@8wave/ai-elements 0.122.0-beta.1 → 0.122.0-beta.10

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.
Files changed (130) hide show
  1. package/dist/_chunks/{Agent-8tYRuiJc.js → Agent-BcmcalNN.js} +2 -1
  2. package/dist/_chunks/{Agent-8tYRuiJc.js.map → Agent-BcmcalNN.js.map} +1 -1
  3. package/dist/_chunks/PkChatbotFilePreview-D5jwgPp8.js.map +1 -1
  4. package/dist/_chunks/{PkStreamingMarkdown-BAiI6n72.js → PkStreamingMarkdown-Dc0R0GHe.js} +22 -16
  5. package/dist/_chunks/PkStreamingMarkdown-Dc0R0GHe.js.map +1 -0
  6. package/dist/_chunks/PkToolChatFile-BsvJIdgo.js +181 -0
  7. package/dist/_chunks/PkToolChatFile-BsvJIdgo.js.map +1 -0
  8. package/dist/_chunks/{PkToolRequestGeolocation-D1n5Gvks.js → PkToolRequestGeolocation-n1W_drCv.js} +2 -2
  9. package/dist/_chunks/{PkToolRequestGeolocation-D1n5Gvks.js.map → PkToolRequestGeolocation-n1W_drCv.js.map} +1 -1
  10. package/dist/_chunks/{PkToolRequestOAuthConnection-2PzVZ_mh.js → PkToolRequestOAuthConnection-DmMeSF2m.js} +2 -2
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-2PzVZ_mh.js.map → PkToolRequestOAuthConnection-DmMeSF2m.js.map} +1 -1
  12. package/dist/_chunks/{PkToolShowArtifact-B2jj0PEo.js → PkToolShowArtifact-BUnSqAWQ.js} +2 -2
  13. package/dist/_chunks/{PkToolShowArtifact-B2jj0PEo.js.map → PkToolShowArtifact-BUnSqAWQ.js.map} +1 -1
  14. package/dist/_chunks/{PkToolShowContactForm-DNJaM53a.js → PkToolShowContactForm-YX1BuolZ.js} +2 -2
  15. package/dist/_chunks/{PkToolShowContactForm-DNJaM53a.js.map → PkToolShowContactForm-YX1BuolZ.js.map} +1 -1
  16. package/dist/_chunks/{PkToolShowForm-Dbua7aMG.js → PkToolShowForm-CkpMsrEo.js} +3 -3
  17. package/dist/_chunks/{PkToolShowForm-Dbua7aMG.js.map → PkToolShowForm-CkpMsrEo.js.map} +1 -1
  18. package/dist/_chunks/{PkToolShowImageGallery-nRTnWZUj.js → PkToolShowImageGallery-BnUnjFeU.js} +2 -2
  19. package/dist/_chunks/{PkToolShowImageGallery-nRTnWZUj.js.map → PkToolShowImageGallery-BnUnjFeU.js.map} +1 -1
  20. package/dist/_chunks/{PkToolShowProductList-NMRtT3fT.js → PkToolShowProductList-CPqmqS-Q.js} +2 -2
  21. package/dist/_chunks/{PkToolShowProductList-NMRtT3fT.js.map → PkToolShowProductList-CPqmqS-Q.js.map} +1 -1
  22. package/dist/_chunks/{PkToolShowSources-CFcTbjcM.js → PkToolShowSources-BO1IhnmO.js} +3 -3
  23. package/dist/_chunks/{PkToolShowSources-CFcTbjcM.js.map → PkToolShowSources-BO1IhnmO.js.map} +1 -1
  24. package/dist/_chunks/{PkToolShowSuggestedReply-CeK6mICV.js → PkToolShowSuggestedReply-79UAjTL4.js} +2 -2
  25. package/dist/_chunks/{PkToolShowSuggestedReply-CeK6mICV.js.map → PkToolShowSuggestedReply-79UAjTL4.js.map} +1 -1
  26. package/dist/_chunks/{PkToolShowVideo-BN3AaLy1.js → PkToolShowVideo-DYnH3VIc.js} +2 -2
  27. package/dist/_chunks/{PkToolShowVideo-BN3AaLy1.js.map → PkToolShowVideo-DYnH3VIc.js.map} +1 -1
  28. package/dist/_chunks/{PkToolShowWebPages-DfBR8eAU.js → PkToolShowWebPages-Ci_Yut6X.js} +2 -2
  29. package/dist/_chunks/{PkToolShowWebPages-DfBR8eAU.js.map → PkToolShowWebPages-Ci_Yut6X.js.map} +1 -1
  30. package/dist/_chunks/{chatImagePolicy-C2-Hy63z.js → chatImagePolicy-B5-NwmIR.js} +2 -2
  31. package/dist/_chunks/{chatImagePolicy-C2-Hy63z.js.map → chatImagePolicy-B5-NwmIR.js.map} +1 -1
  32. package/dist/_chunks/{markdown-B-_gMLvu.js → markdown-_sL6w03k.js} +2 -2
  33. package/dist/_chunks/{markdown-B-_gMLvu.js.map → markdown-_sL6w03k.js.map} +1 -1
  34. package/dist/ai-elements.es.js +65 -28
  35. package/dist/ai-elements.es.js.map +1 -1
  36. package/dist-vue/PkChatbot.js +1 -1
  37. package/dist-vue/PkChatbotEmptyState.js +1 -1
  38. package/dist-vue/PkChatbotInput.js +1 -1
  39. package/dist-vue/PkChatbotMessages.js +1 -1
  40. package/dist-vue/PkChatbotStepPayload.js +1 -1
  41. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  42. package/dist-vue/PkChatbotSteps.js +1 -1
  43. package/dist-vue/PkChatbotViewChat.js +1 -1
  44. package/dist-vue/PkChatbotViewConversations.js +1 -1
  45. package/dist-vue/PkChatbotViewFiles.js +1 -1
  46. package/dist-vue/PkChatbotViewProfile.js +1 -1
  47. package/dist-vue/_chunks/{Agent-CYUPbFnK.js → Agent-BWwjGG2f.js} +2 -1
  48. package/dist-vue/_chunks/{Agent-CYUPbFnK.js.map → Agent-BWwjGG2f.js.map} +1 -1
  49. package/dist-vue/_chunks/{Document-BvZ768dH.js → Document-DvRaziIf.js} +2 -2
  50. package/dist-vue/_chunks/{Document-BvZ768dH.js.map → Document-DvRaziIf.js.map} +1 -1
  51. package/dist-vue/_chunks/PkAvatar-DwtZWSW4.js.map +1 -1
  52. package/dist-vue/_chunks/{PkChatbot-BVw3-kJg.js → PkChatbot-B7JaLUZw.js} +8 -8
  53. package/dist-vue/_chunks/PkChatbot-B7JaLUZw.js.map +1 -0
  54. package/dist-vue/_chunks/{PkChatbotEmptyState-DuLoc_ym.js → PkChatbotEmptyState-B76oD7fB.js} +2 -2
  55. package/dist-vue/_chunks/{PkChatbotEmptyState-DuLoc_ym.js.map → PkChatbotEmptyState-B76oD7fB.js.map} +1 -1
  56. package/dist-vue/_chunks/PkChatbotFilePreview-CzmGvKjI.js.map +1 -1
  57. package/dist-vue/_chunks/{PkChatbotInput-XbH8I-uH.js → PkChatbotInput-BT51V-v4.js} +2 -2
  58. package/dist-vue/_chunks/{PkChatbotInput-XbH8I-uH.js.map → PkChatbotInput-BT51V-v4.js.map} +1 -1
  59. package/dist-vue/_chunks/PkChatbotMessageFeedback-DltXugdR.js.map +1 -1
  60. package/dist-vue/_chunks/{PkChatbotMessages-DcIpivBs.js → PkChatbotMessages-qkodgdDE.js} +17 -17
  61. package/dist-vue/_chunks/{PkChatbotMessages-DcIpivBs.js.map → PkChatbotMessages-qkodgdDE.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkChatbotStepPayload-DXhatUfJ.js → PkChatbotStepPayload-BYChvULZ.js} +2 -2
  63. package/dist-vue/_chunks/PkChatbotStepPayload-BYChvULZ.js.map +1 -0
  64. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Sm5cPUAO.js → PkChatbotStepToolDetail-BysPl2ko.js} +3 -3
  65. package/dist-vue/_chunks/PkChatbotStepToolDetail-BysPl2ko.js.map +1 -0
  66. package/dist-vue/_chunks/{PkChatbotSteps-CWFBX7Rl.js → PkChatbotSteps-p8-SuGGe.js} +5 -5
  67. package/dist-vue/_chunks/{PkChatbotSteps-CWFBX7Rl.js.map → PkChatbotSteps-p8-SuGGe.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotViewChat-C_dLjNVo.js → PkChatbotViewChat-Djts78Oq.js} +7 -7
  69. package/dist-vue/_chunks/PkChatbotViewChat-Djts78Oq.js.map +1 -0
  70. package/dist-vue/_chunks/{PkChatbotViewConversations-DgOFajfO.js → PkChatbotViewConversations-4ZJF-y5q.js} +3 -3
  71. package/dist-vue/_chunks/{PkChatbotViewConversations-DgOFajfO.js.map → PkChatbotViewConversations-4ZJF-y5q.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkChatbotViewFiles-DyKSUXeX.js → PkChatbotViewFiles-CfPwNcvf.js} +3 -3
  73. package/dist-vue/_chunks/{PkChatbotViewFiles-DyKSUXeX.js.map → PkChatbotViewFiles-CfPwNcvf.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkChatbotViewProfile-BXrOGpjB.js → PkChatbotViewProfile-Dd8EhOx3.js} +2 -2
  75. package/dist-vue/_chunks/{PkChatbotViewProfile-BXrOGpjB.js.map → PkChatbotViewProfile-Dd8EhOx3.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkStreamingMarkdown-B5vQ1ZZ8.js → PkStreamingMarkdown-B-sEx8BP.js} +378 -372
  77. package/dist-vue/_chunks/PkStreamingMarkdown-B-sEx8BP.js.map +1 -0
  78. package/dist-vue/_chunks/PkToolChatFile-s46esp0O.js +179 -0
  79. package/dist-vue/_chunks/PkToolChatFile-s46esp0O.js.map +1 -0
  80. package/dist-vue/_chunks/{PkToolRequestGeolocation-BHqLXZDd.js → PkToolRequestGeolocation-e8vyxTI_.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolRequestGeolocation-BHqLXZDd.js.map → PkToolRequestGeolocation-e8vyxTI_.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Cg6T3gzF.js → PkToolRequestOAuthConnection-3zLvNF_c.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Cg6T3gzF.js.map → PkToolRequestOAuthConnection-3zLvNF_c.js.map} +1 -1
  84. package/dist-vue/_chunks/{PkToolShowArtifact-Clvs-28Q.js → PkToolShowArtifact-BRwa5pGY.js} +2 -2
  85. package/dist-vue/_chunks/{PkToolShowArtifact-Clvs-28Q.js.map → PkToolShowArtifact-BRwa5pGY.js.map} +1 -1
  86. package/dist-vue/_chunks/{PkToolShowContactForm-DA3KYufo.js → PkToolShowContactForm-xHBTmITM.js} +2 -2
  87. package/dist-vue/_chunks/{PkToolShowContactForm-DA3KYufo.js.map → PkToolShowContactForm-xHBTmITM.js.map} +1 -1
  88. package/dist-vue/_chunks/{PkToolShowDiagram-DxPuGWin.js → PkToolShowDiagram-DrJs92dg.js} +2 -2
  89. package/dist-vue/_chunks/{PkToolShowDiagram-DxPuGWin.js.map → PkToolShowDiagram-DrJs92dg.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolShowForm-DdA2UM-T.js → PkToolShowForm-Fv4iV0VY.js} +4 -4
  91. package/dist-vue/_chunks/{PkToolShowForm-DdA2UM-T.js.map → PkToolShowForm-Fv4iV0VY.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowImageGallery-B_dA0S6H.js → PkToolShowImageGallery-DD_RGcL6.js} +2 -2
  93. package/dist-vue/_chunks/{PkToolShowImageGallery-B_dA0S6H.js.map → PkToolShowImageGallery-DD_RGcL6.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkToolShowProductList-ubDejlbK.js → PkToolShowProductList-8UQSQvRr.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowProductList-ubDejlbK.js.map → PkToolShowProductList-8UQSQvRr.js.map} +1 -1
  96. package/dist-vue/_chunks/{PkToolShowSources-CRGyOz2J.js → PkToolShowSources-C4rKpypf.js} +3 -3
  97. package/dist-vue/_chunks/{PkToolShowSources-CRGyOz2J.js.map → PkToolShowSources-C4rKpypf.js.map} +1 -1
  98. package/dist-vue/_chunks/{PkToolShowSuggestedReply-zFmhR7Ju.js → PkToolShowSuggestedReply-Bnhgsh4l.js} +2 -2
  99. package/dist-vue/_chunks/{PkToolShowSuggestedReply-zFmhR7Ju.js.map → PkToolShowSuggestedReply-Bnhgsh4l.js.map} +1 -1
  100. package/dist-vue/_chunks/{PkToolShowVideo-LapBUydt.js → PkToolShowVideo-NOwtZPgI.js} +2 -2
  101. package/dist-vue/_chunks/{PkToolShowVideo-LapBUydt.js.map → PkToolShowVideo-NOwtZPgI.js.map} +1 -1
  102. package/dist-vue/_chunks/{PkToolShowWebPages-CSgdDZF6.js → PkToolShowWebPages-DcPboNwp.js} +2 -2
  103. package/dist-vue/_chunks/{PkToolShowWebPages-CSgdDZF6.js.map → PkToolShowWebPages-DcPboNwp.js.map} +1 -1
  104. package/dist-vue/_chunks/{createChatbotApiClient-rGWQSzZY.js → createChatbotApiClient-y6jA42S0.js} +2 -2
  105. package/dist-vue/_chunks/{createChatbotApiClient-rGWQSzZY.js.map → createChatbotApiClient-y6jA42S0.js.map} +1 -1
  106. package/dist-vue/_chunks/{useChatbotStore-BBUPN1Fa.js → useChatbotStore-DCXyql8U.js} +3 -3
  107. package/dist-vue/_chunks/{useChatbotStore-BBUPN1Fa.js.map → useChatbotStore-DCXyql8U.js.map} +1 -1
  108. package/dist-vue/_chunks/{utils-DAJhpoQS.js → utils-DaAIWTtt.js} +2 -2
  109. package/dist-vue/_chunks/{utils-DAJhpoQS.js.map → utils-DaAIWTtt.js.map} +1 -1
  110. package/dist-vue/api.js +1 -1
  111. package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +1 -3
  112. package/dist-vue/composables.js +44 -7
  113. package/dist-vue/composables.js.map +1 -1
  114. package/dist-vue/index.js +30 -26
  115. package/dist-vue/index.js.map +1 -1
  116. package/dist-vue/locales.js +50 -10
  117. package/dist-vue/packages/components/src/chat/PkToolChatFile.d.ts +3 -1
  118. package/dist-vue/packages/models/src/schema/Agent.d.ts +2 -1
  119. package/dist-vue/style.css +1 -1
  120. package/package.json +1 -1
  121. package/dist/_chunks/PkStreamingMarkdown-BAiI6n72.js.map +0 -1
  122. package/dist/_chunks/PkToolChatFile-BuA7AOQ8.js +0 -50
  123. package/dist/_chunks/PkToolChatFile-BuA7AOQ8.js.map +0 -1
  124. package/dist-vue/_chunks/PkChatbot-BVw3-kJg.js.map +0 -1
  125. package/dist-vue/_chunks/PkChatbotStepPayload-DXhatUfJ.js.map +0 -1
  126. package/dist-vue/_chunks/PkChatbotStepToolDetail-Sm5cPUAO.js.map +0 -1
  127. package/dist-vue/_chunks/PkChatbotViewChat-C_dLjNVo.js.map +0 -1
  128. package/dist-vue/_chunks/PkStreamingMarkdown-B5vQ1ZZ8.js.map +0 -1
  129. package/dist-vue/_chunks/PkToolChatFile-BC_DO--d.js +0 -49
  130. package/dist-vue/_chunks/PkToolChatFile-BC_DO--d.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PkChatbotInput-XbH8I-uH.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","PkChatbotFilePreview","_renderSlot","_normalizeProps","_mergeProps","_withCtx","_createVNode","_createTextVNode","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","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","renderSlot","normalizeProps","mergeProps","withCtx","init","aria","toggle","createTextVNode","unref","withKeys","_cache"],"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 }>()\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 }>()\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 <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 <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 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 // 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 &__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 }>()\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 }>()\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 <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 <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 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 // 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 &__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,SAApB,OAA4B,CAAC,IAAE,SAAS,GAAE;CAAC,OAAO;AAAC,EAAA,CAAG,UAAQ,SAAS,GAAE;CAAC,OAAO;AAAC,GAAE,EAAE,SAAO,SAAS,GAAE;CAAC,OAAO;AAAC,MAAI,CAAC,IAAE,SAAS,GAAE,GAAE;CAAC,OAAOF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lCtD,EADOb,EAAAA,GAAGoD,EAAA,kBAAgB,SAAA,CAAA,GAAA,CAAA,C;IAIrBA,EAAA,gBAAY,CAAKyC,EAAA,SAD3BvF,EAAA,GAAAI,EAKmCa,GAAA;;KAH/B,MAAK;KACJ,OAAOzB,EAAAA,GAAE,aAAA;KACT,UAAUkG,EAAA;KACV,SAAK,AAAA8D,EAAA,QAAA,MAAEhF,EAAI,aAAA;;IAINe,EAAA,SADVvF,EAAA,GAAAI,EAK8Ba,GAAA;;KAH1B,MAAK;KACJ,WAAWgF,EAAA,QAAa,KAAA,IAAS;KACjC,OAAOzG,EAAAA,GAAE,aAAA;KACT,SAAOiI;;IAEFxB,EAAA,SADVjG,EAAA,GAAAI,EAKyCa,GAAA;;KAHrC,MAAK;KACL,WAAU;KACV,MAAK;KACJ,OAAOzB,EAAAA,GAAE,qBAAA;I,0BAEE+F,EAAA,Q,aADhBvF,EAAA,GAAAI,EAMmCa,GAAA;;KAJ/B,MAAK;KACL,WAAU;KACT,MAAMwE,EAAA,QAAW,iBAAA;KACjB,OAAOjG,EAAAA,GAAE,eAAA;KACT,UAAQ,CAAGwG,EAAA"}
