@alan-ai/alan-sdk-web 1.8.47 → 1.8.48

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/alan_lib.js CHANGED
@@ -3369,7 +3369,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3369
3369
  }
3370
3370
  // alan_btn/alan_btn.ts
3371
3371
  (function (ns) {
3372
- var alanButtonVersion = "alan-version.1.8.47";
3372
+ var alanButtonVersion = "alan-version.1.8.48";
3373
3373
  alanButtonVersion = alanButtonVersion.replace("alan-version.", "");
3374
3374
  if (window.alanBtn) {
3375
3375
  console.warn("Alan: the Alan Button source code has already added (v." + alanButtonVersion + ")");
@@ -3446,6 +3446,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3446
3446
  var textChatOptions = null;
3447
3447
  var clearChatIsInProcess = false;
3448
3448
  var textChatScrollPosition = null;
3449
+ var sentMessageInd = null;
3450
+ var sentMessages = [];
3449
3451
  var defaultMinChatHeight = 400;
3450
3452
  var defaultChatHeight = 700;
3451
3453
  var defaultMinChatWidth = 250;
@@ -4013,7 +4015,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4013
4015
  }
4014
4016
  el.style.display = "flex";
4015
4017
  setTimeout(function () {
4016
- var textareaEl = document.getElementById("chatTextarea");
4018
+ var textareaEl = getChatTextareaEl();
4017
4019
  if (textareaEl && state === DEFAULT) {
4018
4020
  textareaEl.focus();
4019
4021
  }
@@ -4733,7 +4735,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4733
4735
  "img {\n max-width: 100%!important;\n pointer-events: auto!important;\n cursor: pointer;\n }",
4734
4736
  "code {\n background-color: #F8F8F8!important;\n border-radius: 3px!important;\n border: 1px solid #DDD!important;\n font-family: Consolas, \"Liberation Mono\", Courier, monospace!important;\n margin: 0 2px!important;\n padding: 0 5px!important;\n white-space: pre-line!important;\n font-size: ".concat(responseBubbleFontSize, "px!important;\n }"),
4735
4737
  "pre {\n background-color: #F8F8F8!important;\n border-radius: 3px!important;\n border: 1px solid #DDD!important;\n font-family: Consolas, \"Liberation Mono\", Courier, monospace!important;\n padding: 0 5px!important;\n white-space: pre-line!important;\n font-size: ".concat(responseBubbleFontSize, "px!important;\n }"),
4736
- "pre code {\n border: none!important;\n margin: 0!important;\n padding: 0!important;\n white-space: pre-line!important;\n font-size: ".concat(responseBubbleFontSize, "px!important;\n }"),
4738
+ "pre code {\n border: none!important;\n margin: 0!important;\n padding: 0!important;\n white-space: pre-wrap!important;\n font-size: ".concat(responseBubbleFontSize, "px!important;\n }"),
4737
4739
  "hr {\n display: block!important;\n unicode-bidi: isolate!important;\n margin-block-start: 0.5em!important;\n margin-block-end: 0.5em!important;\n margin-inline-start: auto!important;\n margin-inline-end: auto!important;\n overflow: hidden!important;\n border-style: inset!important;\n border-width: 1px!important;\n }",
4738
4740
  "blockquote {\n padding: 5px 20px 0!important;\n border-left: 5px solid #beb7b7!important;\n font-size: ".concat(responseBubbleFontSize, "px!important;\n }"),
4739
4741
  "table > tbody > tr > td {\n background-color: #fff!important;\n color: #000!important;\n }",
@@ -4750,6 +4752,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4750
4752
  keyFrames += getStyleSheetMarker(true) + ".hide-alan-btn-when-text-chat-is-opened .alanBtn {\n transform: scale(0);\n opacity: 0;\n animation: text-chat-disappear-anim ".concat(textChatAppearAnimationMs, "ms ease-in-out forwards;\n }");
4751
4753
  keyFrames += getStyleSheetMarker(true) + ".text-chat-is-closing .alanBtn {\n transform: scale(0);\n opacity: 0;\n animation: text-chat-appear-anim ".concat(textChatAppearAnimationMs, "ms ease-in-out forwards;\n }");
4752
4754
  keyFrames += getStyleSheetMarker(true) + ".hide-alan-btn-when-text-chat-is-opened .alanBtn-recognised-text-holder {\n display: none;\n }";
4755
+ keyFrames += getStyleSheetMarker() + " mjx-container svg {\n max-width: 100%;\n }";
4753
4756
  keyFrames += getStyleSheetMarker() + ".alan-overlay {position: fixed;top: 0;left: 0;right: 0;bottom: 0;z-index: 99;background: rgba(0, 0, 0, 0.57);opacity: 0;-webkit-animation: alan-fade-in 0.5s 0.2s forwards;-moz-animation: alan-fade-in 0.5s 0.2s forwards;-o-animation: alan-fade-in 0.5s 0.2s forwards;animation: alan-fade-in 0.5s 0.2s forwards;}";
4754
4757
  keyFrames += getStyleSheetMarker() + ".alan-overlay-popup.alan-btn-lib__default-popup {border-radius:10px; box-shadow: 0px 5px 14px rgba(3, 3, 3, 0.25);padding:6px 30px 6px 12px;text-align: left;width: 220px;background: rgb(255 255 255);}";
4755
4758
  keyFrames += getStyleSheetMarker() + ".alan-overlay-popup.alan-btn-lib__top.alan-btn-lib__right {border-top-right-radius: 0!important;}";
@@ -5579,6 +5582,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
5579
5582
  curDialogId = dialogId;
5580
5583
  saveDialogId(dialogId);
5581
5584
  restoreMessageList(true);
5585
+ sentMessages = restoreSentMessages();
5582
5586
  }
5583
5587
  if (options2.onConnectionStatus) {
5584
5588
  options2.onConnectionStatus(res);
@@ -5876,7 +5880,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
5876
5880
  return resultStr;
5877
5881
  }
5878
5882
  function renderInterimForTextChat(msg) {
5879
- var textarea = document.getElementById("chatTextarea");
5883
+ var textarea = getChatTextareaEl();
5880
5884
  if (textarea) {
5881
5885
  if (msg.final === true) {
5882
5886
  renderMessageInTextChat(msg);
@@ -5892,8 +5896,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
5892
5896
  imgPreviewOverlayEl.id = "img-preview-overlay";
5893
5897
  imgPreviewOverlayEl.classList.add("alan-btn__image-preview-overlay");
5894
5898
  imgPreviewOverlayEl.style.zIndex = btnZIndex + 3;
5895
- imgPreviewOverlayEl.setAttribute("data-img-index", parentEl.getAttribute("data-img-index"));
5896
- imgPreviewOverlayEl.setAttribute("data-msg-req-id", parentEl.getAttribute("data-msg-req-id"));
5899
+ if (parentEl) {
5900
+ imgPreviewOverlayEl.setAttribute("data-img-index", parentEl.getAttribute("data-img-index"));
5901
+ imgPreviewOverlayEl.setAttribute("data-msg-req-id", parentEl.getAttribute("data-msg-req-id"));
5902
+ }
5897
5903
  var imgPreviewOverlayCloseIcon = document.createElement("div");
5898
5904
  imgPreviewOverlayCloseIcon.id = "img-preview-overlay__close-icon";
5899
5905
  imgPreviewOverlayCloseIcon.innerHTML = "\n <svg width=\"17\" height=\"17\" viewBox=\"0 0 17 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0.342029 15.0105C-0.113105 15.4658 -0.113035 16.2036 0.34217 16.6587C0.797374 17.1138 1.53533 17.1138 1.99046 16.6586L8.50015 10.1482L15.0104 16.658C15.4655 17.1131 16.2035 17.1131 16.6586 16.658C17.1138 16.2029 17.1138 15.4649 16.6586 15.0098L10.1483 8.49998L16.6582 1.98944C17.1132 1.53427 17.1132 0.796371 16.6579 0.341282C16.2028 -0.113819 15.4648 -0.113749 15.0097 0.341421L8.49991 6.85183L1.98966 0.341981C1.5345 -0.113143 0.796535 -0.113143 0.341377 0.341981C-0.113792 0.797116 -0.113792 1.53502 0.341377 1.99016L6.85187 8.5001L0.342029 15.0105Z\" fill=\"#FFFFFF\"/>\n</svg>\n";
@@ -6123,8 +6129,77 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6123
6129
  function buildMsgContent(msg) {
6124
6130
  return "".concat(buildImagesContent(msg)).concat(buildMsgTextContent(msg)).concat(buildLinksContent(msg)).concat(buildLikesContent(msg)).concat(buildMsgIncommingLoader(msg));
6125
6131
  }
6132
+ function highlightCode() {
6133
+ if (window.hljs) {
6134
+ setTimeout(function () {
6135
+ var msgHolder = document.getElementById("chatMessages");
6136
+ if (msgHolder) {
6137
+ msgHolder.querySelectorAll("pre code:not(.alan-btn__hljs-processed)").forEach(function (el) {
6138
+ window.hljs.highlightElement(el);
6139
+ el.classList.add("alan-btn__hljs-processed");
6140
+ });
6141
+ }
6142
+ });
6143
+ }
6144
+ }
6145
+ function loadHighlightJs() {
6146
+ var script = document.createElement("script");
6147
+ script.src = "https://studio.alan.app/js/hljs/highlight.min.js?v=1";
6148
+ script.async = true;
6149
+ script.onload = function () {
6150
+ highlightCode();
6151
+ };
6152
+ document.head.appendChild(script);
6153
+ var link = document.createElement("link");
6154
+ link.rel = "stylesheet";
6155
+ link.href = "https://studio.alan.app/js/hljs/github.min.css?v=1";
6156
+ document.getElementsByTagName("head")[0].appendChild(link);
6157
+ }
6158
+ loadHighlightJs();
6159
+ function loadMathJax() {
6160
+ window.MathJax = {
6161
+ startup: {
6162
+ pageReady: function () {
6163
+ return window.MathJax.startup.defaultPageReady();
6164
+ }
6165
+ },
6166
+ tex: {
6167
+ inlineMath: [["$", "$"], ["\\(", "\\)"]],
6168
+ processEscapes: true
6169
+ }
6170
+ };
6171
+ var script = document.createElement("script");
6172
+ script.src = "https://studio.alan.app/js/mathjax/tex-svg.js?v=1";
6173
+ script.async = true;
6174
+ script.setAttribute("id", "MathJax-script");
6175
+ script.onload = function () {
6176
+ processFormulasInMsgs();
6177
+ };
6178
+ document.head.appendChild(script);
6179
+ }
6180
+ loadMathJax();
6181
+ function processFormulas(msgInd) {
6182
+ var MathJax = window.MathJax;
6183
+ if (MathJax) {
6184
+ setTimeout(function () {
6185
+ var output = document.getElementById("msg-" + msgInd).querySelectorAll(".alan-btn__chat-response-text-wrapper")[0];
6186
+ if (output && MathJax.texReset) {
6187
+ MathJax.texReset();
6188
+ MathJax.typesetClear();
6189
+ MathJax.typesetPromise([output])["catch"](function (err) {
6190
+ console.error(err);
6191
+ });
6192
+ }
6193
+ });
6194
+ }
6195
+ }
6196
+ function processFormulasInMsgs() {
6197
+ for (var i2 = 0; i2 < textChatMessages.length; i2++) {
6198
+ processFormulas(i2);
6199
+ }
6200
+ }
6126
6201
  function renderMessageInTextChat(msg, noAnimation, immidiateScroll) {
6127
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
6202
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
6128
6203
  if (!textChatIsAvailable)
6129
6204
  return;
6130
6205
  var innerMsgPart = "";
@@ -6165,7 +6240,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6165
6240
  }
6166
6241
  }
6167
6242
  msg = __assign(__assign({}, msg), getMsgReadProp(msg, textChatIsHidden));
6168
- var _m = processMessageForChat(msg, textChatMessages), isNew = _m.isNew, msgInd = _m.msgInd, replaceLoader = _m.replaceLoader, updateResponse = _m.updateResponse;
6243
+ var _p = processMessageForChat(msg, textChatMessages), isNew = _p.isNew, msgInd = _p.msgInd, replaceLoader = _p.replaceLoader, updateResponse = _p.updateResponse;
6169
6244
  if (isNew) {
6170
6245
  var div = document.createElement("div");
6171
6246
  div.id = "msg-" + msgInd;
@@ -6183,6 +6258,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6183
6258
  else {
6184
6259
  scrollTextChat(msgHolder);
6185
6260
  }
6261
+ if (((_g = msg.ctx) === null || _g === void 0 ? void 0 : _g.final) !== false) {
6262
+ processFormulas(msgInd);
6263
+ highlightCode();
6264
+ }
6186
6265
  }
6187
6266
  else {
6188
6267
  var msgEl = document.getElementById("msg-" + msgInd);
@@ -6192,7 +6271,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6192
6271
  if (innerEl) {
6193
6272
  innerEl.innerHTML = innerMsgPart;
6194
6273
  innerEl.classList.remove("alan-incoming-msg");
6195
- if (msg.type !== "chat" && ((_g = msg.images) === null || _g === void 0 ? void 0 : _g.length) > 0) {
6274
+ if (msg.type !== "chat" && ((_h = msg.images) === null || _h === void 0 ? void 0 : _h.length) > 0) {
6196
6275
  innerEl.classList.add("with-images");
6197
6276
  }
6198
6277
  scrollTextChat(msgHolder, "smooth");
@@ -6202,18 +6281,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6202
6281
  var innerEl = msgEl.children[0];
6203
6282
  var updatedMsg = textChatMessages[msgInd];
6204
6283
  var imagesWrapper = innerEl.querySelector(".alan-btn__chat-response-imgs-wrapper");
6205
- if (((_h = updatedMsg.images) === null || _h === void 0 ? void 0 : _h.length) > 0 && !imagesWrapper) {
6284
+ if (((_j = updatedMsg.images) === null || _j === void 0 ? void 0 : _j.length) > 0 && !imagesWrapper) {
6206
6285
  innerEl.insertAdjacentHTML("afterbegin", buildImagesContent(updatedMsg));
6207
6286
  innerEl = msgEl.children[0];
6208
6287
  }
6209
- if (((_j = updatedMsg.images) === null || _j === void 0 ? void 0 : _j.length) > 1 && imagesWrapper) {
6288
+ if (((_k = updatedMsg.images) === null || _k === void 0 ? void 0 : _k.length) > 1 && imagesWrapper) {
6210
6289
  imagesWrapper.querySelector(".alan-btn__chat-response-imgs-wrapper-right-arrow").classList.remove("invisible");
6211
6290
  }
6212
- if (updatedMsg.type !== "chat" && ((_k = updatedMsg.images) === null || _k === void 0 ? void 0 : _k.length) > 0) {
6291
+ if (updatedMsg.type !== "chat" && ((_l = updatedMsg.images) === null || _l === void 0 ? void 0 : _l.length) > 0) {
6213
6292
  innerEl.classList.add("with-images");
6214
6293
  }
6215
6294
  var msgParts = innerEl.children;
6216
- var stop_1 = ((_l = updatedMsg.images) === null || _l === void 0 ? void 0 : _l.length) === 0 ? 0 : 1;
6295
+ var stop_1 = ((_m = updatedMsg.images) === null || _m === void 0 ? void 0 : _m.length) === 0 ? 0 : 1;
6217
6296
  while (msgParts.length > stop_1) {
6218
6297
  msgParts[msgParts.length - 1].remove();
6219
6298
  }
@@ -6229,6 +6308,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6229
6308
  msgEl.innerHTML = msgHtml;
6230
6309
  }
6231
6310
  }
6311
+ if (((_o = msg.ctx) === null || _o === void 0 ? void 0 : _o.final) !== false) {
6312
+ processFormulas(msgInd);
6313
+ highlightCode();
6314
+ }
6232
6315
  }
6233
6316
  saveMessageHistory();
6234
6317
  if (textChatIsAvailable && textChatIsHidden) {
@@ -6356,6 +6439,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6356
6439
  case 1:
6357
6440
  res = _a.sent();
6358
6441
  msg = __assign(__assign({}, msg), { reqId: res.reqId });
6442
+ saveSentMessages(text);
6359
6443
  renderMessageInTextChat(msg);
6360
6444
  renderMessageInTextChat({
6361
6445
  type: "response",
@@ -6379,7 +6463,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6379
6463
  return __awaiter(this, void 0, void 0, function () {
6380
6464
  var textareaEl, textareaHolderEl, text;
6381
6465
  return __generator(this, function (_a) {
6382
- textareaEl = document.getElementById("chatTextarea");
6466
+ textareaEl = getChatTextareaEl();
6383
6467
  textareaHolderEl = document.getElementById("textarea-holder");
6384
6468
  text = textareaEl.value;
6385
6469
  if (lastSendMsgTs) {
@@ -6429,6 +6513,72 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6429
6513
  }
6430
6514
  }
6431
6515
  }
6516
+ function getRestoreMsgsLsKey() {
6517
+ var projectId = getProjectId();
6518
+ return "alan-btn-chat-sent-history-".concat(projectId);
6519
+ }
6520
+ function restoreSentMessages() {
6521
+ var messages = [];
6522
+ if (isLocalStorageAvailable) {
6523
+ var key = getRestoreMsgsLsKey();
6524
+ try {
6525
+ messages = JSON.parse(localStorage.getItem(key)) || [];
6526
+ }
6527
+ catch (e) {
6528
+ }
6529
+ }
6530
+ return messages;
6531
+ }
6532
+ function saveSentMessages(text) {
6533
+ if (isLocalStorageAvailable) {
6534
+ var maxSavedForHistoryMsgCount = 25;
6535
+ var key = getRestoreMsgsLsKey();
6536
+ sentMessages.push(text);
6537
+ if (sentMessages.length > 50) {
6538
+ sentMessages = sentMessages.slice(Math.max(sentMessages.length - maxSavedForHistoryMsgCount, 0));
6539
+ }
6540
+ if (sentMessages.length > 0) {
6541
+ localStorage.setItem(key, JSON.stringify(sentMessages));
6542
+ }
6543
+ }
6544
+ }
6545
+ function switchMessages(keyCode) {
6546
+ var messages = __spreadArray([], sentMessages, true);
6547
+ messages = messages.reverse();
6548
+ if (messages.length === 0) {
6549
+ return;
6550
+ }
6551
+ if (keyCode === 38) {
6552
+ if (sentMessageInd === null || sentMessageInd + 1 === messages.length) {
6553
+ sentMessageInd = 0;
6554
+ }
6555
+ else {
6556
+ sentMessageInd = sentMessageInd + 1;
6557
+ }
6558
+ }
6559
+ if (keyCode === 40) {
6560
+ if (sentMessageInd === null || sentMessageInd - 1 === -1) {
6561
+ sentMessageInd = messages.length - 1;
6562
+ }
6563
+ else {
6564
+ sentMessageInd = sentMessageInd - 1;
6565
+ }
6566
+ }
6567
+ var textareaEl = getChatTextareaEl();
6568
+ textareaEl.value = messages[sentMessageInd];
6569
+ moveCursorToEnd(textareaEl);
6570
+ }
6571
+ function moveCursorToEnd(el) {
6572
+ el.focus();
6573
+ if (typeof el.selectionStart == "number") {
6574
+ el.selectionStart = el.selectionEnd = el.value.length;
6575
+ }
6576
+ else if (typeof el.createTextRange != "undefined") {
6577
+ var range = el.createTextRange();
6578
+ range.collapse(false);
6579
+ range.select();
6580
+ }
6581
+ }
6432
6582
  function onChatTextAreaKeyDown(e) {
6433
6583
  var keyCode = e.keyCode || e.which;
6434
6584
  if (keyCode === 13 && e.shiftKey) {
@@ -6443,6 +6593,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6443
6593
  e.stopPropagation();
6444
6594
  e.preventDefault();
6445
6595
  }
6596
+ var goToPrev = keyCode === 38;
6597
+ var goToNext = keyCode === 40;
6598
+ if (goToPrev || goToNext) {
6599
+ switchMessages(keyCode);
6600
+ e.stopPropagation();
6601
+ e.preventDefault();
6602
+ return;
6603
+ }
6446
6604
  }
6447
6605
  function disableVoiceEnabledBtn() {
6448
6606
  var muteAlanBtn = document.getElementById("chat-unmute-btn");
@@ -6486,7 +6644,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6486
6644
  }
6487
6645
  function hideKeyboard() {
6488
6646
  if (isMobile()) {
6489
- var chatTextarea = document.getElementById("chatTextarea");
6647
+ var chatTextarea = getChatTextareaEl();
6490
6648
  if (chatTextarea) {
6491
6649
  chatTextarea.blur();
6492
6650
  }
@@ -6505,10 +6663,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6505
6663
  var clickedEl = e.target;
6506
6664
  processClickByButtonInPopup(clickedEl, btnInstance, _sendText);
6507
6665
  }
6666
+ function getChatTextareaEl() {
6667
+ return document.getElementById("chatTextarea");
6668
+ }
6508
6669
  function initTextChat() {
6509
6670
  var _a, _b, _c;
6510
6671
  var textareaDiv = document.getElementById("textarea-holder");
6511
- var chatTextarea = document.getElementById("chatTextarea");
6672
+ var chatTextarea = getChatTextareaEl();
6512
6673
  var chatMicBtn = document.getElementById("chat-mic-btn");
6513
6674
  var unmuteAlanBtn = document.getElementById("chat-unmute-btn");
6514
6675
  var chatSendBtn = document.getElementById("chat-send-btn");
@@ -7523,6 +7684,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7523
7684
  var dndInitMousePos = [0, 0];
7524
7685
  var chatHeight, chatWidth, typeBorderHor, typeBorderVert;
7525
7686
  var chatInitLeftPos, chatInitRightPos, chatInitTopPos, chatInitBottomPos;
7687
+ var chatTopPosBeforeResize;
7688
+ var chatBottomPosBeforeResize;
7526
7689
  var chatRightAligned, chatLeftAligned, chatTopAligned, chatBottomAligned;
7527
7690
  if (!isMobile()) {
7528
7691
  chatHolderDiv.addEventListener("mousedown", onMouseDownForResizeTextChat);
@@ -7565,14 +7728,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7565
7728
  posInfo.clientX,
7566
7729
  posInfo.clientY
7567
7730
  ];
7568
- chatHeight = chatHolderDiv.getBoundingClientRect().height;
7569
- chatWidth = chatHolderDiv.getBoundingClientRect().width;
7731
+ var chatRect = chatHolderDiv.getBoundingClientRect();
7732
+ chatHeight = chatRect.height;
7733
+ chatWidth = chatRect.width;
7570
7734
  typeBorderHor = getBorderType(posInfo).typeBorderHor;
7571
7735
  typeBorderVert = getBorderType(posInfo).typeBorderVert;
7572
7736
  chatInitLeftPos = parseInt(chatHolderDiv.style.left);
7573
7737
  chatInitRightPos = parseInt(chatHolderDiv.style.right);
7574
7738
  chatInitTopPos = parseInt(chatHolderDiv.style.top);
7575
7739
  chatInitBottomPos = parseInt(chatHolderDiv.style.bottom);
7740
+ chatTopPosBeforeResize = chatRect.top;
7741
+ chatBottomPosBeforeResize = chatRect.bottom;
7576
7742
  chatRightAligned = chatHolderDiv.style.right;
7577
7743
  chatLeftAligned = chatHolderDiv.style.left;
7578
7744
  chatTopAligned = chatHolderDiv.style.top;
@@ -7625,8 +7791,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7625
7791
  var minChatHeight = ((_a = textChatOptions === null || textChatOptions === void 0 ? void 0 : textChatOptions.popup) === null || _a === void 0 ? void 0 : _a.minHeight) || defaultMinChatHeight;
7626
7792
  var expanding = borderType === "bottom" && delta > 0 || borderType === "top" && delta < 0;
7627
7793
  var h = borderType === "bottom" ? chatHeight + delta : chatHeight - delta;
7628
- var newBottomtPos = chatInitBottomPos - delta;
7629
- var newTopPos = chatInitTopPos + delta;
7794
+ var newBottomtPos = chatBottomPosBeforeResize - delta;
7795
+ var newTopPos = chatTopPosBeforeResize + delta;
7630
7796
  if (borderType === "bottom" && newBottomtPos <= 0 && h >= chatHeight) {
7631
7797
  return false;
7632
7798
  }