@8wave/ai-elements 0.125.0-beta.17 → 0.125.0-beta.19
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/README.md +1 -0
- package/dist/_chunks/{PkChatbotFilePreview-xDlDvl5m.js → PkChatbotFilePreview-CFGqa-tX.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-xDlDvl5m.js.map → PkChatbotFilePreview-CFGqa-tX.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-BIFkMsAC.js → PkFilePreview-BzNLupQS.js} +318 -315
- package/dist/_chunks/PkFilePreview-BzNLupQS.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-NLk4gZMd.js → PkFilePreviewDialog-BfZFgdOi.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-NLk4gZMd.js.map → PkFilePreviewDialog-BfZFgdOi.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-BFTTLuPc.js → PkStreamingMarkdown-CqLpNWQv.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-BFTTLuPc.js.map → PkStreamingMarkdown-CqLpNWQv.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-Buv7Qkes.js → PkToolChatFile-iE4ZokYD.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-Buv7Qkes.js.map → PkToolChatFile-iE4ZokYD.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-kB0qoQda.js → PkToolShareDocument-lTHNZodf.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-kB0qoQda.js.map → PkToolShareDocument-lTHNZodf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-ClYqvIqB.js → PkToolShowArtifact-BNQrM5fY.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-ClYqvIqB.js.map → PkToolShowArtifact-BNQrM5fY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-C0ABjvtZ.js → PkToolShowContactForm-CvQoLumn.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-C0ABjvtZ.js.map → PkToolShowContactForm-CvQoLumn.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-BZbHtEs5.js → PkToolShowDiagram-COt1Z3q9.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-BZbHtEs5.js.map → PkToolShowDiagram-COt1Z3q9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DUjR-9o1.js → PkToolShowForm-DcPccCEU.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-DUjR-9o1.js.map → PkToolShowForm-DcPccCEU.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CNU2Zvso.js → PkToolShowImageGallery-DefXra8-.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-CNU2Zvso.js.map → PkToolShowImageGallery-DefXra8-.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-DhDjNIFa.js → PkToolShowSources-BE3Zv_uz.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-DhDjNIFa.js.map → PkToolShowSources-BE3Zv_uz.js.map} +1 -1
- package/dist/_chunks/{useLightbox-BEEzZ0qT.js → useLightbox-D2Zi-Fpe.js} +72 -13
- package/dist/_chunks/useLightbox-D2Zi-Fpe.js.map +1 -0
- package/dist/ai-elements.es.js +461 -429
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-BtUaZ-LR.js → PkChatbot-BVZgvanv.js} +7 -7
- package/dist-vue/_chunks/{PkChatbot-BtUaZ-LR.js.map → PkChatbot-BVZgvanv.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-DJIkAskP.js → PkChatbotEmptyState-COya3H3C.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-DJIkAskP.js.map → PkChatbotEmptyState-COya3H3C.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BpVM850N.js → PkChatbotFilePreview-BsvT6orx.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFilePreview-BpVM850N.js.map → PkChatbotFilePreview-BsvT6orx.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-DzqaW3EE.js → PkChatbotInput-D0KUEkAs.js} +5 -4
- package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-vkbq5p1X.js → PkChatbotMessages-l-IzEWsN.js} +17 -17
- package/dist-vue/_chunks/{PkChatbotMessages-vkbq5p1X.js.map → PkChatbotMessages-l-IzEWsN.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-D5yz8lut.js → PkChatbotSteps-_Aqft0em.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-D5yz8lut.js.map → PkChatbotSteps-_Aqft0em.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-DCPRePrE.js → PkChatbotViewChat-C1uzFQCJ.js} +458 -453
- package/dist-vue/_chunks/PkChatbotViewChat-C1uzFQCJ.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-BBd3XMmM.js → PkChatbotViewConversations-DjhiHp8-.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BBd3XMmM.js.map → PkChatbotViewConversations-DjhiHp8-.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-BiQzDqJg.js → PkChatbotViewFiles-CtOhnFCc.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-BiQzDqJg.js.map → PkChatbotViewFiles-CtOhnFCc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-7266UiRM.js → PkChatbotViewProfile-NfTamy9j.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-7266UiRM.js.map → PkChatbotViewProfile-NfTamy9j.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-DLo9nI2g.js → PkFilePreview-C2VOU99H.js} +469 -466
- package/dist-vue/_chunks/PkFilePreview-C2VOU99H.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-CgDJQgIJ.js → PkFilePreviewDialog-C6QQMntW.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-CgDJQgIJ.js.map → PkFilePreviewDialog-C6QQMntW.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-C3UGCEXm.js → PkStreamingMarkdown-2FN4WMQD.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-C3UGCEXm.js.map → PkStreamingMarkdown-2FN4WMQD.js.map} +1 -1
- package/dist-vue/_chunks/{PkSvgViewer-DmkElalq.js → PkSvgViewer-BsdSOBpH.js} +2 -2
- package/dist-vue/_chunks/{PkSvgViewer-DmkElalq.js.map → PkSvgViewer-BsdSOBpH.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-Dy0rGC29.js → PkToolChatFile-DAT1tv52.js} +2 -2
- package/dist-vue/_chunks/{PkToolChatFile-Dy0rGC29.js.map → PkToolChatFile-DAT1tv52.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-BIZkgcJ3.js → PkToolShareDocument-Qb2Lu5vh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-BIZkgcJ3.js.map → PkToolShareDocument-Qb2Lu5vh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-B7udnhpb.js → PkToolShowArtifact-Bskomw05.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-B7udnhpb.js.map → PkToolShowArtifact-Bskomw05.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-0SEgxn2S.js → PkToolShowContactForm-iQrlqv7j.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-0SEgxn2S.js.map → PkToolShowContactForm-iQrlqv7j.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-BqHBhZgd.js → PkToolShowDiagram-C-43uUoh.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-BqHBhZgd.js.map → PkToolShowDiagram-C-43uUoh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-C4n_3mFL.js → PkToolShowForm-CKXpqQxy.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-C4n_3mFL.js.map → PkToolShowForm-CKXpqQxy.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-DEpdtLns.js → PkToolShowImageGallery-DLTn6JmU.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowImageGallery-DEpdtLns.js.map → PkToolShowImageGallery-DLTn6JmU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowLocation-DCPaDtBI.js → PkToolShowLocation-B8FE_Sqd.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowLocation-DCPaDtBI.js.map → PkToolShowLocation-B8FE_Sqd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-Bm2NLUGS.js → PkToolShowProductList-hhSBAQVC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-Bm2NLUGS.js.map → PkToolShowProductList-hhSBAQVC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-DwFqlit2.js → PkToolShowSources-BiP9fVV2.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-DwFqlit2.js.map → PkToolShowSources-BiP9fVV2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-BLEJ8tng.js → PkToolShowVideo-DJhsbDuX.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-BLEJ8tng.js.map → PkToolShowVideo-DJhsbDuX.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CeAXllAF.js → PkToolShowWebPages-BAv66f5H.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CeAXllAF.js.map → PkToolShowWebPages-BAv66f5H.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BPN6cLGF.js → createChatbotApiClient-DO4_I5hT.js} +8 -1
- package/dist-vue/_chunks/createChatbotApiClient-DO4_I5hT.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-C4xhJtrb.js → useChatbotStore-BZ1n3Hyx.js} +662 -649
- package/dist-vue/_chunks/useChatbotStore-BZ1n3Hyx.js.map +1 -0
- package/dist-vue/_chunks/{useLightbox-gSzoBgNv.js → useLightbox-FDyQrPWe.js} +72 -13
- package/dist-vue/_chunks/useLightbox-FDyQrPWe.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +8 -2
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +25 -25
- package/dist-vue/locales.js +6 -0
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +2 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +6 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +4 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-BIFkMsAC.js.map +0 -1
- package/dist/_chunks/useLightbox-BEEzZ0qT.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-DzqaW3EE.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-DCPRePrE.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-DLo9nI2g.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BPN6cLGF.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-C4xhJtrb.js.map +0 -1
- package/dist-vue/_chunks/useLightbox-gSzoBgNv.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLightbox-BEEzZ0qT.js","names":["inject","provide","onBeforeUnmount","onMounted","ref","init_runtime_core_esm_bundler","init_reactivity_esm_bundler","shallowRef","useI18n","loadCdnCss","PHOTOSWIPE_CSS","DEFAULT_IMAGE_SIZE","MAX_ZOOM_LAYER_WIDTH","ZOOM_KEYS","SHARED_LIGHTBOX","SHARED_ITEMS","useLightbox","options","lightbox","sharedLightbox","shared","useSharedLightbox","$t","unmounted","gallery","injectPhotoSwipeOverrides","PhotoSwipeLightbox","zoomLevel","linkEl","itemData","element","src","caption","pswp","openInNewTab","downloadable","ui","url","getCurrentSlideUrl","downloadImage","event","factor","key","slide","ctrlKey","metaKey","altKey","provideSharedLightbox","container","joined","started","start","init","useImageSizes","sizes","image","images","img","downloadUrl","toDownloadUrl","anchor","getFilenameFromUrl","name","overridesInjected","style"],"sources":["../../../../packages/components/src/composables/useLightbox.ts"],"sourcesContent":["import {\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n type InjectionKey,\n type Ref,\n type ShallowRef,\n} from 'vue'\nimport { useI18n } from 'vue-i18n'\nimport type PhotoSwipeLightbox from 'photoswipe/lightbox'\nimport type PhotoSwipe from 'photoswipe'\nimport { loadCdnCss } from 'utils'\n\nconst PHOTOSWIPE_CSS =\n 'https://cdn.jsdelivr.net/npm/photoswipe@5/dist/photoswipe.css'\n\nconst DEFAULT_IMAGE_SIZE = { width: 1200, height: 800 }\n\n// The widest layer a zoom may draw, PhotoSwipe's own cap for its default\n// secondary zoom level: past it a very large image stops short of 100%.\nconst MAX_ZOOM_LAYER_WIDTH = 4000\n\n// The zoom factor of one press of `+` or `-`, with or without Shift.\nconst ZOOM_KEYS: Record<string, number | undefined> = {\n '+': 1.25,\n '=': 1.25,\n '-': 0.8,\n _: 0.8,\n}\n\n/** The shared lightbox of a container, as the components inside see it. */\nexport interface SharedLightbox {\n /** An item joined: the first one starts the lightbox. */\n join: () => void\n}\n\n/** Lets the components inside a container join its shared lightbox. */\nconst SHARED_LIGHTBOX: InjectionKey<SharedLightbox> = Symbol('sharedLightbox')\n\n/**\n * The items of a shared lightbox: the anchors of the components that joined\n * it, and the images of a markdown that joined it, except an image inside a\n * link, which opens the link.\n */\nconst SHARED_ITEMS =\n 'a[data-pswp-src][data-pswp-shared], [data-pswp-images] img:not(a img)'\n\nexport interface LightboxImage {\n url: string\n caption?: string\n alt?: string\n /** Natural width in px, used by PhotoSwipe for proper sizing. */\n width?: number\n /** Natural height in px, used by PhotoSwipe for proper sizing. */\n height?: number\n}\n\nexport interface LightboxOptions {\n /** Container element whose child anchors are the gallery items */\n gallery: Readonly<Ref<HTMLElement | null | undefined>>\n /** CSS selector for gallery items inside the container (default: `'a[data-pswp-src]'`) */\n children?: string\n loop?: boolean\n /** Show a download button in the lightbox toolbar */\n downloadable?: boolean\n /** Show an open-in-new-tab button in the lightbox toolbar */\n openInNewTab?: boolean\n /**\n * Hands the items to the shared lightbox of a container above\n * (`provideSharedLightbox`), when there is one.\n */\n shared?: boolean\n}\n\nexport interface UseLightboxReturn {\n lightbox: ShallowRef<PhotoSwipeLightbox | null>\n /** Initialises PhotoSwipe. Call this inside `onMounted`. */\n init: () => Promise<void>\n /**\n * The items went to a shared lightbox: their anchors carry\n * `data-pswp-shared`, and `init` starts that lightbox instead.\n */\n shared: boolean\n}\n\n/**\n * Encapsulates PhotoSwipe 5 initialisation, toolbar customisation, and lifecycle cleanup.\n * CSS is injected into `document.head` so the overlay works in both regular DOM and Shadow DOM.\n *\n * Usage:\n * ```ts\n * const { init } = useLightbox({ gallery: galleryRef, downloadable: true })\n * onMounted(init)\n * ```\n */\nexport function useLightbox(options: LightboxOptions): UseLightboxReturn {\n const {\n gallery,\n children = 'a[data-pswp-src]',\n loop = true,\n downloadable = true,\n openInNewTab = true,\n shared = false,\n } = options\n\n const lightbox = shallowRef<PhotoSwipeLightbox | null>(null)\n const sharedLightbox = shared ? useSharedLightbox() : undefined\n const { t: $t } = useI18n({ useScope: 'global' })\n let unmounted = false\n\n const init = async () => {\n if (sharedLightbox) {\n sharedLightbox.join()\n return\n }\n if (!gallery.value) {\n return\n }\n\n // PhotoSwipe renders its overlay into document.body, so CSS must be in\n // document.head, not inside a shadow root.\n loadCdnCss(PHOTOSWIPE_CSS)\n injectPhotoSwipeOverrides()\n\n const { default: PhotoSwipeLightbox } =\n await import('photoswipe/lightbox')\n // Unmounted while PhotoSwipe loaded: nothing left to destroy it\n if (unmounted) {\n return\n }\n\n lightbox.value = new PhotoSwipeLightbox({\n gallery: gallery.value,\n children,\n pswpModule: () => import('photoswipe'),\n loop,\n // The wheel zooms around the pointer, as an image viewer does;\n // a drag pans\n wheelToZoom: true,\n // A click, a double tap, the zoom button and Z go from fit to the\n // real pixels, where PhotoSwipe stops at three times fit\n secondaryZoomLevel: (zoomLevel) =>\n Math.min(\n 1,\n MAX_ZOOM_LAYER_WIDTH /\n (zoomLevel.elementSize?.x || MAX_ZOOM_LAYER_WIDTH),\n ),\n closeTitle: $t('action.close'),\n zoomTitle: $t('lightbox.zoom'),\n arrowPrevTitle: $t('action.previous'),\n arrowNextTitle: $t('action.next'),\n errorMsg: $t('label.imageLoadError'),\n arrowPrevSVG:\n '<svg aria-hidden=\"true\" class=\"pswp__icn\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"#ffffff\" d=\"m10.828 12l4.95 4.95l-1.414 1.415L8 12l6.364-6.364l1.414 1.414z\"/></svg>',\n arrowNextSVG:\n '<svg aria-hidden=\"true\" class=\"pswp__icn\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"#ffffff\" d=\"m13.172 12l-4.95-4.95l1.414-1.413L16 12l-6.364 6.364l-1.414-1.415z\"/></svg>',\n closeSVG:\n '<svg aria-hidden=\"true\" class=\"pswp__icn\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"#ffffff\" d=\"m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z\"/></svg>',\n zoomSVG:\n '<svg aria-hidden=\"true\" class=\"pswp__icn\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g class=\"pswp__icn--zoom-in\"><path fill=\"#ffffff\" d=\"m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975zM10 10V7h2v3h3v2h-3v3h-2v-3H7v-2z\"/></g><g class=\"pswp__icn--zoom-out\"><path fill=\"#ffffff\" d=\"m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975zM7 10h8v2H7z\"/></g></svg>',\n })\n\n // A markdown image is the `<img>` itself, already loaded: its source\n // and natural size stand in for the data attributes of an anchor\n lightbox.value.addFilter('domItemData', (itemData, element, linkEl) => {\n if (linkEl) {\n return { ...itemData, caption: linkEl.dataset.pswpCaption }\n }\n if (!(element instanceof HTMLImageElement)) {\n return itemData\n }\n const src = element.currentSrc || element.src\n return {\n ...itemData,\n src,\n msrc: src,\n width: element.naturalWidth || DEFAULT_IMAGE_SIZE.width,\n height: element.naturalHeight || DEFAULT_IMAGE_SIZE.height,\n alt: element.alt,\n caption: element.alt,\n }\n })\n\n // The caption under the image, as text: the agent or a page it read\n // may have written it\n lightbox.value.on('uiRegister', () => {\n lightbox.value?.pswp?.ui?.registerElement({\n name: 'caption',\n className: 'pswp__caption pswp__hide-on-close',\n appendTo: 'root',\n onInit: (element, pswp) => {\n pswp.on('change', () => {\n const caption = pswp.currSlide?.data.caption ?? ''\n element.textContent = caption\n element.hidden = !caption\n })\n },\n })\n })\n\n if (openInNewTab || downloadable) {\n lightbox.value.on('uiRegister', () => {\n const ui = lightbox.value!.pswp?.ui\n if (!ui) {\n return\n }\n\n if (openInNewTab) {\n ui.registerElement({\n name: 'open-in-new-tab-button',\n order: 8,\n isButton: true,\n html: '<svg aria-hidden=\"true\" class=\"pswp__icn\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"#ffffff\" d=\"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z\"/></svg>',\n title: $t('lightbox.openInNewTab'),\n onClick: (_, __, pswp) => {\n const url = getCurrentSlideUrl(pswp)\n if (url) {\n window.open(\n url,\n '_blank',\n 'noopener,noreferrer',\n )\n }\n },\n })\n }\n\n if (downloadable) {\n ui.registerElement({\n name: 'download-button',\n order: 9,\n isButton: true,\n html: '<svg aria-hidden=\"true\" class=\"pswp__icn\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"#ffffff\" d=\"M3 19h18v2H3zm10-5.828L19.071 7.1l1.414 1.414L12 17L3.515 8.515L4.929 7.1L11 13.173V2h2z\"/></svg>',\n title: $t('action.download'),\n onClick: (_, __, pswp) => {\n const url = getCurrentSlideUrl(pswp)\n if (url) {\n downloadImage(url)\n }\n },\n })\n }\n })\n }\n\n // `+` and `-` zoom by a step around the center of the screen\n lightbox.value.on('keydown', (event) => {\n const { key, ctrlKey, metaKey, altKey } = event.originalEvent\n const factor = ZOOM_KEYS[key]\n const pswp = lightbox.value?.pswp\n const slide = pswp?.currSlide\n if (\n !factor ||\n ctrlKey ||\n metaKey ||\n altKey ||\n !slide?.isZoomable()\n ) {\n return\n }\n // The first stops PhotoSwipe's own handling, the second the browser's\n event.preventDefault()\n event.originalEvent.preventDefault()\n slide.zoomTo(\n slide.currZoomLevel * factor,\n undefined,\n pswp?.options.zoomAnimationDuration,\n )\n })\n\n lightbox.value.init()\n }\n\n onBeforeUnmount(() => {\n unmounted = true\n lightbox.value?.destroy()\n lightbox.value = null\n })\n\n return { lightbox, init, shared: Boolean(sharedLightbox) }\n}\n\n/**\n * The shared lightbox above that takes this component's images, if any: a\n * markdown marks its container with `data-pswp-images` and joins when it\n * shows an image.\n */\nexport function useSharedLightbox(): SharedLightbox | undefined {\n return inject(SHARED_LIGHTBOX, undefined)\n}\n\n/**\n * One lightbox over the images of a container, a conversation: the arrows go\n * through all of them in page order instead of stopping at the card that was\n * clicked. The components inside that pass `shared` to `useLightbox` skip a\n * lightbox of their own and mark their anchors with `data-pswp-shared`; the\n * others, such as a diagram's, keep theirs. It starts when the first image\n * joins, so a conversation without images loads no PhotoSwipe.\n */\nexport function provideSharedLightbox(\n container: Readonly<Ref<HTMLElement | null | undefined>>,\n): void {\n const { init } = useLightbox({\n gallery: container,\n children: SHARED_ITEMS,\n loop: false,\n })\n let joined = false\n let started = false\n const start = async () => {\n if (!joined || started || !container.value) {\n return\n }\n started = true\n try {\n await init()\n } catch {\n // PhotoSwipe did not load: the next image that joins tries again\n started = false\n }\n }\n provide(SHARED_LIGHTBOX, {\n join: () => {\n joined = true\n void start()\n },\n })\n // An image may join before the container is in place\n onMounted(start)\n}\n\n// ---------------------------------------------------------------------------\n// Image size preloading\n// ---------------------------------------------------------------------------\n\nexport interface UseImageSizesReturn {\n preload: (\n images: Array<{ url: string; width?: number; height?: number }>,\n ) => void\n getSize: (url: string) => { width: number; height: number }\n}\n\n/**\n * Preloads natural image dimensions so PhotoSwipe can size its slides correctly.\n * When `width`/`height` are already provided they are used as-is;\n * otherwise the image is loaded in the background to read `naturalWidth`/`naturalHeight`.\n */\nexport function useImageSizes(): UseImageSizesReturn {\n const sizes = ref(new Map<string, { width: number; height: number }>())\n\n const preload = (\n images: Array<{ url: string; width?: number; height?: number }>,\n ) => {\n for (const image of images) {\n if (image.width && image.height) {\n sizes.value.set(image.url, {\n width: image.width,\n height: image.height,\n })\n continue\n }\n const img = new Image()\n img.onload = () => {\n sizes.value.set(image.url, {\n width: img.naturalWidth,\n height: img.naturalHeight,\n })\n }\n img.src = image.url\n }\n }\n\n const getSize = (url: string) => sizes.value.get(url) ?? DEFAULT_IMAGE_SIZE\n\n return { preload, getSize }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction getCurrentSlideUrl(pswp: PhotoSwipe): string | undefined {\n return (\n pswp.currSlide?.data?.src ??\n pswp.currSlide?.data?.element\n ?.querySelector('img')\n ?.getAttribute('src') ??\n pswp.currSlide?.data?.element\n ?.querySelector('source')\n ?.getAttribute('srcset') ??\n pswp.currSlide?.data?.element?.getAttribute('src') ??\n undefined\n )\n}\n\n/**\n * Triggers a client-side download for an image URL.\n *\n * For backend media URLs (.../media/:file/view), navigates to the\n * corresponding /download endpoint which redirects to an Azure SAS URL\n * with `Content-Disposition: attachment`, so no CORS issues.\n *\n * For blob: URLs (in-session uploads), uses the fetch → blob approach.\n *\n * For data: URLs (inline SVGs, etc.), use the download attribute.\n *\n * Falls back to opening in a new tab for all other cases.\n */\nfunction downloadImage(url: string): void {\n const downloadUrl = toDownloadUrl(url)\n\n const anchor = document.createElement('a')\n anchor.href = downloadUrl\n anchor.target = '_blank'\n anchor.rel = 'noopener noreferrer'\n // `download` attribute works for same-origin, data: and blob: URLs; for\n // cross-origin it is ignored but the browser still follows Content-Disposition.\n anchor.download = getFilenameFromUrl(url)\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n}\n\n/**\n * Converts a `/view` media URL to its `/download` counterpart.\n * Leaves blob:, data: and all other URLs untouched.\n */\nfunction toDownloadUrl(url: string): string {\n return url.replace(/\\/view(\\?|$)/, '/download$1')\n}\n\nfunction getFilenameFromUrl(url: string): string {\n if (url.startsWith('data:image/svg+xml')) {\n return 'diagram.svg'\n }\n if (url.startsWith('data:')) {\n const mime = url.split(':')[1].split(';')[0]\n const ext = mime.split('/')[1] || 'bin'\n return `image.${ext}`\n }\n try {\n const pathname = new URL(url).pathname\n const name = pathname.split('/').pop()\n return name && name.includes('.') ? name : 'image'\n } catch {\n return 'image'\n }\n}\n\nlet overridesInjected = false\n\n/**\n * Injects a one-time `<style>` into `document.head` that raises\n * PhotoSwipe's z-index above any host UI (e.g. floating chat widgets\n * that use `z-index: 2147483647`), sizes its icons, lays a checkerboard\n * under transparent images and places the caption.\n */\nfunction injectPhotoSwipeOverrides(): void {\n if (overridesInjected) {\n return\n }\n overridesInjected = true\n const style = document.createElement('style')\n style.textContent = [\n '.pswp__counter { font-family: sans-serif; }',\n '.pswp { z-index: 2147483647 !important; }',\n '.pswp__icn { width: 20px; height: 20px; }',\n '.pswp__button { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }',\n '.pswp__icn--zoom-out { display: none; }',\n '.pswp--zoomed-in .pswp__icn--zoom-in { display: none; }',\n '.pswp--zoomed-in .pswp__icn--zoom-out { display: block; }',\n '.pswp__button--arrow .pswp__icn {left: auto; right: auto; width: 40px; height: 40px; transform: none; margin-top: -20px; }',\n // A checkerboard under the transparent parts of an image, where a\n // dark logo would vanish into the dark backdrop\n '.pswp__img { background: repeating-conic-gradient(#e6e6e6 0% 25%, #ffffff 0% 50%) 50% / 16px 16px; }',\n '.pswp__caption { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(720px, calc(100% - 32px)); padding: 6px 12px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #ffffff; font: 14px/1.4 sans-serif; text-align: center; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }',\n '.pswp__caption[hidden] { display: none; }',\n ].join(' ')\n document.head.appendChild(style)\n}\n"],"mappings":";;;;;;AAgBA,IAAMU,IACF,iEAEEC,IAAqB;CAAE,OAAO;CAAM,QAAQ;AAAI,GAIhDC,IAAuB,KAGvBC,IAAgD;CAClD,KAAK;CACL,KAAK;CACL,KAAK;CACL,GAAG;AACP,GASMC,IAAgD,OAAO,gBAAgB,GAOvEC,IACF;AAkDJ,SAAgBC,EAAY,GAA6C;CACrE,IAAM,EACF,YACA,cAAW,oBACX,UAAO,IACP,kBAAe,IACf,kBAAe,IACf,YAAS,OACTC,GAEEC,IAAWX,EAAsC,IAAI,GACrDY,IAAiBC,IAASC,EAAkB,IAAI,KAAA,GAChD,EAAE,GAAGC,MAAOd,EAAQ,EAAE,UAAU,SAAS,CAAC,GAC5Ce,IAAY;CA2KhB,OANArB,QAAsB;EAGlB,AAFA,IAAY,IACZgB,EAAS,OAAO,QAAQ,GACxB,EAAS,QAAQ;CACrB,CAAC,GAEM;EAAE;EAAU,kBAzKM;GACrB,IAAIC,GAAgB;IAChB,EAAe,KAAK;IACpB;GACJ;GACA,IAAI,CAACK,EAAQ,OACT;GAMJ,AADAf,EAAWC,CAAc,GACzBe,EAA0B;GAE1B,IAAM,EAAE,SAASC,MACb,MAAM,OAAO;GAEjB,AAAIH,MAIJ,EAAS,QAAQ,IAAIG,EAAmB;IACpC,SAASF,EAAQ;IACjB;IACA,kBAAkB,OAAO;IACzB;IAGA,aAAa;IAGb,qBAAqB,MACjB,KAAK,IACD,GACAZ,KACKe,EAAU,aAAa,KAAKf,EACrC;IACJ,YAAYU,EAAG,cAAc;IAC7B,WAAWA,EAAG,eAAe;IAC7B,gBAAgBA,EAAG,iBAAiB;IACpC,gBAAgBA,EAAG,aAAa;IAChC,UAAUA,EAAG,sBAAsB;IACnC,cACI;IACJ,cACI;IACJ,UACI;IACJ,SACI;GACR,CAAC,GAIDJ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C,IAAIsC,GACA;CAEJ,IAAoB;CACpB,IAAMC,IAAQ,SAAS,cAAc,OAAO;CAgB5C,AAfA,EAAM,cAAc,sjCAepB,SAAS,KAAK,YAAYA,CAAK;AACnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotInput-DzqaW3EE.js","names":["_hoisted_1","_hoisted_2","__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createVNode","_toDisplayString","_createCommentVNode","_sfc_main","$t","$slots","$n","_useModel","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","_createCommentVNode","PkStreamingMarkdown","_toDisplayString","_createElementVNode","_withModifiers","_createVNode","_createTextVNode","PkChatbotFilePreview","_renderSlot","_normalizeProps","_mergeProps","_withCtx","PkChatButton","_unref","_withKeys","_normalizeClass","_sfc_main","codeExtensionsOf","PkStreamingMarkdown_default","PkChatbotFilePreview_default","e","t","o","r","n","l","a","i","s","d","c","v","_hoisted_1$1","_hoisted_2$1","PkChatButton_default","defineComponent","_component_VvIcon","VvIcon","openBlock","createElementBlock","normalizeClass","__props","createVNode","toDisplayString","createCommentVNode","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","PkChatbotInput_default","\"modelValue\"","\"modelModifiers\"","\"pendingAttachments\"","\"pendingAttachmentsModifiers\"","__expose","__emit","modelValue","useModel","pendingAttachments","emit","props","textareaEl","useTemplateRef","fileInputEl","cameraInputEl","formEl","localValue","ref","syncTimer","cancelSync","flushSync","scheduleSync","onTextareaInput","nextTick","isStreaming","computed","isSubmitted","isInputDisabled","counterId","useId","currentLength","isOverLimit","isUploadingAnyFile","isSubmitEnabled","isQueueing","hasCaptureSupport","acceptMimeTypes","allowed","acceptImageMimeTypes","m","showCameraOption","openFilePicker","openCameraPicker","emitFiles","file","files","onFileChange","input","event","removeAttachment","att","id","isDismissableNoticeVisible","closeDismissableNotice","activeNotices","notices","notice","keepKeyboardFocus","stopGeneration","handleSubmit","onTextareaEnter","textareaWidth","useResizeObserver","entry","width","watch","onBeforeUnmount","_component_VvButton","VvButtonLocalized","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","Fragment","renderList","createBlock","_ctx","createElementVNode","withModifiers","_cache","createTextVNode","renderSlot","normalizeProps","mergeProps","withCtx","init","aria","toggle","unref","withKeys"],"sources":["../../../../node_modules/.pnpm/autosize@6.0.1/node_modules/autosize/dist/autosize.esm.js","../../../../packages/components/src/chat/PkChatButton.vue","../../../../packages/components/src/chat/PkChatButton.vue","../../../../packages/components/src/chat/PkChatbotInput.vue","../../../../packages/components/src/chat/PkChatbotInput.vue"],"sourcesContent":["var e=new Map;function t(t){var o=e.get(t);o&&o.destroy()}function o(t){var o=e.get(t);o&&o.update()}var r=null;\"undefined\"==typeof window?((r=function(e){return e}).destroy=function(e){return e},r.update=function(e){return e}):((r=function(t,o){return t&&Array.prototype.forEach.call(t.length?t:[t],function(t){return function(t){if(t&&t.nodeName&&\"TEXTAREA\"===t.nodeName&&!e.has(t)){var o,r=null,n=window.getComputedStyle(t),i=(o=t.value,function(){a({testForHeightReduction:\"\"===o||!t.value.startsWith(o),restoreTextAlign:null}),o=t.value}),l=function(o){t.removeEventListener(\"autosize:destroy\",l),t.removeEventListener(\"autosize:update\",s),t.removeEventListener(\"input\",i),window.removeEventListener(\"resize\",s),Object.keys(o).forEach(function(e){return t.style[e]=o[e]}),e.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener(\"autosize:destroy\",l),t.addEventListener(\"autosize:update\",s),t.addEventListener(\"input\",i),window.addEventListener(\"resize\",s),t.style.overflowX=\"hidden\",t.style.wordWrap=\"break-word\",e.set(t,{destroy:l,update:s}),s()}function a(e){var o,i,l=e.restoreTextAlign,s=void 0===l?null:l,d=e.testForHeightReduction,u=void 0===d||d,c=n.overflowY;if(0!==t.scrollHeight&&(\"vertical\"===n.resize?t.style.resize=\"none\":\"both\"===n.resize&&(t.style.resize=\"horizontal\"),u&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],o=e[1];t.style.scrollBehavior=\"auto\",t.scrollTop=o,t.style.scrollBehavior=null})}}(t),t.style.height=\"\"),i=\"content-box\"===n.boxSizing?t.scrollHeight-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):t.scrollHeight+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),\"none\"!==n.maxHeight&&i>parseFloat(n.maxHeight)?(\"hidden\"===n.overflowY&&(t.style.overflow=\"scroll\"),i=parseFloat(n.maxHeight)):\"hidden\"!==n.overflowY&&(t.style.overflow=\"hidden\"),t.style.height=i+\"px\",s&&(t.style.textAlign=s),o&&o(),r!==i&&(t.dispatchEvent(new Event(\"autosize:resized\",{bubbles:!0})),r=i),c!==n.overflow&&!s)){var v=n.textAlign;\"hidden\"===n.overflow&&(t.style.textAlign=\"start\"===v?\"end\":\"start\"),a({restoreTextAlign:v,testForHeightReduction:!0})}}function s(){a({testForHeightReduction:!0,restoreTextAlign:null})}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},r.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e});var n=r;export default n;\n","<script lang=\"ts\" setup>\n /**\n * The icon button of the chat dock: attach, send and stop in the input,\n * mute and hang up in a live call. One component, because the call bar\n * takes the place of the input and the two must not look like two\n * different pieces of software.\n *\n * Native attributes fall through to the button, so `title`, `disabled` and\n * `aria-pressed` are written by the caller as they would be on a `<button>`.\n */\n withDefaults(\n defineProps<{\n icon: string\n /** Written next to the icon, for an action nobody should have to guess from a glyph. */\n label?: string\n type?: 'button' | 'submit'\n /** `primary` is the filled circle of send and stop, the one action the dock is for. */\n modifiers?: 'danger' | 'primary'\n }>(),\n { label: undefined, type: 'button', modifiers: undefined },\n )\n</script>\n\n<template>\n <button\n class=\"pk-chat-button\"\n :class=\"[\n modifiers ? `pk-chat-button--${modifiers}` : undefined,\n { 'pk-chat-button--labelled': label },\n ]\"\n :type=\"type\">\n <VvIcon :name=\"icon\" class=\"pk-chat-button__icon\" />\n <span v-if=\"label\" class=\"pk-chat-button__label\">{{ label }}</span>\n </button>\n</template>\n\n<style lang=\"scss\">\n .pk-chat-button {\n position: relative;\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: var(--spacing-4);\n border: none;\n border-radius: var(--rounded);\n background-color: transparent;\n color: var(--color-word-1);\n cursor: pointer;\n transition: var(--transition-colors);\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n\n // The fields' focus ring: a 1px surface-5 line measured 1.3:1 on the\n // surface, under the 3:1 a focus indicator needs\n &:focus-visible {\n outline: var(--spacing-2) solid var(--input-focus-color);\n outline-offset: 0;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n // A finger needs 40px and the button is drawn at 28: on a touch\n // screen it answers 8px around itself, in every layout of the chat\n // (it was the fullscreen one only) and in the call bar, which mounts\n // the same button\n @media (pointer: coarse) {\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-8));\n }\n }\n\n // A toggle has to survive a glance: a crossed-out glyph alone changes\n // too few pixels to notice mid-sentence.\n &[aria-pressed='true'] {\n background-color: var(--color-surface-3);\n color: var(--color-word);\n }\n\n // A wash of the same red rather than a lighter red behind it: the\n // `lighten-5` step lands close enough to the icon to leave it at about\n // 2:1, which is a button that disappears exactly while it is being\n // pointed at. The tint composites over whatever surface is behind, so\n // it holds in the dark theme too.\n &--danger {\n // The project's text shade of danger; the fill where a host app\n // loads only the library and this package's stylesheet\n color: var(--u-danger-text, var(--color-danger));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-danger) 12%,\n transparent\n );\n }\n }\n\n // Same 28px box as the ghost buttons, so the dock keeps its height,\n // with a smaller glyph because a filled shape needs air around it.\n // Its edge is visible, so it sits on the input's padding line just as\n // the text does: a ghost glyph sat 6px further in and made the two\n // sides of the input look unequal. Empty, it turns into a grey pad\n // with the fields' disabled ink: a light arrow on that pad vanished,\n // and with it the circle's edge, which is what squares the sides.\n // The agent's color when the widget has one, like the user's bubble.\n &--primary {\n --pk-chat-button-fill: var(\n --chatbot-main-color,\n var(--color-word-1)\n );\n\n padding: var(--spacing-6);\n border-radius: var(--rounded-full);\n background-color: var(--pk-chat-button-fill);\n color: var(--chatbot-contrast-color, var(--color-surface));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--pk-chat-button-fill) 85%,\n var(--color-surface)\n );\n }\n\n // Off the disc, or a dark ring would sink into a dark fill\n &:focus-visible {\n outline-offset: var(--spacing-2);\n }\n\n &:disabled {\n opacity: 1;\n background-color: var(--color-surface-3);\n color: var(--color-word-3);\n }\n\n .pk-chat-button__icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &--labelled {\n gap: var(--spacing-4);\n padding-inline: var(--spacing-8);\n font-size: var(--text-12);\n }\n\n &__icon {\n display: block;\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n /**\n * The icon button of the chat dock: attach, send and stop in the input,\n * mute and hang up in a live call. One component, because the call bar\n * takes the place of the input and the two must not look like two\n * different pieces of software.\n *\n * Native attributes fall through to the button, so `title`, `disabled` and\n * `aria-pressed` are written by the caller as they would be on a `<button>`.\n */\n withDefaults(\n defineProps<{\n icon: string\n /** Written next to the icon, for an action nobody should have to guess from a glyph. */\n label?: string\n type?: 'button' | 'submit'\n /** `primary` is the filled circle of send and stop, the one action the dock is for. */\n modifiers?: 'danger' | 'primary'\n }>(),\n { label: undefined, type: 'button', modifiers: undefined },\n )\n</script>\n\n<template>\n <button\n class=\"pk-chat-button\"\n :class=\"[\n modifiers ? `pk-chat-button--${modifiers}` : undefined,\n { 'pk-chat-button--labelled': label },\n ]\"\n :type=\"type\">\n <VvIcon :name=\"icon\" class=\"pk-chat-button__icon\" />\n <span v-if=\"label\" class=\"pk-chat-button__label\">{{ label }}</span>\n </button>\n</template>\n\n<style lang=\"scss\">\n .pk-chat-button {\n position: relative;\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: var(--spacing-4);\n border: none;\n border-radius: var(--rounded);\n background-color: transparent;\n color: var(--color-word-1);\n cursor: pointer;\n transition: var(--transition-colors);\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n\n // The fields' focus ring: a 1px surface-5 line measured 1.3:1 on the\n // surface, under the 3:1 a focus indicator needs\n &:focus-visible {\n outline: var(--spacing-2) solid var(--input-focus-color);\n outline-offset: 0;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n // A finger needs 40px and the button is drawn at 28: on a touch\n // screen it answers 8px around itself, in every layout of the chat\n // (it was the fullscreen one only) and in the call bar, which mounts\n // the same button\n @media (pointer: coarse) {\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-8));\n }\n }\n\n // A toggle has to survive a glance: a crossed-out glyph alone changes\n // too few pixels to notice mid-sentence.\n &[aria-pressed='true'] {\n background-color: var(--color-surface-3);\n color: var(--color-word);\n }\n\n // A wash of the same red rather than a lighter red behind it: the\n // `lighten-5` step lands close enough to the icon to leave it at about\n // 2:1, which is a button that disappears exactly while it is being\n // pointed at. The tint composites over whatever surface is behind, so\n // it holds in the dark theme too.\n &--danger {\n // The project's text shade of danger; the fill where a host app\n // loads only the library and this package's stylesheet\n color: var(--u-danger-text, var(--color-danger));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-danger) 12%,\n transparent\n );\n }\n }\n\n // Same 28px box as the ghost buttons, so the dock keeps its height,\n // with a smaller glyph because a filled shape needs air around it.\n // Its edge is visible, so it sits on the input's padding line just as\n // the text does: a ghost glyph sat 6px further in and made the two\n // sides of the input look unequal. Empty, it turns into a grey pad\n // with the fields' disabled ink: a light arrow on that pad vanished,\n // and with it the circle's edge, which is what squares the sides.\n // The agent's color when the widget has one, like the user's bubble.\n &--primary {\n --pk-chat-button-fill: var(\n --chatbot-main-color,\n var(--color-word-1)\n );\n\n padding: var(--spacing-6);\n border-radius: var(--rounded-full);\n background-color: var(--pk-chat-button-fill);\n color: var(--chatbot-contrast-color, var(--color-surface));\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--pk-chat-button-fill) 85%,\n var(--color-surface)\n );\n }\n\n // Off the disc, or a dark ring would sink into a dark fill\n &:focus-visible {\n outline-offset: var(--spacing-2);\n }\n\n &:disabled {\n opacity: 1;\n background-color: var(--color-surface-3);\n color: var(--color-word-3);\n }\n\n .pk-chat-button__icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &--labelled {\n gap: var(--spacing-4);\n padding-inline: var(--spacing-8);\n font-size: var(--text-12);\n }\n\n &__icon {\n display: block;\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n // @ts-expect-error - no types for autosize\n import autosize from 'autosize'\n import {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n } from 'vue'\n import { useResizeObserver } from '@vueuse/core'\n import { codeExtensionsOf, type AgentFileUpload } from 'models'\n import type { PendingAttachment } from 'composables'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n import PkChatButton from './PkChatButton.vue'\n\n // --- Models & Props ---\n\n const modelValue = defineModel<string | undefined>({ default: undefined })\n const pendingAttachments = defineModel<PendingAttachment[]>(\n 'pendingAttachments',\n { default: () => [] },\n )\n\n const emit = defineEmits<{\n submit: []\n 'stop-generation': []\n 'file-select': [file: File]\n 'dismiss-attachment-notice': []\n 'dismiss-page-notice': []\n 'open-answer-notice': [id: string]\n 'dismiss-answer-notice': [id: string]\n 'voice-start': []\n /** Point at the page (spec `page-point-and-choose.md`, P). */\n point: []\n 'remove-pointer': []\n /** The user clicked the \"Automatic\" label: back to manual confirmations. */\n 'manual-confirmations': []\n }>()\n\n const props = defineProps<{\n placeholder?: string\n dismissableNotice?: string\n /**\n * What the agent can do on the page that embeds the chat (spec\n * `page-tools.md`). Its closing is the caller's to remember.\n */\n pageNotice?: string\n status?: 'submitted' | 'streaming' | 'ready' | 'error'\n maxMessageLength?: number\n fileUpload?: AgentFileUpload\n attachmentLimitReached?: boolean\n attachmentNotice?: string\n /** Show the talk button: the agent has voice enabled. */\n voiceEnabled?: boolean\n /**\n * What is written while the agent answers is queued and sent when the\n * answer ends (spec resumable-chat-streams, F2): sending stays open.\n */\n queueEnabled?: boolean\n /** Answers that ended in another conversation, each with its own line and its \"Open\". */\n answerNotices?: { id: string; text: string }[]\n /** The user may point at the page that embeds the chat: the button shows. */\n pointerAvailable?: boolean\n /** The user is pointing at the page now. */\n pointing?: boolean\n /** What the user pointed at for this message: the chip above the field. */\n pointer?: { kind: 'element' | 'text'; label: string }\n /**\n * The user chose automatic confirmations (spec\n * `auto-confirmations.md`): a label above the field says so, and\n * takes them back to manual.\n */\n automaticConfirmations?: boolean\n }>()\n\n // --- Template refs ---\n\n const textareaEl = useTemplateRef<HTMLTextAreaElement>('textareaEl')\n const fileInputEl = useTemplateRef<HTMLInputElement>('fileInputEl')\n const cameraInputEl = useTemplateRef<HTMLInputElement>('cameraInputEl')\n const formEl = useTemplateRef<HTMLFormElement>('formEl')\n\n // --- Input buffering (decouples typing from reactive model propagation) ---\n\n const localValue = ref(modelValue.value ?? '')\n let syncTimer: ReturnType<typeof setTimeout> | null = null\n\n const cancelSync = () => {\n if (syncTimer !== null) {\n clearTimeout(syncTimer)\n syncTimer = null\n }\n }\n\n const flushSync = () => {\n cancelSync()\n modelValue.value = localValue.value\n }\n\n const scheduleSync = () => {\n cancelSync()\n syncTimer = setTimeout(() => {\n modelValue.value = localValue.value\n syncTimer = null\n }, 300)\n }\n\n const onTextareaInput = () => {\n localValue.value = textareaEl.value?.value ?? ''\n scheduleSync()\n }\n\n watch(modelValue, (v) => {\n if (v !== localValue.value) {\n localValue.value = v ?? ''\n nextTick(() => {\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n })\n }\n })\n\n // --- Status computeds ---\n\n const isStreaming = computed(() => props.status === 'streaming')\n const isSubmitted = computed(() => props.status === 'submitted')\n const isInputDisabled = computed(\n () => isStreaming.value || isSubmitted.value,\n )\n\n // --- Validation ---\n\n const counterId = useId()\n const currentLength = computed(() => localValue.value.length)\n\n const isOverLimit = computed(\n () =>\n props.maxMessageLength !== undefined &&\n currentLength.value > props.maxMessageLength,\n )\n\n const isUploadingAnyFile = computed(() =>\n pendingAttachments.value.some((a) => a.state === 'uploading'),\n )\n\n const isSubmitEnabled = computed(() => {\n if (\n (isInputDisabled.value && !props.queueEnabled) ||\n isUploadingAnyFile.value ||\n isOverLimit.value\n ) {\n return false\n }\n return localValue.value.trim().length > 0\n })\n\n /** Written during an answer: the send button queues it, next to the stop. */\n const isQueueing = computed(\n () => isInputDisabled.value && isSubmitEnabled.value,\n )\n\n // --- File upload ---\n\n const hasCaptureSupport = 'capture' in document.createElement('input')\n\n // A browser filters the picker by type and knows few code types: their\n // extensions go along.\n const acceptMimeTypes = computed(() => {\n const allowed = props.fileUpload?.allowedMimeTypes ?? []\n return [...allowed, ...codeExtensionsOf(allowed)].join(',')\n })\n\n const acceptImageMimeTypes = computed(() =>\n (props.fileUpload?.allowedMimeTypes ?? [])\n .filter((m) => m.startsWith('image/'))\n .join(','),\n )\n\n const showCameraOption = computed(\n () => hasCaptureSupport && acceptImageMimeTypes.value.length > 0,\n )\n\n const openFilePicker = () => {\n fileInputEl.value?.click()\n }\n\n const openCameraPicker = () => {\n cameraInputEl.value?.click()\n }\n\n // The store owns the attachment limits and drops any overflow; the input\n // just forwards every picked/dropped file.\n const emitFiles = (files: File[]) => {\n for (const file of files) {\n emit('file-select', file)\n }\n }\n\n const onFileChange = (event: Event) => {\n const input = event.target as HTMLInputElement\n emitFiles(Array.from(input.files ?? []))\n input.value = ''\n }\n\n // --- Attachments ---\n\n const removeAttachment = (id: string) => {\n const att = pendingAttachments.value.find((a) => a.id === id)\n if (att) {\n URL.revokeObjectURL(att.localUrl)\n }\n pendingAttachments.value = pendingAttachments.value.filter(\n (a) => a.id !== id,\n )\n }\n\n // --- Notices (one box above the input) ---\n\n type InputNotice = {\n id: string\n text?: string\n markdown?: string\n icon?: string\n open?: () => void\n dismiss?: () => void\n }\n\n const isDismissableNoticeVisible = ref(true)\n const closeDismissableNotice = () => {\n isDismissableNoticeVisible.value = false\n }\n\n const activeNotices = computed<InputNotice[]>(() => {\n // The alert answers what the user just did, and takes the box alone\n // until it is closed.\n if (props.attachmentNotice) {\n return [\n {\n id: 'limit',\n icon: 'ri:information-line',\n text: props.attachmentNotice,\n dismiss: () => emit('dismiss-attachment-notice'),\n },\n ]\n }\n const notices: InputNotice[] = []\n // An answer that ended where the user is not: news, so it comes\n // first, and it leaves once opened or closed.\n for (const notice of props.answerNotices ?? []) {\n notices.push({\n id: `answer-${notice.id}`,\n icon: 'ri:chat-check-line',\n text: notice.text,\n open: () => emit('open-answer-notice', notice.id),\n dismiss: () => emit('dismiss-answer-notice', notice.id),\n })\n }\n // What the agent does on this page, next: the user should read it\n // before writing. The agent's own notice stays beside it, never\n // behind it: it is where an agent states its terms, a privacy\n // policy among them.\n if (props.pageNotice) {\n notices.push({\n id: 'page',\n icon: 'ri:pages-line',\n text: props.pageNotice,\n dismiss: () => emit('dismiss-page-notice'),\n })\n }\n if (props.dismissableNotice && isDismissableNoticeVisible.value) {\n notices.push({\n id: 'dismissable',\n markdown: props.dismissableNotice,\n dismiss: closeDismissableNotice,\n })\n }\n return notices\n })\n\n // --- Submit ---\n\n /**\n * Send turns disabled and then gives way to stop, stop gives way to send:\n * a keyboard user who pressed one would be left on the page body. Hand\n * the focus to the textarea, but only after a keyboard press: a tap has no\n * focus to keep, and focusing would bring the phone keyboard back up over\n * the answer.\n */\n const keepKeyboardFocus = () => {\n if (formEl.value?.querySelector('button:focus-visible')) {\n textareaEl.value?.focus()\n }\n }\n\n const stopGeneration = () => {\n keepKeyboardFocus()\n emit('stop-generation')\n }\n\n const handleSubmit = () => {\n if (!isSubmitEnabled.value) {\n return\n }\n keepKeyboardFocus()\n flushSync()\n emit('submit')\n localValue.value = ''\n modelValue.value = ''\n nextTick(() => {\n if (textareaEl.value) {\n textareaEl.value.value = ''\n autosize.update(textareaEl.value)\n }\n })\n }\n\n /**\n * Enter sends, Shift+Enter goes to a new line. The Enter that confirms an\n * IME composition (Japanese, Chinese, Korean) belongs to the composition:\n * Safari reports it with `isComposing` already false, hence the 229.\n */\n const onTextareaEnter = (event: KeyboardEvent) => {\n if (event.shiftKey || event.isComposing || event.keyCode === 229) {\n return\n }\n event.preventDefault()\n handleSubmit()\n }\n\n // --- Lifecycle ---\n\n onMounted(() => {\n if (textareaEl.value) {\n autosize(textareaEl.value)\n }\n })\n\n // autosize measures on input and on a window resize only, and an empty\n // textarea measures its placeholder. The chat settles its layout after\n // mount: measured at a first, narrower width, the placeholder wrapped,\n // and on the chat page of a phone the field stayed 88px tall, four lines\n // with the text at their top, until the user typed. Measured again when\n // its width changes, or its placeholder.\n let textareaWidth = 0\n useResizeObserver(textareaEl, ([entry]) => {\n const width = entry?.contentRect.width ?? 0\n if (textareaEl.value && width !== textareaWidth) {\n textareaWidth = width\n autosize.update(textareaEl.value)\n }\n })\n watch(\n () => props.placeholder,\n async () => {\n await nextTick()\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n },\n )\n\n onBeforeUnmount(() => {\n cancelSync()\n if (textareaEl.value) {\n autosize.destroy(textareaEl.value)\n }\n for (const att of pendingAttachments.value) {\n URL.revokeObjectURL(att.localUrl)\n }\n })\n\n defineExpose({\n /** Move the focus to the message field */\n focus: () => textareaEl.value?.focus(),\n })\n</script>\n\n<template>\n <div class=\"pk-chatbot-input\">\n <div\n v-if=\"activeNotices.length\"\n class=\"pk-chatbot-input__notice\"\n role=\"status\">\n <div\n v-for=\"notice in activeNotices\"\n :key=\"notice.id\"\n class=\"pk-chatbot-input__notice-item\">\n <VvIcon\n v-if=\"notice.icon\"\n :name=\"notice.icon\"\n class=\"pk-chatbot-input__notice-icon\" />\n <PkStreamingMarkdown\n v-if=\"notice.markdown\"\n :markdown=\"notice.markdown\"\n class=\"wysiwyg pk-chatbot-input__notice-text\" />\n <span v-else class=\"pk-chatbot-input__notice-text\">\n {{ notice.text }}\n </span>\n <VvButton\n v-if=\"notice.open\"\n :label=\"$t('action.open')\"\n modifiers=\"link\"\n class=\"pk-chatbot-input__notice-action\"\n @click=\"notice.open()\" />\n <VvButton\n v-if=\"notice.dismiss\"\n :title=\"$t('action.close')\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n class=\"w-18 h-18\"\n @click=\"notice.dismiss()\" />\n </div>\n </div>\n <form\n ref=\"formEl\"\n class=\"pk-chatbot-input__form\"\n @submit.prevent=\"handleSubmit\">\n <button\n v-if=\"automaticConfirmations\"\n type=\"button\"\n class=\"pk-chatbot-input__mode\"\n :title=\"$t('action.manualConfirmations')\"\n @click=\"emit('manual-confirmations')\">\n <VvIcon\n name=\"ri:flashlight-line\"\n class=\"pk-chatbot-input__pointer-icon\" />\n {{ $t('label.automaticConfirmations') }}\n <VvIcon\n name=\"ri:close-line\"\n class=\"pk-chatbot-input__pointer-icon\" />\n </button>\n <div v-if=\"pointer\" class=\"pk-chatbot-input__pointer\">\n <VvIcon\n :name=\"\n pointer.kind === 'text'\n ? 'ri:double-quotes-l'\n : 'ri:focus-3-line'\n \"\n class=\"pk-chatbot-input__pointer-icon\" />\n <span class=\"pk-chatbot-input__pointer-label\">\n {{\n pointer.kind === 'text'\n ? `«${pointer.label}»`\n : pointer.label\n }}\n </span>\n <VvButton\n :title=\"$t('pagePointer.remove')\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n class=\"w-18 h-18\"\n @click=\"emit('remove-pointer')\" />\n </div>\n <div\n v-if=\"pendingAttachments.length\"\n class=\"pk-chatbot-input__attachments\">\n <PkChatbotFilePreview\n v-for=\"att in pendingAttachments\"\n :key=\"att.id\"\n :media-type=\"att.mediaSource?.mimeType ?? att.file.type\"\n :url=\"att.localUrl\"\n :filename=\"att.file.name\"\n :size=\"att.file.size\"\n :loading=\"att.state === 'uploading'\"\n :error=\"att.state === 'error' ? att.error : undefined\"\n :removable=\"att.state !== 'uploading'\"\n compact\n @remove=\"removeAttachment(att.id)\" />\n </div>\n <div class=\"pk-chatbot-input__fieldset\">\n <slot name=\"prepend\" />\n <VvDropdown\n v-if=\"\n fileUpload &&\n fileUpload.enabled &&\n (showCameraOption || $slots['additional-actions'])\n \"\n v-bind=\"{\n placement: 'top-start',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n }\">\n <template #default=\"{ init, toggle, aria }\">\n <!-- The only one still written by hand: the dropdown\n anchors itself to whatever `init` receives, and that\n has to be the element, not a component instance -->\n <button\n :ref=\"(e: any) => init(e)\"\n v-bind=\"aria\"\n class=\"pk-chat-button\"\n type=\"button\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled\"\n @click=\"toggle\">\n <VvIcon\n name=\"ri:add-line\"\n class=\"pk-chat-button__icon\" />\n </button>\n </template>\n <template #items>\n <VvDropdownAction\n v-if=\"showCameraOption\"\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openCameraPicker\">\n <VvIcon\n name=\"ri:camera-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.takePhoto') }}\n </VvDropdownAction>\n <VvDropdownAction\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openFilePicker\">\n <VvIcon\n name=\"ri:attachment-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.attachFile') }}\n </VvDropdownAction>\n <slot name=\"additional-actions\" />\n </template>\n </VvDropdown>\n <PkChatButton\n v-else-if=\"fileUpload && fileUpload.enabled\"\n icon=\"ri:add-line\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled || attachmentLimitReached\"\n @click=\"openFilePicker\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled\"\n ref=\"fileInputEl\"\n type=\"file\"\n hidden\n multiple\n :accept=\"acceptMimeTypes\"\n @change=\"onFileChange\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled && showCameraOption\"\n ref=\"cameraInputEl\"\n type=\"file\"\n capture=\"environment\"\n hidden\n :accept=\"acceptImageMimeTypes\"\n @change=\"onFileChange\" />\n <PkChatButton\n v-if=\"pointerAvailable\"\n icon=\"ri:focus-3-line\"\n :title=\"$t('pagePointer.start')\"\n :aria-pressed=\"pointing\"\n :disabled=\"isInputDisabled\"\n @click=\"emit('point')\" />\n <div class=\"pk-chatbot-input__content\">\n <textarea\n ref=\"textareaEl\"\n :value=\"localValue\"\n class=\"pk-chatbot-input__textarea\"\n name=\"message\"\n rows=\"1\"\n enterkeyhint=\"send\"\n :aria-label=\"$t('label.message')\"\n :aria-describedby=\"\n maxMessageLength ? counterId : undefined\n \"\n :aria-invalid=\"isOverLimit || undefined\"\n :placeholder\n @input=\"onTextareaInput\"\n @keydown.enter=\"onTextareaEnter\"></textarea>\n </div>\n <div\n v-if=\"maxMessageLength\"\n :id=\"counterId\"\n class=\"pk-chatbot-input__counter\"\n :class=\"{ 'pk-chatbot-input__counter--over': isOverLimit }\">\n {{ $n(currentLength, 'integer') }}/<span\n class=\"opacity-60\"\n >{{ $n(maxMessageLength, 'integer') }}</span\n >\n </div>\n <PkChatButton\n v-if=\"voiceEnabled && !isStreaming\"\n icon=\"ri:mic-line\"\n :title=\"$t('action.talk')\"\n :disabled=\"isInputDisabled\"\n @click=\"emit('voice-start')\" />\n <!-- With a message to queue the send button is the filled one,\n and the stop steps back beside it -->\n <PkChatButton\n v-if=\"isStreaming\"\n icon=\"ri:stop-fill\"\n :modifiers=\"isQueueing ? undefined : 'primary'\"\n :title=\"$t('action.stop')\"\n @click=\"stopGeneration\" />\n <PkChatButton\n v-if=\"isQueueing\"\n type=\"submit\"\n modifiers=\"primary\"\n icon=\"ri:arrow-up-line\"\n :title=\"$t('action.queueMessage')\" />\n <PkChatButton\n v-else-if=\"!isStreaming\"\n type=\"submit\"\n modifiers=\"primary\"\n :icon=\"isSubmitted ? 'loading-loop' : 'ri:arrow-up-line'\"\n :title=\"$t('action.submit')\"\n :disabled=\"!isSubmitEnabled\" />\n </div>\n </form>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-input {\n position: relative;\n display: flex;\n flex-direction: column;\n margin-inline: var(--spacing-sm);\n margin-bottom: var(--spacing-sm);\n\n &__notice {\n position: relative;\n padding: var(--spacing-10) var(--spacing-sm);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-10);\n background-color: var(--color-surface-1);\n border-top-left-radius: var(--rounded-xl);\n border-top-right-radius: var(--rounded-xl);\n transition-property: var(--transition-property-all);\n transition-duration: var(--duration-300);\n transition-timing-function: var(--ease-in-out);\n font-size: var(--text-12);\n color: var(--color-word-4);\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: calc(-1 * var(--spacing-12));\n height: var(--spacing-12);\n background-color: var(--color-surface-1);\n z-index: 1;\n }\n\n // Two notices read as two lines of one box, with a hairline\n // between them\n &-item {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-sm);\n\n & + & {\n padding-top: var(--spacing-10);\n border-top: 1px solid var(--color-surface-3);\n }\n }\n\n &-icon {\n flex-shrink: 0;\n width: var(--spacing-18);\n height: var(--spacing-18);\n }\n\n &-text {\n flex: 1;\n min-width: 0;\n }\n\n // A word of the line's size, on the line: the notice stays one\n // quiet row, not a button bar\n &-action {\n flex-shrink: 0;\n font-size: inherit;\n }\n }\n\n &__form {\n position: relative;\n display: flex;\n z-index: 1;\n flex-direction: column;\n\n // The composer is a field too: same border and focus ring as the\n // form fields, on top of the shadow and the 12px radius that make\n // it the container (12) of its 8px buttons\n border-radius: var(--rounded-xl);\n border: 1px solid var(--input-border-color);\n background-color: var(--color-surface);\n padding: var(--spacing-14);\n box-shadow: var(--shadow-lg);\n font-size: var(\n --text-16\n ); // prevent ios zoom on input focus by using a font size >= 16px\n\n gap: var(--spacing-xs);\n transition: var(--input-transition);\n\n @include media-breakpoint-up('sm', $breakpoints) {\n font-size: var(--text-14);\n padding: var(--spacing-10);\n }\n\n &:has(:focus-within) {\n border-color: var(--input-focus-color);\n box-shadow: var(--shadow-lg), var(--input-focus-ring);\n }\n }\n\n &__fieldset {\n display: flex;\n align-items: center;\n gap: var(--spacing-xs);\n flex: 1;\n\n // The buttons answer 8px around themselves on a touch screen\n // (PkChatButton): 12px apart, neither takes the other's box\n @media (pointer: coarse) {\n gap: var(--spacing-12);\n }\n }\n\n &__content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-4);\n min-width: 0;\n overflow: hidden;\n }\n\n &__textarea {\n display: block;\n border: none;\n outline: none;\n resize: none;\n width: 100%;\n max-height: 200px;\n color: var(--color-word-1);\n background-color: var(--color-surface);\n\n &::placeholder {\n color: var(--color-word-4);\n }\n }\n\n &__attachments {\n display: flex;\n flex-wrap: wrap;\n\n // Roomy gap so the uniform-height chips breathe in the row.\n gap: var(--spacing-12);\n padding-bottom: var(--spacing-xs);\n border-bottom: 1px solid var(--color-surface-2);\n }\n\n // What the user pointed at on the page: one chip, the element's name\n // or the selected text, on one line\n &__pointer {\n display: flex;\n align-items: center;\n gap: var(--spacing-6);\n align-self: flex-start;\n max-width: 100%;\n padding: var(--spacing-4) var(--spacing-4) var(--spacing-4)\n var(--spacing-8);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-full);\n margin-bottom: var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n font-size: var(--text-12);\n }\n\n &__pointer-icon {\n flex-shrink: 0;\n width: var(--spacing-14);\n height: var(--spacing-14);\n }\n\n // The automatic confirmations, while they hold: the same chip, a\n // button as a whole, since one click takes them back to manual\n &__mode {\n display: flex;\n align-items: center;\n gap: var(--spacing-6);\n align-self: flex-start;\n padding: var(--spacing-4) var(--spacing-8);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-full);\n margin-bottom: var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n font: inherit;\n font-size: var(--text-12);\n cursor: pointer;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n\n &:focus-visible {\n outline: 2px solid var(--color-brand);\n outline-offset: 2px;\n }\n }\n\n &__pointer-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__counter {\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-md);\n font-size: var(--text-12);\n color: var(--color-word-3);\n line-height: 1;\n padding-inline: var(--spacing-6);\n padding-block: var(--spacing-4);\n z-index: 1;\n font-variant-numeric: tabular-nums;\n font-family: var(--font-mono);\n font-weight: var(--font-bold);\n\n &--over {\n color: var(--u-danger-text, var(--color-danger));\n border-color: var(--color-danger-lighten-5);\n font-weight: var(--font-bold);\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n // @ts-expect-error - no types for autosize\n import autosize from 'autosize'\n import {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n } from 'vue'\n import { useResizeObserver } from '@vueuse/core'\n import { codeExtensionsOf, type AgentFileUpload } from 'models'\n import type { PendingAttachment } from 'composables'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n import PkChatButton from './PkChatButton.vue'\n\n // --- Models & Props ---\n\n const modelValue = defineModel<string | undefined>({ default: undefined })\n const pendingAttachments = defineModel<PendingAttachment[]>(\n 'pendingAttachments',\n { default: () => [] },\n )\n\n const emit = defineEmits<{\n submit: []\n 'stop-generation': []\n 'file-select': [file: File]\n 'dismiss-attachment-notice': []\n 'dismiss-page-notice': []\n 'open-answer-notice': [id: string]\n 'dismiss-answer-notice': [id: string]\n 'voice-start': []\n /** Point at the page (spec `page-point-and-choose.md`, P). */\n point: []\n 'remove-pointer': []\n /** The user clicked the \"Automatic\" label: back to manual confirmations. */\n 'manual-confirmations': []\n }>()\n\n const props = defineProps<{\n placeholder?: string\n dismissableNotice?: string\n /**\n * What the agent can do on the page that embeds the chat (spec\n * `page-tools.md`). Its closing is the caller's to remember.\n */\n pageNotice?: string\n status?: 'submitted' | 'streaming' | 'ready' | 'error'\n maxMessageLength?: number\n fileUpload?: AgentFileUpload\n attachmentLimitReached?: boolean\n attachmentNotice?: string\n /** Show the talk button: the agent has voice enabled. */\n voiceEnabled?: boolean\n /**\n * What is written while the agent answers is queued and sent when the\n * answer ends (spec resumable-chat-streams, F2): sending stays open.\n */\n queueEnabled?: boolean\n /** Answers that ended in another conversation, each with its own line and its \"Open\". */\n answerNotices?: { id: string; text: string }[]\n /** The user may point at the page that embeds the chat: the button shows. */\n pointerAvailable?: boolean\n /** The user is pointing at the page now. */\n pointing?: boolean\n /** What the user pointed at for this message: the chip above the field. */\n pointer?: { kind: 'element' | 'text'; label: string }\n /**\n * The user chose automatic confirmations (spec\n * `auto-confirmations.md`): a label above the field says so, and\n * takes them back to manual.\n */\n automaticConfirmations?: boolean\n }>()\n\n // --- Template refs ---\n\n const textareaEl = useTemplateRef<HTMLTextAreaElement>('textareaEl')\n const fileInputEl = useTemplateRef<HTMLInputElement>('fileInputEl')\n const cameraInputEl = useTemplateRef<HTMLInputElement>('cameraInputEl')\n const formEl = useTemplateRef<HTMLFormElement>('formEl')\n\n // --- Input buffering (decouples typing from reactive model propagation) ---\n\n const localValue = ref(modelValue.value ?? '')\n let syncTimer: ReturnType<typeof setTimeout> | null = null\n\n const cancelSync = () => {\n if (syncTimer !== null) {\n clearTimeout(syncTimer)\n syncTimer = null\n }\n }\n\n const flushSync = () => {\n cancelSync()\n modelValue.value = localValue.value\n }\n\n const scheduleSync = () => {\n cancelSync()\n syncTimer = setTimeout(() => {\n modelValue.value = localValue.value\n syncTimer = null\n }, 300)\n }\n\n const onTextareaInput = () => {\n localValue.value = textareaEl.value?.value ?? ''\n scheduleSync()\n }\n\n watch(modelValue, (v) => {\n if (v !== localValue.value) {\n localValue.value = v ?? ''\n nextTick(() => {\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n })\n }\n })\n\n // --- Status computeds ---\n\n const isStreaming = computed(() => props.status === 'streaming')\n const isSubmitted = computed(() => props.status === 'submitted')\n const isInputDisabled = computed(\n () => isStreaming.value || isSubmitted.value,\n )\n\n // --- Validation ---\n\n const counterId = useId()\n const currentLength = computed(() => localValue.value.length)\n\n const isOverLimit = computed(\n () =>\n props.maxMessageLength !== undefined &&\n currentLength.value > props.maxMessageLength,\n )\n\n const isUploadingAnyFile = computed(() =>\n pendingAttachments.value.some((a) => a.state === 'uploading'),\n )\n\n const isSubmitEnabled = computed(() => {\n if (\n (isInputDisabled.value && !props.queueEnabled) ||\n isUploadingAnyFile.value ||\n isOverLimit.value\n ) {\n return false\n }\n return localValue.value.trim().length > 0\n })\n\n /** Written during an answer: the send button queues it, next to the stop. */\n const isQueueing = computed(\n () => isInputDisabled.value && isSubmitEnabled.value,\n )\n\n // --- File upload ---\n\n const hasCaptureSupport = 'capture' in document.createElement('input')\n\n // A browser filters the picker by type and knows few code types: their\n // extensions go along.\n const acceptMimeTypes = computed(() => {\n const allowed = props.fileUpload?.allowedMimeTypes ?? []\n return [...allowed, ...codeExtensionsOf(allowed)].join(',')\n })\n\n const acceptImageMimeTypes = computed(() =>\n (props.fileUpload?.allowedMimeTypes ?? [])\n .filter((m) => m.startsWith('image/'))\n .join(','),\n )\n\n const showCameraOption = computed(\n () => hasCaptureSupport && acceptImageMimeTypes.value.length > 0,\n )\n\n const openFilePicker = () => {\n fileInputEl.value?.click()\n }\n\n const openCameraPicker = () => {\n cameraInputEl.value?.click()\n }\n\n // The store owns the attachment limits and drops any overflow; the input\n // just forwards every picked/dropped file.\n const emitFiles = (files: File[]) => {\n for (const file of files) {\n emit('file-select', file)\n }\n }\n\n const onFileChange = (event: Event) => {\n const input = event.target as HTMLInputElement\n emitFiles(Array.from(input.files ?? []))\n input.value = ''\n }\n\n // --- Attachments ---\n\n const removeAttachment = (id: string) => {\n const att = pendingAttachments.value.find((a) => a.id === id)\n if (att) {\n URL.revokeObjectURL(att.localUrl)\n }\n pendingAttachments.value = pendingAttachments.value.filter(\n (a) => a.id !== id,\n )\n }\n\n // --- Notices (one box above the input) ---\n\n type InputNotice = {\n id: string\n text?: string\n markdown?: string\n icon?: string\n open?: () => void\n dismiss?: () => void\n }\n\n const isDismissableNoticeVisible = ref(true)\n const closeDismissableNotice = () => {\n isDismissableNoticeVisible.value = false\n }\n\n const activeNotices = computed<InputNotice[]>(() => {\n // The alert answers what the user just did, and takes the box alone\n // until it is closed.\n if (props.attachmentNotice) {\n return [\n {\n id: 'limit',\n icon: 'ri:information-line',\n text: props.attachmentNotice,\n dismiss: () => emit('dismiss-attachment-notice'),\n },\n ]\n }\n const notices: InputNotice[] = []\n // An answer that ended where the user is not: news, so it comes\n // first, and it leaves once opened or closed.\n for (const notice of props.answerNotices ?? []) {\n notices.push({\n id: `answer-${notice.id}`,\n icon: 'ri:chat-check-line',\n text: notice.text,\n open: () => emit('open-answer-notice', notice.id),\n dismiss: () => emit('dismiss-answer-notice', notice.id),\n })\n }\n // What the agent does on this page, next: the user should read it\n // before writing. The agent's own notice stays beside it, never\n // behind it: it is where an agent states its terms, a privacy\n // policy among them.\n if (props.pageNotice) {\n notices.push({\n id: 'page',\n icon: 'ri:pages-line',\n text: props.pageNotice,\n dismiss: () => emit('dismiss-page-notice'),\n })\n }\n if (props.dismissableNotice && isDismissableNoticeVisible.value) {\n notices.push({\n id: 'dismissable',\n markdown: props.dismissableNotice,\n dismiss: closeDismissableNotice,\n })\n }\n return notices\n })\n\n // --- Submit ---\n\n /**\n * Send turns disabled and then gives way to stop, stop gives way to send:\n * a keyboard user who pressed one would be left on the page body. Hand\n * the focus to the textarea, but only after a keyboard press: a tap has no\n * focus to keep, and focusing would bring the phone keyboard back up over\n * the answer.\n */\n const keepKeyboardFocus = () => {\n if (formEl.value?.querySelector('button:focus-visible')) {\n textareaEl.value?.focus()\n }\n }\n\n const stopGeneration = () => {\n keepKeyboardFocus()\n emit('stop-generation')\n }\n\n const handleSubmit = () => {\n if (!isSubmitEnabled.value) {\n return\n }\n keepKeyboardFocus()\n flushSync()\n emit('submit')\n localValue.value = ''\n modelValue.value = ''\n nextTick(() => {\n if (textareaEl.value) {\n textareaEl.value.value = ''\n autosize.update(textareaEl.value)\n }\n })\n }\n\n /**\n * Enter sends, Shift+Enter goes to a new line. The Enter that confirms an\n * IME composition (Japanese, Chinese, Korean) belongs to the composition:\n * Safari reports it with `isComposing` already false, hence the 229.\n */\n const onTextareaEnter = (event: KeyboardEvent) => {\n if (event.shiftKey || event.isComposing || event.keyCode === 229) {\n return\n }\n event.preventDefault()\n handleSubmit()\n }\n\n // --- Lifecycle ---\n\n onMounted(() => {\n if (textareaEl.value) {\n autosize(textareaEl.value)\n }\n })\n\n // autosize measures on input and on a window resize only, and an empty\n // textarea measures its placeholder. The chat settles its layout after\n // mount: measured at a first, narrower width, the placeholder wrapped,\n // and on the chat page of a phone the field stayed 88px tall, four lines\n // with the text at their top, until the user typed. Measured again when\n // its width changes, or its placeholder.\n let textareaWidth = 0\n useResizeObserver(textareaEl, ([entry]) => {\n const width = entry?.contentRect.width ?? 0\n if (textareaEl.value && width !== textareaWidth) {\n textareaWidth = width\n autosize.update(textareaEl.value)\n }\n })\n watch(\n () => props.placeholder,\n async () => {\n await nextTick()\n if (textareaEl.value) {\n autosize.update(textareaEl.value)\n }\n },\n )\n\n onBeforeUnmount(() => {\n cancelSync()\n if (textareaEl.value) {\n autosize.destroy(textareaEl.value)\n }\n for (const att of pendingAttachments.value) {\n URL.revokeObjectURL(att.localUrl)\n }\n })\n\n defineExpose({\n /** Move the focus to the message field */\n focus: () => textareaEl.value?.focus(),\n })\n</script>\n\n<template>\n <div class=\"pk-chatbot-input\">\n <div\n v-if=\"activeNotices.length\"\n class=\"pk-chatbot-input__notice\"\n role=\"status\">\n <div\n v-for=\"notice in activeNotices\"\n :key=\"notice.id\"\n class=\"pk-chatbot-input__notice-item\">\n <VvIcon\n v-if=\"notice.icon\"\n :name=\"notice.icon\"\n class=\"pk-chatbot-input__notice-icon\" />\n <PkStreamingMarkdown\n v-if=\"notice.markdown\"\n :markdown=\"notice.markdown\"\n class=\"wysiwyg pk-chatbot-input__notice-text\" />\n <span v-else class=\"pk-chatbot-input__notice-text\">\n {{ notice.text }}\n </span>\n <VvButton\n v-if=\"notice.open\"\n :label=\"$t('action.open')\"\n modifiers=\"link\"\n class=\"pk-chatbot-input__notice-action\"\n @click=\"notice.open()\" />\n <VvButton\n v-if=\"notice.dismiss\"\n :title=\"$t('action.close')\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n class=\"w-18 h-18\"\n @click=\"notice.dismiss()\" />\n </div>\n </div>\n <form\n ref=\"formEl\"\n class=\"pk-chatbot-input__form\"\n @submit.prevent=\"handleSubmit\">\n <button\n v-if=\"automaticConfirmations\"\n type=\"button\"\n class=\"pk-chatbot-input__mode\"\n :title=\"$t('action.manualConfirmations')\"\n @click=\"emit('manual-confirmations')\">\n <VvIcon\n name=\"ri:flashlight-line\"\n class=\"pk-chatbot-input__pointer-icon\" />\n {{ $t('label.automaticConfirmations') }}\n <VvIcon\n name=\"ri:close-line\"\n class=\"pk-chatbot-input__pointer-icon\" />\n </button>\n <div v-if=\"pointer\" class=\"pk-chatbot-input__pointer\">\n <VvIcon\n :name=\"\n pointer.kind === 'text'\n ? 'ri:double-quotes-l'\n : 'ri:focus-3-line'\n \"\n class=\"pk-chatbot-input__pointer-icon\" />\n <span class=\"pk-chatbot-input__pointer-label\">\n {{\n pointer.kind === 'text'\n ? `«${pointer.label}»`\n : pointer.label\n }}\n </span>\n <VvButton\n :title=\"$t('pagePointer.remove')\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n class=\"w-18 h-18\"\n @click=\"emit('remove-pointer')\" />\n </div>\n <div\n v-if=\"pendingAttachments.length\"\n class=\"pk-chatbot-input__attachments\">\n <PkChatbotFilePreview\n v-for=\"att in pendingAttachments\"\n :key=\"att.id\"\n :media-type=\"att.mediaSource?.mimeType ?? att.file.type\"\n :url=\"att.localUrl\"\n :filename=\"att.file.name\"\n :size=\"att.file.size\"\n :loading=\"att.state === 'uploading'\"\n :error=\"att.state === 'error' ? att.error : undefined\"\n :removable=\"att.state !== 'uploading'\"\n compact\n @remove=\"removeAttachment(att.id)\" />\n </div>\n <div class=\"pk-chatbot-input__fieldset\">\n <slot name=\"prepend\" />\n <VvDropdown\n v-if=\"\n fileUpload &&\n fileUpload.enabled &&\n (showCameraOption || $slots['additional-actions'])\n \"\n v-bind=\"{\n placement: 'top-start',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n }\">\n <template #default=\"{ init, toggle, aria }\">\n <!-- The only one still written by hand: the dropdown\n anchors itself to whatever `init` receives, and that\n has to be the element, not a component instance -->\n <button\n :ref=\"(e: any) => init(e)\"\n v-bind=\"aria\"\n class=\"pk-chat-button\"\n type=\"button\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled\"\n @click=\"toggle\">\n <VvIcon\n name=\"ri:add-line\"\n class=\"pk-chat-button__icon\" />\n </button>\n </template>\n <template #items>\n <VvDropdownAction\n v-if=\"showCameraOption\"\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openCameraPicker\">\n <VvIcon\n name=\"ri:camera-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.takePhoto') }}\n </VvDropdownAction>\n <VvDropdownAction\n :disabled=\"\n isInputDisabled || attachmentLimitReached\n \"\n @click=\"openFilePicker\">\n <VvIcon\n name=\"ri:attachment-line\"\n class=\"pk-chatbot-input__dropdown-icon\" />\n {{ $t('action.attachFile') }}\n </VvDropdownAction>\n <slot name=\"additional-actions\" />\n </template>\n </VvDropdown>\n <PkChatButton\n v-else-if=\"fileUpload && fileUpload.enabled\"\n icon=\"ri:add-line\"\n :title=\"$t('action.attachFile')\"\n :disabled=\"isInputDisabled || attachmentLimitReached\"\n @click=\"openFilePicker\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled\"\n ref=\"fileInputEl\"\n type=\"file\"\n hidden\n multiple\n :accept=\"acceptMimeTypes\"\n @change=\"onFileChange\" />\n <input\n v-if=\"fileUpload && fileUpload.enabled && showCameraOption\"\n ref=\"cameraInputEl\"\n type=\"file\"\n capture=\"environment\"\n hidden\n :accept=\"acceptImageMimeTypes\"\n @change=\"onFileChange\" />\n <PkChatButton\n v-if=\"pointerAvailable\"\n icon=\"ri:focus-3-line\"\n :title=\"$t('pagePointer.start')\"\n :aria-pressed=\"pointing\"\n :disabled=\"isInputDisabled\"\n @click=\"emit('point')\" />\n <div class=\"pk-chatbot-input__content\">\n <textarea\n ref=\"textareaEl\"\n :value=\"localValue\"\n class=\"pk-chatbot-input__textarea\"\n name=\"message\"\n rows=\"1\"\n enterkeyhint=\"send\"\n :aria-label=\"$t('label.message')\"\n :aria-describedby=\"\n maxMessageLength ? counterId : undefined\n \"\n :aria-invalid=\"isOverLimit || undefined\"\n :placeholder\n @input=\"onTextareaInput\"\n @keydown.enter=\"onTextareaEnter\"></textarea>\n </div>\n <div\n v-if=\"maxMessageLength\"\n :id=\"counterId\"\n class=\"pk-chatbot-input__counter\"\n :class=\"{ 'pk-chatbot-input__counter--over': isOverLimit }\">\n {{ $n(currentLength, 'integer') }}/<span\n class=\"opacity-60\"\n >{{ $n(maxMessageLength, 'integer') }}</span\n >\n </div>\n <PkChatButton\n v-if=\"voiceEnabled && !isStreaming\"\n icon=\"ri:mic-line\"\n :title=\"$t('action.talk')\"\n :disabled=\"isInputDisabled\"\n @click=\"emit('voice-start')\" />\n <!-- With a message to queue the send button is the filled one,\n and the stop steps back beside it -->\n <PkChatButton\n v-if=\"isStreaming\"\n icon=\"ri:stop-fill\"\n :modifiers=\"isQueueing ? undefined : 'primary'\"\n :title=\"$t('action.stop')\"\n @click=\"stopGeneration\" />\n <PkChatButton\n v-if=\"isQueueing\"\n type=\"submit\"\n modifiers=\"primary\"\n icon=\"ri:arrow-up-line\"\n :title=\"$t('action.queueMessage')\" />\n <PkChatButton\n v-else-if=\"!isStreaming\"\n type=\"submit\"\n modifiers=\"primary\"\n :icon=\"isSubmitted ? 'loading-loop' : 'ri:arrow-up-line'\"\n :title=\"$t('action.submit')\"\n :disabled=\"!isSubmitEnabled\" />\n </div>\n </form>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-input {\n position: relative;\n display: flex;\n flex-direction: column;\n margin-inline: var(--spacing-sm);\n margin-bottom: var(--spacing-sm);\n\n &__notice {\n position: relative;\n padding: var(--spacing-10) var(--spacing-sm);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-10);\n background-color: var(--color-surface-1);\n border-top-left-radius: var(--rounded-xl);\n border-top-right-radius: var(--rounded-xl);\n transition-property: var(--transition-property-all);\n transition-duration: var(--duration-300);\n transition-timing-function: var(--ease-in-out);\n font-size: var(--text-12);\n color: var(--color-word-4);\n\n &::after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: calc(-1 * var(--spacing-12));\n height: var(--spacing-12);\n background-color: var(--color-surface-1);\n z-index: 1;\n }\n\n // Two notices read as two lines of one box, with a hairline\n // between them\n &-item {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-sm);\n\n & + & {\n padding-top: var(--spacing-10);\n border-top: 1px solid var(--color-surface-3);\n }\n }\n\n &-icon {\n flex-shrink: 0;\n width: var(--spacing-18);\n height: var(--spacing-18);\n }\n\n &-text {\n flex: 1;\n min-width: 0;\n }\n\n // A word of the line's size, on the line: the notice stays one\n // quiet row, not a button bar\n &-action {\n flex-shrink: 0;\n font-size: inherit;\n }\n }\n\n &__form {\n position: relative;\n display: flex;\n z-index: 1;\n flex-direction: column;\n\n // The composer is a field too: same border and focus ring as the\n // form fields, on top of the shadow and the 12px radius that make\n // it the container (12) of its 8px buttons\n border-radius: var(--rounded-xl);\n border: 1px solid var(--input-border-color);\n background-color: var(--color-surface);\n padding: var(--spacing-14);\n box-shadow: var(--shadow-lg);\n font-size: var(\n --text-16\n ); // prevent ios zoom on input focus by using a font size >= 16px\n\n gap: var(--spacing-xs);\n transition: var(--input-transition);\n\n @include media-breakpoint-up('sm', $breakpoints) {\n font-size: var(--text-14);\n padding: var(--spacing-10);\n }\n\n &:has(:focus-within) {\n border-color: var(--input-focus-color);\n box-shadow: var(--shadow-lg), var(--input-focus-ring);\n }\n }\n\n &__fieldset {\n display: flex;\n align-items: center;\n gap: var(--spacing-xs);\n flex: 1;\n\n // The buttons answer 8px around themselves on a touch screen\n // (PkChatButton): 12px apart, neither takes the other's box\n @media (pointer: coarse) {\n gap: var(--spacing-12);\n }\n }\n\n &__content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: var(--spacing-4);\n min-width: 0;\n overflow: hidden;\n }\n\n &__textarea {\n display: block;\n border: none;\n outline: none;\n resize: none;\n width: 100%;\n max-height: 200px;\n color: var(--color-word-1);\n background-color: var(--color-surface);\n\n &::placeholder {\n color: var(--color-word-4);\n }\n }\n\n &__attachments {\n display: flex;\n flex-wrap: wrap;\n\n // Roomy gap so the uniform-height chips breathe in the row.\n gap: var(--spacing-12);\n padding-bottom: var(--spacing-xs);\n border-bottom: 1px solid var(--color-surface-2);\n }\n\n // What the user pointed at on the page: one chip, the element's name\n // or the selected text, on one line\n &__pointer {\n display: flex;\n align-items: center;\n gap: var(--spacing-6);\n align-self: flex-start;\n max-width: 100%;\n padding: var(--spacing-4) var(--spacing-4) var(--spacing-4)\n var(--spacing-8);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-full);\n margin-bottom: var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n font-size: var(--text-12);\n }\n\n &__pointer-icon {\n flex-shrink: 0;\n width: var(--spacing-14);\n height: var(--spacing-14);\n }\n\n // The automatic confirmations, while they hold: the same chip, a\n // button as a whole, since one click takes them back to manual\n &__mode {\n display: flex;\n align-items: center;\n gap: var(--spacing-6);\n align-self: flex-start;\n padding: var(--spacing-4) var(--spacing-8);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-full);\n margin-bottom: var(--spacing-8);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n font: inherit;\n font-size: var(--text-12);\n cursor: pointer;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n\n &:focus-visible {\n outline: 2px solid var(--color-brand);\n outline-offset: 2px;\n }\n }\n\n &__pointer-label {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__counter {\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--rounded-md);\n font-size: var(--text-12);\n color: var(--color-word-3);\n line-height: 1;\n padding-inline: var(--spacing-6);\n padding-block: var(--spacing-4);\n z-index: 1;\n font-variant-numeric: tabular-nums;\n font-family: var(--font-mono);\n font-weight: var(--font-bold);\n\n &--over {\n color: var(--u-danger-text, var(--color-danger));\n border-color: var(--color-danger-lighten-5);\n font-weight: var(--font-bold);\n }\n }\n }\n</style>\n"],"ignoreList":[0],"mappings":";;;;;;;;AAAA,IAAI2C,oBAAE,IAAI,IAAE;AAAE,SAASC,EAAE,GAAE;CAAC,IAAIC,IAAEF,EAAE,IAAIC,CAAC;CAAE,KAAGC,EAAE,QAAQ;AAAC;AAAC,SAASA,EAAE,GAAE;CAAC,IAAIA,IAAEF,EAAE,IAAIC,CAAC;CAAE,KAAGC,EAAE,OAAO;AAAC;AAAC,IAAIC,IAAE;AAAkB,OAAO,S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