@8wave/ai-elements 0.126.0-beta.20 → 0.126.0-beta.22

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 (118) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-DHcHcy4x.js → PkChatbotFilePreview-jN3SAlut.js} +2 -2
  2. package/dist/_chunks/{PkChatbotFilePreview-DHcHcy4x.js.map → PkChatbotFilePreview-jN3SAlut.js.map} +1 -1
  3. package/dist/_chunks/{PkStreamingMarkdown-0lzE-l9f.js → PkStreamingMarkdown-qoTgaVHP.js} +2 -2
  4. package/dist/_chunks/{PkStreamingMarkdown-0lzE-l9f.js.map → PkStreamingMarkdown-qoTgaVHP.js.map} +1 -1
  5. package/dist/_chunks/{PkToolChatFile-x50rORrq.js → PkToolChatFile-uAyCds1k.js} +2 -2
  6. package/dist/_chunks/{PkToolChatFile-x50rORrq.js.map → PkToolChatFile-uAyCds1k.js.map} +1 -1
  7. package/dist/_chunks/{PkToolShareDocument-Cv7uBr5Z.js → PkToolShareDocument-NUMXFQ2e.js} +2 -2
  8. package/dist/_chunks/{PkToolShareDocument-Cv7uBr5Z.js.map → PkToolShareDocument-NUMXFQ2e.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-DMIADTQ6.js → PkToolShowArtifact-D1p76r2a.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-DMIADTQ6.js.map → PkToolShowArtifact-D1p76r2a.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-B5DCcFqt.js → PkToolShowContactForm-B4S4qtxp.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-B5DCcFqt.js.map → PkToolShowContactForm-B4S4qtxp.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowDiagram-DEFJr7zY.js → PkToolShowDiagram-CauQT97Z.js} +2 -2
  14. package/dist/_chunks/{PkToolShowDiagram-DEFJr7zY.js.map → PkToolShowDiagram-CauQT97Z.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowForm-BBxcDLyR.js → PkToolShowForm-1sJBr8KY.js} +2 -2
  16. package/dist/_chunks/{PkToolShowForm-BBxcDLyR.js.map → PkToolShowForm-1sJBr8KY.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowImageGallery-BYvCAUFX.js → PkToolShowImageGallery-DFhYCp-v.js} +2 -2
  18. package/dist/_chunks/{PkToolShowImageGallery-BYvCAUFX.js.map → PkToolShowImageGallery-DFhYCp-v.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowSources-DxZoqWZd.js → PkToolShowSources-DFHejVc0.js} +2 -2
  20. package/dist/_chunks/{PkToolShowSources-DxZoqWZd.js.map → PkToolShowSources-DFHejVc0.js.map} +1 -1
  21. package/dist/_chunks/{useLightbox-BlHExsUm.js → useLightbox-CUT_xmuZ.js} +100 -95
  22. package/dist/_chunks/useLightbox-CUT_xmuZ.js.map +1 -0
  23. package/dist/ai-elements.es.js +2316 -2153
  24. package/dist/ai-elements.es.js.map +1 -1
  25. package/dist-vue/PkChatbot.js +1 -1
  26. package/dist-vue/PkChatbotEmptyState.js +1 -1
  27. package/dist-vue/PkChatbotFilePreview.js +1 -1
  28. package/dist-vue/PkChatbotInput.js +1 -1
  29. package/dist-vue/PkChatbotMessages.js +1 -1
  30. package/dist-vue/PkChatbotSteps.js +1 -1
  31. package/dist-vue/PkChatbotViewChat.js +1 -1
  32. package/dist-vue/PkChatbotViewConversations.js +1 -1
  33. package/dist-vue/PkChatbotViewFiles.js +1 -1
  34. package/dist-vue/PkChatbotViewProfile.js +1 -1
  35. package/dist-vue/_chunks/{PkChatbot-CxphD_YU.js → PkChatbot-VJorpNbU.js} +7 -7
  36. package/dist-vue/_chunks/{PkChatbot-CxphD_YU.js.map → PkChatbot-VJorpNbU.js.map} +1 -1
  37. package/dist-vue/_chunks/{PkChatbotEmptyState-Jxc1HNJ5.js → PkChatbotEmptyState-B9dYpXZm.js} +2 -2
  38. package/dist-vue/_chunks/{PkChatbotEmptyState-Jxc1HNJ5.js.map → PkChatbotEmptyState-B9dYpXZm.js.map} +1 -1
  39. package/dist-vue/_chunks/{PkChatbotFilePreview-BDU2vY0F.js → PkChatbotFilePreview-5_bih_vc.js} +2 -2
  40. package/dist-vue/_chunks/{PkChatbotFilePreview-BDU2vY0F.js.map → PkChatbotFilePreview-5_bih_vc.js.map} +1 -1
  41. package/dist-vue/_chunks/{PkChatbotInput-DSdGtBTs.js → PkChatbotInput-BLKhf3WD.js} +3 -3
  42. package/dist-vue/_chunks/{PkChatbotInput-DSdGtBTs.js.map → PkChatbotInput-BLKhf3WD.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotMessages-C7WSS6sd.js → PkChatbotMessages-Dx_IIX0J.js} +17 -17
  44. package/dist-vue/_chunks/{PkChatbotMessages-C7WSS6sd.js.map → PkChatbotMessages-Dx_IIX0J.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkChatbotSteps-BMWrHfC9.js → PkChatbotSteps-BAQ1LriG.js} +2 -2
  46. package/dist-vue/_chunks/{PkChatbotSteps-BMWrHfC9.js.map → PkChatbotSteps-BAQ1LriG.js.map} +1 -1
  47. package/dist-vue/_chunks/PkChatbotViewChat-1RqLcPl4.js +1336 -0
  48. package/dist-vue/_chunks/PkChatbotViewChat-1RqLcPl4.js.map +1 -0
  49. package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js → PkChatbotViewConversations-D0vDYTyo.js} +2 -2
  50. package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js.map → PkChatbotViewConversations-D0vDYTyo.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js → PkChatbotViewFiles-Bj5Nkzst.js} +2 -2
  52. package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js.map → PkChatbotViewFiles-Bj5Nkzst.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js → PkChatbotViewProfile-GW0WuMOy.js} +2 -2
  54. package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js.map → PkChatbotViewProfile-GW0WuMOy.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js → PkFilePreview-Dkm34tMI.js} +2 -2
  56. package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js.map → PkFilePreview-Dkm34tMI.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js → PkFilePreviewDialog-CZg7uqHL.js} +2 -2
  58. package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js.map → PkFilePreviewDialog-CZg7uqHL.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkStreamingMarkdown-BFBv_HdF.js → PkStreamingMarkdown-D6Qxwf47.js} +2 -2
  60. package/dist-vue/_chunks/{PkStreamingMarkdown-BFBv_HdF.js.map → PkStreamingMarkdown-D6Qxwf47.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkSvgViewer-CRNwb6Yn.js → PkSvgViewer-jCi13HSd.js} +2 -2
  62. package/dist-vue/_chunks/{PkSvgViewer-CRNwb6Yn.js.map → PkSvgViewer-jCi13HSd.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkToolChatFile-BntAINfN.js → PkToolChatFile-uO6r1l6t.js} +2 -2
  64. package/dist-vue/_chunks/{PkToolChatFile-BntAINfN.js.map → PkToolChatFile-uO6r1l6t.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkToolShareDocument-Bf7OE8XA.js → PkToolShareDocument-B7mMJJfn.js} +2 -2
  66. package/dist-vue/_chunks/{PkToolShareDocument-Bf7OE8XA.js.map → PkToolShareDocument-B7mMJJfn.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkToolShowArtifact-PTyAPKlR.js → PkToolShowArtifact-VOfSN9nc.js} +2 -2
  68. package/dist-vue/_chunks/{PkToolShowArtifact-PTyAPKlR.js.map → PkToolShowArtifact-VOfSN9nc.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkToolShowContactForm-CGIA743D.js → PkToolShowContactForm-D9J0B3C-.js} +2 -2
  70. package/dist-vue/_chunks/{PkToolShowContactForm-CGIA743D.js.map → PkToolShowContactForm-D9J0B3C-.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkToolShowDiagram-CppjE7Vr.js → PkToolShowDiagram-BlV7ktLW.js} +2 -2
  72. package/dist-vue/_chunks/{PkToolShowDiagram-CppjE7Vr.js.map → PkToolShowDiagram-BlV7ktLW.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolShowForm-DLlcs1c4.js → PkToolShowForm-BCvqIlt_.js} +2 -2
  74. package/dist-vue/_chunks/{PkToolShowForm-DLlcs1c4.js.map → PkToolShowForm-BCvqIlt_.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolShowImageGallery-KP_ptp0w.js → PkToolShowImageGallery-D2DrAB9v.js} +3 -3
  76. package/dist-vue/_chunks/{PkToolShowImageGallery-KP_ptp0w.js.map → PkToolShowImageGallery-D2DrAB9v.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowLocation-Nhh_LwmN.js → PkToolShowLocation-BhVcLnkV.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowLocation-Nhh_LwmN.js.map → PkToolShowLocation-BhVcLnkV.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolShowProductList-CbI-ncWs.js → PkToolShowProductList--MBQ_ztM.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolShowProductList-CbI-ncWs.js.map → PkToolShowProductList--MBQ_ztM.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolShowSources-E02Gy3vC.js → PkToolShowSources-D_KfNZ_Q.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowSources-E02Gy3vC.js.map → PkToolShowSources-D_KfNZ_Q.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js → PkToolShowVideo-CS6iDwjn.js} +2 -2
  84. package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js.map → PkToolShowVideo-CS6iDwjn.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js → PkToolShowWebPages-y3sajjCP.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js.map → PkToolShowWebPages-y3sajjCP.js.map} +1 -1
  87. package/dist-vue/_chunks/{createChatbotApiClient-BACnmIzY.js → createChatbotApiClient-Pb7_cU2s.js} +105 -75
  88. package/dist-vue/_chunks/createChatbotApiClient-Pb7_cU2s.js.map +1 -0
  89. package/dist-vue/_chunks/{useChatbotStore-B-WenuyB.js → useChatbotStore-ChrZVIDt.js} +1172 -1141
  90. package/dist-vue/_chunks/useChatbotStore-ChrZVIDt.js.map +1 -0
  91. package/dist-vue/_chunks/{useLightbox-DmtNa8bJ.js → useLightbox-BZN3tRGu.js} +100 -95
  92. package/dist-vue/_chunks/useLightbox-BZN3tRGu.js.map +1 -0
  93. package/dist-vue/api.js +1 -1
  94. package/dist-vue/composables.js +76 -2
  95. package/dist-vue/composables.js.map +1 -1
  96. package/dist-vue/index.js +4304 -3590
  97. package/dist-vue/index.js.map +1 -1
  98. package/dist-vue/locales.js +78 -2
  99. package/dist-vue/packages/components/src/PkSchemaField.d.ts +2 -2
  100. package/dist-vue/packages/components/src/chat/PkChatProjectDialog.d.ts +50 -0
  101. package/dist-vue/packages/components/src/chat/PkChatProjectMoveDialog.d.ts +23 -0
  102. package/dist-vue/packages/components/src/chat/PkChatSidebar.d.ts +5 -2
  103. package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +12 -0
  104. package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +9 -3
  105. package/dist-vue/packages/components/src/chat/PkChatbotFeedbackForm.d.ts +2 -2
  106. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +20 -1
  107. package/dist-vue/packages/composable/src/chatbot/index.d.ts +1 -0
  108. package/dist-vue/packages/composable/src/chatbot/useChatProjectsStore.d.ts +4005 -0
  109. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +36 -6
  110. package/dist-vue/packages/models/src/schema/ChatProject.d.ts +10 -0
  111. package/dist-vue/style.css +1 -1
  112. package/package.json +1 -1
  113. package/dist/_chunks/useLightbox-BlHExsUm.js.map +0 -1
  114. package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js +0 -1307
  115. package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js.map +0 -1
  116. package/dist-vue/_chunks/createChatbotApiClient-BACnmIzY.js.map +0 -1
  117. package/dist-vue/_chunks/useChatbotStore-B-WenuyB.js.map +0 -1
  118. package/dist-vue/_chunks/useLightbox-DmtNa8bJ.js.map +0 -1
