@alan-ai/alan-sdk-web 1.8.132 → 1.8.134

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
@@ -85739,6 +85739,7 @@
85739
85739
  function copyTextToBuffer(text3) {
85740
85740
  const el = document.createElement("textarea");
85741
85741
  el.value = text3;
85742
+ el.setAttribute("name", "alan-copy-textarea-" + Date.now());
85742
85743
  document.body.appendChild(el);
85743
85744
  el.select();
85744
85745
  document.execCommand("copy");
@@ -85772,7 +85773,7 @@
85772
85773
  const placeholderText = iframeText ? `Embedded content: ${iframeText}` : "Embedded content";
85773
85774
  const placeholderDiv = document.createElement("div");
85774
85775
  placeholderDiv.style.cssText = "width: 100%; min-height: 20px; border: 1px solid #ccc; padding: 10px; box-sizing: border-box; font-style: italic; color: #666;";
85775
- placeholderDiv.innerHTML = `${placeholderText}<br><br><br><a href="${iframe.src}" target="_blank">${iframe.src}</a>`;
85776
+ placeholderDiv.innerHTML = `${placeholderText}<br><br><a href="${iframe.src}" target="_blank">${iframe.src}</a>`;
85776
85777
  embedContainer.replaceWith(placeholderDiv);
85777
85778
  }
85778
85779
  });
@@ -85805,9 +85806,35 @@
85805
85806
  font-weight: bold !important;
85806
85807
  }
85807
85808
  `;
85808
- const inlinedHtml = juice.inlineContent(rawHtml, css2);
85809
+ let inlinedHtml;
85810
+ try {
85811
+ inlinedHtml = juice.inlineContent(rawHtml, css2);
85812
+ } catch (err) {
85813
+ console.warn("Failed to inline styles with Juice (possible DOM clobbering):", err);
85814
+ inlinedHtml = rawHtml;
85815
+ }
85809
85816
  const blobHtml = new Blob([inlinedHtml], { type: "text/html" });
85810
- const plainText = bubbleToCopy.innerText.replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
85817
+ const codeBlocks = [];
85818
+ const tempElement = bubbleToCopy.cloneNode(true);
85819
+ tempElement.querySelectorAll("pre").forEach((pre, index2) => {
85820
+ const placeholder = `<<<CODE_BLOCK_${index2}>>>`;
85821
+ codeBlocks.push(pre.textContent || "");
85822
+ pre.textContent = placeholder;
85823
+ });
85824
+ let plainText = tempElement.innerText;
85825
+ const lines = plainText.split("\n");
85826
+ const processedLines = lines.map((line) => {
85827
+ if (line.includes("<<<CODE_BLOCK_")) {
85828
+ return line;
85829
+ }
85830
+ return line.replace(/[ \t]+/g, " ").trim();
85831
+ });
85832
+ plainText = processedLines.join("\n");
85833
+ codeBlocks.forEach((code2, index2) => {
85834
+ const placeholder = `<<<CODE_BLOCK_${index2}>>>`;
85835
+ plainText = plainText.replace(placeholder, "\n\n" + code2);
85836
+ });
85837
+ plainText = plainText.replace(/\n{3,}/g, "\n\n").trim();
85811
85838
  const blobText = new Blob([plainText], { type: "text/plain" });
85812
85839
  const data3 = [new ClipboardItem({
85813
85840
  "text/html": blobHtml,
@@ -99152,7 +99179,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
99152
99179
  // alan_btn/alan_btn.ts
99153
99180
  (function(ns) {
99154
99181
  const uiState10 = getUIState();
99155
- const version2 = "alan-version.1.8.132".replace("alan-version.", "");
99182
+ const version2 = "alan-version.1.8.134".replace("alan-version.", "");
99156
99183
  uiState10.lib.version = version2;
99157
99184
  window.alanLib = { version: version2 };
99158
99185
  if (window.alanBtn) {
@@ -101714,7 +101741,8 @@ ${curDialogId}`);
101714
101741
  ".alan-btn__chat-graph",
101715
101742
  ".alan-btn__chat-suggestions",
101716
101743
  ".alan-btn__chat-response-imgs-wrapper-right-arrow",
101717
- ".alan-btn__chat-response-imgs-wrapper-left-arrow"
101744
+ ".alan-btn__chat-response-imgs-wrapper-left-arrow",
101745
+ ".alan-btn__chat-response__copy-code-btn"
101718
101746
  ],
101719
101747
  [
101720
101748
  ".alan-btn__chat-response-img"