@8wave/ai-elements 0.125.0-beta.39 → 0.125.0-beta.40

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 (121) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-Dt0ygdJM.js → PkChatbotFilePreview-o0zIuCgN.js} +2 -2
  2. package/dist/_chunks/{PkChatbotFilePreview-Dt0ygdJM.js.map → PkChatbotFilePreview-o0zIuCgN.js.map} +1 -1
  3. package/dist/_chunks/{PkFilePreview-CT3_vRcU.js → PkFilePreview-D_1ZgiiA.js} +438 -438
  4. package/dist/_chunks/{PkFilePreview-CT3_vRcU.js.map → PkFilePreview-D_1ZgiiA.js.map} +1 -1
  5. package/dist/_chunks/{PkFilePreviewDialog-BOKJCapN.js → PkFilePreviewDialog-CI22huzK.js} +2 -2
  6. package/dist/_chunks/{PkFilePreviewDialog-BOKJCapN.js.map → PkFilePreviewDialog-CI22huzK.js.map} +1 -1
  7. package/dist/_chunks/{PkImageEditorDialog-D-ikpGo8.js → PkImageEditorDialog-CAEninFi.js} +152 -130
  8. package/dist/_chunks/PkImageEditorDialog-CAEninFi.js.map +1 -0
  9. package/dist/_chunks/{PkSelectionActions-CXQTnSXQ.js → PkSelectionActions-BriGyWCi.js} +2 -2
  10. package/dist/_chunks/{PkSelectionActions-CXQTnSXQ.js.map → PkSelectionActions-BriGyWCi.js.map} +1 -1
  11. package/dist/_chunks/{PkStreamingMarkdown-5fgxYt_s.js → PkStreamingMarkdown--9i0feuM.js} +3 -3
  12. package/dist/_chunks/{PkStreamingMarkdown-5fgxYt_s.js.map → PkStreamingMarkdown--9i0feuM.js.map} +1 -1
  13. package/dist/_chunks/{PkToolChatFile-Cbmu6I0S.js → PkToolChatFile-BKGUnWrj.js} +3 -3
  14. package/dist/_chunks/{PkToolChatFile-Cbmu6I0S.js.map → PkToolChatFile-BKGUnWrj.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShareDocument-Bxm1pSpj.js → PkToolShareDocument-BUg-uDTO.js} +2 -2
  16. package/dist/_chunks/{PkToolShareDocument-Bxm1pSpj.js.map → PkToolShareDocument-BUg-uDTO.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowArtifact-CGUmoTfN.js → PkToolShowArtifact-BfLpz2-W.js} +2 -2
  18. package/dist/_chunks/{PkToolShowArtifact-CGUmoTfN.js.map → PkToolShowArtifact-BfLpz2-W.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowContactForm-DZ-kgXa6.js → PkToolShowContactForm-BsF6DFzV.js} +2 -2
  20. package/dist/_chunks/{PkToolShowContactForm-DZ-kgXa6.js.map → PkToolShowContactForm-BsF6DFzV.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowDiagram-CwINVecL.js → PkToolShowDiagram-CcRJNDHo.js} +2 -2
  22. package/dist/_chunks/{PkToolShowDiagram-CwINVecL.js.map → PkToolShowDiagram-CcRJNDHo.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowForm-BrxNGFCH.js → PkToolShowForm-w6RvbKEB.js} +3 -3
  24. package/dist/_chunks/{PkToolShowForm-BrxNGFCH.js.map → PkToolShowForm-w6RvbKEB.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowImageGallery-BGTncXxq.js → PkToolShowImageGallery-BEddh4He.js} +2 -2
  26. package/dist/_chunks/{PkToolShowImageGallery-BGTncXxq.js.map → PkToolShowImageGallery-BEddh4He.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowSources-B3RSUWP7.js → PkToolShowSources-CGESvGrm.js} +2 -2
  28. package/dist/_chunks/{PkToolShowSources-B3RSUWP7.js.map → PkToolShowSources-CGESvGrm.js.map} +1 -1
  29. package/dist/_chunks/{useLightbox-C54BCSbU.js → useLightbox-TagJmiah.js} +38 -37
  30. package/dist/_chunks/useLightbox-TagJmiah.js.map +1 -0
  31. package/dist/_chunks/{utils-Do6urHUh.js → utils-zkq8kMz-.js} +7 -4
  32. package/{dist-vue/_chunks/utils-Do3JWPJe.js.map → dist/_chunks/utils-zkq8kMz-.js.map} +1 -1
  33. package/dist/ai-elements.es.js +2711 -2711
  34. package/dist/ai-elements.es.js.map +1 -1
  35. package/dist-vue/PkChatbot.js +1 -1
  36. package/dist-vue/PkChatbotEmptyState.js +1 -1
  37. package/dist-vue/PkChatbotFilePreview.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/_chunks/{PkChart-BsF3OtnS.js → PkChart-DyyBXkd3.js} +2 -2
  46. package/dist-vue/_chunks/{PkChart-BsF3OtnS.js.map → PkChart-DyyBXkd3.js.map} +1 -1
  47. package/dist-vue/_chunks/{PkChatbot-BIQh81cA.js → PkChatbot-wsqj3EpU.js} +5 -5
  48. package/dist-vue/_chunks/{PkChatbot-BIQh81cA.js.map → PkChatbot-wsqj3EpU.js.map} +1 -1
  49. package/dist-vue/_chunks/{PkChatbotEmptyState-pAeFPPQc.js → PkChatbotEmptyState-DcgIfNkX.js} +2 -2
  50. package/dist-vue/_chunks/{PkChatbotEmptyState-pAeFPPQc.js.map → PkChatbotEmptyState-DcgIfNkX.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotFilePreview-BIta8Yg-.js → PkChatbotFilePreview-BDU2vY0F.js} +2 -2
  52. package/dist-vue/_chunks/{PkChatbotFilePreview-BIta8Yg-.js.map → PkChatbotFilePreview-BDU2vY0F.js.map} +1 -1
  53. package/dist-vue/_chunks/PkChatbotInput-CN4rmNgu.js +520 -0
  54. package/dist-vue/_chunks/PkChatbotInput-CN4rmNgu.js.map +1 -0
  55. package/dist-vue/_chunks/PkChatbotMessages-BlF4Xp0_.js +1054 -0
  56. package/dist-vue/_chunks/{PkChatbotMessages-CZu8feEz.js.map → PkChatbotMessages-BlF4Xp0_.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkChatbotStepPayload-r25JHO7_.js → PkChatbotStepPayload-q9uXE5mr.js} +2 -2
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-r25JHO7_.js.map → PkChatbotStepPayload-q9uXE5mr.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkChatbotStepToolDetail-C897BpRX.js → PkChatbotStepToolDetail-BJz6Qwh3.js} +3 -3
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-C897BpRX.js.map → PkChatbotStepToolDetail-BJz6Qwh3.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkChatbotSteps-CRtIVwJV.js → PkChatbotSteps-DvJYNl_k.js} +5 -5
  62. package/dist-vue/_chunks/{PkChatbotSteps-CRtIVwJV.js.map → PkChatbotSteps-DvJYNl_k.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotViewChat-BBCxj4Qz.js → PkChatbotViewChat-tmHyxxT3.js} +23 -23
  64. package/dist-vue/_chunks/{PkChatbotViewChat-BBCxj4Qz.js.map → PkChatbotViewChat-tmHyxxT3.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkChatbotViewConversations-rXGl7NKA.js → PkChatbotViewConversations-DOzUh_A7.js} +2 -2
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-rXGl7NKA.js.map → PkChatbotViewConversations-DOzUh_A7.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkFilePreview-1ZNyDAo5.js → PkFilePreview-Bp5-Pl54.js} +227 -227
  68. package/dist-vue/_chunks/{PkFilePreview-1ZNyDAo5.js.map → PkFilePreview-Bp5-Pl54.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkFilePreviewDialog-DnbUHGG2.js → PkFilePreviewDialog-CS885vBR.js} +2 -2
  70. package/dist-vue/_chunks/{PkFilePreviewDialog-DnbUHGG2.js.map → PkFilePreviewDialog-CS885vBR.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkImageEditorDialog-Dn3HV_ny.js → PkImageEditorDialog-BhfdnsmX.js} +300 -278
  72. package/dist-vue/_chunks/PkImageEditorDialog-BhfdnsmX.js.map +1 -0
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-COQLmP8b.js → PkStreamingMarkdown-NgrJUZPI.js} +3 -3
  74. package/dist-vue/_chunks/{PkStreamingMarkdown-COQLmP8b.js.map → PkStreamingMarkdown-NgrJUZPI.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkSvgViewer-vkd5Dluw.js → PkSvgViewer-CRNwb6Yn.js} +2 -2
  76. package/dist-vue/_chunks/{PkSvgViewer-vkd5Dluw.js.map → PkSvgViewer-CRNwb6Yn.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolChatFile-e-7a0k7l.js → PkToolChatFile-DnmiNGF4.js} +3 -3
  78. package/dist-vue/_chunks/{PkToolChatFile-e-7a0k7l.js.map → PkToolChatFile-DnmiNGF4.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolShareDocument-CspvFwRR.js → PkToolShareDocument-Bf7OE8XA.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolShareDocument-CspvFwRR.js.map → PkToolShareDocument-Bf7OE8XA.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolShowArtifact-CUP3VaC9.js → PkToolShowArtifact-C8ueuIGQ.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowArtifact-CUP3VaC9.js.map → PkToolShowArtifact-C8ueuIGQ.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowChart-X6JZDAWD.js → PkToolShowChart-BWO6Hzlq.js} +3 -3
  84. package/dist-vue/_chunks/{PkToolShowChart-X6JZDAWD.js.map → PkToolShowChart-BWO6Hzlq.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowContactForm-BM8d9M5a.js → PkToolShowContactForm-BBcDsLEO.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowContactForm-BM8d9M5a.js.map → PkToolShowContactForm-BBcDsLEO.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowDiagram-DOdzpndK.js → PkToolShowDiagram-BzUcxOKy.js} +3 -3
  88. package/dist-vue/_chunks/{PkToolShowDiagram-DOdzpndK.js.map → PkToolShowDiagram-BzUcxOKy.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowForm-TYBf8q6g.js → PkToolShowForm-B6uhHzJ8.js} +3 -3
  90. package/dist-vue/_chunks/{PkToolShowForm-TYBf8q6g.js.map → PkToolShowForm-B6uhHzJ8.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowImageGallery-BvwuoyF6.js → PkToolShowImageGallery-C39nlJrJ.js} +3 -3
  92. package/dist-vue/_chunks/{PkToolShowImageGallery-BvwuoyF6.js.map → PkToolShowImageGallery-C39nlJrJ.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkToolShowLocation-WdRqG8Wi.js → PkToolShowLocation-Nhh_LwmN.js} +2 -2
  94. package/dist-vue/_chunks/{PkToolShowLocation-WdRqG8Wi.js.map → PkToolShowLocation-Nhh_LwmN.js.map} +1 -1
  95. package/dist-vue/_chunks/{PkToolShowProductList-_MHBAgNI.js → PkToolShowProductList-FLLkRCnm.js} +2 -2
  96. package/dist-vue/_chunks/{PkToolShowProductList-_MHBAgNI.js.map → PkToolShowProductList-FLLkRCnm.js.map} +1 -1
  97. package/dist-vue/_chunks/{PkToolShowSources-CHw7qZtw.js → PkToolShowSources-Cb7r5jrX.js} +2 -2
  98. package/dist-vue/_chunks/{PkToolShowSources-CHw7qZtw.js.map → PkToolShowSources-Cb7r5jrX.js.map} +1 -1
  99. package/dist-vue/_chunks/{PkToolShowVideo-D7oiBe4p.js → PkToolShowVideo-QDLhVlau.js} +2 -2
  100. package/dist-vue/_chunks/{PkToolShowVideo-D7oiBe4p.js.map → PkToolShowVideo-QDLhVlau.js.map} +1 -1
  101. package/dist-vue/_chunks/{PkToolShowWebPages-CRq9Jhmw.js → PkToolShowWebPages-P6PdJTEE.js} +2 -2
  102. package/dist-vue/_chunks/{PkToolShowWebPages-CRq9Jhmw.js.map → PkToolShowWebPages-P6PdJTEE.js.map} +1 -1
  103. package/dist-vue/_chunks/{useLightbox-Ctl9zaMX.js → useLightbox-DmtNa8bJ.js} +38 -37
  104. package/dist-vue/_chunks/useLightbox-DmtNa8bJ.js.map +1 -0
  105. package/dist-vue/_chunks/{utils-Do3JWPJe.js → utils-D4B1FVGF.js} +6 -3
  106. package/dist-vue/_chunks/utils-D4B1FVGF.js.map +1 -0
  107. package/dist-vue/composables.js +1 -1
  108. package/dist-vue/index.js +61 -61
  109. package/dist-vue/index.js.map +1 -1
  110. package/dist-vue/packages/components/src/chat/imageEdits.d.ts +3 -1
  111. package/dist-vue/packages/components/src/chat/utils.d.ts +6 -0
  112. package/dist-vue/packages/components/src/composables/useLightbox.d.ts +6 -0
  113. package/package.json +1 -1
  114. package/dist/_chunks/PkImageEditorDialog-D-ikpGo8.js.map +0 -1
  115. package/dist/_chunks/useLightbox-C54BCSbU.js.map +0 -1
  116. package/dist/_chunks/utils-Do6urHUh.js.map +0 -1
  117. package/dist-vue/_chunks/PkChatbotInput-DSyIo0xB.js +0 -520
  118. package/dist-vue/_chunks/PkChatbotInput-DSyIo0xB.js.map +0 -1
  119. package/dist-vue/_chunks/PkChatbotMessages-CZu8feEz.js +0 -1054
  120. package/dist-vue/_chunks/PkImageEditorDialog-Dn3HV_ny.js.map +0 -1
  121. package/dist-vue/_chunks/useLightbox-Ctl9zaMX.js.map +0 -1
