@crestapps/ai-chat-ui 2.0.0-preview.203 → 2.0.0-preview.215
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/ai-chat.js +4 -1
- package/dist/ai-chat.js.map +1 -1
- package/dist/ai-chat.min.js +1 -1
- package/dist/ai-chat.min.js.map +1 -1
- package/dist/chat-image-carousel.css +277 -0
- package/dist/chat-image-carousel.css.map +1 -0
- package/dist/chat-image-carousel.js +485 -0
- package/dist/chat-image-carousel.js.map +1 -0
- package/dist/chat-image-carousel.min.css +1 -0
- package/dist/chat-image-carousel.min.js +2 -0
- package/dist/chat-image-carousel.min.js.map +1 -0
- package/dist/chat-interaction.js +4 -1
- package/dist/chat-interaction.js.map +1 -1
- package/dist/chat-interaction.min.js +1 -1
- package/dist/chat-interaction.min.js.map +1 -1
- package/dist/chat-markers.js +77 -28
- package/dist/chat-markers.js.map +1 -1
- package/dist/chat-markers.min.js +1 -1
- package/dist/chat-markers.min.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["chat-image-carousel.js"],"names":["_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","_arrayLikeToArray","toString","slice","constructor","name","from","test","window","CoreAIChatImageCarousel","imageContainerClass","contentBetweenSelector","sizes","text","label","defaultSize","sizeStorageKey","activeIndexByCarouselKey","Map","drag","suppressNextClick","isOnlyWhitespaceBetween","previous","range","ownerDocument","createRange","setStartAfter","setEndBefore","between","cloneContents","textContent","trim","querySelector","buildCarousel","containers","firstParagraph","parentElement","vacatedParagraphs","Set","carousel","createElement","tabIndex","setAttribute","concat","dataset","carouselKey","firstImage","firstSource","getAttribute","getCarouselKey","carouselSize","storedSize","localStorage","getItem","some","size","_","getPreferredSize","stage","controls","caption","navigation","dots","before","forEach","container","index","sibling","previousSibling","nodeType","Node","TEXT_NODE","nodeName","remove","removeSeparatorsBefore","add","classList","image","dot","type","carouselTarget","appendChild","append","createStepButton","selectedSize","picker","_step4","_iterator4","button","title","carouselSizeOption","err","createSizePicker","_step3","_iterator3","paragraph","showImage","get","tagName","className","element","step","icon","carouselStep","innerHTML","getItems","querySelectorAll","getActiveIndex","Number","activeIndex","requestedIndex","items","Math","max","min","children","lastElementChild","item","offset","isActive","downloadLink","stackOffset","furthestVisibleOffset","toggle","activeImage","altText","imageCount","disabled","set","stopEvent","event","preventDefault","stopPropagation","endDrag","style","removeProperty","document","addEventListener","target","closest","detail","stepButton","sizeButton","setItem","_step5","_iterator5","_step6","_iterator6","setPreferredSize","contains","prototype","indexOf","key","pointerId","startX","clientX","startY","clientY","distance","isSwiping","abs","setProperty","_drag","removeAttribute","after","stackAdjacentImages","html","firstContainerIndex","template","runs","root","_step2","run","_iterator2","push","filter","candidate","findImageRuns","content","_step","_iterator"],"mappings":"AAKA,SAASA,2BAA2BC,EAAGC,GAAK,IAAIC,EAAI,oBAAsBC,QAAUH,EAAEG,OAAOC,WAAaJ,EAAE,cAAe,IAAKE,EAAG,CAAE,GAAIG,MAAMC,QAAQN,KAAOE,EAAIK,4BAA4BP,KAAOC,GAAKD,GAAK,iBAAmBA,EAAEQ,OAAQ,CAAEN,IAAMF,EAAIE,GAAI,IAAIO,EAAK,EAAGC,EAAI,WAAc,EAAG,MAAO,CAAEC,EAAGD,EAAGE,EAAG,WAAe,OAAOH,GAAMT,EAAEQ,OAAS,CAAEK,MAAM,GAAO,CAAEA,MAAM,EAAIC,MAAOd,EAAES,KAAS,EAAGR,EAAG,SAAWD,GAAK,MAAMA,CAAG,EAAGe,EAAGL,EAAK,CAAE,MAAM,IAAIM,UAAU,wIAA0I,CAAE,IAAIC,EAAGC,GAAI,EAAIC,GAAI,EAAI,MAAO,CAAER,EAAG,WAAeT,EAAIA,EAAEkB,KAAKpB,EAAI,EAAGY,EAAG,WAAe,IAAIZ,EAAIE,EAAEmB,OAAQ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AqD,MAApC6B,EAAU7B,cAAc8D,SAMpD0E,EAAIzL,OAAS,IAAMkC,EAAwBuJ,EAAIA,EAAIzL,OAAS,GAAI8E,KAChEwG,EAAKK,KAAKF,GACVA,EAAM,IAGVA,EAAIE,KAAK7G,KAVLwG,EAAKK,KAAKF,GACVA,EAAM,GAUd,CAAC,CAAA,MAAAjF,GAAAkF,EAAAjM,EAAA+G,EAAA,CAAA,QAAAkF,EAAAnL,GAAA,CAID,OAFA+K,EAAKK,KAAKF,GAEHH,EAAKM,OAAO,SAAAC,GAAS,OAAIA,EAAU7L,OAAS,CAAC,EACxD,CAtCiB8L,CAAcT,EAASU,SAEpC,GAAoB,IAAhBT,EAAKtL,OACL,OAAOmL,EACV,IAEqBa,EAFrBC,EAAA1M,2BAEiB+L,GAAI,IAAtB,IAAAW,EAAA9L,MAAA6L,EAAAC,EAAA7L,KAAAC,MAAwB,CACpByC,EADUkJ,EAAA1L,MAEd,CAAC,CAAA,MAAAkG,GAAAyF,EAAAxM,EAAA+G,EAAA,CAAA,QAAAyF,EAAA1L,GAAA,CAED,OAAO8K,EAAShE,SACpB,EAicJ,CAhgBoE","file":"chat-image-carousel.min.js","sourcesContent":["/*\n * Stacks the pictures a single answer shows one after another into one carousel.\n *\n * A tool that previews a document -- slides, sheets, pages -- hands back one figure marker per picture, all on a\n * line of their own, and each one renders at full thumbnail size: eight slides is eight thumbnails running down\n * the conversation. Here a run of two or more pictures with nothing but whitespace between them becomes a stack\n * of cards instead: the current picture in front, its neighbours fanned out behind it, moved through by swiping,\n * clicking a neighbour, the arrows, the dots or the arrow keys. A picture written mid-sentence keeps its place.\n *\n * It works on the sanitized HTML every chat surface already produces, so the surfaces share one implementation\n * without sharing a renderer, and the carousel is written in the same pass as the message -- there is no frame\n * of full-size pictures before they are gathered up. HTML with no such run is handed back exactly as it came.\n *\n * Loaded on its own, like chat-markers.js, and optional: a surface without it renders the pictures as before.\n */\nwindow.CoreAIChatImageCarousel = window.CoreAIChatImageCarousel || (function () {\n 'use strict';\n\n const imageContainerClass = 'generated-image-container';\n\n // How far a drag has to travel before it counts as a swipe rather than a click.\n const swipeThreshold = 40;\n\n // How far a drag has to travel before the card starts following the pointer.\n const dragStartThreshold = 8;\n\n // Cards further than this from the current one are stacked out of sight behind the last visible one.\n const furthestVisibleOffset = 2;\n\n // Anything that is content in its own right, so pictures either side of it are not one run.\n const contentBetweenSelector = 'img, svg, canvas, video, audio, iframe, table, hr, input';\n\n const previousIcon = '<svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M10 3 5 8l5 5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>';\n const nextIcon = '<svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" focusable=\"false\"><path d=\"m6 3 5 5-5 5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>';\n\n // How large the reader wants previews drawn. It is the reader's taste rather than the answer's, so one choice\n // applies to every carousel on the page and is kept in the browser for the next visit.\n const sizes = [\n { name: 'small', text: 'S', label: 'Small previews' },\n { name: 'medium', text: 'M', label: 'Medium previews' },\n { name: 'large', text: 'L', label: 'Large previews' },\n ];\n const defaultSize = 'medium';\n const sizeStorageKey = 'coreai-image-carousel-size';\n\n // A streamed answer is re-rendered on every chunk, and every render builds the carousel afresh. The picture\n // the reader moved to is remembered here so the next render opens on it rather than back on the first.\n const activeIndexByCarouselKey = new Map();\n\n let drag = null;\n let suppressNextClick = false;\n\n\n function stackAdjacentImages(html) {\n if (typeof document === 'undefined' || !html) {\n return html;\n }\n\n const firstContainerIndex = html.indexOf(imageContainerClass);\n\n if (firstContainerIndex < 0 || html.indexOf(imageContainerClass, firstContainerIndex + imageContainerClass.length) < 0) {\n return html;\n }\n\n const template = document.createElement('template');\n template.innerHTML = html;\n\n const runs = findImageRuns(template.content);\n\n if (runs.length === 0) {\n return html;\n }\n\n for (const run of runs) {\n buildCarousel(run);\n }\n\n return template.innerHTML;\n }\n\n\n function findImageRuns(root) {\n const runs = [];\n let run = [];\n\n for (const container of root.querySelectorAll('.' + imageContainerClass)) {\n // Only a picture standing in a paragraph is gathered. One in a list, a table cell or a link belongs\n // to that structure, and lifting it out would change what the answer says.\n if (!container.parentElement || container.parentElement.tagName !== 'P') {\n runs.push(run);\n run = [];\n continue;\n }\n\n if (run.length > 0 && !isOnlyWhitespaceBetween(run[run.length - 1], container)) {\n runs.push(run);\n run = [];\n }\n\n run.push(container);\n }\n\n runs.push(run);\n\n return runs.filter(candidate => candidate.length > 1);\n }\n\n\n // Two pictures belong to one run when nothing a reader would read sits between them: spaces and line breaks\n // within a paragraph, or the boundary between two paragraphs that hold nothing else.\n function isOnlyWhitespaceBetween(previous, next) {\n const range = previous.ownerDocument.createRange();\n range.setStartAfter(previous);\n range.setEndBefore(next);\n\n const between = range.cloneContents();\n\n return between.textContent.trim() === '' && !between.querySelector(contentBetweenSelector);\n }\n\n\n function buildCarousel(containers) {\n const ownerDocument = containers[0].ownerDocument;\n const firstParagraph = containers[0].parentElement;\n const vacatedParagraphs = new Set();\n\n // Spans throughout, for the same reason the picture's own wrapper is one: the carousel sits inside the\n // paragraph the first picture was in, and a block element there would close that paragraph.\n const carousel = createElement(ownerDocument, 'span', 'ai-image-carousel');\n carousel.tabIndex = 0;\n carousel.setAttribute('role', 'region');\n carousel.setAttribute('aria-roledescription', 'carousel');\n carousel.setAttribute('aria-label', `${containers.length} images`);\n carousel.dataset.carouselKey = getCarouselKey(containers);\n carousel.dataset.carouselSize = getPreferredSize();\n\n const stage = createElement(ownerDocument, 'span', 'ai-image-carousel-stage');\n const controls = createElement(ownerDocument, 'span', 'ai-image-carousel-controls');\n const caption = createElement(ownerDocument, 'span', 'ai-image-carousel-caption');\n const navigation = createElement(ownerDocument, 'span', 'ai-image-carousel-navigation');\n const dots = createElement(ownerDocument, 'span', 'ai-image-carousel-dots');\n\n caption.setAttribute('aria-live', 'polite');\n containers[0].before(carousel);\n\n containers.forEach((container, index) => {\n removeSeparatorsBefore(container);\n\n if (container.parentElement !== firstParagraph) {\n vacatedParagraphs.add(container.parentElement);\n }\n\n container.classList.add('ai-image-carousel-item');\n\n const image = container.querySelector('img');\n\n // The browser's own image drag would otherwise take over the pointer the moment a swipe starts.\n if (image) {\n image.setAttribute('draggable', 'false');\n }\n\n const dot = createElement(ownerDocument, 'button', 'ai-image-carousel-dot');\n dot.type = 'button';\n dot.dataset.carouselTarget = index;\n dot.setAttribute('aria-label', `Show image ${index + 1}`);\n dots.appendChild(dot);\n\n stage.appendChild(container);\n });\n\n navigation.append(\n createStepButton(ownerDocument, -1, 'Previous image', previousIcon),\n dots,\n createStepButton(ownerDocument, 1, 'Next image', nextIcon));\n\n controls.append(caption, createSizePicker(ownerDocument, carousel.dataset.carouselSize), navigation);\n carousel.append(stage, controls);\n\n for (const paragraph of vacatedParagraphs) {\n if (paragraph.textContent.trim() === '' && !paragraph.querySelector(contentBetweenSelector)) {\n paragraph.remove();\n }\n }\n\n showImage(carousel, activeIndexByCarouselKey.get(carousel.dataset.carouselKey) || 0);\n }\n\n\n // Whatever separated this picture from the one before it -- a space, a line break -- is all that is left once\n // the pictures have moved into the carousel, and it would otherwise trail the carousel as a blank line.\n function removeSeparatorsBefore(container) {\n let sibling = container.previousSibling;\n\n while (sibling && ((sibling.nodeType === Node.TEXT_NODE && sibling.textContent.trim() === '') || sibling.nodeName === 'BR')) {\n const previousSibling = sibling.previousSibling;\n sibling.remove();\n sibling = previousSibling;\n }\n }\n\n\n // Cheap rather than exact: a generated image can be a data URI hundreds of kilobytes long, so only the tail\n // of the first address -- where a served document's identifier sits -- and the number of pictures are used.\n function getCarouselKey(containers) {\n const firstImage = containers[0].querySelector('img');\n const firstSource = firstImage ? firstImage.getAttribute('src') || '' : '';\n\n return `${containers.length}:${firstSource.slice(-120)}`;\n }\n\n\n function createElement(ownerDocument, tagName, className) {\n const element = ownerDocument.createElement(tagName);\n element.className = className;\n\n return element;\n }\n\n\n function createStepButton(ownerDocument, step, label, icon) {\n const button = createElement(ownerDocument, 'button', 'ai-image-carousel-button');\n button.type = 'button';\n button.dataset.carouselStep = step;\n button.setAttribute('aria-label', label);\n button.innerHTML = icon;\n\n return button;\n }\n\n\n // A segmented S / M / L control.\n function createSizePicker(ownerDocument, selectedSize) {\n const picker = createElement(ownerDocument, 'span', 'ai-image-carousel-sizes');\n picker.setAttribute('role', 'group');\n picker.setAttribute('aria-label', 'Preview size');\n\n for (const size of sizes) {\n const button = createElement(ownerDocument, 'button', 'ai-image-carousel-size');\n button.type = 'button';\n button.title = size.label;\n button.textContent = size.text;\n button.dataset.carouselSizeOption = size.name;\n button.setAttribute('aria-label', size.label);\n button.setAttribute('aria-pressed', size.name === selectedSize ? 'true' : 'false');\n picker.appendChild(button);\n }\n\n return picker;\n }\n\n\n // Storage can be missing or refuse access -- a private window, blocked site data -- and the default is a fine\n // answer then.\n function getPreferredSize() {\n try {\n const storedSize = localStorage.getItem(sizeStorageKey);\n\n return sizes.some(size => size.name === storedSize) ? storedSize : defaultSize;\n } catch (_) {\n return defaultSize;\n }\n }\n\n\n function setPreferredSize(selectedSize) {\n try {\n localStorage.setItem(sizeStorageKey, selectedSize);\n } catch (_) {\n // Still applied to the page; only remembering it for the next visit is lost.\n }\n\n for (const carousel of document.querySelectorAll('.ai-image-carousel')) {\n carousel.dataset.carouselSize = selectedSize;\n }\n\n for (const button of document.querySelectorAll('[data-carousel-size-option]')) {\n button.setAttribute('aria-pressed', button.dataset.carouselSizeOption === selectedSize ? 'true' : 'false');\n }\n }\n\n\n function getItems(carousel) {\n return carousel.querySelectorAll('.ai-image-carousel-stage > .ai-image-carousel-item');\n }\n\n\n function getActiveIndex(carousel) {\n return Number(carousel.dataset.activeIndex) || 0;\n }\n\n\n function showImage(carousel, requestedIndex) {\n const items = getItems(carousel);\n\n if (items.length === 0) {\n carousel.remove();\n\n return;\n }\n\n const activeIndex = Math.max(0, Math.min(items.length - 1, requestedIndex));\n const dots = carousel.querySelector('.ai-image-carousel-dots');\n\n while (dots.children.length > items.length) {\n dots.lastElementChild.remove();\n }\n\n items.forEach((item, index) => {\n const offset = index - activeIndex;\n const isActive = offset === 0;\n const downloadLink = item.querySelector('a');\n\n item.dataset.stackOffset = Math.max(-furthestVisibleOffset - 1, Math.min(furthestVisibleOffset + 1, offset));\n item.classList.toggle('is-active', isActive);\n item.setAttribute('aria-hidden', isActive ? 'false' : 'true');\n\n // A card behind the current one is hidden from assistive technology, so nothing in it may take focus.\n if (downloadLink) {\n downloadLink.tabIndex = isActive ? 0 : -1;\n }\n\n dots.children[index].classList.toggle('is-active', isActive);\n dots.children[index].setAttribute('aria-current', isActive ? 'true' : 'false');\n });\n\n const activeImage = items[activeIndex].querySelector('img');\n const altText = activeImage ? activeImage.getAttribute('alt') : '';\n\n carousel.dataset.activeIndex = activeIndex;\n carousel.dataset.imageCount = items.length;\n carousel.querySelector('[data-carousel-step=\"-1\"]').disabled = activeIndex === 0;\n carousel.querySelector('[data-carousel-step=\"1\"]').disabled = activeIndex === items.length - 1;\n carousel.querySelector('.ai-image-carousel-caption').textContent = altText\n ? `${activeIndex + 1} / ${items.length} · ${altText}`\n : `${activeIndex + 1} / ${items.length}`;\n\n activeIndexByCarouselKey.set(carousel.dataset.carouselKey, activeIndex);\n }\n\n\n function stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n\n // Captured, so it runs before anything bound to the picture itself: a card behind the current one is brought\n // to the front, and is not zoomed or downloaded on the way.\n function onClick(event) {\n const carousel = event.target.closest && event.target.closest('.ai-image-carousel');\n\n if (!carousel) {\n return;\n }\n\n // A click raised from the keyboard has no pointer behind it, so a swipe that ended without one -- a touch\n // swipe, or a drag released outside the carousel -- must not swallow it.\n if (suppressNextClick && event.detail > 0) {\n suppressNextClick = false;\n stopEvent(event);\n\n return;\n }\n\n const stepButton = event.target.closest('[data-carousel-step]');\n\n if (stepButton) {\n stopEvent(event);\n showImage(carousel, getActiveIndex(carousel) + Number(stepButton.dataset.carouselStep));\n\n return;\n }\n\n const sizeButton = event.target.closest('[data-carousel-size-option]');\n\n if (sizeButton) {\n stopEvent(event);\n setPreferredSize(sizeButton.dataset.carouselSizeOption);\n\n return;\n }\n\n const dot = event.target.closest('[data-carousel-target]');\n\n if (dot) {\n stopEvent(event);\n showImage(carousel, Number(dot.dataset.carouselTarget));\n\n return;\n }\n\n const item = event.target.closest('.ai-image-carousel-item');\n\n if (item && !item.classList.contains('is-active')) {\n stopEvent(event);\n showImage(carousel, Array.prototype.indexOf.call(getItems(carousel), item));\n }\n }\n\n\n // Only while the carousel has focus, so the arrow keys still move the caret in the prompt.\n function onKeyDown(event) {\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') {\n return;\n }\n\n const carousel = event.target.closest && event.target.closest('.ai-image-carousel');\n\n if (!carousel) {\n return;\n }\n\n event.preventDefault();\n showImage(carousel, getActiveIndex(carousel) + (event.key === 'ArrowRight' ? 1 : -1));\n }\n\n\n function onPointerDown(event) {\n suppressNextClick = false;\n\n const stage = event.button === 0 && event.target.closest && event.target.closest('.ai-image-carousel-stage');\n\n if (!stage) {\n return;\n }\n\n drag = {\n stage: stage,\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n distance: 0,\n isSwiping: false,\n };\n }\n\n\n // The pointer is not captured: a captured pointer retargets the click that follows to the stage, and the click\n // is what brings a card forward or opens the zoom. Listening on the document follows the pointer anyway.\n function onPointerMove(event) {\n if (!drag || event.pointerId !== drag.pointerId) {\n return;\n }\n\n const distance = event.clientX - drag.startX;\n\n if (!drag.isSwiping) {\n if (Math.abs(distance) < dragStartThreshold || Math.abs(distance) < Math.abs(event.clientY - drag.startY)) {\n return;\n }\n\n drag.isSwiping = true;\n drag.stage.classList.add('is-dragging');\n }\n\n drag.distance = distance;\n drag.stage.style.setProperty('--ai-image-carousel-drag', `${distance}px`);\n }\n\n\n function onPointerUp(event) {\n if (!drag || event.pointerId !== drag.pointerId) {\n return;\n }\n\n const { stage, distance, isSwiping } = drag;\n\n endDrag();\n\n if (!isSwiping) {\n return;\n }\n\n // The click the browser fires at the end of a drag is not a click on whatever the pointer ended over.\n suppressNextClick = true;\n\n if (Math.abs(distance) >= swipeThreshold) {\n const carousel = stage.closest('.ai-image-carousel');\n showImage(carousel, getActiveIndex(carousel) + (distance < 0 ? 1 : -1));\n }\n }\n\n\n function endDrag() {\n if (!drag) {\n return;\n }\n\n drag.stage.classList.remove('is-dragging');\n drag.stage.style.removeProperty('--ai-image-carousel-drag');\n drag = null;\n }\n\n\n // A picture the server will not serve is taken out of the stack and put back just after it, where the\n // surface's own handler hides it and says it could not be loaded, exactly as it does for a lone picture.\n // Captured on the document because an image's error event does not bubble.\n function onImageError(event) {\n const item = event.target.tagName === 'IMG' && event.target.closest('.ai-image-carousel-item');\n\n if (!item) {\n return;\n }\n\n const carousel = item.closest('.ai-image-carousel');\n\n item.classList.remove('ai-image-carousel-item', 'is-active');\n item.removeAttribute('data-stack-offset');\n item.removeAttribute('aria-hidden');\n carousel.after(item);\n showImage(carousel, getActiveIndex(carousel));\n }\n\n\n if (typeof document !== 'undefined') {\n document.addEventListener('click', onClick, true);\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('pointerdown', onPointerDown);\n document.addEventListener('pointermove', onPointerMove);\n document.addEventListener('pointerup', onPointerUp);\n document.addEventListener('pointercancel', endDrag);\n document.addEventListener('error', onImageError, true);\n }\n\n return {\n stackAdjacentImages: stackAdjacentImages,\n };\n})();\n"]}
|
package/dist/chat-interaction.js
CHANGED
|
@@ -653,10 +653,13 @@ window.chatInteractionManager = function (_window$CoreAIChatMar, _window$CoreAIC
|
|
|
653
653
|
renderer: renderer
|
|
654
654
|
}));
|
|
655
655
|
message._pendingCharts = _pendingCharts.length > 0 ? _toConsumableArray(_pendingCharts) : [];
|
|
656
|
-
|
|
656
|
+
var sanitizedHtml = DOMPurify.sanitize(html, {
|
|
657
657
|
ADD_TAGS: ['canvas'],
|
|
658
658
|
ADD_ATTR: ['target']
|
|
659
659
|
});
|
|
660
|
+
|
|
661
|
+
// Optional, shared with every chat surface: a run of pictures becomes one stacked carousel.
|
|
662
|
+
return window.CoreAIChatImageCarousel ? window.CoreAIChatImageCarousel.stackAdjacentImages(sanitizedHtml) : sanitizedHtml;
|
|
660
663
|
}
|
|
661
664
|
function compactObject(source) {
|
|
662
665
|
if (!source || _typeof(source) !== 'object') {
|