@@ -0,0 +1,1336 @@
1
+ import { t as e } from "./VvButtonLocalized-C-vx25u4.js";
2
+ import { a as t, n, t as r } from "./useChatbotStore-ChrZVIDt.js";
3
+ import { B as i, b as a, n as o, p as s, r as c, u as l } from "./utils-Bdk5kFfi.js";
4
+ import { t as u } from "./PkAvatar-DwtZWSW4.js";
5
+ import { t as d } from "./PkChatbotMessages-Dx_IIX0J.js";
6
+ import { n as f, t as p } from "./PkChatbotInput-BLKhf3WD.js";
7
+ import { t as m } from "./PkChatbotQueuedMessages-CIJFAvE2.js";
8
+ import { s as h, t as g } from "./message-DuibQyHy.js";
9
+ import { t as ee } from "./PkChatbotEmptyState-B9dYpXZm.js";
10
+ import { t as _ } from "./PkChatbotWakeupBar-DOCJYxzV.js";
11
+ import { n as v } from "./src-nb8MU1sh.js";
12
+ import { t as y } from "./useLightbox-BZN3tRGu.js";
13
+ import { t as te } from "./useLocalizedString-Dmn92nix.js";
14
+ import { o as ne } from "./Media-0U2B_qCS.js";
15
+ import { VvIcon as b } from "@volverjs/ui-vue/components";
16
+ import { Fragment as x, Teleport as re, Transition as S, computed as C, createBlock as w, createCommentVNode as T, createElementBlock as E, createElementVNode as D, createSlots as ie, createTextVNode as ae, createVNode as O, defineAsyncComponent as k, defineComponent as oe, inject as se, isRef as ce, nextTick as le, normalizeClass as ue, normalizeStyle as de, onBeforeUnmount as fe, onMounted as pe, onScopeDispose as me, onUnmounted as he, openBlock as A, provide as ge, ref as j, renderList as _e, shallowRef as ve, toDisplayString as M, toValue as ye, unref as N, useTemplateRef as be, watch as P, withCtx as F } from "vue";
17
+ import { useI18n as xe } from "vue-i18n";
18
+ import { useDropZone as Se, useResizeObserver as Ce } from "@vueuse/core";
19
+ import { storeToRefs as we } from "pinia";
20
+ // ../../packages/composable/src/chatbot/useGreeting.ts
21
+ function Te(e, t) {
22
+ let { locale: n, t: r, te: i } = xe({ useScope: "global" });
23
+ return C(() => I(ye(e)?.greeting?.[0]?.[n.value] ?? "", ye(t)) || (i("message.defaultAgentWelcome") ? r("message.defaultAgentWelcome") : ""));
24
+ }
25
+ function I(e, t) {
26
+ return (t ? e.replace(/\{name\}/g, t) : e.replace(/[,\s]*\{name\}[!?]?/g, "")).trim();
27
+ }
28
+ // ../../packages/components/src/chat/PkAuroraCanvas.vue?vue&type=script&setup=true&lang.ts
29
+ var Ee = {
30
+ key: 1,
31
+ class: "pk-aurora__fallback"
32
+ }, L = "\nattribute vec2 a_position;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n}", R = "\nprecision mediump float;\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_color;\nuniform vec3 u_color2;\nuniform float u_duo;\nuniform vec2 u_center;\nuniform vec2 u_half;\nuniform float u_spread;\n\nvec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nvoid main() {\n vec2 px = gl_FragCoord.xy;\n vec2 rel = px - u_center;\n\n // Ignition: the ellipse lights up expanding from the center on mount\n float intro = smoothstep(0.0, 1.4, u_time);\n\n // Breathing: size and brightness oscillate gently but visibly\n float breath = 1.0\n + 0.12 * sin(u_time * 0.55)\n + 0.06 * snoise(vec2(u_time * 0.1, 3.7));\n float pulse = 1.0 + 0.2 * sin(u_time * 0.55 + 1.3);\n\n // Keep it simple (Gemini-style): one huge soft elliptical glow\n // centered on the pill. Its height follows the pill's, but each half\n // ends inside the canvas: at most the room to that edge over 1.75, so\n // at the widest breath (1.24) the glow there is about 1% of its peak,\n // under one 8-bit step, and the edge fade below finds nothing to cut.\n // Uncapped, a taller pill (a second line, an attachment) or a short\n // canvas left a quarter of the glow or more at the edge, cut straight.\n vec2 radii = vec2(u_half.x * 0.95, u_half.y * 6.5) * u_spread;\n float room = rel.y > 0.0 ? u_resolution.y - u_center.y : u_center.y;\n radii.y = min(radii.y, room / 1.75);\n radii *= breath * mix(0.15, 1.0, intro);\n float r = length(rel / max(radii, vec2(1.0)));\n float glow = exp(-r * r * 2.2);\n\n // Never cut hard against the canvas bounds\n vec2 m = min(px, u_resolution - px);\n glow *= smoothstep(0.0, 32.0, min(m.x, m.y));\n\n // Dither: breaks the 8-bit banding rings of the very soft gradient\n // (no CSS blur on the canvas, the noise must fully mask the bands)\n glow = max(glow + (snoise(px * 0.9) - 0.5) * 0.03, 0.0);\n\n float alpha = glow * 0.2 * pulse * intro;\n\n // Two tones: left to right the glow passes from the first to the\n // second, along a border a slow noise field keeps bending\n vec2 q = rel / max(radii, vec2(1.0));\n float bands = q.x * 0.9\n + 0.7 * snoise(q * 0.8 + vec2(u_time * 0.07, -u_time * 0.05));\n vec3 color = mix(u_color, u_color2, u_duo * smoothstep(-0.6, 0.6, bands));\n\n // Premultiplied alpha (default canvas compositing)\n gl_FragColor = vec4(color * alpha, alpha);\n}", De = /* @__PURE__ */ oe({
33
+ __name: "PkAuroraCanvas",
34
+ props: {
35
+ sourceSelector: {},
36
+ mainColor: {},
37
+ tones: {},
38
+ secondColor: {}
39
+ },
40
+ setup(e) {
41
+ let t = e, n = be("rootEl"), r = be("canvasEl"), a = j(!1), o = j(null), s = C(() => o.value ? {
42
+ "--pk-aurora-tint": `rgb(${o.value.first.join(" ")})`,
43
+ "--pk-aurora-tint-2": `rgb(${(o.value.duo ? o.value.second : o.value.first).join(" ")})`
44
+ } : void 0), c = null, l = 0, u = null, d = null, f = null, p = null, m = null, h = null, g = null, ee = null, _ = null, v = performance.now(), y = (e, t) => {
45
+ if (!c) return null;
46
+ let n = c.createShader(e);
47
+ return !n || (c.shaderSource(n, t), c.compileShader(n), !c.getShaderParameter(n, c.COMPILE_STATUS)) ? null : n;
48
+ }, te = (e) => e.map((e) => e / 255), ne = () => {
49
+ n.value && (o.value = i(n.value, {
50
+ mainColor: t.mainColor,
51
+ tones: t.tones,
52
+ secondColor: t.secondColor
53
+ }), c && !a.value && o.value && (c.uniform3f(g, ...te(o.value.first)), c.uniform3f(ee, ...te(o.value.second)), c.uniform1f(_, +!!o.value.duo), re(x() ? 10 : void 0)));
54
+ };
55
+ P([
56
+ () => t.mainColor,
57
+ () => t.tones,
58
+ () => t.secondColor
59
+ ], ne);
60
+ let b = () => {
61
+ if (!c || !r.value) return;
62
+ let e = Math.min(window.devicePixelRatio || 1, 1.5), { clientWidth: n, clientHeight: i } = r.value;
63
+ r.value.width = Math.max(1, Math.round(n * e)), r.value.height = Math.max(1, Math.round(i * e)), c.viewport(0, 0, r.value.width, r.value.height);
64
+ let a = r.value.parentElement?.offsetParent, o = (t.sourceSelector ? a?.querySelector(t.sourceSelector) : a) ?? a, s = r.value.getBoundingClientRect(), l = o?.getBoundingClientRect();
65
+ if (l && s.width > 0) {
66
+ let e = r.value.width / s.width, t = r.value.height / s.height, n = (l.left + l.width / 2 - s.left) * e, i = (s.bottom - (l.top + l.height / 2)) * t, a = l.width / 2 * e, o = l.height / 2 * t;
67
+ c.uniform2f(p, n, i), c.uniform2f(m, a, o);
68
+ let u = Number.parseFloat(getComputedStyle(r.value).getPropertyValue("--aurora-spread"));
69
+ c.uniform1f(h, Number.isNaN(u) ? 1 : u);
70
+ }
71
+ re(x() ? 10 : void 0);
72
+ }, x = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, re = (e) => {
73
+ c && r.value && (c.uniform1f(d, e ?? (performance.now() - v) / 1e3), c.uniform2f(f, r.value.width, r.value.height), c.drawArrays(c.TRIANGLE_STRIP, 0, 4));
74
+ }, S = () => {
75
+ re(), l = requestAnimationFrame(S);
76
+ };
77
+ return pe(() => {
78
+ let e = r.value;
79
+ if (ne(), c = e?.getContext("webgl", { alpha: !0 }) ?? null, !e || !c || !o.value) {
80
+ a.value = !0;
81
+ return;
82
+ }
83
+ let t = y(c.VERTEX_SHADER, L), n = y(c.FRAGMENT_SHADER, R), i = c.createProgram();
84
+ if (!t || !n || !i || (c.attachShader(i, t), c.attachShader(i, n), c.linkProgram(i), !c.getProgramParameter(i, c.LINK_STATUS))) {
85
+ a.value = !0;
86
+ return;
87
+ }
88
+ c.useProgram(i);
89
+ let s = c.createBuffer();
90
+ c.bindBuffer(c.ARRAY_BUFFER, s), c.bufferData(c.ARRAY_BUFFER, new Float32Array([
91
+ -1,
92
+ -1,
93
+ 1,
94
+ -1,
95
+ -1,
96
+ 1,
97
+ 1,
98
+ 1
99
+ ]), c.STATIC_DRAW);
100
+ let l = c.getAttribLocation(i, "a_position");
101
+ c.enableVertexAttribArray(l), c.vertexAttribPointer(l, 2, c.FLOAT, !1, 0, 0), d = c.getUniformLocation(i, "u_time"), f = c.getUniformLocation(i, "u_resolution"), p = c.getUniformLocation(i, "u_center"), m = c.getUniformLocation(i, "u_half"), h = c.getUniformLocation(i, "u_spread"), g = c.getUniformLocation(i, "u_color"), ee = c.getUniformLocation(i, "u_color2"), _ = c.getUniformLocation(i, "u_duo"), ne(), u = new ResizeObserver(b), u.observe(e), b(), le(b), x() ? re(10) : S();
102
+ }), fe(() => {
103
+ cancelAnimationFrame(l), u?.disconnect();
104
+ }), he(() => {
105
+ let e = c;
106
+ c = null, setTimeout(() => {
107
+ e?.getExtension("WEBGL_lose_context")?.loseContext();
108
+ }, 150);
109
+ }), (e, t) => (A(), E("div", {
110
+ ref_key: "rootEl",
111
+ ref: n,
112
+ class: "pk-aurora",
113
+ "aria-hidden": "true",
114
+ style: de(s.value)
115
+ }, [a.value ? (A(), E("div", Ee)) : (A(), E("canvas", {
116
+ key: 0,
117
+ ref_key: "canvasEl",
118
+ ref: r,
119
+ class: "pk-aurora__canvas"
120
+ }, null, 512))], 4));
121
+ }
122
+ }), z = .18, B = .35, Oe = /* @__PURE__ */ oe({
123
+ __name: "PkVoiceOrb",
124
+ props: {
125
+ sample: {},
126
+ spectrum: {
127
+ type: Function,
128
+ default: void 0
129
+ },
130
+ state: {},
131
+ bars: { default: 5 }
132
+ },
133
+ setup(e) {
134
+ let t = e, n = be("barsEl"), r = Array.from({ length: t.bars }, () => z), i, a = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === !0, o = () => {
135
+ let e = Math.min(1, Math.max(0, t.sample())), n = t.spectrum?.(), i = r.length;
136
+ if (!n?.length) {
137
+ let t = Date.now() / 260;
138
+ return Array.from({ length: i }, (n, r) => {
139
+ let i = .65 + .35 * Math.sin(t + r * .9);
140
+ return z + e * 2.4 * i;
141
+ });
142
+ }
143
+ let a = Math.max(1, Math.floor(n.length / 2)), o = Math.max(1, Math.floor(a / i));
144
+ return Array.from({ length: i }, (e, t) => {
145
+ let r = 0;
146
+ for (let e = 0; e < o; e += 1) r += n[t * o + e] ?? 0;
147
+ return z + r / o / 255 * 2.2;
148
+ });
149
+ }, s = () => {
150
+ let e = n.value?.children;
151
+ e && r.forEach((t, n) => {
152
+ e[n]?.style.setProperty("--pk-voice-orb-scale", String(t));
153
+ });
154
+ }, c = () => {
155
+ let e = o();
156
+ r = r.map((t, n) => t + (Math.min(1, Math.max(z, e[n] ?? z)) - t) * B), s(), i = requestAnimationFrame(c);
157
+ }, l = () => {
158
+ i !== void 0 && (cancelAnimationFrame(i), i = void 0);
159
+ };
160
+ return P(() => t.state, async (e) => {
161
+ e !== "listening" && e !== "speaking" || a() ? (l(), r = r.map(() => z * 1.6), await le(), s()) : i === void 0 && (i = requestAnimationFrame(c));
162
+ }, { immediate: !0 }), fe(l), (t, r) => (A(), E("div", {
163
+ class: ue(["pk-voice-orb", `pk-voice-orb--${e.state}`]),
164
+ "aria-hidden": "true"
165
+ }, [D("div", {
166
+ ref_key: "barsEl",
167
+ ref: n,
168
+ class: "pk-voice-orb__bars"
169
+ }, [(A(!0), E(x, null, _e(e.bars, (e) => (A(), E("span", {
170
+ key: e,
171
+ class: "pk-voice-orb__bar"
172
+ }))), 128))], 512)], 2));
173
+ }
174
+ }), ke = {
175
+ key: 0,
176
+ class: "pk-voice-session__badge",
177
+ "aria-hidden": "true"
178
+ }, Ae = {
179
+ class: "pk-voice-session__status",
180
+ role: "status"
181
+ }, je = {
182
+ key: 0,
183
+ class: "pk-voice-session__live-dot",
184
+ "aria-hidden": "true"
185
+ }, Me = ["title"], V = ["title"], H = { class: "pk-voice-session__actions" }, Ne = /* @__PURE__ */ oe({
186
+ __name: "PkVoiceSession",
187
+ props: {
188
+ state: {},
189
+ sample: { type: Function },
190
+ spectrum: { type: Function },
191
+ remainingSeconds: {},
192
+ muted: { type: Boolean },
193
+ error: {},
194
+ rawError: {},
195
+ live: { type: Boolean }
196
+ },
197
+ emits: [
198
+ "toggle-mute",
199
+ "hang-up",
200
+ "retry",
201
+ "dismiss"
202
+ ],
203
+ setup(e, { emit: t }) {
204
+ let n = e, r = t, { t: i } = xe({ useScope: "global" }), a = C(() => n.error ? i("message.voiceFailed") : n.state === "connecting" ? i("message.voiceConnecting") : n.state === "speaking" ? i("message.voiceSpeaking") : n.muted ? i("message.voiceMuted") : i("message.voiceListening")), o = C(() => {
205
+ if (n.remainingSeconds === void 0) return;
206
+ let e = Math.floor(n.remainingSeconds / 60), t = n.remainingSeconds % 60;
207
+ return `${e}:${String(t).padStart(2, "0")}`;
208
+ }), s = C(() => n.remainingSeconds !== void 0 && n.remainingSeconds <= 30), c = C(() => !n.error && (n.state === "listening" || n.state === "speaking")), l = C(() => {
209
+ if (c.value) return n.state === "speaking" ? "speaking" : n.muted ? void 0 : "listening";
210
+ });
211
+ return (t, n) => {
212
+ let u = b;
213
+ return A(), E("div", { class: ue(["pk-voice-session", { "pk-voice-session--failed": !!e.error }]) }, [
214
+ e.error ? (A(), E("span", ke, [O(u, { name: "ri:error-warning-line" })])) : (A(), w(Oe, {
215
+ key: 1,
216
+ state: e.state,
217
+ sample: e.sample,
218
+ spectrum: e.spectrum
219
+ }, null, 8, [
220
+ "state",
221
+ "sample",
222
+ "spectrum"
223
+ ])),
224
+ D("div", Ae, [D("span", { class: ue(["pk-voice-session__state", l.value && `pk-voice-session__state--${l.value}`]) }, [c.value ? (A(), E("span", je)) : T("", !0), ae(" " + M(a.value), 1)], 2), e.error ? (A(), E("p", {
225
+ key: 0,
226
+ class: "pk-voice-session__detail",
227
+ title: e.rawError ?? e.error
228
+ }, M(e.error), 9, Me)) : T("", !0)]),
229
+ o.value ? (A(), E("span", {
230
+ key: 2,
231
+ class: ue(["pk-voice-session__timer", { "pk-voice-session__timer--warning": s.value }]),
232
+ title: N(i)("hint.voiceRemaining"),
233
+ "aria-hidden": "true"
234
+ }, M(o.value), 11, V)) : T("", !0),
235
+ D("div", H, [e.error ? (A(), E(x, { key: 0 }, [O(f, {
236
+ icon: "ri:refresh-line",
237
+ label: N(i)("action.retry"),
238
+ onClick: n[0] ||= (e) => r("retry")
239
+ }, null, 8, ["label"]), e.live ? (A(), w(f, {
240
+ key: 0,
241
+ icon: "ri:stop-circle-line",
242
+ modifiers: "danger",
243
+ title: N(i)("action.hangUp"),
244
+ "aria-label": N(i)("action.hangUp"),
245
+ onClick: n[1] ||= (e) => r("hang-up")
246
+ }, null, 8, ["title", "aria-label"])) : (A(), w(f, {
247
+ key: 1,
248
+ icon: "ri:close-line",
249
+ label: N(i)("action.close"),
250
+ onClick: n[2] ||= (e) => r("dismiss")
251
+ }, null, 8, ["label"]))], 64)) : (A(), E(x, { key: 1 }, [O(f, {
252
+ icon: e.muted ? "ri:mic-off-line" : "ri:mic-line",
253
+ title: e.muted ? N(i)("action.unmute") : N(i)("action.mute"),
254
+ "aria-label": e.muted ? N(i)("action.unmute") : N(i)("action.mute"),
255
+ "aria-pressed": e.muted,
256
+ onClick: n[3] ||= (e) => r("toggle-mute")
257
+ }, null, 8, [
258
+ "icon",
259
+ "title",
260
+ "aria-label",
261
+ "aria-pressed"
262
+ ]), O(f, {
263
+ icon: "ri:stop-circle-line",
264
+ modifiers: "danger",
265
+ title: N(i)("action.hangUp"),
266
+ "aria-label": N(i)("action.hangUp"),
267
+ onClick: n[4] ||= (e) => r("hang-up")
268
+ }, null, 8, ["title", "aria-label"])], 64))])
269
+ ], 2);
270
+ };
271
+ }
272
+ }), Pe = (e) => {
273
+ let t = ve(), n = j("disconnected"), r = j("listening"), i = j(), a = j([]), o = j(), s = j(), c, l, u = 0, d = !1, f = () => {
274
+ l &&= (clearInterval(l), void 0), o.value = void 0;
275
+ }, p = (e) => {
276
+ let t = Date.now() + e * 1e3, n = () => {
277
+ let e = Math.max(0, Math.ceil((t - Date.now()) / 1e3));
278
+ o.value = e, e === 0 && h();
279
+ };
280
+ n(), l = setInterval(n, 1e3);
281
+ }, m = async (t) => {
282
+ t && (c === t && (c = void 0), await e.closeGrant?.(t).catch(() => void 0));
283
+ }, h = async () => {
284
+ u += 1, f();
285
+ let e = c;
286
+ c = void 0;
287
+ let i = t.value;
288
+ t.value = void 0, await i?.endSession().catch(() => void 0), await m(e), n.value = "disconnected", r.value = "listening";
289
+ }, g = async () => {
290
+ if (d || t.value || n.value === "connecting") return;
291
+ i.value = void 0, a.value = [], r.value = "listening", s.value = void 0, n.value = "connecting", u += 1;
292
+ let o = u, l = () => o === u && !d, h;
293
+ try {
294
+ let o = import("./web-CCRwq-Go.js");
295
+ o.catch(() => void 0);
296
+ let u = await e.fetchGrant();
297
+ if (!l()) {
298
+ await e.closeGrant?.(u.sessionId).catch(() => void 0);
299
+ return;
300
+ }
301
+ c = u.sessionId, h = u.sessionId, s.value = u.chatId;
302
+ let { VoiceConversation: d } = await o;
303
+ if (!l()) {
304
+ await m(u.sessionId);
305
+ return;
306
+ }
307
+ let g = await d.startSession({
308
+ signedUrl: u.signedUrl,
309
+ customLlmExtraBody: { voice_session_id: u.sessionId },
310
+ clientTools: e.clientTools?.() ?? {},
311
+ onStatusChange: ({ status: e }) => {
312
+ l() && (n.value = e);
313
+ },
314
+ onModeChange: ({ mode: t }) => {
315
+ if (!l()) return;
316
+ let n = r.value === "speaking";
317
+ r.value = t, n && t !== "speaking" && e.onTurnEnd?.();
318
+ },
319
+ onMessage: ({ message: t, role: n }) => {
320
+ if (!l()) return;
321
+ let r = {
322
+ role: n,
323
+ text: t
324
+ };
325
+ a.value = [...a.value, r], e.onTranscript?.(r);
326
+ },
327
+ onError: (e) => {
328
+ l() && (i.value = e);
329
+ },
330
+ onDisconnect: (a) => {
331
+ l() && (f(), t.value = void 0, n.value = "disconnected", r.value = "listening", a.reason === "error" && (i.value = a.message), m(u.sessionId), e.onTurnEnd?.());
332
+ }
333
+ });
334
+ if (!l()) {
335
+ await g.endSession().catch(() => void 0), await m(u.sessionId);
336
+ return;
337
+ }
338
+ t.value = g, p(u.maxSessionSeconds);
339
+ } catch (e) {
340
+ if (await m(h), !l()) return;
341
+ t.value = void 0, f(), n.value = "disconnected", i.value = e instanceof Error ? e.message : String(e);
342
+ }
343
+ }, ee = () => {
344
+ i.value = void 0;
345
+ }, _ = (e) => {
346
+ t.value?.setMicMuted(e);
347
+ }, y = (e) => {
348
+ let n = t.value;
349
+ if (!n || !e.trim()) return !1;
350
+ try {
351
+ return n.sendUserMessage(e), !0;
352
+ } catch (e) {
353
+ return v.warn("The spoken answer could not be sent", e), !1;
354
+ }
355
+ }, te = (e) => {
356
+ let n = t.value;
357
+ if (!n) return 0;
358
+ try {
359
+ return e === "input" ? n.getInputVolume() : n.getOutputVolume();
360
+ } catch {
361
+ return 0;
362
+ }
363
+ }, ne = (e) => {
364
+ let n = t.value;
365
+ if (n) try {
366
+ return e === "input" ? n.getInputByteFrequencyData() : n.getOutputByteFrequencyData();
367
+ } catch {
368
+ return;
369
+ }
370
+ }, b = () => {
371
+ let e = c;
372
+ c = void 0, u += 1, f(), m(e);
373
+ let r = t.value;
374
+ t.value = void 0, r?.endSession().catch(() => void 0), n.value = "disconnected";
375
+ };
376
+ return typeof window < "u" && window.addEventListener("pagehide", b), me(() => {
377
+ d = !0, typeof window < "u" && window.removeEventListener("pagehide", b), h();
378
+ }), {
379
+ status: n,
380
+ mode: r,
381
+ error: i,
382
+ transcript: a,
383
+ remainingSeconds: o,
384
+ chatId: s,
385
+ isActive: C(() => n.value === "connected" || n.value === "connecting"),
386
+ isConnecting: C(() => n.value === "connecting"),
387
+ isSpeaking: C(() => n.value === "connected" && r.value === "speaking"),
388
+ isListening: C(() => n.value === "connected" && r.value === "listening"),
389
+ start: g,
390
+ stop: h,
391
+ dismissError: ee,
392
+ setMuted: _,
393
+ sendUserMessage: y,
394
+ readLevel: te,
395
+ readSpectrum: ne
396
+ };
397
+ }, Fe = Symbol("ChatFilePreviewDock");
398
+ function Ie(e) {
399
+ ge(Fe, e);
400
+ }
401
+ function Le() {
402
+ return se(Fe, void 0);
403
+ }
404
+ // ../../packages/components/src/chat/useWakeupWatch.ts
405
+ var Re = 4e3, ze = [
406
+ 3e3,
407
+ 5e3,
408
+ 1e4
409
+ ], Be = 12e4, Ve = 6e4, He = 216e5, Ue = 3e4;
410
+ function We(e) {
411
+ let t = j(null), n = j(!1), r, i = !1, a = () => {
412
+ clearTimeout(r), r = void 0;
413
+ }, o = (e, t) => {
414
+ a(), i || (r = setTimeout(() => void t(), e));
415
+ }, s = (t) => {
416
+ let n = Date.parse(t.dueAt) - Ve;
417
+ return e.messages().some((e) => {
418
+ let r = e.metadata?.wakeup;
419
+ return r?.id === t.wakeId || t.kind === "task" && r?.taskId === t.taskId && (e.metadata?.createdAt ?? 0) >= n;
420
+ });
421
+ }, c = (e) => {
422
+ let t = Date.parse(e.dueAt) - Date.now() + Re;
423
+ t > He ? o(He, l) : o(Math.max(Re, t), () => u(e, Date.now(), 0));
424
+ };
425
+ async function l() {
426
+ a();
427
+ let n = e.chatId();
428
+ try {
429
+ let r = await e.apiClient().getChatWakeup(e.agentId(), n);
430
+ if (n !== e.chatId()) return;
431
+ t.value = r.pendingWakeup;
432
+ } catch {
433
+ t.value = null;
434
+ }
435
+ t.value && c(t.value);
436
+ }
437
+ async function u(t, n, r) {
438
+ await e.refreshMessages(), i || (s(t) || Date.now() - n >= Be ? await l() : o(ze[Math.min(r, ze.length - 1)], () => u(t, n, r + 1)));
439
+ }
440
+ async function d() {
441
+ let r = t.value;
442
+ n.value = !0;
443
+ try {
444
+ let n = e.apiClient(), i = r?.kind === "task" && r.taskId ? await n.deleteChatTask(e.agentId(), e.chatId(), r.taskId) : await n.stopChatWakeup(e.agentId(), e.chatId());
445
+ a(), t.value = i.pendingWakeup, i.pendingWakeup && c(i.pendingWakeup);
446
+ } finally {
447
+ n.value = !1;
448
+ }
449
+ }
450
+ function f() {
451
+ a(), t.value = null;
452
+ }
453
+ let p;
454
+ function m() {
455
+ p = e.chatId();
456
+ }
457
+ function h() {
458
+ p === e.chatId() && (p = void 0, l());
459
+ }
460
+ function g() {
461
+ p = void 0;
462
+ }
463
+ let ee = C(() => e.messages().some((e) => e.role === "user"));
464
+ P([e.chatId, ee], ([, t]) => {
465
+ f();
466
+ let n = e.status(), r = n === "submitted" || n === "streaming" || p === e.chatId();
467
+ t && !r && l();
468
+ }, { immediate: !0 }), P(e.status, (e, t) => {
469
+ e === "ready" && t !== "ready" && ee.value && l();
470
+ });
471
+ let _;
472
+ function v() {
473
+ t.value && document.visibilityState === "visible" && e.apiClient().markChatWakeupPresence(e.agentId(), e.chatId()).catch(() => void 0);
474
+ }
475
+ let y = () => v();
476
+ return document.addEventListener("visibilitychange", y), P(() => t.value?.wakeId, (e) => {
477
+ clearInterval(_), _ = void 0, e && !i && (v(), _ = setInterval(v, Ue));
478
+ }), fe(() => {
479
+ i = !0, a(), clearInterval(_), document.removeEventListener("visibilitychange", y);
480
+ }), {
481
+ pendingWakeup: t,
482
+ isStopping: n,
483
+ check: l,
484
+ reset: f,
485
+ stop: d,
486
+ spokenTurnStarted: m,
487
+ spokenTurnsWritten: h,
488
+ forgetSpokenTurns: g
489
+ };
490
+ }
491
+ // ../../packages/components/src/chat/previewChanges.ts
492
+ var U = 1e6, Ge = (e, t) => {
493
+ let n = 0;
494
+ for (; n < e.length && n < t.length && e[n] === t[n];) n += 1;
495
+ let r = 0;
496
+ for (; r < e.length - n && r < t.length - n && e[e.length - 1 - r] === t[t.length - 1 - r];) r += 1;
497
+ let i = e.length - n - r, a = t.length - n - r, o = /* @__PURE__ */ new Map(), s = (e, t, n, r) => {
498
+ for (let i = n; i < r; i++) {
499
+ let r = e + (i - n);
500
+ o.set(i, r < t ? r : void 0);
501
+ }
502
+ };
503
+ if (!a) return o;
504
+ if (!i || i * a > U) return s(n, n + i, n, n + a), o;
505
+ let c = new Uint32Array((i + 1) * (a + 1));
506
+ for (let r = i - 1; r >= 0; r--) for (let i = a - 1; i >= 0; i--) c[r * (a + 1) + i] = e[n + r] === t[n + i] ? c[(r + 1) * (a + 1) + i + 1] + 1 : Math.max(c[(r + 1) * (a + 1) + i], c[r * (a + 1) + i + 1]);
507
+ let l = 0, u = 0, d = 0, f = 0;
508
+ for (; l < i && u < a;) e[n + l] === t[n + u] ? (s(n + d, n + l, n + f, n + u), l += 1, u += 1, d = l, f = u) : c[(l + 1) * (a + 1) + u] >= c[l * (a + 1) + u + 1] ? l += 1 : u += 1;
509
+ return s(n + d, n + i, n + f, n + a), o;
510
+ }, Ke = (e, t) => e === "id" || e === "ids" ? void 0 : t, W = (e) => JSON.stringify(e, Ke), qe = (e, t) => {
511
+ let n = (e) => e.flatMap((e) => e.ids ?? []);
512
+ return t?.kind === "table" ? [...Ge(t.rows.map(W), e.rows.map(W))].flatMap(([r, i]) => {
513
+ let a = i === void 0 ? void 0 : t.rows[i];
514
+ return n(e.rows[r].filter((e, t) => !a?.[t] || W(a[t]) !== W(e)));
515
+ }) : n(e.rows.flat());
516
+ }, Je = (e, t) => {
517
+ let n = /* @__PURE__ */ new Set(), r = Ge(e.blocks.map(W), t.blocks.map(W));
518
+ for (let [i, a] of r) {
519
+ let r = t.blocks[i];
520
+ if (r.kind === "table") {
521
+ let t = a === void 0 ? void 0 : e.blocks[a];
522
+ for (let e of qe(r, t)) n.add(e);
523
+ } else r.id && n.add(r.id);
524
+ }
525
+ return n;
526
+ }, Ye = (e, t) => {
527
+ let n = /* @__PURE__ */ new Map();
528
+ for (let r of t.rows) for (let t of r.cells) n.set(`${r.row}:${t.col}`, JSON.stringify({
529
+ ...t,
530
+ style: t.style === void 0 ? void 0 : e.styles[t.style],
531
+ numFmt: t.numFmt === void 0 ? void 0 : e.numberFormats?.[t.numFmt]
532
+ }));
533
+ return n;
534
+ }, G = (e, t) => {
535
+ let n = /* @__PURE__ */ new Map();
536
+ for (let r of t.sheets) {
537
+ let i = e.sheets.find((e) => e.name === r.name), a = Ye(t, r), o = i ? Ye(e, i) : /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
538
+ for (let [e, t] of a) o.get(e) !== t && s.add(e);
539
+ for (let e of o.keys()) a.has(e) || s.add(e);
540
+ s.size && n.set(r.name, s);
541
+ }
542
+ return n;
543
+ }, Xe = (e, t) => {
544
+ if (e.kind === "word" && t.kind === "word") {
545
+ let n = Je(e, t);
546
+ return n.size ? {
547
+ kind: "word",
548
+ paragraphs: n
549
+ } : void 0;
550
+ }
551
+ if (e.kind === "spreadsheet" && t.kind === "spreadsheet") {
552
+ let n = G(e, t);
553
+ return n.size ? {
554
+ kind: "spreadsheet",
555
+ cells: n
556
+ } : void 0;
557
+ }
558
+ }, Ze = (e, t) => {
559
+ let n = e?.querySelector(t);
560
+ if (!e || !n) return !1;
561
+ let r = e.getBoundingClientRect(), i = n.getBoundingClientRect();
562
+ return (i.top < r.top || i.bottom > r.bottom) && (e.scrollTop += i.top - r.top - (r.height - i.height) / 2), (i.left < r.left || i.right > r.right) && (e.scrollLeft += i.left - r.left - (r.width - i.width) / 2), !0;
563
+ }, Qe = 4e3;
564
+ function $e(e) {
565
+ let t = j(), n = j(), r = j(!1), i = j(!1), a = ve(), o = /* @__PURE__ */ new Map(), s, c = 0, l = 0, u = () => {
566
+ clearTimeout(s), a.value = void 0;
567
+ }, d = (e, t) => {
568
+ u();
569
+ let r = e && t ? Xe(t, e) : void 0;
570
+ r && (a.value = r, s = setTimeout(u, Qe)), n.value = e;
571
+ }, f = async (n, a) => {
572
+ let s = ++c, u = l, f = a ? o.get(a) : void 0;
573
+ t.value = n, i.value = !1;
574
+ let p = o.get(n.storedFileName);
575
+ if (d(p, f), r.value = !1, p) return;
576
+ r.value = !0;
577
+ let m = () => s === c;
578
+ try {
579
+ let t = await e(n.storedFileName);
580
+ u === l && o.set(n.storedFileName, t), m() && d(t, f);
581
+ } catch {
582
+ m() && (i.value = !0);
583
+ } finally {
584
+ m() && (r.value = !1);
585
+ }
586
+ }, p = () => {
587
+ t.value = void 0, c += 1, u();
588
+ };
589
+ return {
590
+ target: t,
591
+ preview: n,
592
+ loading: r,
593
+ error: i,
594
+ changes: a,
595
+ open: f,
596
+ close: p,
597
+ reset: () => {
598
+ p(), o.clear(), l += 1;
599
+ }
600
+ };
601
+ }
602
+ // ../../packages/components/src/chat/PkChatbotViewChat.vue?vue&type=script&setup=true&lang.ts
603
+ var et = { class: "pk-chatbot-view-chat__input-stage" }, tt = {
604
+ key: 1,
605
+ class: "p-md border-t border-surface-3 text-center text-12 text-danger bg-surface-danger"
606
+ }, nt = {
607
+ key: 2,
608
+ class: "pk-chatbot-view-chat__read-only",
609
+ role: "status"
610
+ }, rt = { class: "pk-chatbot-view-chat__read-only-text" }, it = { class: "pk-chatbot-view-chat__agent-chip" }, at = {
611
+ key: 0,
612
+ class: "pk-chatbot-view-chat__agent-chip-name"
613
+ }, ot = {
614
+ key: 0,
615
+ class: "pk-chatbot-view-chat__drop-overlay"
616
+ }, st = 1e3, ct = 3e3, lt = 6e4, ut = 3e5, dt = 6e5, ft = /* @__PURE__ */ oe({
617
+ __name: "PkChatbotViewChat",
618
+ props: {
619
+ agentId: {},
620
+ modifier: {},
621
+ userName: {}
622
+ },
623
+ emits: [
624
+ "show-info",
625
+ "revise",
626
+ "selection-action"
627
+ ],
628
+ setup(i, { emit: f }) {
629
+ let v = k(() => import("./PkToolShowForm-BCvqIlt_.js").then((e) => e.n)), x = k(() => import("./PkToolShowContactForm-D9J0B3C-.js").then((e) => e.n)), ae = k(() => import("./PkToolShowSuggestedReply-75Kc8-OQ.js").then((e) => e.n)), oe = k(() => import("./PkToolShowSources-D_KfNZ_Q.js").then((e) => e.n)), se = k(() => import("./PkToolRequestGeolocation-C2OmF31d.js").then((e) => e.n)), le = k(() => import("./PkToolRequestOAuthConnection-CgD-o99C.js")), de = k(() => import("./PkToolShowLocation-BhVcLnkV.js").then((e) => e.n)), pe = k(() => import("./PkToolShowChart-B8xJi1yY.js")), me = k(() => import("./PkToolShowDiagram-BlV7ktLW.js")), he = k(() => import("./PkToolChatFile-uO6r1l6t.js").then((e) => e.n)), _e = k(() => import("./PkToolShareDocument-B7mMJJfn.js").then((e) => e.n)), ve = k(() => import("./PkFilePreview-Dkm34tMI.js").then((e) => e.n)), ye = k(() => import("./PkFilePreviewDialog-CZg7uqHL.js").then((e) => e.n)), I = i, Ee = f, L = n(I.agentId), { isReadOnlyChat: R, chatProjectId: z, agentInterface: B, agentFileUpload: Oe, agentType: ke, agentVoice: Ae, actions: je, revisedAnswers: Me, messages: V, chat: H, messageFeedbacks: Fe, feedbackDialogMessage: Ie, isFeedbackSubmitting: Re, isFeedbackSubmitted: ze, feedbackSubmitError: Be, isLeadSubmitted: Ve, isLoadingSubmitLead: He, submitLeadError: Ue, input: U, inputMessagePlaceholder: Ge, isConversationBlocked: Ke, baseUrl: W, pendingAttachments: qe, isAttachmentLimitReached: Je, fileLimitError: Ye, apiClient: G, isDark: Xe, hostToolsPending: Ze, pageNoticeLevel: Qe, hostConfirmation: ft, agentPageAccess: pt, hostStepTitles: mt, hostStepChanges: ht, confirmationMode: gt, canQueue: _t, queuedMessages: vt, backgroundAnswers: yt, inputFocusRequest: bt, pagePointer: xt, pagePointerAvailable: St, pagePointing: Ct, agentSelectionActions: wt } = we(L);
630
+ ge(c, mt), ge(o, ht);
631
+ let Tt = be("inputEl");
632
+ P(bt, () => {
633
+ Tt.value?.focus();
634
+ }), P(xt, (e) => {
635
+ e && Tt.value?.focus();
636
+ });
637
+ let Et = C(() => xt.value ? {
638
+ kind: xt.value.kind,
639
+ label: xt.value.label
640
+ } : void 0), K = C(() => ke.value === "reasoning" ? void 0 : Oe.value), Dt = C(() => {
641
+ let e = K.value?.allowedMimeTypes ?? [];
642
+ return !!K.value?.enabled && (!e.length || e.some((e) => e.startsWith("image/")));
643
+ });
644
+ y({
645
+ available: () => !!Tt.value && Dt.value && !Je.value,
646
+ annotate: (e) => Tt.value?.annotateImage(e)
647
+ });
648
+ let q = (e) => G.value.getMediaDownloadUrl(I.agentId, L.localChatId, e), { handleSubmit: Ot, stopGeneration: kt, regenerate: At, onUpvote: jt, onDownvote: Mt, onFeedback: Nt, onFeedbackSubmit: Pt, onLeadSubmit: Ft, startNewChat: It, addToolOutput: Lt, addToolApprovalResponse: Rt, handleFileSelect: zt, discardPendingAttachment: Bt, replacePendingAttachment: Vt, retryPendingAttachment: Ht, clearFileLimitError: Ut, refreshMessages: Wt, appendMessage: Gt, closePageNotice: Kt, respondHostConfirmation: qt, editQueuedMessage: Jt, removeQueuedMessage: Yt, openBackgroundAnswer: Xt, dismissBackgroundAnswer: Zt } = L, { t: J } = xe({ useScope: "global" }), Qt = C(() => Ze.value > 0), $t = C(() => Qt.value && H.value.status === "ready" ? "streaming" : H.value.status), en = te(() => pt.value?.notice), tn = C(() => Qe.value ? en.value || J(`message.pageAccessNotice.${Qe.value}`) : void 0), nn = C(() => {
649
+ let e = Ye.value;
650
+ if (e) return e.reason === "per-chat" ? J("message.fileLimitPerChat", { max: e.max }) : J("message.fileLimitPerMessage", { max: e.max });
651
+ }), rn = C(() => yt.value.map(({ chatId: e, title: t }) => ({
652
+ id: e,
653
+ text: t ? J("message.backgroundAnswerReady", { title: t }) : J("message.backgroundAnswerReadyUntitled")
654
+ }))), an = te(() => B.value?.dismissableNotice), on = C(() => V.value.some((e) => e.role === "user")), sn = C(() => I.modifier === "fullscreen" && !on.value), cn = Te(B, () => I.userName), ln = be("chatViewEl"), un = Le(), dn = C(() => !!un?.value), fn = C(() => un?.value ?? "body"), pn = j(0), mn = j(0);
655
+ Ce([ln, C(() => un?.value ?? void 0)], (e) => {
656
+ for (let t of e) {
657
+ let e = t.borderBoxSize?.[0]?.inlineSize ?? t.contentRect.width;
658
+ t.target === ln.value ? pn.value = e : mn.value = e;
659
+ }
660
+ }, { box: "border-box" });
661
+ let hn = C(() => pn.value + (dn.value ? mn.value : 0) >= st), gn = C(() => pn.value > 0 && pn.value < 576), { target: Y, preview: _n, loading: vn, error: yn, changes: bn, open: xn, close: Sn, reset: Cn } = $e((e) => G.value.getChatFilePreview(I.agentId, L.localChatId, e)), X = j({}), wn = (e, t) => {
662
+ let n = (e) => e?.fileId ?? e?.storedFileName;
663
+ return n(e) !== n(Y.value) && (X.value = {}), xn(e, t);
664
+ }, Tn = j(!1), En = C(() => !!Y.value && hn.value && !Tn.value), Dn = () => {
665
+ Sn(), Tn.value = !1;
666
+ }, On = /* @__PURE__ */ new Set([
667
+ "tool-editSpreadsheet",
668
+ "tool-editWordDocument",
669
+ "tool-createSpreadsheet",
670
+ "tool-createWordDocument"
671
+ ]), kn = C(() => {
672
+ let e = /* @__PURE__ */ new Map();
673
+ for (let t of V.value) for (let n of t.parts) {
674
+ let { type: t, state: r, output: i } = n;
675
+ if (On.has(t) && r === "output-available" && i?.fileId && i.version && i.storedFileName) {
676
+ let t = e.get(i.fileId) ?? /* @__PURE__ */ new Map();
677
+ t.set(i.version, i.storedFileName), e.set(i.fileId, t);
678
+ }
679
+ }
680
+ for (let [t, n] of e) n.has(1) || n.set(1, t);
681
+ return e;
682
+ }), An = C(() => [...kn.value.get(Y.value?.fileId ?? "")?.keys() ?? []].sort((e, t) => e - t)), jn = (e, t) => {
683
+ let n = Y.value, r = kn.value.get(n?.fileId ?? "")?.get(e);
684
+ n && r && wn({
685
+ ...n,
686
+ version: e,
687
+ storedFileName: r
688
+ }, t);
689
+ }, Mn = C(() => {
690
+ let e = Y.value, t = An.value;
691
+ return !!$.value && !!e?.fileId && !!e.version && t.length > 0 && e.version < t[t.length - 1];
692
+ }), Nn = () => {
693
+ let e = Y.value;
694
+ e?.fileId && e.version && ($.value?.({
695
+ fileId: e.fileId,
696
+ version: e.version,
697
+ filename: e.filename
698
+ }), Dn());
699
+ };
700
+ P(() => L.localChatId, Cn), P(() => {
701
+ let e = Y.value?.fileId;
702
+ return e ? {
703
+ fileId: e,
704
+ newest: Math.max(0, ...An.value)
705
+ } : void 0;
706
+ }, (e, t) => {
707
+ e && t && e.fileId === t.fileId && e.newest > t.newest && Y.value?.version === t.newest && jn(e.newest, Y.value.storedFileName);
708
+ });
709
+ let Pn = C(() => {
710
+ let e = H.value?.status;
711
+ if (!(Ke.value || R.value || e === "submitted" || e === "streaming")) return Y.value?.kind === "word" ? wt.value?.word : wt.value?.excel;
712
+ }), Fn = C(() => $t.value === "submitted" || $t.value === "streaming"), In = () => {
713
+ hn.value ? Tn.value = !1 : Dn();
714
+ }, Ln = (e, t, n) => {
715
+ L.sendSelection(e, { filePointer: t }) && Ee("selection-action", {
716
+ surface: t.format === "docx" ? "word" : "excel",
717
+ action: n.id,
718
+ state: "chat",
719
+ size: String(n.size)
720
+ });
721
+ }, Rn = async (e) => (await G.value.expandSourceContext(I.agentId, e.documentId, e.chunkIndex)).content, zn = async (e) => {
722
+ let t = await G.value.downloadSourceDocument(I.agentId, e);
723
+ window.open(t.downloadUrl, "_blank");
724
+ }, { isOverDropZone: Bn } = Se(ln, {
725
+ dataTypes: (e) => !R.value && ne(e, K.value?.allowedMimeTypes ?? []),
726
+ onDrop: (e) => {
727
+ if (K.value?.enabled && e) for (let t of e) zt(t);
728
+ }
729
+ }), Vn = j(!1), Hn = !1, Z = j(!1), Un = [
730
+ 3e3,
731
+ 5e3,
732
+ 1e4
733
+ ], Wn, Gn, Kn = !1, qn = 0, Jn = !1;
734
+ function Yn() {
735
+ clearTimeout(Wn), Wn = void 0, Gn = void 0, Kn = !1, qn = 0, Z.value = !1;
736
+ }
737
+ function Xn(e) {
738
+ Hn || (clearTimeout(Wn), Wn = setTimeout(() => {
739
+ Zn();
740
+ }, e));
741
+ }
742
+ async function Zn() {
743
+ if (Hn || Jn) return;
744
+ Jn = !0;
745
+ let e;
746
+ try {
747
+ e = await Wt();
748
+ } finally {
749
+ Jn = !1;
750
+ }
751
+ if (Hn) return;
752
+ if (e === "caught-up" && (Z.value = !1, Dr()), Q.isActive.value) {
753
+ Gn = void 0, Kn = !1, qn = 0, Xn(ct);
754
+ return;
755
+ }
756
+ Gn === void 0 && (Gn = Date.now(), Kn = !!Q.error.value);
757
+ let t = Date.now() - Gn;
758
+ if (e === "caught-up" && t >= (Kn ? ut : lt) || t >= dt) {
759
+ Yn(), Or();
760
+ return;
761
+ }
762
+ let n = Un[Math.min(qn, Un.length - 1)];
763
+ qn += 1, Xn(n);
764
+ }
765
+ let Qn = (e = 1200) => {
766
+ Xn(e);
767
+ }, $n, Q = Pe({
768
+ fetchGrant: async () => {
769
+ $n = L.voicePageTools();
770
+ let e = await G.value.createVoiceSession(I.agentId, L.localChatId, {
771
+ deviceContext: L.buildDeviceContext(),
772
+ externalContext: L.externalContext,
773
+ pageTools: $n?.declaration,
774
+ ...L.confirmationMode === "automatic" && { confirmations: "automatic" }
775
+ });
776
+ return e.chatId !== L.localChatId && (L.localChatId = e.chatId), e;
777
+ },
778
+ closeGrant: (e) => G.value.closeVoiceSession(I.agentId, e),
779
+ clientTools: () => $n?.clientTools,
780
+ onTranscript: (e) => {
781
+ e.role === "user" ? (Z.value = !0, Er(), Gt({
782
+ id: `${r}user-${t()}`,
783
+ role: "user",
784
+ parts: [{
785
+ type: "text",
786
+ text: e.text
787
+ }]
788
+ })) : Z.value = !1;
789
+ },
790
+ onTurnEnd: () => {
791
+ Qn();
792
+ }
793
+ });
794
+ P(() => Q.isActive.value, (e) => {
795
+ e || L.cancelVoicePageCalls();
796
+ }), P(() => Q.error.value, (e) => {
797
+ e && (Z.value = !1);
798
+ });
799
+ let er = C(() => Ae.value?.enabled === !0), tr = C(() => Q.error.value ? "error" : Q.isConnecting.value ? "connecting" : Q.isSpeaking.value ? "speaking" : Q.isActive.value ? "listening" : "idle"), nr = C(() => {
800
+ let e = Q.error.value;
801
+ if (e) return /took too long/i.test(e) ? J("message.voiceTookTooLong") : /cascade|no response|custom_llm_error/i.test(e) ? J("message.voiceNoAnswer") : J("message.voiceInterrupted");
802
+ }), rr = C(() => Q.isSpeaking.value ? "output" : "input"), ir = () => Q.readLevel(rr.value), ar = () => Q.readSpectrum(rr.value), or = async () => {
803
+ Vn.value = !1, await Q.start(), Q.isActive.value && (Yn(), Xn(ct));
804
+ }, sr = async () => {
805
+ Z.value = !1, await Q.stop(), Hn || Qn(0);
806
+ }, cr = () => {
807
+ Q.dismissError();
808
+ }, lr = async () => {
809
+ Q.dismissError(), await Q.stop(), await or();
810
+ }, ur = (e) => e?.toolCallId ?? "", dr = j(/* @__PURE__ */ new Set()), fr = (e) => dr.value.has(ur(e)), pr = j(/* @__PURE__ */ new Map()), mr = (e, t) => Q.isActive.value ? (Q.sendUserMessage(t) && (dr.value = new Set(dr.value).add(ur(e)), Qn()), !0) : !1, hr = (e, t, n) => {
811
+ mr(t, s(t, n)) || Lt({
812
+ tool: e,
813
+ toolCallId: ur(t),
814
+ output: n
815
+ });
816
+ }, gr = (e) => {
817
+ let t = e.confirmed ? J("message.voiceConfirmed") : J("message.voiceCancelled");
818
+ mr({ toolCallId: e.toolCallId }, t) ? dr.value.has(e.toolCallId) && (pr.value = new Map(pr.value).set(e.toolCallId, e.confirmed)) : Lt({
819
+ tool: "requestConfirm",
820
+ toolCallId: e.toolCallId,
821
+ output: e.confirmed ? "confirmed" : "cancelled"
822
+ });
823
+ }, _r = C(() => {
824
+ let e = /* @__PURE__ */ new Map();
825
+ for (let t of V.value) for (let n of t.parts) {
826
+ let { type: t, state: r, output: i } = n;
827
+ On.has(t) && r === "output-available" && i?.fileId && i.version && e.set(i.fileId, Math.max(e.get(i.fileId) ?? 0, i.version));
828
+ }
829
+ return e;
830
+ }), vr = C(() => {
831
+ let e = /* @__PURE__ */ new Map(), t = (t, n) => {
832
+ if (t && n) {
833
+ let r = t.toLowerCase();
834
+ e.set(r, (e.get(r) ?? /* @__PURE__ */ new Set()).add(n));
835
+ }
836
+ };
837
+ for (let e of V.value) for (let n of e.parts) {
838
+ if (h(n)) {
839
+ t(n.filename, g(n)?.storedFileName);
840
+ continue;
841
+ }
842
+ let { type: e, state: r, output: i } = n;
843
+ On.has(e) && r === "output-available" && i?.filename && t(l(i.filename, i.version), i.fileId);
844
+ }
845
+ return e;
846
+ }), $ = C(() => Ke.value || R.value ? void 0 : (e) => {
847
+ let t = (vr.value.get(e.filename.toLowerCase())?.size ?? 0) > 1;
848
+ U.value = J(t ? "messagePart.chatFileRestoreRequestById" : "messagePart.chatFileRestoreRequest", e), Ot();
849
+ }), yr = (e, t) => {
850
+ mr(e, t) || (U.value = t, Ot());
851
+ }, br = (e, t) => {
852
+ let n = t.error ? J("message.voiceLocationRefused") : J("message.voiceLocationShared", { place: t.displayName ?? `${t.latitude}, ${t.longitude}` });
853
+ mr(e, n) || Lt({
854
+ tool: "requestGeolocation",
855
+ toolCallId: ur(e),
856
+ output: t
857
+ });
858
+ }, xr = (e, t) => {
859
+ mr(e, J("message.voiceConnectionDone")) || Lt({
860
+ tool: "requestOAuthConnection",
861
+ toolCallId: ur(e),
862
+ output: {
863
+ connected: !0,
864
+ mcpServerId: t
865
+ }
866
+ });
867
+ }, Sr = () => {
868
+ Vn.value = !Vn.value, Q.setMuted(Vn.value);
869
+ };
870
+ fe(() => {
871
+ Hn = !0, Yn();
872
+ });
873
+ let { pendingWakeup: Cr, isStopping: wr, stop: Tr, spokenTurnStarted: Er, spokenTurnsWritten: Dr, forgetSpokenTurns: Or } = We({
874
+ agentId: () => I.agentId,
875
+ chatId: () => L.localChatId,
876
+ apiClient: () => G.value,
877
+ messages: () => V.value,
878
+ refreshMessages: Wt,
879
+ status: () => H.value.status
880
+ });
881
+ return (t, n) => {
882
+ let r = b, o = e;
883
+ return A(), E("div", {
884
+ ref_key: "chatViewEl",
885
+ ref: ln,
886
+ class: ue(["pk-chatbot-view-chat", {
887
+ "pk-chatbot-view-chat--dragover": N(Bn) && K.value?.enabled,
888
+ "pk-chatbot-view-chat--empty": sn.value,
889
+ "pk-chatbot-view-chat--with-preview": En.value && !dn.value
890
+ }])
891
+ }, [
892
+ O(S, {
893
+ name: "pk-chatbot-view-chat-fade",
894
+ mode: "out-in"
895
+ }, {
896
+ default: F(() => [sn.value ? (A(), w(ee, {
897
+ key: 0,
898
+ greeting: N(cn),
899
+ logo: N(B)?.logo,
900
+ name: N(L).name
901
+ }, null, 8, [
902
+ "greeting",
903
+ "logo",
904
+ "name"
905
+ ])) : (A(), w(d, {
906
+ key: 1,
907
+ class: "flex flex-col flex-1 min-h-0 p-md overflow-y-auto",
908
+ interactive: !N(R),
909
+ messages: N(V),
910
+ "confirm-verdicts-on-call": pr.value,
911
+ status: N(H).status,
912
+ error: N(H).error,
913
+ "main-color": N(B)?.mainColor,
914
+ "text-color": N(B)?.textColor,
915
+ "revised-answers": N(Me),
916
+ actions: N(R) ? [] : N(je),
917
+ "message-feedbacks": N(Fe),
918
+ "feedback-message-id": N(Ie)?.id,
919
+ "feedback-loading": N(Re),
920
+ "feedback-submitted": N(ze),
921
+ "feedback-error": N(Be),
922
+ "show-extended-steps": N(B)?.showExtendedSteps,
923
+ "hide-reasoning": N(B)?.showReasoning === !1,
924
+ "awaiting-spoken-answer": Z.value,
925
+ "host-working": Qt.value,
926
+ "host-confirmation": N(ft),
927
+ "is-dark": N(Xe),
928
+ "show-scroll-to-bottom": i.modifier === "fullscreen",
929
+ onFeedbackSubmit: n[0] ||= (e) => N(Pt)(e),
930
+ onFeedbackClose: n[1] ||= (e) => Ie.value = void 0,
931
+ onRegenerate: N(At),
932
+ onAutoRetry: N(At),
933
+ onResetChat: N(It),
934
+ onShowInfo: n[2] ||= (e) => Ee("show-info", e),
935
+ onRevise: n[3] ||= (e) => Ee("revise", e),
936
+ onUpvote: N(jt),
937
+ onDownvote: N(Mt),
938
+ onFeedback: N(Nt),
939
+ onApprovalRespond: N(Rt),
940
+ onConfirmRespond: gr,
941
+ onHostConfirmRespond: N(qt)
942
+ }, {
943
+ "tool-showContactForm": F(({ part: e }) => [O(N(x), {
944
+ part: e,
945
+ record: N(R),
946
+ readonly: !N(W),
947
+ submitted: N(Ve),
948
+ loading: N(He),
949
+ error: N(Ue),
950
+ "privacy-policy-notice": N(B)?.privacyPolicyNotice,
951
+ onSubmit: N(Ft)
952
+ }, null, 8, [
953
+ "part",
954
+ "record",
955
+ "readonly",
956
+ "submitted",
957
+ "loading",
958
+ "error",
959
+ "privacy-policy-notice",
960
+ "onSubmit"
961
+ ])]),
962
+ "tool-showSuggestedReply": F(({ part: e }) => [O(N(ae), {
963
+ part: e,
964
+ record: N(R),
965
+ onSelect: (t) => yr(e, t)
966
+ }, null, 8, [
967
+ "part",
968
+ "record",
969
+ "onSelect"
970
+ ])]),
971
+ "tool-showSources": F(({ part: e }) => [O(N(oe), {
972
+ part: e,
973
+ "on-expand-context": Rn,
974
+ "on-download": zn
975
+ }, null, 8, ["part"])]),
976
+ "tool-showForm": F(({ part: e }) => [O(S, { mode: "out-in" }, {
977
+ default: F(() => [O(N(v), {
978
+ part: e,
979
+ record: N(R),
980
+ answered: fr(e),
981
+ onSelect: (t) => hr("showForm", e, t)
982
+ }, null, 8, [
983
+ "part",
984
+ "record",
985
+ "answered",
986
+ "onSelect"
987
+ ])]),
988
+ _: 2
989
+ }, 1024)]),
990
+ "tool-showMultipleChoice": F(({ part: e }) => [O(S, { mode: "out-in" }, {
991
+ default: F(() => [O(N(v), {
992
+ part: e,
993
+ "allow-custom-answer": "",
994
+ record: N(R),
995
+ answered: fr(e),
996
+ onSelect: (t) => hr("showMultipleChoice", e, t)
997
+ }, null, 8, [
998
+ "part",
999
+ "record",
1000
+ "answered",
1001
+ "onSelect"
1002
+ ])]),
1003
+ _: 2
1004
+ }, 1024)]),
1005
+ "tool-requestOAuthConnection": F(({ part: e }) => [O(N(le), {
1006
+ part: e,
1007
+ "backend-url": N(W),
1008
+ "resolve-connection": (e) => N(G).getOAuthAuthorizeUrl(I.agentId, e),
1009
+ "check-connection": (e) => N(G).getOAuthConnectionStatus(I.agentId, e),
1010
+ onConnected: (t) => xr(e, t)
1011
+ }, null, 8, [
1012
+ "part",
1013
+ "backend-url",
1014
+ "resolve-connection",
1015
+ "check-connection",
1016
+ "onConnected"
1017
+ ])]),
1018
+ "tool-requestGeolocation": F(({ part: e }) => [O(N(se), {
1019
+ part: e,
1020
+ "call-live": N(Q).isActive.value,
1021
+ "reverse-geocode": (e, t) => N(G).reverseGeocode(e, t),
1022
+ onResult: (t) => br(e, t)
1023
+ }, null, 8, [
1024
+ "part",
1025
+ "call-live",
1026
+ "reverse-geocode",
1027
+ "onResult"
1028
+ ])]),
1029
+ "tool-showLocation": F(({ part: e }) => [O(N(de), {
1030
+ part: e,
1031
+ "is-dark": N(Xe),
1032
+ "main-color": N(B)?.mainColor,
1033
+ "forward-geocode": (e, t) => N(G).forwardGeocode(e, t)
1034
+ }, null, 8, [
1035
+ "part",
1036
+ "is-dark",
1037
+ "main-color",
1038
+ "forward-geocode"
1039
+ ])]),
1040
+ "tool-showChart": F(({ part: e }) => [O(N(pe), {
1041
+ part: e,
1042
+ "is-dark": N(Xe)
1043
+ }, null, 8, ["part", "is-dark"])]),
1044
+ "tool-showDiagram": F(({ part: e }) => [O(N(me), {
1045
+ part: e,
1046
+ "is-dark": N(Xe)
1047
+ }, null, 8, ["part", "is-dark"])]),
1048
+ "tool-editSpreadsheet": F(({ part: e }) => [(A(), w(N(he), {
1049
+ key: N(a)(e),
1050
+ part: e,
1051
+ "file-url": q,
1052
+ preview: wn,
1053
+ "latest-versions": _r.value,
1054
+ restore: $.value
1055
+ }, null, 8, [
1056
+ "part",
1057
+ "latest-versions",
1058
+ "restore"
1059
+ ]))]),
1060
+ "tool-editWordDocument": F(({ part: e }) => [(A(), w(N(he), {
1061
+ key: N(a)(e),
1062
+ part: e,
1063
+ "file-url": q,
1064
+ preview: wn,
1065
+ "latest-versions": _r.value,
1066
+ restore: $.value
1067
+ }, null, 8, [
1068
+ "part",
1069
+ "latest-versions",
1070
+ "restore"
1071
+ ]))]),
1072
+ "tool-createSpreadsheet": F(({ part: e }) => [(A(), w(N(he), {
1073
+ key: N(a)(e),
1074
+ part: e,
1075
+ "file-url": q,
1076
+ preview: wn,
1077
+ "latest-versions": _r.value,
1078
+ restore: $.value
1079
+ }, null, 8, [
1080
+ "part",
1081
+ "latest-versions",
1082
+ "restore"
1083
+ ]))]),
1084
+ "tool-createWordDocument": F(({ part: e }) => [(A(), w(N(he), {
1085
+ key: N(a)(e),
1086
+ part: e,
1087
+ "file-url": q,
1088
+ preview: wn,
1089
+ "latest-versions": _r.value,
1090
+ restore: $.value
1091
+ }, null, 8, [
1092
+ "part",
1093
+ "latest-versions",
1094
+ "restore"
1095
+ ]))]),
1096
+ "tool-shareDocument": F(({ part: e }) => [(A(), w(N(_e), {
1097
+ key: N(a)(e),
1098
+ part: e,
1099
+ "on-download": zn
1100
+ }, null, 8, ["part"]))]),
1101
+ _: 1
1102
+ }, 8, /* @__PURE__ */ "interactive.messages.confirm-verdicts-on-call.status.error.main-color.text-color.revised-answers.actions.message-feedbacks.feedback-message-id.feedback-loading.feedback-submitted.feedback-error.show-extended-steps.hide-reasoning.awaiting-spoken-answer.host-working.host-confirmation.is-dark.show-scroll-to-bottom.onRegenerate.onAutoRetry.onResetChat.onUpvote.onDownvote.onFeedback.onApprovalRespond.onHostConfirmRespond".split(".")))]),
1103
+ _: 1
1104
+ }),
1105
+ N(vt).length ? (A(), w(m, {
1106
+ key: 0,
1107
+ messages: N(vt),
1108
+ onEdit: N(Jt),
1109
+ onRemove: N(Yt)
1110
+ }, null, 8, [
1111
+ "messages",
1112
+ "onEdit",
1113
+ "onRemove"
1114
+ ])) : T("", !0),
1115
+ D("div", et, [
1116
+ O(S, { name: "pk-chatbot-view-chat-fade" }, {
1117
+ default: F(() => [sn.value ? (A(), w(De, {
1118
+ key: 0,
1119
+ class: "pk-chatbot-view-chat__aurora",
1120
+ "source-selector": ".pk-chatbot-input__form",
1121
+ "main-color": N(B)?.mainColor,
1122
+ tones: N(B)?.glowTones,
1123
+ "second-color": N(B)?.glowSecondColor
1124
+ }, null, 8, [
1125
+ "main-color",
1126
+ "tones",
1127
+ "second-color"
1128
+ ])) : T("", !0)]),
1129
+ _: 1
1130
+ }),
1131
+ N(Cr) && !N(Ke) && !N(R) ? (A(), w(_, {
1132
+ key: 0,
1133
+ pending: N(Cr),
1134
+ stopping: N(wr),
1135
+ onStop: N(Tr)
1136
+ }, null, 8, [
1137
+ "pending",
1138
+ "stopping",
1139
+ "onStop"
1140
+ ])) : T("", !0),
1141
+ N(Ke) ? (A(), E("div", tt, M(N(J)("message.chatErrorConversationBlocked")), 1)) : N(R) ? (A(), E("div", nt, [
1142
+ O(r, {
1143
+ name: "ri:eye-line",
1144
+ class: "shrink-0 w-18 h-18"
1145
+ }),
1146
+ D("span", rt, M(N(J)("chatProjects.readOnly")), 1),
1147
+ N(z) ? (A(), w(o, {
1148
+ key: 0,
1149
+ modifiers: "action-quiet",
1150
+ icon: "ri:edit-box-line",
1151
+ label: N(J)("chatProjects.newChat"),
1152
+ onClick: n[4] ||= (e) => N(L).startNewChat({ projectId: N(z) })
1153
+ }, null, 8, ["label"])) : T("", !0)
1154
+ ])) : tr.value === "idle" ? (A(), w(p, {
1155
+ key: 4,
1156
+ ref_key: "inputEl",
1157
+ ref: Tt,
1158
+ modelValue: N(U),
1159
+ "onUpdate:modelValue": n[5] ||= (e) => ce(U) ? U.value = e : null,
1160
+ "pending-attachments": N(qe),
1161
+ "onUpdate:pendingAttachments": n[6] ||= (e) => ce(qe) ? qe.value = e : null,
1162
+ placeholder: N(Ge),
1163
+ "dismissable-notice": N(an) && N(H).messages.length <= 1 ? N(an) : void 0,
1164
+ "page-notice": tn.value,
1165
+ status: $t.value,
1166
+ "max-message-length": N(B)?.maxMessageLength,
1167
+ "file-upload": K.value,
1168
+ "attachment-limit-reached": N(Je),
1169
+ "attachment-notice": nn.value,
1170
+ "voice-enabled": er.value,
1171
+ "queue-enabled": N(_t),
1172
+ "answer-notices": rn.value,
1173
+ "pointer-available": N(St),
1174
+ pointing: N(Ct),
1175
+ pointer: Et.value,
1176
+ "automatic-confirmations": N(gt) === "automatic",
1177
+ "editable-images": "",
1178
+ "retryable-attachments": "",
1179
+ onPoint: n[7] ||= (e) => N(L).pagePointerStart?.(),
1180
+ onRemovePointer: n[8] ||= (e) => xt.value = void 0,
1181
+ onManualConfirmations: n[9] ||= (e) => N(L).setConfirmationMode("manual"),
1182
+ onStopGeneration: N(kt),
1183
+ onSubmit: N(Ot),
1184
+ onFileSelect: N(zt),
1185
+ onRemoveAttachment: N(Bt),
1186
+ onReplaceAttachment: N(Vt),
1187
+ onRetryAttachment: N(Ht),
1188
+ onDismissAttachmentNotice: N(Ut),
1189
+ onDismissPageNotice: N(Kt),
1190
+ onOpenAnswerNotice: N(Xt),
1191
+ onDismissAnswerNotice: N(Zt),
1192
+ onVoiceStart: or
1193
+ }, ie({ _: 2 }, [i.modifier === "fullscreen" ? {
1194
+ name: "prepend",
1195
+ fn: F(() => [D("span", it, [O(u, {
1196
+ class: "pk-chatbot-view-chat__agent-chip-avatar",
1197
+ "img-src": N(B)?.logo,
1198
+ name: N(L).name
1199
+ }, null, 8, ["img-src", "name"]), N(L).name ? (A(), E("strong", at, M(N(L).name), 1)) : T("", !0)])]),
1200
+ key: "0"
1201
+ } : void 0]), 1032, /* @__PURE__ */ "modelValue.pending-attachments.placeholder.dismissable-notice.page-notice.status.max-message-length.file-upload.attachment-limit-reached.attachment-notice.voice-enabled.queue-enabled.answer-notices.pointer-available.pointing.pointer.automatic-confirmations.onStopGeneration.onSubmit.onFileSelect.onRemoveAttachment.onReplaceAttachment.onRetryAttachment.onDismissAttachmentNotice.onDismissPageNotice.onOpenAnswerNotice.onDismissAnswerNotice".split("."))) : (A(), w(Ne, {
1202
+ key: 3,
1203
+ state: tr.value,
1204
+ sample: ir,
1205
+ spectrum: ar,
1206
+ "remaining-seconds": N(Q).remainingSeconds.value,
1207
+ muted: Vn.value,
1208
+ error: nr.value,
1209
+ "raw-error": N(Q).error.value,
1210
+ live: N(Q).isActive.value,
1211
+ class: "pk-chatbot-view-chat__voice",
1212
+ onToggleMute: Sr,
1213
+ onHangUp: sr,
1214
+ onRetry: lr,
1215
+ onDismiss: cr
1216
+ }, null, 8, [
1217
+ "state",
1218
+ "remaining-seconds",
1219
+ "muted",
1220
+ "error",
1221
+ "raw-error",
1222
+ "live"
1223
+ ]))
1224
+ ]),
1225
+ O(S, null, {
1226
+ default: F(() => [N(Bn) && K.value?.enabled ? (A(), E("div", ot, [O(r, {
1227
+ name: "ri:upload-cloud-2-line",
1228
+ class: "pk-chatbot-view-chat__drop-overlay-icon"
1229
+ }), D("span", null, M(N(J)("action.dropFile")), 1)])) : T("", !0)]),
1230
+ _: 1
1231
+ }),
1232
+ En.value ? (A(), w(re, {
1233
+ key: 1,
1234
+ to: fn.value,
1235
+ disabled: !dn.value
1236
+ }, [D("aside", { class: ue(["pk-chatbot-view-chat__preview", { "pk-chatbot-view-chat__preview--docked": dn.value }]) }, [N(Y) ? (A(), w(N(ve), {
1237
+ key: 0,
1238
+ mode: X.value.mode,
1239
+ "onUpdate:mode": n[10] ||= (e) => X.value.mode = e,
1240
+ sheet: X.value.sheet,
1241
+ "onUpdate:sheet": n[11] ||= (e) => X.value.sheet = e,
1242
+ zoom: X.value.zoom,
1243
+ "onUpdate:zoom": n[12] ||= (e) => X.value.zoom = e,
1244
+ fit: X.value.fit,
1245
+ "onUpdate:fit": n[13] ||= (e) => X.value.fit = e,
1246
+ kind: N(Y).kind,
1247
+ filename: N(Y).filename,
1248
+ version: N(Y).version,
1249
+ versions: An.value,
1250
+ "download-url": q(N(Y).storedFileName),
1251
+ preview: N(_n),
1252
+ changes: N(bn),
1253
+ loading: N(vn),
1254
+ error: N(yn),
1255
+ restorable: Mn.value,
1256
+ resize: "expand",
1257
+ "file-id": N(Y).fileId,
1258
+ "stored-file-name": N(Y).storedFileName,
1259
+ "selection-actions": Pn.value,
1260
+ onVersion: jn,
1261
+ onRestore: Nn,
1262
+ onResize: n[14] ||= (e) => Tn.value = !0,
1263
+ onSelectionSend: Ln,
1264
+ onClose: Dn
1265
+ }, null, 8, [
1266
+ "mode",
1267
+ "sheet",
1268
+ "zoom",
1269
+ "fit",
1270
+ "kind",
1271
+ "filename",
1272
+ "version",
1273
+ "versions",
1274
+ "download-url",
1275
+ "preview",
1276
+ "changes",
1277
+ "loading",
1278
+ "error",
1279
+ "restorable",
1280
+ "file-id",
1281
+ "stored-file-name",
1282
+ "selection-actions"
1283
+ ])) : T("", !0)], 2)], 8, ["to", "disabled"])) : T("", !0),
1284
+ N(Y) && !En.value ? (A(), w(N(ye), {
1285
+ key: 2,
1286
+ mode: X.value.mode,
1287
+ "onUpdate:mode": n[15] ||= (e) => X.value.mode = e,
1288
+ sheet: X.value.sheet,
1289
+ "onUpdate:sheet": n[16] ||= (e) => X.value.sheet = e,
1290
+ zoom: X.value.zoom,
1291
+ "onUpdate:zoom": n[17] ||= (e) => X.value.zoom = e,
1292
+ fit: X.value.fit,
1293
+ "onUpdate:fit": n[18] ||= (e) => X.value.fit = e,
1294
+ target: N(Y),
1295
+ versions: An.value,
1296
+ "download-url": q(N(Y).storedFileName),
1297
+ preview: N(_n),
1298
+ changes: N(bn),
1299
+ loading: N(vn),
1300
+ error: N(yn),
1301
+ restorable: Mn.value,
1302
+ resize: hn.value ? "shrink" : void 0,
1303
+ fullscreen: gn.value,
1304
+ "selection-actions": Pn.value,
1305
+ working: Fn.value,
1306
+ onVersion: jn,
1307
+ onRestore: Nn,
1308
+ onResize: n[19] ||= (e) => Tn.value = !1,
1309
+ onSelectionSend: Ln,
1310
+ onShowChat: In,
1311
+ onClose: Dn
1312
+ }, null, 8, [
1313
+ "mode",
1314
+ "sheet",
1315
+ "zoom",
1316
+ "fit",
1317
+ "target",
1318
+ "versions",
1319
+ "download-url",
1320
+ "preview",
1321
+ "changes",
1322
+ "loading",
1323
+ "error",
1324
+ "restorable",
1325
+ "resize",
1326
+ "fullscreen",
1327
+ "selection-actions",
1328
+ "working"
1329
+ ])) : T("", !0)
1330
+ ], 2);
1331
+ };
1332
+ }
1333
+ });
1334
+ export { Ne as a, Ie as i, $e as n, Oe as o, Ze as r, De as s, ft as t };
1335
+
1336
+ //# sourceMappingURL=PkChatbotViewChat-1RqLcPl4.js.map