deep-chat-dev 9.0.5 → 9.0.6

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,38 +319,130 @@ 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
- function getBytes(_x, _x2) {
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) {
328
420
  return _getBytes.apply(this, arguments);
329
421
  }
330
422
  function _getBytes() {
331
- _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(r, e) {
423
+ _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r, e) {
332
424
  var t, n;
333
- return _regeneratorRuntime().wrap(function _callee75$(_context75) {
334
- while (1) switch (_context75.prev = _context75.next) {
425
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
426
+ while (1) switch (_context71.prev = _context71.next) {
335
427
  case 0:
336
428
  t = r.getReader();
337
429
  case 1:
338
- _context75.next = 3;
430
+ _context71.next = 3;
339
431
  return t.read();
340
432
  case 3:
341
- if ((n = _context75.sent).done) {
342
- _context75.next = 7;
433
+ if ((n = _context71.sent).done) {
434
+ _context71.next = 7;
343
435
  break;
344
436
  }
345
437
  e(n.value);
346
438
  case 5:
347
- _context75.next = 1;
439
+ _context71.next = 1;
348
440
  break;
349
441
  case 7:
350
442
  case "end":
351
- return _context75.stop();
443
+ return _context71.stop();
352
444
  }
353
- }, _callee75);
445
+ }, _callee71);
354
446
  }));
355
447
  return _getBytes.apply(this, arguments);
356
448
  }
@@ -439,254 +531,81 @@ function fetchEventSource(r, e) {
439
531
  c = e.openWhenHidden,
440
532
  u = e.fetch,
441
533
  d = __rest(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
442
- return new Promise(function (h, f) {
443
- var p = Object.assign({}, n);
444
- p.accept || (p.accept = EventStreamContentType);
534
+ return new Promise(function (h, p) {
535
+ var f = Object.assign({}, n);
536
+ f.accept || (f.accept = EventStreamContentType);
445
537
  var b;
446
538
  function m() {
447
- b.abort(), document.hidden || x();
539
+ b.abort(), document.hidden || I();
448
540
  }
449
541
  c || document.addEventListener("visibilitychange", m);
450
- var g = DefaultRetryInterval,
451
- v = 0;
542
+ var v = DefaultRetryInterval,
543
+ g = 0;
452
544
  function y() {
453
- document.removeEventListener("visibilitychange", m), window.clearTimeout(v), b.abort();
545
+ document.removeEventListener("visibilitychange", m), window.clearTimeout(g), b.abort();
454
546
  }
455
547
  t == null || t.addEventListener("abort", function () {
456
548
  y(), h();
457
549
  });
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) {
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) {
468
560
  case 0:
469
561
  b = new AbortController();
470
- _context.prev = 1;
471
- _context.next = 4;
472
- return S(r, Object.assign(Object.assign({}, d), {
473
- headers: p,
562
+ _context3.prev = 1;
563
+ _context3.next = 4;
564
+ return x(r, Object.assign(Object.assign({}, d), {
565
+ headers: f,
474
566
  signal: b.signal
475
567
  }));
476
568
  case 4:
477
- C = _context.sent;
478
- _context.next = 7;
479
- return E(C);
569
+ w = _context3.sent;
570
+ _context3.next = 7;
571
+ return _(w);
480
572
  case 7:
481
- _context.next = 9;
482
- return getBytes(C.body, getLines(getMessages(function (_) {
483
- _ ? p[LastEventId] = _ : delete p[LastEventId];
484
- }, function (_) {
485
- g = _;
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;
486
578
  }, o)));
487
579
  case 9:
488
580
  a == null || a();
489
581
  y();
490
582
  h();
491
- _context.next = 17;
583
+ _context3.next = 17;
492
584
  break;
493
585
  case 14:
494
- _context.prev = 14;
495
- _context.t0 = _context["catch"](1);
586
+ _context3.prev = 14;
587
+ _context3.t0 = _context3["catch"](1);
496
588
  if (!b.signal.aborted) try {
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(_);
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);
501
593
  }
502
594
  case 17:
503
595
  case "end":
504
- return _context.stop();
596
+ return _context3.stop();
505
597
  }
506
- }, _callee, null, [[1, 14]]);
598
+ }, _callee3, null, [[1, 14]]);
507
599
  }));
508
- return _x3.apply(this, arguments);
600
+ return _I.apply(this, arguments);
509
601
  }
510
- x();
602
+ I();
511
603
  });
512
604
  }
513
605
  function defaultOnOpen(r) {
514
606
  var e = r.headers.get("content-type");
515
607
  if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
516
608
  }
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;
690
609
  var Stream = /*#__PURE__*/function () {
691
610
  function Stream() {
692
611
  _classCallCheck(this, Stream);
@@ -695,12 +614,11 @@ var Stream = /*#__PURE__*/function () {
695
614
  key: "request",
696
615
  value: // prettier-ignore
697
616
  function () {
698
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
617
+ var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, t, n) {
699
618
  var s,
700
- p,
619
+ f,
701
620
  b,
702
621
  m,
703
- g,
704
622
  v,
705
623
  o,
706
624
  _yield$RequestUtils$p,
@@ -711,20 +629,20 @@ var Stream = /*#__PURE__*/function () {
711
629
  u,
712
630
  d,
713
631
  h,
714
- f,
715
- _args6 = arguments;
716
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
717
- while (1) switch (_context6.prev = _context6.next) {
632
+ p,
633
+ _args5 = arguments;
634
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
635
+ while (1) switch (_context5.prev = _context5.next) {
718
636
  case 0:
719
- s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
637
+ s = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : !0;
720
638
  o = {
721
639
  body: t,
722
- headers: (p = e.requestSettings) == null ? void 0 : p.headers
640
+ headers: (f = e.requestSettings) == null ? void 0 : f.headers
723
641
  };
724
- _context6.next = 4;
642
+ _context5.next = 4;
725
643
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
726
644
  case 4:
727
- _yield$RequestUtils$p = _context6.sent;
645
+ _yield$RequestUtils$p = _context5.sent;
728
646
  a = _yield$RequestUtils$p.body;
729
647
  l = _yield$RequestUtils$p.headers;
730
648
  c = _yield$RequestUtils$p.error;
@@ -733,85 +651,79 @@ var Stream = /*#__PURE__*/function () {
733
651
  d = _e$streamHandlers.onClose;
734
652
  h = _e$streamHandlers.abortStream;
735
653
  if (!c) {
736
- _context6.next = 14;
654
+ _context5.next = 14;
737
655
  break;
738
656
  }
739
- return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
657
+ return _context5.abrupt("return", Stream.onInterceptorError(n, c, d));
740
658
  case 14:
741
- if (!((b = e.requestSettings) != null && b.handler)) {
742
- _context6.next = 16;
659
+ if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
660
+ _context5.next = 16;
743
661
  break;
744
662
  }
745
- return _context6.abrupt("return", CustomHandler.stream(e, a, n));
663
+ return _context5.abrupt("return", Demo.requestStream(n, e.streamHandlers));
746
664
  case 16:
747
- if (!(((m = e.requestSettings) == null ? void 0 : m.url) === Demo.URL)) {
748
- _context6.next = 18;
749
- break;
750
- }
751
- return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
752
- case 18:
753
- f = null;
754
- fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
665
+ p = null;
666
+ fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
755
667
  method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
756
668
  headers: l,
757
669
  body: s ? JSON.stringify(a) : a,
758
670
  openWhenHidden: !0,
759
671
  // keep stream open when browser tab not open
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) {
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) {
764
676
  case 0:
765
- if (!y.ok) {
766
- _context5.next = 2;
677
+ if (!g.ok) {
678
+ _context4.next = 2;
767
679
  break;
768
680
  }
769
- return _context5.abrupt("return", (f = n.addNewStreamedMessage(), u()));
681
+ return _context4.abrupt("return", (p = n.addNewStreamedMessage(), u()));
770
682
  case 2:
771
- _context5.next = 4;
772
- return RequestUtils.processResponseByType(y);
683
+ _context4.next = 4;
684
+ return RequestUtils.processResponseByType(g);
773
685
  case 4:
774
- throw _context5.sent;
686
+ throw _context4.sent;
775
687
  case 5:
776
688
  case "end":
777
- return _context5.stop();
689
+ return _context4.stop();
778
690
  }
779
- }, _callee5);
691
+ }, _callee4);
780
692
  }))();
781
693
  },
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);
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, _);
790
702
  });
791
703
  }
792
704
  },
793
- onerror: function onerror(y) {
794
- throw d(), y;
705
+ onerror: function onerror(g) {
706
+ throw d(), g;
795
707
  },
796
708
  onclose: function onclose() {
797
709
  n.finaliseStreamedMessage(), d();
798
710
  },
799
711
  signal: h.signal
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);
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);
806
718
  });
807
719
  });
808
- case 20:
720
+ case 18:
809
721
  case "end":
810
- return _context6.stop();
722
+ return _context5.stop();
811
723
  }
812
- }, _callee6);
724
+ }, _callee5);
813
725
  }));
814
- function request(_x9, _x10, _x11) {
726
+ function request(_x8, _x9, _x10) {
815
727
  return _request.apply(this, arguments);
816
728
  }
817
729
  return request;
@@ -853,164 +765,87 @@ var Stream = /*#__PURE__*/function () {
853
765
  }]);
854
766
  return Stream;
855
767
  }();
856
- var CustomHandler = /*#__PURE__*/function () {
857
- function CustomHandler() {
858
- _classCallCheck(this, CustomHandler);
768
+ var _Demo = /*#__PURE__*/function () {
769
+ function C() {
770
+ _classCallCheck(this, C);
859
771
  }
860
- _createClass(CustomHandler, null, [{
861
- key: "request",
862
- value: function () {
863
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
864
- var a, l, s, o;
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(c) {
871
- var d, h, u;
872
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
873
- while (1) switch (_context7.prev = _context7.next) {
874
- case 0:
875
- if (s) {
876
- _context7.next = 2;
877
- break;
878
- }
879
- return _context7.abrupt("return");
880
- case 2:
881
- _context7.next = 4;
882
- return (h = (d = e.deepChat).responseInterceptor) == null ? void 0 : h.call(d, c);
883
- case 4:
884
- _context7.t0 = _context7.sent;
885
- if (_context7.t0) {
886
- _context7.next = 7;
887
- break;
888
- }
889
- _context7.t0 = c;
890
- case 7:
891
- u = _context7.t0;
892
- !u || _typeof(u) != "object" || typeof u.error != "string" && typeof u.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, u)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof u.error == "string" ? (console.error(u.error), n.addNewErrorMessage("service", u.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : (n.addNewMessage(u, !0, !0), e.completionsHandlers.onFinish()), s = !1;
893
- case 9:
894
- case "end":
895
- return _context7.stop();
896
- }
897
- }, _callee7);
898
- }));
899
- return function o(_x15) {
900
- return _ref2.apply(this, arguments);
901
- };
902
- }();
903
- (l = (a = e.requestSettings).handler) == null || l.call(a, t, {
904
- onResponse: o
905
- });
906
- case 3:
907
- case "end":
908
- return _context8.stop();
909
- }
910
- }, _callee8);
911
- }));
912
- function request(_x12, _x13, _x14) {
913
- return _request2.apply(this, arguments);
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?";
914
779
  }
915
- return request;
916
- }()
780
+ return "Hi there! This is a demo response!";
781
+ }
917
782
  }, {
918
- key: "stream",
919
- value: function () {
920
- var _stream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, n) {
921
- var h, f, s, o, a, l, c, u, d;
922
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
923
- while (1) switch (_context9.prev = _context9.next) {
783
+ key: "generateResponse",
784
+ value: function generateResponse(e) {
785
+ var t = [];
786
+ for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
787
+ if (t.length === 1) return C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
788
+ var n = e.messages.findIndex(function (s) {
789
+ return s.text;
790
+ });
791
+ return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
792
+ }
793
+ }, {
794
+ key: "getCustomResponse",
795
+ value: function getCustomResponse(e, t) {
796
+ return typeof e == "function" ? e(t) : e;
797
+ }
798
+ }, {
799
+ key: "getResponse",
800
+ value: function getResponse(e) {
801
+ return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
802
+ text: C.generateResponse(e)
803
+ };
804
+ }
805
+ // timeout is used to simulate a timeout for a response to come back
806
+ }, {
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) {
924
814
  case 0:
925
- s = !0, o = !1, a = null;
926
- l = function l() {
927
- o || !s || (a = n.addNewStreamedMessage(), e.streamHandlers.onOpen(), o = !0);
928
- }, c = function c() {
929
- s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
930
- }, u = function u(p) {
931
- s && (!p || _typeof(p) != "object" || typeof p.error != "string" && typeof p.text != "string" ? console.error(ErrorMessages.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
932
- };
933
- e.streamHandlers.abortStream.abort = function () {
934
- n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
935
- };
936
- d = {
937
- onOpen: l,
938
- onResponse: u,
939
- onClose: c,
940
- stopClicked: e.streamHandlers.stopClicked
941
- };
942
- (f = (h = e.requestSettings).handler) == null || f.call(h, t, d);
815
+ _context6.next = 2;
816
+ return n == null ? void 0 : n(s);
817
+ case 2:
818
+ _context6.t0 = _context6.sent;
819
+ if (_context6.t0) {
820
+ _context6.next = 5;
821
+ break;
822
+ }
823
+ _context6.t0 = s;
943
824
  case 5:
825
+ o = _context6.t0;
826
+ o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
827
+ case 7:
944
828
  case "end":
945
- return _context9.stop();
829
+ return _context6.stop();
946
830
  }
947
- }, _callee9);
948
- }));
949
- function stream(_x16, _x17, _x18) {
950
- return _stream.apply(this, arguments);
951
- }
952
- return stream;
953
- }()
831
+ }, _callee6);
832
+ })), 400);
833
+ }
834
+ // timeout is used to simulate a timeout for a response to come back
954
835
  }, {
955
- key: "websocket",
956
- value: function websocket(e, t) {
957
- var c, u;
958
- var n = {
959
- isOpen: !1,
960
- newUserMessage: {
961
- listener: function listener() {}
962
- }
963
- };
964
- e.websocket = n;
965
- var l = {
966
- onOpen: function onOpen() {
967
- t.removeError(), n.isOpen = !0;
968
- },
969
- onResponse: function () {
970
- var _onResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
971
- var f, p, h;
972
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
973
- while (1) switch (_context10.prev = _context10.next) {
974
- case 0:
975
- if (n.isOpen) {
976
- _context10.next = 2;
977
- break;
978
- }
979
- return _context10.abrupt("return");
980
- case 2:
981
- _context10.next = 4;
982
- return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
983
- case 4:
984
- _context10.t0 = _context10.sent;
985
- if (_context10.t0) {
986
- _context10.next = 7;
987
- break;
988
- }
989
- _context10.t0 = d;
990
- case 7:
991
- h = _context10.t0;
992
- !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);
993
- case 9:
994
- case "end":
995
- return _context10.stop();
996
- }
997
- }, _callee10);
998
- }));
999
- function onResponse(_x19) {
1000
- return _onResponse.apply(this, arguments);
1001
- }
1002
- return onResponse;
1003
- }(),
1004
- onClose: function onClose() {
1005
- n.isOpen = !1;
1006
- },
1007
- newUserMessage: n.newUserMessage
1008
- };
1009
- (u = (c = e.requestSettings).handler) == null || u.call(c, void 0, l);
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);
1010
843
  }
1011
844
  }]);
1012
- return CustomHandler;
845
+ return C;
1013
846
  }();
847
+ _Demo.URL = "deep-chat-demo";
848
+ var Demo = _Demo;
1014
849
  var HTTPRequest = /*#__PURE__*/function () {
1015
850
  function HTTPRequest() {
1016
851
  _classCallCheck(this, HTTPRequest);
@@ -1019,13 +854,12 @@ var HTTPRequest = /*#__PURE__*/function () {
1019
854
  key: "request",
1020
855
  value: // prettier-ignore
1021
856
  function () {
1022
- var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
857
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
1023
858
  var s,
1024
859
  h,
1025
- f,
1026
860
  p,
861
+ f,
1027
862
  b,
1028
- m,
1029
863
  o,
1030
864
  _yield$RequestUtils$p2,
1031
865
  a,
@@ -1033,110 +867,104 @@ var HTTPRequest = /*#__PURE__*/function () {
1033
867
  c,
1034
868
  u,
1035
869
  d,
1036
- _args12 = arguments;
1037
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1038
- while (1) switch (_context12.prev = _context12.next) {
870
+ _args8 = arguments;
871
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
872
+ while (1) switch (_context8.prev = _context8.next) {
1039
873
  case 0:
1040
- s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
874
+ s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
1041
875
  o = {
1042
876
  body: t,
1043
877
  headers: (h = e.requestSettings) == null ? void 0 : h.headers
1044
878
  };
1045
- _context12.next = 4;
879
+ _context8.next = 4;
1046
880
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
1047
881
  case 4:
1048
- _yield$RequestUtils$p2 = _context12.sent;
882
+ _yield$RequestUtils$p2 = _context8.sent;
1049
883
  a = _yield$RequestUtils$p2.body;
1050
884
  l = _yield$RequestUtils$p2.headers;
1051
885
  c = _yield$RequestUtils$p2.error;
1052
886
  u = e.completionsHandlers.onFinish;
1053
887
  if (!c) {
1054
- _context12.next = 11;
888
+ _context8.next = 11;
1055
889
  break;
1056
890
  }
1057
- return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
891
+ return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1058
892
  case 11:
1059
- if (!((f = e.requestSettings) != null && f.handler)) {
1060
- _context12.next = 13;
1061
- break;
1062
- }
1063
- return _context12.abrupt("return", CustomHandler.request(e, a, n));
1064
- case 13:
1065
893
  if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
1066
- _context12.next = 15;
894
+ _context8.next = 13;
1067
895
  break;
1068
896
  }
1069
- return _context12.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1070
- case 15:
897
+ return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
898
+ case 13:
1071
899
  d = !0;
1072
- fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
1073
- method: ((m = e.requestSettings) == null ? void 0 : m.method) || "POST",
900
+ fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
901
+ method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
1074
902
  headers: l,
1075
903
  body: s ? JSON.stringify(a) : a
1076
- }).then(function (g) {
1077
- return d = !!g.ok, g;
1078
- }).then(function (g) {
1079
- return RequestUtils.processResponseByType(g);
904
+ }).then(function (m) {
905
+ return d = !!m.ok, m;
906
+ }).then(function (m) {
907
+ return RequestUtils.processResponseByType(m);
1080
908
  }).then( /*#__PURE__*/function () {
1081
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(g) {
1082
- var S, E, v, y;
1083
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1084
- while (1) switch (_context11.prev = _context11.next) {
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) {
1085
913
  case 0:
1086
914
  if (e.extractResultData) {
1087
- _context11.next = 2;
915
+ _context7.next = 2;
1088
916
  break;
1089
917
  }
1090
- return _context11.abrupt("return");
918
+ return _context7.abrupt("return");
1091
919
  case 2:
1092
- _context11.next = 4;
1093
- return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
920
+ _context7.next = 4;
921
+ return (x = (y = e.deepChat).responseInterceptor) == null ? void 0 : x.call(y, m);
1094
922
  case 4:
1095
- _context11.t0 = _context11.sent;
1096
- if (_context11.t0) {
1097
- _context11.next = 7;
923
+ _context7.t0 = _context7.sent;
924
+ if (_context7.t0) {
925
+ _context7.next = 7;
1098
926
  break;
1099
927
  }
1100
- _context11.t0 = g;
928
+ _context7.t0 = m;
1101
929
  case 7:
1102
- v = _context11.t0;
1103
- _context11.next = 10;
930
+ v = _context7.t0;
931
+ _context7.next = 10;
1104
932
  return e.extractResultData(v);
1105
933
  case 10:
1106
- y = _context11.sent;
934
+ g = _context7.sent;
1107
935
  if (d) {
1108
- _context11.next = 13;
936
+ _context7.next = 13;
1109
937
  break;
1110
938
  }
1111
- throw g;
939
+ throw m;
1112
940
  case 13:
1113
- if (!(!y || _typeof(y) != "object")) {
1114
- _context11.next = 15;
941
+ if (!(!g || _typeof(g) != "object")) {
942
+ _context7.next = 15;
1115
943
  break;
1116
944
  }
1117
- throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
945
+ throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
1118
946
  case 15:
1119
- y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
947
+ g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
1120
948
  case 16:
1121
949
  case "end":
1122
- return _context11.stop();
950
+ return _context7.stop();
1123
951
  }
1124
- }, _callee11);
952
+ }, _callee7);
1125
953
  }));
1126
- return function (_x23) {
1127
- return _ref3.apply(this, arguments);
954
+ return function (_x14) {
955
+ return _ref2.apply(this, arguments);
1128
956
  };
1129
- }())["catch"](function (g) {
1130
- RequestUtils.displayError(n, g), u();
957
+ }())["catch"](function (m) {
958
+ RequestUtils.displayError(n, m), u();
1131
959
  });
1132
- case 17:
960
+ case 15:
1133
961
  case "end":
1134
- return _context12.stop();
962
+ return _context8.stop();
1135
963
  }