@@ -0,0 +1,520 @@
1
+ import { s as e } from "./Media-DylqhvaF.js";
2
+ import { t } from "./VvButtonLocalized-C-vx25u4.js";
3
+ import { t as n } from "./PkStreamingMarkdown-NgrJUZPI.js";
4
+ import { A as r, O as i } from "./utils-D4B1FVGF.js";
5
+ import { t as a } from "./PkChatbotFilePreview-BDU2vY0F.js";
6
+ import { VvDropdown as o, VvDropdownAction as s, VvIcon as c } from "@volverjs/ui-vue/components";
7
+ import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineAsyncComponent as _, defineComponent as v, mergeModels as y, mergeProps as ee, nextTick as b, normalizeClass as te, normalizeProps as ne, onBeforeUnmount as re, onMounted as ie, openBlock as x, ref as S, renderList as ae, renderSlot as oe, shallowRef as se, toDisplayString as C, unref as w, useId as ce, useModel as T, useTemplateRef as E, watch as D, withCtx as O, withKeys as le, withModifiers as ue } from "vue";
8
+ import { useI18n as de } from "vue-i18n";
9
+ import { useResizeObserver as fe } from "@vueuse/core";
10
+ // ../../node_modules/.pnpm/autosize@6.0.1/node_modules/autosize/dist/autosize.esm.js
11
+ var k = /* @__PURE__ */ new Map();
12
+ function pe(e) {
13
+ var t = k.get(e);
14
+ t && t.destroy();
15
+ }
16
+ function A(e) {
17
+ var t = k.get(e);
18
+ t && t.update();
19
+ }
20
+ var j = null;
21
+ typeof window > "u" ? ((j = function(e) {
22
+ return e;
23
+ }).destroy = function(e) {
24
+ return e;
25
+ }, j.update = function(e) {
26
+ return e;
27
+ }) : ((j = function(e, t) {
28
+ return e && Array.prototype.forEach.call(e.length ? e : [e], function(e) {
29
+ return function(e) {
30
+ if (e && e.nodeName && e.nodeName === "TEXTAREA" && !k.has(e)) {
31
+ var t, n = null, r = window.getComputedStyle(e), i = (t = e.value, function() {
32
+ o({
33
+ testForHeightReduction: t === "" || !e.value.startsWith(t),
34
+ restoreTextAlign: null
35
+ }), t = e.value;
36
+ }), a = function(t) {
37
+ e.removeEventListener("autosize:destroy", a), e.removeEventListener("autosize:update", s), e.removeEventListener("input", i), window.removeEventListener("resize", s), Object.keys(t).forEach(function(n) {
38
+ return e.style[n] = t[n];
39
+ }), k.delete(e);
40
+ }.bind(e, {
41
+ height: e.style.height,
42
+ resize: e.style.resize,
43
+ textAlign: e.style.textAlign,
44
+ overflowY: e.style.overflowY,
45
+ overflowX: e.style.overflowX,
46
+ wordWrap: e.style.wordWrap
47
+ });
48
+ e.addEventListener("autosize:destroy", a), e.addEventListener("autosize:update", s), e.addEventListener("input", i), window.addEventListener("resize", s), e.style.overflowX = "hidden", e.style.wordWrap = "break-word", k.set(e, {
49
+ destroy: a,
50
+ update: s
51
+ }), s();
52
+ }
53
+ function o(t) {
54
+ var i, a, s = t.restoreTextAlign, c = s === void 0 ? null : s, l = t.testForHeightReduction, u = l === void 0 || l, d = r.overflowY;
55
+ if (e.scrollHeight !== 0 && (r.resize === "vertical" ? e.style.resize = "none" : r.resize === "both" && (e.style.resize = "horizontal"), u && (i = function(e) {
56
+ for (var t = []; e && e.parentNode && e.parentNode instanceof Element;) e.parentNode.scrollTop && t.push([e.parentNode, e.parentNode.scrollTop]), e = e.parentNode;
57
+ return function() {
58
+ return t.forEach(function(e) {
59
+ var t = e[0], n = e[1];
60
+ t.style.scrollBehavior = "auto", t.scrollTop = n, t.style.scrollBehavior = null;
61
+ });
62
+ };
63
+ }(e), e.style.height = ""), a = r.boxSizing === "content-box" ? e.scrollHeight - (parseFloat(r.paddingTop) + parseFloat(r.paddingBottom)) : e.scrollHeight + parseFloat(r.borderTopWidth) + parseFloat(r.borderBottomWidth), r.maxHeight !== "none" && a > parseFloat(r.maxHeight) ? (r.overflowY === "hidden" && (e.style.overflow = "scroll"), a = parseFloat(r.maxHeight)) : r.overflowY !== "hidden" && (e.style.overflow = "hidden"), e.style.height = a + "px", c && (e.style.textAlign = c), i && i(), n !== a && (e.dispatchEvent(new Event("autosize:resized", { bubbles: !0 })), n = a), d !== r.overflow && !c)) {
64
+ var f = r.textAlign;
65
+ r.overflow === "hidden" && (e.style.textAlign = f === "start" ? "end" : "start"), o({
66
+ restoreTextAlign: f,
67
+ testForHeightReduction: !0
68
+ });
69
+ }
70
+ }
71
+ function s() {
72
+ o({
73
+ testForHeightReduction: !0,
74
+ restoreTextAlign: null
75
+ });
76
+ }
77
+ }(e);
78
+ }), e;
79
+ }).destroy = function(e) {
80
+ return e && Array.prototype.forEach.call(e.length ? e : [e], pe), e;
81
+ }, j.update = function(e) {
82
+ return e && Array.prototype.forEach.call(e.length ? e : [e], A), e;
83
+ });
84
+ var M = j, N = ["type"], P = {
85
+ key: 0,
86
+ class: "pk-chat-button__label"
87
+ }, F = /* @__PURE__ */ v({
88
+ __name: "PkChatButton",
89
+ props: {
90
+ icon: {},
91
+ label: { default: void 0 },
92
+ type: { default: "button" },
93
+ modifiers: { default: void 0 }
94
+ },
95
+ setup(e) {
96
+ return (t, n) => {
97
+ let r = c;
98
+ return x(), p("button", {
99
+ class: te(["pk-chat-button", [e.modifiers ? `pk-chat-button--${e.modifiers}` : void 0, { "pk-chat-button--labelled": e.label }]]),
100
+ type: e.type
101
+ }, [g(r, {
102
+ name: e.icon,
103
+ class: "pk-chat-button__icon"
104
+ }, null, 8, ["name"]), e.label ? (x(), p("span", P, C(e.label), 1)) : f("", !0)], 10, N);
105
+ };
106
+ }
107
+ }), me = { class: "pk-chatbot-input" }, he = {
108
+ key: 0,
109
+ class: "pk-chatbot-input__notice",
110
+ role: "status"
111
+ }, ge = {
112
+ key: 2,
113
+ class: "pk-chatbot-input__notice-text"
114
+ }, _e = ["title"], ve = {
115
+ key: 1,
116
+ class: "pk-chatbot-input__pointer"
117
+ }, ye = { class: "pk-chatbot-input__pointer-label" }, be = {
118
+ key: 2,
119
+ class: "pk-chatbot-input__attachments"
120
+ }, xe = { class: "pk-chatbot-input__fieldset" }, Se = [
121
+ "title",
122
+ "disabled",
123
+ "onClick"
124
+ ], Ce = ["accept"], we = ["accept"], Te = { class: "pk-chatbot-input__content" }, Ee = [
125
+ "value",
126
+ "aria-label",
127
+ "aria-describedby",
128
+ "aria-invalid",
129
+ "placeholder"
130
+ ], De = ["id"], Oe = { class: "opacity-60" }, I = /* @__PURE__ */ v({
131
+ __name: "PkChatbotInput",
132
+ props: /*@__PURE__*/ y({
133
+ placeholder: {},
134
+ dismissableNotice: {},
135
+ pageNotice: {},
136
+ status: {},
137
+ maxMessageLength: {},
138
+ fileUpload: {},
139
+ attachmentLimitReached: { type: Boolean },
140
+ attachmentNotice: {},
141
+ voiceEnabled: { type: Boolean },
142
+ queueEnabled: { type: Boolean },
143
+ answerNotices: {},
144
+ pointerAvailable: { type: Boolean },
145
+ pointing: { type: Boolean },
146
+ pointer: {},
147
+ automaticConfirmations: { type: Boolean },
148
+ editableImages: { type: Boolean },
149
+ retryableAttachments: { type: Boolean }
150
+ }, {
151
+ modelValue: { default: void 0 },
152
+ modelModifiers: {},
153
+ pendingAttachments: { default: () => [] },
154
+ pendingAttachmentsModifiers: {}
155
+ }),
156
+ emits: /*@__PURE__*/ y([
157
+ "submit",
158
+ "stop-generation",
159
+ "file-select",
160
+ "remove-attachment",
161
+ "replace-attachment",
162
+ "retry-attachment",
163
+ "dismiss-attachment-notice",
164
+ "dismiss-page-notice",
165
+ "open-answer-notice",
166
+ "dismiss-answer-notice",
167
+ "voice-start",
168
+ "point",
169
+ "remove-pointer",
170
+ "manual-confirmations"
171
+ ], ["update:modelValue", "update:pendingAttachments"]),
172
+ setup(v, { expose: y, emit: k }) {
173
+ let pe = _(() => import("./PkImageEditorDialog-BhfdnsmX.js")), A = T(v, "modelValue"), j = T(v, "pendingAttachments"), N = k, P = v, { t: I } = de({ useScope: "global" }), L = E("textareaEl"), R = E("fileInputEl"), z = E("cameraInputEl"), B = E("formEl"), V = S(A.value ?? ""), H = null, U = () => {
174
+ H !== null && (clearTimeout(H), H = null);
175
+ }, ke = () => {
176
+ U(), A.value = V.value;
177
+ }, Ae = () => {
178
+ U(), H = setTimeout(() => {
179
+ A.value = V.value, H = null;
180
+ }, 300);
181
+ }, je = () => {
182
+ V.value = L.value?.value ?? "", Ae();
183
+ };
184
+ D(A, (e) => {
185
+ e !== V.value && (V.value = e ?? "", b(() => {
186
+ L.value && M.update(L.value);
187
+ }));
188
+ });
189
+ let W = u(() => P.status === "streaming"), Me = u(() => P.status === "submitted"), G = u(() => W.value || Me.value), Ne = ce(), Pe = u(() => V.value.length), K = u(() => P.maxMessageLength !== void 0 && Pe.value > P.maxMessageLength), Fe = u(() => j.value.some((e) => e.state === "uploading")), Ie = u(() => j.value.some((e) => e.state === "error")), q = u(() => G.value && !P.queueEnabled || Fe.value || Ie.value || K.value ? !1 : V.value.trim().length > 0), Le = u(() => G.value && q.value), Re = "capture" in document.createElement("input"), ze = u(() => {
190
+ let t = P.fileUpload?.allowedMimeTypes ?? [];
191
+ return [...t, ...e(t)].join(",");
192
+ }), Be = u(() => (P.fileUpload?.allowedMimeTypes ?? []).filter((e) => e.startsWith("image/")).join(",")), J = u(() => Re && Be.value.length > 0), Ve = () => {
193
+ R.value?.click();
194
+ }, He = () => {
195
+ z.value?.click();
196
+ }, Ue = (e) => {
197
+ for (let t of e) N("file-select", t);
198
+ }, We = (e) => {
199
+ let t = e.target;
200
+ Ue(Array.from(t.files ?? [])), t.value = "";
201
+ }, Ge = (e) => {
202
+ let t = j.value.find((t) => t.id === e);
203
+ t && (URL.revokeObjectURL(t.localUrl), j.value = j.value.filter((t) => t.id !== e), N("remove-attachment", t));
204
+ }, Y = S(), X = u(() => j.value.find((e) => e.id === Y.value)), Z = se(), Q = u(() => X.value?.file ?? Z.value), Ke = (e) => !!P.editableImages && e.state !== "uploading" && i(e.file.type), qe = () => {
205
+ Y.value = void 0, Z.value = void 0;
206
+ }, Je = async (e) => {
207
+ let t = X.value, n = !t && !!Z.value;
208
+ if (qe(), t) N("replace-attachment", t, e);
209
+ else if (n) N("file-select", e);
210
+ else return;
211
+ await b(), L.value?.focus();
212
+ }, Ye = S(!0), Xe = () => {
213
+ Ye.value = !1;
214
+ }, Ze = u(() => {
215
+ if (P.attachmentNotice) return [{
216
+ id: "limit",
217
+ icon: "ri:information-line",
218
+ text: P.attachmentNotice,
219
+ dismiss: () => N("dismiss-attachment-notice")
220
+ }];
221
+ let e = [];
222
+ Ie.value && e.push({
223
+ id: "upload-failed",
224
+ icon: "ri:error-warning-line",
225
+ text: I("message.attachmentUploadFailed")
226
+ });
227
+ for (let t of P.answerNotices ?? []) e.push({
228
+ id: `answer-${t.id}`,
229
+ icon: "ri:chat-check-line",
230
+ text: t.text,
231
+ open: () => N("open-answer-notice", t.id),
232
+ dismiss: () => N("dismiss-answer-notice", t.id)
233
+ });
234
+ return P.pageNotice && e.push({
235
+ id: "page",
236
+ icon: "ri:pages-line",
237
+ text: P.pageNotice,
238
+ dismiss: () => N("dismiss-page-notice")
239
+ }), P.dismissableNotice && Ye.value && e.push({
240
+ id: "dismissable",
241
+ markdown: P.dismissableNotice,
242
+ dismiss: Xe
243
+ }), e;
244
+ }), Qe = () => {
245
+ B.value?.querySelector("button:focus-visible") && L.value?.focus();
246
+ }, $e = () => {
247
+ Qe(), N("stop-generation");
248
+ }, et = () => {
249
+ q.value && (Qe(), ke(), N("submit"), V.value = "", A.value = "", b(() => {
250
+ L.value && (L.value.value = "", M.update(L.value));
251
+ }));
252
+ }, tt = (e) => {
253
+ e.shiftKey || r(e) || (e.preventDefault(), et());
254
+ };
255
+ ie(() => {
256
+ L.value && M(L.value);
257
+ });
258
+ let $ = 0;
259
+ return fe(L, ([e]) => {
260
+ let t = e?.contentRect.width ?? 0;
261
+ L.value && t !== $ && ($ = t, M.update(L.value));
262
+ }), D(() => P.placeholder, async () => {
263
+ await b(), L.value && M.update(L.value);
264
+ }), re(() => {
265
+ U(), L.value && M.destroy(L.value);
266
+ for (let e of j.value) URL.revokeObjectURL(e.localUrl);
267
+ }), y({
268
+ focus: () => L.value?.focus(),
269
+ annotateImage: (e) => {
270
+ Y.value = void 0, Z.value = e;
271
+ }
272
+ }), (e, r) => {
273
+ let i = c, u = t, _ = s, y = o;
274
+ return x(), p("div", me, [
275
+ Ze.value.length ? (x(), p("div", he, [(x(!0), p(l, null, ae(Ze.value, (e) => (x(), p("div", {
276
+ key: e.id,
277
+ class: "pk-chatbot-input__notice-item"
278
+ }, [
279
+ e.icon ? (x(), d(i, {
280
+ key: 0,
281
+ name: e.icon,
282
+ class: "pk-chatbot-input__notice-icon"
283
+ }, null, 8, ["name"])) : f("", !0),
284
+ e.markdown ? (x(), d(n, {
285
+ key: 1,
286
+ markdown: e.markdown,
287
+ class: "wysiwyg pk-chatbot-input__notice-text"
288
+ }, null, 8, ["markdown"])) : (x(), p("span", ge, C(e.text), 1)),
289
+ e.open ? (x(), d(u, {
290
+ key: 3,
291
+ label: w(I)("action.open"),
292
+ modifiers: "link",
293
+ class: "pk-chatbot-input__notice-action",
294
+ onClick: (t) => e.open()
295
+ }, null, 8, ["label", "onClick"])) : f("", !0),
296
+ e.dismiss ? (x(), d(u, {
297
+ key: 4,
298
+ title: w(I)("action.close"),
299
+ modifiers: "action-quiet",
300
+ icon: "ri:close-line",
301
+ class: "w-18 h-18",
302
+ onClick: (t) => e.dismiss()
303
+ }, null, 8, ["title", "onClick"])) : f("", !0)
304
+ ]))), 128))])) : f("", !0),
305
+ m("form", {
306
+ ref_key: "formEl",
307
+ ref: B,
308
+ class: "pk-chatbot-input__form",
309
+ onSubmit: ue(et, ["prevent"])
310
+ }, [
311
+ v.automaticConfirmations ? (x(), p("button", {
312
+ key: 0,
313
+ type: "button",
314
+ class: "pk-chatbot-input__mode",
315
+ title: w(I)("action.manualConfirmations"),
316
+ onClick: r[0] ||= (e) => N("manual-confirmations")
317
+ }, [
318
+ g(i, {
319
+ name: "ri:flashlight-line",
320
+ class: "pk-chatbot-input__pointer-icon"
321
+ }),
322
+ h(" " + C(w(I)("label.automaticConfirmations")) + " ", 1),
323
+ g(i, {
324
+ name: "ri:close-line",
325
+ class: "pk-chatbot-input__pointer-icon"
326
+ })
327
+ ], 8, _e)) : f("", !0),
328
+ v.pointer ? (x(), p("div", ve, [
329
+ g(i, {
330
+ name: v.pointer.kind === "text" ? "ri:double-quotes-l" : "ri:focus-3-line",
331
+ class: "pk-chatbot-input__pointer-icon"
332
+ }, null, 8, ["name"]),
333
+ m("span", ye, C(v.pointer.kind === "text" ? `«${v.pointer.label}»` : v.pointer.label), 1),
334
+ g(u, {
335
+ title: w(I)("pagePointer.remove"),
336
+ modifiers: "action-quiet",
337
+ icon: "ri:close-line",
338
+ class: "w-18 h-18",
339
+ onClick: r[1] ||= (e) => N("remove-pointer")
340
+ }, null, 8, ["title"])
341
+ ])) : f("", !0),
342
+ j.value.length ? (x(), p("div", be, [(x(!0), p(l, null, ae(j.value, (e) => (x(), d(a, {
343
+ key: e.id,
344
+ "media-type": e.mediaSource?.mimeType ?? e.file.type,
345
+ url: e.localUrl,
346
+ filename: e.file.name,
347
+ size: e.file.size,
348
+ loading: e.state === "uploading",
349
+ error: e.state === "error" ? e.error : void 0,
350
+ removable: e.state !== "uploading",
351
+ editable: Ke(e),
352
+ retryable: v.retryableAttachments && e.state === "error",
353
+ compact: "",
354
+ onRemove: (t) => Ge(e.id),
355
+ onEdit: (t) => Y.value = e.id,
356
+ onRetry: (t) => N("retry-attachment", e)
357
+ }, null, 8, [
358
+ "media-type",
359
+ "url",
360
+ "filename",
361
+ "size",
362
+ "loading",
363
+ "error",
364
+ "removable",
365
+ "editable",
366
+ "retryable",
367
+ "onRemove",
368
+ "onEdit",
369
+ "onRetry"
370
+ ]))), 128))])) : f("", !0),
371
+ m("div", xe, [
372
+ oe(e.$slots, "prepend"),
373
+ v.fileUpload && v.fileUpload.enabled && (J.value || e.$slots["additional-actions"]) ? (x(), d(y, ne(ee({ key: 0 }, {
374
+ placement: "top-start",
375
+ modifiers: "menu",
376
+ flip: !0,
377
+ offset: 3
378
+ })), {
379
+ default: O(({ init: e, toggle: t, aria: n }) => [m("button", ee({ ref: (t) => e(t) }, n, {
380
+ class: "pk-chat-button",
381
+ type: "button",
382
+ title: w(I)("action.attachFile"),
383
+ disabled: G.value,
384
+ onClick: t
385
+ }), [g(i, {
386
+ name: "ri:add-line",
387
+ class: "pk-chat-button__icon"
388
+ })], 16, Se)]),
389
+ items: O(() => [
390
+ J.value ? (x(), d(_, {
391
+ key: 0,
392
+ disabled: G.value || v.attachmentLimitReached,
393
+ onClick: He
394
+ }, {
395
+ default: O(() => [g(i, {
396
+ name: "ri:camera-line",
397
+ class: "pk-chatbot-input__dropdown-icon"
398
+ }), h(" " + C(w(I)("action.takePhoto")), 1)]),
399
+ _: 1
400
+ }, 8, ["disabled"])) : f("", !0),
401
+ g(_, {
402
+ disabled: G.value || v.attachmentLimitReached,
403
+ onClick: Ve
404
+ }, {
405
+ default: O(() => [g(i, {
406
+ name: "ri:attachment-line",
407
+ class: "pk-chatbot-input__dropdown-icon"
408
+ }), h(" " + C(w(I)("action.attachFile")), 1)]),
409
+ _: 1
410
+ }, 8, ["disabled"]),
411
+ oe(e.$slots, "additional-actions")
412
+ ]),
413
+ _: 3
414
+ }, 16)) : v.fileUpload && v.fileUpload.enabled ? (x(), d(F, {
415
+ key: 1,
416
+ icon: "ri:add-line",
417
+ title: w(I)("action.attachFile"),
418
+ disabled: G.value || v.attachmentLimitReached,
419
+ onClick: Ve
420
+ }, null, 8, ["title", "disabled"])) : f("", !0),
421
+ v.fileUpload && v.fileUpload.enabled ? (x(), p("input", {
422
+ key: 2,
423
+ ref_key: "fileInputEl",
424
+ ref: R,
425
+ type: "file",
426
+ hidden: "",
427
+ multiple: "",
428
+ accept: ze.value,
429
+ onChange: We
430
+ }, null, 40, Ce)) : f("", !0),
431
+ v.fileUpload && v.fileUpload.enabled && J.value ? (x(), p("input", {
432
+ key: 3,
433
+ ref_key: "cameraInputEl",
434
+ ref: z,
435
+ type: "file",
436
+ capture: "environment",
437
+ hidden: "",
438
+ accept: Be.value,
439
+ onChange: We
440
+ }, null, 40, we)) : f("", !0),
441
+ v.pointerAvailable ? (x(), d(F, {
442
+ key: 4,
443
+ icon: "ri:focus-3-line",
444
+ title: w(I)("pagePointer.start"),
445
+ "aria-pressed": v.pointing,
446
+ disabled: G.value,
447
+ onClick: r[2] ||= (e) => N("point")
448
+ }, null, 8, [
449
+ "title",
450
+ "aria-pressed",
451
+ "disabled"
452
+ ])) : f("", !0),
453
+ m("div", Te, [m("textarea", {
454
+ ref_key: "textareaEl",
455
+ ref: L,
456
+ value: V.value,
457
+ class: "pk-chatbot-input__textarea",
458
+ name: "message",
459
+ rows: "1",
460
+ enterkeyhint: "send",
461
+ "aria-label": w(I)("label.message"),
462
+ "aria-describedby": v.maxMessageLength ? w(Ne) : void 0,
463
+ "aria-invalid": K.value || void 0,
464
+ placeholder: v.placeholder,
465
+ onInput: je,
466
+ onKeydown: le(tt, ["enter"])
467
+ }, null, 40, Ee)]),
468
+ v.maxMessageLength ? (x(), p("div", {
469
+ key: 5,
470
+ id: w(Ne),
471
+ class: te(["pk-chatbot-input__counter", { "pk-chatbot-input__counter--over": K.value }])
472
+ }, [h(C(e.$n(Pe.value, "integer")) + "/", 1), m("span", Oe, C(e.$n(v.maxMessageLength, "integer")), 1)], 10, De)) : f("", !0),
473
+ v.voiceEnabled && !W.value ? (x(), d(F, {
474
+ key: 6,
475
+ icon: "ri:mic-line",
476
+ title: w(I)("action.talk"),
477
+ disabled: G.value,
478
+ onClick: r[3] ||= (e) => N("voice-start")
479
+ }, null, 8, ["title", "disabled"])) : f("", !0),
480
+ W.value ? (x(), d(F, {
481
+ key: 7,
482
+ icon: "ri:stop-fill",
483
+ modifiers: Le.value ? void 0 : "primary",
484
+ title: w(I)("action.stop"),
485
+ onClick: $e
486
+ }, null, 8, ["modifiers", "title"])) : f("", !0),
487
+ Le.value ? (x(), d(F, {
488
+ key: 8,
489
+ type: "submit",
490
+ modifiers: "primary",
491
+ icon: "ri:arrow-up-line",
492
+ title: w(I)("action.queueMessage")
493
+ }, null, 8, ["title"])) : W.value ? f("", !0) : (x(), d(F, {
494
+ key: 9,
495
+ type: "submit",
496
+ modifiers: "primary",
497
+ icon: Me.value ? "loading-loop" : "ri:arrow-up-line",
498
+ title: w(I)("action.submit"),
499
+ disabled: !q.value
500
+ }, null, 8, [
501
+ "icon",
502
+ "title",
503
+ "disabled"
504
+ ]))
505
+ ])
506
+ ], 544),
507
+ Q.value ? (x(), d(w(pe), {
508
+ key: X.value?.id ?? "annotating",
509
+ file: Q.value,
510
+ "initial-tool": X.value ? void 0 : "arrow",
511
+ onApply: Je,
512
+ onClose: qe
513
+ }, null, 8, ["file", "initial-tool"])) : f("", !0)
514
+ ]);
515
+ };
516
+ }
517
+ });
518
+ export { F as n, I as t };
519
+
520
+ //# sourceMappingURL=PkChatbotInput-CN4rmNgu.js.map