deep-chat-dev 9.0.6 → 9.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/deepChat.js CHANGED
@@ -319,130 +319,38 @@ function getInvalidResponseMessage(r, e, t, n) {
319
319
  return "".concat(s + o, "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
320
320
  }
321
321
  var ErrorMessages = {
322
- INVALID_KEY: "Invalid API Key",
323
- CONNECTION_FAILED: "Failed to connect",
324
- INVALID_RESPONSE: getInvalidResponseMessage,
325
- INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
326
- },
327
- _RequestUtils = /*#__PURE__*/function () {
328
- function D() {
329
- _classCallCheck(this, D);
330
- }
331
- _createClass(D, null, [{
332
- key: "temporarilyRemoveHeader",
333
- value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
334
- // prettier-ignore
335
- function () {
336
- var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, t, n) {
337
- var s;
338
- return _regeneratorRuntime().wrap(function _callee$(_context) {
339
- while (1) switch (_context.prev = _context.next) {
340
- case 0:
341
- if (e != null && e.headers) {
342
- _context.next = 2;
343
- break;
344
- }
345
- throw new Error("Request settings have not been set up");
346
- case 2:
347
- s = e.headers[D.CONTENT_TYPE];
348
- delete e.headers[D.CONTENT_TYPE];
349
- _context.next = 6;
350
- return t(n);
351
- case 6:
352
- e.headers[D.CONTENT_TYPE] = s;
353
- case 7:
354
- case "end":
355
- return _context.stop();
356
- }
357
- }, _callee);
358
- }));
359
- function temporarilyRemoveHeader(_x, _x2, _x3) {
360
- return _temporarilyRemoveHeader.apply(this, arguments);
361
- }
362
- return temporarilyRemoveHeader;
363
- }()
364
- }, {
365
- key: "displayError",
366
- value: function displayError(e, t) {
367
- var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
368
- if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
369
- e.addNewErrorMessage("service", t);
370
- }
371
- }, {
372
- key: "processResponseByType",
373
- value: function processResponseByType(e) {
374
- var t = e.headers.get("content-type");
375
- return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
376
- }
377
- }, {
378
- key: "processRequestInterceptor",
379
- value: function () {
380
- var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
381
- var a, n, s, o;
382
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
383
- while (1) switch (_context2.prev = _context2.next) {
384
- case 0:
385
- _context2.next = 2;
386
- return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
387
- case 2:
388
- _context2.t0 = _context2.sent;
389
- if (_context2.t0) {
390
- _context2.next = 5;
391
- break;
392
- }
393
- _context2.t0 = t;
394
- case 5:
395
- n = _context2.t0;
396
- s = n;
397
- o = n;
398
- return _context2.abrupt("return", {
399
- body: s.body,
400
- headers: s.headers,
401
- error: o.error
402
- });
403
- case 9:
404
- case "end":
405
- return _context2.stop();
406
- }
407
- }, _callee2);
408
- }));
409
- function processRequestInterceptor(_x4, _x5) {
410
- return _processRequestInterceptor.apply(this, arguments);
411
- }
412
- return processRequestInterceptor;
413
- }()
414
- }]);
415
- return D;
416
- }();
417
- _RequestUtils.CONTENT_TYPE = "Content-Type";
418
- var RequestUtils = _RequestUtils;
419
- function getBytes(_x6, _x7) {
322
+ INVALID_KEY: "Invalid API Key",
323
+ CONNECTION_FAILED: "Failed to connect",
324
+ INVALID_RESPONSE: getInvalidResponseMessage,
325
+ INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
326
+ };
327
+ function getBytes(_x, _x2) {
420
328
  return _getBytes.apply(this, arguments);
421
329
  }
422
330
  function _getBytes() {
423
- _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r, e) {
331
+ _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(r, e) {
424
332
  var t, n;
425
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
426
- while (1) switch (_context71.prev = _context71.next) {
333
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
334
+ while (1) switch (_context74.prev = _context74.next) {
427
335
  case 0:
428
336
  t = r.getReader();
429
337
  case 1:
430
- _context71.next = 3;
338
+ _context74.next = 3;
431
339
  return t.read();
432
340
  case 3:
433
- if ((n = _context71.sent).done) {
434
- _context71.next = 7;
341
+ if ((n = _context74.sent).done) {
342
+ _context74.next = 7;
435
343
  break;
436
344
  }
437
345
  e(n.value);
438
346
  case 5:
439
- _context71.next = 1;
347
+ _context74.next = 1;
440
348
  break;
441
349
  case 7:
442
350
  case "end":
443
- return _context71.stop();
351
+ return _context74.stop();
444
352
  }
445
- }, _callee71);
353
+ }, _callee74);
446
354
  }));
447
355
  return _getBytes.apply(this, arguments);
448
356
  }
@@ -531,81 +439,254 @@ function fetchEventSource(r, e) {
531
439
  c = e.openWhenHidden,
532
440
  u = e.fetch,
533
441
  d = __rest(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
534
- return new Promise(function (h, p) {
535
- var f = Object.assign({}, n);
536
- f.accept || (f.accept = EventStreamContentType);
442
+ return new Promise(function (h, f) {
443
+ var p = Object.assign({}, n);
444
+ p.accept || (p.accept = EventStreamContentType);
537
445
  var b;
538
446
  function m() {
539
- b.abort(), document.hidden || I();
447
+ b.abort(), document.hidden || x();
540
448
  }
541
449
  c || document.addEventListener("visibilitychange", m);
542
- var v = DefaultRetryInterval,
543
- g = 0;
450
+ var g = DefaultRetryInterval,
451
+ v = 0;
544
452
  function y() {
545
- document.removeEventListener("visibilitychange", m), window.clearTimeout(g), b.abort();
453
+ document.removeEventListener("visibilitychange", m), window.clearTimeout(v), b.abort();
546
454
  }
547
455
  t == null || t.addEventListener("abort", function () {
548
456
  y(), h();
549
457
  });
550
- var x = u !== null && u !== void 0 ? u : window.fetch,
551
- _ = s !== null && s !== void 0 ? s : defaultOnOpen;
552
- function I() {
553
- return _I.apply(this, arguments);
554
- }
555
- function _I() {
556
- _I = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
557
- var R, w, S;
558
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
559
- while (1) switch (_context3.prev = _context3.next) {
458
+ var S = u !== null && u !== void 0 ? u : window.fetch,
459
+ E = s !== null && s !== void 0 ? s : defaultOnOpen;
460
+ function x() {
461
+ return _x3.apply(this, arguments);
462
+ }
463
+ function _x3() {
464
+ _x3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
465
+ var R, C, _;
466
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
467
+ while (1) switch (_context.prev = _context.next) {
560
468
  case 0:
561
469
  b = new AbortController();
562
- _context3.prev = 1;
563
- _context3.next = 4;
564
- return x(r, Object.assign(Object.assign({}, d), {
565
- headers: f,
470
+ _context.prev = 1;
471
+ _context.next = 4;
472
+ return S(r, Object.assign(Object.assign({}, d), {
473
+ headers: p,
566
474
  signal: b.signal
567
475
  }));
568
476
  case 4:
569
- w = _context3.sent;
570
- _context3.next = 7;
571
- return _(w);
477
+ C = _context.sent;
478
+ _context.next = 7;
479
+ return E(C);
572
480
  case 7:
573
- _context3.next = 9;
574
- return getBytes(w.body, getLines(getMessages(function (S) {
575
- S ? f[LastEventId] = S : delete f[LastEventId];
576
- }, function (S) {
577
- v = S;
481
+ _context.next = 9;
482
+ return getBytes(C.body, getLines(getMessages(function (_) {
483
+ _ ? p[LastEventId] = _ : delete p[LastEventId];
484
+ }, function (_) {
485
+ g = _;
578
486
  }, o)));
579
487
  case 9:
580
488
  a == null || a();
581
489
  y();
582
490
  h();
583
- _context3.next = 17;
491
+ _context.next = 17;
584
492
  break;
585
493
  case 14:
586
- _context3.prev = 14;
587
- _context3.t0 = _context3["catch"](1);
494
+ _context.prev = 14;
495
+ _context.t0 = _context["catch"](1);
588
496
  if (!b.signal.aborted) try {
589
- S = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : v;
590
- window.clearTimeout(g), g = window.setTimeout(I, S);
591
- } catch (S) {
592
- y(), p(S);
497
+ _ = (R = l == null ? void 0 : l(_context.t0)) !== null && R !== void 0 ? R : g;
498
+ window.clearTimeout(v), v = window.setTimeout(x, _);
499
+ } catch (_) {
500
+ y(), f(_);
593
501
  }
594
502
  case 17:
595
503
  case "end":
596
- return _context3.stop();
504
+ return _context.stop();
597
505
  }
598
- }, _callee3, null, [[1, 14]]);
506
+ }, _callee, null, [[1, 14]]);
599
507
  }));
600
- return _I.apply(this, arguments);
508
+ return _x3.apply(this, arguments);
601
509
  }
602
- I();
510
+ x();
603
511
  });
604
512
  }
605
513
  function defaultOnOpen(r) {
606
514
  var e = r.headers.get("content-type");
607
515
  if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
608
516
  }
517
+ var _RequestUtils = /*#__PURE__*/function () {
518
+ function D() {
519
+ _classCallCheck(this, D);
520
+ }
521
+ _createClass(D, null, [{
522
+ key: "temporarilyRemoveHeader",
523
+ value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
524
+ // prettier-ignore
525
+ function () {
526
+ var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t, n) {
527
+ var s;
528
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
529
+ while (1) switch (_context2.prev = _context2.next) {
530
+ case 0:
531
+ if (e != null && e.headers) {
532
+ _context2.next = 2;
533
+ break;
534
+ }
535
+ throw new Error("Request settings have not been set up");
536
+ case 2:
537
+ s = e.headers[D.CONTENT_TYPE];
538
+ delete e.headers[D.CONTENT_TYPE];
539
+ _context2.next = 6;
540
+ return t(n);
541
+ case 6:
542
+ e.headers[D.CONTENT_TYPE] = s;
543
+ case 7:
544
+ case "end":
545
+ return _context2.stop();
546
+ }
547
+ }, _callee2);
548
+ }));
549
+ function temporarilyRemoveHeader(_x4, _x5, _x6) {
550
+ return _temporarilyRemoveHeader.apply(this, arguments);
551
+ }
552
+ return temporarilyRemoveHeader;
553
+ }()
554
+ }, {
555
+ key: "displayError",
556
+ value: function displayError(e, t) {
557
+ var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
558
+ if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
559
+ e.addNewErrorMessage("service", t);
560
+ }
561
+ }, {
562
+ key: "processResponseByType",
563
+ value: function processResponseByType(e) {
564
+ var t = e.headers.get("content-type");
565
+ return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
566
+ }
567
+ }, {
568
+ key: "processRequestInterceptor",
569
+ value: function () {
570
+ var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, t) {
571
+ var a, n, s, o;
572
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
573
+ while (1) switch (_context3.prev = _context3.next) {
574
+ case 0:
575
+ _context3.next = 2;
576
+ return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
577
+ case 2:
578
+ _context3.t0 = _context3.sent;
579
+ if (_context3.t0) {
580
+ _context3.next = 5;
581
+ break;
582
+ }
583
+ _context3.t0 = t;
584
+ case 5:
585
+ n = _context3.t0;
586
+ s = n;
587
+ o = n;
588
+ return _context3.abrupt("return", {
589
+ body: s.body,
590
+ headers: s.headers,
591
+ error: o.error
592
+ });
593
+ case 9:
594
+ case "end":
595
+ return _context3.stop();
596
+ }
597
+ }, _callee3);
598
+ }));
599
+ function processRequestInterceptor(_x7, _x8) {
600
+ return _processRequestInterceptor.apply(this, arguments);
601
+ }
602
+ return processRequestInterceptor;
603
+ }()
604
+ }]);
605
+ return D;
606
+ }();
607
+ _RequestUtils.CONTENT_TYPE = "Content-Type";
608
+ var RequestUtils = _RequestUtils;
609
+ var _Demo = /*#__PURE__*/function () {
610
+ function A() {
611
+ _classCallCheck(this, A);
612
+ }
613
+ _createClass(A, null, [{
614
+ key: "generateResponseForOneMessage",
615
+ value: function generateResponseForOneMessage(e) {
616
+ if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
617
+ if (e.text) {
618
+ if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
619
+ if (e.text.includes("updog")) return "What's updog?";
620
+ }
621
+ return "Hi there! This is a demo response!";
622
+ }
623
+ }, {
624
+ key: "generateResponse",
625
+ value: function generateResponse(e) {
626
+ var t = [];
627
+ for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
628
+ if (t.length === 1) return A.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
629
+ var n = e.messages.findIndex(function (s) {
630
+ return s.text;
631
+ });
632
+ return n !== -1 && t.splice(n, 1), t.length === 1 ? A.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
633
+ }
634
+ }, {
635
+ key: "getCustomResponse",
636
+ value: function getCustomResponse(e, t) {
637
+ return typeof e == "function" ? e(t) : e;
638
+ }
639
+ }, {
640
+ key: "getResponse",
641
+ value: function getResponse(e) {
642
+ return e.customDemoResponse ? A.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
643
+ text: A.generateResponse(e)
644
+ };
645
+ }
646
+ // timeout is used to simulate a timeout for a response to come back
647
+ }, {
648
+ key: "request",
649
+ value: function request(e, t, n) {
650
+ var s = A.getResponse(e);
651
+ setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
652
+ var o;
653
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
654
+ while (1) switch (_context4.prev = _context4.next) {
655
+ case 0:
656
+ _context4.next = 2;
657
+ return n == null ? void 0 : n(s);
658
+ case 2:
659
+ _context4.t0 = _context4.sent;
660
+ if (_context4.t0) {
661
+ _context4.next = 5;
662
+ break;
663
+ }
664
+ _context4.t0 = s;
665
+ case 5:
666
+ o = _context4.t0;
667
+ o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
668
+ case 7:
669
+ case "end":
670
+ return _context4.stop();
671
+ }
672
+ }, _callee4);
673
+ })), 400);
674
+ }
675
+ // timeout is used to simulate a timeout for a response to come back
676
+ }, {
677
+ key: "requestStream",
678
+ value: function requestStream(e, t) {
679
+ setTimeout(function () {
680
+ var s;
681
+ var n = (s = A.getResponse(e)) == null ? void 0 : s.text;
682
+ Stream.simulate(e, t, n);
683
+ }, 400);
684
+ }
685
+ }]);
686
+ return A;
687
+ }();
688
+ _Demo.URL = "deep-chat-demo";
689
+ var Demo = _Demo;
609
690
  var Stream = /*#__PURE__*/function () {
610
691
  function Stream() {
611
692
  _classCallCheck(this, Stream);
@@ -614,11 +695,12 @@ var Stream = /*#__PURE__*/function () {
614
695
  key: "request",
615
696
  value: // prettier-ignore
616
697
  function () {
617
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, t, n) {
698
+ var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
618
699
  var s,
619
- f,
700
+ p,
620
701
  b,
621
702
  m,
703
+ g,
622
704
  v,
623
705
  o,
624
706
  _yield$RequestUtils$p,
@@ -629,20 +711,20 @@ var Stream = /*#__PURE__*/function () {
629
711
  u,
630
712
  d,
631
713
  h,
632
- p,
633
- _args5 = arguments;
634
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
635
- while (1) switch (_context5.prev = _context5.next) {
714
+ f,
715
+ _args6 = arguments;
716
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
717
+ while (1) switch (_context6.prev = _context6.next) {
636
718
  case 0:
637
- s = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : !0;
719
+ s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
638
720
  o = {
639
721
  body: t,
640
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
722
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
641
723
  };
642
- _context5.next = 4;
724
+ _context6.next = 4;
643
725
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
644
726
  case 4:
645
- _yield$RequestUtils$p = _context5.sent;
727
+ _yield$RequestUtils$p = _context6.sent;
646
728
  a = _yield$RequestUtils$p.body;
647
729
  l = _yield$RequestUtils$p.headers;
648
730
  c = _yield$RequestUtils$p.error;
@@ -651,79 +733,85 @@ var Stream = /*#__PURE__*/function () {
651
733
  d = _e$streamHandlers.onClose;
652
734
  h = _e$streamHandlers.abortStream;
653
735
  if (!c) {
654
- _context5.next = 14;
736
+ _context6.next = 14;
655
737
  break;
656
738
  }
657
- return _context5.abrupt("return", Stream.onInterceptorError(n, c, d));
739
+ return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
658
740
  case 14:
659
- if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
660
- _context5.next = 16;
741
+ if (!((b = e.requestSettings) != null && b.handler)) {
742
+ _context6.next = 16;
661
743
  break;
662
744
  }
663
- return _context5.abrupt("return", Demo.requestStream(n, e.streamHandlers));
745
+ return _context6.abrupt("return", CustomHandler.stream(e, a, n));
664
746
  case 16:
665
- p = null;
666
- fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
747
+ if (!(((m = e.requestSettings) == null ? void 0 : m.url) === Demo.URL)) {
748
+ _context6.next = 18;
749
+ break;
750
+ }
751
+ return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
752
+ case 18:
753
+ f = null;
754
+ fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
667
755
  method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
668
756
  headers: l,
669
757
  body: s ? JSON.stringify(a) : a,
670
758
  openWhenHidden: !0,
671
759
  // keep stream open when browser tab not open
672
- onopen: function onopen(g) {
673
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
674
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
675
- while (1) switch (_context4.prev = _context4.next) {
760
+ onopen: function onopen(y) {
761
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
762
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
763
+ while (1) switch (_context5.prev = _context5.next) {
676
764
  case 0:
677
- if (!g.ok) {
678
- _context4.next = 2;
765
+ if (!y.ok) {
766
+ _context5.next = 2;
679
767
  break;
680
768
  }
681
- return _context4.abrupt("return", (p = n.addNewStreamedMessage(), u()));
769
+ return _context5.abrupt("return", (f = n.addNewStreamedMessage(), u()));
682
770
  case 2:
683
- _context4.next = 4;
684
- return RequestUtils.processResponseByType(g);
771
+ _context5.next = 4;
772
+ return RequestUtils.processResponseByType(y);
685
773
  case 4:
686
- throw _context4.sent;
774
+ throw _context5.sent;
687
775
  case 5:
688
776
  case "end":
689
- return _context4.stop();
777
+ return _context5.stop();
690
778
  }
691
- }, _callee4);
779
+ }, _callee5);
692
780
  }))();
693
781
  },
694
- onmessage: function onmessage(g) {
695
- var y;
696
- if (JSON.stringify(g.data) !== JSON.stringify("[DONE]")) {
697
- var x = JSON.parse(g.data);
698
- (y = e.extractResultData) == null || y.call(e, x).then(function (_) {
699
- (_ == null ? void 0 : _.text) === void 0 ? console.error("Response data: ".concat(g.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(_.text, p);
700
- })["catch"](function (_) {
701
- return RequestUtils.displayError(n, _);
782
+ onmessage: function onmessage(y) {
783
+ var S;
784
+ if (JSON.stringify(y.data) !== JSON.stringify("[DONE]")) {
785
+ var E = JSON.parse(y.data);
786
+ (S = e.extractResultData) == null || S.call(e, E).then(function (x) {
787
+ (x == null ? void 0 : x.text) === void 0 ? console.error("Response data: ".concat(y.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : f && n.updateStreamedMessage(x.text, f);
788
+ })["catch"](function (x) {
789
+ return RequestUtils.displayError(n, x);
702
790
  });
703
791
  }
704
792
  },
705
- onerror: function onerror(g) {
706
- throw d(), g;
793
+ onerror: function onerror(y) {
794
+ throw d(), y;
707
795
  },
708
796
  onclose: function onclose() {
709
797
  n.finaliseStreamedMessage(), d();
710
798
  },
711
799
  signal: h.signal
712
- })["catch"](function (g) {
713
- var y;
714
- (y = e.extractResultData) == null || y.call(e, g).then(function () {
715
- RequestUtils.displayError(n, g);
716
- })["catch"](function (x) {
717
- RequestUtils.displayError(n, x);
800
+ })["catch"](function (y) {
801
+ var S;
802
+ (S = e.extractResultData) == null || S.call(e, y).then(function () {
803
+ RequestUtils.displayError(n, y);
804
+ })["catch"](function (E) {
805
+ RequestUtils.displayError(n, E);
718
806
  });
719
807
  });
720
- case 18:
808
+ case 20:
721
809
  case "end":
722
- return _context5.stop();
810
+ return _context6.stop();
723
811
  }
724
- }, _callee5);
812
+ }, _callee6);
725
813
  }));
726
- function request(_x8, _x9, _x10) {
814
+ function request(_x9, _x10, _x11) {
727
815
  return _request.apply(this, arguments);
728
816
  }
729
817
  return request;
@@ -765,87 +853,172 @@ var Stream = /*#__PURE__*/function () {
765
853
  }]);
766
854
  return Stream;
767
855
  }();
768
- var _Demo = /*#__PURE__*/function () {
769
- function C() {
770
- _classCallCheck(this, C);
856
+ var CustomHandler = /*#__PURE__*/function () {
857
+ function CustomHandler() {
858
+ _classCallCheck(this, CustomHandler);
771
859
  }
772
- _createClass(C, null, [{
773
- key: "generateResponseForOneMessage",
774
- value: function generateResponseForOneMessage(e) {
775
- if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
776
- if (e.text) {
777
- if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
778
- if (e.text.includes("updog")) return "What's updog?";
860
+ _createClass(CustomHandler, null, [{
861
+ key: "request",
862
+ value: function () {
863
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
864
+ var l, c, s, o, a;
865
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
866
+ while (1) switch (_context8.prev = _context8.next) {
867
+ case 0:
868
+ s = !0;
869
+ o = /*#__PURE__*/function () {
870
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(u) {
871
+ var h, f, d;
872
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
873
+ while (1) switch (_context7.prev = _context7.next) {
874
+ case 0:
875
+ if (s) {
876
+ _context7.next = 2;
877
+ break;
878
+ }
879
+ return _context7.abrupt("return");
880
+ case 2:
881
+ s = !1;
882
+ _context7.next = 5;
883
+ return (f = (h = e.deepChat).responseInterceptor) == null ? void 0 : f.call(h, u);
884
+ case 5:
885
+ _context7.t0 = _context7.sent;
886
+ if (_context7.t0) {
887
+ _context7.next = 8;
888
+ break;
889
+ }
890
+ _context7.t0 = u;
891
+ case 8:
892
+ d = _context7.t0;
893
+ !d || _typeof(d) != "object" || typeof d.error != "string" && typeof d.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(u, "server", !!e.deepChat.responseInterceptor, d)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof d.error == "string" ? (console.error(d.error), n.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && d.text ? Stream.simulate(n, e.streamHandlers, d.text) : (n.addNewMessage(d, !0, !0), e.completionsHandlers.onFinish());
894
+ case 10:
895
+ case "end":
896
+ return _context7.stop();
897
+ }
898
+ }, _callee7);
899
+ }));
900
+ return function o(_x15) {
901
+ return _ref2.apply(this, arguments);
902
+ };
903
+ }(), a = CustomHandler.generateOptionalSignals();
904
+ (c = (l = e.requestSettings).handler) == null || c.call(l, t, _objectSpread(_objectSpread({}, a), {}, {
905
+ onResponse: o
906
+ }));
907
+ case 3:
908
+ case "end":
909
+ return _context8.stop();
910
+ }
911
+ }, _callee8);
912
+ }));
913
+ function request(_x12, _x13, _x14) {
914
+ return _request2.apply(this, arguments);
779
915
  }
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
- }
916
+ return request;
917
+ }() // prettier-ignore
798
918
  }, {
799
- key: "getResponse",
800
- value: function getResponse(e) {
801
- return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
802
- text: C.generateResponse(e)
919
+ key: "stream",
920
+ value: function stream(e, t, n) {
921
+ var h, f;
922
+ var s = !0,
923
+ o = !1,
924
+ a = null;
925
+ var l = function l() {
926
+ o || !s || (a = n.addNewStreamedMessage(), e.streamHandlers.onOpen(), o = !0);
927
+ },
928
+ c = function c() {
929
+ s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
930
+ },
931
+ u = function u(p) {
932
+ s && (!p || _typeof(p) != "object" || typeof p.error != "string" && typeof p.text != "string" ? console.error(ErrorMessages.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
933
+ };
934
+ e.streamHandlers.abortStream.abort = function () {
935
+ n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
803
936
  };
937
+ var d = CustomHandler.generateOptionalSignals();
938
+ (f = (h = e.requestSettings).handler) == null || f.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
939
+ onOpen: l,
940
+ onResponse: u,
941
+ onClose: c,
942
+ stopClicked: e.streamHandlers.stopClicked
943
+ }));
804
944
  }
805
- // timeout is used to simulate a timeout for a response to come back
945
+ // prettier-ignore
806
946
  }, {
807
- key: "request",
808
- value: function request(e, t, n) {
809
- var s = C.getResponse(e);
810
- setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
811
- var o;
812
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
813
- while (1) switch (_context6.prev = _context6.next) {
814
- case 0:
815
- _context6.next = 2;
816
- return n == null ? void 0 : n(s);
817
- case 2:
818
- _context6.t0 = _context6.sent;
819
- if (_context6.t0) {
820
- _context6.next = 5;
821
- break;
947
+ key: "websocket",
948
+ value: function websocket(e, t) {
949
+ var c, u;
950
+ var n = {
951
+ isOpen: !1,
952
+ newUserMessage: {
953
+ listener: function listener() {}
954
+ }
955
+ };
956
+ e.websocket = n;
957
+ var s = function s() {
958
+ t.removeError(), n.isOpen = !0;
959
+ },
960
+ o = function o() {
961
+ n.isOpen = !1;
962
+ },
963
+ a = /*#__PURE__*/function () {
964
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(d) {
965
+ var f, p, h;
966
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
967
+ while (1) switch (_context9.prev = _context9.next) {
968
+ case 0:
969
+ if (n.isOpen) {
970
+ _context9.next = 2;
971
+ break;
972
+ }
973
+ return _context9.abrupt("return");
974
+ case 2:
975
+ _context9.next = 4;
976
+ return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
977
+ case 4:
978
+ _context9.t0 = _context9.sent;
979
+ if (_context9.t0) {
980
+ _context9.next = 7;
981
+ break;
982
+ }
983
+ _context9.t0 = d;
984
+ case 7:
985
+ h = _context9.t0;
986
+ !h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message")) : typeof h.error == "string" ? (console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error)) : e.deepChat.stream ? Stream.simulate(t, e.streamHandlers, h.text) : t.addNewMessage(h, !0, !0);
987
+ case 9:
988
+ case "end":
989
+ return _context9.stop();
822
990
  }
823
- _context6.t0 = s;
824
- case 5:
825
- o = _context6.t0;
826
- o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
827
- case 7:
828
- case "end":
829
- return _context6.stop();
830
- }
831
- }, _callee6);
832
- })), 400);
991
+ }, _callee9);
992
+ }));
993
+ return function a(_x16) {
994
+ return _ref3.apply(this, arguments);
995
+ };
996
+ }(),
997
+ l = CustomHandler.generateOptionalSignals();
998
+ (u = (c = e.requestSettings).handler) == null || u.call(c, void 0, _objectSpread(_objectSpread({}, l), {}, {
999
+ onOpen: s,
1000
+ onResponse: a,
1001
+ onClose: o,
1002
+ newUserMessage: n.newUserMessage
1003
+ }));
833
1004
  }