1136
- }, _callee12);
964
+ }, _callee8);
1137
965
  }));
1138
- function request(_x20, _x21, _x22) {
1139
- return _request3.apply(this, arguments);
966
+ function request(_x11, _x12, _x13) {
967
+ return _request2.apply(this, arguments);
1140
968
  }
1141
969
  return request;
1142
970
  }() // prettier-ignore
@@ -1148,44 +976,44 @@ var HTTPRequest = /*#__PURE__*/function () {
1148
976
  fetch(t, n).then(function (a) {
1149
977
  return a.json();
1150
978
  }).then( /*#__PURE__*/function () {
1151
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(a) {
979
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
1152
980
  var c, u, l;
1153
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1154
- while (1) switch (_context13.prev = _context13.next) {
981
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
982
+ while (1) switch (_context9.prev = _context9.next) {
1155
983
  case 0:
1156
984
  if (e.extractPollResultData) {
1157
- _context13.next = 2;
985
+ _context9.next = 2;
1158
986
  break;
1159
987
  }
1160
- return _context13.abrupt("return");
988
+ return _context9.abrupt("return");
1161
989
  case 2:
1162
- _context13.t0 = e;
1163
- _context13.next = 5;
990
+ _context9.t0 = e;
991
+ _context9.next = 5;
1164
992
  return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
1165
993
  case 5:
1166
- _context13.t1 = _context13.sent;
1167
- if (_context13.t1) {
1168
- _context13.next = 8;
994
+ _context9.t1 = _context9.sent;
995
+ if (_context9.t1) {
996
+ _context9.next = 8;
1169
997
  break;
1170
998
  }
1171
- _context13.t1 = a;
999
+ _context9.t1 = a;
1172
1000
  case 8:
1173
- _context13.t2 = _context13.t1;
1174
- _context13.next = 11;
1175
- return _context13.t0.extractPollResultData.call(_context13.t0, _context13.t2);
1001
+ _context9.t2 = _context9.t1;
1002
+ _context9.next = 11;
1003
+ return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
1176
1004
  case 11:
1177
- l = _context13.sent;
1005
+ l = _context9.sent;
1178
1006
  l.timeoutMS ? setTimeout(function () {
1179
1007
  HTTPRequest.executePollRequest(e, t, n, s);
1180
1008
  }, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
1181
1009
  case 13:
1182
1010
  case "end":
1183
- return _context13.stop();
1011
+ return _context9.stop();
1184
1012
  }
1185
- }, _callee13);
1013
+ }, _callee9);
1186
1014
  }));
1187
- return function (_x24) {
1188
- return _ref4.apply(this, arguments);
1015
+ return function (_x15) {
1016
+ return _ref3.apply(this, arguments);
1189
1017
  };
1190
1018
  }())["catch"](function (a) {
1191
1019
  RequestUtils.displayError(s, a), o();
@@ -1195,9 +1023,9 @@ var HTTPRequest = /*#__PURE__*/function () {
1195
1023
  }, {
1196
1024
  key: "poll",
1197
1025
  value: function () {
1198
- var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n) {
1026
+ var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
1199
1027
  var s,
1200
- p,
1028
+ f,
1201
1029
  b,
1202
1030
  m,
1203
1031
  o,
@@ -1208,42 +1036,42 @@ var HTTPRequest = /*#__PURE__*/function () {
1208
1036
  u,
1209
1037
  d,
1210
1038
  h,
1211
- f,
1212
- _args14 = arguments;
1213
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1214
- while (1) switch (_context14.prev = _context14.next) {
1039
+ p,
1040
+ _args10 = arguments;
1041
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1042
+ while (1) switch (_context10.prev = _context10.next) {
1215
1043
  case 0:
1216
- s = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
1044
+ s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
1217
1045
  o = {
1218
1046
  body: t,
1219
- headers: (p = e.requestSettings) == null ? void 0 : p.headers
1047
+ headers: (f = e.requestSettings) == null ? void 0 : f.headers
1220
1048
  };
1221
- _context14.next = 4;
1049
+ _context10.next = 4;
1222
1050
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
1223
1051
  case 4:
1224
- _yield$RequestUtils$p3 = _context14.sent;
1052
+ _yield$RequestUtils$p3 = _context10.sent;
1225
1053
  a = _yield$RequestUtils$p3.body;
1226
1054
  l = _yield$RequestUtils$p3.headers;
1227
1055
  c = _yield$RequestUtils$p3.error;
1228
1056
  if (!c) {
1229
- _context14.next = 10;
1057
+ _context10.next = 10;
1230
1058
  break;
1231
1059
  }
1232
- return _context14.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1060
+ return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1233
1061
  case 10:
1234
- 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 = {
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 = {
1235
1063
  method: d,
1236
1064
  body: h,
1237
1065
  headers: l
1238
1066
  };
1239
- HTTPRequest.executePollRequest(e, u, f, n);
1067
+ HTTPRequest.executePollRequest(e, u, p, n);
1240
1068
  case 12:
1241
1069
  case "end":
1242
- return _context14.stop();
1070
+ return _context10.stop();
1243
1071
  }
1244
- }, _callee14);
1072
+ }, _callee10);
1245
1073
  }));
1246
- function poll(_x25, _x26, _x27) {
1074
+ function poll(_x16, _x17, _x18) {
1247
1075
  return _poll.apply(this, arguments);
1248
1076
  }
1249
1077
  return poll;
@@ -1284,9 +1112,9 @@ var MessageLimitUtils = /*#__PURE__*/function () {
1284
1112
  var n = 0,
1285
1113
  s = e.length - 1;
1286
1114
  for (s; s >= 0; s -= 1) {
1287
- var _a = (o = e[s]) == null ? void 0 : o.text;
1288
- if (_a !== void 0 && (n += _a.length, n > t)) {
1289
- e[s].text = _a.substring(0, _a.length - (n - t));
1115
+ var a = (o = e[s]) == null ? void 0 : o.text;
1116
+ if (a !== void 0 && (n += a.length, n > t)) {
1117
+ e[s].text = a.substring(0, a.length - (n - t));
1290
1118
  break;
1291
1119
  }
1292
1120
  }
@@ -1336,19 +1164,16 @@ var Websocket = /*#__PURE__*/function () {
1336
1164
  value: function createConnection(e, t) {
1337
1165
  if (!document.body.contains(e.deepChat)) return;
1338
1166
  var n = e.requestSettings.websocket;
1339
- if (n) {
1340
- if (e.requestSettings.handler) return CustomHandler.websocket(e, t);
1341
- try {
1342
- var _s = typeof n != "boolean" ? n : void 0,
1343
- _o = new WebSocket(e.requestSettings.url || "", _s);
1344
- e.websocket = _o, e.websocket.onopen = function () {
1345
- t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, _o, t);
1346
- }, e.websocket.onerror = function (a) {
1347
- console.error(a), Websocket.retryConnection(e, t);
1348
- };
1349
- } catch (s) {
1350
- console.error(s), Websocket.retryConnection(e, t);
1351
- }
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);
1352
1177
  }
1353
1178
  }
1354
1179
  }, {
@@ -1362,53 +1187,53 @@ var Websocket = /*#__PURE__*/function () {
1362
1187
  key: "assignListeners",
1363
1188
  value: function assignListeners(e, t, n) {
1364
1189
  t.onmessage = /*#__PURE__*/function () {
1365
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
1190
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
1366
1191
  var o, a, l, c, u;
1367
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1368
- while (1) switch (_context15.prev = _context15.next) {
1192
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1193
+ while (1) switch (_context11.prev = _context11.next) {
1369
1194
  case 0:
1370
1195
  if (!e.extractResultData) {
1371
- _context15.next = 20;
1196
+ _context11.next = 20;
1372
1197
  break;
1373
1198
  }
1374
- _context15.prev = 1;
1199
+ _context11.prev = 1;
1375
1200
  l = JSON.parse(s.data);
1376
- _context15.next = 5;
1201
+ _context11.next = 5;
1377
1202
  return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
1378
1203
  case 5:
1379
- _context15.t0 = _context15.sent;
1380
- if (_context15.t0) {
1381
- _context15.next = 8;
1204
+ _context11.t0 = _context11.sent;
1205
+ if (_context11.t0) {
1206
+ _context11.next = 8;
1382
1207
  break;
1383
1208
  }
1384
- _context15.t0 = l;
1209
+ _context11.t0 = l;
1385
1210
  case 8:
1386
- c = _context15.t0;
1387
- _context15.next = 11;
1211
+ c = _context11.t0;
1212
+ _context11.next = 11;
1388
1213
  return e.extractResultData(c);
1389
1214
  case 11:
1390
- u = _context15.sent;
1215
+ u = _context11.sent;
1391
1216
  if (!(!u || _typeof(u) != "object")) {
1392
- _context15.next = 14;
1217
+ _context11.next = 14;
1393
1218
  break;
1394
1219
  }
1395
1220
  throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
1396
1221
  case 14:
1397
1222
  e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
1398
- _context15.next = 20;
1223
+ _context11.next = 20;
1399
1224
  break;
1400
1225
  case 17:
1401
- _context15.prev = 17;
1402
- _context15.t1 = _context15["catch"](1);
1403
- RequestUtils.displayError(n, _context15.t1, "Error in server message");
1226
+ _context11.prev = 17;
1227
+ _context11.t1 = _context11["catch"](1);
1228
+ RequestUtils.displayError(n, _context11.t1, "Error in server message");
1404
1229
  case 20:
1405
1230
  case "end":
1406
- return _context15.stop();
1231
+ return _context11.stop();
1407
1232
  }
1408
- }, _callee15, null, [[1, 17]]);
1233
+ }, _callee11, null, [[1, 17]]);
1409
1234
  }));
1410
- return function (_x28) {
1411
- return _ref5.apply(this, arguments);
1235
+ return function (_x19) {
1236
+ return _ref4.apply(this, arguments);
1412
1237
  };
1413
1238
  }(), t.onclose = function () {
1414
1239
  console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
@@ -1417,7 +1242,7 @@ var Websocket = /*#__PURE__*/function () {
1417
1242
  }, {
1418
1243
  key: "sendWebsocket",
1419
1244
  value: function () {
1420
- var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
1245
+ var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
1421
1246
  var s,
1422
1247
  d,
1423
1248
  h,
@@ -1427,55 +1252,55 @@ var Websocket = /*#__PURE__*/function () {
1427
1252
  l,
1428
1253
  c,
1429
1254
  u,
1430
- _args16 = arguments;
1431
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1432
- while (1) switch (_context16.prev = _context16.next) {
1255
+ _args12 = arguments;
1256
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1257
+ while (1) switch (_context12.prev = _context12.next) {
1433
1258
  case 0:
1434
- s = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : !0;
1259
+ s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
1435
1260
  o = e.websocket;
1436
1261
  if (!(!o || o === "pending")) {
1437
- _context16.next = 4;
1262
+ _context12.next = 4;
1438
1263
  break;
1439
1264
  }
1440
- return _context16.abrupt("return");
1265
+ return _context12.abrupt("return");
1441
1266
  case 4:
1442
1267
  a = {
1443
1268
  body: t,
1444
1269
  headers: (d = e.requestSettings) == null ? void 0 : d.headers
1445
1270
  };
1446
- _context16.next = 7;
1271
+ _context12.next = 7;
1447
1272
  return RequestUtils.processRequestInterceptor(e.deepChat, a);
1448
1273
  case 7:
1449
- _yield$RequestUtils$p4 = _context16.sent;
1274
+ _yield$RequestUtils$p4 = _context12.sent;
1450
1275
  l = _yield$RequestUtils$p4.body;
1451
1276
  c = _yield$RequestUtils$p4.error;
1452
1277
  if (!c) {
1453
- _context16.next = 12;
1278
+ _context12.next = 12;
1454
1279
  break;
1455
1280
  }
1456
- return _context16.abrupt("return", n.addNewErrorMessage("service", c));
1281
+ return _context12.abrupt("return", n.addNewErrorMessage("service", c));
1457
1282
  case 12:
1458
1283
  if (Websocket.isWebSocket(o)) {
1459
- _context16.next = 14;
1284
+ _context12.next = 14;
1460
1285
  break;
1461
1286
  }
1462
- return _context16.abrupt("return", o.newUserMessage.listener(l));
1287
+ return _context12.abrupt("return", o.newUserMessage.listener(l));
1463
1288
  case 14:
1464
1289
  u = s ? JSON.stringify(l) : l;
1465
1290
  if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1466
- _context16.next = 17;
1291
+ _context12.next = 17;
1467
1292
  break;
1468
1293
  }
1469
- return _context16.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1294
+ return _context12.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1470
1295
  case 17:
1471
1296
  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));
1472
1297
  case 18:
1473
1298
  case "end":
1474
- return _context16.stop();
1299
+ return _context12.stop();
1475
1300
  }
1476
- }, _callee16);
1301
+ }, _callee12);
1477
1302
  }));
