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