834
- // timeout is used to simulate a timeout for a response to come back
835
1005
  }, {
836
- key: "requestStream",
837
- value: function requestStream(e, t) {
838
- setTimeout(function () {
839
- var s;
840
- var n = (s = C.getResponse(e)) == null ? void 0 : s.text;
841
- Stream.simulate(e, t, n);
842
- }, 400);
1006
+ key: "generateOptionalSignals",
1007
+ value: function generateOptionalSignals() {
1008
+ return {
1009
+ onClose: function onClose() {},
1010
+ onOpen: function onOpen() {},
1011
+ stopClicked: {
1012
+ listener: function listener() {}
1013
+ },
1014
+ newUserMessage: {
1015
+ listener: function listener() {}
1016
+ }
1017
+ };
843
1018
  }
844
1019
  }]);
845
- return C;
1020
+ return CustomHandler;
846
1021
  }();
847
- _Demo.URL = "deep-chat-demo";
848
- var Demo = _Demo;
849
1022
  var HTTPRequest = /*#__PURE__*/function () {
850
1023
  function HTTPRequest() {
851
1024
  _classCallCheck(this, HTTPRequest);
@@ -854,12 +1027,13 @@ var HTTPRequest = /*#__PURE__*/function () {
854
1027
  key: "request",
855
1028
  value: // prettier-ignore
856
1029
  function () {
857
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
1030
+ var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, n) {
858
1031
  var s,
859
1032
  h,
860
- p,
861
1033
  f,
1034
+ p,
862
1035
  b,
1036
+ m,
863
1037
  o,
864
1038
  _yield$RequestUtils$p2,
865
1039
  a,
@@ -867,104 +1041,110 @@ var HTTPRequest = /*#__PURE__*/function () {
867
1041
  c,
868
1042
  u,
869
1043
  d,
870
- _args8 = arguments;
871
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
872
- while (1) switch (_context8.prev = _context8.next) {
1044
+ _args11 = arguments;
1045
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1046
+ while (1) switch (_context11.prev = _context11.next) {
873
1047
  case 0:
874
- s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
1048
+ s = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : !0;
875
1049
  o = {
876
1050
  body: t,
877
1051
  headers: (h = e.requestSettings) == null ? void 0 : h.headers
878
1052
  };
879
- _context8.next = 4;
1053
+ _context11.next = 4;
880
1054
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
881
1055
  case 4:
882
- _yield$RequestUtils$p2 = _context8.sent;
1056
+ _yield$RequestUtils$p2 = _context11.sent;
883
1057
  a = _yield$RequestUtils$p2.body;
884
1058
  l = _yield$RequestUtils$p2.headers;
885
1059
  c = _yield$RequestUtils$p2.error;
886
1060
  u = e.completionsHandlers.onFinish;
887
1061
  if (!c) {
888
- _context8.next = 11;
1062
+ _context11.next = 11;
889
1063
  break;
890
1064
  }
891
- return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1065
+ return _context11.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
892
1066
  case 11:
893
- if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
894
- _context8.next = 13;
1067
+ if (!((f = e.requestSettings) != null && f.handler)) {
1068
+ _context11.next = 13;
895
1069
  break;
896
1070
  }
897
- return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1071
+ return _context11.abrupt("return", CustomHandler.request(e, a, n));
898
1072
  case 13:
1073
+ if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
1074
+ _context11.next = 15;
1075
+ break;
1076
+ }
1077
+ return _context11.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1078
+ case 15:
899
1079
  d = !0;
900
- fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
901
- method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
1080
+ fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
1081
+ method: ((m = e.requestSettings) == null ? void 0 : m.method) || "POST",
902
1082
  headers: l,
903
1083
  body: s ? JSON.stringify(a) : a
904
- }).then(function (m) {
905
- return d = !!m.ok, m;
906
- }).then(function (m) {
907
- return RequestUtils.processResponseByType(m);
1084
+ }).then(function (g) {
1085
+ return d = !!g.ok, g;
1086
+ }).then(function (g) {
1087
+ return RequestUtils.processResponseByType(g);
908
1088
  }).then( /*#__PURE__*/function () {
909
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(m) {
910
- var y, x, v, g;
911
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
912
- while (1) switch (_context7.prev = _context7.next) {
1089
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(g) {
1090
+ var S, E, v, y;
1091
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1092
+ while (1) switch (_context10.prev = _context10.next) {
913
1093
  case 0:
914
1094
  if (e.extractResultData) {
915
- _context7.next = 2;
1095
+ _context10.next = 2;
916
1096
  break;
917
1097
  }
918
- return _context7.abrupt("return");
1098
+ return _context10.abrupt("return");
919
1099
  case 2:
920
- _context7.next = 4;
921
- return (x = (y = e.deepChat).responseInterceptor) == null ? void 0 : x.call(y, m);
1100
+ _context10.next = 4;
1101
+ return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
922
1102
  case 4:
923
- _context7.t0 = _context7.sent;
924
- if (_context7.t0) {
925
- _context7.next = 7;
1103
+ _context10.t0 = _context10.sent;
1104
+ if (_context10.t0) {
1105
+ _context10.next = 7;
926
1106
  break;
927
1107
  }
928
- _context7.t0 = m;
1108
+ _context10.t0 = g;
929
1109
  case 7:
930
- v = _context7.t0;
931
- _context7.next = 10;
1110
+ v = _context10.t0;
1111
+ _context10.next = 10;
932
1112
  return e.extractResultData(v);
933
1113
  case 10:
934
- g = _context7.sent;
1114
+ y = _context10.sent;
935
1115
  if (d) {
936
- _context7.next = 13;
1116
+ _context10.next = 13;
937
1117
  break;
938
1118
  }
939
- throw m;
1119
+ throw g;
940
1120
  case 13:
941
- if (!(!g || _typeof(g) != "object")) {
942
- _context7.next = 15;
1121
+ if (!(!y || _typeof(y) != "object")) {
1122
+ _context10.next = 15;
943
1123
  break;
944
1124
  }
945
- throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
1125
+ throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
946
1126
  case 15:
947
- g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
1127
+ y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
948
1128
  case 16:
949
1129
  case "end":
950
- return _context7.stop();
1130
+ return _context10.stop();
951
1131
  }
952
- }, _callee7);
1132
+ }, _callee10);
953
1133
  }));
954
- return function (_x14) {
955
- return _ref2.apply(this, arguments);
1134
+ return function (_x20) {
1135
+ return _ref4.apply(this, arguments);
956
1136
  };
957
- }())["catch"](function (m) {
958
- RequestUtils.displayError(n, m), u();
1137
+ }())["catch"](function (g) {
1138
+ RequestUtils.displayError(n, g), u();
959
1139
  });
960
- case 15:
1140
+ case 17:
961
1141
  case "end":
962
- return _context8.stop();
1142
+ return _context11.stop();
963
1143
  }
964
- }, _callee8);
1144
+ }, _callee11);
965
1145
  }));
966
- function request(_x11, _x12, _x13) {
967
- return _request2.apply(this, arguments);
1146
+ function request(_x17, _x18, _x19) {
1147
+ return _request3.apply(this, arguments);
968
1148
  }
969
1149
  return request;
970
1150
  }() // prettier-ignore
@@ -976,44 +1156,44 @@ var HTTPRequest = /*#__PURE__*/function () {
976
1156
  fetch(t, n).then(function (a) {
977
1157
  return a.json();
978
1158
  }).then( /*#__PURE__*/function () {
979
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
1159
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(a) {
980
1160
  var c, u, l;
981
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
982
- while (1) switch (_context9.prev = _context9.next) {
1161
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1162
+ while (1) switch (_context12.prev = _context12.next) {
983
1163
  case 0:
984
1164
  if (e.extractPollResultData) {
985
- _context9.next = 2;
1165
+ _context12.next = 2;
986
1166
  break;
987
1167
  }
988
- return _context9.abrupt("return");
1168
+ return _context12.abrupt("return");
989
1169
  case 2:
990
- _context9.t0 = e;
991
- _context9.next = 5;
1170
+ _context12.t0 = e;
1171
+ _context12.next = 5;
992
1172
  return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
993
1173
  case 5:
994
- _context9.t1 = _context9.sent;
995
- if (_context9.t1) {
996
- _context9.next = 8;
1174
+ _context12.t1 = _context12.sent;
1175
+ if (_context12.t1) {
1176
+ _context12.next = 8;
997
1177
  break;
998
1178
  }
999
- _context9.t1 = a;
1179
+ _context12.t1 = a;
1000
1180
  case 8:
1001
- _context9.t2 = _context9.t1;
1002
- _context9.next = 11;
1003
- return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
1181
+ _context12.t2 = _context12.t1;
1182
+ _context12.next = 11;
1183
+ return _context12.t0.extractPollResultData.call(_context12.t0, _context12.t2);
1004
1184
  case 11:
1005
- l = _context9.sent;
1185
+ l = _context12.sent;
1006
1186
  l.timeoutMS ? setTimeout(function () {
1007
1187
  HTTPRequest.executePollRequest(e, t, n, s);
1008
1188
  }, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
1009
1189
  case 13:
1010
1190
  case "end":
1011
- return _context9.stop();
1191
+ return _context12.stop();
1012
1192
  }
1013
- }, _callee9);
1193
+ }, _callee12);
1014
1194
  }));
1015
- return function (_x15) {
1016
- return _ref3.apply(this, arguments);
1195
+ return function (_x21) {
1196
+ return _ref5.apply(this, arguments);
1017
1197
  };
1018
1198
  }())["catch"](function (a) {
1019
1199
  RequestUtils.displayError(s, a), o();
@@ -1023,9 +1203,9 @@ var HTTPRequest = /*#__PURE__*/function () {
1023
1203
  }, {
1024
1204
  key: "poll",
1025
1205
  value: function () {
1026
- var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
1206
+ var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
1027
1207
  var s,
1028
- f,
1208
+ p,
1029
1209
  b,
1030
1210
  m,
1031
1211
  o,
@@ -1036,42 +1216,42 @@ var HTTPRequest = /*#__PURE__*/function () {
1036
1216
  u,
1037
1217
  d,
1038
1218
  h,
1039
- p,
1040
- _args10 = arguments;
1041
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1042
- while (1) switch (_context10.prev = _context10.next) {
1219
+ f,
1220
+ _args13 = arguments;
1221
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1222
+ while (1) switch (_context13.prev = _context13.next) {
1043
1223
  case 0:
1044
- s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
1224
+ s = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : !0;
1045
1225
  o = {
1046
1226
  body: t,
1047
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
1227
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
1048
1228
  };
1049
- _context10.next = 4;
1229
+ _context13.next = 4;
1050
1230
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
1051
1231
  case 4:
1052
- _yield$RequestUtils$p3 = _context10.sent;
1232
+ _yield$RequestUtils$p3 = _context13.sent;
1053
1233
  a = _yield$RequestUtils$p3.body;
1054
1234
  l = _yield$RequestUtils$p3.headers;
1055
1235
  c = _yield$RequestUtils$p3.error;
1056
1236
  if (!c) {
1057
- _context10.next = 10;
1237
+ _context13.next = 10;
1058
1238
  break;
1059
1239
  }
1060
- return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1240
+ return _context13.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1061
1241
  case 10:
1062
- u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, p = {
1242
+ u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, f = {
1063
1243
  method: d,
1064
1244
  body: h,
1065
1245
  headers: l
1066
1246
  };
1067
- HTTPRequest.executePollRequest(e, u, p, n);
1247
+ HTTPRequest.executePollRequest(e, u, f, n);
1068
1248
  case 12:
1069
1249
  case "end":
1070
- return _context10.stop();
1250
+ return _context13.stop();
1071
1251
  }
1072
- }, _callee10);
1252
+ }, _callee13);
1073
1253
  }));
1074
- function poll(_x16, _x17, _x18) {
1254
+ function poll(_x22, _x23, _x24) {
1075
1255
  return _poll.apply(this, arguments);
1076
1256
  }
1077
1257
  return poll;
@@ -1145,7 +1325,7 @@ var MessageLimitUtils = /*#__PURE__*/function () {
1145
1325
  }, {
1146
1326
  key: "processMessages",
1147
1327
  value: function processMessages(e, t, n, s) {
1148
- return n !== void 0 ? n > 0 && (t = MessageLimitUtils.getMaxMessages(t, n)) : t = MessageLimitUtils.getRequestMessages(e, t), s === void 0 ? t : MessageLimitUtils.getCharacterLimitMessages(t, s);
1328
+ return n !== void 0 ? n > 0 && (t = MessageLimitUtils.getMaxMessages(t, n)) : t = MessageLimitUtils.getRequestMessages(e, t), t = JSON.parse(JSON.stringify(t)), s === void 0 ? t : MessageLimitUtils.getCharacterLimitMessages(t, s);
1149
1329
  }
1150
1330
  }]);
1151
1331
  return MessageLimitUtils;
@@ -1164,16 +1344,19 @@ var Websocket = /*#__PURE__*/function () {
1164
1344
  value: function createConnection(e, t) {
1165
1345
  if (!document.body.contains(e.deepChat)) return;
1166
1346
  var n = e.requestSettings.websocket;
1167
- if (n) try {
1168
- var s = typeof n != "boolean" ? n : void 0,
1169
- o = new WebSocket(e.requestSettings.url || "", s);
1170
- e.websocket = o, e.websocket.onopen = function () {
1171
- t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, o, t);
1172
- }, e.websocket.onerror = function (a) {
1173
- console.error(a), Websocket.retryConnection(e, t);
1174
- };
1175
- } catch (s) {
1176
- console.error(s), Websocket.retryConnection(e, t);
1347
+ if (n) {
1348
+ if (e.requestSettings.handler) return CustomHandler.websocket(e, t);
1349
+ try {
1350
+ var s = typeof n != "boolean" ? n : void 0,
1351
+ o = new WebSocket(e.requestSettings.url || "", s);
1352
+ e.websocket = o, e.websocket.onopen = function () {
1353
+ t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, o, t);
1354
+ }, e.websocket.onerror = function (a) {
1355
+ console.error(a), Websocket.retryConnection(e, t);
1356
+ };
1357
+ } catch (s) {
1358
+ console.error(s), Websocket.retryConnection(e, t);
1359
+ }
1177
1360
  }
1178
1361
  }
