@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
@@ -1,1054 +0,0 @@
1
- import { A as e, E as t, S as n, n as r, v as i } from "./schemas-BO5QlXAp.js";
2
- import { c as a } from "./Media-DylqhvaF.js";
3
- import { A as o, H as s, _ as c, k as l, r as u } from "./Agent-ldDZiq6E.js";
4
- import { t as d } from "./VvButtonLocalized-C-vx25u4.js";
5
- import { n as f } from "./useLightbox-Ctl9zaMX.js";
6
- import { t as p } from "./PkStreamingMarkdown-COQLmP8b.js";
7
- import "./src-nb8MU1sh.js";
8
- import { c as m, i as h, l as g, n as _, o as ee, s as v, t as te, u as y } from "./message-DuibQyHy.js";
9
- import { t as ne } from "./PkChatbotAudioTranscript-DgmuXalb.js";
10
- import { D as re, F as ie, L as ae, M as b, P as oe, S as x, V as se, b as ce, d as le, g as S, h as ue, i as de, j as fe, k as pe, n as me, r as he, t as ge, u as _e, v as ve, x as ye, y as be } from "./utils-Do3JWPJe.js";
11
- import { t as xe } from "./PkChatbotError-BS84xuiu.js";
12
- import { t as Se } from "./PkRelativeTime-CZF5CYHv.js";
13
- import { t as Ce } from "./PkChatbotFeedbackForm-D3YNMO7m.js";
14
- import { t as we } from "./PkChatbotMessageFeedback-DltXugdR.js";
15
- import { t as Te } from "./PkChatbotFilePreview-BIta8Yg-.js";
16
- import { n as Ee, r as De, t as Oe } from "./PkChatbotSteps-CRtIVwJV.js";
17
- import { t as ke } from "./PkChatbotOutlineRail-BI-DMvZi.js";
18
- import { VvAccordion as Ae, VvButtonGroup as je, VvIcon as Me } from "@volverjs/ui-vue/components";
19
- import { Fragment as C, Transition as w, computed as T, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createTextVNode as Ne, createVNode as A, defineAsyncComponent as j, defineComponent as M, inject as Pe, mergeProps as Fe, nextTick as N, normalizeClass as P, normalizeStyle as Ie, onBeforeUnmount as F, onMounted as Le, openBlock as I, ref as L, renderList as Re, renderSlot as ze, resolveDynamicComponent as Be, shallowRef as Ve, toDisplayString as R, unref as z, useSlots as He, useTemplateRef as Ue, watch as B, withCtx as V, withModifiers as H } from "vue";
20
- import { useI18n as We } from "vue-i18n";
21
- import { useResizeObserver as Ge } from "@vueuse/core";
22
- // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.js
23
- function Ke(t) {
24
- return e(r, t);
25
- }
26
- i({
27
- platform: n(),
28
- threadId: n()
29
- });
30
- var qe = i({
31
- wakeId: t(),
32
- dueAt: Ke(),
33
- reason: n()
34
- });
35
- i({ pendingWakeup: qe.nullable() }), i({ wakeId: t() });
36
- var U = (e) => e?.role === "user" && !!e.metadata?.wakeup, Je = /* @__PURE__ */ new Set([
37
- "input-streaming",
38
- "input-available",
39
- "approval-requested"
40
- ]), Ye = /* @__PURE__ */ new Set([
41
- ...o,
42
- ...l,
43
- ...c
44
- ]);
45
- [...l, u.ShowContactForm];
46
- var Xe = (e) => e.state, Ze = (e) => e.type.startsWith("tool-") ? e.type.slice(5) : void 0, W = (e) => e?.role === "assistant" && e.parts.some((e) => {
47
- if (e.type === "text") return e.text.trim().length > 0;
48
- if (e.type === "file") return !0;
49
- let t = Xe(e);
50
- if (t && Je.has(t)) return !0;
51
- let n = Ze(e);
52
- return n !== void 0 && Ye.has(n) && t === "output-available";
53
- }), Qe = (e) => {
54
- if (e?.role !== "assistant" || W(e)) return !1;
55
- let t = !1;
56
- for (let n of e.parts) n.type === "tool-scheduleWakeup" && (t = Xe(n) === "output-available" && n.input?.noop === !0);
57
- return t;
58
- }, $e = {
59
- requestOAuthConnection: j(() => import("./PkToolRequestOAuthConnection-OTvMRYaL.js")),
60
- shareDocument: j(() => import("./PkToolShareDocument-CspvFwRR.js").then((e) => e.n)),
61
- showArtifact: j(() => import("./PkToolShowArtifact-CUP3VaC9.js").then((e) => e.n)),
62
- showCalendarEvent: j(() => import("./PkToolShowCalendarEvent-CAejFLQI.js").then((e) => e.n)),
63
- showChart: j(() => import("./PkToolShowChart-X6JZDAWD.js").then((e) => e.t)),
64
- showComparison: j(() => import("./PkToolShowComparison-BEHyRNXE.js").then((e) => e.n)),
65
- showContactForm: j(() => import("./PkToolShowContactForm-BM8d9M5a.js").then((e) => e.n)),
66
- showDiagram: j(() => import("./PkToolShowDiagram-DOdzpndK.js")),
67
- showEmail: j(() => import("./PkToolShowEmail-BehvoNsz.js").then((e) => e.n)),
68
- showImageGallery: j(() => import("./PkToolShowImageGallery-BvwuoyF6.js").then((e) => e.n)),
69
- showLocation: j(() => import("./PkToolShowLocation-WdRqG8Wi.js").then((e) => e.n)),
70
- showMessage: j(() => import("./PkToolShowMessage-Cca7K7GQ.js").then((e) => e.n)),
71
- showForm: j(() => import("./PkToolShowForm-TYBf8q6g.js").then((e) => e.n)),
72
- showMultipleChoice: j(() => import("./PkToolShowForm-TYBf8q6g.js").then((e) => e.n)),
73
- showProductList: j(() => import("./PkToolShowProductList-_MHBAgNI.js").then((e) => e.n)),
74
- showQrCode: j(() => import("./PkToolShowQrCode-96KzD1rX.js").then((e) => e.n)),
75
- showSources: j(() => import("./PkToolShowSources-CHw7qZtw.js").then((e) => e.n)),
76
- showSuggestedReply: j(() => import("./PkToolShowSuggestedReply-BVLCX5Sm.js").then((e) => e.n)),
77
- showVideo: j(() => import("./PkToolShowVideo-D7oiBe4p.js")),
78
- showWeather: j(() => import("./PkToolShowWeather-1NJwawC7.js")),
79
- showWebPages: j(() => import("./PkToolShowWebPages-CRq9Jhmw.js").then((e) => e.n))
80
- }, et = {
81
- key: 0,
82
- class: "text-12 text-word-3 m-0 mb-xs"
83
- }, tt = /* @__PURE__ */ M({
84
- __name: "PkToolApprovalPreviewMessage",
85
- props: { input: {} },
86
- setup(e) {
87
- let t = e, n = T(() => {
88
- let e = t.input;
89
- return typeof e?.message == "string" ? e.message : "";
90
- });
91
- return (e, t) => n.value ? (I(), O("p", et, R(n.value), 1)) : D("", !0);
92
- }
93
- }), nt = { [ge]: tt }, rt = {
94
- key: 0,
95
- class: "text-12 text-word-3 m-0 mb-xs"
96
- }, it = /* @__PURE__ */ M({
97
- __name: "PkToolApprovalCard",
98
- props: {
99
- part: {},
100
- actionable: { type: Boolean },
101
- callVerdict: { type: Boolean }
102
- },
103
- emits: ["respond"],
104
- setup(e, { emit: t }) {
105
- let n = e, r = t, { t: i, te: a } = We({ useScope: "global" }), o = T(() => n.part), c = T(() => h(n.part)), l = T(() => c.value === ge), u = T(() => l.value ? (o.value.state === "input-available" || s(o.value.output)) && n.callVerdict === void 0 : o.value.state === "approval-requested"), f = T(() => u.value && n.actionable === !0), p = T(() => u.value && n.actionable !== !0), m = T(() => l.value ? o.value.output === "confirmed" || n.callVerdict === !0 : o.value.approval?.approved === !0), g = T(() => l.value ? o.value.output === "cancelled" || n.callVerdict === !1 : o.value.approval?.approved === !1 || o.value.state === "output-denied"), _ = T(() => nt[c.value]), ee = T(() => _.value ? i("toolApproval.prompt") : i("toolApproval.promptNamed", { tool: se(c.value, {
106
- t: i,
107
- te: a
108
- }) })), v = T(() => {
109
- if (p.value) return {
110
- icon: "ri:time-line",
111
- message: i("toolApproval.expired")
112
- };
113
- if (m.value) return {
114
- icon: "ri:check-line",
115
- message: i(l.value ? "toolApproval.confirmed" : "toolApproval.approved")
116
- };
117
- if (g.value) return {
118
- icon: "ri:close-line",
119
- message: i(l.value ? "toolApproval.cancelled" : "toolApproval.denied")
120
- };
121
- }), te = T(() => !!v.value && !_.value);
122
- return (t, n) => {
123
- let a = d, s = je, c = Me;
124
- return I(), O("div", { class: P(["w-full overflow-hidden transition-all duration-300", { "bg-surface p-sm rounded-xl border border-surface-3": !te.value }]) }, [
125
- A(w, null, {
126
- default: V(() => [!l.value && u.value ? (I(), O("p", rt, R(ee.value), 1)) : D("", !0)]),
127
- _: 1
128
- }),
129
- _.value ? (I(), E(Be(_.value), {
130
- key: 0,
131
- part: e.part,
132
- input: o.value.input
133
- }, null, 8, ["part", "input"])) : D("", !0),
134
- A(w, { mode: "out-in" }, {
135
- default: V(() => [v.value ? (I(), O("p", {
136
- key: 1,
137
- class: P(["flex items-center gap-4 text-12 text-word-3 m-0", { "mt-xs": _.value }])
138
- }, [A(c, {
139
- name: v.value.icon,
140
- class: "shrink-0"
141
- }, null, 8, ["name"]), Ne(" " + R(v.value.message), 1)], 2)) : (I(), E(s, { key: 0 }, {
142
- default: V(() => [A(a, {
143
- modifiers: "primary-small",
144
- disabled: !f.value,
145
- icon: "ri:check-line",
146
- label: z(i)("action.proceed"),
147
- onClick: n[0] ||= H((e) => r("respond", !0), ["stop"])
148
- }, null, 8, ["disabled", "label"]), A(a, {
149
- modifiers: "action-quiet-small",
150
- disabled: !f.value,
151
- icon: "ri:close-line",
152
- label: z(i)("action.cancel"),
153
- onClick: n[1] ||= H((e) => r("respond", !1), ["stop"])
154
- }, null, 8, ["disabled", "label"])]),
155
- _: 1
156
- }))]),
157
- _: 1
158
- })
159
- ], 2);
160
- };
161
- }
162
- }), G = { class: "pk-host-call-confirm-card w-full bg-surface p-sm rounded-xl border border-surface-3" }, K = { class: "text-14 text-word-2 m-0 mb-xs" }, at = {
163
- key: 1,
164
- class: "pk-host-call-confirm-card__details text-14 m-0 mb-xs"
165
- }, q = {
166
- key: 0,
167
- class: "text-word-3 truncate"
168
- }, ot = {
169
- key: 2,
170
- class: "text-12 text-word-3 m-0 mb-xs"
171
- }, st = { class: "pk-host-call-confirm-card__details text-12 m-0" }, ct = { class: "text-word-3" }, J = { class: "text-word-2 m-0" }, lt = /* @__PURE__ */ M({
172
- __name: "PkHostCallConfirmCard",
173
- props: {
174
- question: {},
175
- details: {},
176
- unchanged: {}
177
- },
178
- emits: ["respond"],
179
- setup(e, { emit: t }) {
180
- let n = e, r = t, i = T(() => n.details?.some((e) => e.before !== void 0) ?? !1);
181
- return (t, n) => {
182
- let a = Ae, o = d, s = je;
183
- return I(), O("div", G, [
184
- k("p", K, R(e.question), 1),
185
- e.details?.length && i.value ? (I(), E(De, {
186
- key: 0,
187
- changes: e.details,
188
- class: "mb-xs"
189
- }, null, 8, ["changes"])) : e.details?.length ? (I(), O("dl", at, [(I(!0), O(C, null, Re(e.details, (e, t) => (I(), O(C, { key: t }, [e.label ? (I(), O("dt", q, R(e.label), 1)) : D("", !0), k("dd", { class: P(["text-word-1 m-0 truncate", { "pk-host-call-confirm-card__alone": !e.label }]) }, R(e.value), 3)], 64))), 128))])) : e.unchanged?.length ? (I(), O("p", ot, R(t.$t("toolApproval.noChanges")), 1)) : D("", !0),
190
- e.unchanged?.length ? (I(), E(a, {
191
- key: 3,
192
- title: t.$t("toolApproval.unchangedFields", e.unchanged.length),
193
- modifiers: "compact",
194
- class: "mb-xs"
195
- }, {
196
- default: V(() => [k("dl", st, [(I(!0), O(C, null, Re(e.unchanged, (e, t) => (I(), O(C, { key: t }, [k("dt", ct, R(e.label), 1), k("dd", J, R(e.value), 1)], 64))), 128))])]),
197
- _: 1
198
- }, 8, ["title"])) : D("", !0),
199
- A(s, null, {
200
- default: V(() => [A(o, {
201
- modifiers: "primary-small",
202
- icon: "ri:check-line",
203
- label: t.$t("action.proceed"),
204
- onClick: n[0] ||= H((e) => r("respond", !0), ["stop"])
205
- }, null, 8, ["label"]), A(o, {
206
- modifiers: "action-quiet-small",
207
- icon: "ri:close-line",
208
- label: t.$t("action.cancel"),
209
- onClick: n[1] ||= H((e) => r("respond", !1), ["stop"])
210
- }, null, 8, ["label"])]),
211
- _: 1
212
- })
213
- ]);
214
- };
215
- }
216
- }), ut = 30, Y = 500;
217
- function dt(e) {
218
- let { scrollEl: t, status: n, messagesLength: r, lastMessageRole: i, contentEl: a, beforeNewMessageScroll: o, onScrollUp: s, onScrollDown: c } = e, l = L(!1), u = L(!0), d = !1, f = null, p = null, m = null, h = null, g = 0, _ = (e = "smooth") => {
219
- !t.value || l.value ? d = !1 : (d = !0, t.value.scrollTo({
220
- top: t.value.scrollHeight,
221
- behavior: e
222
- }), setTimeout(() => {
223
- d = !1;
224
- }, e === "instant" ? 0 : Y));
225
- }, ee = (e) => {
226
- e.deltaY < 0 && (l.value = !0);
227
- }, v = 0, te = (e) => {
228
- v = e.touches[0]?.clientY ?? 0;
229
- }, y = (e) => {
230
- let t = e.touches[0]?.clientY ?? 0;
231
- t > v && (l.value = !0), v = t;
232
- }, ne = () => {
233
- if (!t.value) return;
234
- let { scrollTop: e, scrollHeight: n, clientHeight: r } = t.value;
235
- u.value = n - r - e < ut, d || (e < g && s?.(), e > g && (u.value && (l.value = !1), c?.())), g = e;
236
- }, re = () => {
237
- if (d || l.value || !t.value) return;
238
- let e = t.value, n = e.scrollHeight - e.clientHeight;
239
- n <= e.scrollTop || (u.value = !0, d = !0, e.scrollTop = n, requestAnimationFrame(() => {
240
- d = !1;
241
- }));
242
- }, ie = () => {
243
- !f && t.value && (f = new MutationObserver(re), f.observe(t.value, {
244
- childList: !0,
245
- subtree: !0,
246
- characterData: !0
247
- }));
248
- }, ae = () => {
249
- f?.disconnect(), f = null;
250
- };
251
- B(n, (e, t) => {
252
- e === "streaming" || e === "submitted" ? ie() : (e !== "ready" || t !== "streaming") && ae();
253
- }), B(r, async () => {
254
- if (r() && i() !== "assistant") {
255
- x(), l.value = !1, d = !0;
256
- try {
257
- await N(), await o?.(), await N();
258
- } finally {
259
- _();
260
- }
261
- }
262
- });
263
- let b = null, oe = () => {
264
- t.value && (t.value.scrollHeight <= t.value.clientHeight || (t.value.scrollTop = t.value.scrollHeight, b && clearTimeout(b), b = setTimeout(x, 300)));
265
- }, x = () => {
266
- p?.disconnect(), p = null, m?.disconnect(), m = null, b &&= (clearTimeout(b), null);
267
- };
268
- return Le(() => {
269
- if (!t.value) return;
270
- t.value.addEventListener("wheel", ee, { passive: !0 }), t.value.addEventListener("touchstart", te, { passive: !0 }), t.value.addEventListener("touchmove", y, { passive: !0 });
271
- let e = n() === "submitted" || n() === "streaming";
272
- e ? ie() : (p = new ResizeObserver(oe), p.observe(t.value), m = new MutationObserver(oe), m.observe(t.value, {
273
- childList: !0,
274
- subtree: !0
275
- }));
276
- let r = a?.() ?? t.value.firstElementChild;
277
- r && (h = new ResizeObserver(re), h.observe(r)), e || oe();
278
- }), F(() => {
279
- t.value?.removeEventListener("wheel", ee), t.value?.removeEventListener("touchstart", te), t.value?.removeEventListener("touchmove", y), h?.disconnect(), h = null, ae(), x();
280
- }), {
281
- handleScroll: ne,
282
- scrollToBottom: _,
283
- userScrolledUp: l,
284
- isAtBottom: u
285
- };
286
- }
287
- // ../../packages/components/src/chat/wakeupFeed.ts
288
- function ft(e, t = () => !1) {
289
- let n = (e) => Qe(e) && !t(e), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = 0;
290
- for (; a < e.length;) {
291
- let t = e[a];
292
- if (U(t) && n(e[a + 1])) {
293
- let o = t.id, s = 0, c;
294
- for (; U(e[a]) && n(e[a + 1]);) s += 1, c = e[a].metadata?.createdAt ?? c, r.add(e[a].id), r.add(e[a + 1].id), a += 2;
295
- i.set(o, {
296
- count: s,
297
- lastAt: c
298
- });
299
- } else n(t) && r.add(t.id), a += 1;
300
- }
301
- return {
302
- hidden: r,
303
- quietRuns: i
304
- };
305
- }
306
- // ../../packages/components/src/chat/PkChatbotMessages.vue?vue&type=script&setup=true&lang.ts
307
- var pt = ["aria-busy"], mt = {
308
- key: 0,
309
- class: "pk-chatbot-messages__outline"
310
- }, ht = {
311
- key: 0,
312
- class: "pk-chatbot-divider vv-separator"
313
- }, gt = { class: "pk-chatbot-divider__label" }, _t = {
314
- key: 1,
315
- class: "pk-chatbot-wakeup"
316
- }, vt = ["title"], yt = { class: "pk-chatbot-message__text" }, bt = ["title"], xt = {
317
- key: 0,
318
- class: "pk-chatbot-message__reaction-emoji"
319
- }, St = {
320
- key: 0,
321
- class: "flex flex-col items-end gap-8 w-full"
322
- }, Ct = { class: "pk-chatbot-message__host-step" }, wt = { class: "pk-chatbot-message__host-call" }, Tt = { class: "pk-chatbot-message__host-call-label" }, Et = {
323
- key: 0,
324
- class: "pk-chatbot-message__host-call-outcome"
325
- }, Dt = {
326
- key: 0,
327
- class: "pk-chatbot-message__loading-info"
328
- }, Ot = { class: "flex gap-8 items-center" }, kt = { class: "text-12" }, At = ["title"], jt = { class: "pk-chatbot-message__pointer-label" }, Mt = ["title"], Nt = { class: "pk-chatbot-message__pointer-label" }, Pt = { class: "flex gap-8 items-center" }, Ft = {
329
- key: 0,
330
- class: "pk-chatbot-message__footer"
331
- }, It = {
332
- key: 0,
333
- class: "pk-chatbot-message__hover-meta"
334
- }, Lt = ["datetime", "title"], Rt = { class: "truncate" }, zt = {
335
- key: 0,
336
- class: "flex items-center gap-4 min-w-0"
337
- }, Bt = { class: "truncate" }, Vt = ["title"], Ht = {
338
- key: 2,
339
- class: "flex items-center gap-4 text-12 text-word-3"
340
- }, Ut = { class: "truncate" }, Wt = ["datetime"], Gt = { class: "truncate" }, Kt = {
341
- key: 4,
342
- class: "flex items-center gap-4 text-12 text-word-3"
343
- }, qt = { class: "pk-chatbot-message__loading-info" }, Jt = { class: "flex gap-8 items-center" }, Yt = { class: "text-12" }, Xt = {
344
- key: 0,
345
- class: "pk-chatbot-message pk-chatbot-message--assistant"
346
- }, Zt = ["title", "aria-label"], Qt = /* @__PURE__ */ M({
347
- __name: "PkChatbotMessages",
348
- props: {
349
- status: {},
350
- messages: {},
351
- error: {},
352
- actions: {},
353
- mainColor: {},
354
- textColor: {},
355
- revisedAnswers: {},
356
- messageFeedbacks: {},
357
- readonlyFeedback: { type: Boolean },
358
- disableHeightAdjustment: { type: Boolean },
359
- showMessageDateTime: { type: Boolean },
360
- showMessageTokensCount: { type: Boolean },
361
- showMessageNumber: { type: Boolean },
362
- showAllMessageParts: { type: Boolean },
363
- interactive: { type: Boolean },
364
- showExtendedSteps: { type: Boolean },
365
- hideReasoning: { type: Boolean },
366
- awaitingSpokenAnswer: { type: Boolean },
367
- hostWorking: { type: Boolean },
368
- hostConfirmation: {},
369
- confirmVerdictsOnCall: {},
370
- isDark: { type: Boolean },
371
- showScrollToBottom: { type: Boolean },
372
- parentScrolls: { type: Boolean },
373
- feedbackMessageId: {},
374
- feedbackLoading: { type: Boolean },
375
- feedbackSubmitted: { type: Boolean },
376
- feedbackError: {}
377
- },
378
- emits: [
379
- "show-info",
380
- "regenerate",
381
- "revise",
382
- "upvote",
383
- "downvote",
384
- "feedback",
385
- "feedback-submit",
386
- "feedback-close",
387
- "scroll-up",
388
- "scroll-down",
389
- "auto-retry",
390
- "reset-chat",
391
- "approval-respond",
392
- "confirm-respond",
393
- "host-confirm-respond"
394
- ],
395
- setup(e, { emit: t }) {
396
- let n = e, r = t, { t: i, te: o, d: s, n: c } = We({ useScope: "global" }), l = Pe(he, void 0), u = Pe(me, void 0), se = (e) => {
397
- let t = e.toolCallId;
398
- return typeof t == "string" ? u?.value[t]?.details : void 0;
399
- }, ge = He(), j = (e, t) => {
400
- if (b(e)) {
401
- let n = e.toolCallId;
402
- n && r("confirm-respond", {
403
- toolCallId: n,
404
- confirmed: t
405
- });
406
- return;
407
- }
408
- let n = ye(e);
409
- n && r("approval-respond", {
410
- id: n,
411
- approved: t
412
- });
413
- }, M = Ue("scrollEl"), F = Ue("wrapperEl"), Ke = T(() => ae(n.textColor, n.mainColor));
414
- f(F);
415
- let { handleScroll: qe, scrollToBottom: Je, userScrolledUp: Ye, isAtBottom: Xe } = dt({
416
- scrollEl: M,
417
- status: () => n.status,
418
- messagesLength: () => n.messages?.length,
419
- lastMessageRole: () => n.messages?.[n.messages.length - 1]?.role,
420
- contentEl: () => F.value,
421
- beforeNewMessageScroll: () => J(),
422
- onScrollUp: () => r("scroll-up"),
423
- onScrollDown: () => r("scroll-down")
424
- }), Ze = () => {
425
- Ye.value = !1, Je();
426
- }, W = T(() => (n.messages ?? []).filter((e) => e.role === "user" && !U(e)).map((e) => ({
427
- id: e.id,
428
- preview: e.parts.find(g)?.text.trim().slice(0, 120) || "…"
429
- }))), Qe = L(), et = () => M.value?.querySelectorAll(".pk-chatbot-message--user") ?? [], tt = () => {
430
- let e = M.value;
431
- if (!e || !n.showScrollToBottom) return;
432
- let t = e.getBoundingClientRect().top + e.clientHeight / 2, r = W.value[0]?.id;
433
- et().forEach((e, n) => {
434
- e.getBoundingClientRect().top <= t && (r = W.value[n]?.id);
435
- }), Qe.value = r;
436
- };
437
- B(W, async () => {
438
- await N(), tt();
439
- });
440
- let nt = () => {
441
- qe(), tt();
442
- }, rt = (e) => {
443
- let t = M.value, n = W.value.findIndex((t) => t.id === e), r = et()[n];
444
- t && r && (Ye.value = !0, t.scrollTo({
445
- top: t.scrollTop + r.getBoundingClientRect().top - t.getBoundingClientRect().top - Number.parseFloat(getComputedStyle(t).paddingTop),
446
- behavior: "smooth"
447
- }));
448
- }, G = T(() => n.status === "submitted" || n.status === "streaming" || n.hostWorking === !0), K = L(0), at = L(!1), q = !1, ot = Ve(), st = () => n.messages?.[n.messages.length - 1]?.role === "user" || G.value, ct = () => {
449
- q = !1, at.value = !0, K.value = 0;
450
- }, J = async () => {
451
- if (!n.messages?.length || n.disableHeightAdjustment) return;
452
- if (!st()) {
453
- q && (await N(), M.value?.scrollHeight, st() || ct());
454
- return;
455
- }
456
- if (q = !0, at.value = !1, await N(), !M.value) return;
457
- let { paddingTop: e, paddingBottom: t } = getComputedStyle(M.value), r = M.value.clientHeight - Number.parseFloat(e) - Number.parseFloat(t), i = F.value && Number.parseFloat(getComputedStyle(F.value).rowGap) || 0, a = et();
458
- ot.value = a[a.length - 1];
459
- let o = r - (ot.value?.clientHeight ?? 0) - i;
460
- r > 0 && (K.value = Math.max(o, 0)), await N();
461
- };
462
- B([() => n.messages?.length, () => n.messages?.[n.messages.length - 1]?.id], () => J()), Ge([M, ot], () => {
463
- q && J();
464
- }), Le(() => {
465
- (G.value || n.awaitingSpokenAnswer) && J();
466
- }), B(G, (e) => {
467
- e || ct();
468
- });
469
- let ut = (e) => n.revisedAnswers?.some((t) => t.messageId === e), Y = (e) => n.messageFeedbacks?.find((t) => t.messageId === e), Qt = /* @__PURE__ */ new Set([
470
- "showContactForm",
471
- "showForm",
472
- "showMultipleChoice",
473
- "showSuggestedReply"
474
- ]), $t = /* @__PURE__ */ new Set([
475
- "showChart",
476
- "showDiagram",
477
- "showLocation"
478
- ]), en = (e) => {
479
- let t = h(e);
480
- return {
481
- ...!n.interactive && Qt.has(t) ? { record: !0 } : {},
482
- ...$t.has(t) ? { isDark: n.isDark } : {}
483
- };
484
- }, tn = (e, t) => !n.readonlyFeedback && xn(e, t), nn = (e) => n.readonlyFeedback ? Y(e) : void 0, rn = (e) => nn(e)?.vote, an = (e) => {
485
- let t = nn(e);
486
- if (t?.vote) return;
487
- let n = t?.metadata?.reactionEmoji;
488
- return typeof n == "string" && /\p{Extended_Pictographic}/u.test(n) ? n : void 0;
489
- }, on = (e) => !!(rn(e) || an(e)), sn = (e) => {
490
- if (an(e)) return "pk-chatbot-message__reaction--neutral";
491
- let t = rn(e);
492
- return t === "upvote" ? "pk-chatbot-message__reaction--positive" : t === "downvote" ? "pk-chatbot-message__reaction--negative" : "pk-chatbot-message__reaction--neutral";
493
- }, cn = (e) => {
494
- let t = rn(e);
495
- return i(t === "upvote" ? "hint.userFeedbackPositive" : t === "downvote" ? "hint.userFeedbackNegative" : "hint.userFeedbackReaction");
496
- }, ln = (e) => {
497
- let t = fn(e);
498
- for (let e = t.length - 1; e >= 0; --e) if (g(t[e])) return e;
499
- return -1;
500
- }, un = T(() => n.messages?.[n.messages.length - 1]), X = T(() => {
501
- let e = un.value;
502
- return e ? e.parts[e.parts.length - 1] : null;
503
- }), dn = T(() => {
504
- let e = /* @__PURE__ */ new Map();
505
- for (let t of n.messages ?? []) t.role === "assistant" && e.set(t.id, ie(_e(oe(t.parts))));
506
- return e;
507
- }), fn = (e) => dn.value.get(e.id) ?? e.parts, pn = T(() => n.status === "error"), mn = T(() => n.awaitingSpokenAnswer === !0 && !G.value), hn = T(() => mn.value && un.value?.role === "user" && !pn.value), gn = (e, t) => t(), _n = T(() => {
508
- let e = X.value;
509
- return x(i, e, l?.value);
510
- }), vn = T(() => {
511
- let e = X.value;
512
- return ve(e);
513
- }), yn = (e) => n.messages?.findIndex((t) => t.id === e), Z = (e) => e === void 0 || !n.messages ? !1 : e === n.messages.length - 1, bn = (e) => Z(e) && n.status === "ready" && !n.hostWorking && !!n.actions?.includes("regenerate"), xn = (e, t) => (!Z(t) || n.status === "ready" && !n.hostWorking) && !!n.actions?.includes(e), Sn = (e) => {
514
- let t = e.parts[e.parts.length - 1];
515
- return g(t);
516
- }, Cn = (e) => e.parts.some((e) => m(e) || y(e) || !!S(e)), wn = (e) => !!n.showExtendedSteps && Q(e) && Cn(e), Tn = (e) => n.hostConfirmation !== void 0 && S(e) !== void 0 && e.toolCallId === n.hostConfirmation.toolCallId, En = T(() => n.hostConfirmation !== void 0 && !n.messages?.some((e) => e.parts.some(Tn))), Dn = (e, t) => G.value && Z(e) && S(t)?.state === "input-available", On = (e, t, n, r) => {
517
- if (!S(n) || wn(e)) return !1;
518
- let i = Dn(t, n);
519
- return i && r === fn(e).length - 1 ? !1 : i || pe(n) || !ee(e);
520
- }, kn = (e, t) => {
521
- let n = S(t);
522
- return n?.state === "output-error" ? i(n.errorText === "The user refused this call. Do not repeat it unless the user asks." ? "toolApproval.denied" : "messagePart.hostToolFailed") : n?.state === "input-available" && !Dn(e, t) ? i("messagePart.hostToolNoAnswer") : void 0;
523
- }, An = (e) => y(e) && !fe(e) && !!($e[h(e)] || ge[e.type] || n.showAllMessageParts), jn = (e) => e.parts.some((e) => g(e) && !!e.text.trim() || v(e) || re(e) && !fe(e) || An(e)), Q = (e) => e.role === "assistant", Mn = (e) => e.role === "user", Nn = (e) => n.messages?.slice(0, e).reverse().find((e) => Q(e)), Pn = (e) => n.messages?.slice(e + 1).find((e) => Q(e)), Fn = (e) => {
524
- let t = Nn(e)?.metadata?.createdAt, n = Pn(e)?.metadata?.createdAt;
525
- if (!t || !n) return;
526
- let r = new Date(t), i = new Date(n);
527
- return r.toDateString() === i.toDateString() ? void 0 : i;
528
- }, $ = T(() => n.showAllMessageParts ? ft([]) : ft(n.messages ?? [], jn)), In = T(() => {
529
- let e = 0;
530
- return (n.messages ?? []).map((t) => t.parts.length > 0 ? ++e : void 0);
531
- }), Ln = (e, t) => t === 0 || e.role !== "assistant" ? !1 : !!(n.actions?.length || n.showMessageNumber || n.showMessageDateTime && e.metadata?.createdAt !== void 0 || e.metadata?.completedAt !== void 0 || n.showMessageTokensCount && e.metadata?.totalTokens !== void 0), Rn = (e) => {
532
- let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
533
- return s(t, n ? "time" : "date-time");
534
- }, zn = (e) => {
535
- let { createdAt: t, completedAt: n } = e.metadata ?? {};
536
- if (t && n) return ue(c, n - t);
537
- }, Bn = Ue("feedbackMessageEl");
538
- return B(() => n.feedbackMessageId, async () => {
539
- if (await N(), !n.feedbackMessageId) return;
540
- let e = Bn.value?.[0]?.$el;
541
- e && (Z(yn(n.feedbackMessageId)) ? Je() : e.scrollIntoView({
542
- behavior: "smooth",
543
- block: "center"
544
- }));
545
- }), (t, n) => {
546
- let u = Me, f = Ae, m = d, ee = je;
547
- return I(), O("div", {
548
- ref_key: "scrollEl",
549
- ref: M,
550
- class: P(["pk-chatbot-messages scrollbar-thin", {
551
- "pk-chatbot-messages--settling": at.value,
552
- "pk-chatbot-messages--parent-scrolls": e.parentScrolls
553
- }]),
554
- role: "log",
555
- "aria-live": "polite",
556
- "aria-relevant": "additions text",
557
- "aria-busy": G.value,
558
- style: Ie({
559
- "--chatbot-main-color": e.mainColor,
560
- "--chatbot-contrast-color": Ke.value
561
- }),
562
- onScroll: nt
563
- }, [
564
- e.showScrollToBottom && W.value.length > 1 ? (I(), O("div", mt, [A(ke, {
565
- items: W.value,
566
- "active-id": Qe.value,
567
- onSelect: rt
568
- }, null, 8, ["items", "active-id"])])) : D("", !0),
569
- k("div", {
570
- ref_key: "wrapperEl",
571
- ref: F,
572
- class: "pk-chatbot-messages__wrapper"
573
- }, [
574
- (I(!0), O(C, null, Re(e.messages, (d, y) => (I(), O(C, { key: d.id }, [
575
- Mn(d) && Fn(y) ? (I(), O("div", ht, [k("span", gt, R(z(s)(Fn(y), "short")), 1)])) : D("", !0),
576
- $.value.quietRuns.has(d.id) ? (I(), O("div", _t, [A(u, {
577
- name: "ri:alarm-line",
578
- class: "shrink-0"
579
- }), k("span", null, R(z(i)("label.wakeupQuietRun", {
580
- count: $.value.quietRuns.get(d.id).count,
581
- time: z(s)($.value.quietRuns.get(d.id).lastAt ?? Date.now(), "time")
582
- }, $.value.quietRuns.get(d.id).count)), 1)])) : z(U)(d) && !$.value.hidden.has(d.id) && !e.showAllMessageParts ? (I(), O("div", {
583
- key: 2,
584
- class: "pk-chatbot-wakeup",
585
- title: d.metadata?.wakeup?.reason
586
- }, [A(u, {
587
- name: "ri:alarm-line",
588
- class: "shrink-0"
589
- }), k("span", null, [Ne(R(z(i)("label.wakeupCheck")) + " ", 1), d.metadata?.createdAt ? (I(), O(C, { key: 0 }, [Ne(" · " + R(z(s)(d.metadata.createdAt, "time")), 1)], 64)) : D("", !0)])], 8, vt)) : D("", !0),
590
- (!z(U)(d) || e.showAllMessageParts) && (!$.value.hidden.has(d.id) || G.value && Z(y)) && (d.parts.length || Z(y) && G.value && Q(d)) ? (I(), O("div", {
591
- key: 3,
592
- class: P(["pk-chatbot-message", [`pk-chatbot-message--${d.role}`, { "pk-chatbot-message--loading": G.value && Z(y) && Q(d) }]]),
593
- style: Ie({ minHeight: Z(y) && Q(d) && !pn.value ? `${K.value}px` : void 0 })
594
- }, [
595
- A(w, {
596
- appear: "",
597
- name: "pk-chatbot-part"
598
- }, {
599
- default: V(() => [wn(d) ? (I(), E(Oe, {
600
- key: 0,
601
- message: d,
602
- "is-streaming": G.value && Z(y),
603
- "has-content": jn(d),
604
- "hide-reasoning": e.hideReasoning,
605
- "is-dark": e.isDark
606
- }, null, 8, [
607
- "message",
608
- "is-streaming",
609
- "has-content",
610
- "hide-reasoning",
611
- "is-dark"
612
- ])) : D("", !0)]),
613
- _: 2
614
- }, 1024),
615
- (I(!0), O(C, null, Re(fn(d), (s, c) => (I(), O(C, { key: z(le)(s, c) }, [z(g)(s) && s.text.trim() ? (I(), E(w, {
616
- key: 0,
617
- appear: "",
618
- name: "pk-chatbot-part"
619
- }, {
620
- default: V(() => [k("div", yt, [ze(t.$slots, "text", Fe({ ref_for: !0 }, {
621
- message: d,
622
- part: s,
623
- index: y,
624
- isLoading: G.value
625
- }), () => [Q(d) ? (I(), E(p, {
626
- key: 0,
627
- class: "wysiwyg",
628
- markdown: s.text,
629
- "is-dark": e.isDark,
630
- loading: Z(y) && e.status === "streaming"
631
- }, null, 8, [
632
- "markdown",
633
- "is-dark",
634
- "loading"
635
- ])) : (I(), O(C, { key: 1 }, [Ne(R(s.text), 1)], 64))]), on(d.id) && !Y(d.id)?.comment && c === ln(d) ? (I(), O("span", {
636
- key: 0,
637
- class: P(["pk-chatbot-message__reaction", sn(d.id)]),
638
- title: cn(d.id)
639
- }, [an(d.id) ? (I(), O("span", xt, R(an(d.id)), 1)) : (I(), E(u, {
640
- key: 1,
641
- name: rn(d.id) === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-up-fill"
642
- }, null, 8, ["name"]))], 10, bt)) : D("", !0)])]),
643
- _: 2
644
- }, 1024)) : z(v)(s) ? (I(), E(w, {
645
- key: 1,
646
- appear: "",
647
- name: "pk-chatbot-part"
648
- }, {
649
- default: V(() => [z(a)(s.filename, s.mediaType) ? (I(), O("div", St, [A(Te, {
650
- "media-type": s.mediaType,
651
- url: s.url,
652
- filename: s.filename,
653
- size: z(te)(s)?.bytesCount
654
- }, null, 8, [
655
- "media-type",
656
- "url",
657
- "filename",
658
- "size"
659
- ]), A(ne, {
660
- url: s.url,
661
- transcript: z(_)(s),
662
- pending: e.status === "submitted" && Z(y)
663
- }, null, 8, [
664
- "url",
665
- "transcript",
666
- "pending"
667
- ])])) : (I(), E(Te, {
668
- key: 1,
669
- "media-type": s.mediaType,
670
- url: s.url,
671
- filename: s.filename,
672
- size: z(te)(s)?.bytesCount
673
- }, null, 8, [
674
- "media-type",
675
- "url",
676
- "filename",
677
- "size"
678
- ]))]),
679
- _: 2
680
- }, 1024)) : z(re)(s) && !z(fe)(s) ? (I(), E(w, {
681
- key: 2,
682
- appear: "",
683
- name: "pk-chatbot-part"
684
- }, {
685
- default: V(() => [(I(), E(it, {
686
- key: `approval-${c}`,
687
- part: s,
688
- actionable: e.interactive === !0 && (z(b)(s) || Z(y)),
689
- "call-verdict": e.confirmVerdictsOnCall?.get(s.toolCallId ?? ""),
690
- onRespond: (e) => j(s, e)
691
- }, null, 8, [
692
- "part",
693
- "actionable",
694
- "call-verdict",
695
- "onRespond"
696
- ]))]),
697
- _: 2
698
- }, 1024)) : Tn(s) ? (I(), E(w, {
699
- key: 3,
700
- appear: "",
701
- name: "pk-chatbot-part"
702
- }, {
703
- default: V(() => [A(lt, {
704
- question: e.hostConfirmation?.question ?? z(i)("toolApproval.hostCall", { name: z(x)(z(i), s) }),
705
- details: e.hostConfirmation?.details,
706
- unchanged: e.hostConfirmation?.unchanged,
707
- onRespond: n[0] ||= (e) => r("host-confirm-respond", e)
708
- }, null, 8, [
709
- "question",
710
- "details",
711
- "unchanged"
712
- ])]),
713
- _: 2
714
- }, 1024)) : On(d, y, s, c) ? (I(), E(w, {
715
- key: 4,
716
- appear: "",
717
- name: "pk-chatbot-part"
718
- }, {
719
- default: V(() => [k("div", Ct, [k("div", wt, [
720
- A(u, {
721
- name: Dn(y, s) ? "loading-loop" : z(ve)(s) ?? "ri:apps-line",
722
- class: "shrink-0"
723
- }, null, 8, ["name"]),
724
- k("span", Tt, R(z(x)(z(i), s, z(l))), 1),
725
- kn(y, s) ? (I(), O("span", Et, " · " + R(kn(y, s)), 1)) : D("", !0)
726
- ]), se(s)?.length ? (I(), E(f, {
727
- key: 0,
728
- title: z(i)("toolApproval.changesCount", se(s).length),
729
- modifiers: "compact",
730
- class: "pk-chatbot-message__host-changes"
731
- }, {
732
- default: V(() => [A(De, { changes: se(s) }, null, 8, ["changes"])]),
733
- _: 2
734
- }, 1032, ["title"])) : D("", !0)])]),
735
- _: 2
736
- }, 1024)) : An(s) ? (I(), E(w, {
737
- key: 5,
738
- appear: "",
739
- name: "pk-chatbot-part"
740
- }, {
741
- default: V(() => [!z(ge)[s.type] && z($e)[z(h)(s)] ? (I(), E(Be(z($e)[z(h)(s)]), Fe({
742
- key: `component-${c}-${z(be)(s)}`,
743
- part: s
744
- }, { ref_for: !0 }, en(s)), null, 16, ["part"])) : ze(t.$slots, s.type, Fe({ ref_for: !0 }, {
745
- message: d,
746
- part: s,
747
- index: y,
748
- isLoading: G.value
749
- }), () => [e.showAllMessageParts ? (I(), O("div", Dt, [k("div", Ot, [z(ve)(s) ? (I(), E(u, {
750
- key: 0,
751
- name: z(ve)(s),
752
- class: "shrink-0"
753
- }, null, 8, ["name"])) : D("", !0), k("span", kt, R(z(ce)(s, {
754
- t: z(i),
755
- te: z(o)
756
- })), 1)])])) : D("", !0)], void 0, 1)]),
757
- _: 2
758
- }, 1024)) : D("", !0), A(w, { mode: "out-in" }, {
759
- default: V(() => [c === ln(d) && e.readonlyFeedback && Y(d.id)?.comment ? (I(), E(we, {
760
- key: 0,
761
- feedback: Y(d.id)
762
- }, null, 8, ["feedback"])) : D("", !0)]),
763
- _: 2
764
- }, 1024)], 64))), 128)),
765
- Mn(d) && d.metadata?.pagePointer ? (I(), O("div", {
766
- key: 0,
767
- class: "pk-chatbot-message__pointer",
768
- title: d.metadata.pagePointer.kind === "text" ? z(i)("pagePointer.selected") : z(i)("pagePointer.pointed")
769
- }, [A(u, {
770
- name: d.metadata.pagePointer.kind === "text" ? "ri:double-quotes-l" : "ri:focus-3-line",
771
- class: "pk-chatbot-message__pointer-icon"
772
- }, null, 8, ["name"]), k("span", jt, R(d.metadata.pagePointer.kind === "text" ? `«${d.metadata.pagePointer.label}»` : d.metadata.pagePointer.label), 1)], 8, At)) : Mn(d) && d.metadata?.filePointer ? (I(), O("div", {
773
- key: 1,
774
- class: "pk-chatbot-message__pointer",
775
- title: z(i)("selectionActions.selectedInFile")
776
- }, [A(u, {
777
- name: d.metadata.filePointer.format === "docx" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
778
- class: "pk-chatbot-message__pointer-icon"
779
- }, null, 8, ["name"]), k("span", Nt, R(d.metadata.filePointer.label), 1)], 8, Mt)) : D("", !0),
780
- A(w, {
781
- name: "fade-in",
782
- mode: "out-in"
783
- }, {
784
- default: V(() => [G.value && Z(y) && !Sn(d) && !e.hostConfirmation && Q(d) && (!wn(d) || jn(d)) ? (I(), O("div", {
785
- key: `loading-info-${d.id}`,
786
- class: "pk-chatbot-message__loading-info"
787
- }, [k("div", Pt, [
788
- A(u, {
789
- name: "loading-loop",
790
- class: "shrink-0"
791
- }),
792
- A(w, { mode: "out-in" }, {
793
- default: V(() => [vn.value ? (I(), E(u, {
794
- key: vn.value,
795
- class: "shrink-0",
796
- name: vn.value
797
- }, null, 8, ["name"])) : D("", !0)]),
798
- _: 1
799
- }),
800
- A(w, { mode: "out-in" }, {
801
- default: V(() => [_n.value ? (I(), O("span", {
802
- key: _n.value,
803
- class: "text-12"
804
- }, R(_n.value), 1)) : D("", !0)]),
805
- _: 1
806
- })
807
- ]), A(w, {
808
- name: "fade-in",
809
- mode: "out-in"
810
- }, {
811
- default: V(() => [!e.hideReasoning && !wn(d) && X.value && "text" in X.value && X.value.text.trim() ? (I(), E(Ee, {
812
- key: 0,
813
- markdown: X.value.text,
814
- "is-dark": e.isDark,
815
- "tail-length": z(de),
816
- "inner-class": "wysiwyg",
817
- class: "border border-surface-3 rounded-md p-4 mt-8 bg-surface-1 max-h-64 text-12 w-full"
818
- }, null, 8, [
819
- "markdown",
820
- "is-dark",
821
- "tail-length"
822
- ])) : D("", !0)]),
823
- _: 2
824
- }, 1024)])) : D("", !0)]),
825
- _: 2
826
- }, 1024),
827
- A(w, { mode: "out-in" }, {
828
- default: V(() => [Ln(d, y) ? (I(), O("div", Ft, [
829
- A(ee, {
830
- modifiers: "compact",
831
- class: "mr-auto shrink-0"
832
- }, {
833
- default: V(() => [
834
- A(w, { mode: "out-in" }, {
835
- default: V(() => [bn(y) ? (I(), E(m, {
836
- key: 0,
837
- icon: "ri:reset-right-line",
838
- modifiers: "action-quiet-small",
839
- title: z(i)("action.regenerate"),
840
- "aria-label": z(i)("action.regenerate"),
841
- onClick: n[1] ||= H((e) => t.$emit("regenerate"), ["stop"])
842
- }, null, 8, ["title", "aria-label"])) : D("", !0)]),
843
- _: 2
844
- }, 1024),
845
- A(w, { mode: "out-in" }, {
846
- default: V(() => [xn("show-info", y) ? (I(), E(m, {
847
- key: 0,
848
- icon: "ri:information-line",
849
- title: z(i)("action.getMoreInfo"),
850
- "aria-label": z(i)("action.getMoreInfo"),
851
- modifiers: "action-quiet-small",
852
- onClick: H((e) => t.$emit("show-info", d), ["stop"])
853
- }, null, 8, [
854
- "title",
855
- "aria-label",
856
- "onClick"
857
- ])) : D("", !0)]),
858
- _: 2
859
- }, 1024),
860
- A(w, { mode: "out-in" }, {
861
- default: V(() => [xn("revise", y) ? (I(), E(m, {
862
- key: 0,
863
- icon: ut(d.id) ? "ri:file-edit-fill" : "ri:file-edit-line",
864
- title: ut(d.id) ? z(i)("action.editRevise") : z(i)("action.createRevise"),
865
- "aria-label": ut(d.id) ? z(i)("action.editRevise") : z(i)("action.createRevise"),
866
- modifiers: "action-quiet-small",
867
- class: P({ "text-brand-graphic": ut(d.id) }),
868
- onClick: H((e) => t.$emit("revise", d), ["stop"])
869
- }, null, 8, [
870
- "icon",
871
- "title",
872
- "aria-label",
873
- "class",
874
- "onClick"
875
- ])) : D("", !0)]),
876
- _: 2
877
- }, 1024),
878
- A(w, { mode: "out-in" }, {
879
- default: V(() => [tn("upvote", y) ? (I(), E(m, {
880
- key: 0,
881
- icon: Y(d.id)?.vote === "upvote" ? "ri:thumb-up-fill" : "ri:thumb-up-line",
882
- title: z(i)("action.upvote"),
883
- "aria-label": z(i)("action.upvote"),
884
- modifiers: "action-quiet-small",
885
- onClick: H((e) => t.$emit("upvote", d), ["stop"])
886
- }, null, 8, [
887
- "icon",
888
- "title",
889
- "aria-label",
890
- "onClick"
891
- ])) : D("", !0)]),
892
- _: 2
893
- }, 1024),
894
- A(w, { mode: "out-in" }, {
895
- default: V(() => [tn("downvote", y) ? (I(), E(m, {
896
- key: 0,
897
- icon: Y(d.id)?.vote === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-down-line",
898
- title: z(i)("action.downvote"),
899
- "aria-label": z(i)("action.downvote"),
900
- modifiers: "action-quiet-small",
901
- onClick: H((e) => t.$emit("downvote", d), ["stop"])
902
- }, null, 8, [
903
- "icon",
904
- "title",
905
- "aria-label",
906
- "onClick"
907
- ])) : D("", !0)]),
908
- _: 2
909
- }, 1024),
910
- A(w, { mode: "out-in" }, {
911
- default: V(() => [tn("feedback", y) ? (I(), E(m, {
912
- key: 0,
913
- icon: Y(d.id)?.comment ? "ri:feedback-fill" : "ri:feedback-line",
914
- title: z(i)("action.feedback"),
915
- "aria-label": z(i)("action.feedback"),
916
- modifiers: "action-quiet-small",
917
- onClick: H((e) => t.$emit("feedback", d), ["stop"])
918
- }, null, 8, [
919
- "icon",
920
- "title",
921
- "aria-label",
922
- "onClick"
923
- ])) : D("", !0)]),
924
- _: 2
925
- }, 1024)
926
- ]),
927
- _: 2
928
- }, 1024),
929
- !e.showMessageDateTime && d.metadata?.createdAt && d.metadata?.completedAt ? (I(), O("div", It, [k("time", {
930
- datetime: new Date(d.metadata.createdAt).toISOString(),
931
- title: z(s)(new Date(d.metadata.createdAt), "date-time"),
932
- class: "flex items-center gap-4 min-w-0"
933
- }, [A(u, {
934
- name: "ri:time-line",
935
- class: "shrink-0"
936
- }), k("span", Rt, R(Rn(d.metadata.createdAt)), 1)], 8, Lt), zn(d) ? (I(), O("span", zt, [A(u, {
937
- name: "ri:hourglass-line",
938
- class: "shrink-0"
939
- }), k("span", Bt, R(zn(d)), 1)])) : D("", !0)])) : D("", !0),
940
- e.showMessageNumber ? (I(), O("span", {
941
- key: 1,
942
- title: z(i)("label.messageNumber", { n: In.value[y] }),
943
- class: "text-12 text-word-3 tabular-nums"
944
- }, " #" + R(In.value[y]), 9, Vt)) : D("", !0),
945
- e.showMessageTokensCount && d.metadata?.totalTokens ? (I(), O("span", Ht, [A(u, {
946
- name: "ri:ai-generate-2-line",
947
- class: "shrink-0"
948
- }), k("span", Ut, R(z(c)(d.metadata.totalTokens, "integer")) + " " + R(z(i)("label.tokens")), 1)])) : D("", !0),
949
- e.showMessageDateTime && d.metadata?.createdAt ? (I(), O("time", {
950
- key: 3,
951
- datetime: new Date(d.metadata?.createdAt).toISOString(),
952
- class: "flex items-center gap-4 text-12 text-word-3"
953
- }, [A(u, {
954
- name: "ri:time-line",
955
- class: "shrink-0"
956
- }), k("span", Gt, R(z(s)(new Date(d.metadata?.createdAt), "date-time")), 1)], 8, Wt)) : D("", !0),
957
- e.showMessageDateTime && d?.metadata?.completedAt && d?.metadata?.createdAt ? (I(), O("div", Kt, [A(u, {
958
- name: "ri:hourglass-line",
959
- class: "shrink-0"
960
- }), A(Se, {
961
- class: "truncate",
962
- date: d.metadata?.createdAt,
963
- "end-date": d.metadata?.completedAt
964
- }, null, 8, ["date", "end-date"])])) : D("", !0)
965
- ])) : D("", !0)]),
966
- _: 2
967
- }, 1024),
968
- A(w, { mode: "out-in" }, {
969
- default: V(() => [d.id === e.feedbackMessageId ? (I(), E(Ce, {
970
- key: 0,
971
- ref_for: !0,
972
- ref_key: "feedbackMessageEl",
973
- ref: Bn,
974
- loading: e.feedbackLoading,
975
- submitted: e.feedbackSubmitted,
976
- error: e.feedbackError,
977
- onSubmit: n[2] ||= (e) => t.$emit("feedback-submit", e),
978
- onClose: n[3] ||= (e) => t.$emit("feedback-close")
979
- }, null, 8, [
980
- "loading",
981
- "submitted",
982
- "error"
983
- ])) : D("", !0)]),
984
- _: 2
985
- }, 1024)
986
- ], 6)) : D("", !0)
987
- ], 64))), 128)),
988
- A(w, {
989
- appear: "",
990
- name: "pk-chatbot-part",
991
- onLeave: gn
992
- }, {
993
- default: V(() => [mn.value ? (I(), O("div", {
994
- key: 0,
995
- class: "pk-chatbot-message pk-chatbot-message--assistant pk-chatbot-message--loading",
996
- style: Ie({ minHeight: hn.value ? `${K.value}px` : void 0 })
997
- }, [k("div", qt, [k("div", Jt, [A(u, {
998
- name: "loading-loop",
999
- class: "shrink-0"
1000
- }), k("span", Yt, R(z(i)("label.answeringOnTheCall")), 1)])])], 4)) : D("", !0)]),
1001
- _: 1
1002
- }),
1003
- A(w, {
1004
- appear: "",
1005
- name: "pk-chatbot-part"
1006
- }, {
1007
- default: V(() => [En.value ? (I(), O("div", Xt, [A(lt, {
1008
- question: e.hostConfirmation?.question ?? z(i)("toolApproval.prompt"),
1009
- details: e.hostConfirmation?.details,
1010
- unchanged: e.hostConfirmation?.unchanged,
1011
- onRespond: n[4] ||= (e) => r("host-confirm-respond", e)
1012
- }, null, 8, [
1013
- "question",
1014
- "details",
1015
- "unchanged"
1016
- ])])) : D("", !0)]),
1017
- _: 1
1018
- }),
1019
- A(w, {
1020
- appear: "",
1021
- name: "pk-chatbot-part"
1022
- }, {
1023
- default: V(() => [pn.value ? (I(), E(xe, {
1024
- key: 0,
1025
- error: e.error,
1026
- onRetry: n[5] ||= (e) => t.$emit("auto-retry"),
1027
- onReset: n[6] ||= (e) => t.$emit("reset-chat")
1028
- }, null, 8, ["error"])) : D("", !0)]),
1029
- _: 1
1030
- }),
1031
- un.value?.role === "user" && !hn.value || pn.value ? (I(), O("div", {
1032
- key: 0,
1033
- class: "pk-chatbot-messages__spacer",
1034
- style: Ie({ minHeight: `${K.value}px` })
1035
- }, null, 4)) : D("", !0)
1036
- ], 512),
1037
- A(w, { name: "pk-chatbot-messages-fab" }, {
1038
- default: V(() => [e.showScrollToBottom && (z(Ye) || !z(Xe)) ? (I(), O("button", {
1039
- key: 0,
1040
- type: "button",
1041
- class: "pk-chatbot-messages__scroll-to-bottom",
1042
- title: z(i)("action.scrollToBottom"),
1043
- "aria-label": z(i)("action.scrollToBottom"),
1044
- onClick: Ze
1045
- }, [A(u, { name: "ri:arrow-down-line" })], 8, Zt)) : D("", !0)]),
1046
- _: 1
1047
- })
1048
- ], 46, pt);
1049
- };
1050
- }
1051
- });
1052
- export { Qt as t };
1053
-
1054
- //# sourceMappingURL=PkChatbotMessages-CZu8feEz.js.map