1478
- function sendWebsocket(_x29, _x30, _x31) {
1303
+ function sendWebsocket(_x20, _x21, _x22) {
1479
1304
  return _sendWebsocket.apply(this, arguments);
1480
1305
  }
1481
1306
  return sendWebsocket;
@@ -1981,13 +1806,13 @@ function normalizeReference(r) {
1981
1806
  return r.trim().replace(/\s+/g, " ").toUpperCase();
1982
1807
  }
1983
1808
  function parseReference(r, e, t, n) {
1984
- var s, o, a, l, c, u, d, h, f;
1809
+ var s, o, a, l, c, u, d, h, p;
1985
1810
  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;
1986
1811
  for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1987
1812
  if (!parseLinkDestination(s, a)) return -1;
1988
1813
  for (d = s.linkContent, a = s.pos, u = a, a = a + 1; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1989
1814
  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++;
1990
- return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (f = normalizeReference(r.slice(1, o)), _typeof(n.references[f]) > "u" && (n.references[f] = {
1815
+ return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (p = normalizeReference(r.slice(1, o)), _typeof(n.references[p]) > "u" && (n.references[p] = {
1991
1816
  title: h,
1992
1817
  href: d
1993
1818
  }), a);
@@ -2024,9 +1849,9 @@ function footnote_block(r) {
2024
1849
  u,
2025
1850
  d = 0,
2026
1851
  h = !1,
2027
- f = {};
2028
- if (r.env.footnotes && (r.tokens = r.tokens.filter(function (p) {
2029
- 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);
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);
2030
1855
  }), !!r.env.footnotes.list)) {
2031
1856
  for (a = r.env.footnotes.list, r.tokens.push({
2032
1857
  type: "footnote_block_open",
@@ -2049,7 +1874,7 @@ function footnote_block(r) {
2049
1874
  type: "paragraph_close",
2050
1875
  tight: !1,
2051
1876
  level: --d
2052
- })) : 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({
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({
2053
1878
  type: "footnote_anchor",
2054
1879
  id: e,
2055
1880
  subId: n,
@@ -2082,15 +1907,15 @@ function abbr2(r) {
2082
1907
  u,
2083
1908
  d,
2084
1909
  h,
2085
- f,
2086
- p = r.tokens;
1910
+ p,
1911
+ f = r.tokens;
2087
1912
  if (r.env.abbreviations) {
2088
- for (r.env.abbrRegExp || (f = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
1913
+ for (r.env.abbrRegExp || (p = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
2089
1914
  return b.substr(1);
2090
1915
  }).sort(function (b, m) {
2091
1916
  return m.length - b.length;
2092
- }).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") {
2093
- for (s = p[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
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") {
2094
1919
  for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
2095
1920
  type: "text",
2096
1921
  content: a.slice(c, h.index + h[1].length),
@@ -2111,7 +1936,7 @@ function abbr2(r) {
2111
1936
  type: "text",
2112
1937
  content: a.slice(c),
2113
1938
  level: u
2114
- }), p[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
1939
+ }), f[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
2115
1940
  }
2116
1941
  }
2117
1942
  }
@@ -2146,29 +1971,29 @@ function replaceAt(r, e, t) {
2146
1971
  return r.substr(0, e) + t + r.substr(e + 1);
2147
1972
  }
2148
1973
  function smartquotes(r) {
2149
- var e, t, n, s, o, a, l, c, u, d, h, f, p, b, m, g, v;
1974
+ var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2150
1975
  if (r.options.typographer) {
2151
- for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
2152
- 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))) {
2153
- for (l = g[e].level, p = v.length - 1; p >= 0 && !(v[p].level <= l); p--);
2154
- v.length = p + 1, n = t.content, o = 0, a = n.length;
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;
2155
1980
  e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
2156
1981
  if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
2157
1982
  b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2158
1983
  continue;
2159
1984
  }
2160
- if (h = !u, f = !c, f) {
2161
- for (p = v.length - 1; p >= 0 && (d = v[p], !(v[p].level < l)); p--) if (d.single === b && v[p].level === l) {
2162
- 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;
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;
2163
1988
  continue e;
2164
1989
  }
2165
1990
  }
2166
- h ? v.push({
1991
+ h ? g.push({
2167
1992
  token: e,
2168
1993
  pos: s.index,
2169
1994
  single: b,
2170
1995
  level: l
2171
- }) : f && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
1996
+ }) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2172
1997
  }
2173
1998
  }
2174
1999
  }
@@ -2280,20 +2105,20 @@ function blockquote(r, e, t, n) {
2280
2105
  u,
2281
2106
  d,
2282
2107
  h,
2283
- f,
2284
2108
  p,
2109
+ f,
2285
2110
  b,
2286
2111
  m = r.bMarks[e] + r.tShift[e],
2287
- g = r.eMarks[e];
2288
- if (m > g || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2112
+ v = r.eMarks[e];
2113
+ if (m > v || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2289
2114
  if (n) return !0;
2290
- 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++) {
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++) {
2291
2116
  if (r.src.charCodeAt(m++) === 62) {
2292
- 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];
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];
2293
2118
  continue;
2294
2119
  }
2295
2120
  if (o) break;
2296
- for (b = !1, f = 0, p = h.length; f < p; f++) if (h[f](r, s, t, !0)) {
2121
+ for (b = !1, p = 0, f = h.length; p < f; p++) if (h[p](r, s, t, !0)) {
2297
2122
  b = !0;
2298
2123
  break;
2299
2124
  }
@@ -2307,7 +2132,7 @@ function blockquote(r, e, t, n) {
2307
2132
  }), r.parser.tokenize(r, e, s), r.tokens.push({
2308
2133
  type: "blockquote_close",
2309
2134
  level: --r.level
2310
- }), 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];
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];
2311
2136
  return r.blkIndent = c, !0;
2312
2137
  }
2313
2138
  function hr(r, e, t, n) {
@@ -2360,55 +2185,55 @@ function list(r, e, t, n) {
2360
2185
  u,
2361
2186
  d,
2362
2187
  h,
2363
- f,
2364
2188
  p,
2189
+ f,
2365
2190
  b,
2366
2191
  m,
2367
- g,
2368
2192
  v,
2193
+ g,
2369
2194
  y,
2370
- S,
2371
- E,
2372
2195
  x,
2373
- R = !0,
2374
- C,
2375
2196
  _,
2197
+ I,
2198
+ R = !0,
2199
+ w,
2200
+ S,
2376
2201
  H,
2377
2202
  F;
2378
- if ((h = skipOrderedListMarker(r, e)) >= 0) g = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) g = !1;else return !1;
2203
+ if ((h = skipOrderedListMarker(r, e)) >= 0) v = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) v = !1;else return !1;
2379
2204
  if (r.level >= r.options.maxNesting) return !1;
2380
2205
  if (m = r.src.charCodeAt(h - 1), n) return !0;
2381
- 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({
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({
2382
2207
  type: "ordered_list_open",
2383
2208
  order: b,
2384
- lines: E = [e, 0],
2209
+ lines: _ = [e, 0],
2385
2210
  level: r.level++
2386
2211
  })) : r.tokens.push({
2387
2212
  type: "bullet_list_open",
2388
- lines: E = [e, 0],
2213
+ lines: _ = [e, 0],
2389
2214
  level: r.level++
2390
- }), 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({
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({
2391
2216
  type: "list_item_open",
2392
- lines: x = [e, 0],
2217
+ lines: I = [e, 0],
2393
2218
  level: r.level++
2394
- }), 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({
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({
2395
2220
  type: "list_item_close",
2396
2221
  level: --r.level
2397
- }), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2398
- for (F = !1, _ = 0, H = C.length; _ < H; _++) if (C[_](r, s, t, !0)) {
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)) {
2399
2224
  F = !0;
2400
2225
  break;
2401
2226
  }
2402
2227
  if (F) break;
2403
- if (g) {
2228
+ if (v) {
2404
2229
  if (h = skipOrderedListMarker(r, s), h < 0) break;
2405
2230
  } else if (h = skipBulletListMarker(r, s), h < 0) break;
2406
2231
  if (m !== r.src.charCodeAt(h - 1)) break;
2407
2232
  }
2408
2233
  return r.tokens.push({
2409
- type: g ? "ordered_list_close" : "bullet_list_close",
2234
+ type: v ? "ordered_list_close" : "bullet_list_close",
2410
2235
  level: --r.level
2411
- }), E[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2236
+ }), _[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2412
2237
  }
2413
2238
  function footnote(r, e, t, n) {
2414
2239
  var s,
@@ -2520,21 +2345,21 @@ function getLine(r, e) {
2520
2345
  return r.src.substr(t, n - t);
2521
2346
  }
2522
2347
  function table(r, e, t, n) {
2523
- var s, o, a, l, c, u, d, h, f, p, b;
2348
+ var s, o, a, l, c, u, d, h, p, f, b;
2524
2349
  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;
2525
2350
  for (h = [], l = 0; l < u.length; l++) {
2526
- if (f = u[l].trim(), !f) {
2351
+ if (p = u[l].trim(), !p) {
2527
2352
  if (l === 0 || l === u.length - 1) continue;
2528
2353
  return !1;
2529
2354
  }
2530
- if (!/^:?-+:?$/.test(f)) return !1;
2531
- f.charCodeAt(f.length - 1) === 58 ? h.push(f.charCodeAt(0) === 58 ? "center" : "right") : f.charCodeAt(0) === 58 ? h.push("left") : h.push("");
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("");
2532
2357
  }
2533
2358
  if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
2534
2359
  if (n) return !0;
2535
2360
  for (r.tokens.push({
2536
2361
  type: "table_open",
2537
- lines: p = [e, 0],
2362
+ lines: f = [e, 0],
2538
2363
  level: r.level++
2539
2364
  }), r.tokens.push({
2540
2365
  type: "thead_open",
@@ -2597,7 +2422,7 @@ function table(r, e, t, n) {
2597
2422
  }), r.tokens.push({
2598
2423
  type: "table_close",
2599
2424
  level: --r.level
2600
- }), p[1] = b[1] = c, r.line = c, !0;
2425
+ }), f[1] = b[1] = c, r.line = c, !0;
2601
2426
  }
2602
2427
  function skipMarker(r, e) {
2603
2428
  var t,
@@ -2613,7 +2438,7 @@ function markTightParagraphs$1(r, e) {
2613
2438
  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);
2614
2439
  }
2615
2440
  function deflist(r, e, t, n) {
2616
- var s, o, a, l, c, u, d, h, f, p, b, m, g, v;
2441
+ var s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2617
2442
  if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
2618
2443
  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;
2619
2444
  u = r.tokens.length, r.tokens.push({
@@ -2622,7 +2447,7 @@ function deflist(r, e, t, n) {
2622
2447
  level: r.level++
2623
2448
  }), a = e, o = d;
2624
2449
  e: for (;;) {
2625
- for (v = !0, g = !1, r.tokens.push({
2450
+ for (g = !0, v = !1, r.tokens.push({
2626
2451
  type: "dt_open",
2627
2452
  lines: [a, a],
2628
2453
  level: r.level++
@@ -2640,7 +2465,7 @@ function deflist(r, e, t, n) {
2640
2465
  type: "dd_open",
2641
2466
  lines: l = [d, 0],
2642
2467
  level: r.level++
2643
- }), 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({
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({
2644
2469
  type: "dd_close",
2645
2470
  level: --r.level
2646
2471
  }), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
@@ -2652,7 +2477,7 @@ function deflist(r, e, t, n) {
2652
2477
  return r.tokens.push({
2653
2478
  type: "dl_close",
2654
2479
  level: --r.level
2655
- }), c[1] = d, r.line = d, v && markTightParagraphs$1(r, u), !0;
2480
+ }), c[1] = d, r.line = d, g && markTightParagraphs$1(r, u), !0;
2656
2481
  }
2657
2482
  function paragraph(r, e) {
2658
2483
  var t,
@@ -3017,21 +2842,21 @@ function links(r, e) {
3017
2842
  u,
3018
2843
  d = !1,
3019
2844
  h = r.pos,
3020
- f = r.posMax,
3021
- p = r.pos,
3022
- b = r.src.charCodeAt(p);
3023
- 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;
3024
- if (l = n + 1, l < f && r.src.charCodeAt(l) === 40) {
3025
- for (l++; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3026
- if (l >= f) return !1;
3027
- 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++);
3028
- 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 = "";
3029
- if (l >= f || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
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;
3030
2855
  l++;
3031
2856
  } else {
3032
2857
  if (r.linkLevel > 0) return !1;
3033
- for (; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3034
- 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;
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;
3035
2860
  o = c.href, a = c.title;
3036
2861
  }
3037
2862
  return e || (r.pos = t, r.posMax = n, d ? r.push({
@@ -3048,7 +2873,7 @@ function links(r, e) {
3048
2873
  }), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
3049
2874
  type: "link_close",
3050
2875
  level: --r.level
3051
- }))), r.pos = l, r.posMax = f, !0;
2876
+ }))), r.pos = l, r.posMax = p, !0;
3052
2877
  }
3053
2878
  function footnote_inline(r, e) {
3054
2879
  var t,
@@ -3433,10 +3258,10 @@ var SetFileTypes = /*#__PURE__*/function () {
3433
3258
  key: "processMixedFiles",
3434
3259
  value: function processMixedFiles(e, t, n) {
3435
3260
  if (n) {
3436
- var _s2 = {
3261
+ var s = {
3437
3262
  acceptedFormats: ""
3438
3263
  };
3439
- e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, _s2, t, n);
3264
+ e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, s, t, n);
3440
3265
  }
3441
3266
  }
3442
3267
  // needs to be set after audio to overwrite maxNumberOfFiles
@@ -3444,12 +3269,12 @@ var SetFileTypes = /*#__PURE__*/function () {
3444
3269
  }, {
3445
3270
  key: "processMicrophone",
3446
3271
  value: function processMicrophone(e, t, n, s) {
3447
- var _c$files, _f$maxNumberOfFiles;
3448
- var l, c, u, d, h, f;
3272
+ var _c$files, _p$maxNumberOfFiles;
3273
+ var l, c, u, d, h, p;
3449
3274
  var a = _objectSpread({
3450
3275
  acceptedFormats: "audio/*"
3451
3276
  }, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
3452
- 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)));
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)));
3453
3278
  }
3454
3279
  // prettier-ignore
3455
3280
  }, {
@@ -3535,11 +3360,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3535
3360
  }, {
3536
3361
  key: "callServiceAPI",
3537
3362
  value: function () {
3538
- var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
3363
+ var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
3539
3364
  var _c$headers, _u$ContentType;
3540
3365
  var l, c, u, d, s, o, a;
3541
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3542
- while (1) switch (_context17.prev = _context17.next) {
3366
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3367
+ while (1) switch (_context13.prev = _context13.next) {
3543
3368
  case 0:
3544
3369
  s = _objectSpread({
3545
3370
  messages: t
@@ -3548,26 +3373,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
3548
3373
  (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);
3549
3374
  a = this.deepChat.stream;
3550
3375
  if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
3551
- _context17.next = 9;
3376
+ _context13.next = 9;
3552
3377
  break;
3553
3378
  }
3554
- _context17.next = 7;
3379
+ _context13.next = 7;
3555
3380
  return Stream.request(this, s, e);
3556
3381
  case 7:
3557
- _context17.next = 11;
3382
+ _context13.next = 11;
3558
3383
  break;
3559
3384
  case 9:
3560
- _context17.next = 11;
3385
+ _context13.next = 11;
3561
3386
  return HTTPRequest.request(this, s, e);
3562
3387
  case 11:
3563
3388
  o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
3564
3389
  case 12:
3565
3390
  case "end":
3566
- return _context17.stop();
3391
+ return _context13.stop();
3567
3392
  }
3568
- }, _callee17, this);
3393
+ }, _callee13, this);
3569
3394
  }));
3570
- function callServiceAPI(_x32, _x33, _x34) {
3395
+ function callServiceAPI(_x23, _x24, _x25) {
3571
3396
  return _callServiceAPI.apply(this, arguments);
3572
3397
  }
3573
3398
  return callServiceAPI;
@@ -3575,24 +3400,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3575
3400
  }, {
3576
3401
  key: "callApiWithFiles",
3577
3402
  value: function () {
3578
- var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n, s) {
3403
+ var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
3579
3404
  var o, a, l;
3580
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3581
- while (1) switch (_context18.prev = _context18.next) {
3405
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3406
+ while (1) switch (_context14.prev = _context14.next) {
3582
3407
  case 0:
3583
3408
  o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
3584
3409
  this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
3585
- _context18.next = 4;
3410
+ _context14.next = 4;
3586
3411
  return HTTPRequest.request(this, o, t, !1);
3587
3412
  case 4:
3588
3413
  this.requestSettings = a;
3589
3414
  case 5:
3590
3415
  case "end":
3591
- return _context18.stop();
3416
+ return _context14.stop();
3592
3417
  }
3593
- }, _callee18, this);
3418
+ }, _callee14, this);
3594
3419
  }));
3595
- function callApiWithFiles(_x35, _x36, _x37, _x38) {
3420
+ function callApiWithFiles(_x26, _x27, _x28, _x29) {
3596
3421
  return _callApiWithFiles.apply(this, arguments);
3597
3422
  }
3598
3423
  return callApiWithFiles;
@@ -3600,31 +3425,31 @@ var BaseServiceIO = /*#__PURE__*/function () {
3600
3425
  }, {
3601
3426
  key: "callAPI",
3602
3427
  value: function () {
3603
- var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t) {
3604
- var n, _s3;
3605
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3606
- while (1) switch (_context19.prev = _context19.next) {
3428
+ var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t) {
3429
+ var n, s;
3430
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3431
+ while (1) switch (_context15.prev = _context15.next) {
3607
3432
  case 0:
3608
3433
  if (this.requestSettings) {
3609
- _context19.next = 2;
3434
+ _context15.next = 2;
3610
3435
  break;
3611
3436
  }
3612
3437
  throw new Error("Request settings have not been set up");
3613
3438
  case 2:
3614
3439
  n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
3615
3440
  if (this.requestSettings.websocket) {
3616
- _s3 = _objectSpread({
3441
+ s = _objectSpread({
3617
3442
  messages: n
3618
3443
  }, this.rawBody);
3619
- Websocket.sendWebsocket(this, _s3, t, !1);
3444
+ Websocket.sendWebsocket(this, s, t, !1);
3620
3445
  } else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
3621
3446
  case 4:
3622
3447
  case "end":
3623
- return _context19.stop();
3448
+ return _context15.stop();
3624
3449
  }
3625
- }, _callee19, this);
3450
+ }, _callee15, this);
3626
3451
  }));
3627
- function callAPI(_x39, _x40) {
3452
+ function callAPI(_x30, _x31) {
3628
3453
  return _callAPI.apply(this, arguments);
3629
3454
  }
3630
3455
  return callAPI;
@@ -3633,24 +3458,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3633
3458
  }, {
3634
3459
  key: "extractResultData",
3635
3460
  value: function () {
3636
- var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
3637
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3638
- while (1) switch (_context20.prev = _context20.next) {
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) {
3639
3464
  case 0:
3640
3465
  if (!e.error) {
3641
- _context20.next = 2;
3466
+ _context16.next = 2;
3642
3467
  break;
3643
3468
  }
3644
3469
  throw e.error;
3645
3470
  case 2:
3646
- return _context20.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
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);
3647
3472
  case 3:
3648
3473
  case "end":
3649
- return _context20.stop();
3474
+ return _context16.stop();
3650
3475
  }
3651
- }, _callee20);
3476
+ }, _callee16);
3652
3477
  }));
3653
- function extractResultData(_x41) {
3478
+ function extractResultData(_x32) {
3654
3479
  return _extractResultData.apply(this, arguments);
3655
3480
  }
3656
3481
  return extractResultData;
@@ -3867,8 +3692,8 @@ var InsertKeyView = /*#__PURE__*/function () {
3867
3692
  n.id = "insert-key-help-text-contents";
3868
3693
  var s = InsertKeyView.createFailText();
3869
3694
  if (n.appendChild(s), e) {
3870
- var _a2 = InsertKeyView.createHelpLink(e);
3871
- n.appendChild(_a2);
3695
+ var a = InsertKeyView.createHelpLink(e);
3696
+ n.appendChild(a);
3872
3697
  }
3873
3698
  var o = InsertKeyView.createCautionText();
3874
3699
  return n.appendChild(o), t.appendChild(n), {
@@ -4014,13 +3839,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
4014
3839
  }, {
4015
3840
  key: "callServiceAPI",
4016
3841
  value: function () {
4017
- var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
3842
+ var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
4018
3843
  var s;
4019
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4020
- while (1) switch (_context21.prev = _context21.next) {
3844
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3845
+ while (1) switch (_context17.prev = _context17.next) {
4021
3846
  case 0:
4022
3847
  if (this.requestSettings) {
4023
- _context21.next = 2;
3848
+ _context17.next = 2;
4024
3849
  break;
4025
3850
  }
4026
3851
  throw new Error("Request settings have not been set up");
@@ -4029,11 +3854,11 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
4029
3854
  HTTPRequest.request(this, s, e);
4030
3855
  case 4:
4031
3856
  case "end":
4032
- return _context21.stop();
3857
+ return _context17.stop();
4033
3858
  }
4034
- }, _callee21, this);
3859
+ }, _callee17, this);
4035
3860
  }));
4036
- function callServiceAPI(_x42, _x43, _x44) {
3861
+ function callServiceAPI(_x33, _x34, _x35) {
4037
3862
  return _callServiceAPI2.apply(this, arguments);
4038
3863
  }
4039
3864
  return callServiceAPI;
@@ -4062,18 +3887,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
4062
3887
  }, {
4063
3888
  key: "callServiceAPI",
4064
3889
  value: function () {
4065
- var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e, t, n) {
4066
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4067
- while (1) switch (_context22.prev = _context22.next) {
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) {
4068
3893
  case 0:
4069
3894
  if (this.requestSettings) {
4070
- _context22.next = 2;
3895
+ _context18.next = 2;
4071
3896
  break;
4072
3897
  }
4073
3898
  throw new Error("Request settings have not been set up");
4074
3899
  case 2:
4075
3900
  if (n != null && n[0]) {
4076
- _context22.next = 4;
3901
+ _context18.next = 4;
4077
3902
  break;
4078
3903
  }
4079
3904
  throw new Error("No file was added");
@@ -4081,11 +3906,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
4081
3906
  HTTPRequest.poll(this, n[0], e, !1);
4082
3907
  case 5:
4083
3908
  case "end":
4084
- return _context22.stop();
3909
+ return _context18.stop();
4085
3910
  }
4086
- }, _callee22, this);
3911
+ }, _callee18, this);
4087
3912
  }));
4088
- function callServiceAPI(_x45, _x46, _x47) {
3913
+ function callServiceAPI(_x36, _x37, _x38) {
4089
3914
  return _callServiceAPI3.apply(this, arguments);
4090
3915
  }
4091
3916
  return callServiceAPI;
@@ -4114,35 +3939,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
4114
3939
  _createClass(HuggingFaceAudioClassificationIO, [{
4115
3940
  key: "extractPollResultData",
4116
3941
  value: function () {
4117
- var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
3942
+ var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
4118
3943
  var t;
4119
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4120
- while (1) switch (_context23.prev = _context23.next) {
3944
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3945
+ while (1) switch (_context19.prev = _context19.next) {
4121
3946
  case 0:
4122
3947
  if (!e.estimated_time) {
4123
- _context23.next = 2;
3948
+ _context19.next = 2;
4124
3949
  break;
4125
3950
  }
4126
- return _context23.abrupt("return", {
3951
+ return _context19.abrupt("return", {
4127
3952
  timeoutMS: (e.estimated_time + 1) * 1e3
4128
3953
  });
4129
3954
  case 2:
4130
3955
  if (!e.error) {
4131
- _context23.next = 4;
3956
+ _context19.next = 4;
4132
3957
  break;
4133
3958
  }
4134
3959
  throw e.error;
4135
3960
  case 4:
4136
- return _context23.abrupt("return", {
3961
+ return _context19.abrupt("return", {
4137
3962
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4138
3963
  });
4139
3964
  case 5:
4140
3965
  case "end":
4141
- return _context23.stop();
3966
+ return _context19.stop();
4142
3967
  }
4143
- }, _callee23);
3968
+ }, _callee19);
4144
3969
  }));
4145
- function extractPollResultData(_x48) {
3970
+ function extractPollResultData(_x39) {
4146
3971
  return _extractPollResultData.apply(this, arguments);
4147
3972
  }
4148
3973
  return extractPollResultData;
@@ -4165,35 +3990,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
4165
3990
  _createClass(HuggingFaceImageClassificationIO, [{
4166
3991
  key: "extractPollResultData",
4167
3992
  value: function () {
4168
- var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
3993
+ var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
4169
3994
  var t;
4170
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4171
- while (1) switch (_context24.prev = _context24.next) {
3995
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3996
+ while (1) switch (_context20.prev = _context20.next) {
4172
3997
  case 0:
4173
3998
  if (!e.estimated_time) {
4174
- _context24.next = 2;
3999
+ _context20.next = 2;
4175
4000
  break;
4176
4001
  }
4177
- return _context24.abrupt("return", {
4002
+ return _context20.abrupt("return", {
4178
4003
  timeoutMS: (e.estimated_time + 1) * 1e3
4179
4004
  });
4180
4005
  case 2:
4181
4006
  if (!e.error) {
4182
- _context24.next = 4;
4007
+ _context20.next = 4;
4183
4008
  break;
4184
4009
  }
4185
4010
  throw e.error;
4186
4011
  case 4:
4187
- return _context24.abrupt("return", {
4012
+ return _context20.abrupt("return", {
4188
4013
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4189
4014
  });
4190
4015
  case 5:
4191
4016
  case "end":
4192
- return _context24.stop();
4017
+ return _context20.stop();
4193
4018
  }
4194
- }, _callee24);
4019
+ }, _callee20);
4195
4020
  }));
4196
- function extractPollResultData(_x49) {
4021
+ function extractPollResultData(_x40) {
4197
4022
  return _extractPollResultData2.apply(this, arguments);
4198
4023
  }
4199
4024
  return extractPollResultData;
@@ -4278,19 +4103,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4278
4103
  }, {
4279
4104
  key: "callServiceAPI",
4280
4105
  value: function () {
4281
- var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
4106
+ var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
4282
4107
  var s;
4283
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4284
- while (1) switch (_context25.prev = _context25.next) {
4108
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4109
+ while (1) switch (_context21.prev = _context21.next) {
4285
4110
  case 0:
4286
4111
  if (this.requestSettings) {
4287
- _context25.next = 2;
4112
+ _context21.next = 2;
4288
4113
  break;
4289
4114
  }
4290
4115
  throw new Error("Request settings have not been set up");
4291
4116
  case 2:
4292
4117
  if (n) {
4293
- _context25.next = 4;
4118
+ _context21.next = 4;
4294
4119
  break;
4295
4120
  }
4296
4121
  throw new Error("Image was not found");
@@ -4299,11 +4124,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4299
4124
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
4300
4125
  case 6:
4301
4126
  case "end":
4302
- return _context25.stop();
4127
+ return _context21.stop();
4303
4128
  }
4304
- }, _callee25, this);
4129
+ }, _callee21, this);
4305
4130
  }));
4306
- function callServiceAPI(_x50, _x51, _x52) {
4131
+ function callServiceAPI(_x41, _x42, _x43) {
4307
4132
  return _callServiceAPI4.apply(this, arguments);
4308
4133
  }
4309
4134
  return callServiceAPI;
@@ -4311,17 +4136,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4311
4136
  }, {
4312
4137
  key: "extractResultData",
4313
4138
  value: function () {
4314
- var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4315
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4316
- while (1) switch (_context26.prev = _context26.next) {
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) {
4317
4142
  case 0:
4318
4143
  if (!e.message) {
4319
- _context26.next = 2;
4144
+ _context22.next = 2;
4320
4145
  break;
4321
4146
  }
4322
4147
  throw e.message;
4323
4148
  case 2:
4324
- return _context26.abrupt("return", {
4149
+ return _context22.abrupt("return", {
4325
4150
  files: e.artifacts.map(function (n) {
4326
4151
  return {
4327
4152
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4331,11 +4156,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4331
4156
  });
4332
4157
  case 3:
4333
4158
  case "end":
4334
- return _context26.stop();
4159
+ return _context22.stop();
4335
4160
  }
4336
- }, _callee26);
4161
+ }, _callee22);
4337
4162
  }));
4338
- function extractResultData(_x53) {
4163
+ function extractResultData(_x44) {
4339
4164
  return _extractResultData2.apply(this, arguments);
4340
4165
  }
4341
4166
  return extractResultData;
@@ -4387,19 +4212,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4387
4212
  }, {
4388
4213
  key: "callServiceAPI",
4389
4214
  value: function () {
4390
- var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e, t, n) {
4215
+ var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
4391
4216
  var a, l, s, o;
4392
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4393
- while (1) switch (_context27.prev = _context27.next) {
4217
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4218
+ while (1) switch (_context23.prev = _context23.next) {
4394
4219
  case 0:
4395
4220
  if (this.requestSettings) {
4396
- _context27.next = 2;
4221
+ _context23.next = 2;
4397
4222
  break;
4398
4223
  }
4399
4224
  throw new Error("Request settings have not been set up");
4400
4225
  case 2:
4401
4226
  if (!(!n || !n[0] || !n[1])) {
4402
- _context27.next = 4;
4227
+ _context23.next = 4;
4403
4228
  break;
4404
4229
  }
4405
4230
  throw new Error("Image was not found");
@@ -4408,11 +4233,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4408
4233
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4409
4234
  case 6:
4410
4235
  case "end":
4411
- return _context27.stop();
4236
+ return _context23.stop();
4412
4237
  }
4413
- }, _callee27, this);
4238
+ }, _callee23, this);
4414
4239
  }));