1179
1362
  }, {
@@ -1187,53 +1370,53 @@ var Websocket = /*#__PURE__*/function () {
1187
1370
  key: "assignListeners",
1188
1371
  value: function assignListeners(e, t, n) {
1189
1372
  t.onmessage = /*#__PURE__*/function () {
1190
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
1373
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
1191
1374
  var o, a, l, c, u;
1192
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1193
- while (1) switch (_context11.prev = _context11.next) {
1375
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1376
+ while (1) switch (_context14.prev = _context14.next) {
1194
1377
  case 0:
1195
1378
  if (!e.extractResultData) {
1196
- _context11.next = 20;
1379
+ _context14.next = 20;
1197
1380
  break;
1198
1381
  }
1199
- _context11.prev = 1;
1382
+ _context14.prev = 1;
1200
1383
  l = JSON.parse(s.data);
1201
- _context11.next = 5;
1384
+ _context14.next = 5;
1202
1385
  return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
1203
1386
  case 5:
1204
- _context11.t0 = _context11.sent;
1205
- if (_context11.t0) {
1206
- _context11.next = 8;
1387
+ _context14.t0 = _context14.sent;
1388
+ if (_context14.t0) {
1389
+ _context14.next = 8;
1207
1390
  break;
1208
1391
  }
1209
- _context11.t0 = l;
1392
+ _context14.t0 = l;
1210
1393
  case 8:
1211
- c = _context11.t0;
1212
- _context11.next = 11;
1394
+ c = _context14.t0;
1395
+ _context14.next = 11;
1213
1396
  return e.extractResultData(c);
1214
1397
  case 11:
1215
- u = _context11.sent;
1398
+ u = _context14.sent;
1216
1399
  if (!(!u || _typeof(u) != "object")) {
1217
- _context11.next = 14;
1400
+ _context14.next = 14;
1218
1401
  break;
1219
1402
  }
1220
1403
  throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
1221
1404
  case 14:
1222
1405
  e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
1223
- _context11.next = 20;
1406
+ _context14.next = 20;
1224
1407
  break;
1225
1408
  case 17:
1226
- _context11.prev = 17;
1227
- _context11.t1 = _context11["catch"](1);
1228
- RequestUtils.displayError(n, _context11.t1, "Error in server message");
1409
+ _context14.prev = 17;
1410
+ _context14.t1 = _context14["catch"](1);
1411
+ RequestUtils.displayError(n, _context14.t1, "Error in server message");
1229
1412
  case 20:
1230
1413
  case "end":
1231
- return _context11.stop();
1414
+ return _context14.stop();
1232
1415
  }
1233
- }, _callee11, null, [[1, 17]]);
1416
+ }, _callee14, null, [[1, 17]]);
1234
1417
  }));
1235
- return function (_x19) {
1236
- return _ref4.apply(this, arguments);
1418
+ return function (_x25) {
1419
+ return _ref6.apply(this, arguments);
1237
1420
  };
1238
1421
  }(), t.onclose = function () {
1239
1422
  console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
@@ -1242,7 +1425,7 @@ var Websocket = /*#__PURE__*/function () {
1242
1425
  }, {
1243
1426
  key: "sendWebsocket",
1244
1427
  value: function () {
1245
- var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
1428
+ var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, n) {
1246
1429
  var s,
1247
1430
  d,
1248
1431
  h,
@@ -1252,55 +1435,55 @@ var Websocket = /*#__PURE__*/function () {
1252
1435
  l,
1253
1436
  c,
1254
1437
  u,
1255
- _args12 = arguments;
1256
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1257
- while (1) switch (_context12.prev = _context12.next) {
1438
+ _args15 = arguments;
1439
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1440
+ while (1) switch (_context15.prev = _context15.next) {
1258
1441
  case 0:
1259
- s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
1442
+ s = _args15.length > 3 && _args15[3] !== undefined ? _args15[3] : !0;
1260
1443
  o = e.websocket;
1261
1444
  if (!(!o || o === "pending")) {
1262
- _context12.next = 4;
1445
+ _context15.next = 4;
1263
1446
  break;
1264
1447
  }
1265
- return _context12.abrupt("return");
1448
+ return _context15.abrupt("return");
1266
1449
  case 4:
1267
1450
  a = {
1268
1451
  body: t,
1269
1452
  headers: (d = e.requestSettings) == null ? void 0 : d.headers
1270
1453
  };
1271
- _context12.next = 7;
1454
+ _context15.next = 7;
1272
1455
  return RequestUtils.processRequestInterceptor(e.deepChat, a);
1273
1456
  case 7:
1274
- _yield$RequestUtils$p4 = _context12.sent;
1457
+ _yield$RequestUtils$p4 = _context15.sent;
1275
1458
  l = _yield$RequestUtils$p4.body;
1276
1459
  c = _yield$RequestUtils$p4.error;
1277
1460
  if (!c) {
1278
- _context12.next = 12;
1461
+ _context15.next = 12;
1279
1462
  break;
1280
1463
  }
1281
- return _context12.abrupt("return", n.addNewErrorMessage("service", c));
1464
+ return _context15.abrupt("return", n.addNewErrorMessage("service", c));
1282
1465
  case 12:
1283
1466
  if (Websocket.isWebSocket(o)) {
1284
- _context12.next = 14;
1467
+ _context15.next = 14;
1285
1468
  break;
1286
1469
  }
1287
- return _context12.abrupt("return", o.newUserMessage.listener(l));
1470
+ return _context15.abrupt("return", o.newUserMessage.listener(l));
1288
1471
  case 14:
1289
1472
  u = s ? JSON.stringify(l) : l;
1290
1473
  if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1291
- _context12.next = 17;
1474
+ _context15.next = 17;
1292
1475
  break;
1293
1476
  }
1294
- return _context12.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1477
+ return _context15.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1295
1478
  case 17:
1296
1479
  o.readyState === void 0 || o.readyState !== o.OPEN ? (console.error("Connection is not open"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error")) : o.send(JSON.stringify(u));
1297
1480
  case 18:
1298
1481
  case "end":
1299
- return _context12.stop();
1482
+ return _context15.stop();
1300
1483
  }
1301
- }, _callee12);
1484
+ }, _callee15);
1302
1485
  }));