1
+ {"version":3,"file":"PkChatbotInput-BT51V-v4.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","PkChatbotFilePreview","_renderSlot","_normalizeProps","_mergeProps","_withCtx","_createVNode","_createTextVNode","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","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","renderSlot","normalizeProps","mergeProps","withCtx","init","aria","toggle","createTextVNode","unref","withKeys","_cache"],"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 }>()\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 }>()\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 <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 <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 &__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 }>()\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 }>()\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 <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 <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 &__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,SAApB,OAA4B,CAAC,IAAE,SAAS,GAAE;CAAC,OAAO;AAAC,EAAA,CAAG,UAAQ,SAAS,GAAE;CAAC,OAAO;AAAC,GAAE,EAAE,SAAO,SAAS,GAAE;CAAC,OAAO;AAAC,MAAI,CAAC,IAAE,SAAS,GAAE,GAAE;CAAC,OAAOF,KAAG,MAAM,UAAU,QAAQ,KAAKA,EAAE,SAAOA,IAAE,CAACA,CAAC,GAAE,SAAS,GAAE;EAAC,OAAO,SAAS,GAAE;GAAC,IAAGA,KAAGA,EAAE,YAAuBA,EAAE,aAAf,cAAyB,CAACD,EAAE,IAAIC,CAAC,GAAE;IAAC,IAAIC,GAAEC,IAAE,MAAKC,IAAE,OAAO,iBAAiBH,CAAC,GAAE,KAAG,IAAEA,EAAE,OAAM,WAAU;KAAC,EAAE;MAAC,wBAA4BC,MAAL,MAAQ,CAACD,EAAE,MAAM,WAAWC,CAAC;MAAE,kBAAiB;KAAI,CAAC,GAAE,IAAED,EAAE;IAAK,IAAGI,IAAE,SAAS,GAAE;KAAC,EAAE,oBAAoB,oBAAmBA,CAAC,GAAEJ,EAAE,oBAAoB,mBAAkB,CAAC,GAAEA,EAAE,oBAAoB,SAAQ,CAAC,GAAE,OAAO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vF,EAAA,GAAAI,EAMmCa,GAAA;;KAJ/B,MAAK;KACL,WAAU;KACT,MAAMwE,EAAA,QAAW,iBAAA;KACjB,OAAOjG,EAAAA,GAAE,eAAA;KACT,UAAQ,CAAGwG,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"PkChatbotMessageFeedback-DltXugdR.js","names":["__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_toDisplayString","_createBlock","_createCommentVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","PkChatbotMessageFeedback_default","defineComponent","props","__props","emoji","computed","raw","toneClass","icon","_component_VvIcon","VvIcon","openBlock","createElementBlock","normalizeClass","createElementVNode","toDisplayString","createBlock","createCommentVNode"],"sources":["../../../../packages/components/src/chat/PkChatbotMessageFeedback.vue","../../../../packages/components/src/chat/PkChatbotMessageFeedback.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import type { MessageFeedback } from 'models'\n import { computed } from 'vue'\n\n const props = defineProps<{\n feedback: MessageFeedback\n }>()\n\n // The real reaction glyph, shown ONLY for unmapped reactions (no vote):\n // 👍/❤️/👎 keep the classic thumb icon, while e.g. WhatsApp \"😍\" shows the\n // actual emoji.\n const emoji = computed(() => {\n if (props.feedback.vote) {\n return undefined\n }\n const raw = props.feedback.metadata?.reactionEmoji\n return typeof raw === 'string' && /\\p{Extended_Pictographic}/u.test(raw)\n ? raw\n : undefined\n })\n\n // Accent matches the vote; neutral for a real emoji (it carries its own\n // colour) or a comment-only feedback.\n const toneClass = computed(() => {\n if (emoji.value) {\n return 'pk-message-feedback--neutral'\n }\n switch (props.feedback.vote) {\n case 'upvote':\n return 'pk-message-feedback--positive'\n case 'downvote':\n return 'pk-message-feedback--negative'\n default:\n return 'pk-message-feedback--neutral'\n }\n })\n\n // Fallback icon when there is no real emoji glyph to show.\n const icon = computed(() => {\n switch (props.feedback.vote) {\n case 'upvote':\n return 'ri:thumb-up-fill'\n case 'downvote':\n return 'ri:thumb-down-fill'\n default:\n return 'ri:chat-quote-line'\n }\n })\n</script>\n\n<template>\n <div class=\"pk-message-feedback\" :class=\"toneClass\">\n <span class=\"pk-message-feedback__badge\">\n <span v-if=\"emoji\" class=\"pk-message-feedback__emoji\">\n {{ emoji }}\n </span>\n <VvIcon v-else :name=\"icon\" />\n </span>\n <p v-if=\"feedback.comment\" class=\"pk-message-feedback__comment\">\n {{ feedback.comment }}\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n /*\n * The user's reaction + comment, shown as an annotation hanging off the\n * assistant message: echoes the bubble radius (same speech-bubble tail) and\n * a coloured left rail + badge match the vote. Sits flush under the bubble.\n */\n .pk-message-feedback {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-6);\n border-radius: var(--rounded-lg);\n background: var(--pk-feedback-surface);\n font-size: var(--text-12);\n color: var(--color-word-2);\n\n // The accent colors the thumb on the surface: the text shades of\n // success and danger, the fills where a host app loads only the\n // library and this package's stylesheet\n &--positive {\n --pk-feedback-accent: var(--u-success-text, var(--color-success));\n }\n\n &--negative {\n --pk-feedback-accent: var(--u-danger-text, var(--color-danger));\n }\n\n &--neutral {\n --pk-feedback-accent: var(--color-surface-4);\n }\n\n --pk-feedback-surface: color-mix(\n in srgb,\n var(--pk-feedback-accent) 8%,\n var(--color-surface)\n );\n\n &__badge {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: var(--spacing-22, 1.375rem);\n height: var(--spacing-22, 1.375rem);\n border-radius: var(--rounded-full, 9999px);\n background: var(--color-surface);\n color: var(--pk-feedback-accent);\n box-shadow: var(--shadow-sm);\n }\n\n &__emoji {\n /* Smaller than the badge so the glyph doesn't touch the ring. */\n font-size: var(--text-12);\n line-height: 1;\n }\n\n &__comment {\n margin: 0;\n /* Preserve the user's line breaks; avoid orphans on wrap. */\n white-space: pre-wrap;\n text-wrap: pretty;\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import type { MessageFeedback } from 'models'\n import { computed } from 'vue'\n\n const props = defineProps<{\n feedback: MessageFeedback\n }>()\n\n // The real reaction glyph, shown ONLY for unmapped reactions (no vote):\n // 👍/❤️/👎 keep the classic thumb icon, while e.g. WhatsApp \"😍\" shows the\n // actual emoji.\n const emoji = computed(() => {\n if (props.feedback.vote) {\n return undefined\n }\n const raw = props.feedback.metadata?.reactionEmoji\n return typeof raw === 'string' && /\\p{Extended_Pictographic}/u.test(raw)\n ? raw\n : undefined\n })\n\n // Accent matches the vote; neutral for a real emoji (it carries its own\n // colour) or a comment-only feedback.\n const toneClass = computed(() => {\n if (emoji.value) {\n return 'pk-message-feedback--neutral'\n }\n switch (props.feedback.vote) {\n case 'upvote':\n return 'pk-message-feedback--positive'\n case 'downvote':\n return 'pk-message-feedback--negative'\n default:\n return 'pk-message-feedback--neutral'\n }\n })\n\n // Fallback icon when there is no real emoji glyph to show.\n const icon = computed(() => {\n switch (props.feedback.vote) {\n case 'upvote':\n return 'ri:thumb-up-fill'\n case 'downvote':\n return 'ri:thumb-down-fill'\n default:\n return 'ri:chat-quote-line'\n }\n })\n</script>\n\n<template>\n <div class=\"pk-message-feedback\" :class=\"toneClass\">\n <span class=\"pk-message-feedback__badge\">\n <span v-if=\"emoji\" class=\"pk-message-feedback__emoji\">\n {{ emoji }}\n </span>\n <VvIcon v-else :name=\"icon\" />\n </span>\n <p v-if=\"feedback.comment\" class=\"pk-message-feedback__comment\">\n {{ feedback.comment }}\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n /*\n * The user's reaction + comment, shown as an annotation hanging off the\n * assistant message: echoes the bubble radius (same speech-bubble tail) and\n * a coloured left rail + badge match the vote. Sits flush under the bubble.\n */\n .pk-message-feedback {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-6);\n border-radius: var(--rounded-lg);\n background: var(--pk-feedback-surface);\n font-size: var(--text-12);\n color: var(--color-word-2);\n\n // The accent colors the thumb on the surface: the text shades of\n // success and danger, the fills where a host app loads only the\n // library and this package's stylesheet\n &--positive {\n --pk-feedback-accent: var(--u-success-text, var(--color-success));\n }\n\n &--negative {\n --pk-feedback-accent: var(--u-danger-text, var(--color-danger));\n }\n\n &--neutral {\n --pk-feedback-accent: var(--color-surface-4);\n }\n\n --pk-feedback-surface: color-mix(\n in srgb,\n var(--pk-feedback-accent) 8%,\n var(--color-surface)\n );\n\n &__badge {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: var(--spacing-22, 1.375rem);\n height: var(--spacing-22, 1.375rem);\n border-radius: var(--rounded-full, 9999px);\n background: var(--color-surface);\n color: var(--pk-feedback-accent);\n box-shadow: var(--shadow-sm);\n }\n\n &__emoji {\n /* Smaller than the badge so the glyph doesn't touch the ring. */\n font-size: var(--text-12);\n line-height: 1;\n }\n\n &__comment {\n margin: 0;\n /* Preserve the user's line breaks; avoid orphans on wrap. */\n white-space: pre-wrap;\n text-wrap: pretty;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;EAII,IAAMc,IAAQC,GAORC,IAAQC,QAAe;GACzB,IAAIH,EAAM,SAAS,MACf;GAEJ,IAAMI,IAAMJ,EAAM,SAAS,UAAU;GACrC,OAAO,OAAOI,KAAQ,YAAY,6BAA6B,KAAKA,CAAG,IACjEA,IACA,KAAA;EACV,CAAC,GAIKC,IAAYF,QAAe;GAC7B,IAAID,EAAM,OACN,OAAO;GAEX,QAAQF,EAAM,SAAS,MAAvB;IACI,KAAK,UACD,OAAO;IACX,KAAK,YACD,OAAO;IACX,SACI,OAAO;GACf;EACJ,CAAC,GAGKM,IAAOH,QAAe;GACxB,QAAQH,EAAM,SAAS,MAAvB;IACI,KAAK,UACD,OAAO;IACX,KAAK,YACD,OAAO;IACX,SACI,OAAO;GACf;EACJ,CAAC;;;GAID,OAAAb,EAAA,GAAAC,EAUM,OAAA,EAVD,OAAKC,EAAA,CAAC,uBAA8BgB,EAAA,KAAS,CAAA,E,IAC9Cf,EAKO,QALPK,GAKO,CAJSO,EAAA,SAAZf,EAAA,GAAAC,EAEO,QAFPQ,GAEOL,EADAW,EAAA,KAAK,GAAA,CAAA,MAEZf,EAAA,GAAAK,EAA8Be,GAAA;;IAAd,MAAMD,EAAA;G,0BAEjBL,EAAA,SAAS,WAAlBd,EAAA,GAAAC,EAEI,KAFJS,GAEIN,EADGU,EAAA,SAAS,OAAO,GAAA,CAAA,K"}
1
+ {"version":3,"file":"PkChatbotMessageFeedback-DltXugdR.js","names":["__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_toDisplayString","_createBlock","_createCommentVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","PkChatbotMessageFeedback_default","defineComponent","props","__props","emoji","computed","raw","toneClass","icon","_component_VvIcon","VvIcon","openBlock","createElementBlock","normalizeClass","createElementVNode","toDisplayString","createBlock","createCommentVNode"],"sources":["../../../../packages/components/src/chat/PkChatbotMessageFeedback.vue","../../../../packages/components/src/chat/PkChatbotMessageFeedback.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import type { MessageFeedback } from 'models'\n import { computed } from 'vue'\n\n const props = defineProps<{\n feedback: MessageFeedback\n }>()\n\n // The real reaction glyph, shown ONLY for unmapped reactions (no vote):\n // 👍/❤️/👎 keep the classic thumb icon, while e.g. WhatsApp \"😍\" shows the\n // actual emoji.\n const emoji = computed(() => {\n if (props.feedback.vote) {\n return undefined\n }\n const raw = props.feedback.metadata?.reactionEmoji\n return typeof raw === 'string' && /\\p{Extended_Pictographic}/u.test(raw)\n ? raw\n : undefined\n })\n\n // Accent matches the vote; neutral for a real emoji (it carries its own\n // colour) or a comment-only feedback.\n const toneClass = computed(() => {\n if (emoji.value) {\n return 'pk-message-feedback--neutral'\n }\n switch (props.feedback.vote) {\n case 'upvote':\n return 'pk-message-feedback--positive'\n case 'downvote':\n return 'pk-message-feedback--negative'\n default:\n return 'pk-message-feedback--neutral'\n }\n })\n\n // Fallback icon when there is no real emoji glyph to show.\n const icon = computed(() => {\n switch (props.feedback.vote) {\n case 'upvote':\n return 'ri:thumb-up-fill'\n case 'downvote':\n return 'ri:thumb-down-fill'\n default:\n return 'ri:chat-quote-line'\n }\n })\n</script>\n\n<template>\n <div class=\"pk-message-feedback\" :class=\"toneClass\">\n <span class=\"pk-message-feedback__badge\">\n <span v-if=\"emoji\" class=\"pk-message-feedback__emoji\">\n {{ emoji }}\n </span>\n <VvIcon v-else :name=\"icon\" />\n </span>\n <p v-if=\"feedback.comment\" class=\"pk-message-feedback__comment\">\n {{ feedback.comment }}\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n /*\n * The user's reaction + comment, shown as an annotation hanging off the\n * assistant message: echoes the bubble radius (same speech-bubble tail) and\n * a coloured left rail + badge match the vote. Sits flush under the bubble.\n */\n .pk-message-feedback {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-6);\n border-radius: var(--rounded-lg);\n background: var(--pk-feedback-surface);\n font-size: var(--text-12);\n color: var(--color-word-2);\n\n // The accent colors the thumb on the surface: the text shades of\n // success and danger, the fills where a host app loads only the\n // library and this package's stylesheet\n &--positive {\n --pk-feedback-accent: var(--u-success-text, var(--color-success));\n }\n\n &--negative {\n --pk-feedback-accent: var(--u-danger-text, var(--color-danger));\n }\n\n &--neutral {\n --pk-feedback-accent: var(--color-surface-4);\n }\n\n --pk-feedback-surface: color-mix(\n in srgb,\n var(--pk-feedback-accent) 8%,\n var(--color-surface)\n );\n\n &__badge {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: var(--spacing-22, 1.375rem);\n height: var(--spacing-22, 1.375rem);\n border-radius: var(--rounded-full, 9999px);\n background: var(--color-surface);\n color: var(--pk-feedback-accent);\n box-shadow: var(--shadow-sm);\n }\n\n &__emoji {\n /* Smaller than the badge so the glyph doesn't touch the ring. */\n font-size: var(--text-12);\n line-height: 1;\n }\n\n &__comment {\n margin: 0;\n\n /* Preserve the user's line breaks; avoid orphans on wrap. */\n white-space: pre-wrap;\n text-wrap: pretty;\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import type { MessageFeedback } from 'models'\n import { computed } from 'vue'\n\n const props = defineProps<{\n feedback: MessageFeedback\n }>()\n\n // The real reaction glyph, shown ONLY for unmapped reactions (no vote):\n // 👍/❤️/👎 keep the classic thumb icon, while e.g. WhatsApp \"😍\" shows the\n // actual emoji.\n const emoji = computed(() => {\n if (props.feedback.vote) {\n return undefined\n }\n const raw = props.feedback.metadata?.reactionEmoji\n return typeof raw === 'string' && /\\p{Extended_Pictographic}/u.test(raw)\n ? raw\n : undefined\n })\n\n // Accent matches the vote; neutral for a real emoji (it carries its own\n // colour) or a comment-only feedback.\n const toneClass = computed(() => {\n if (emoji.value) {\n return 'pk-message-feedback--neutral'\n }\n switch (props.feedback.vote) {\n case 'upvote':\n return 'pk-message-feedback--positive'\n case 'downvote':\n return 'pk-message-feedback--negative'\n default:\n return 'pk-message-feedback--neutral'\n }\n })\n\n // Fallback icon when there is no real emoji glyph to show.\n const icon = computed(() => {\n switch (props.feedback.vote) {\n case 'upvote':\n return 'ri:thumb-up-fill'\n case 'downvote':\n return 'ri:thumb-down-fill'\n default:\n return 'ri:chat-quote-line'\n }\n })\n</script>\n\n<template>\n <div class=\"pk-message-feedback\" :class=\"toneClass\">\n <span class=\"pk-message-feedback__badge\">\n <span v-if=\"emoji\" class=\"pk-message-feedback__emoji\">\n {{ emoji }}\n </span>\n <VvIcon v-else :name=\"icon\" />\n </span>\n <p v-if=\"feedback.comment\" class=\"pk-message-feedback__comment\">\n {{ feedback.comment }}\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n /*\n * The user's reaction + comment, shown as an annotation hanging off the\n * assistant message: echoes the bubble radius (same speech-bubble tail) and\n * a coloured left rail + badge match the vote. Sits flush under the bubble.\n */\n .pk-message-feedback {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-6) var(--spacing-12) var(--spacing-6)\n var(--spacing-6);\n border-radius: var(--rounded-lg);\n background: var(--pk-feedback-surface);\n font-size: var(--text-12);\n color: var(--color-word-2);\n\n // The accent colors the thumb on the surface: the text shades of\n // success and danger, the fills where a host app loads only the\n // library and this package's stylesheet\n &--positive {\n --pk-feedback-accent: var(--u-success-text, var(--color-success));\n }\n\n &--negative {\n --pk-feedback-accent: var(--u-danger-text, var(--color-danger));\n }\n\n &--neutral {\n --pk-feedback-accent: var(--color-surface-4);\n }\n\n --pk-feedback-surface: color-mix(\n in srgb,\n var(--pk-feedback-accent) 8%,\n var(--color-surface)\n );\n\n &__badge {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: var(--spacing-22, 1.375rem);\n height: var(--spacing-22, 1.375rem);\n border-radius: var(--rounded-full, 9999px);\n background: var(--color-surface);\n color: var(--pk-feedback-accent);\n box-shadow: var(--shadow-sm);\n }\n\n &__emoji {\n /* Smaller than the badge so the glyph doesn't touch the ring. */\n font-size: var(--text-12);\n line-height: 1;\n }\n\n &__comment {\n margin: 0;\n\n /* Preserve the user's line breaks; avoid orphans on wrap. */\n white-space: pre-wrap;\n text-wrap: pretty;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;EAII,IAAMc,IAAQC,GAORC,IAAQC,QAAe;GACzB,IAAIH,EAAM,SAAS,MACf;GAEJ,IAAMI,IAAMJ,EAAM,SAAS,UAAU;GACrC,OAAO,OAAOI,KAAQ,YAAY,6BAA6B,KAAKA,CAAG,IACjEA,IACA,KAAA;EACV,CAAC,GAIKC,IAAYF,QAAe;GAC7B,IAAID,EAAM,OACN,OAAO;GAEX,QAAQF,EAAM,SAAS,MAAvB;IACI,KAAK,UACD,OAAO;IACX,KAAK,YACD,OAAO;IACX,SACI,OAAO;GACf;EACJ,CAAC,GAGKM,IAAOH,QAAe;GACxB,QAAQH,EAAM,SAAS,MAAvB;IACI,KAAK,UACD,OAAO;IACX,KAAK,YACD,OAAO;IACX,SACI,OAAO;GACf;EACJ,CAAC;;;GAID,OAAAb,EAAA,GAAAC,EAUM,OAAA,EAVD,OAAKC,EAAA,CAAC,uBAA8BgB,EAAA,KAAS,CAAA,E,IAC9Cf,EAKO,QALPK,GAKO,CAJSO,EAAA,SAAZf,EAAA,GAAAC,EAEO,QAFPQ,GAEOL,EADAW,EAAA,KAAK,GAAA,CAAA,MAEZf,EAAA,GAAAK,EAA8Be,GAAA;;IAAd,MAAMD,EAAA;G,0BAEjBL,EAAA,SAAS,WAAlBd,EAAA,GAAAC,EAEI,KAFJS,GAEIN,EADGU,EAAA,SAAS,OAAO,GAAA,CAAA,K"}
@@ -1,18 +1,18 @@
1
1
  import { A as e, E as t, S as n, n as r, v as i } from "./schemas-BO5QlXAp.js";
2
2
  import { c as a } from "./Media-DylqhvaF.js";
3
- import { O as o, V as s, _ as c, k as l, r as u } from "./Agent-CYUPbFnK.js";
3
+ import { O as o, V as s, _ as c, k as l, r as u } from "./Agent-BWwjGG2f.js";
4
4
  import { t as d } from "./VvButtonLocalized-C-vx25u4.js";
5
- import { t as f } from "./PkStreamingMarkdown-B5vQ1ZZ8.js";
5
+ import { t as f } from "./PkStreamingMarkdown-B-sEx8BP.js";
6
6
  import "./src-B-ZKEhTU.js";
7
7
  import { c as p, i as m, l as h, n as g, o as _, s as ee, t as v, u as y } from "./message-DuibQyHy.js";
8
8
  import { t as te } from "./PkChatbotAudioTranscript-BCSpDNpy.js";
9
- import { C as b, E as ne, N as re, O as ie, S as x, T as S, _ as ae, d as oe, f as C, g as se, h as ce, j as le, k as ue, m as de, n as fe, o as pe, r as me, s as he, t as w, v as ge } from "./utils-DAJhpoQS.js";
9
+ import { C as b, E as ne, N as re, O as ie, S as x, T as S, _ as ae, d as oe, f as C, g as se, h as ce, j as le, k as ue, m as de, n as fe, o as pe, r as me, s as he, t as w, v as ge } from "./utils-DaAIWTtt.js";
10
10
  import { t as _e } from "./PkChatbotError-BS84xuiu.js";
11
11
  import { t as ve } from "./PkRelativeTime-CZF5CYHv.js";
12
12
  import { t as ye } from "./PkChatbotFilePreview-CzmGvKjI.js";
13
13
  import { t as be } from "./PkChatbotFeedbackForm-Bh3tvNUW.js";
14
14
  import { t as xe } from "./PkChatbotMessageFeedback-DltXugdR.js";
15
- import { n as Se, t as Ce } from "./PkChatbotSteps-CWFBX7Rl.js";
15
+ import { n as Se, t as Ce } from "./PkChatbotSteps-p8-SuGGe.js";
16
16
  import { t as we } from "./PkChatbotOutlineRail-BI-DMvZi.js";
17
17
  import { VvButtonGroup as Te, VvIcon as Ee } from "@volverjs/ui-vue/components";
18
18
  import { Fragment as T, Transition as E, computed as D, createBlock as O, createCommentVNode as k, createElementBlock as A, createElementVNode as j, createTextVNode as De, createVNode as M, defineAsyncComponent as N, defineComponent as Oe, inject as ke, mergeProps as Ae, nextTick as P, normalizeClass as F, normalizeStyle as je, onBeforeUnmount as Me, onMounted as Ne, openBlock as I, ref as Pe, renderList as Fe, renderSlot as Ie, resolveDynamicComponent as Le, shallowRef as Re, toDisplayString as L, unref as R, useSlots as ze, useTemplateRef as Be, watch as z, withCtx as B, withModifiers as V } from "vue";
@@ -55,26 +55,26 @@ var U = (e) => e.state, qe = (e) => e.type.startsWith("tool-") ? e.type.slice(5)
55
55
  for (let n of e.parts) n.type === "tool-scheduleWakeup" && (t = U(n) === "output-available" && n.input?.noop === !0);
56
56
  return t;
57
57
  }, Xe = {
58
- requestOAuthConnection: N(() => import("./PkToolRequestOAuthConnection-Cg6T3gzF.js")),
58
+ requestOAuthConnection: N(() => import("./PkToolRequestOAuthConnection-3zLvNF_c.js")),
59
59
  shareDocument: N(() => import("./PkToolShareDocument-CRghPfep.js").then((e) => e.n)),
60
- showArtifact: N(() => import("./PkToolShowArtifact-Clvs-28Q.js").then((e) => e.n)),
60
+ showArtifact: N(() => import("./PkToolShowArtifact-BRwa5pGY.js").then((e) => e.n)),
61
61
  showCalendarEvent: N(() => import("./PkToolShowCalendarEvent-C16j-Cto.js").then((e) => e.n)),
62
62
  showComparison: N(() => import("./PkToolShowComparison-BEHyRNXE.js").then((e) => e.n)),
63
- showContactForm: N(() => import("./PkToolShowContactForm-DA3KYufo.js").then((e) => e.n)),
64
- showDiagram: N(() => import("./PkToolShowDiagram-DxPuGWin.js")),
63
+ showContactForm: N(() => import("./PkToolShowContactForm-xHBTmITM.js").then((e) => e.n)),
64
+ showDiagram: N(() => import("./PkToolShowDiagram-DrJs92dg.js")),
65
65
  showEmail: N(() => import("./PkToolShowEmail-BehvoNsz.js").then((e) => e.n)),
66
- showImageGallery: N(() => import("./PkToolShowImageGallery-B_dA0S6H.js").then((e) => e.n)),
66
+ showImageGallery: N(() => import("./PkToolShowImageGallery-DD_RGcL6.js").then((e) => e.n)),
67
67
  showLocation: N(() => import("./PkToolShowLocation-Cq0IXye1.js").then((e) => e.n)),
68
68
  showMessage: N(() => import("./PkToolShowMessage-Cca7K7GQ.js").then((e) => e.n)),
69
- showForm: N(() => import("./PkToolShowForm-DdA2UM-T.js").then((e) => e.n)),
70
- showMultipleChoice: N(() => import("./PkToolShowForm-DdA2UM-T.js").then((e) => e.n)),
71
- showProductList: N(() => import("./PkToolShowProductList-ubDejlbK.js").then((e) => e.n)),
69
+ showForm: N(() => import("./PkToolShowForm-Fv4iV0VY.js").then((e) => e.n)),
70
+ showMultipleChoice: N(() => import("./PkToolShowForm-Fv4iV0VY.js").then((e) => e.n)),
71
+ showProductList: N(() => import("./PkToolShowProductList-8UQSQvRr.js").then((e) => e.n)),
72
72
  showQrCode: N(() => import("./PkToolShowQrCode-skWaARYV.js").then((e) => e.n)),
73
- showSources: N(() => import("./PkToolShowSources-CRGyOz2J.js").then((e) => e.n)),
74
- showSuggestedReply: N(() => import("./PkToolShowSuggestedReply-zFmhR7Ju.js").then((e) => e.n)),
75
- showVideo: N(() => import("./PkToolShowVideo-LapBUydt.js")),
73
+ showSources: N(() => import("./PkToolShowSources-C4rKpypf.js").then((e) => e.n)),
74
+ showSuggestedReply: N(() => import("./PkToolShowSuggestedReply-Bnhgsh4l.js").then((e) => e.n)),
75
+ showVideo: N(() => import("./PkToolShowVideo-NOwtZPgI.js")),
76
76
  showWeather: N(() => import("./PkToolShowWeather-BZaeG1cY.js")),
77
- showWebPages: N(() => import("./PkToolShowWebPages-CSgdDZF6.js").then((e) => e.n))
77
+ showWebPages: N(() => import("./PkToolShowWebPages-DcPboNwp.js").then((e) => e.n))
78
78
  }, Ze = {
79
79
  key: 0,
80
80
  class: "text-12 text-word-3 m-0 mb-xs"
@@ -965,4 +965,4 @@ var st = ["aria-busy"], ct = {
965
965
  });
966
966
  export { J as t };
967
967
 
968
- //# sourceMappingURL=PkChatbotMessages-DcIpivBs.js.map
968
+ //# sourceMappingURL=PkChatbotMessages-qkodgdDE.js.map