4415
- function callServiceAPI(_x54, _x55, _x56) {
4240
+ function callServiceAPI(_x45, _x46, _x47) {
4416
4241
  return _callServiceAPI5.apply(this, arguments);
4417
4242
  }
4418
4243
  return callServiceAPI;
@@ -4420,17 +4245,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4420
4245
  }, {
4421
4246
  key: "extractResultData",
4422
4247
  value: function () {
4423
- var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4424
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4425
- while (1) switch (_context28.prev = _context28.next) {
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) {
4426
4251
  case 0:
4427
4252
  if (!e.message) {
4428
- _context28.next = 2;
4253
+ _context24.next = 2;
4429
4254
  break;
4430
4255
  }
4431
4256
  throw e.message;
4432
4257
  case 2:
4433
- return _context28.abrupt("return", {
4258
+ return _context24.abrupt("return", {
4434
4259
  files: e.artifacts.map(function (n) {
4435
4260
  return {
4436
4261
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4440,11 +4265,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4440
4265
  });
4441
4266
  case 3:
4442
4267
  case "end":
4443
- return _context28.stop();
4268
+ return _context24.stop();
4444
4269
  }
4445
- }, _callee28);
4270
+ }, _callee24);
4446
4271
  }));
4447
- function extractResultData(_x57) {
4272
+ function extractResultData(_x48) {
4448
4273
  return _extractResultData3.apply(this, arguments);
4449
4274
  }
4450
4275
  return extractResultData;
@@ -4477,34 +4302,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
4477
4302
  _createClass(HuggingFaceAudioRecognitionIO, [{
4478
4303
  key: "extractPollResultData",
4479
4304
  value: function () {
4480
- var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4481
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4482
- while (1) switch (_context29.prev = _context29.next) {
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) {
4483
4308
  case 0:
4484
4309
  if (!e.estimated_time) {
4485
- _context29.next = 2;
4310
+ _context25.next = 2;
4486
4311
  break;
4487
4312
  }
4488
- return _context29.abrupt("return", {
4313
+ return _context25.abrupt("return", {
4489
4314
  timeoutMS: (e.estimated_time + 1) * 1e3
4490
4315
  });
4491
4316
  case 2:
4492
4317
  if (!e.error) {
4493
- _context29.next = 4;
4318
+ _context25.next = 4;
4494
4319
  break;
4495
4320
  }
4496
4321
  throw e.error;
4497
4322
  case 4:
4498
- return _context29.abrupt("return", {
4323
+ return _context25.abrupt("return", {
4499
4324
  text: e.text || ""
4500
4325
  });
4501
4326
  case 5:
4502
4327
  case "end":
4503
- return _context29.stop();
4328
+ return _context25.stop();
4504
4329
  }
4505
- }, _callee29);
4330
+ }, _callee25);
4506
4331
  }));
4507
- function extractPollResultData(_x58) {
4332
+ function extractPollResultData(_x49) {
4508
4333
  return _extractPollResultData3.apply(this, arguments);
4509
4334
  }
4510
4335
  return extractPollResultData;
@@ -4525,26 +4350,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
4525
4350
  _createClass(HuggingFaceTextGenerationIO, [{
4526
4351
  key: "extractResultData",
4527
4352
  value: function () {
4528
- var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4529
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4530
- while (1) switch (_context30.prev = _context30.next) {
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) {
4531
4356
  case 0:
4532
4357
  if (!e.error) {
4533
- _context30.next = 2;
4358
+ _context26.next = 2;
4534
4359
  break;
4535
4360
  }
4536
4361
  throw e.error;
4537
4362
  case 2:
4538
- return _context30.abrupt("return", {
4363
+ return _context26.abrupt("return", {
4539
4364
  text: e[0].generated_text || ""
4540
4365
  });
4541
4366
  case 3:
4542
4367
  case "end":
4543
- return _context30.stop();
4368
+ return _context26.stop();
4544
4369
  }
4545
- }, _callee30);
4370
+ }, _callee26);
4546
4371
  }));
4547
- function extractResultData(_x59) {
4372
+ function extractResultData(_x50) {
4548
4373
  return _extractResultData4.apply(this, arguments);
4549
4374
  }
4550
4375
  return extractResultData;
@@ -4581,26 +4406,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
4581
4406
  }, {
4582
4407
  key: "extractResultData",
4583
4408
  value: function () {
4584
- var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4585
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4586
- while (1) switch (_context31.prev = _context31.next) {
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) {
4587
4412
  case 0:
4588
4413
  if (!e.error) {
4589
- _context31.next = 2;
4414
+ _context27.next = 2;
4590
4415
  break;
4591
4416
  }
4592
4417
  throw e.error;
4593
4418
  case 2:
4594
- return _context31.abrupt("return", {
4419
+ return _context27.abrupt("return", {
4595
4420
  text: e.answer || ""
4596
4421
  });
4597
4422
  case 3:
4598
4423
  case "end":
4599
- return _context31.stop();
4424
+ return _context27.stop();
4600
4425
  }
4601
- }, _callee31);
4426
+ }, _callee27);
4602
4427
  }));
4603
- function extractResultData(_x60) {
4428
+ function extractResultData(_x51) {
4604
4429
  return _extractResultData5.apply(this, arguments);
4605
4430
  }
4606
4431
  return extractResultData;
@@ -4621,26 +4446,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
4621
4446
  _createClass(HuggingFaceSummarizationIO, [{
4622
4447
  key: "extractResultData",
4623
4448
  value: function () {
4624
- var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4625
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4626
- while (1) switch (_context32.prev = _context32.next) {
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) {
4627
4452
  case 0:
4628
4453
  if (!e.error) {
4629
- _context32.next = 2;
4454
+ _context28.next = 2;
4630
4455
  break;
4631
4456
  }
4632
4457
  throw e.error;
4633
4458
  case 2:
4634
- return _context32.abrupt("return", {
4459
+ return _context28.abrupt("return", {
4635
4460
  text: e[0].summary_text || ""
4636
4461
  });
4637
4462
  case 3:
4638
4463
  case "end":
4639
- return _context32.stop();
4464
+ return _context28.stop();
4640
4465
  }
4641
- }, _callee32);
4466
+ }, _callee28);
4642
4467
  }));
4643
- function extractResultData(_x61) {
4468
+ function extractResultData(_x52) {
4644
4469
  return _extractResultData6.apply(this, arguments);
4645
4470
  }
4646
4471
  return extractResultData;
@@ -4701,26 +4526,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
4701
4526
  }, {
4702
4527
  key: "extractResultData",
4703
4528
  value: function () {
4704
- var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
4705
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4706
- while (1) switch (_context33.prev = _context33.next) {
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) {
4707
4532
  case 0:
4708
4533
  if (!e.error) {
4709
- _context33.next = 2;
4534
+ _context29.next = 2;
4710
4535
  break;
4711
4536
  }
4712
4537
  throw e.error;
4713
4538
  case 2:
4714
- return _context33.abrupt("return", {
4539
+ return _context29.abrupt("return", {
4715
4540
  text: e.generated_text || ""
4716
4541
  });
4717
4542
  case 3:
4718
4543
  case "end":
4719
- return _context33.stop();
4544
+ return _context29.stop();
4720
4545
  }
4721
- }, _callee33);
4546
+ }, _callee29);
4722
4547
  }));
4723
- function extractResultData(_x62) {
4548
+ function extractResultData(_x53) {
4724
4549
  return _extractResultData7.apply(this, arguments);
4725
4550
  }
4726
4551
  return extractResultData;
@@ -4762,19 +4587,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4762
4587
  }, {
4763
4588
  key: "callServiceAPI",
4764
4589
  value: function () {
4765
- var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e, t, n) {
4590
+ var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
4766
4591
  var a, l, s, o;
4767
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4768
- while (1) switch (_context34.prev = _context34.next) {
4592
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4593
+ while (1) switch (_context30.prev = _context30.next) {
4769
4594
  case 0:
4770
4595
  if (this.requestSettings) {
4771
- _context34.next = 2;
4596
+ _context30.next = 2;
4772
4597
  break;
4773
4598
  }
4774
4599
  throw new Error("Request settings have not been set up");
4775
4600
  case 2:
4776
4601
  if (n) {
4777
- _context34.next = 4;
4602
+ _context30.next = 4;
4778
4603
  break;
4779
4604
  }
4780
4605
  throw new Error("Image was not found");
@@ -4783,11 +4608,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4783
4608
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4784
4609
  case 6:
4785
4610
  case "end":
4786
- return _context34.stop();
4611
+ return _context30.stop();
4787
4612
  }
4788
- }, _callee34, this);
4613
+ }, _callee30, this);
4789
4614
  }));
4790
- function callServiceAPI(_x63, _x64, _x65) {
4615
+ function callServiceAPI(_x54, _x55, _x56) {
4791
4616
  return _callServiceAPI6.apply(this, arguments);
4792
4617
  }
4793
4618
  return callServiceAPI;
@@ -4795,17 +4620,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4795
4620
  }, {
4796
4621
  key: "extractResultData",
4797
4622
  value: function () {
4798
- var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4799
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4800
- while (1) switch (_context35.prev = _context35.next) {
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) {
4801
4626
  case 0:
4802
4627
  if (!e.message) {
4803
- _context35.next = 2;
4628
+ _context31.next = 2;
4804
4629
  break;
4805
4630
  }
4806
4631
  throw e.message;
4807
4632
  case 2:
4808
- return _context35.abrupt("return", {
4633
+ return _context31.abrupt("return", {
4809
4634
  files: e.artifacts.map(function (n) {
4810
4635
  return {
4811
4636
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4815,11 +4640,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4815
4640
  });
4816
4641
  case 3:
4817
4642
  case "end":
4818
- return _context35.stop();
4643
+ return _context31.stop();
4819
4644
  }
4820
- }, _callee35);
4645
+ }, _callee31);
4821
4646
  }));
4822
- function extractResultData(_x66) {
4647
+ function extractResultData(_x57) {
4823
4648
  return _extractResultData8.apply(this, arguments);
4824
4649
  }
4825
4650
  return extractResultData;
@@ -4850,26 +4675,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
4850
4675
  _createClass(HuggingFaceTranslationIO, [{
4851
4676
  key: "extractResultData",
4852
4677
  value: function () {
4853
- var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
4854
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4855
- while (1) switch (_context36.prev = _context36.next) {
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) {
4856
4681
  case 0:
4857
4682
  if (!e.error) {
4858
- _context36.next = 2;
4683
+ _context32.next = 2;
4859
4684
  break;
4860
4685
  }
4861
4686
  throw e.error;
4862
4687
  case 2:
4863
- return _context36.abrupt("return", {
4688
+ return _context32.abrupt("return", {
4864
4689
  text: e[0].translation_text || ""
4865
4690
  });
4866
4691
  case 3:
4867
4692
  case "end":
4868
- return _context36.stop();
4693
+ return _context32.stop();
4869
4694
  }
4870
- }, _callee36);
4695
+ }, _callee32);
4871
4696
  }));
4872
- function extractResultData(_x67) {
4697
+ function extractResultData(_x58) {
4873
4698
  return _extractResultData9.apply(this, arguments);
4874
4699
  }
4875
4700
  return extractResultData;
@@ -4903,13 +4728,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4903
4728
  }, {
4904
4729
  key: "callServiceAPI",
4905
4730
  value: function () {
4906
- var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e, t) {
4731
+ var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
4907
4732
  var n;
4908
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4909
- while (1) switch (_context37.prev = _context37.next) {
4733
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4734
+ while (1) switch (_context33.prev = _context33.next) {
4910
4735
  case 0:
4911
4736
  if (this.requestSettings) {
4912
- _context37.next = 2;
4737
+ _context33.next = 2;
4913
4738
  break;
4914
4739
  }
4915
4740
  throw new Error("Request settings have not been set up");
@@ -4918,11 +4743,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4918
4743
  HTTPRequest.request(this, n, e);
4919
4744
  case 4:
4920
4745
  case "end":
4921
- return _context37.stop();
4746
+ return _context33.stop();
4922
4747
  }
4923
- }, _callee37, this);
4748
+ }, _callee33, this);
4924
4749
  }));
4925
- function callServiceAPI(_x68, _x69) {
4750
+ function callServiceAPI(_x59, _x60) {
4926
4751
  return _callServiceAPI7.apply(this, arguments);
4927
4752
  }
4928
4753
  return callServiceAPI;
@@ -4930,17 +4755,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4930
4755
  }, {
4931
4756
  key: "extractResultData",
4932
4757
  value: function () {
4933
- var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
4934
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4935
- while (1) switch (_context38.prev = _context38.next) {
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) {
4936
4761
  case 0:
4937
4762
  if (!e.message) {
4938
- _context38.next = 2;
4763
+ _context34.next = 2;
4939
4764
  break;
4940
4765
  }
4941
4766
  throw e.message;
4942
4767
  case 2:
4943
- return _context38.abrupt("return", {
4768
+ return _context34.abrupt("return", {
4944
4769
  files: e.artifacts.map(function (n) {
4945
4770
  return {
4946
4771
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4950,11 +4775,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4950
4775
  });
4951
4776
  case 3:
4952
4777
  case "end":
4953
- return _context38.stop();
4778
+ return _context34.stop();
4954
4779
  }
4955
- }, _callee38);
4780
+ }, _callee34);
4956
4781
  }));
4957
- function extractResultData(_x70) {
4782
+ function extractResultData(_x61) {
4958
4783
  return _extractResultData10.apply(this, arguments);
4959
4784
  }
4960
4785
  return extractResultData;
@@ -4987,26 +4812,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
4987
4812
  _createClass(HuggingFaceFillMaskIO, [{
4988
4813
  key: "extractResultData",
4989
4814
  value: function () {
4990
- var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
4991
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4992
- while (1) switch (_context39.prev = _context39.next) {
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) {
4993
4818
  case 0:
4994
4819
  if (!e.error) {
4995
- _context39.next = 2;
4820
+ _context35.next = 2;
4996
4821
  break;
4997
4822
  }
4998
4823
  throw e.error;
4999
4824
  case 2:
5000
- return _context39.abrupt("return", {
4825
+ return _context35.abrupt("return", {
5001
4826
  text: e[0].sequence || ""
5002
4827
  });
5003
4828
  case 3:
5004
4829
  case "end":
5005
- return _context39.stop();
4830
+ return _context35.stop();
5006
4831
  }
5007
- }, _callee39);
4832
+ }, _callee35);
5008
4833
  }));
5009
- function extractResultData(_x71) {
4834
+ function extractResultData(_x62) {
5010
4835
  return _extractResultData11.apply(this, arguments);
5011
4836
  }
5012
4837
  return extractResultData;
@@ -5081,13 +4906,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
5081
4906
  }, {
5082
4907
  key: "callServiceAPI",
5083
4908
  value: function () {
5084
- var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
4909
+ var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
5085
4910
  var n;
5086
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5087
- while (1) switch (_context40.prev = _context40.next) {
4911
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4912
+ while (1) switch (_context36.prev = _context36.next) {
5088
4913
  case 0:
5089
4914
  if (this.requestSettings) {
5090
- _context40.next = 2;
4915
+ _context36.next = 2;
5091
4916
  break;
5092
4917
  }
5093
4918
  throw new Error("Request settings have not been set up");
@@ -5096,11 +4921,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
5096
4921
  HTTPRequest.request(this, n, e);
5097
4922
  case 4:
5098
4923
  case "end":
5099
- return _context40.stop();
4924
+ return _context36.stop();
5100
4925
  }
5101
- }, _callee40, this);
4926
+ }, _callee36, this);
5102
4927
  }));
5103
- function callServiceAPI(_x72, _x73) {
4928
+ function callServiceAPI(_x63, _x64) {
5104
4929
  return _callServiceAPI8.apply(this, arguments);
5105
4930
  }
5106
4931
  return callServiceAPI;
@@ -5108,27 +4933,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
5108
4933
  }, {
5109
4934
  key: "extractResultData",
5110
4935
  value: function () {
5111
- var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
4936
+ var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
5112
4937
  var t;
5113
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5114
- while (1) switch (_context41.prev = _context41.next) {
4938
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4939
+ while (1) switch (_context37.prev = _context37.next) {
5115
4940
  case 0:
5116
4941
  if (!e.message) {
5117
- _context41.next = 2;
4942
+ _context37.next = 2;
5118
4943
  break;
5119
4944
  }
5120
4945
  throw e.message;
5121
4946
  case 2:
5122
- return _context41.abrupt("return", {
4947
+ return _context37.abrupt("return", {
5123
4948
  text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
5124
4949
  });
5125
4950
  case 3:
5126
4951
  case "end":
5127
- return _context41.stop();
4952
+ return _context37.stop();
5128
4953
  }
5129
- }, _callee41);
4954
+ }, _callee37);
5130
4955
  }));