1303
- function sendWebsocket(_x20, _x21, _x22) {
1486
+ function sendWebsocket(_x26, _x27, _x28) {
1304
1487
  return _sendWebsocket.apply(this, arguments);
1305
1488
  }
1306
1489
  return sendWebsocket;
@@ -1806,13 +1989,13 @@ function normalizeReference(r) {
1806
1989
  return r.trim().replace(/\s+/g, " ").toUpperCase();
1807
1990
  }
1808
1991
  function parseReference(r, e, t, n) {
1809
- var s, o, a, l, c, u, d, h, p;
1992
+ var s, o, a, l, c, u, d, h, f;
1810
1993
  if (r.charCodeAt(0) !== 91 || r.indexOf("]:") === -1 || (s = new StateInline(r, e, t, n, []), o = parseLinkLabel(s, 0), o < 0 || r.charCodeAt(o + 1) !== 58)) return -1;
1811
1994
  for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1812
1995
  if (!parseLinkDestination(s, a)) return -1;
1813
1996
  for (d = s.linkContent, a = s.pos, u = a, a = a + 1; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1814
1997
  for (a < l && u !== a && parseLinkTitle(s, a) ? (h = s.linkContent, a = s.pos) : (h = "", a = u); a < l && s.src.charCodeAt(a) === 32;) a++;
1815
- return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (p = normalizeReference(r.slice(1, o)), _typeof(n.references[p]) > "u" && (n.references[p] = {
1998
+ return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (f = normalizeReference(r.slice(1, o)), _typeof(n.references[f]) > "u" && (n.references[f] = {
1816
1999
  title: h,
1817
2000
  href: d
1818
2001
  }), a);
@@ -1849,9 +2032,9 @@ function footnote_block(r) {
1849
2032
  u,
1850
2033
  d = 0,
1851
2034
  h = !1,
1852
- p = {};
1853
- if (r.env.footnotes && (r.tokens = r.tokens.filter(function (f) {
1854
- return f.type === "footnote_reference_open" ? (h = !0, c = [], u = f.label, !1) : f.type === "footnote_reference_close" ? (h = !1, p[":" + u] = c, !1) : (h && c.push(f), !h);
2035
+ f = {};
2036
+ if (r.env.footnotes && (r.tokens = r.tokens.filter(function (p) {
2037
+ return p.type === "footnote_reference_open" ? (h = !0, c = [], u = p.label, !1) : p.type === "footnote_reference_close" ? (h = !1, f[":" + u] = c, !1) : (h && c.push(p), !h);
1855
2038
  }), !!r.env.footnotes.list)) {
1856
2039
  for (a = r.env.footnotes.list, r.tokens.push({
1857
2040
  type: "footnote_block_open",
@@ -1874,7 +2057,7 @@ function footnote_block(r) {
1874
2057
  type: "paragraph_close",
1875
2058
  tight: !1,
1876
2059
  level: --d
1877
- })) : a[e].label && (l = p[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
2060
+ })) : a[e].label && (l = f[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
1878
2061
  type: "footnote_anchor",
1879
2062
  id: e,
1880
2063
  subId: n,
@@ -1907,15 +2090,15 @@ function abbr2(r) {
1907
2090
  u,
1908
2091
  d,
1909
2092
  h,
1910
- p,
1911
- f = r.tokens;
2093
+ f,
2094
+ p = r.tokens;
1912
2095
  if (r.env.abbreviations) {
1913
- for (r.env.abbrRegExp || (p = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
2096
+ for (r.env.abbrRegExp || (f = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
1914
2097
  return b.substr(1);
1915
2098
  }).sort(function (b, m) {
1916
2099
  return m.length - b.length;
1917
- }).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(p, "g")), d = r.env.abbrRegExp, t = 0, n = f.length; t < n; t++) if (f[t].type === "inline") {
1918
- for (s = f[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
2100
+ }).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(f, "g")), d = r.env.abbrRegExp, t = 0, n = p.length; t < n; t++) if (p[t].type === "inline") {
2101
+ for (s = p[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
1919
2102
  for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
1920
2103
  type: "text",
1921
2104
  content: a.slice(c, h.index + h[1].length),
@@ -1936,7 +2119,7 @@ function abbr2(r) {
1936
2119
  type: "text",
1937
2120
  content: a.slice(c),
1938
2121
  level: u
1939
- }), f[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
2122
+ }), p[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
1940
2123
  }
1941
2124
  }
1942
2125
  }
@@ -1971,29 +2154,29 @@ function replaceAt(r, e, t) {
1971
2154
  return r.substr(0, e) + t + r.substr(e + 1);
1972
2155
  }
1973
2156
  function smartquotes(r) {
1974
- var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2157
+ var e, t, n, s, o, a, l, c, u, d, h, f, p, b, m, g, v;
1975
2158
  if (r.options.typographer) {
1976
- for (g = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
1977
- for (v = r.tokens[m].children, g.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
1978
- for (l = v[e].level, f = g.length - 1; f >= 0 && !(g[f].level <= l); f--);
1979
- g.length = f + 1, n = t.content, o = 0, a = n.length;
2159
+ for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
2160
+ 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))) {
2161
+ for (l = g[e].level, p = v.length - 1; p >= 0 && !(v[p].level <= l); p--);
2162
+ v.length = p + 1, n = t.content, o = 0, a = n.length;
1980
2163
  e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
1981
2164
  if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
1982
2165
  b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
1983
2166
  continue;
1984
2167
  }
1985
- if (h = !u, p = !c, p) {
1986
- for (f = g.length - 1; f >= 0 && (d = g[f], !(g[f].level < l)); f--) if (d.single === b && g[f].level === l) {
1987
- d = g[f], b ? (v[d.token].content = replaceAt(v[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (v[d.token].content = replaceAt(v[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), g.length = f;
2168
+ if (h = !u, f = !c, f) {
2169
+ for (p = v.length - 1; p >= 0 && (d = v[p], !(v[p].level < l)); p--) if (d.single === b && v[p].level === l) {
2170
+ d = v[p], b ? (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), v.length = p;
1988
2171
  continue e;
1989
2172
  }
1990
2173
  }
1991
- h ? g.push({
2174
+ h ? v.push({
1992
2175
  token: e,
1993
2176
  pos: s.index,
1994
2177
  single: b,
1995
2178
  level: l
1996
- }) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2179
+ }) : f && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
1997
2180
  }
1998
2181
  }
1999
2182
  }
@@ -2105,20 +2288,20 @@ function blockquote(r, e, t, n) {
2105
2288
  u,
2106
2289
  d,
2107
2290
  h,
2108
- p,
2109
2291
  f,
2292
+ p,
2110
2293
  b,
2111
2294
  m = r.bMarks[e] + r.tShift[e],
2112
- v = r.eMarks[e];
2113
- if (m > v || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2295
+ g = r.eMarks[e];
2296
+ if (m > g || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2114
2297
  if (n) return !0;
2115
- for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m < v ? r.skipSpaces(m) : m, o = m >= v, a = [r.tShift[e]], r.tShift[e] = m - r.bMarks[e], h = r.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (m = r.bMarks[s] + r.tShift[s], v = r.eMarks[s], !(m >= v)); s++) {
2298
+ for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m < g ? r.skipSpaces(m) : m, o = m >= g, a = [r.tShift[e]], r.tShift[e] = m - r.bMarks[e], h = r.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (m = r.bMarks[s] + r.tShift[s], g = r.eMarks[s], !(m >= g)); s++) {
2116
2299
  if (r.src.charCodeAt(m++) === 62) {
2117
- r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m < v ? r.skipSpaces(m) : m, o = m >= v, a.push(r.tShift[s]), r.tShift[s] = m - r.bMarks[s];
2300
+ r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m < g ? r.skipSpaces(m) : m, o = m >= g, a.push(r.tShift[s]), r.tShift[s] = m - r.bMarks[s];
2118
2301
  continue;
2119
2302
  }
2120
2303
  if (o) break;
2121
- for (b = !1, p = 0, f = h.length; p < f; p++) if (h[p](r, s, t, !0)) {
2304
+ for (b = !1, f = 0, p = h.length; f < p; f++) if (h[f](r, s, t, !0)) {
2122
2305
  b = !0;
2123
2306
  break;
2124
2307
  }
@@ -2132,7 +2315,7 @@ function blockquote(r, e, t, n) {
2132
2315
  }), r.parser.tokenize(r, e, s), r.tokens.push({
2133
2316
  type: "blockquote_close",
2134
2317
  level: --r.level
2135
- }), r.parentType = u, d[1] = r.line, p = 0; p < a.length; p++) r.bMarks[p + e] = l[p], r.tShift[p + e] = a[p];
2318
+ }), r.parentType = u, d[1] = r.line, f = 0; f < a.length; f++) r.bMarks[f + e] = l[f], r.tShift[f + e] = a[f];
2136
2319
  return r.blkIndent = c, !0;
2137
2320
  }
2138
2321
  function hr(r, e, t, n) {
@@ -2185,55 +2368,55 @@ function list(r, e, t, n) {
2185
2368
  u,
2186
2369
  d,
2187
2370
  h,
2188
- p,
2189
2371
  f,
2372
+ p,
2190
2373
  b,
2191
2374
  m,
2192
- v,
2193
2375
  g,
2376
+ v,
2194
2377
  y,
2378
+ S,
2379
+ E,
2195
2380
  x,
2196
- _,
2197
- I,
2198
2381
  R = !0,
2199
- w,
2200
- S,
2382
+ C,
2383
+ _,
2201
2384
  H,
2202
2385
  F;
2203
- if ((h = skipOrderedListMarker(r, e)) >= 0) v = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) v = !1;else return !1;
2386
+ if ((h = skipOrderedListMarker(r, e)) >= 0) g = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) g = !1;else return !1;
2204
2387
  if (r.level >= r.options.maxNesting) return !1;
2205
2388
  if (m = r.src.charCodeAt(h - 1), n) return !0;
2206
- for (y = r.tokens.length, v ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
2389
+ for (y = r.tokens.length, g ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
2207
2390
  type: "ordered_list_open",
2208
2391
  order: b,
2209
- lines: _ = [e, 0],
2392
+ lines: E = [e, 0],
2210
2393
  level: r.level++
2211
2394
  })) : r.tokens.push({
2212
2395
  type: "bullet_list_open",
2213
- lines: _ = [e, 0],
2396
+ lines: E = [e, 0],
2214
2397
  level: r.level++
2215
- }), s = e, x = !1, w = r.parser.ruler.getRules("list"); s < t && (g = r.skipSpaces(h), p = r.eMarks[s], g >= p ? f = 1 : f = g - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
2398
+ }), s = e, S = !1, C = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), f = r.eMarks[s], v >= f ? p = 1 : p = v - h, p > 4 && (p = 1), p < 1 && (p = 1), o = h - r.bMarks[s] + p, r.tokens.push({
2216
2399
  type: "list_item_open",
2217
- lines: I = [e, 0],
2400
+ lines: x = [e, 0],
2218
2401
  level: r.level++
2219
- }), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = g - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || x) && (R = !1), x = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
2402
+ }), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = v - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || S) && (R = !1), S = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
2220
2403
  type: "list_item_close",
2221
2404
  level: --r.level
2222
- }), s = e = r.line, I[1] = s, g = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2223
- for (F = !1, S = 0, H = w.length; S < H; S++) if (w[S](r, s, t, !0)) {
2405
+ }), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2406
+ for (F = !1, _ = 0, H = C.length; _ < H; _++) if (C[_](r, s, t, !0)) {
2224
2407
  F = !0;
2225
2408
  break;
2226
2409
  }
2227
2410
  if (F) break;
2228
- if (v) {
2411
+ if (g) {
2229
2412
  if (h = skipOrderedListMarker(r, s), h < 0) break;
2230
2413
  } else if (h = skipBulletListMarker(r, s), h < 0) break;
2231
2414
  if (m !== r.src.charCodeAt(h - 1)) break;
2232
2415
  }
2233
2416
  return r.tokens.push({
2234
- type: v ? "ordered_list_close" : "bullet_list_close",
2417
+ type: g ? "ordered_list_close" : "bullet_list_close",
2235
2418
  level: --r.level
2236
- }), _[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2419
+ }), E[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2237
2420
  }
2238
2421
  function footnote(r, e, t, n) {
2239
2422
  var s,
@@ -2345,21 +2528,21 @@ function getLine(r, e) {
2345
2528
  return r.src.substr(t, n - t);
2346
2529
  }
2347
2530
  function table(r, e, t, n) {
2348
- var s, o, a, l, c, u, d, h, p, f, b;
2531
+ var s, o, a, l, c, u, d, h, f, p, b;
2349
2532
  if (e + 2 > t || (c = e + 1, r.tShift[c] < r.blkIndent) || (a = r.bMarks[c] + r.tShift[c], a >= r.eMarks[c]) || (s = r.src.charCodeAt(a), s !== 124 && s !== 45 && s !== 58) || (o = getLine(r, e + 1), !/^[-:| ]+$/.test(o)) || (u = o.split("|"), u <= 2)) return !1;
2350
2533
  for (h = [], l = 0; l < u.length; l++) {
2351
- if (p = u[l].trim(), !p) {
2534
+ if (f = u[l].trim(), !f) {
2352
2535
  if (l === 0 || l === u.length - 1) continue;
2353
2536
  return !1;
2354
2537
  }
2355
- if (!/^:?-+:?$/.test(p)) return !1;
2356
- p.charCodeAt(p.length - 1) === 58 ? h.push(p.charCodeAt(0) === 58 ? "center" : "right") : p.charCodeAt(0) === 58 ? h.push("left") : h.push("");
2538
+ if (!/^:?-+:?$/.test(f)) return !1;
2539
+ f.charCodeAt(f.length - 1) === 58 ? h.push(f.charCodeAt(0) === 58 ? "center" : "right") : f.charCodeAt(0) === 58 ? h.push("left") : h.push("");
2357
2540
  }
2358
2541
  if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
2359
2542
  if (n) return !0;
2360
2543
  for (r.tokens.push({
2361
2544
  type: "table_open",
2362
- lines: f = [e, 0],
2545
+ lines: p = [e, 0],
2363
2546
  level: r.level++
2364
2547
  }), r.tokens.push({
2365
2548
  type: "thead_open",
@@ -2422,7 +2605,7 @@ function table(r, e, t, n) {
2422
2605
  }), r.tokens.push({
2423
2606
  type: "table_close",
2424
2607
  level: --r.level
2425
- }), f[1] = b[1] = c, r.line = c, !0;
2608
+ }), p[1] = b[1] = c, r.line = c, !0;
2426
2609
  }
2427
2610
  function skipMarker(r, e) {
2428
2611
  var t,
@@ -2438,7 +2621,7 @@ function markTightParagraphs$1(r, e) {
2438
2621
  for (t = e + 2, n = r.tokens.length - 2; t < n; t++) r.tokens[t].level === s && r.tokens[t].type === "paragraph_open" && (r.tokens[t + 2].tight = !0, r.tokens[t].tight = !0, t += 2);
2439
2622
  }
2440
2623
  function deflist(r, e, t, n) {
2441
- var s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2624
+ var s, o, a, l, c, u, d, h, f, p, b, m, g, v;
2442
2625
  if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
2443
2626
  if (d = e + 1, r.isEmpty(d) && ++d > t || r.tShift[d] < r.blkIndent || (s = skipMarker(r, d), s < 0) || r.level >= r.options.maxNesting) return !1;
2444
2627
  u = r.tokens.length, r.tokens.push({
@@ -2447,7 +2630,7 @@ function deflist(r, e, t, n) {
2447
2630
  level: r.level++
2448
2631
  }), a = e, o = d;
2449
2632
  e: for (;;) {
2450
- for (g = !0, v = !1, r.tokens.push({
2633
+ for (v = !0, g = !1, r.tokens.push({
2451
2634
  type: "dt_open",
2452
2635
  lines: [a, a],
2453
2636
  level: r.level++
@@ -2465,7 +2648,7 @@ function deflist(r, e, t, n) {
2465
2648
  type: "dd_open",
2466
2649
  lines: l = [d, 0],
2467
2650
  level: r.level++
2468
- }), m = r.tight, p = r.ddIndent, h = r.blkIndent, b = r.tShift[o], f = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || v) && (g = !1), v = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = f, r.blkIndent = h, r.ddIndent = p, r.tokens.push({
2651
+ }), m = r.tight, f = r.ddIndent, h = r.blkIndent, b = r.tShift[o], p = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || g) && (v = !1), g = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = p, r.blkIndent = h, r.ddIndent = f, r.tokens.push({
2469
2652
  type: "dd_close",
2470
2653
  level: --r.level
2471
2654
  }), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
@@ -2477,7 +2660,7 @@ function deflist(r, e, t, n) {
2477
2660
  return r.tokens.push({
2478
2661
  type: "dl_close",
2479
2662
  level: --r.level
2480
- }), c[1] = d, r.line = d, g && markTightParagraphs$1(r, u), !0;
2663
+ }), c[1] = d, r.line = d, v && markTightParagraphs$1(r, u), !0;
2481
2664
  }
2482
2665
  function paragraph(r, e) {
2483
2666
  var t,
@@ -2842,21 +3025,21 @@ function links(r, e) {
2842
3025
  u,
2843
3026
  d = !1,
2844
3027
  h = r.pos,
2845
- p = r.posMax,
2846
- f = r.pos,
2847
- b = r.src.charCodeAt(f);
2848
- if (b === 33 && (d = !0, b = r.src.charCodeAt(++f)), b !== 91 || r.level >= r.options.maxNesting || (t = f + 1, n = parseLinkLabel(r, f), n < 0)) return !1;
2849
- if (l = n + 1, l < p && r.src.charCodeAt(l) === 40) {
2850
- for (l++; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2851
- if (l >= p) return !1;
2852
- for (f = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", f = l; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2853
- if (l < p && f !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
2854
- if (l >= p || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
3028
+ f = r.posMax,
3029
+ p = r.pos,
3030
+ b = r.src.charCodeAt(p);
3031
+ if (b === 33 && (d = !0, b = r.src.charCodeAt(++p)), b !== 91 || r.level >= r.options.maxNesting || (t = p + 1, n = parseLinkLabel(r, p), n < 0)) return !1;
3032
+ if (l = n + 1, l < f && r.src.charCodeAt(l) === 40) {
3033
+ for (l++; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3034
+ if (l >= f) return !1;
3035
+ for (p = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", p = l; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3036
+ if (l < f && p !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
3037
+ if (l >= f || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
2855
3038
  l++;
2856
3039
  } else {
2857
3040
  if (r.linkLevel > 0) return !1;
2858
- for (; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2859
- if (l < p && r.src.charCodeAt(l) === 91 && (f = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(f, l++) : l = f - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
3041
+ for (; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3042
+ if (l < f && r.src.charCodeAt(l) === 91 && (p = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(p, l++) : l = p - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
2860
3043
  o = c.href, a = c.title;
2861
3044
  }
2862
3045
  return e || (r.pos = t, r.posMax = n, d ? r.push({
@@ -2873,7 +3056,7 @@ function links(r, e) {
2873
3056
  }), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
2874
3057
  type: "link_close",
2875
3058
  level: --r.level
2876
- }))), r.pos = l, r.posMax = p, !0;
3059
+ }))), r.pos = l, r.posMax = f, !0;
2877
3060
  }
2878
3061
  function footnote_inline(r, e) {
2879
3062
  var t,
@@ -3269,12 +3452,12 @@ var SetFileTypes = /*#__PURE__*/function () {
3269
3452
  }, {
3270
3453
  key: "processMicrophone",
3271
3454
  value: function processMicrophone(e, t, n, s) {
3272
- var _c$files, _p$maxNumberOfFiles;
3273
- var l, c, u, d, h, p;
3455
+ var _c$files, _f$maxNumberOfFiles;
3456
+ var l, c, u, d, h, f;
3274
3457
  var a = _objectSpread({
3275
3458
  acceptedFormats: "audio/*"
3276
3459
  }, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
3277
- n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_p$maxNumberOfFiles = (p = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _p$maxNumberOfFiles !== void 0 ? _p$maxNumberOfFiles : p.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
3460
+ n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_f$maxNumberOfFiles = (f = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _f$maxNumberOfFiles !== void 0 ? _f$maxNumberOfFiles : f.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
3278
3461
  }
3279
3462
  // prettier-ignore
3280
3463
  }, {
@@ -3360,11 +3543,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3360
3543
  }, {
3361
3544
  key: "callServiceAPI",
3362
3545
  value: function () {
3363
- var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
3546
+ var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
3364
3547
  var _c$headers, _u$ContentType;
3365
3548
  var l, c, u, d, s, o, a;
3366
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3367
- while (1) switch (_context13.prev = _context13.next) {
3549
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3550
+ while (1) switch (_context16.prev = _context16.next) {
3368
3551
  case 0:
3369
3552
  s = _objectSpread({
3370
3553
  messages: t
@@ -3373,26 +3556,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
3373
3556
  (l = this.requestSettings.headers) != null && l["Content-Type"] || ((_c$headers = (c = this.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_u$ContentType = (u = this.requestSettings.headers)["Content-Type"]) !== null && _u$ContentType !== void 0 ? _u$ContentType : u["Content-Type"] = "application/json", o = !0);
3374
3557
  a = this.deepChat.stream;
3375
3558
  if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
3376
- _context13.next = 9;
3559
+ _context16.next = 9;
3377
3560
  break;
3378
3561
  }
3379
- _context13.next = 7;
3562
+ _context16.next = 7;
3380
3563
  return Stream.request(this, s, e);
3381
3564
  case 7:
3382
- _context13.next = 11;
3565
+ _context16.next = 11;
3383
3566
  break;
3384
3567
  case 9:
3385
- _context13.next = 11;
3568
+ _context16.next = 11;
3386
3569
  return HTTPRequest.request(this, s, e);
3387
3570
  case 11:
3388
3571
  o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
3389
3572
  case 12:
3390
3573
  case "end":
3391
- return _context13.stop();
3574
+ return _context16.stop();
3392
3575
  }
3393
- }, _callee13, this);
3576
+ }, _callee16, this);
3394
3577
  }));
3395
- function callServiceAPI(_x23, _x24, _x25) {
3578
+ function callServiceAPI(_x29, _x30, _x31) {
3396
3579
  return _callServiceAPI.apply(this, arguments);
3397
3580
  }
3398
3581
  return callServiceAPI;
@@ -3400,24 +3583,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3400
3583
  }, {
3401
3584
  key: "callApiWithFiles",
3402
3585
  value: function () {
3403
- var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
3586
+ var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n, s) {
3404
3587
  var o, a, l;
3405
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3406
- while (1) switch (_context14.prev = _context14.next) {
3588
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3589
+ while (1) switch (_context17.prev = _context17.next) {
3407
3590
  case 0:
3408
3591
  o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
3409
3592
  this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
3410
- _context14.next = 4;
3593
+ _context17.next = 4;
3411
3594
  return HTTPRequest.request(this, o, t, !1);
3412
3595
  case 4:
3413
3596
  this.requestSettings = a;
3414
3597
  case 5:
3415
3598
  case "end":
3416
- return _context14.stop();
3599
+ return _context17.stop();
3417
3600
  }
3418
- }, _callee14, this);
3601
+ }, _callee17, this);
3419
3602
  }));
3420
- function callApiWithFiles(_x26, _x27, _x28, _x29) {
3603
+ function callApiWithFiles(_x32, _x33, _x34, _x35) {
3421
3604
  return _callApiWithFiles.apply(this, arguments);
3422
3605
  }
3423
3606
  return callApiWithFiles;
@@ -3425,13 +3608,13 @@ var BaseServiceIO = /*#__PURE__*/function () {
3425
3608
  }, {
3426
3609
  key: "callAPI",
3427
3610
  value: function () {
3428
- var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t) {
3611
+ var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t) {
3429
3612
  var n, s;
3430
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3431
- while (1) switch (_context15.prev = _context15.next) {
3613
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3614
+ while (1) switch (_context18.prev = _context18.next) {
3432
3615
  case 0:
3433
3616
  if (this.requestSettings) {
3434
- _context15.next = 2;
3617
+ _context18.next = 2;
3435
3618
  break;
3436
3619
  }
3437
3620
  throw new Error("Request settings have not been set up");
@@ -3445,11 +3628,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3445
3628
  } else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
3446
3629
  case 4:
3447
3630
  case "end":
3448
- return _context15.stop();
3631
+ return _context18.stop();
3449
3632
  }
3450
- }, _callee15, this);
3633
+ }, _callee18, this);
3451
3634
  }));
3452
- function callAPI(_x30, _x31) {
3635
+ function callAPI(_x36, _x37) {
3453
3636
  return _callAPI.apply(this, arguments);
3454
3637
  }
3455
3638
  return callAPI;
@@ -3458,24 +3641,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3458
3641
  }, {
3459
3642
  key: "extractResultData",
3460
3643
  value: function () {
3461
- var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e) {
3462
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3463
- while (1) switch (_context16.prev = _context16.next) {
3644
+ var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
3645
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3646
+ while (1) switch (_context19.prev = _context19.next) {
3464
3647
  case 0:
3465
3648
  if (!e.error) {
3466
- _context16.next = 2;
3649
+ _context19.next = 2;
3467
3650
  break;
3468
3651
  }
3469
3652
  throw e.error;
3470
3653
  case 2:
3471
- return _context16.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
3654
+ 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);
3472
3655
  case 3:
3473
3656
  case "end":
3474
- return _context16.stop();
3657
+ return _context19.stop();
3475
3658
  }
3476
- }, _callee16);
3659
+ }, _callee19);
3477
3660
  }));
3478
- function extractResultData(_x32) {
3661
+ function extractResultData(_x38) {
3479
3662
  return _extractResultData.apply(this, arguments);
3480
3663
  }
3481
3664
  return extractResultData;
@@ -3816,17 +3999,17 @@ var HuggingFaceUtils = /*#__PURE__*/function () {
3816
3999
  return HuggingFaceUtils;
3817
4000
  }();
3818
4001
  var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3819
- _inherits(j, _DirectServiceIO);
3820
- var _super3 = _createSuper(j);
4002
+ _inherits(U, _DirectServiceIO);
4003
+ var _super3 = _createSuper(U);
3821
4004
  // prettier-ignore
3822
- function j(e, t, n, s, o, a) {
4005
+ function U(e, t, n, s, o, a) {
3823
4006
  var _this4;
3824
- _classCallCheck(this, j);
3825
- _this4 = _super3.call(this, e, HuggingFaceUtils.buildKeyVerificationDetails(), HuggingFaceUtils.buildHeaders, o, a), _this4.insertKeyPlaceholderText = "Hugging Face Token", _this4.getKeyLink = "https://huggingface.co/settings/tokens", _this4.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this4.permittedErrorPrefixes = ["Authorization header"], _this4.url = "".concat(j.URL_PREFIX).concat(n), _this4.textInputPlaceholderText = t, _typeof(s) == "object" && (s.model && (_this4.url = "".concat(j.URL_PREFIX).concat(s.model)), s.options && (_this4.rawBody.options = s.options), s.parameters && (_this4.rawBody.parameters = s.parameters));
4007
+ _classCallCheck(this, U);
4008
+ _this4 = _super3.call(this, e, HuggingFaceUtils.buildKeyVerificationDetails(), HuggingFaceUtils.buildHeaders, o, a), _this4.insertKeyPlaceholderText = "Hugging Face Token", _this4.getKeyLink = "https://huggingface.co/settings/tokens", _this4.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this4.permittedErrorPrefixes = ["Authorization header"], _this4.url = "".concat(U.URL_PREFIX).concat(n), _this4.textInputPlaceholderText = t, _typeof(s) == "object" && (s.model && (_this4.url = "".concat(U.URL_PREFIX).concat(s.model)), s.options && (_this4.rawBody.options = s.options), s.parameters && (_this4.rawBody.parameters = s.parameters));
3826
4009
  return _this4;
3827
4010
  }
3828
4011
  // prettier-ignore
3829
- _createClass(j, [{
4012
+ _createClass(U, [{
3830
4013
  key: "preprocessBody",
3831
4014
  value: function preprocessBody(e, t, n) {
3832
4015
  var _s$options;
@@ -3839,13 +4022,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3839
4022
  }, {
3840
4023
  key: "callServiceAPI",
3841
4024
  value: function () {
3842
- var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
4025
+ var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e, t, n) {
3843
4026
  var s;
3844
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3845
- while (1) switch (_context17.prev = _context17.next) {
4027
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
4028
+ while (1) switch (_context20.prev = _context20.next) {
3846
4029
  case 0:
3847
4030
  if (this.requestSettings) {
3848
- _context17.next = 2;
4031
+ _context20.next = 2;
3849
4032
  break;
3850
4033
  }
3851
4034
  throw new Error("Request settings have not been set up");
@@ -3854,17 +4037,17 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3854
4037
  HTTPRequest.request(this, s, e);
3855
4038
  case 4:
3856
4039
  case "end":
3857
- return _context17.stop();
4040
+ return _context20.stop();
3858
4041
  }
3859
- }, _callee17, this);
4042
+ }, _callee20, this);
3860
4043
  }));
3861
- function callServiceAPI(_x33, _x34, _x35) {
4044
+ function callServiceAPI(_x39, _x40, _x41) {
3862
4045
  return _callServiceAPI2.apply(this, arguments);
3863
4046
  }
3864
4047
  return callServiceAPI;
3865
4048
  }()
3866
4049
  }]);
3867
- return j;
4050
+ return U;
3868
4051
  }(DirectServiceIO);
3869
4052
  _HuggingFaceIO.URL_PREFIX = "https://api-inference.huggingface.co/models/";
3870
4053
  var HuggingFaceIO = _HuggingFaceIO;
@@ -3887,18 +4070,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3887
4070
  }, {
3888
4071
  key: "callServiceAPI",
3889
4072
  value: function () {
3890
- var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n) {
3891
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3892
- while (1) switch (_context18.prev = _context18.next) {
4073
+ var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
4074
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4075
+ while (1) switch (_context21.prev = _context21.next) {
3893
4076
  case 0:
3894
4077
  if (this.requestSettings) {
3895
- _context18.next = 2;
4078
+ _context21.next = 2;
3896
4079
  break;
3897
4080
  }
3898
4081
  throw new Error("Request settings have not been set up");
3899
4082
  case 2:
3900
4083
  if (n != null && n[0]) {
3901
- _context18.next = 4;
4084
+ _context21.next = 4;
3902
4085
  break;
3903
4086
  }
3904
4087
  throw new Error("No file was added");
@@ -3906,11 +4089,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3906
4089
  HTTPRequest.poll(this, n[0], e, !1);
3907
4090
  case 5:
3908
4091
  case "end":
3909
- return _context18.stop();
4092
+ return _context21.stop();
3910
4093
  }
3911
- }, _callee18, this);
4094
+ }, _callee21, this);
3912
4095
  }));
3913
- function callServiceAPI(_x36, _x37, _x38) {
4096
+ function callServiceAPI(_x42, _x43, _x44) {
3914
4097
  return _callServiceAPI3.apply(this, arguments);
3915
4098
  }
3916
4099
  return callServiceAPI;
@@ -3939,35 +4122,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3939
4122
  _createClass(HuggingFaceAudioClassificationIO, [{
3940
4123
  key: "extractPollResultData",
3941
4124
  value: function () {
3942
- var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
4125
+ var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
3943
4126
  var t;
3944
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3945
- while (1) switch (_context19.prev = _context19.next) {
4127
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4128
+ while (1) switch (_context22.prev = _context22.next) {
3946
4129
  case 0:
3947
4130
  if (!e.estimated_time) {
3948
- _context19.next = 2;
4131
+ _context22.next = 2;
3949
4132
  break;
3950
4133
  }
3951
- return _context19.abrupt("return", {
4134
+ return _context22.abrupt("return", {
3952
4135
  timeoutMS: (e.estimated_time + 1) * 1e3
3953
4136
  });
3954
4137
  case 2:
3955
4138
  if (!e.error) {
3956
- _context19.next = 4;
4139
+ _context22.next = 4;
3957
4140
  break;
3958
4141
  }
3959
4142
  throw e.error;
3960
4143
  case 4:
3961
- return _context19.abrupt("return", {
4144
+ return _context22.abrupt("return", {
3962
4145
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
3963
4146
  });
3964
4147
  case 5:
3965
4148
  case "end":
3966
- return _context19.stop();
4149
+ return _context22.stop();
3967
4150
  }
3968
- }, _callee19);
4151
+ }, _callee22);
3969
4152
  }));
3970
- function extractPollResultData(_x39) {
4153
+ function extractPollResultData(_x45) {
3971
4154
  return _extractPollResultData.apply(this, arguments);
3972
4155
  }
3973
4156
  return extractPollResultData;
@@ -3990,35 +4173,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3990
4173
  _createClass(HuggingFaceImageClassificationIO, [{
3991
4174
  key: "extractPollResultData",
3992
4175
  value: function () {
3993
- var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
4176
+ var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
3994
4177
  var t;
3995
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3996
- while (1) switch (_context20.prev = _context20.next) {
4178
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4179
+ while (1) switch (_context23.prev = _context23.next) {
3997
4180
  case 0:
3998
4181
  if (!e.estimated_time) {
3999
- _context20.next = 2;
4182
+ _context23.next = 2;
4000
4183
  break;
4001
4184
  }
4002
- return _context20.abrupt("return", {
4185
+ return _context23.abrupt("return", {
4003
4186
  timeoutMS: (e.estimated_time + 1) * 1e3
4004
4187
  });
4005
4188
  case 2:
4006
4189
  if (!e.error) {
4007
- _context20.next = 4;
4190
+ _context23.next = 4;
4008
4191
  break;
4009
4192
  }
4010
4193
  throw e.error;
4011
4194
  case 4:
4012
- return _context20.abrupt("return", {
4195
+ return _context23.abrupt("return", {
4013
4196
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4014
4197
  });
4015
4198
  case 5:
4016
4199
  case "end":
4017
- return _context20.stop();
4200
+ return _context23.stop();
4018
4201
  }
4019
- }, _callee20);
4202
+ }, _callee23);
4020
4203
  }));
4021
- function extractPollResultData(_x40) {
4204
+ function extractPollResultData(_x46) {
4022
4205
  return _extractPollResultData2.apply(this, arguments);
4023
4206
  }
4024
4207
  return extractPollResultData;
@@ -4103,19 +4286,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4103
4286
  }, {
4104
4287
  key: "callServiceAPI",
4105
4288
  value: function () {
4106
- var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
4289
+ var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e, t, n) {
4107
4290
  var s;
4108
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4109
- while (1) switch (_context21.prev = _context21.next) {
4291
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4292
+ while (1) switch (_context24.prev = _context24.next) {
4110
4293
  case 0:
4111
4294
  if (this.requestSettings) {
4112
- _context21.next = 2;
4295
+ _context24.next = 2;
4113
4296
  break;
4114
4297
  }
4115
4298
  throw new Error("Request settings have not been set up");
4116
4299
  case 2:
4117
4300
  if (n) {
4118
- _context21.next = 4;
4301
+ _context24.next = 4;
4119
4302
  break;
4120
4303
  }
4121
4304
  throw new Error("Image was not found");
@@ -4124,11 +4307,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4124
4307
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
4125
4308
  case 6:
4126
4309
  case "end":
4127
- return _context21.stop();
4310
+ return _context24.stop();
4128
4311
  }
4129
- }, _callee21, this);
4312
+ }, _callee24, this);
4130
4313
  }));
4131
- function callServiceAPI(_x41, _x42, _x43) {
4314
+ function callServiceAPI(_x47, _x48, _x49) {
4132
4315
  return _callServiceAPI4.apply(this, arguments);
4133
4316
  }
4134
4317
  return callServiceAPI;
@@ -4136,17 +4319,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4136
4319
  }, {
4137
4320
  key: "extractResultData",
4138
4321
  value: function () {
4139
- var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
4140
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4141
- while (1) switch (_context22.prev = _context22.next) {
4322
+ var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
4323
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4324
+ while (1) switch (_context25.prev = _context25.next) {
4142
4325
  case 0:
4143
4326
  if (!e.message) {
4144
- _context22.next = 2;
4327
+ _context25.next = 2;
4145
4328
  break;
4146
4329
  }
4147
4330
  throw e.message;
4148
4331
  case 2:
4149
- return _context22.abrupt("return", {
4332
+ return _context25.abrupt("return", {
4150
4333
  files: e.artifacts.map(function (n) {
4151
4334
  return {
4152
4335
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4156,11 +4339,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4156
4339
  });
4157
4340
  case 3:
4158
4341
  case "end":
4159
- return _context22.stop();
4342
+ return _context25.stop();
4160
4343
  }
4161
- }, _callee22);
4344
+ }, _callee25);
4162
4345
  }));
4163
- function extractResultData(_x44) {
4346
+ function extractResultData(_x50) {
4164
4347
  return _extractResultData2.apply(this, arguments);
4165
4348
  }
4166
4349
  return extractResultData;
@@ -4212,19 +4395,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4212
4395
  }, {
4213
4396
  key: "callServiceAPI",
4214
4397
  value: function () {
4215
- var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
4398
+ var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e, t, n) {
4216
4399
  var a, l, s, o;
4217
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4218
- while (1) switch (_context23.prev = _context23.next) {
4400
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4401
+ while (1) switch (_context26.prev = _context26.next) {
4219
4402
  case 0:
4220
4403
  if (this.requestSettings) {
4221
- _context23.next = 2;
4404
+ _context26.next = 2;
4222
4405
  break;
4223
4406
  }
4224
4407
  throw new Error("Request settings have not been set up");
4225
4408
  case 2:
4226
4409
  if (!(!n || !n[0] || !n[1])) {
4227
- _context23.next = 4;
4410
+ _context26.next = 4;
4228
4411
  break;
4229
4412
  }
4230
4413
  throw new Error("Image was not found");
@@ -4233,11 +4416,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4233
4416
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4234
4417
  case 6:
4235
4418
  case "end":
4236
- return _context23.stop();
4419
+ return _context26.stop();
4237
4420
  }
4238
- }, _callee23, this);
4421
+ }, _callee26, this);
4239
4422
  }));
4240
- function callServiceAPI(_x45, _x46, _x47) {
4423
+ function callServiceAPI(_x51, _x52, _x53) {
4241
4424
  return _callServiceAPI5.apply(this, arguments);
4242
4425
  }
4243
4426
  return callServiceAPI;
@@ -4245,17 +4428,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4245
4428
  }, {
4246
4429
  key: "extractResultData",
4247
4430
  value: function () {
4248
- var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
4249
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4250
- while (1) switch (_context24.prev = _context24.next) {
4431
+ var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4432
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4433
+ while (1) switch (_context27.prev = _context27.next) {
4251
4434
  case 0:
4252
4435
  if (!e.message) {
4253
- _context24.next = 2;
4436
+ _context27.next = 2;
4254
4437
  break;
4255
4438
  }
4256
4439
  throw e.message;
4257
4440
  case 2:
4258
- return _context24.abrupt("return", {
4441
+ return _context27.abrupt("return", {
4259
4442
  files: e.artifacts.map(function (n) {
4260
4443
  return {
4261
4444
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4265,11 +4448,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4265
4448
  });
4266
4449
  case 3:
4267
4450
  case "end":
4268
- return _context24.stop();
4451
+ return _context27.stop();
4269
4452
  }
4270
- }, _callee24);
4453
+ }, _callee27);
4271
4454
  }));
4272
- function extractResultData(_x48) {
4455
+ function extractResultData(_x54) {
4273
4456
  return _extractResultData3.apply(this, arguments);
4274
4457
  }
4275
4458
  return extractResultData;
@@ -4302,34 +4485,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
4302
4485
  _createClass(HuggingFaceAudioRecognitionIO, [{
4303
4486
  key: "extractPollResultData",
4304
4487
  value: function () {
4305
- var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
4306
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4307
- while (1) switch (_context25.prev = _context25.next) {
4488
+ var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4489
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4490
+ while (1) switch (_context28.prev = _context28.next) {
4308
4491
  case 0:
4309
4492
  if (!e.estimated_time) {
4310
- _context25.next = 2;
4493
+ _context28.next = 2;
4311
4494
  break;
4312
4495
  }
4313
- return _context25.abrupt("return", {
4496
+ return _context28.abrupt("return", {
4314
4497
  timeoutMS: (e.estimated_time + 1) * 1e3
4315
4498
  });
4316
4499
  case 2:
4317
4500
  if (!e.error) {
4318
- _context25.next = 4;
4501
+ _context28.next = 4;
4319
4502
  break;
4320
4503
  }
4321
4504
  throw e.error;
4322
4505
  case 4:
4323
- return _context25.abrupt("return", {
4506
+ return _context28.abrupt("return", {
4324
4507
  text: e.text || ""
4325
4508
  });
4326
4509
  case 5:
4327
4510
  case "end":
4328
- return _context25.stop();
4511
+ return _context28.stop();
4329
4512
  }
4330
- }, _callee25);
4513
+ }, _callee28);
4331
4514
  }));
4332
- function extractPollResultData(_x49) {
4515
+ function extractPollResultData(_x55) {
4333
4516
  return _extractPollResultData3.apply(this, arguments);
4334
4517
  }
4335
4518
  return extractPollResultData;
@@ -4350,26 +4533,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
4350
4533
  _createClass(HuggingFaceTextGenerationIO, [{
4351
4534
  key: "extractResultData",
4352
4535
  value: function () {
4353
- var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4354
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4355
- while (1) switch (_context26.prev = _context26.next) {
4536
+ var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4537
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4538
+ while (1) switch (_context29.prev = _context29.next) {
4356
4539
  case 0:
4357
4540
  if (!e.error) {
4358
- _context26.next = 2;
4541
+ _context29.next = 2;
4359
4542
  break;
4360
4543
  }
4361
4544
  throw e.error;
4362
4545
  case 2:
4363
- return _context26.abrupt("return", {
4546
+ return _context29.abrupt("return", {
4364
4547
  text: e[0].generated_text || ""
4365
4548
  });
4366
4549
  case 3:
4367
4550
  case "end":
4368
- return _context26.stop();
4551
+ return _context29.stop();
4369
4552
  }
4370
- }, _callee26);
4553
+ }, _callee29);
4371
4554
  }));
4372
- function extractResultData(_x50) {
4555
+ function extractResultData(_x56) {
4373
4556
  return _extractResultData4.apply(this, arguments);
4374
4557
  }
4375
4558
  return extractResultData;
@@ -4406,26 +4589,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
4406
4589
  }, {
4407
4590
  key: "extractResultData",
4408
4591
  value: function () {
4409
- var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4410
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4411
- while (1) switch (_context27.prev = _context27.next) {
4592
+ var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4593
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4594
+ while (1) switch (_context30.prev = _context30.next) {
4412
4595
  case 0:
4413
4596
  if (!e.error) {
4414
- _context27.next = 2;
4597
+ _context30.next = 2;
4415
4598
  break;
4416
4599
  }
4417
4600
  throw e.error;
4418
4601
  case 2:
4419
- return _context27.abrupt("return", {
4602
+ return _context30.abrupt("return", {
4420
4603
  text: e.answer || ""
4421
4604
  });
4422
4605
  case 3:
4423
4606
  case "end":
4424
- return _context27.stop();
4607
+ return _context30.stop();
4425
4608
  }
4426
- }, _callee27);
4609
+ }, _callee30);
4427
4610
  }));
4428
- function extractResultData(_x51) {
4611
+ function extractResultData(_x57) {
4429
4612
  return _extractResultData5.apply(this, arguments);
4430
4613
  }
4431
4614
  return extractResultData;
@@ -4446,26 +4629,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
4446
4629
  _createClass(HuggingFaceSummarizationIO, [{
4447
4630
  key: "extractResultData",
4448
4631
  value: function () {
4449
- var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4450
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4451
- while (1) switch (_context28.prev = _context28.next) {
4632
+ var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4633
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4634
+ while (1) switch (_context31.prev = _context31.next) {
4452
4635
  case 0:
4453
4636
  if (!e.error) {
4454
- _context28.next = 2;
4637
+ _context31.next = 2;
4455
4638
  break;
4456
4639
  }
4457
4640
  throw e.error;
4458
4641
  case 2:
4459
- return _context28.abrupt("return", {
4642
+ return _context31.abrupt("return", {
4460
4643
  text: e[0].summary_text || ""
4461
4644
  });
4462
4645
  case 3:
4463
4646
  case "end":
4464
- return _context28.stop();
4647
+ return _context31.stop();
4465
4648
  }
4466
- }, _callee28);
4649
+ }, _callee31);
4467
4650
  }));
4468
- function extractResultData(_x52) {
4651
+ function extractResultData(_x58) {
4469
4652
  return _extractResultData6.apply(this, arguments);
4470
4653
  }
4471
4654
  return extractResultData;
@@ -4526,26 +4709,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
4526
4709
  }, {
4527
4710
  key: "extractResultData",
4528
4711
  value: function () {
4529
- var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4530
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4531
- while (1) switch (_context29.prev = _context29.next) {
4712
+ var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4713
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4714
+ while (1) switch (_context32.prev = _context32.next) {
4532
4715
  case 0:
4533
4716
  if (!e.error) {
4534
- _context29.next = 2;
4717
+ _context32.next = 2;
4535
4718
  break;
4536
4719
  }
4537
4720
  throw e.error;
4538
4721
  case 2:
4539
- return _context29.abrupt("return", {
4722
+ return _context32.abrupt("return", {
4540
4723
  text: e.generated_text || ""
4541
4724
  });
4542
4725
  case 3:
4543
4726
  case "end":
4544
- return _context29.stop();
4727
+ return _context32.stop();
4545
4728
  }
4546
- }, _callee29);
4729
+ }, _callee32);
4547
4730
  }));
4548
- function extractResultData(_x53) {
4731
+ function extractResultData(_x59) {
4549
4732
  return _extractResultData7.apply(this, arguments);
4550
4733
  }
4551
4734
  return extractResultData;
@@ -4587,19 +4770,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4587
4770
  }, {
4588
4771
  key: "callServiceAPI",
4589
4772
  value: function () {
4590
- var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
4773
+ var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t, n) {
4591
4774
  var a, l, s, o;
4592
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4593
- while (1) switch (_context30.prev = _context30.next) {
4775
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4776
+ while (1) switch (_context33.prev = _context33.next) {
4594
4777
  case 0:
4595
4778
  if (this.requestSettings) {
4596
- _context30.next = 2;
4779
+ _context33.next = 2;
4597
4780
  break;
4598
4781
  }
4599
4782
  throw new Error("Request settings have not been set up");
4600
4783
  case 2:
4601
4784
  if (n) {
4602
- _context30.next = 4;
4785
+ _context33.next = 4;
4603
4786
  break;
4604
4787
  }
4605
4788
  throw new Error("Image was not found");
@@ -4608,11 +4791,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4608
4791
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4609
4792
  case 6:
4610
4793
  case "end":
4611
- return _context30.stop();
4794
+ return _context33.stop();
4612
4795
  }
4613
- }, _callee30, this);
4796
+ }, _callee33, this);
4614
4797
  }));
4615
- function callServiceAPI(_x54, _x55, _x56) {
4798
+ function callServiceAPI(_x60, _x61, _x62) {
4616
4799
  return _callServiceAPI6.apply(this, arguments);
4617
4800
  }
4618
4801
  return callServiceAPI;
@@ -4620,17 +4803,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4620
4803
  }, {
4621
4804
  key: "extractResultData",
4622
4805
  value: function () {
4623
- var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4624
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4625
- while (1) switch (_context31.prev = _context31.next) {
4806
+ var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4807
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4808
+ while (1) switch (_context34.prev = _context34.next) {
4626
4809
  case 0:
4627
4810
  if (!e.message) {
4628
- _context31.next = 2;
4811
+ _context34.next = 2;
4629
4812
  break;
4630
4813
  }
4631
4814
  throw e.message;
4632
4815
  case 2:
4633
- return _context31.abrupt("return", {
4816
+ return _context34.abrupt("return", {
4634
4817
  files: e.artifacts.map(function (n) {
4635
4818
  return {
4636
4819
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4640,11 +4823,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4640
4823
  });
4641
4824
  case 3:
4642
4825
  case "end":
4643
- return _context31.stop();
4826
+ return _context34.stop();
4644
4827
  }
4645
- }, _callee31);
4828
+ }, _callee34);
4646
4829
  }));
4647
- function extractResultData(_x57) {
4830
+ function extractResultData(_x63) {
4648
4831
  return _extractResultData8.apply(this, arguments);
4649
4832
  }
4650
4833
  return extractResultData;
@@ -4675,26 +4858,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
4675
4858
  _createClass(HuggingFaceTranslationIO, [{
4676
4859
  key: "extractResultData",
4677
4860
  value: function () {
4678
- var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4679
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4680
- while (1) switch (_context32.prev = _context32.next) {
4861
+ var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4862
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4863
+ while (1) switch (_context35.prev = _context35.next) {
4681
4864
  case 0:
4682
4865
  if (!e.error) {
4683
- _context32.next = 2;
4866
+ _context35.next = 2;
4684
4867
  break;
4685
4868
  }
4686
4869
  throw e.error;
4687
4870
  case 2:
4688
- return _context32.abrupt("return", {
4871
+ return _context35.abrupt("return", {
4689
4872
  text: e[0].translation_text || ""
4690
4873
  });
4691
4874
  case 3:
4692
4875
  case "end":
4693
- return _context32.stop();
4876
+ return _context35.stop();
4694
4877
  }
4695
- }, _callee32);
4878
+ }, _callee35);
4696
4879
  }));
4697
- function extractResultData(_x58) {
4880
+ function extractResultData(_x64) {
4698
4881
  return _extractResultData9.apply(this, arguments);
4699
4882
  }
4700
4883
  return extractResultData;
@@ -4728,13 +4911,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4728
4911
  }, {
4729
4912
  key: "callServiceAPI",
4730
4913
  value: function () {
4731
- var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
4914
+ var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
4732
4915
  var n;
4733
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4734
- while (1) switch (_context33.prev = _context33.next) {
4916
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4917
+ while (1) switch (_context36.prev = _context36.next) {
4735
4918
  case 0:
4736
4919
  if (this.requestSettings) {
4737
- _context33.next = 2;
4920
+ _context36.next = 2;
4738
4921
  break;
4739
4922
  }
4740
4923
  throw new Error("Request settings have not been set up");
@@ -4743,11 +4926,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4743
4926
  HTTPRequest.request(this, n, e);
4744
4927
  case 4:
4745
4928
  case "end":
4746
- return _context33.stop();
4929
+ return _context36.stop();
4747
4930
  }
4748
- }, _callee33, this);
4931
+ }, _callee36, this);
4749
4932
  }));
4750
- function callServiceAPI(_x59, _x60) {
4933
+ function callServiceAPI(_x65, _x66) {
4751
4934
  return _callServiceAPI7.apply(this, arguments);
4752
4935
  }
4753
4936
  return callServiceAPI;
@@ -4755,17 +4938,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4755
4938
  }, {
4756
4939
  key: "extractResultData",
4757
4940
  value: function () {
4758
- var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4759
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4760
- while (1) switch (_context34.prev = _context34.next) {
4941
+ var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
4942
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4943
+ while (1) switch (_context37.prev = _context37.next) {
4761
4944
  case 0:
4762
4945
  if (!e.message) {
4763
- _context34.next = 2;
4946
+ _context37.next = 2;
4764
4947
  break;
4765
4948
  }
4766
4949
  throw e.message;
4767
4950
  case 2:
4768
- return _context34.abrupt("return", {
4951
+ return _context37.abrupt("return", {
4769
4952
  files: e.artifacts.map(function (n) {
4770
4953
  return {
4771
4954
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4775,11 +4958,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4775
4958
  });
4776
4959
  case 3:
4777
4960
  case "end":
4778
- return _context34.stop();
4961
+ return _context37.stop();
4779
4962
  }
4780
- }, _callee34);
4963
+ }, _callee37);
4781
4964
  }));
4782
- function extractResultData(_x61) {
4965
+ function extractResultData(_x67) {
4783
4966
  return _extractResultData10.apply(this, arguments);
4784
4967
  }
4785
4968
  return extractResultData;
@@ -4812,26 +4995,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
4812
4995
  _createClass(HuggingFaceFillMaskIO, [{
4813
4996
  key: "extractResultData",
4814
4997
  value: function () {
4815
- var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4816
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4817
- while (1) switch (_context35.prev = _context35.next) {
4998
+ var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
4999
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
5000
+ while (1) switch (_context38.prev = _context38.next) {
4818
5001
  case 0:
4819
5002
  if (!e.error) {
4820
- _context35.next = 2;
5003
+ _context38.next = 2;
4821
5004
  break;
4822
5005
  }
4823
5006
  throw e.error;
4824
5007
  case 2:
4825
- return _context35.abrupt("return", {
5008
+ return _context38.abrupt("return", {
4826
5009
  text: e[0].sequence || ""
4827
5010
  });
4828
5011
  case 3:
4829
5012
  case "end":
4830
- return _context35.stop();
5013
+ return _context38.stop();
4831
5014
  }
4832
- }, _callee35);
5015
+ }, _callee38);
4833
5016
  }));
4834
- function extractResultData(_x62) {
5017
+ function extractResultData(_x68) {
4835
5018
  return _extractResultData11.apply(this, arguments);
4836
5019
  }
4837
5020
  return extractResultData;
@@ -4906,13 +5089,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4906
5089
  }, {
4907
5090
  key: "callServiceAPI",
4908
5091
  value: function () {
4909
- var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
5092
+ var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e, t) {
4910
5093
  var n;
4911
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4912
- while (1) switch (_context36.prev = _context36.next) {
5094
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
5095
+ while (1) switch (_context39.prev = _context39.next) {
4913
5096
  case 0:
4914
5097
  if (this.requestSettings) {
4915
- _context36.next = 2;
5098
+ _context39.next = 2;
4916
5099
  break;
4917
5100
  }
4918
5101
  throw new Error("Request settings have not been set up");
@@ -4921,11 +5104,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4921
5104
  HTTPRequest.request(this, n, e);
4922
5105
  case 4:
4923
5106
  case "end":
4924
- return _context36.stop();
5107
+ return _context39.stop();
4925
5108
  }
4926
- }, _callee36, this);
5109
+ }, _callee39, this);
4927
5110
  }));
4928
- function callServiceAPI(_x63, _x64) {
5111
+ function callServiceAPI(_x69, _x70) {
4929
5112
  return _callServiceAPI8.apply(this, arguments);
4930
5113
  }
4931
5114
  return callServiceAPI;
@@ -4933,27 +5116,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4933
5116
  }, {
4934
5117
  key: "extractResultData",
4935
5118
  value: function () {
4936
- var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
5119
+ var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e) {
4937
5120
  var t;
4938
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4939
- while (1) switch (_context37.prev = _context37.next) {
5121
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5122
+ while (1) switch (_context40.prev = _context40.next) {
4940
5123
  case 0:
4941
5124
  if (!e.message) {
4942
- _context37.next = 2;
5125
+ _context40.next = 2;
4943
5126
  break;
4944
5127
  }
4945
5128
  throw e.message;
4946
5129
  case 2:
4947
- return _context37.abrupt("return", {
5130
+ return _context40.abrupt("return", {
4948
5131
  text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
4949
5132
  });
4950
5133
  case 3:
4951
5134
  case "end":
4952
- return _context37.stop();
5135
+ return _context40.stop();
4953
5136
  }
4954
- }, _callee37);
5137
+ }, _callee40);
4955
5138
  }));
4956
- function extractResultData(_x65) {
5139
+ function extractResultData(_x71) {
4957
5140
  return _extractResultData12.apply(this, arguments);
4958
5141
  }
4959
5142
  return extractResultData;
@@ -4983,13 +5166,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4983
5166
  }, {
4984
5167
  key: "callServiceAPI",
4985
5168
  value: function () {
4986
- var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
5169
+ var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e, t) {
4987
5170
  var n;
4988
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4989
- while (1) switch (_context38.prev = _context38.next) {
5171
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5172
+ while (1) switch (_context41.prev = _context41.next) {
4990
5173
  case 0:
4991
5174
  if (this.requestSettings) {
4992
- _context38.next = 2;
5175
+ _context41.next = 2;
4993
5176
  break;
4994
5177
  }
4995
5178
  throw new Error("Request settings have not been set up");
@@ -4998,11 +5181,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4998
5181
  HTTPRequest.request(this, n, e);
4999
5182
  case 4:
5000
5183
  case "end":
5001
- return _context38.stop();
5184
+ return _context41.stop();
5002
5185
  }
5003
- }, _callee38, this);
5186
+ }, _callee41, this);
5004
5187
  }));