5131
- function extractResultData(_x74) {
4956
+ function extractResultData(_x65) {
5132
4957
  return _extractResultData12.apply(this, arguments);
5133
4958
  }
5134
4959
  return extractResultData;
@@ -5158,13 +4983,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5158
4983
  }, {
5159
4984
  key: "callServiceAPI",
5160
4985
  value: function () {
5161
- var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
4986
+ var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
5162
4987
  var n;
5163
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5164
- while (1) switch (_context42.prev = _context42.next) {
4988
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4989
+ while (1) switch (_context38.prev = _context38.next) {
5165
4990
  case 0:
5166
4991
  if (this.requestSettings) {
5167
- _context42.next = 2;
4992
+ _context38.next = 2;
5168
4993
  break;
5169
4994
  }
5170
4995
  throw new Error("Request settings have not been set up");
@@ -5173,11 +4998,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5173
4998
  HTTPRequest.request(this, n, e);
5174
4999
  case 4:
5175
5000
  case "end":
5176
- return _context42.stop();
5001
+ return _context38.stop();
5177
5002
  }
5178
- }, _callee42, this);
5003
+ }, _callee38, this);
5179
5004
  }));
5180
- function callServiceAPI(_x75, _x76) {
5005
+ function callServiceAPI(_x66, _x67) {
5181
5006
  return _callServiceAPI9.apply(this, arguments);
5182
5007
  }
5183
5008
  return callServiceAPI;
@@ -5185,26 +5010,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5185
5010
  }, {
5186
5011
  key: "extractResultData",
5187
5012
  value: function () {
5188
- var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
5189
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5190
- while (1) switch (_context43.prev = _context43.next) {
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) {
5191
5016
  case 0:
5192
5017
  if (!e.message) {
5193
- _context43.next = 2;
5018
+ _context39.next = 2;
5194
5019
  break;
5195
5020
  }
5196
5021
  throw e.message;
5197
5022
  case 2:
5198
- return _context43.abrupt("return", {
5023
+ return _context39.abrupt("return", {
5199
5024
  text: e.summary || ""
5200
5025
  });
5201
5026
  case 3:
5202
5027
  case "end":
5203
- return _context43.stop();
5028
+ return _context39.stop();
5204
5029
  }
5205
- }, _callee43);
5030
+ }, _callee39);
5206
5031
  }));
5207
- function extractResultData(_x77) {
5032
+ function extractResultData(_x68) {
5208
5033
  return _extractResultData13.apply(this, arguments);
5209
5034
  }
5210
5035
  return extractResultData;
@@ -5361,13 +5186,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5361
5186
  }, {
5362
5187
  key: "callServiceAPI",
5363
5188
  value: function () {
5364
- var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e, t) {
5189
+ var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
5365
5190
  var n;
5366
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5367
- while (1) switch (_context44.prev = _context44.next) {
5191
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5192
+ while (1) switch (_context40.prev = _context40.next) {
5368
5193
  case 0:
5369
5194
  if (this.requestSettings) {
5370
- _context44.next = 2;
5195
+ _context40.next = 2;
5371
5196
  break;
5372
5197
  }
5373
5198
  throw new Error("Request settings have not been set up");
@@ -5376,11 +5201,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5376
5201
  HTTPRequest.request(this, n, e), this.messages = e;
5377
5202
  case 4:
5378
5203
  case "end":
5379
- return _context44.stop();
5204
+ return _context40.stop();
5380
5205
  }
5381
- }, _callee44, this);
5206
+ }, _callee40, this);
5382
5207
  }));
5383
- function callServiceAPI(_x78, _x79) {
5208
+ function callServiceAPI(_x69, _x70) {
5384
5209
  return _callServiceAPI10.apply(this, arguments);
5385
5210
  }
5386
5211
  return callServiceAPI;
@@ -5388,34 +5213,34 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5388
5213
  }, {
5389
5214
  key: "extractResultData",
5390
5215
  value: function () {
5391
- var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5392
- var t, n, _s4;
5393
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5394
- while (1) switch (_context45.prev = _context45.next) {
5216
+ var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
5217
+ var t, n, s;
5218
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5219
+ while (1) switch (_context41.prev = _context41.next) {
5395
5220
  case 0:
5396
5221
  if (!e.error) {
5397
- _context45.next = 2;
5222
+ _context41.next = 2;
5398
5223
  break;
5399
5224
  }
5400
5225
  throw e.error.message;
5401
5226
  case 2:
5402
5227
  if (this.messages && this.completionsHandlers) {
5403
- n = e.headers.get("operation-location"), _s4 = {
5228
+ n = e.headers.get("operation-location"), s = {
5404
5229
  method: "GET",
5405
5230
  headers: (t = this.requestSettings) == null ? void 0 : t.headers
5406
5231
  };
5407
- HTTPRequest.executePollRequest(this, n, _s4, this.messages);
5232
+ HTTPRequest.executePollRequest(this, n, s, this.messages);
5408
5233
  }
5409
- return _context45.abrupt("return", {
5234
+ return _context41.abrupt("return", {
5410
5235
  pollingInAnotherRequest: !0
5411
5236
  });
5412
5237
  case 4:
5413
5238
  case "end":
5414
- return _context45.stop();
5239
+ return _context41.stop();
5415
5240
  }
5416
- }, _callee45, this);
5241
+ }, _callee41, this);
5417
5242
  }));
5418
- function extractResultData(_x80) {
5243
+ function extractResultData(_x71) {
5419
5244
  return _extractResultData14.apply(this, arguments);
5420
5245
  }
5421
5246
  return extractResultData;
@@ -5423,33 +5248,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5423
5248
  }, {
5424
5249
  key: "extractPollResultData",
5425
5250
  value: function () {
5426
- var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
5251
+ var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5427
5252
  var t, _iterator, _step, n;
5428
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5429
- while (1) switch (_context46.prev = _context46.next) {
5253
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5254
+ while (1) switch (_context42.prev = _context42.next) {
5430
5255
  case 0:
5431
5256
  if (!e.error) {
5432
- _context46.next = 2;
5257
+ _context42.next = 2;
5433
5258
  break;
5434
5259
  }
5435
5260
  throw e.error;
5436
5261
  case 2:
5437
5262
  if (!(e.status === "running")) {
5438
- _context46.next = 4;
5263
+ _context42.next = 4;
5439
5264
  break;
5440
5265
  }
5441
- return _context46.abrupt("return", {
5266
+ return _context42.abrupt("return", {
5442
5267
  timeoutMS: 2e3
5443
5268
  });
5444
5269
  case 4:
5445
5270
  if (!(e.errors.length > 0)) {
5446
- _context46.next = 6;
5271
+ _context42.next = 6;
5447
5272
  break;
5448
5273
  }
5449
5274
  throw e.errors[0];
5450
5275
  case 6:
5451
5276
  if (!(e.tasks.items[0].results.errors.length > 0)) {
5452
- _context46.next = 8;
5277
+ _context42.next = 8;
5453
5278
  break;
5454
5279
  }
5455
5280
  throw e.tasks.items[0].results.errors[0];
@@ -5466,16 +5291,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5466
5291
  } finally {
5467
5292
  _iterator.f();
5468
5293
  }
5469
- return _context46.abrupt("return", {
5294
+ return _context42.abrupt("return", {
5470
5295
  text: t || ""
5471
5296
  });
5472
5297
  case 12:
5473
5298
  case "end":
5474
- return _context46.stop();
5299
+ return _context42.stop();
5475
5300
  }
5476
- }, _callee46);
5301
+ }, _callee42);
5477
5302
  }));
5478
- function extractPollResultData(_x81) {
5303
+ function extractPollResultData(_x72) {
5479
5304
  return _extractPollResultData4.apply(this, arguments);
5480
5305
  }
5481
5306
  return extractPollResultData;
@@ -5574,13 +5399,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5574
5399
  }, {
5575
5400
  key: "callServiceAPI",
5576
5401
  value: function () {
5577
- var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
5402
+ var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5578
5403
  var n;
5579
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5580
- while (1) switch (_context47.prev = _context47.next) {
5404
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5405
+ while (1) switch (_context43.prev = _context43.next) {
5581
5406
  case 0:
5582
5407
  if (this.requestSettings) {
5583
- _context47.next = 2;
5408
+ _context43.next = 2;
5584
5409
  break;
5585
5410
  }
5586
5411
  throw new Error("Request settings have not been set up");
@@ -5589,11 +5414,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5589
5414
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
5590
5415
  case 4:
5591
5416
  case "end":
5592
- return _context47.stop();
5417
+ return _context43.stop();
5593
5418
  }
5594
- }, _callee47, this);
5419
+ }, _callee43, this);
5595
5420
  }));
5596
- function callServiceAPI(_x82, _x83) {
5421
+ function callServiceAPI(_x73, _x74) {
5597
5422
  return _callServiceAPI11.apply(this, arguments);
5598
5423
  }
5599
5424
  return callServiceAPI;
@@ -5601,27 +5426,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5601
5426
  }, {
5602
5427
  key: "extractResultData",
5603
5428
  value: function () {
5604
- var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e) {
5429
+ var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5605
5430
  var t;
5606
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5607
- while (1) switch (_context48.prev = _context48.next) {
5431
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5432
+ while (1) switch (_context44.prev = _context44.next) {
5608
5433
  case 0:
5609
5434
  if (!e.error) {
5610
- _context48.next = 2;
5435
+ _context44.next = 2;
5611
5436
  break;
5612
5437
  }
5613
5438
  throw e.error.message;
5614
5439
  case 2:
5615
- return _context48.abrupt("return", {
5440
+ return _context44.abrupt("return", {
5616
5441
  text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
5617
5442
  });
5618
5443
  case 3:
5619
5444
  case "end":
5620
- return _context48.stop();
5445
+ return _context44.stop();
5621
5446
  }
5622
- }, _callee48);
5447
+ }, _callee44);
5623
5448
  }));
5624
- function extractResultData(_x84) {
5449
+ function extractResultData(_x75) {
5625
5450
  return _extractResultData15.apply(this, arguments);
5626
5451
  }
5627
5452
  return extractResultData;
@@ -5636,17 +5461,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5636
5461
  _createClass(AssemblyAIUtils, null, [{
5637
5462
  key: "poll",
5638
5463
  value: function () {
5639
- var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t) {
5464
+ var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
5640
5465
  var n, l, c, d;
5641
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5642
- while (1) switch (_context49.prev = _context49.next) {
5466
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5467
+ while (1) switch (_context45.prev = _context45.next) {
5643
5468
  case 0:
5644
5469
  n = {
5645
5470
  authorization: e,
5646
5471
  "content-type": "application/json"
5647
5472
  };
5648
- _context49.t0 = "https://api.assemblyai.com/v2/transcript/";
5649
- _context49.next = 4;
5473
+ _context45.t0 = "https://api.assemblyai.com/v2/transcript/";
5474
+ _context45.next = 4;
5650
5475
  return fetch("https://api.assemblyai.com/v2/transcript", {
5651
5476
  method: "POST",
5652
5477
  body: JSON.stringify({
@@ -5655,55 +5480,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5655
5480
  headers: n
5656
5481
  });
5657
5482
  case 4:
5658
- _context49.next = 6;
5659
- return _context49.sent.json();
5483
+ _context45.next = 6;
5484
+ return _context45.sent.json();
5660
5485
  case 6:
5661
- _context49.t1 = _context49.sent.id;
5662
- l = _context49.t0.concat.call(_context49.t0, _context49.t1);
5486
+ _context45.t1 = _context45.sent.id;
5487
+ l = _context45.t0.concat.call(_context45.t0, _context45.t1);
5663
5488
  case 8:
5664
5489
  if (c) {
5665
- _context49.next = 24;
5490
+ _context45.next = 24;
5666
5491
  break;
5667
5492
  }
5668
- _context49.next = 11;
5493
+ _context45.next = 11;
5669
5494
  return fetch(l, {
5670
5495
  headers: n
5671
5496
  });
5672
5497
  case 11:
5673
- _context49.next = 13;
5674
- return _context49.sent.json();
5498
+ _context45.next = 13;
5499
+ return _context45.sent.json();
5675
5500
  case 13:
5676
- d = _context49.sent;
5501
+ d = _context45.sent;
5677
5502
  if (!(d.status === "completed")) {
5678
- _context49.next = 18;
5503
+ _context45.next = 18;
5679
5504
  break;
5680
5505
  }
5681
5506
  c = d;
5682
- _context49.next = 22;
5507
+ _context45.next = 22;
5683
5508
  break;
5684
5509
  case 18:
5685
5510
  if (!(d.status === "error")) {
5686
- _context49.next = 20;
5511
+ _context45.next = 20;
5687
5512
  break;
5688
5513
  }
5689
5514
  throw new Error("Transcription failed: ".concat(d.error));
5690
5515
  case 20:
5691
- _context49.next = 22;
5516
+ _context45.next = 22;
5692
5517
  return new Promise(function (h) {
5693
5518
  return setTimeout(h, 3e3);
5694
5519
  });
5695
5520
  case 22:
5696
- _context49.next = 8;
5521
+ _context45.next = 8;
5697
5522
  break;
5698
5523
  case 24:
5699
- return _context49.abrupt("return", c);
5524
+ return _context45.abrupt("return", c);
5700
5525
  case 25:
5701
5526
  case "end":
5702
- return _context49.stop();
5527
+ return _context45.stop();
5703
5528
  }
5704
- }, _callee49);
5529
+ }, _callee45);
5705
5530
  }));
5706
- function poll(_x85, _x86) {
5531
+ function poll(_x76, _x77) {
5707
5532
  return _poll2.apply(this, arguments);
5708
5533
  }
5709
5534
  return poll;
@@ -5751,19 +5576,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5751
5576
  _createClass(AssemblyAIAudioIO, [{
5752
5577
  key: "callServiceAPI",
5753
5578
  value: function () {
5754
- var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5579
+ var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
5755
5580
  var s;
5756
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5757
- while (1) switch (_context50.prev = _context50.next) {
5581
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5582
+ while (1) switch (_context46.prev = _context46.next) {
5758
5583
  case 0:
5759
5584
  if ((s = this.requestSettings) != null && s.headers) {
5760
- _context50.next = 2;
5585
+ _context46.next = 2;
5761
5586
  break;
5762
5587
  }
5763
5588
  throw new Error("Request settings have not been set up");
5764
5589
  case 2:
5765
5590
  if (n != null && n[0]) {
5766
- _context50.next = 4;
5591
+ _context46.next = 4;
5767
5592
  break;
5768
5593
  }
5769
5594
  throw new Error("No file was added");
@@ -5771,11 +5596,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5771
5596
  HTTPRequest.request(this, n[0], e, !1);
5772
5597
  case 5:
5773
5598
  case "end":
5774
- return _context50.stop();
5599
+ return _context46.stop();
5775
5600
  }
5776
- }, _callee50, this);
5601
+ }, _callee46, this);
5777
5602
  }));
5778
- function callServiceAPI(_x87, _x88, _x89) {
5603
+ function callServiceAPI(_x78, _x79, _x80) {
5779
5604
  return _callServiceAPI12.apply(this, arguments);
5780
5605
  }
5781
5606
  return callServiceAPI;
@@ -5783,32 +5608,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5783
5608
  }, {
5784
5609
  key: "extractResultData",
5785
5610
  value: function () {
5786
- var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5611
+ var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5787
5612
  var s, o, t;
5788
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5789
- while (1) switch (_context51.prev = _context51.next) {
5613
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5614
+ while (1) switch (_context47.prev = _context47.next) {
5790
5615
  case 0:
5791
5616
  if (!e.error) {
5792
- _context51.next = 2;
5617
+ _context47.next = 2;
5793
5618
  break;
5794
5619
  }
5795
5620
  throw e.error;
5796
5621
  case 2:
5797
5622
  t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
5798
- _context51.next = 5;
5623
+ _context47.next = 5;
5799
5624
  return AssemblyAIUtils.poll(t, e.upload_url);
5800
5625
  case 5:
5801
- _context51.t0 = _context51.sent.text;
5802
- return _context51.abrupt("return", {
5803
- text: _context51.t0
5626
+ _context47.t0 = _context47.sent.text;
5627
+ return _context47.abrupt("return", {
5628
+ text: _context47.t0
5804
5629
  });
5805
5630
  case 7:
5806
5631
  case "end":
5807
- return _context51.stop();
5632
+ return _context47.stop();
5808
5633
  }
5809
- }, _callee51, this);
5634
+ }, _callee47, this);
5810
5635
  }));
5811
- function extractResultData(_x90) {
5636
+ function extractResultData(_x81) {
5812
5637
  return _extractResultData16.apply(this, arguments);
5813
5638
  }
5814
5639
  return extractResultData;
@@ -5858,13 +5683,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5858
5683
  }, {
5859
5684
  key: "callServiceAPI",
5860
5685
  value: function () {
5861
- var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
5686
+ var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5862
5687
  var n;
5863
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5864
- while (1) switch (_context52.prev = _context52.next) {
5688
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5689
+ while (1) switch (_context48.prev = _context48.next) {
5865
5690
  case 0:
5866
5691
  if (this.requestSettings) {
5867
- _context52.next = 2;
5692
+ _context48.next = 2;
5868
5693
  break;
5869
5694
  }
5870
5695
  throw new Error("Request settings have not been set up");
@@ -5873,11 +5698,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5873
5698
  HTTPRequest.request(this, n, e, !1);
5874
5699
  case 4:
5875
5700
  case "end":
5876
- return _context52.stop();
5701
+ return _context48.stop();
5877
5702
  }
5878
- }, _callee52, this);
5703
+ }, _callee48, this);
5879
5704
  }));
5880
- function callServiceAPI(_x91, _x92) {
5705
+ function callServiceAPI(_x82, _x83) {
5881
5706
  return _callServiceAPI13.apply(this, arguments);
5882
5707
  }
5883
5708
  return callServiceAPI;
@@ -5885,11 +5710,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5885
5710
  }, {
5886
5711
  key: "extractResultData",
5887
5712
  value: function () {
5888
- var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
5889
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5890
- while (1) switch (_context53.prev = _context53.next) {
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) {
5891
5716
  case 0:
5892
- return _context53.abrupt("return", new Promise(function (t) {
5717
+ return _context49.abrupt("return", new Promise(function (t) {
5893
5718
  var n = new FileReader();
5894
5719
  n.readAsDataURL(e), n.onload = function (s) {
5895
5720
  t({
@@ -5902,11 +5727,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5902
5727
  }));
5903
5728
  case 1:
5904
5729
  case "end":
5905
- return _context53.stop();
5730
+ return _context49.stop();
5906
5731
  }
5907
- }, _callee53);
5732
+ }, _callee49);
5908
5733
  }));
5909
- function extractResultData(_x93) {
5734
+ function extractResultData(_x84) {
5910
5735
  return _extractResultData17.apply(this, arguments);
5911
5736
  }
5912
5737
  return extractResultData;
@@ -5942,19 +5767,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5942
5767
  _createClass(U, [{
5943
5768
  key: "callServiceAPI",
5944
5769
  value: function () {
5945
- var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5770
+ var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5946
5771
  var s, o;
5947
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5948
- while (1) switch (_context54.prev = _context54.next) {
5772
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5773
+ while (1) switch (_context50.prev = _context50.next) {
5949
5774
  case 0:
5950
5775
  if ((s = this.requestSettings) != null && s.headers) {
5951
- _context54.next = 2;
5776
+ _context50.next = 2;
5952
5777
  break;
5953
5778
  }
5954
5779
  throw new Error("Request settings have not been set up");
5955
5780
  case 2:
5956
5781
  if (n != null && n[0]) {
5957
- _context54.next = 4;
5782
+ _context50.next = 4;
5958
5783
  break;
5959
5784
  }
5960
5785
  throw new Error("No file was added");
@@ -5962,11 +5787,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5962
5787
  (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);
5963
5788
  case 5:
5964
5789
  case "end":
5965
- return _context54.stop();
5790
+ return _context50.stop();
5966
5791
  }
5967
- }, _callee54, this);
5792
+ }, _callee50, this);
5968
5793
  }));