5005
- function callServiceAPI(_x66, _x67) {
5188
+ function callServiceAPI(_x72, _x73) {
5006
5189
  return _callServiceAPI9.apply(this, arguments);
5007
5190
  }
5008
5191
  return callServiceAPI;
@@ -5010,26 +5193,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5010
5193
  }, {
5011
5194
  key: "extractResultData",
5012
5195
  value: function () {
5013
- var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
5014
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
5015
- while (1) switch (_context39.prev = _context39.next) {
5196
+ var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5197
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5198
+ while (1) switch (_context42.prev = _context42.next) {
5016
5199
  case 0:
5017
5200
  if (!e.message) {
5018
- _context39.next = 2;
5201
+ _context42.next = 2;
5019
5202
  break;
5020
5203
  }
5021
5204
  throw e.message;
5022
5205
  case 2:
5023
- return _context39.abrupt("return", {
5206
+ return _context42.abrupt("return", {
5024
5207
  text: e.summary || ""
5025
5208
  });
5026
5209
  case 3:
5027
5210
  case "end":
5028
- return _context39.stop();
5211
+ return _context42.stop();
5029
5212
  }
5030
- }, _callee39);
5213
+ }, _callee42);
5031
5214
  }));
5032
- function extractResultData(_x68) {
5215
+ function extractResultData(_x74) {
5033
5216
  return _extractResultData13.apply(this, arguments);
5034
5217
  }
5035
5218
  return extractResultData;
@@ -5186,13 +5369,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5186
5369
  }, {
5187
5370
  key: "callServiceAPI",
5188
5371
  value: function () {
5189
- var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
5372
+ var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5190
5373
  var n;
5191
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5192
- while (1) switch (_context40.prev = _context40.next) {
5374
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5375
+ while (1) switch (_context43.prev = _context43.next) {
5193
5376
  case 0:
5194
5377
  if (this.requestSettings) {
5195
- _context40.next = 2;
5378
+ _context43.next = 2;
5196
5379
  break;
5197
5380
  }
5198
5381
  throw new Error("Request settings have not been set up");
@@ -5201,11 +5384,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5201
5384
  HTTPRequest.request(this, n, e), this.messages = e;
5202
5385
  case 4:
5203
5386
  case "end":
5204
- return _context40.stop();
5387
+ return _context43.stop();
5205
5388
  }
5206
- }, _callee40, this);
5389
+ }, _callee43, this);
5207
5390
  }));
5208
- function callServiceAPI(_x69, _x70) {
5391
+ function callServiceAPI(_x75, _x76) {
5209
5392
  return _callServiceAPI10.apply(this, arguments);
5210
5393
  }
5211
5394
  return callServiceAPI;
@@ -5213,13 +5396,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5213
5396
  }, {
5214
5397
  key: "extractResultData",
5215
5398
  value: function () {
5216
- var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
5399
+ var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5217
5400
  var t, n, s;
5218
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5219
- while (1) switch (_context41.prev = _context41.next) {
5401
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5402
+ while (1) switch (_context44.prev = _context44.next) {
5220
5403
  case 0:
5221
5404
  if (!e.error) {
5222
- _context41.next = 2;
5405
+ _context44.next = 2;
5223
5406
  break;
5224
5407
  }
5225
5408
  throw e.error.message;
@@ -5231,16 +5414,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5231
5414
  };
5232
5415
  HTTPRequest.executePollRequest(this, n, s, this.messages);
5233
5416
  }
5234
- return _context41.abrupt("return", {
5417
+ return _context44.abrupt("return", {
5235
5418
  pollingInAnotherRequest: !0
5236
5419
  });
5237
5420
  case 4:
5238
5421
  case "end":
5239
- return _context41.stop();
5422
+ return _context44.stop();
5240
5423
  }
5241
- }, _callee41, this);
5424
+ }, _callee44, this);
5242
5425
  }));
5243
- function extractResultData(_x71) {
5426
+ function extractResultData(_x77) {
5244
5427
  return _extractResultData14.apply(this, arguments);
5245
5428
  }
5246
5429
  return extractResultData;
@@ -5248,33 +5431,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5248
5431
  }, {
5249
5432
  key: "extractPollResultData",
5250
5433
  value: function () {
5251
- var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5434
+ var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5252
5435
  var t, _iterator, _step, n;
5253
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5254
- while (1) switch (_context42.prev = _context42.next) {
5436
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5437
+ while (1) switch (_context45.prev = _context45.next) {
5255
5438
  case 0:
5256
5439
  if (!e.error) {
5257
- _context42.next = 2;
5440
+ _context45.next = 2;
5258
5441
  break;
5259
5442
  }
5260
5443
  throw e.error;
5261
5444
  case 2:
5262
5445
  if (!(e.status === "running")) {
5263
- _context42.next = 4;
5446
+ _context45.next = 4;
5264
5447
  break;
5265
5448
  }
5266
- return _context42.abrupt("return", {
5449
+ return _context45.abrupt("return", {
5267
5450
  timeoutMS: 2e3
5268
5451
  });
5269
5452
  case 4:
5270
5453
  if (!(e.errors.length > 0)) {
5271
- _context42.next = 6;
5454
+ _context45.next = 6;
5272
5455
  break;
5273
5456
  }
5274
5457
  throw e.errors[0];
5275
5458
  case 6:
5276
5459
  if (!(e.tasks.items[0].results.errors.length > 0)) {
5277
- _context42.next = 8;
5460
+ _context45.next = 8;
5278
5461
  break;
5279
5462
  }
5280
5463
  throw e.tasks.items[0].results.errors[0];
@@ -5291,16 +5474,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5291
5474
  } finally {
5292
5475
  _iterator.f();
5293
5476
  }
5294
- return _context42.abrupt("return", {
5477
+ return _context45.abrupt("return", {
5295
5478
  text: t || ""
5296
5479
  });
5297
5480
  case 12:
5298
5481
  case "end":
5299
- return _context42.stop();
5482
+ return _context45.stop();
5300
5483
  }
5301
- }, _callee42);
5484
+ }, _callee45);
5302
5485
  }));
5303
- function extractPollResultData(_x72) {
5486
+ function extractPollResultData(_x78) {
5304
5487
  return _extractPollResultData4.apply(this, arguments);
5305
5488
  }
5306
5489
  return extractPollResultData;
@@ -5399,13 +5582,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5399
5582
  }, {
5400
5583
  key: "callServiceAPI",
5401
5584
  value: function () {
5402
- var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5585
+ var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t) {
5403
5586
  var n;
5404
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5405
- while (1) switch (_context43.prev = _context43.next) {
5587
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5588
+ while (1) switch (_context46.prev = _context46.next) {
5406
5589
  case 0:
5407
5590
  if (this.requestSettings) {
5408
- _context43.next = 2;
5591
+ _context46.next = 2;
5409
5592
  break;
5410
5593
  }
5411
5594
  throw new Error("Request settings have not been set up");
@@ -5414,11 +5597,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5414
5597
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
5415
5598
  case 4:
5416
5599
  case "end":
5417
- return _context43.stop();
5600
+ return _context46.stop();
5418
5601
  }
5419
- }, _callee43, this);
5602
+ }, _callee46, this);
5420
5603
  }));
5421
- function callServiceAPI(_x73, _x74) {
5604
+ function callServiceAPI(_x79, _x80) {
5422
5605
  return _callServiceAPI11.apply(this, arguments);
5423
5606
  }
5424
5607
  return callServiceAPI;
@@ -5426,27 +5609,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5426
5609
  }, {
5427
5610
  key: "extractResultData",
5428
5611
  value: function () {
5429
- var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5612
+ var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5430
5613
  var t;
5431
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5432
- while (1) switch (_context44.prev = _context44.next) {
5614
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5615
+ while (1) switch (_context47.prev = _context47.next) {
5433
5616
  case 0:
5434
5617
  if (!e.error) {
5435
- _context44.next = 2;
5618
+ _context47.next = 2;
5436
5619
  break;
5437
5620
  }
5438
5621
  throw e.error.message;
5439
5622
  case 2:
5440
- return _context44.abrupt("return", {
5623
+ return _context47.abrupt("return", {
5441
5624
  text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
5442
5625
  });
5443
5626
  case 3:
5444
5627
  case "end":
5445
- return _context44.stop();
5628
+ return _context47.stop();
5446
5629
  }
5447
- }, _callee44);
5630
+ }, _callee47);
5448
5631
  }));
5449
- function extractResultData(_x75) {
5632
+ function extractResultData(_x81) {
5450
5633
  return _extractResultData15.apply(this, arguments);
5451
5634
  }
5452
5635
  return extractResultData;
@@ -5461,17 +5644,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5461
5644
  _createClass(AssemblyAIUtils, null, [{
5462
5645
  key: "poll",
5463
5646
  value: function () {
5464
- var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
5647
+ var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5465
5648
  var n, l, c, d;
5466
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5467
- while (1) switch (_context45.prev = _context45.next) {
5649
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5650
+ while (1) switch (_context48.prev = _context48.next) {
5468
5651
  case 0:
5469
5652
  n = {
5470
5653
  authorization: e,
5471
5654
  "content-type": "application/json"
5472
5655
  };
5473
- _context45.t0 = "https://api.assemblyai.com/v2/transcript/";
5474
- _context45.next = 4;
5656
+ _context48.t0 = "https://api.assemblyai.com/v2/transcript/";
5657
+ _context48.next = 4;
5475
5658
  return fetch("https://api.assemblyai.com/v2/transcript", {
5476
5659
  method: "POST",
5477
5660
  body: JSON.stringify({
@@ -5480,55 +5663,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5480
5663
  headers: n
5481
5664
  });
5482
5665
  case 4:
5483
- _context45.next = 6;
5484
- return _context45.sent.json();
5666
+ _context48.next = 6;
5667
+ return _context48.sent.json();
5485
5668
  case 6:
5486
- _context45.t1 = _context45.sent.id;
5487
- l = _context45.t0.concat.call(_context45.t0, _context45.t1);
5669
+ _context48.t1 = _context48.sent.id;
5670
+ l = _context48.t0.concat.call(_context48.t0, _context48.t1);
5488
5671
  case 8:
5489
5672
  if (c) {
5490
- _context45.next = 24;
5673
+ _context48.next = 24;
5491
5674
  break;
5492
5675
  }
5493
- _context45.next = 11;
5676
+ _context48.next = 11;
5494
5677
  return fetch(l, {
5495
5678
  headers: n
5496
5679
  });
5497
5680
  case 11:
5498
- _context45.next = 13;
5499
- return _context45.sent.json();
5681
+ _context48.next = 13;
5682
+ return _context48.sent.json();
5500
5683
  case 13:
5501
- d = _context45.sent;
5684
+ d = _context48.sent;
5502
5685
  if (!(d.status === "completed")) {
5503
- _context45.next = 18;
5686
+ _context48.next = 18;
5504
5687
  break;
5505
5688
  }
5506
5689
  c = d;
5507
- _context45.next = 22;
5690
+ _context48.next = 22;
5508
5691
  break;
5509
5692
  case 18:
5510
5693
  if (!(d.status === "error")) {
5511
- _context45.next = 20;
5694
+ _context48.next = 20;
5512
5695
  break;
5513
5696
  }
5514
5697
  throw new Error("Transcription failed: ".concat(d.error));
5515
5698
  case 20:
5516
- _context45.next = 22;
5699
+ _context48.next = 22;
5517
5700
  return new Promise(function (h) {
5518
5701
  return setTimeout(h, 3e3);
5519
5702
  });
5520
5703
  case 22:
5521
- _context45.next = 8;
5704
+ _context48.next = 8;
5522
5705
  break;
5523
5706
  case 24:
5524
- return _context45.abrupt("return", c);
5707
+ return _context48.abrupt("return", c);
5525
5708
  case 25:
5526
5709
  case "end":
5527
- return _context45.stop();
5710
+ return _context48.stop();
5528
5711
  }
5529
- }, _callee45);
5712
+ }, _callee48);
5530
5713
  }));
5531
- function poll(_x76, _x77) {
5714
+ function poll(_x82, _x83) {
5532
5715
  return _poll2.apply(this, arguments);
5533
5716
  }
5534
5717
  return poll;
@@ -5576,19 +5759,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5576
5759
  _createClass(AssemblyAIAudioIO, [{
5577
5760
  key: "callServiceAPI",
5578
5761
  value: function () {
5579
- var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
5762
+ var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t, n) {
5580
5763
  var s;
5581
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5582
- while (1) switch (_context46.prev = _context46.next) {
5764
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5765
+ while (1) switch (_context49.prev = _context49.next) {
5583
5766
  case 0:
5584
5767
  if ((s = this.requestSettings) != null && s.headers) {
5585
- _context46.next = 2;
5768
+ _context49.next = 2;
5586
5769
  break;
5587
5770
  }
5588
5771
  throw new Error("Request settings have not been set up");
5589
5772
  case 2:
5590
5773
  if (n != null && n[0]) {
5591
- _context46.next = 4;
5774
+ _context49.next = 4;
5592
5775
  break;
5593
5776
  }
5594
5777
  throw new Error("No file was added");
@@ -5596,11 +5779,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5596
5779
  HTTPRequest.request(this, n[0], e, !1);
5597
5780
  case 5:
5598
5781
  case "end":
5599
- return _context46.stop();
5782
+ return _context49.stop();
5600
5783
  }
5601
- }, _callee46, this);
5784
+ }, _callee49, this);
5602
5785
  }));
5603
- function callServiceAPI(_x78, _x79, _x80) {
5786
+ function callServiceAPI(_x84, _x85, _x86) {
5604
5787
  return _callServiceAPI12.apply(this, arguments);
5605
5788
  }
5606
5789
  return callServiceAPI;
@@ -5608,32 +5791,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5608
5791
  }, {
5609
5792
  key: "extractResultData",
5610
5793
  value: function () {
5611
- var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5794
+ var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e) {
5612
5795
  var s, o, t;
5613
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5614
- while (1) switch (_context47.prev = _context47.next) {
5796
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5797
+ while (1) switch (_context50.prev = _context50.next) {
5615
5798
  case 0:
5616
5799
  if (!e.error) {
5617
- _context47.next = 2;
5800
+ _context50.next = 2;
5618
5801
  break;
5619
5802
  }
5620
5803
  throw e.error;
5621
5804
  case 2:
5622
5805
  t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
5623
- _context47.next = 5;
5806
+ _context50.next = 5;
5624
5807
  return AssemblyAIUtils.poll(t, e.upload_url);
5625
5808
  case 5:
5626
- _context47.t0 = _context47.sent.text;
5627
- return _context47.abrupt("return", {
5628
- text: _context47.t0
5809
+ _context50.t0 = _context50.sent.text;
5810
+ return _context50.abrupt("return", {
5811
+ text: _context50.t0
5629
5812
  });
5630
5813
  case 7:
5631
5814
  case "end":
5632
- return _context47.stop();
5815
+ return _context50.stop();
5633
5816
  }
5634
- }, _callee47, this);
5817
+ }, _callee50, this);
5635
5818
  }));
5636
- function extractResultData(_x81) {
5819
+ function extractResultData(_x87) {
5637
5820
  return _extractResultData16.apply(this, arguments);
5638
5821
  }
5639
5822
  return extractResultData;
@@ -5683,13 +5866,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5683
5866
  }, {
5684
5867
  key: "callServiceAPI",
5685
5868
  value: function () {
5686
- var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5869
+ var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e, t) {
5687
5870
  var n;
5688
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5689
- while (1) switch (_context48.prev = _context48.next) {
5871
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5872
+ while (1) switch (_context51.prev = _context51.next) {
5690
5873
  case 0:
5691
5874
  if (this.requestSettings) {
5692
- _context48.next = 2;
5875
+ _context51.next = 2;
5693
5876
  break;
5694
5877
  }
5695
5878
  throw new Error("Request settings have not been set up");
@@ -5698,11 +5881,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5698
5881
  HTTPRequest.request(this, n, e, !1);
5699
5882
  case 4:
5700
5883
  case "end":
5701
- return _context48.stop();
5884
+ return _context51.stop();
5702
5885
  }
5703
- }, _callee48, this);
5886
+ }, _callee51, this);
5704
5887
  }));
5705
- function callServiceAPI(_x82, _x83) {
5888
+ function callServiceAPI(_x88, _x89) {
5706
5889
  return _callServiceAPI13.apply(this, arguments);
5707
5890
  }
5708
5891
  return callServiceAPI;
@@ -5710,11 +5893,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5710
5893
  }, {
5711
5894
  key: "extractResultData",
5712
5895
  value: function () {
5713
- var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
5714
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5715
- while (1) switch (_context49.prev = _context49.next) {
5896
+ var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e) {
5897
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5898
+ while (1) switch (_context52.prev = _context52.next) {
5716
5899
  case 0:
5717
- return _context49.abrupt("return", new Promise(function (t) {
5900
+ return _context52.abrupt("return", new Promise(function (t) {
5718
5901
  var n = new FileReader();
5719
5902
  n.readAsDataURL(e), n.onload = function (s) {
5720
5903
  t({
@@ -5727,11 +5910,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5727
5910
  }));
5728
5911
  case 1:
5729
5912
  case "end":
5730
- return _context49.stop();
5913
+ return _context52.stop();
5731
5914
  }
5732
- }, _callee49);
5915
+ }, _callee52);
5733
5916
  }));
5734
- function extractResultData(_x84) {
5917
+ function extractResultData(_x90) {
5735
5918
  return _extractResultData17.apply(this, arguments);
5736
5919
  }
5737
5920
  return extractResultData;
@@ -5744,11 +5927,11 @@ _AzureTextToSpeechIO.HELP_LINK =
5744
5927
  "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
5745
5928
  var AzureTextToSpeechIO = _AzureTextToSpeechIO;
5746
5929
  var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5747
- _inherits(U, _AzureSpeechIO2);
5748
- var _super28 = _createSuper(U);
5749
- function U(e) {
5930
+ _inherits(j, _AzureSpeechIO2);
5931
+ var _super28 = _createSuper(j);
5932
+ function j(e) {
5750
5933
  var _this21;
5751
- _classCallCheck(this, U);
5934
+ _classCallCheck(this, j);
5752
5935
  var a, l, c;
5753
5936
  var t = (l = (a = e.directConnection) == null ? void 0 : a.azure) == null ? void 0 : l.speechToText,
5754
5937
  n = (c = e.directConnection) == null ? void 0 : c.azure,
@@ -5759,27 +5942,27 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5759
5942
  }
5760
5943
  }
5761
5944
  };
5762
- _this21 = _super28.call(this, e, AzureUtils.buildSpeechToTextHeaders, t.region, n, s), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(U.HELP_LINK, "\">here</a> for more info.\n </p>"), _this21.url = "", _this21.isTextInputDisabled = !0, _this21.textInputPlaceholderText = "Upload an audio file", _this21.canSendMessage = U.canFileSendMessage;
5945
+ _this21 = _super28.call(this, e, AzureUtils.buildSpeechToTextHeaders, t.region, n, s), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(j.HELP_LINK, "\">here</a> for more info.\n </p>"), _this21.url = "", _this21.isTextInputDisabled = !0, _this21.textInputPlaceholderText = "Upload an audio file", _this21.canSendMessage = j.canFileSendMessage;
5763
5946
  var o = t.lang || "en-US";
5764
5947
  _this21.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(o, "&format=detailed"), _this21.recordAudio = void 0;
5765
5948
  return _this21;
5766
5949
  }
5767
- _createClass(U, [{
5950
+ _createClass(j, [{
5768
5951
  key: "callServiceAPI",
5769
5952
  value: function () {
5770
- var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5953
+ var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e, t, n) {
5771
5954
  var s, o;
5772
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5773
- while (1) switch (_context50.prev = _context50.next) {
5955
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5956
+ while (1) switch (_context53.prev = _context53.next) {
5774
5957
  case 0:
5775
5958
  if ((s = this.requestSettings) != null && s.headers) {
5776
- _context50.next = 2;
5959
+ _context53.next = 2;
5777
5960
  break;
5778
5961
  }
5779
5962
  throw new Error("Request settings have not been set up");
5780
5963
  case 2:
5781
5964
  if (n != null && n[0]) {
5782
- _context50.next = 4;
5965
+ _context53.next = 4;
5783
5966
  break;
5784
5967
  }
5785
5968
  throw new Error("No file was added");
@@ -5787,11 +5970,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5787
5970
  (o = this.requestSettings) != null && o.headers && (this.requestSettings.headers["Content-Type"] = n[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), HTTPRequest.request(this, n[0], e, !1);
5788
5971
  case 5:
5789
5972
  case "end":
5790
- return _context50.stop();
5973
+ return _context53.stop();
5791
5974
  }
5792
- }, _callee50, this);
5975
+ }, _callee53, this);
5793
5976
  }));
5794
- function callServiceAPI(_x85, _x86, _x87) {
5977
+ function callServiceAPI(_x91, _x92, _x93) {
5795
5978
  return _callServiceAPI14.apply(this, arguments);
5796
5979
  }
5797
5980
  return callServiceAPI;
@@ -5799,26 +5982,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5799
5982
  }, {
5800
5983
  key: "extractResultData",
5801
5984
  value: function () {
5802
- var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5803
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5804
- while (1) switch (_context51.prev = _context51.next) {
5985
+ var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e) {
5986
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5987
+ while (1) switch (_context54.prev = _context54.next) {
5805
5988
  case 0:
5806
5989
  if (!e.error) {
5807
- _context51.next = 2;
5990
+ _context54.next = 2;
5808
5991
  break;
5809
5992
  }
5810
5993
  throw e.error;
5811
5994
  case 2:
5812
- return _context51.abrupt("return", {
5995
+ return _context54.abrupt("return", {
5813
5996
  text: e.DisplayText || ""
5814
5997
  });
5815
5998
  case 3:
5816
5999
  case "end":
5817
- return _context51.stop();
6000
+ return _context54.stop();
5818
6001
  }
5819
- }, _callee51);
6002
+ }, _callee54);
5820
6003
  }));
5821
- function extractResultData(_x88) {
6004
+ function extractResultData(_x94) {
5822
6005
  return _extractResultData18.apply(this, arguments);
5823
6006
  }
5824
6007
  return extractResultData;
@@ -5829,7 +6012,7 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5829
6012
  return !!(t != null && t[0]);
5830
6013
  }
5831
6014
  }]);
5832
- return U;
6015
+ return j;
5833
6016
  }(AzureSpeechIO);
5834
6017
  _AzureSpeechToTextIO.HELP_LINK =
5835
6018
  // eslint-disable-next-line max-len
@@ -5861,13 +6044,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5861
6044
  }, {
5862
6045
  key: "callServiceAPI",
5863
6046
  value: function () {
5864
- var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
6047
+ var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e, t) {
5865
6048
  var n;
5866
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5867
- while (1) switch (_context52.prev = _context52.next) {
6049
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
6050
+ while (1) switch (_context55.prev = _context55.next) {
5868
6051
  case 0:
5869
6052
  if (this.requestSettings) {
5870
- _context52.next = 2;
6053
+ _context55.next = 2;
5871
6054
  break;
5872
6055
  }
5873
6056
  throw new Error("Request settings have not been set up");
@@ -5876,11 +6059,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5876
6059
  HTTPRequest.request(this, n, e);
5877
6060
  case 4:
5878
6061
  case "end":
5879
- return _context52.stop();
6062
+ return _context55.stop();
5880
6063
  }
5881
- }, _callee52, this);
6064
+ }, _callee55, this);
5882
6065
  }));
5883
- function callServiceAPI(_x89, _x90) {
6066
+ function callServiceAPI(_x95, _x96) {
5884
6067
  return _callServiceAPI15.apply(this, arguments);
5885
6068
  }
5886
6069
  return callServiceAPI;
@@ -5888,27 +6071,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5888
6071
  }, {
5889
6072
  key: "extractResultData",
5890
6073
  value: function () {
5891
- var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
6074
+ var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e) {
5892
6075
  var t;
5893
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5894
- while (1) switch (_context53.prev = _context53.next) {
6076
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6077
+ while (1) switch (_context56.prev = _context56.next) {
5895
6078
  case 0:
5896
6079
  if (!Array.isArray(e)) {
5897
- _context53.next = 2;
6080
+ _context56.next = 2;
5898
6081
  break;
5899
6082
  }
5900
- return _context53.abrupt("return", {
6083
+ return _context56.abrupt("return", {
5901
6084
  text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
5902
6085
  });
5903
6086
  case 2:
5904
6087
  throw e.error;
5905
6088
  case 3:
5906
6089
  case "end":
5907
- return _context53.stop();
6090
+ return _context56.stop();
5908
6091
  }
5909
- }, _callee53);
6092
+ }, _callee56);
5910
6093
  }));
5911
- function extractResultData(_x91) {
6094
+ function extractResultData(_x97) {
5912
6095
  return _extractResultData19.apply(this, arguments);
5913
6096
  }
5914
6097
  return extractResultData;
@@ -5917,11 +6100,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5917
6100
  return AzureTranslationIO;
5918
6101
  }(DirectServiceIO);
5919
6102
  var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5920
- _inherits(A, _DirectServiceIO9);
5921
- var _super30 = _createSuper(A);
5922
- function A(e) {
6103
+ _inherits(M, _DirectServiceIO9);
6104
+ var _super30 = _createSuper(M);
6105
+ function M(e) {
5923
6106
  var _this23;
5924
- _classCallCheck(this, A);
6107
+ _classCallCheck(this, M);
5925
6108
  var l;
5926
6109
  var t = e.directConnection,
5927
6110
  n = e.textInput,
@@ -5945,10 +6128,10 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5945
6128
  }
5946
6129
  };
5947
6130
  }
5948
- _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
6131
+ _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = M.canFileSendMessage;
5949
6132
  return _this23;
5950
6133
  }
5951
- _createClass(A, [{
6134
+ _createClass(M, [{
5952
6135
  key: "preprocessBody",
5953
6136
  value: function preprocessBody(e, t) {
5954
6137
  var n = JSON.parse(JSON.stringify(e));
@@ -5966,50 +6149,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5966
6149
  var s;
5967
6150
  var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
5968
6151
  if (n[1] || o && o !== "") {
5969
- this.url = A.IMAGE_EDIT_URL;
6152
+ this.url = M.IMAGE_EDIT_URL;
5970
6153
  var c = this.preprocessBody(this.rawBody, o);
5971
- s = A.createFormDataBody(c, n[0], n[1]);
5972
- } else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
6154
+ s = M.createFormDataBody(c, n[0], n[1]);
6155
+ } else this.url = M.IMAGE_VARIATIONS_URL, s = M.createFormDataBody(this.rawBody, n[0]);
5973
6156
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
5974
6157
  }
5975
6158
  }, {
5976
6159
  key: "callServiceAPI",
5977
6160
  value: function () {
5978
- var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
6161
+ var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e, t, n) {
5979
6162
  var s, o;
5980
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5981
- while (1) switch (_context54.prev = _context54.next) {
6163
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6164
+ while (1) switch (_context57.prev = _context57.next) {
5982
6165
  case 0:
5983
6166
  if ((s = this.requestSettings) != null && s.headers) {
5984
- _context54.next = 2;
6167
+ _context57.next = 2;
5985
6168
  break;
5986
6169
  }
5987
6170
  throw new Error("Request settings have not been set up");
5988
6171
  case 2:
5989
6172
  if (!(n != null && n[0])) {
5990
- _context54.next = 6;
6173
+ _context57.next = 6;
5991
6174
  break;
5992
6175
  }
5993
6176
  this.callApiWithImage(e, t, n);
5994
- _context54.next = 11;
6177
+ _context57.next = 11;
5995
6178
  break;
5996
6179
  case 6:
5997
6180
  if (this.requestSettings) {
5998
- _context54.next = 8;
6181
+ _context57.next = 8;
5999
6182
  break;
6000
6183
  }
6001
6184
  throw new Error("Request settings have not been set up");
6002
6185
  case 8:
6003
- this.url = A.IMAGE_GENERATION_URL;
6186
+ this.url = M.IMAGE_GENERATION_URL;
6004
6187
  o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6005
6188
  HTTPRequest.request(this, o, e);
6006
6189
  case 11:
6007
6190
  case "end":
6008
- return _context54.stop();
6191
+ return _context57.stop();
6009
6192
  }
6010
- }, _callee54, this);
6193
+ }, _callee57, this);
6011
6194
  }));
6012
- function callServiceAPI(_x92, _x93, _x94) {
6195
+ function callServiceAPI(_x98, _x99, _x100) {
6013
6196
  return _callServiceAPI16.apply(this, arguments);
6014
6197
  }
6015
6198
  return callServiceAPI;
@@ -6017,17 +6200,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6017
6200
  }, {
6018
6201
  key: "extractResultData",
6019
6202
  value: function () {
6020
- var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
6021
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
6022
- while (1) switch (_context55.prev = _context55.next) {
6203
+ var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e) {
6204
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6205
+ while (1) switch (_context58.prev = _context58.next) {
6023
6206
  case 0:
6024
6207
  if (!e.error) {
6025
- _context55.next = 2;
6208
+ _context58.next = 2;
6026
6209
  break;
6027
6210
  }
6028
6211
  throw e.error.message;
6029
6212
  case 2:
6030
- return _context55.abrupt("return", {
6213
+ return _context58.abrupt("return", {
6031
6214
  files: e.data.map(function (n) {
6032
6215
  return n.url ? {
6033
6216
  src: n.url,
@@ -6040,11 +6223,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6040
6223
  });
6041
6224
  case 3:
6042
6225
  case "end":
6043
- return _context55.stop();
6226
+ return _context58.stop();
6044
6227
  }
6045
- }, _callee55);
6228
+ }, _callee58);
6046
6229
  }));
6047
- function extractResultData(_x95) {
6230
+ function extractResultData(_x101) {
6048
6231
  return _extractResultData20.apply(this, arguments);
6049
6232
  }
6050
6233
  return extractResultData;
@@ -6071,34 +6254,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6071
6254
  }), s;
6072
6255
  }
6073
6256
  }]);
6074
- return A;
6257
+ return M;
6075
6258
  }(DirectServiceIO);
6076
6259
  _OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
6077
6260
  _OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
6078
6261
  _OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
6079
6262
  var OpenAIImagesIO = _OpenAIImagesIO;
6080
6263
  var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6081
- _inherits(M, _DirectServiceIO10);
6082
- var _super31 = _createSuper(M);
6083
- function M(e) {
6264
+ _inherits(k, _DirectServiceIO10);
6265
+ var _super31 = _createSuper(k);
6266
+ function k(e) {
6084
6267
  var _l$model2;
6085
6268
  var _this24;
6086
- _classCallCheck(this, M);
6269
+ _classCallCheck(this, k);
6087
6270
  var a, l;
6088
6271
  var t = e.directConnection,
6089
6272
  n = e.textInput,
6090
6273
  s = t == null ? void 0 : t.openAI;
6091
6274
  _this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
6092
6275
  audio: {}
6093
- }), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = M.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
6276
+ }), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = k.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
6094
6277
  var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
6095
- _typeof(o) == "object" && (_this24.processConfig(o), M.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = M.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = M.canSendFileMessage;
6278
+ _typeof(o) == "object" && (_this24.processConfig(o), k.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = k.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = k.canSendFileMessage;
6096
6279
  return _this24;
6097
6280
  }
6098
- _createClass(M, [{
6281
+ _createClass(k, [{
6099
6282
  key: "processConfig",
6100
6283
  value: function processConfig(e) {
6101
- e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
6284
+ e != null && e.type && e.type === "translation" && (this._service_url = k.AUDIO_TRANSLATIONS_URL, delete e.language);
6102
6285
  }
6103
6286
  }, {
6104
6287
  key: "preprocessBody",
@@ -6116,33 +6299,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6116
6299
  }, {
6117
6300
  key: "callServiceAPI",
6118
6301
  value: function () {
6119
- var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
6302
+ var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e, t, n) {
6120
6303
  var a, s, o;
6121
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6122
- while (1) switch (_context56.prev = _context56.next) {
6304
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6305
+ while (1) switch (_context59.prev = _context59.next) {
6123
6306
  case 0:
6124
6307
  if ((a = this.requestSettings) != null && a.headers) {
6125
- _context56.next = 2;
6308
+ _context59.next = 2;
6126
6309
  break;
6127
6310
  }
6128
6311
  throw new Error("Request settings have not been set up");
6129
6312
  case 2:
6130
6313
  if (n != null && n[0]) {
6131
- _context56.next = 4;
6314
+ _context59.next = 4;
6132
6315
  break;
6133
6316
  }
6134
6317
  throw new Error("No file was added");
6135
6318
  case 4:
6136
6319
  this.url = this.requestSettings.url || this._service_url;
6137
- s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
6320
+ s = this.preprocessBody(this.rawBody, t, n), o = k.createFormDataBody(s, n[0]);
6138
6321
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
6139
6322
  case 7:
6140
6323
  case "end":
6141
- return _context56.stop();
6324
+ return _context59.stop();
6142
6325
  }
6143
- }, _callee56, this);
6326
+ }, _callee59, this);
6144
6327
  }));
6145
- function callServiceAPI(_x96, _x97, _x98) {
6328
+ function callServiceAPI(_x102, _x103, _x104) {
6146
6329
  return _callServiceAPI17.apply(this, arguments);
6147
6330
  }
6148
6331
  return callServiceAPI;
@@ -6150,26 +6333,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6150
6333
  }, {
6151
6334
  key: "extractResultData",
6152
6335
  value: function () {
6153
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
6154
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6155
- while (1) switch (_context57.prev = _context57.next) {
6336
+ var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e) {
6337
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6338
+ while (1) switch (_context60.prev = _context60.next) {
6156
6339
  case 0:
6157
6340
  if (!e.error) {
6158
- _context57.next = 2;
6341
+ _context60.next = 2;
6159
6342
  break;
6160
6343
  }
6161
6344
  throw e.error.message;
6162
6345
  case 2:
6163
- return _context57.abrupt("return", {
6346
+ return _context60.abrupt("return", {
6164
6347
  text: e.text
6165
6348
  });
6166
6349
  case 3:
6167
6350
  case "end":
6168
- return _context57.stop();
6351
+ return _context60.stop();
6169
6352
  }
6170
- }, _callee57);
6353
+ }, _callee60);
6171
6354
  }));
6172
- function extractResultData(_x99) {
6355
+ function extractResultData(_x105) {
6173
6356
  return _extractResultData21.apply(this, arguments);
6174
6357
  }
6175
6358
  return extractResultData;
@@ -6193,7 +6376,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6193
6376
  }), n;
6194
6377
  }
6195
6378
  }]);
6196
- return M;
6379
+ return k;
6197
6380
  }(DirectServiceIO);
6198
6381
  _OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
6199
6382
  _OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
@@ -6235,13 +6418,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6235
6418
  }, {
6236
6419
  key: "callServiceAPI",
6237
6420
  value: function () {
6238
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
6421
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e, t) {
6239
6422
  var n;
6240
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6241
- while (1) switch (_context58.prev = _context58.next) {
6423
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6424
+ while (1) switch (_context61.prev = _context61.next) {
6242
6425
  case 0:
6243
6426
  if (this.requestSettings) {
6244
- _context58.next = 2;
6427
+ _context61.next = 2;
6245
6428
  break;
6246
6429
  }
6247
6430
  throw new Error("Request settings have not been set up");
@@ -6250,11 +6433,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6250
6433
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
6251
6434
  case 4:
6252
6435
  case "end":
6253
- return _context58.stop();
6436
+ return _context61.stop();
6254
6437
  }
6255
- }, _callee58, this);
6438
+ }, _callee61, this);
6256
6439
  }));
6257
- function callServiceAPI(_x100, _x101) {
6440
+ function callServiceAPI(_x106, _x107) {
6258
6441
  return _callServiceAPI18.apply(this, arguments);
6259
6442
  }
6260
6443
  return callServiceAPI;
@@ -6262,17 +6445,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6262
6445
  }, {
6263
6446
  key: "extractResultData",
6264
6447
  value: function () {
6265
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6266
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6267
- while (1) switch (_context59.prev = _context59.next) {
6448
+ var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e) {
6449
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6450
+ while (1) switch (_context62.prev = _context62.next) {
6268
6451
  case 0:
6269
6452
  if (!e.error) {
6270
- _context59.next = 2;
6453
+ _context62.next = 2;
6271
6454
  break;
6272
6455
  }
6273
6456
  throw e.error.message;
6274
6457
  case 2:
6275
- return _context59.abrupt("return", e.choices[0].delta ? {
6458
+ return _context62.abrupt("return", e.choices[0].delta ? {
6276
6459
  text: e.choices[0].delta.content || ""
6277
6460
  } : e.choices[0].message ? {
6278
6461
  text: e.choices[0].message.content
@@ -6281,11 +6464,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6281
6464
  });
6282
6465
  case 3:
6283
6466
  case "end":
6284
- return _context59.stop();
6467
+ return _context62.stop();
6285
6468
  }
6286
- }, _callee59);
6469
+ }, _callee62);
6287
6470
  }));
6288
- function extractResultData(_x102) {
6471
+ function extractResultData(_x108) {
6289
6472
  return _extractResultData22.apply(this, arguments);
6290
6473
  }
6291
6474
  return extractResultData;
@@ -6333,13 +6516,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6333
6516
  }, {
6334
6517
  key: "callServiceAPI",
6335
6518
  value: function () {
6336
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
6519
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e, t) {
6337
6520
  var n;
6338
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6339
- while (1) switch (_context60.prev = _context60.next) {
6521
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6522
+ while (1) switch (_context63.prev = _context63.next) {
6340
6523
  case 0:
6341
6524
  if (this.requestSettings) {
6342
- _context60.next = 2;
6525
+ _context63.next = 2;
6343
6526
  break;
6344
6527
  }
6345
6528
  throw new Error("Request settings have not been set up");
@@ -6348,11 +6531,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6348
6531
  HTTPRequest.request(this, n, e);
6349
6532
  case 4:
6350
6533
  case "end":
6351
- return _context60.stop();
6534
+ return _context63.stop();
6352
6535
  }
6353
- }, _callee60, this);
6536
+ }, _callee63, this);
6354
6537
  }));
6355
- function callServiceAPI(_x103, _x104) {
6538
+ function callServiceAPI(_x109, _x110) {
6356
6539
  return _callServiceAPI19.apply(this, arguments);
6357
6540
  }
6358
6541
  return callServiceAPI;
@@ -6360,26 +6543,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6360
6543
  }, {
6361
6544
  key: "extractResultData",
6362
6545
  value: function () {
6363
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6364
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6365
- while (1) switch (_context61.prev = _context61.next) {
6546
+ var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
6547
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6548
+ while (1) switch (_context64.prev = _context64.next) {
6366
6549
  case 0:
6367
6550
  if (!e.message) {
6368
- _context61.next = 2;
6551
+ _context64.next = 2;
6369
6552
  break;
6370
6553
  }
6371
6554
  throw e.message;
6372
6555
  case 2:
6373
- return _context61.abrupt("return", {
6556
+ return _context64.abrupt("return", {
6374
6557
  text: e.text
6375
6558
  });
6376
6559
  case 3:
6377
6560
  case "end":
6378
- return _context61.stop();
6561
+ return _context64.stop();
6379
6562
  }
6380
- }, _callee61);
6563
+ }, _callee64);
6381
6564
  }));