5969
- function callServiceAPI(_x94, _x95, _x96) {
5794
+ function callServiceAPI(_x85, _x86, _x87) {
5970
5795
  return _callServiceAPI14.apply(this, arguments);
5971
5796
  }
5972
5797
  return callServiceAPI;
@@ -5974,26 +5799,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5974
5799
  }, {
5975
5800
  key: "extractResultData",
5976
5801
  value: function () {
5977
- var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
5978
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5979
- while (1) switch (_context55.prev = _context55.next) {
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) {
5980
5805
  case 0:
5981
5806
  if (!e.error) {
5982
- _context55.next = 2;
5807
+ _context51.next = 2;
5983
5808
  break;
5984
5809
  }
5985
5810
  throw e.error;
5986
5811
  case 2:
5987
- return _context55.abrupt("return", {
5812
+ return _context51.abrupt("return", {
5988
5813
  text: e.DisplayText || ""
5989
5814
  });
5990
5815
  case 3:
5991
5816
  case "end":
5992
- return _context55.stop();
5817
+ return _context51.stop();
5993
5818
  }
5994
- }, _callee55);
5819
+ }, _callee51);
5995
5820
  }));
5996
- function extractResultData(_x97) {
5821
+ function extractResultData(_x88) {
5997
5822
  return _extractResultData18.apply(this, arguments);
5998
5823
  }
5999
5824
  return extractResultData;
@@ -6036,13 +5861,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
6036
5861
  }, {
6037
5862
  key: "callServiceAPI",
6038
5863
  value: function () {
6039
- var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t) {
5864
+ var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
6040
5865
  var n;
6041
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6042
- while (1) switch (_context56.prev = _context56.next) {
5866
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5867
+ while (1) switch (_context52.prev = _context52.next) {
6043
5868
  case 0:
6044
5869
  if (this.requestSettings) {
6045
- _context56.next = 2;
5870
+ _context52.next = 2;
6046
5871
  break;
6047
5872
  }
6048
5873
  throw new Error("Request settings have not been set up");
@@ -6051,11 +5876,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
6051
5876
  HTTPRequest.request(this, n, e);
6052
5877
  case 4:
6053
5878
  case "end":
6054
- return _context56.stop();
5879
+ return _context52.stop();
6055
5880
  }
6056
- }, _callee56, this);
5881
+ }, _callee52, this);
6057
5882
  }));
6058
- function callServiceAPI(_x98, _x99) {
5883
+ function callServiceAPI(_x89, _x90) {
6059
5884
  return _callServiceAPI15.apply(this, arguments);
6060
5885
  }
6061
5886
  return callServiceAPI;
@@ -6063,27 +5888,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
6063
5888
  }, {
6064
5889
  key: "extractResultData",
6065
5890
  value: function () {
6066
- var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
5891
+ var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
6067
5892
  var t;
6068
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6069
- while (1) switch (_context57.prev = _context57.next) {
5893
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5894
+ while (1) switch (_context53.prev = _context53.next) {
6070
5895
  case 0:
6071
5896
  if (!Array.isArray(e)) {
6072
- _context57.next = 2;
5897
+ _context53.next = 2;
6073
5898
  break;
6074
5899
  }
6075
- return _context57.abrupt("return", {
5900
+ return _context53.abrupt("return", {
6076
5901
  text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
6077
5902
  });
6078
5903
  case 2:
6079
5904
  throw e.error;
6080
5905
  case 3:
6081
5906
  case "end":
6082
- return _context57.stop();
5907
+ return _context53.stop();
6083
5908
  }
6084
- }, _callee57);
5909
+ }, _callee53);
6085
5910
  }));
6086
- function extractResultData(_x100) {
5911
+ function extractResultData(_x91) {
6087
5912
  return _extractResultData19.apply(this, arguments);
6088
5913
  }
6089
5914
  return extractResultData;
@@ -6092,11 +5917,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
6092
5917
  return AzureTranslationIO;
6093
5918
  }(DirectServiceIO);
6094
5919
  var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6095
- _inherits(M, _DirectServiceIO9);
6096
- var _super30 = _createSuper(M);
6097
- function M(e) {
5920
+ _inherits(A, _DirectServiceIO9);
5921
+ var _super30 = _createSuper(A);
5922
+ function A(e) {
6098
5923
  var _this23;
6099
- _classCallCheck(this, M);
5924
+ _classCallCheck(this, A);
6100
5925
  var l;
6101
5926
  var t = e.directConnection,
6102
5927
  n = e.textInput,
@@ -6120,16 +5945,16 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6120
5945
  }
6121
5946
  };
6122
5947
  }
6123
- _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = M.canFileSendMessage;
5948
+ _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
6124
5949
  return _this23;
6125
5950
  }
6126
- _createClass(M, [{
5951
+ _createClass(A, [{
6127
5952
  key: "preprocessBody",
6128
5953
  value: function preprocessBody(e, t) {
6129
5954
  var n = JSON.parse(JSON.stringify(e));
6130
5955
  if (t && t !== "") {
6131
- var _s5 = t.substring(0, this._maxCharLength);
6132
- n.prompt = _s5;
5956
+ var s = t.substring(0, this._maxCharLength);
5957
+ n.prompt = s;
6133
5958
  }
6134
5959
  return n;
6135
5960
  }
@@ -6141,50 +5966,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6141
5966
  var s;
6142
5967
  var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
6143
5968
  if (n[1] || o && o !== "") {
6144
- this.url = M.IMAGE_EDIT_URL;
5969
+ this.url = A.IMAGE_EDIT_URL;
6145
5970
  var c = this.preprocessBody(this.rawBody, o);
6146
- s = M.createFormDataBody(c, n[0], n[1]);
6147
- } else this.url = M.IMAGE_VARIATIONS_URL, s = M.createFormDataBody(this.rawBody, n[0]);
5971
+ s = A.createFormDataBody(c, n[0], n[1]);
5972
+ } else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
6148
5973
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
6149
5974
  }
6150
5975
  }, {
6151
5976
  key: "callServiceAPI",
6152
5977
  value: function () {
6153
- var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
6154
- var s, _o2;
6155
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6156
- while (1) switch (_context58.prev = _context58.next) {
5978
+ var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5979
+ var s, o;
5980
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5981
+ while (1) switch (_context54.prev = _context54.next) {
6157
5982
  case 0:
6158
5983
  if ((s = this.requestSettings) != null && s.headers) {
6159
- _context58.next = 2;
5984
+ _context54.next = 2;
6160
5985
  break;
6161
5986
  }
6162
5987
  throw new Error("Request settings have not been set up");
6163
5988
  case 2:
6164
5989
  if (!(n != null && n[0])) {
6165
- _context58.next = 6;
5990
+ _context54.next = 6;
6166
5991
  break;
6167
5992
  }
6168
5993
  this.callApiWithImage(e, t, n);
6169
- _context58.next = 11;
5994
+ _context54.next = 11;
6170
5995
  break;
6171
5996
  case 6:
6172
5997
  if (this.requestSettings) {
6173
- _context58.next = 8;
5998
+ _context54.next = 8;
6174
5999
  break;
6175
6000
  }
6176
6001
  throw new Error("Request settings have not been set up");
6177
6002
  case 8:
6178
- this.url = M.IMAGE_GENERATION_URL;
6179
- _o2 = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6180
- HTTPRequest.request(this, _o2, e);
6003
+ this.url = A.IMAGE_GENERATION_URL;
6004
+ o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6005
+ HTTPRequest.request(this, o, e);
6181
6006
  case 11:
6182
6007
  case "end":
6183
- return _context58.stop();
6008
+ return _context54.stop();
6184
6009
  }
6185
- }, _callee58, this);
6010
+ }, _callee54, this);
6186
6011
  }));
6187
- function callServiceAPI(_x101, _x102, _x103) {
6012
+ function callServiceAPI(_x92, _x93, _x94) {
6188
6013
  return _callServiceAPI16.apply(this, arguments);
6189
6014
  }
6190
6015
  return callServiceAPI;
@@ -6192,17 +6017,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6192
6017
  }, {
6193
6018
  key: "extractResultData",
6194
6019
  value: function () {
6195
- var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6196
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6197
- while (1) switch (_context59.prev = _context59.next) {
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) {
6198
6023
  case 0:
6199
6024
  if (!e.error) {
6200
- _context59.next = 2;
6025
+ _context55.next = 2;
6201
6026
  break;
6202
6027
  }
6203
6028
  throw e.error.message;
6204
6029
  case 2:
6205
- return _context59.abrupt("return", {
6030
+ return _context55.abrupt("return", {
6206
6031
  files: e.data.map(function (n) {
6207
6032
  return n.url ? {
6208
6033
  src: n.url,
@@ -6215,11 +6040,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6215
6040
  });
6216
6041
  case 3:
6217
6042
  case "end":
6218
- return _context59.stop();
6043
+ return _context55.stop();
6219
6044
  }
6220
- }, _callee59);
6045
+ }, _callee55);
6221
6046
  }));
6222
- function extractResultData(_x104) {
6047
+ function extractResultData(_x95) {
6223
6048
  return _extractResultData20.apply(this, arguments);
6224
6049
  }
6225
6050
  return extractResultData;
@@ -6246,34 +6071,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6246
6071
  }), s;
6247
6072
  }
6248
6073
  }]);
6249
- return M;
6074
+ return A;
6250
6075
  }(DirectServiceIO);
6251
6076
  _OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
6252
6077
  _OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
6253
6078
  _OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
6254
6079
  var OpenAIImagesIO = _OpenAIImagesIO;
6255
6080
  var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6256
- _inherits(k, _DirectServiceIO10);
6257
- var _super31 = _createSuper(k);
6258
- function k(e) {
6081
+ _inherits(M, _DirectServiceIO10);
6082
+ var _super31 = _createSuper(M);
6083
+ function M(e) {
6259
6084
  var _l$model2;
6260
6085
  var _this24;
6261
- _classCallCheck(this, k);
6086
+ _classCallCheck(this, M);
6262
6087
  var a, l;
6263
6088
  var t = e.directConnection,
6264
6089
  n = e.textInput,
6265
6090
  s = t == null ? void 0 : t.openAI;
6266
6091
  _this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
6267
6092
  audio: {}
6268
- }), _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);
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);
6269
6094
  var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
6270
- _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;
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;
6271
6096
  return _this24;
6272
6097
  }
6273
- _createClass(k, [{
6098
+ _createClass(M, [{
6274
6099
  key: "processConfig",
6275
6100
  value: function processConfig(e) {
6276
- e != null && e.type && e.type === "translation" && (this._service_url = k.AUDIO_TRANSLATIONS_URL, delete e.language);
6101
+ e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
6277
6102
  }
6278
6103
  }, {
6279
6104
  key: "preprocessBody",
@@ -6291,33 +6116,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6291
6116
  }, {
6292
6117
  key: "callServiceAPI",
6293
6118
  value: function () {
6294
- var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, n) {
6119
+ var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
6295
6120
  var a, s, o;
6296
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6297
- while (1) switch (_context60.prev = _context60.next) {
6121
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6122
+ while (1) switch (_context56.prev = _context56.next) {
6298
6123
  case 0:
6299
6124
  if ((a = this.requestSettings) != null && a.headers) {
6300
- _context60.next = 2;
6125
+ _context56.next = 2;
6301
6126
  break;
6302
6127
  }
6303
6128
  throw new Error("Request settings have not been set up");
6304
6129
  case 2:
6305
6130
  if (n != null && n[0]) {
6306
- _context60.next = 4;
6131
+ _context56.next = 4;
6307
6132
  break;
6308
6133
  }
6309
6134
  throw new Error("No file was added");
6310
6135
  case 4:
6311
6136
  this.url = this.requestSettings.url || this._service_url;
6312
- s = this.preprocessBody(this.rawBody, t, n), o = k.createFormDataBody(s, n[0]);
6137
+ s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
6313
6138
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
6314
6139
  case 7:
6315
6140
  case "end":
6316
- return _context60.stop();
6141
+ return _context56.stop();
6317
6142
  }
6318
- }, _callee60, this);
6143
+ }, _callee56, this);
6319
6144
  }));
6320
- function callServiceAPI(_x105, _x106, _x107) {
6145
+ function callServiceAPI(_x96, _x97, _x98) {
6321
6146
  return _callServiceAPI17.apply(this, arguments);
6322
6147
  }
6323
6148
  return callServiceAPI;
@@ -6325,26 +6150,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6325
6150
  }, {
6326
6151
  key: "extractResultData",
6327
6152
  value: function () {
6328
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6329
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6330
- while (1) switch (_context61.prev = _context61.next) {
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) {
6331
6156
  case 0:
6332
6157
  if (!e.error) {
6333
- _context61.next = 2;
6158
+ _context57.next = 2;
6334
6159
  break;
6335
6160
  }
6336
6161
  throw e.error.message;
6337
6162
  case 2:
6338
- return _context61.abrupt("return", {
6163
+ return _context57.abrupt("return", {
6339
6164
  text: e.text
6340
6165
  });
6341
6166
  case 3:
6342
6167
  case "end":
6343
- return _context61.stop();
6168
+ return _context57.stop();
6344
6169
  }
6345
- }, _callee61);
6170
+ }, _callee57);
6346
6171
  }));
6347
- function extractResultData(_x108) {
6172
+ function extractResultData(_x99) {
6348
6173
  return _extractResultData21.apply(this, arguments);
6349
6174
  }
6350
6175
  return extractResultData;
@@ -6368,7 +6193,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6368
6193
  }), n;
6369
6194
  }
6370
6195
  }]);
6371
- return k;
6196
+ return M;
6372
6197
  }(DirectServiceIO);
6373
6198
  _OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
6374
6199
  _OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
@@ -6410,13 +6235,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6410
6235
  }, {
6411
6236
  key: "callServiceAPI",
6412
6237
  value: function () {
6413
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
6238
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
6414
6239
  var n;
6415
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6416
- while (1) switch (_context62.prev = _context62.next) {
6240
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6241
+ while (1) switch (_context58.prev = _context58.next) {
6417
6242
  case 0:
6418
6243
  if (this.requestSettings) {
6419
- _context62.next = 2;
6244
+ _context58.next = 2;
6420
6245
  break;
6421
6246
  }
6422
6247
  throw new Error("Request settings have not been set up");
@@ -6425,11 +6250,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6425
6250
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
6426
6251
  case 4:
6427
6252
  case "end":
6428
- return _context62.stop();
6253
+ return _context58.stop();
6429
6254
  }
6430
- }, _callee62, this);
6255
+ }, _callee58, this);
6431
6256
  }));
6432
- function callServiceAPI(_x109, _x110) {
6257
+ function callServiceAPI(_x100, _x101) {
6433
6258
  return _callServiceAPI18.apply(this, arguments);
6434
6259
  }
6435
6260
  return callServiceAPI;
@@ -6437,17 +6262,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6437
6262
  }, {
6438
6263
  key: "extractResultData",
6439
6264
  value: function () {
6440
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
6441
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6442
- while (1) switch (_context63.prev = _context63.next) {
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) {
6443
6268
  case 0:
6444
6269
  if (!e.error) {
6445
- _context63.next = 2;
6270
+ _context59.next = 2;
6446
6271
  break;
6447
6272
  }
6448
6273
  throw e.error.message;
6449
6274
  case 2:
6450
- return _context63.abrupt("return", e.choices[0].delta ? {
6275
+ return _context59.abrupt("return", e.choices[0].delta ? {
6451
6276
  text: e.choices[0].delta.content || ""
6452
6277
  } : e.choices[0].message ? {
6453
6278
  text: e.choices[0].message.content
@@ -6456,11 +6281,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6456
6281
  });
6457
6282
  case 3:
6458
6283
  case "end":
6459
- return _context63.stop();
6284
+ return _context59.stop();
6460
6285
  }
6461
- }, _callee63);
6286
+ }, _callee59);
6462
6287
  }));
6463
- function extractResultData(_x111) {
6288
+ function extractResultData(_x102) {
6464
6289
  return _extractResultData22.apply(this, arguments);
6465
6290
  }
6466
6291
  return extractResultData;
@@ -6508,13 +6333,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6508
6333
  }, {
6509
6334
  key: "callServiceAPI",
6510
6335
  value: function () {
6511
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t) {
6336
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
6512
6337
  var n;
6513
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6514
- while (1) switch (_context64.prev = _context64.next) {
6338
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6339
+ while (1) switch (_context60.prev = _context60.next) {
6515
6340
  case 0:
6516
6341
  if (this.requestSettings) {
6517
- _context64.next = 2;
6342
+ _context60.next = 2;
6518
6343
  break;
6519
6344
  }
6520
6345
  throw new Error("Request settings have not been set up");
@@ -6523,11 +6348,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6523
6348
  HTTPRequest.request(this, n, e);
6524
6349
  case 4:
6525
6350
  case "end":
6526
- return _context64.stop();
6351
+ return _context60.stop();
6527
6352
  }
6528
- }, _callee64, this);
6353
+ }, _callee60, this);
6529
6354
  }));
6530
- function callServiceAPI(_x112, _x113) {
6355
+ function callServiceAPI(_x103, _x104) {
6531
6356
  return _callServiceAPI19.apply(this, arguments);
6532
6357
  }
6533
6358
  return callServiceAPI;
@@ -6535,26 +6360,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6535
6360
  }, {
6536
6361
  key: "extractResultData",
6537
6362
  value: function () {
6538
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
6539
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6540
- while (1) switch (_context65.prev = _context65.next) {
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) {
6541
6366
  case 0:
6542
6367
  if (!e.message) {
6543
- _context65.next = 2;
6368
+ _context61.next = 2;
6544
6369
  break;
6545
6370
  }
6546
6371
  throw e.message;
6547
6372
  case 2:
6548
- return _context65.abrupt("return", {
6373
+ return _context61.abrupt("return", {
6549
6374
  text: e.text
6550
6375
  });
6551
6376
  case 3:
6552
6377
  case "end":
6553
- return _context65.stop();
6378
+ return _context61.stop();
6554
6379
  }
6555
- }, _callee65);
6380
+ }, _callee61);
6556
6381
  }));
6557
- function extractResultData(_x114) {
6382
+ function extractResultData(_x105) {
6558
6383
  return _extractResultData23.apply(this, arguments);
6559
6384
  }
6560
6385
  return extractResultData;
@@ -6721,11 +6546,11 @@ var _TextToSpeech = /*#__PURE__*/function () {
6721
6546
  var n = {};
6722
6547
  setTimeout(function () {
6723
6548
  if (_typeof(e) == "object" && (e.lang && (n.lang = e.lang), e.pitch && (n.pitch = e.pitch), e.rate && (n.rate = e.rate), e.volume && (n.volume = e.volume), e.voiceName)) {
6724
- var _s6 = window.speechSynthesis.getVoices().find(function (o) {
6549
+ var s = window.speechSynthesis.getVoices().find(function (o) {
6725
6550
  var a;
6726
6551
  return o.name.toLocaleLowerCase() === ((a = e.voiceName) == null ? void 0 : a.toLocaleLowerCase());
6727
6552
  });
6728
- _s6 && (n.voice = _s6);
6553
+ s && (n.voice = s);
6729
6554
  }
6730
6555
  t(n);
6731
6556
  }, $.LOAD_VOICES_MS);
@@ -6767,9 +6592,9 @@ var MessageStyleUtils = /*#__PURE__*/function () {
6767
6592
  key: "applyCustomStylesToElements",
6768
6593
  value: function applyCustomStylesToElements(e, t, n) {
6769
6594
  if (n && (Object.assign(e.outerContainer.style, n.outerContainer), Object.assign(e.innerContainer.style, n.innerContainer), Object.assign(e.bubbleElement.style, n.bubble), t)) {
6770
- var _s7 = e.bubbleElement.children[0],
6771
- _o3 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
6772
- Object.assign(_o3.style, n.media);
6595
+ var s = e.bubbleElement.children[0],
6596
+ o = s.tagName.toLocaleLowerCase() !== "a" ? s : s.children[0];
6597
+ Object.assign(o.style, n.media);
6773
6598
  }
6774
6599
  }
6775
6600
  }, {
@@ -6912,24 +6737,24 @@ var FileMessages = /*#__PURE__*/function () {
6912
6737
  }, {
6913
6738
  key: "addNewImageMessage",
6914
6739
  value: function () {
6915
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, n) {
6740
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
6916
6741
  var s,
6917
6742
  o,
6918
6743
  a,
6919
- _args66 = arguments;
6920
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6921
- while (1) switch (_context66.prev = _context66.next) {
6744
+ _args62 = arguments;
6745
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6746
+ while (1) switch (_context62.prev = _context62.next) {
6922
6747
  case 0:
6923
- s = _args66.length > 3 && _args66[3] !== undefined ? _args66[3] : !1;
6748
+ s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
6924
6749
  o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
6925
6750
  a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
6926
6751
  case 3:
6927
6752
  case "end":
6928
- return _context66.stop();
6753
+ return _context62.stop();
6929
6754
  }
6930
- }, _callee66);
6755
+ }, _callee62);
6931
6756
  }));
6932
- function addNewImageMessage(_x115, _x116, _x117) {
6757
+ function addNewImageMessage(_x106, _x107, _x108) {
6933
6758
  return _addNewImageMessage.apply(this, arguments);
6934
6759
  }
6935
6760
  return addNewImageMessage;
@@ -7265,27 +7090,27 @@ var Messages = /*#__PURE__*/function () {
7265
7090
  }, {
7266
7091
  key: "addMultipleFiles",
7267
7092
  value: function () {
7268
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
7093
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
7269
7094
  var _this31 = this;
7270
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
7271
- while (1) switch (_context67.prev = _context67.next) {
7095
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
7096
+ while (1) switch (_context63.prev = _context63.next) {
7272
7097
  case 0:
7273
- return _context67.abrupt("return", Promise.all((e || []).map(function (t) {
7098
+ return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
7274
7099
  return new Promise(function (n) {
7275
7100
  if (!t.type || t.type === "any") {
7276
- var _s8 = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7101
+ var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7277
7102
  _this31.addNewMessage({
7278
7103
  files: [{
7279
- name: _s8,
7104
+ name: s,
7280
7105
  type: "any"
7281
7106
  }]
7282
7107
  }, !1, !0), n(!0);
7283
7108
  } else {
7284
- var _s9 = new FileReader();
7285
- _s9.readAsDataURL(t.file), _s9.onload = function () {
7109
+ var _s = new FileReader();
7110
+ _s.readAsDataURL(t.file), _s.onload = function () {
7286
7111
  _this31.addNewMessage({
7287
7112
  files: [{
7288
- src: _s9.result,
7113
+ src: _s.result,
7289
7114
  type: t.type
7290
7115
  }]
7291
7116
  }, !1, !0), n(!0);
@@ -7295,15 +7120,15 @@ var Messages = /*#__PURE__*/function () {
7295
7120
  })));
7296
7121
  case 1:
7297
7122
  case "end":
7298
- return _context67.stop();
7123
+ return _context63.stop();
7299
7124
  }
7300
- }, _callee67);
7125
+ }, _callee63);
7301
7126
  }));
7302
- function addMultipleFiles(_x118) {
7127
+ function addMultipleFiles(_x109) {
7303
7128
  return _addMultipleFiles.apply(this, arguments);
7304
7129
  }
7305
7130
  return addMultipleFiles;
7306
- }() // WORK - need to clear the messages array
7131
+ }()
7307
7132
  }, {
7308
7133
  key: "clearMessages",
7309
7134
  value: function clearMessages(e) {
@@ -7312,7 +7137,7 @@ var Messages = /*#__PURE__*/function () {
7312
7137
  this._messageElementRefs.forEach(function (o) {
7313
7138
  var a = o.bubbleElement.classList;
7314
7139
  a.contains("loading-message-text") || a.contains("streamed-message") ? t.push(o) : o.outerContainer.remove();
7315
- }), this._messageElementRefs = t, e !== !1 && ((n = this._introPanel) != null && n._elementRef && this._introPanel.display(), this.addIntroductoryMessage()), (s = this._onClearMessages) == null || s.call(this);
7140
+ }), this._messageElementRefs = t, e !== !1 && ((n = this._introPanel) != null && n._elementRef && this._introPanel.display(), this.addIntroductoryMessage()), this.messages.splice(0, this.messages.length), (s = this._onClearMessages) == null || s.call(this);
7316
7141
  }
7317
7142
  // this is mostly used for enabling highlight.js to highlight code if it is downloads later
7318
7143
  }, {
@@ -7373,10 +7198,10 @@ var Messages = /*#__PURE__*/function () {
7373
7198
  return Messages;
7374
7199
  }();
7375
7200
  var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7376
- function T() {
7377
- _classCallCheck(this, T);
7201
+ function E() {
7202
+ _classCallCheck(this, E);
7378
7203
  }
7379
- _createClass(T, null, [{
7204
+ _createClass(E, null, [{
7380
7205
  key: "adjustInputPadding",
7381
7206
  value: function adjustInputPadding(e, t) {
7382
7207
  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");
@@ -7384,7 +7209,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7384
7209
  }, {
7385
7210
  key: "adjustForOutsideButton",
7386
7211
  value: function adjustForOutsideButton(e, t, n) {
7387
- n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(T.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(T.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
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));
7388
7213
  }
7389
7214
  // when submit is the only button
7390
7215
  // when submit button is outside by itself - we increase the height for a better look
@@ -7392,10 +7217,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7392
7217
  key: "adjustOutsideSubmit",
7393
7218
  value: function adjustOutsideSubmit(e, t, n) {
7394
7219
  if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
7395
- if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(T.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
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) {
7396
7221
  return s.button.elementRef.classList.add("submit-button-enlarged");
7397
7222
  });
7398
- if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(T.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
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) {
7399
7224
  return s.button.elementRef.classList.add("submit-button-enlarged");
7400
7225
  });
7401
7226
  }
@@ -7403,10 +7228,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7403
7228
  }, {
7404
7229
  key: "set",
7405
7230
  value: function set(e, t, n, s) {
7406
- !!T.adjustOutsideSubmit(t, n, s) || T.adjustForOutsideButton(t, n, s), T.adjustInputPadding(e, s);
7231
+ !!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
7407
7232
  }
7408
7233
  }]);
7409
- return T;
7234
+ return E;
7410
7235
  }();
7411
7236
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
7412
7237
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
@@ -7570,8 +7395,8 @@ var InputButton = /*#__PURE__*/function () {
7570
7395
  value: function unsetCustomStateStyles(e) {
7571
7396
  if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
7572
7397
  var n = e[t],
7573
- _s10 = n && this._customStyles[n];
7574
- _s10 && ButtonCSS.unsetActionCSS(this.elementRef, _s10);
7398
+ s = n && this._customStyles[n];
7399
+ s && ButtonCSS.unsetActionCSS(this.elementRef, s);
7575
7400
  }
7576
7401
  }
7577
7402
  }, {
@@ -7935,14 +7760,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7935
7760
  key: "addAttachmentBasedOnType",
7936
7761
  value: function addAttachmentBasedOnType(e, t, n) {
7937
7762
  if (e.type.startsWith("image")) {
7938
- var _s11 = FileAttachmentsType.createImageAttachment(t);
7939
- this.addFileAttachment(e, "image", _s11, n);
7763
+ var s = FileAttachmentsType.createImageAttachment(t);
7764
+ this.addFileAttachment(e, "image", s, n);
7940
7765
  } else if (e.type.startsWith("audio")) {
7941
- var _s12 = AudioFileAttachmentType.createAudioAttachment(t);
7942
- this.addFileAttachment(e, "audio", _s12, n);
7766
+ var _s2 = AudioFileAttachmentType.createAudioAttachment(t);
7767
+ this.addFileAttachment(e, "audio", _s2, n);
7943
7768
  } else {
7944
- var _s13 = FileAttachmentsType.createAnyFileAttachment(e.name);
7945
- this.addFileAttachment(e, "any", _s13, n);
7769
+ var _s3 = FileAttachmentsType.createAnyFileAttachment(e.name);
7770
+ this.addFileAttachment(e, "any", _s3, n);
7946
7771
  }
7947
7772
  }
7948
7773
  }, {
@@ -8004,15 +7829,15 @@ var FileAttachmentsType = /*#__PURE__*/function () {
8004
7829
  value: function isFileTypeValid(e, t) {
8005
7830
  if (t === "") return !0;
8006
7831
  var n = t.split(",");
8007
- for (var _s14 = 0; _s14 < n.length; _s14++) {
8008
- var _o4 = n[_s14].trim();
8009
- if (e.type === _o4) return !0;
8010
- if (_o4.startsWith(".")) {
8011
- var _a3 = _o4.slice(1);
8012
- if (e.name.endsWith(_a3)) return !0;
7832
+ for (var s = 0; s < n.length; s++) {
7833
+ var o = n[s].trim();
7834
+ if (e.type === o) return !0;
7835
+ if (o.startsWith(".")) {
7836
+ var a = o.slice(1);
7837
+ if (e.name.endsWith(a)) return !0;
8013
7838
  } else {
8014
- if (e.name.endsWith(_o4)) return !0;
8015
- if (_o4.endsWith("/*") && e.type.startsWith(_o4.slice(0, -2))) return !0;
7839
+ if (e.name.endsWith(o)) return !0;
7840
+ if (o.endsWith("/*") && e.type.startsWith(o.slice(0, -2))) return !0;
8016
7841
  }
8017
7842
  }
8018
7843
  return !1;
@@ -8045,18 +7870,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
8045
7870
  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>",
8046
7871
  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>",
8047
7872
  _AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
8048
- _inherits(I, _FileAttachmentsType);
8049
- var _super35 = _createSuper(I);
8050
- function I(e, t, n) {
8051
- _classCallCheck(this, I);
7873
+ _inherits(k, _FileAttachmentsType);
7874
+ var _super35 = _createSuper(k);
7875
+ function k(e, t, n) {
7876
+ _classCallCheck(this, k);
8052
7877
  return _super35.call(this, e, t, n);
8053
7878
  }
8054
- _createClass(I, [{
7879
+ _createClass(k, [{
8055
7880
  key: "createTimer",
8056
7881
  value: function createTimer(e, t) {
8057
7882
  var _this37 = this;
8058
7883
  var n = 0;
8059
- var s = t !== void 0 && t < I.TIMER_LIMIT_S ? t : I.TIMER_LIMIT_S;
7884
+ var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
8060
7885
  return setInterval(function () {
8061
7886
  var l;
8062
7887
  n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
@@ -8068,7 +7893,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
8068
7893
  }, {
8069
7894
  key: "createPlaceholderAudioAttachment",
8070
7895
  value: function createPlaceholderAudioAttachment(e) {
8071
- var t = I.createAudioContainer(),
7896
+ var t = k.createAudioContainer(),
8072
7897
  n = document.createElement("div");
8073
7898
  n.classList.add("audio-placeholder-text-3-digits");
8074
7899
  var s = document.createElement("div");
@@ -8105,7 +7930,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
8105
7930
  key: "completePlaceholderAttachment",
8106
7931
  value: function completePlaceholderAttachment(e, t) {
8107
7932
  var n = this._activePlaceholderAttachment;
8108
- 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());
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());
8109
7934
  }
8110
7935
  }, {
8111
7936
  key: "removePlaceholderAttachment",
@@ -8145,8 +7970,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
8145
7970
  }, {
8146
7971
  key: "createAudioAttachment",
8147
7972
  value: function createAudioAttachment(e) {
8148
- var t = I.createAudioContainer();
8149
- return I.addAudioElements(t, e), t;
7973
+ var t = k.createAudioContainer();
7974
+ return k.addAudioElements(t, e), t;
8150
7975
  }
8151
7976
  }, {
8152
7977
  key: "stopAttachmentPlayback",
@@ -8155,7 +7980,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
8155
7980
  (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();
8156
7981
  }
8157
7982
  }]);
8158
- return I;
7983
+ return k;
8159
7984
  }(FileAttachmentsType);
8160
7985
  _AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
8161
7986
  var AudioFileAttachmentType = _AudioFileAttachmentType;
@@ -8209,33 +8034,33 @@ var FileAttachments = /*#__PURE__*/function () {
8209
8034
  }, {
8210
8035
  key: "completePlaceholders",
8211
8036
  value: function () {
8212
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
8213
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
8214
- while (1) switch (_context69.prev = _context69.next) {
8037
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
8038
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
8039
+ while (1) switch (_context65.prev = _context65.next) {
8215
8040
  case 0:
8216
- _context69.next = 2;
8041
+ _context65.next = 2;
8217
8042
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
8218
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
8043
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
8219
8044
  var t;
8220
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8221
- while (1) switch (_context68.prev = _context68.next) {
8045
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
8046
+ while (1) switch (_context64.prev = _context64.next) {
8222
8047
  case 0:
8223
- return _context68.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8048
+ return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8224
8049
  case 1:
8225
8050
  case "end":
8226
- return _context68.stop();
8051
+ return _context64.stop();
8227
8052
  }
8228
- }, _callee68);
8053
+ }, _callee64);
8229
8054
  }));
8230
- return function (_x119) {
8231
- return _ref6.apply(this, arguments);
8055
+ return function (_x110) {
8056
+ return _ref5.apply(this, arguments);
8232
8057
  };
8233
8058
  }()));
8234
8059
  case 2:
8235
8060
  case "end":
8236
- return _context69.stop();
8061
+ return _context65.stop();
8237
8062
  }
8238
- }, _callee69, this);
8063
+ }, _callee65, this);
8239
8064
  }));
8240
8065
  function completePlaceholders() {
8241
8066
  return _completePlaceholders.apply(this, arguments);
@@ -8265,7 +8090,7 @@ var FileAttachments = /*#__PURE__*/function () {
8265
8090
  e.forEach(function (n) {
8266
8091
  var s = new FileReader();
8267
8092
  s.readAsDataURL(n), s.onload = function (o) {
8268
- for (var _a4 = 0; _a4 < t.length && !t[_a4].attemptAddFile(n, o.target.result); _a4 += 1);
8093
+ for (var a = 0; a < t.length && !t[a].attemptAddFile(n, o.target.result); a += 1);
8269
8094
  };
8270
8095
  });
8271
8096
  }
@@ -8273,11 +8098,11 @@ var FileAttachments = /*#__PURE__*/function () {
8273
8098
  return FileAttachments;
8274
8099
  }();
8275
8100
  var _Modal = /*#__PURE__*/function () {
8276
- function w(e, t, n) {
8277
- _classCallCheck(this, w);
8278
- this._isOpen = !1, this._contentRef = w.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = w.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = w.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = w.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
8101
+ function T(e, t, n) {
8102
+ _classCallCheck(this, T);
8103
+ this._isOpen = !1, this._contentRef = T.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = T.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = T.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = T.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
8279
8104
  }
8280
- _createClass(w, [{
8105
+ _createClass(T, [{
8281
8106
  key: "isOpen",
8282
8107
  value: function isOpen() {
8283
8108
  return this._isOpen;
@@ -8299,7 +8124,7 @@ var _Modal = /*#__PURE__*/function () {
8299
8124
  var _this40 = this;
8300
8125
  this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
8301
8126
  _this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
8302
- }, w.MODAL_CLOSE_TIMEOUT_MS);
8127
+ }, T.MODAL_CLOSE_TIMEOUT_MS);
8303
8128
  }
8304
8129
  }, {
8305
8130
  key: "displayModalElements",
@@ -8315,7 +8140,7 @@ var _Modal = /*#__PURE__*/function () {
8315
8140
  key: "addCloseButton",
8316
8141
  value: function addCloseButton(e, t, n) {
8317
8142
  var _this41 = this;
8318
- var s = t ? w.createSVGButton(e) : w.createTextButton(e);
8143
+ var s = t ? T.createSVGButton(e) : T.createTextButton(e);
8319
8144
  return this.addButtons(s), s.onclick = function () {
8320
8145
  _this41.close(), setTimeout(function () {
8321
8146
  n == null || n();
@@ -8375,12 +8200,12 @@ var _Modal = /*#__PURE__*/function () {
8375
8200
  value: function createTextModalFunc(e, t, n) {
8376
8201
  var s;
8377
8202
  if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
8378
- var _o5 = new w(e, ["modal-content"], t.files.infoModal.containerStyle);
8379
- return _o5.addCloseButton("OK", !1, n), _o5.openTextModal.bind(_o5, t.infoModalTextMarkUp || "");
8203
+ var o = new T(e, ["modal-content"], t.files.infoModal.containerStyle);
8204
+ return o.addCloseButton("OK", !1, n), o.openTextModal.bind(o, t.infoModalTextMarkUp || "");
8380
8205
  }
8381
8206
  }
8382
8207
  }]);
8383
- return w;
8208
+ return T;
8384
8209
  }();
8385
8210
  _Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
8386
8211
  var Modal = _Modal;
@@ -8391,10 +8216,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
8391
8216
  function UploadFileButton(e, t, n, s, o, a) {
8392
8217
  var _this43;
8393
8218
  _classCallCheck(this, UploadFileButton);
8394
- var c, u, d, h, f, p;
8219
+ var c, u, d, h, p, f;
8395
8220
  _this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
8396
8221
  var l = _this43.createInnerElements(s, o, _this43._customStyles);
8397
- _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;
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;
8398
8223
  return _this43;
8399
8224
  }
8400
8225
  _createClass(UploadFileButton, [{
@@ -8641,7 +8466,7 @@ var Translate = /*#__PURE__*/function () {
8641
8466
  key: "translate",
8642
8467
  value: function translate(e, t) {
8643
8468
  var n = text_1$3.Text.breakupIntoWordsArr(e);
8644
- for (var _s15 = 0; _s15 < n.length; _s15 += 1) t[n[_s15]] && (n[_s15] = t[n[_s15]]);
8469
+ for (var s = 0; s < n.length; s += 1) t[n[s]] && (n[s] = t[n[s]]);
8645
8470
  return n.join("");
8646
8471
  }
8647
8472
  }]);
@@ -8661,9 +8486,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8661
8486
  key: "extract",
8662
8487
  value: function extract(e, t, n) {
8663
8488
  var s = "";
8664
- for (var _o6 = e.resultIndex; _o6 < e.results.length; ++_o6) {
8665
- var _a5 = e.results[_o6][0].transcript;
8666
- n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[_o6].isFinal ? t += _a5 : s += _a5;
8489
+ for (var o = e.resultIndex; o < e.results.length; ++o) {
8490
+ var a = e.results[o][0].transcript;
8491
+ n && (a = translate_1$1.Translate.translate(a, n)), e.results[o].isFinal ? t += a : s += a;
8667
8492
  }
8668
8493
  return {
8669
8494
  interimTranscript: s,
@@ -8676,8 +8501,8 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8676
8501
  value: function extractSafari(e, t, n) {
8677
8502
  var s = "";
8678
8503
  var o = "";
8679
- for (var _a6 = e.resultIndex; _a6 < e.results.length; ++_a6) {
8680
- var l = e.results[_a6][0].transcript;
8504
+ for (var a = e.resultIndex; a < e.results.length; ++a) {
8505
+ var l = e.results[a][0].transcript;
8681
8506
  n && (l = translate_1$1.Translate.translate(l, n)), s += l;
8682
8507
  }
8683
8508
  return {
@@ -8849,8 +8674,8 @@ var Elements = /*#__PURE__*/function () {
8849
8674
  if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
8850
8675
  var n = window.getSelection();
8851
8676
  if (n != null && n.focusNode) {
8852
- var _s16 = n.getRangeAt(0);
8853
- _s16.insertNode(e.scrollingSpan), _s16.insertNode(e.interimSpan), _s16.insertNode(e.finalSpan), _s16.collapse(!1), n.removeAllRanges(), n.addRange(_s16);
8677
+ var s = n.getRangeAt(0);
8678
+ s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1), n.removeAllRanges(), n.addRange(s);
8854
8679
  return;
8855
8680
  }
8856
8681
  }
@@ -8884,20 +8709,20 @@ var Cursor = /*#__PURE__*/function () {
8884
8709
  value: function setOffsetForGeneric(e, t) {
8885
8710
  var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8886
8711
  var s = 0;
8887
- for (var _o7 = 0; _o7 < e.childNodes.length; _o7 += 1) {
8888
- var _a7 = e.childNodes[_o7];
8889
- if (_a7.childNodes.length > 0) {
8890
- var l = Cursor.setOffsetForGeneric(_a7, t, n);
8712
+ for (var o = 0; o < e.childNodes.length; o += 1) {
8713
+ var a = e.childNodes[o];
8714
+ if (a.childNodes.length > 0) {
8715
+ var l = Cursor.setOffsetForGeneric(a, t, n);
8891
8716
  if (l === -1) return -1;
8892
8717
  n += l;
8893
- } else if (_a7.textContent !== null) {
8894
- if (n + _a7.textContent.length > t) {
8718
+ } else if (a.textContent !== null) {
8719
+ if (n + a.textContent.length > t) {
8895
8720
  var _l = document.createRange();
8896
- _l.setStart(_a7, t - n), _l.collapse(!0);
8721
+ _l.setStart(a, t - n), _l.collapse(!0);
8897
8722
  var c = window.getSelection();
8898
8723
  return c == null || c.removeAllRanges(), c == null || c.addRange(_l), e.focus(), -1;
8899
8724
  }
8900
- n += _a7.textContent.length, s += _a7.textContent.length;
8725
+ n += a.textContent.length, s += a.textContent.length;
8901
8726
  }
8902
8727
  }
8903
8728
  return s;
@@ -8915,8 +8740,8 @@ var Cursor = /*#__PURE__*/function () {
8915
8740
  value: function setOffsetForSafariGeneric(e, t) {
8916
8741
  var n = window.getSelection();
8917
8742
  if (n) {
8918
- var _s17 = Cursor.getGenericElementCursorOffset(e, n, !0);
8919
- console.log(_s17), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, _s17 + t);
8743
+ var s = Cursor.getGenericElementCursorOffset(e, n, !0);
8744
+ console.log(s), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, s + t);
8920
8745
  }
8921
8746
  }
8922
8747
  // set to automatically scroll to cursor (scroll does not work in Safari)
@@ -8947,9 +8772,9 @@ var Cursor = /*#__PURE__*/function () {
8947
8772
  value: function getGenericElementCursorOffset(e, t, n) {
8948
8773
  var s = 0;
8949
8774
  if (t.rangeCount > 0) {
8950
- var _o8 = t.getRangeAt(0),
8951
- _a8 = _o8.cloneRange();
8952
- _a8.selectNodeContents(e), n ? _a8.setEnd(_o8.startContainer, _o8.startOffset) : _a8.setEnd(_o8.endContainer, _o8.endOffset), s = _a8.toString().length;
8775
+ var o = t.getRangeAt(0),
8776
+ a = o.cloneRange();
8777
+ a.selectNodeContents(e), n ? a.setEnd(o.startContainer, o.startOffset) : a.setEnd(o.endContainer, o.endOffset), s = a.toString().length;
8953
8778
  }
8954
8779
  return s;
8955
8780
  }
@@ -9012,10 +8837,10 @@ var CommandUtils = /*#__PURE__*/function () {
9012
8837
  key: "checkIfMatchesWord",
9013
8838
  value: function checkIfMatchesWord(e, t, n) {
9014
8839
  var s = e;
9015
- for (var _o9 = n.length - 1; _o9 >= 0; _o9 -= 1) {
9016
- var _a9 = _o9,
8840
+ for (var o = n.length - 1; o >= 0; o -= 1) {
8841
+ var a = o,
9017
8842
  l = s.length - 1;
9018
- for (; n[_a9] === s[l] && l >= 0;) _a9 -= 1, l -= 1;
8843
+ for (; n[a] === s[l] && l >= 0;) a -= 1, l -= 1;
9019
8844
  if (l < 0) return !0;
9020
8845
  }
9021
8846
  return !1;
@@ -9029,31 +8854,31 @@ var CommandUtils = /*#__PURE__*/function () {
9029
8854
  if (!u || !s || !n) return;
9030
8855
  var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
9031
8856
  h = text_1$2.Text.breakupIntoWordsArr(d),
9032
- f = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
9033
- if (u.commandMode && f(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
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 () {
9034
8859
  return CommandUtils.toggleCommandModeOn(e);
9035
8860
  }), {
9036
8861
  doNotProcessTranscription: !1
9037
8862
  };
9038
8863
  if (!(u.commandMode && !e.isWaitingForCommand)) {
9039
- if (u.stop && f(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
8864
+ if (u.stop && p(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
9040
8865
  return e.stop();
9041
8866
  }), {
9042
8867
  doNotProcessTranscription: !1
9043
8868
  };
9044
- if (u.pause && f(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
9045
- var p;
9046
- e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
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);
9047
8872
  }), {
9048
8873
  doNotProcessTranscription: !1
9049
8874
  };
9050
- 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), {
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), {
9051
8876
  doNotProcessTranscription: !0
9052
8877
  };
9053
- if (u.reset && f(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
8878
+ if (u.reset && p(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
9054
8879
  doNotProcessTranscription: !0
9055
8880
  };
9056
- if (u.removeAllText && f(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
8881
+ if (u.removeAllText && p(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
9057
8882
  doNotProcessTranscription: !0
9058
8883
  };
9059
8884
  }
@@ -9084,9 +8909,9 @@ var Highlight = /*#__PURE__*/function () {
9084
8909
  value: function setStateForGeneric(e, t) {
9085
8910
  var n = window.getSelection();
9086
8911
  if (n != null && n.focusNode) {
9087
- var _s18 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
9088
- _o10 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
9089
- e.isHighlighted = _s18 !== _o10;
8912
+ var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
8913
+ o = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
8914
+ e.isHighlighted = s !== o;
9090
8915
  }
9091
8916
  }
9092
8917
  }, {
@@ -9099,8 +8924,8 @@ var Highlight = /*#__PURE__*/function () {
9099
8924
  value: function removeForGeneric(e, t) {
9100
8925
  var n = window.getSelection();
9101
8926
  if (n) {
9102
- var _s19 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
9103
- n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, _s19), e.isHighlighted = !1;
8927
+ var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
8928
+ n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, s), e.isHighlighted = !1;
9104
8929
  }
9105
8930
  }
9106
8931
  }, {
@@ -9110,8 +8935,8 @@ var Highlight = /*#__PURE__*/function () {
9110
8935
  s = t.selectionEnd,
9111
8936
  o = t.value;
9112
8937
  if (n && s) {
9113
- var _a10 = o.substring(0, n) + o.substring(s);
9114
- t.value = _a10, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
8938
+ var a = o.substring(0, n) + o.substring(s);
8939
+ t.value = a, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
9115
8940
  }
9116
8941
  e.isHighlighted = !1;
9117
8942
  }
@@ -9135,11 +8960,11 @@ var Padding = /*#__PURE__*/function () {
9135
8960
  key: "setStateForPrimitiveElement",
9136
8961
  value: function setStateForPrimitiveElement(e, t) {
9137
8962
  if (document.activeElement === t && t.selectionStart !== null) {
9138
- var _s20 = t.selectionStart,
9139
- _o11 = t.value[_s20 - 1],
9140
- _a11 = t.selectionEnd === null ? _s20 : t.selectionEnd,
9141
- l = t.value[_a11];
9142
- text_1$1.Text.isCharDefined(_o11) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === _a11;
8963
+ var s = t.selectionStart,
8964
+ o = t.value[s - 1],
8965
+ a = t.selectionEnd === null ? s : t.selectionEnd,
8966
+ l = t.value[a];
8967
+ text_1$1.Text.isCharDefined(o) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === a;
9143
8968
  return;
9144
8969
  }
9145
8970
  var n = t.value[t.value.length - 1];
@@ -9210,11 +9035,11 @@ var Speech = /*#__PURE__*/function () {
9210
9035
  value: function prepareBeforeStart(e) {
9211
9036
  var t, n;
9212
9037
  if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
9213
- var _o12 = e.element.find(function (a) {
9038
+ var o = e.element.find(function (a) {
9214
9039
  return a === document.activeElement;
9215
9040
  }) || e.element[0];
9216
- if (!_o12) return;
9217
- this.prepare(_o12);
9041
+ if (!o) return;
9042
+ this.prepare(o);
9218
9043
  } else this.prepare(e.element);
9219
9044
  (e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], elements_1.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((n = this._options) === null || n === void 0) && n.commands && (this.commands = commandUtils_1$1.CommandUtils.process(this._options.commands));
9220
9045
  }
@@ -9257,8 +9082,8 @@ var Speech = /*#__PURE__*/function () {
9257
9082
  this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
9258
9083
  var s = this.startPadding + this.finalTranscript + t;
9259
9084
  if (e.value = s + this.endPadding, !this.isTargetInShadow) {
9260
- var _o13 = s.length + this.numberOfSpacesAfterNewText;
9261
- cursor_1.Cursor.setOffsetForPrimitive(e, _o13, this.autoScroll);
9085
+ var o = s.length + this.numberOfSpacesAfterNewText;
9086
+ cursor_1.Cursor.setOffsetForPrimitive(e, o, this.autoScroll);
9262
9087
  }
9263
9088
  this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
9264
9089
  }
@@ -9359,8 +9184,8 @@ var WebSpeech = /*#__PURE__*/function (_speech_1$1$Speech) {
9359
9184
  var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
9360
9185
  t = _this46$_extractText.interimTranscript,
9361
9186
  n = _this46$_extractText.finalTranscript,
9362
- _s21 = _this46$_extractText.newText;
9363
- _this46.updateElements(t, n, _s21);
9187
+ s = _this46$_extractText.newText;
9188
+ _this46.updateElements(t, n, s);
9364
9189
  }
9365
9190
  });
9366
9191
  }
@@ -9455,26 +9280,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9455
9280
  }, {
9456
9281
  key: "getNewSpeechConfig",
9457
9282
  value: function () {
9458
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9459
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9460
- while (1) switch (_context70.prev = _context70.next) {
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) {
9461
9286
  case 0:
9462
9287
  if (!t.region) {
9463
- _context70.next = 2;
9288
+ _context66.next = 2;
9464
9289
  break;
9465
9290
  }
9466
- return _context70.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
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) {
9467
9292
  return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
9468
9293
  })["catch"](function (n) {
9469
9294
  return console.error(n), null;
9470
9295
  }) : null);
9471
9296
  case 2:
9472
9297
  case "end":
9473
- return _context70.stop();
9298
+ return _context66.stop();
9474
9299
  }
9475
- }, _callee70);
9300
+ }, _callee66);
9476
9301
  }));
9477
- function getNewSpeechConfig(_x120, _x121) {
9302
+ function getNewSpeechConfig(_x111, _x112) {
9478
9303
  return _getNewSpeechConfig.apply(this, arguments);
9479
9304
  }
9480
9305
  return getNewSpeechConfig;
@@ -9487,23 +9312,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9487
9312
  }, {
9488
9313
  key: "get",
9489
9314
  value: function () {
9490
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e, t) {
9315
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
9491
9316
  var n;
9492
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9493
- while (1) switch (_context71.prev = _context71.next) {
9317
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
9318
+ while (1) switch (_context67.prev = _context67.next) {
9494
9319
  case 0:
9495
- _context71.next = 2;
9320
+ _context67.next = 2;
9496
9321
  return AzureSpeechConfig.getNewSpeechConfig(e, t);
9497
9322
  case 2:
9498
- n = _context71.sent;
9499
- return _context71.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9323
+ n = _context67.sent;
9324
+ return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9500
9325
  case 4:
9501
9326
  case "end":
9502
- return _context71.stop();
9327
+ return _context67.stop();
9503
9328
  }
9504
- }, _callee71);
9329
+ }, _callee67);
9505
9330
  }));
9506
- function get(_x122, _x123) {
9331
+ function get(_x113, _x114) {
9507
9332
  return _get.apply(this, arguments);
9508
9333
  }
9509
9334
  return get;
@@ -9593,28 +9418,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9593
9418
  }, {
9594
9419
  key: "startAsync",
9595
9420
  value: function () {
9596
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9421
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
9597
9422
  var t;
9598
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9599
- while (1) switch (_context72.prev = _context72.next) {
9423
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
9424
+ while (1) switch (_context68.prev = _context68.next) {
9600
9425
  case 0:
9601
- _context72.t0 = this.validate(e);
9602
- if (!_context72.t0) {
9603
- _context72.next = 6;
9426
+ _context68.t0 = this.validate(e);
9427
+ if (!_context68.t0) {
9428
+ _context68.next = 6;
9604
9429
  break;
9605
9430
  }
9606
- _context72.next = 4;
9431
+ _context68.next = 4;
9607
9432
  return this.instantiateService(e);
9608
9433
  case 4:
9609
9434
  this._translations = e == null ? void 0 : e.translations;
9610
9435
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
9611
9436
  case 6:
9612
9437
  case "end":
9613
- return _context72.stop();
9438
+ return _context68.stop();
9614
9439
  }
9615
- }, _callee72, this);
9440
+ }, _callee68, this);
9616
9441
  }));
9617
- function startAsync(_x124) {
9442
+ function startAsync(_x115) {
9618
9443
  return _startAsync.apply(this, arguments);
9619
9444
  }
9620
9445
  return startAsync;
@@ -9627,28 +9452,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9627
9452
  }, {
9628
9453
  key: "instantiateService",
9629
9454
  value: function () {
9630
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e) {
9631
- var t, n, s, _o14;
9632
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
9633
- while (1) switch (_context73.prev = _context73.next) {
9455
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
9456
+ var t, n, s, o;
9457
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9458
+ while (1) switch (_context69.prev = _context69.next) {
9634
9459
  case 0:
9635
9460
  t = Azure.getAPI();
9636
9461
  n = t.AudioConfig.fromDefaultMicrophoneInput();
9637
- _context73.next = 4;
9462
+ _context69.next = 4;
9638
9463
  return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
9639
9464
  case 4:
9640
- s = _context73.sent;
9465
+ s = _context69.sent;
9641
9466
  if (s) {
9642
- _o14 = new t.SpeechRecognizer(s, n);
9643
- this.setEvents(_o14), this._service = _o14, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9467
+ o = new t.SpeechRecognizer(s, n);
9468
+ this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9644
9469
  } else this.error("Unable to contact Azure server");
9645
9470
  case 6:
9646
9471
  case "end":
9647
- return _context73.stop();
9472
+ return _context69.stop();
9648
9473
  }
9649
- }, _callee73, this);
9474
+ }, _callee69, this);
9650
9475
  }));
9651
- function instantiateService(_x125) {
9476
+ function instantiateService(_x116) {
9652
9477
  return _instantiateService.apply(this, arguments);
9653
9478
  }
9654
9479
  return instantiateService;
@@ -9685,10 +9510,10 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9685
9510
  case window.SpeechSDK.ResultReason.RecognizedSpeech:
9686
9511
  if (n.text && !this._stopping) {
9687
9512
  var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
9688
- _s22 = _azureTranscript_1$Az2.interimTranscript,
9689
- _o15 = _azureTranscript_1$Az2.finalTranscript,
9690
- _a12 = _azureTranscript_1$Az2.newText;
9691
- stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o15, _a12), _o15 !== "" && (this._newTextPadding = " ");
9513
+ s = _azureTranscript_1$Az2.interimTranscript,
9514
+ o = _azureTranscript_1$Az2.finalTranscript,
9515
+ a = _azureTranscript_1$Az2.newText;
9516
+ stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(s, o, a), o !== "" && (this._newTextPadding = " ");
9692
9517
  }
9693
9518
  break;
9694
9519
  }
@@ -10030,17 +9855,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
10030
9855
  }, {
10031
9856
  key: "submit",
10032
9857
  value: function () {
10033
- var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(e, t) {
9858
+ var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
10034
9859
  var l, c, n, s, o, a;
10035
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
10036
- while (1) switch (_context74.prev = _context74.next) {
9860
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9861
+ while (1) switch (_context70.prev = _context70.next) {
10037
9862
  case 0:
10038
- _context74.t0 = e;
10039
- if (_context74.t0) {
10040
- _context74.next = 6;
9863
+ _context70.t0 = e;
9864
+ if (_context70.t0) {
9865
+ _context70.next = 6;
10041
9866
  break;
10042
9867
  }
10043
- _context74.next = 4;
9868
+ _context70.next = 4;
10044
9869
  return this._fileAttachments.completePlaceholders();
10045
9870
  case 4:
10046
9871
  n = this._fileAttachments.getAllFileData();
@@ -10050,40 +9875,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
10050
9875
  case 6:
10051
9876
  o = t === "" ? void 0 : t;
10052
9877
  if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
10053
- _context74.next = 9;
9878
+ _context70.next = 9;
10054
9879
  break;
10055
9880
  }
10056
- return _context74.abrupt("return");
9881
+ return _context70.abrupt("return");
10057
9882
  case 9:
10058
9883
  if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
10059
- _context74.next = 14;
9884
+ _context70.next = 14;
10060
9885
  break;
10061
9886
  }
10062
9887
  if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
10063
- _context74.next = 12;
9888
+ _context70.next = 12;
10064
9889
  break;
10065
9890
  }
10066
- return _context74.abrupt("return");
9891
+ return _context70.abrupt("return");
10067
9892
  case 12:
10068
- _context74.next = 16;
9893
+ _context70.next = 16;
10069
9894
  break;
10070
9895
  case 14:
10071
9896
  if (this._serviceIO.canSendMessage(o, s)) {
10072
- _context74.next = 16;
9897
+ _context70.next = 16;
10073
9898
  break;
10074
9899
  }
10075
- return _context74.abrupt("return");
9900
+ return _context70.abrupt("return");
10076
9901
  case 16:
10077
9902
  this.changeToLoadingIcon();
10078
9903
  t !== "" && this._messages.addNewMessage({
10079
9904
  text: t
10080
9905
  }, !1, !0);
10081
- _context74.t1 = n;
10082
- if (!_context74.t1) {
10083
- _context74.next = 22;
9906
+ _context70.t1 = n;
9907
+ if (!_context70.t1) {
9908
+ _context70.next = 22;
10084
9909
  break;
10085
9910
  }
10086
- _context74.next = 22;
9911
+ _context70.next = 22;
10087
9912
  return this._messages.addMultipleFiles(n);
10088
9913
  case 22:
10089
9914
  this._messages.addLoadingMessage();
@@ -10092,17 +9917,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
10092
9917
  text: o,
10093
9918
  files: s
10094
9919
  };
10095
- _context74.next = 27;
9920
+ _context70.next = 27;
10096
9921
  return this._serviceIO.callAPI(a, this._messages);
10097
9922
  case 27:
10098
9923
  e || (c = this._fileAttachments) == null || c.removeAllFiles();
10099
9924
  case 28:
10100
9925
  case "end":
10101
- return _context74.stop();
9926
+ return _context70.stop();
10102
9927
  }
10103
- }, _callee74, this);
9928
+ }, _callee70, this);
10104
9929
  }));
10105
- function submit(_x126, _x127) {
9930
+ function submit(_x117, _x118) {
10106
9931
  return _submit.apply(this, arguments);
10107
9932
  }
10108
9933
  return submit;
@@ -10237,13 +10062,13 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
10237
10062
  t = new Array(e.length);
10238
10063
  for (var l = 0; l < e.length; l++) t[l] = e.charCodeAt(l);
10239
10064
  var n = new Uint8Array(t),
10240
- _s23 = new Blob([n], {
10065
+ s = new Blob([n], {
10241
10066
  type: this._format
10242
10067
  }),
10243
- _o16 = this._format === "image/jpeg" ? "jpeg" : "png",
10244
- _a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o16);
10245
- return new File([_s23], _a13, {
10246
- type: _s23.type
10068
+ o = this._format === "image/jpeg" ? "jpeg" : "png",
10069
+ a = NewFileName.getFileName(this._newFilePrefix || "photo", o);
10070
+ return new File([s], a, {
10071
+ type: s.type
10247
10072
  });
10248
10073
  }
10249
10074
  }
@@ -10378,9 +10203,9 @@ var Input = /*#__PURE__*/function () {
10378
10203
  u = _FILE_TYPE_BUTTON_ICO.id,
10379
10204
  d = _FILE_TYPE_BUTTON_ICO.svgString,
10380
10205
  h = _FILE_TYPE_BUTTON_ICO.dropupText,
10381
- f = new UploadFileButton(n, c, l, u, d, h);
10206
+ p = new UploadFileButton(n, c, l, u, d, h);
10382
10207
  s[a] = {
10383
- button: f,
10208
+ button: p,
10384
10209
  fileType: c
10385
10210
  };
10386
10211
  }