6382
- function extractResultData(_x105) {
6565
+ function extractResultData(_x111) {
6383
6566
  return _extractResultData23.apply(this, arguments);
6384
6567
  }
6385
6568
  return extractResultData;
@@ -6737,24 +6920,24 @@ var FileMessages = /*#__PURE__*/function () {
6737
6920
  }, {
6738
6921
  key: "addNewImageMessage",
6739
6922
  value: function () {
6740
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
6923
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e, t, n) {
6741
6924
  var s,
6742
6925
  o,
6743
6926
  a,
6744
- _args62 = arguments;
6745
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6746
- while (1) switch (_context62.prev = _context62.next) {
6927
+ _args65 = arguments;
6928
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6929
+ while (1) switch (_context65.prev = _context65.next) {
6747
6930
  case 0:
6748
- s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
6931
+ s = _args65.length > 3 && _args65[3] !== undefined ? _args65[3] : !1;
6749
6932
  o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
6750
6933
  a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
6751
6934
  case 3:
6752
6935
  case "end":
6753
- return _context62.stop();
6936
+ return _context65.stop();
6754
6937
  }
6755
- }, _callee62);
6938
+ }, _callee65);
6756
6939
  }));
6757
- function addNewImageMessage(_x106, _x107, _x108) {
6940
+ function addNewImageMessage(_x112, _x113, _x114) {
6758
6941
  return _addNewImageMessage.apply(this, arguments);
6759
6942
  }
6760
6943
  return addNewImageMessage;
@@ -6986,7 +7169,7 @@ var Messages = /*#__PURE__*/function () {
6986
7169
  value: function sendClientUpdate(e) {
6987
7170
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6988
7171
  var n;
6989
- (n = this._onNewMessage) == null || n.call(this, e, t);
7172
+ (n = this._onNewMessage) == null || n.call(this, JSON.parse(JSON.stringify(e)), t);
6990
7173
  }
6991
7174
  // prettier-ignore
6992
7175
  }, {
@@ -7090,12 +7273,12 @@ var Messages = /*#__PURE__*/function () {
7090
7273
  }, {
7091
7274
  key: "addMultipleFiles",
7092
7275
  value: function () {
7093
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
7276
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e) {
7094
7277
  var _this31 = this;
7095
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
7096
- while (1) switch (_context63.prev = _context63.next) {
7278
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
7279
+ while (1) switch (_context66.prev = _context66.next) {
7097
7280
  case 0:
7098
- return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
7281
+ return _context66.abrupt("return", Promise.all((e || []).map(function (t) {
7099
7282
  return new Promise(function (n) {
7100
7283
  if (!t.type || t.type === "any") {
7101
7284
  var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
@@ -7120,11 +7303,11 @@ var Messages = /*#__PURE__*/function () {
7120
7303
  })));
7121
7304
  case 1:
7122
7305
  case "end":
7123
- return _context63.stop();
7306
+ return _context66.stop();
7124
7307
  }
7125
- }, _callee63);
7308
+ }, _callee66);
7126
7309
  }));
7127
- function addMultipleFiles(_x109) {
7310
+ function addMultipleFiles(_x115) {
7128
7311
  return _addMultipleFiles.apply(this, arguments);
7129
7312
  }
7130
7313
  return addMultipleFiles;
@@ -7198,10 +7381,10 @@ var Messages = /*#__PURE__*/function () {
7198
7381
  return Messages;
7199
7382
  }();
7200
7383
  var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7201
- function E() {
7202
- _classCallCheck(this, E);
7384
+ function w() {
7385
+ _classCallCheck(this, w);
7203
7386
  }
7204
- _createClass(E, null, [{
7387
+ _createClass(w, null, [{
7205
7388
  key: "adjustInputPadding",
7206
7389
  value: function adjustInputPadding(e, t) {
7207
7390
  t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
@@ -7209,7 +7392,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7209
7392
  }, {
7210
7393
  key: "adjustForOutsideButton",
7211
7394
  value: function adjustForOutsideButton(e, t, n) {
7212
- n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7395
+ n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(w.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(w.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7213
7396
  }
7214
7397
  // when submit is the only button
7215
7398
  // when submit button is outside by itself - we increase the height for a better look
@@ -7217,10 +7400,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7217
7400
  key: "adjustOutsideSubmit",
7218
7401
  value: function adjustOutsideSubmit(e, t, n) {
7219
7402
  if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
7220
- if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7403
+ if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(w.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7221
7404
  return s.button.elementRef.classList.add("submit-button-enlarged");
7222
7405
  });
7223
- if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7406
+ if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(w.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7224
7407
  return s.button.elementRef.classList.add("submit-button-enlarged");
7225
7408
  });
7226
7409
  }
@@ -7228,10 +7411,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7228
7411
  }, {
7229
7412
  key: "set",
7230
7413
  value: function set(e, t, n, s) {
7231
- !!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
7414
+ !!w.adjustOutsideSubmit(t, n, s) || w.adjustForOutsideButton(t, n, s), w.adjustInputPadding(e, s);
7232
7415
  }
7233
7416
  }]);
7234
- return E;
7417
+ return w;
7235
7418
  }();
7236
7419
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
7237
7420
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
@@ -7870,18 +8053,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7870
8053
  var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
7871
8054
  STOP_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
7872
8055
  _AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
7873
- _inherits(k, _FileAttachmentsType);
7874
- var _super35 = _createSuper(k);
7875
- function k(e, t, n) {
7876
- _classCallCheck(this, k);
8056
+ _inherits(I, _FileAttachmentsType);
8057
+ var _super35 = _createSuper(I);
8058
+ function I(e, t, n) {
8059
+ _classCallCheck(this, I);
7877
8060
  return _super35.call(this, e, t, n);
7878
8061
  }
7879
- _createClass(k, [{
8062
+ _createClass(I, [{
7880
8063
  key: "createTimer",
7881
8064
  value: function createTimer(e, t) {
7882
8065
  var _this37 = this;
7883
8066
  var n = 0;
7884
- var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
8067
+ var s = t !== void 0 && t < I.TIMER_LIMIT_S ? t : I.TIMER_LIMIT_S;
7885
8068
  return setInterval(function () {
7886
8069
  var l;
7887
8070
  n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
@@ -7893,7 +8076,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7893
8076
  }, {
7894
8077
  key: "createPlaceholderAudioAttachment",
7895
8078
  value: function createPlaceholderAudioAttachment(e) {
7896
- var t = k.createAudioContainer(),
8079
+ var t = I.createAudioContainer(),
7897
8080
  n = document.createElement("div");
7898
8081
  n.classList.add("audio-placeholder-text-3-digits");
7899
8082
  var s = document.createElement("div");
@@ -7930,7 +8113,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7930
8113
  key: "completePlaceholderAttachment",
7931
8114
  value: function completePlaceholderAttachment(e, t) {
7932
8115
  var n = this._activePlaceholderAttachment;
7933
- n && (n.file = e, k.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
8116
+ n && (n.file = e, I.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
7934
8117
  }
7935
8118
  }, {
7936
8119
  key: "removePlaceholderAttachment",
@@ -7970,8 +8153,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7970
8153
  }, {
7971
8154
  key: "createAudioAttachment",
7972
8155
  value: function createAudioAttachment(e) {
7973
- var t = k.createAudioContainer();
7974
- return k.addAudioElements(t, e), t;
8156
+ var t = I.createAudioContainer();
8157
+ return I.addAudioElements(t, e), t;
7975
8158
  }
7976
8159
  }, {
7977
8160
  key: "stopAttachmentPlayback",
@@ -7980,7 +8163,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7980
8163
  (s = (n = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : n[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
7981
8164
  }
7982
8165
  }]);
7983
- return k;
8166
+ return I;
7984
8167
  }(FileAttachmentsType);
7985
8168
  _AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
7986
8169
  var AudioFileAttachmentType = _AudioFileAttachmentType;
@@ -8034,33 +8217,33 @@ var FileAttachments = /*#__PURE__*/function () {
8034
8217
  }, {
8035
8218
  key: "completePlaceholders",
8036
8219
  value: function () {
8037
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
8038
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
8039
- while (1) switch (_context65.prev = _context65.next) {
8220
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
8221
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8222
+ while (1) switch (_context68.prev = _context68.next) {
8040
8223
  case 0:
8041
- _context65.next = 2;
8224
+ _context68.next = 2;
8042
8225
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
8043
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
8226
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
8044
8227
  var t;
8045
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
8046
- while (1) switch (_context64.prev = _context64.next) {
8228
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
8229
+ while (1) switch (_context67.prev = _context67.next) {
8047
8230
  case 0:
8048
- return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8231
+ return _context67.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8049
8232
  case 1:
8050
8233
  case "end":
8051
- return _context64.stop();
8234
+ return _context67.stop();
8052
8235
  }
8053
- }, _callee64);
8236
+ }, _callee67);
8054
8237
  }));
8055
- return function (_x110) {
8056
- return _ref5.apply(this, arguments);
8238
+ return function (_x116) {
8239
+ return _ref7.apply(this, arguments);
8057
8240
  };
8058
8241
  }()));
8059
8242
  case 2:
8060
8243
  case "end":
8061
- return _context65.stop();
8244
+ return _context68.stop();
8062
8245
  }
8063
- }, _callee65, this);
8246
+ }, _callee68, this);
8064
8247
  }));
8065
8248
  function completePlaceholders() {
8066
8249
  return _completePlaceholders.apply(this, arguments);
@@ -8216,10 +8399,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
8216
8399
  function UploadFileButton(e, t, n, s, o, a) {
8217
8400
  var _this43;
8218
8401
  _classCallCheck(this, UploadFileButton);
8219
- var c, u, d, h, p, f;
8402
+ var c, u, d, h, f, p;
8220
8403
  _this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
8221
8404
  var l = _this43.createInnerElements(s, o, _this43._customStyles);
8222
- _this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (f = (p = n.files) == null ? void 0 : p.infoModal) == null ? void 0 : f.openModalOnce;
8405
+ _this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (p = (f = n.files) == null ? void 0 : f.infoModal) == null ? void 0 : p.openModalOnce;
8223
8406
  return _this43;
8224
8407
  }
8225
8408
  _createClass(UploadFileButton, [{
@@ -8854,31 +9037,31 @@ var CommandUtils = /*#__PURE__*/function () {
8854
9037
  if (!u || !s || !n) return;
8855
9038
  var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
8856
9039
  h = text_1$2.Text.breakupIntoWordsArr(d),
8857
- p = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
8858
- if (u.commandMode && p(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
9040
+ f = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
9041
+ if (u.commandMode && f(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
8859
9042
  return CommandUtils.toggleCommandModeOn(e);
8860
9043
  }), {
8861
9044
  doNotProcessTranscription: !1
8862
9045
  };
8863
9046
  if (!(u.commandMode && !e.isWaitingForCommand)) {
8864
- if (u.stop && p(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
9047
+ if (u.stop && f(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
8865
9048
  return e.stop();
8866
9049
  }), {
8867
9050
  doNotProcessTranscription: !1
8868
9051
  };
8869
- if (u.pause && p(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
8870
- var f;
8871
- e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
9052
+ if (u.pause && f(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
9053
+ var p;
9054
+ e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
8872
9055
  }), {
8873
9056
  doNotProcessTranscription: !1
8874
9057
  };
8875
- if (u.resume && p(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
9058
+ if (u.resume && f(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
8876
9059
  doNotProcessTranscription: !0
8877
9060
  };
8878
- if (u.reset && p(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
9061
+ if (u.reset && f(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
8879
9062
  doNotProcessTranscription: !0
8880
9063
  };
8881
- if (u.removeAllText && p(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
9064
+ if (u.removeAllText && f(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
8882
9065
  doNotProcessTranscription: !0
8883
9066
  };
8884
9067
  }
@@ -9280,26 +9463,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9280
9463
  }, {
9281
9464
  key: "getNewSpeechConfig",
9282
9465
  value: function () {
9283
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t) {
9284
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
9285
- while (1) switch (_context66.prev = _context66.next) {
9466
+ var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e, t) {
9467
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9468
+ while (1) switch (_context69.prev = _context69.next) {
9286
9469
  case 0:
9287
9470
  if (!t.region) {
9288
- _context66.next = 2;
9471
+ _context69.next = 2;
9289
9472
  break;
9290
9473
  }
9291
- return _context66.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
9474
+ 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) {
9292
9475
  return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
9293
9476
  })["catch"](function (n) {
9294
9477
  return console.error(n), null;
9295
9478
  }) : null);
9296
9479
  case 2:
9297
9480
  case "end":
9298
- return _context66.stop();
9481
+ return _context69.stop();
9299
9482
  }
9300
- }, _callee66);
9483
+ }, _callee69);
9301
9484
  }));
9302
- function getNewSpeechConfig(_x111, _x112) {
9485
+ function getNewSpeechConfig(_x117, _x118) {
9303
9486
  return _getNewSpeechConfig.apply(this, arguments);
9304
9487
  }
9305
9488
  return getNewSpeechConfig;
@@ -9312,23 +9495,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9312
9495
  }, {
9313
9496
  key: "get",
9314
9497
  value: function () {
9315
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
9498
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9316
9499
  var n;
9317
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
9318
- while (1) switch (_context67.prev = _context67.next) {
9500
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9501
+ while (1) switch (_context70.prev = _context70.next) {
9319
9502
  case 0:
9320
- _context67.next = 2;
9503
+ _context70.next = 2;
9321
9504
  return AzureSpeechConfig.getNewSpeechConfig(e, t);
9322
9505
  case 2:
9323
- n = _context67.sent;
9324
- return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9506
+ n = _context70.sent;
9507
+ return _context70.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9325
9508
  case 4:
9326
9509
  case "end":
9327
- return _context67.stop();
9510
+ return _context70.stop();
9328
9511
  }
9329
- }, _callee67);
9512
+ }, _callee70);
9330
9513
  }));
9331
- function get(_x113, _x114) {
9514
+ function get(_x119, _x120) {
9332
9515
  return _get.apply(this, arguments);
9333
9516
  }
9334
9517
  return get;
@@ -9418,28 +9601,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9418
9601
  }, {
9419
9602
  key: "startAsync",
9420
9603
  value: function () {
9421
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
9604
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
9422
9605
  var t;
9423
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
9424
- while (1) switch (_context68.prev = _context68.next) {
9606
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9607
+ while (1) switch (_context71.prev = _context71.next) {
9425
9608
  case 0:
9426
- _context68.t0 = this.validate(e);
9427
- if (!_context68.t0) {
9428
- _context68.next = 6;
9609
+ _context71.t0 = this.validate(e);
9610
+ if (!_context71.t0) {
9611
+ _context71.next = 6;
9429
9612
  break;
9430
9613
  }
9431
- _context68.next = 4;
9614
+ _context71.next = 4;
9432
9615
  return this.instantiateService(e);
9433
9616
  case 4:
9434
9617
  this._translations = e == null ? void 0 : e.translations;
9435
9618
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
9436
9619
  case 6:
9437
9620
  case "end":
9438
- return _context68.stop();
9621
+ return _context71.stop();
9439
9622
  }
9440
- }, _callee68, this);
9623
+ }, _callee71, this);
9441
9624
  }));
9442
- function startAsync(_x115) {
9625
+ function startAsync(_x121) {
9443
9626
  return _startAsync.apply(this, arguments);
9444
9627
  }
9445
9628
  return startAsync;
@@ -9452,28 +9635,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9452
9635
  }, {
9453
9636
  key: "instantiateService",
9454
9637
  value: function () {
9455
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
9638
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9456
9639
  var t, n, s, o;
9457
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9458
- while (1) switch (_context69.prev = _context69.next) {
9640
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9641
+ while (1) switch (_context72.prev = _context72.next) {
9459
9642
  case 0:
9460
9643
  t = Azure.getAPI();
9461
9644
  n = t.AudioConfig.fromDefaultMicrophoneInput();
9462
- _context69.next = 4;
9645
+ _context72.next = 4;
9463
9646
  return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
9464
9647
  case 4:
9465
- s = _context69.sent;
9648
+ s = _context72.sent;
9466
9649
  if (s) {
9467
9650
  o = new t.SpeechRecognizer(s, n);
9468
9651
  this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9469
9652
  } else this.error("Unable to contact Azure server");
9470
9653
  case 6:
9471
9654
  case "end":
9472
- return _context69.stop();
9655
+ return _context72.stop();
9473
9656
  }
9474
- }, _callee69, this);
9657
+ }, _callee72, this);
9475
9658
  }));
9476
- function instantiateService(_x116) {
9659
+ function instantiateService(_x122) {
9477
9660
  return _instantiateService.apply(this, arguments);
9478
9661
  }
9479
9662
  return instantiateService;
@@ -9855,17 +10038,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9855
10038
  }, {
9856
10039
  key: "submit",
9857
10040
  value: function () {
9858
- var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
10041
+ var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e, t) {
9859
10042
  var l, c, n, s, o, a;
9860
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9861
- while (1) switch (_context70.prev = _context70.next) {
10043
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
10044
+ while (1) switch (_context73.prev = _context73.next) {
9862
10045
  case 0:
9863
- _context70.t0 = e;
9864
- if (_context70.t0) {
9865
- _context70.next = 6;
10046
+ _context73.t0 = e;
10047
+ if (_context73.t0) {
10048
+ _context73.next = 6;
9866
10049
  break;
9867
10050
  }
9868
- _context70.next = 4;
10051
+ _context73.next = 4;
9869
10052
  return this._fileAttachments.completePlaceholders();
9870
10053
  case 4:
9871
10054
  n = this._fileAttachments.getAllFileData();
@@ -9875,40 +10058,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9875
10058
  case 6:
9876
10059
  o = t === "" ? void 0 : t;
9877
10060
  if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
9878
- _context70.next = 9;
10061
+ _context73.next = 9;
9879
10062
  break;
9880
10063
  }
9881
- return _context70.abrupt("return");
10064
+ return _context73.abrupt("return");
9882
10065
  case 9:
9883
10066
  if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
9884
- _context70.next = 14;
10067
+ _context73.next = 14;
9885
10068
  break;
9886
10069
  }
9887
10070
  if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
9888
- _context70.next = 12;
10071
+ _context73.next = 12;
9889
10072
  break;
9890
10073
  }
9891
- return _context70.abrupt("return");
10074
+ return _context73.abrupt("return");
9892
10075
  case 12:
9893
- _context70.next = 16;
10076
+ _context73.next = 16;
9894
10077
  break;
9895
10078
  case 14:
9896
10079
  if (this._serviceIO.canSendMessage(o, s)) {
9897
- _context70.next = 16;
10080
+ _context73.next = 16;
9898
10081
  break;
9899
10082
  }
9900
- return _context70.abrupt("return");
10083
+ return _context73.abrupt("return");
9901
10084
  case 16:
9902
10085
  this.changeToLoadingIcon();
9903
10086
  t !== "" && this._messages.addNewMessage({
9904
10087
  text: t
9905
10088
  }, !1, !0);
9906
- _context70.t1 = n;
9907
- if (!_context70.t1) {
9908
- _context70.next = 22;
10089
+ _context73.t1 = n;
10090
+ if (!_context73.t1) {
10091
+ _context73.next = 22;
9909
10092
  break;
9910
10093
  }
9911
- _context70.next = 22;
10094
+ _context73.next = 22;
9912
10095
  return this._messages.addMultipleFiles(n);
9913
10096
  case 22:
9914
10097
  this._messages.addLoadingMessage();
@@ -9917,17 +10100,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9917
10100
  text: o,
9918
10101
  files: s
9919
10102
  };
9920
- _context70.next = 27;
10103
+ _context73.next = 27;
9921
10104
  return this._serviceIO.callAPI(a, this._messages);
9922
10105
  case 27:
9923
10106
  e || (c = this._fileAttachments) == null || c.removeAllFiles();
9924
10107
  case 28:
9925
10108
  case "end":
9926
- return _context70.stop();
10109
+ return _context73.stop();
9927
10110
  }
9928
- }, _callee70, this);
10111
+ }, _callee73, this);
9929
10112
  }));
9930
- function submit(_x117, _x118) {
10113
+ function submit(_x123, _x124) {
9931
10114
  return _submit.apply(this, arguments);
9932
10115
  }
9933
10116
  return submit;
@@ -10203,9 +10386,9 @@ var Input = /*#__PURE__*/function () {
10203
10386
  u = _FILE_TYPE_BUTTON_ICO.id,
10204
10387
  d = _FILE_TYPE_BUTTON_ICO.svgString,
10205
10388
  h = _FILE_TYPE_BUTTON_ICO.dropupText,
10206
- p = new UploadFileButton(n, c, l, u, d, h);
10389
+ f = new UploadFileButton(n, c, l, u, d, h);
10207
10390
  s[a] = {
10208
- button: p,
10391
+ button: f,
10209
10392
  fileType: c
10210
10393
  };
10211
10394
  }