@8wave/ai-elements 0.115.0-beta.34 → 0.115.0-beta.52

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 (185) hide show
  1. package/README.md +1 -0
  2. package/dist/_chunks/{Agent-Cu04vBnd.js → Agent-CJbRpoZG.js} +133 -122
  3. package/dist/_chunks/Agent-CJbRpoZG.js.map +1 -0
  4. package/dist/_chunks/PkChatbotFilePreview-DcqwX9nI.js +256 -0
  5. package/dist/_chunks/PkChatbotFilePreview-DcqwX9nI.js.map +1 -0
  6. package/dist/_chunks/PkHeldImage-BtaPh0Jr.js +42 -0
  7. package/dist/_chunks/PkHeldImage-BtaPh0Jr.js.map +1 -0
  8. package/dist/_chunks/{PkStreamingMarkdown-Qk9Tk_N7.js → PkStreamingMarkdown-B_qmgO9_.js} +801 -745
  9. package/dist/_chunks/PkStreamingMarkdown-B_qmgO9_.js.map +1 -0
  10. package/dist/_chunks/PkToolEditSpreadsheet-BSxYLcys.js +41 -0
  11. package/dist/_chunks/PkToolEditSpreadsheet-BSxYLcys.js.map +1 -0
  12. package/dist/_chunks/{PkToolRequestGeolocation-BoKYkQ-Z.js → PkToolRequestGeolocation-YW0ilIxN.js} +2 -2
  13. package/dist/_chunks/{PkToolRequestGeolocation-BoKYkQ-Z.js.map → PkToolRequestGeolocation-YW0ilIxN.js.map} +1 -1
  14. package/dist/_chunks/{PkToolRequestOAuthConnection-CDzpfBg6.js → PkToolRequestOAuthConnection-Cx4aFL5g.js} +2 -2
  15. package/dist/_chunks/{PkToolRequestOAuthConnection-CDzpfBg6.js.map → PkToolRequestOAuthConnection-Cx4aFL5g.js.map} +1 -1
  16. package/dist/_chunks/{PkToolShowArtifact-DB8JjN-b.js → PkToolShowArtifact-Bgj02cPe.js} +2 -2
  17. package/dist/_chunks/{PkToolShowArtifact-DB8JjN-b.js.map → PkToolShowArtifact-Bgj02cPe.js.map} +1 -1
  18. package/dist/_chunks/{PkToolShowContactForm-DHviNxDk.js → PkToolShowContactForm-Die8UpNv.js} +2 -2
  19. package/dist/_chunks/{PkToolShowContactForm-DHviNxDk.js.map → PkToolShowContactForm-Die8UpNv.js.map} +1 -1
  20. package/dist/_chunks/{PkToolShowForm-B-R9fh3R.js → PkToolShowForm-Dmq95u6b.js} +5 -5
  21. package/dist/_chunks/{PkToolShowForm-B-R9fh3R.js.map → PkToolShowForm-Dmq95u6b.js.map} +1 -1
  22. package/dist/_chunks/PkToolShowImageGallery-CKuyTxih.js +88 -0
  23. package/dist/_chunks/PkToolShowImageGallery-CKuyTxih.js.map +1 -0
  24. package/dist/_chunks/PkToolShowProductList-DjS9nvXe.js +72 -0
  25. package/dist/_chunks/PkToolShowProductList-DjS9nvXe.js.map +1 -0
  26. package/dist/_chunks/{PkToolShowSources-CfZEfleZ.js → PkToolShowSources-MJRFeqMA.js} +3 -3
  27. package/dist/_chunks/{PkToolShowSources-CfZEfleZ.js.map → PkToolShowSources-MJRFeqMA.js.map} +1 -1
  28. package/dist/_chunks/{PkToolShowSuggestedReply-DsB35hRR.js → PkToolShowSuggestedReply-DPVS3C74.js} +2 -2
  29. package/dist/_chunks/{PkToolShowSuggestedReply-DsB35hRR.js.map → PkToolShowSuggestedReply-DPVS3C74.js.map} +1 -1
  30. package/dist/_chunks/PkToolShowVideo-DnvvRE7H.js +142 -0
  31. package/dist/_chunks/PkToolShowVideo-DnvvRE7H.js.map +1 -0
  32. package/dist/_chunks/{PkToolShowWebPages-BOxbTe2X.js → PkToolShowWebPages-CYbiGa7e.js} +31 -24
  33. package/dist/_chunks/PkToolShowWebPages-CYbiGa7e.js.map +1 -0
  34. package/dist/_chunks/chatImagePolicy-C5eH4Cpq.js +46 -0
  35. package/dist/_chunks/chatImagePolicy-C5eH4Cpq.js.map +1 -0
  36. package/dist/_chunks/{markdown-_p-gd9w8.js → markdown-qIVVfGoX.js} +146 -73
  37. package/dist/_chunks/markdown-qIVVfGoX.js.map +1 -0
  38. package/dist/ai-elements.es.js +2975 -3134
  39. package/dist/ai-elements.es.js.map +1 -1
  40. package/dist-vue/PkChatbot.js +1 -1
  41. package/dist-vue/PkChatbotEmptyState.js +1 -1
  42. package/dist-vue/PkChatbotFilePreview.js +1 -1
  43. package/dist-vue/PkChatbotInput.js +1 -1
  44. package/dist-vue/PkChatbotMessages.js +1 -1
  45. package/dist-vue/PkChatbotStepPayload.js +1 -1
  46. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  47. package/dist-vue/PkChatbotSteps.js +1 -1
  48. package/dist-vue/PkChatbotViewChat.js +1 -1
  49. package/dist-vue/PkChatbotViewConversations.js +1 -1
  50. package/dist-vue/PkChatbotViewFiles.js +1 -1
  51. package/dist-vue/PkChatbotViewProfile.js +1 -1
  52. package/dist-vue/_chunks/{Agent-KbZm8GvA.js → Agent---jwXeaB.js} +57 -46
  53. package/dist-vue/_chunks/Agent---jwXeaB.js.map +1 -0
  54. package/dist-vue/_chunks/{Document-DCSWwcRE.js → Document-DmBTgjd4.js} +150 -77
  55. package/dist-vue/_chunks/Document-DmBTgjd4.js.map +1 -0
  56. package/dist-vue/_chunks/PkChatbot-W9tO1H9i.js +275 -0
  57. package/dist-vue/_chunks/PkChatbot-W9tO1H9i.js.map +1 -0
  58. package/dist-vue/_chunks/{PkChatbotEmptyState-CO7-vlsZ.js → PkChatbotEmptyState-BY3f3T0T.js} +2 -2
  59. package/dist-vue/_chunks/{PkChatbotEmptyState-CO7-vlsZ.js.map → PkChatbotEmptyState-BY3f3T0T.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotFilePreview-CwiVQDF2.js → PkChatbotFilePreview-Dq9JBX9U.js} +5 -3
  61. package/dist-vue/_chunks/PkChatbotFilePreview-Dq9JBX9U.js.map +1 -0
  62. package/dist-vue/_chunks/{PkChatbotInput-D8ykcHKJ.js → PkChatbotInput-C5l6QDQY.js} +3 -3
  63. package/dist-vue/_chunks/{PkChatbotInput-D8ykcHKJ.js.map → PkChatbotInput-C5l6QDQY.js.map} +1 -1
  64. package/dist-vue/_chunks/PkChatbotMessages-3RZER9PO.js +769 -0
  65. package/dist-vue/_chunks/PkChatbotMessages-3RZER9PO.js.map +1 -0
  66. package/dist-vue/_chunks/{PkChatbotStepPayload-CSVHe7DP.js → PkChatbotStepPayload-C-xnhmzZ.js} +2 -2
  67. package/dist-vue/_chunks/{PkChatbotStepPayload-CSVHe7DP.js.map → PkChatbotStepPayload-C-xnhmzZ.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotStepToolDetail-ixte-rGB.js → PkChatbotStepToolDetail-Cko1vU0N.js} +3 -3
  69. package/dist-vue/_chunks/{PkChatbotStepToolDetail-ixte-rGB.js.map → PkChatbotStepToolDetail-Cko1vU0N.js.map} +1 -1
  70. package/dist-vue/_chunks/PkChatbotSteps-BkZ3Kq2M.js +191 -0
  71. package/dist-vue/_chunks/{PkChatbotSteps-Y6kQ00ui.js.map → PkChatbotSteps-BkZ3Kq2M.js.map} +1 -1
  72. package/dist-vue/_chunks/PkChatbotViewChat-BFImSy1X.js +789 -0
  73. package/dist-vue/_chunks/PkChatbotViewChat-BFImSy1X.js.map +1 -0
  74. package/dist-vue/_chunks/{PkChatbotViewConversations-dpwDFyr_.js → PkChatbotViewConversations-C6T4ZxxX.js} +2 -2
  75. package/dist-vue/_chunks/{PkChatbotViewConversations-dpwDFyr_.js.map → PkChatbotViewConversations-C6T4ZxxX.js.map} +1 -1
  76. package/dist-vue/_chunks/PkChatbotViewFiles-CMQdbZN6.js +125 -0
  77. package/dist-vue/_chunks/PkChatbotViewFiles-CMQdbZN6.js.map +1 -0
  78. package/dist-vue/_chunks/{PkChatbotViewProfile-Brylm3We.js → PkChatbotViewProfile-CDCy1LEX.js} +2 -2
  79. package/dist-vue/_chunks/{PkChatbotViewProfile-Brylm3We.js.map → PkChatbotViewProfile-CDCy1LEX.js.map} +1 -1
  80. package/dist-vue/_chunks/PkHeldImage-BqnlurT_.js +41 -0
  81. package/dist-vue/_chunks/PkHeldImage-BqnlurT_.js.map +1 -0
  82. package/dist-vue/_chunks/{PkStreamingMarkdown-CJlfq7ub.js → PkStreamingMarkdown-DJG-aPx2.js} +792 -780
  83. package/dist-vue/_chunks/PkStreamingMarkdown-DJG-aPx2.js.map +1 -0
  84. package/dist-vue/_chunks/{PkSvgViewer-D-0M5bqg.js → PkSvgViewer-D1y8hZRW.js} +2 -2
  85. package/dist-vue/_chunks/{PkSvgViewer-D-0M5bqg.js.map → PkSvgViewer-D1y8hZRW.js.map} +1 -1
  86. package/dist-vue/_chunks/PkToolEditSpreadsheet-BHh7NUdR.js +40 -0
  87. package/dist-vue/_chunks/PkToolEditSpreadsheet-BHh7NUdR.js.map +1 -0
  88. package/dist-vue/_chunks/{PkToolRequestGeolocation-C8sLjD6g.js → PkToolRequestGeolocation-Ccbhljmn.js} +2 -2
  89. package/dist-vue/_chunks/{PkToolRequestGeolocation-C8sLjD6g.js.map → PkToolRequestGeolocation-Ccbhljmn.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-rbjNi_l0.js → PkToolRequestOAuthConnection-BXf5ZRzR.js} +2 -2
  91. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-rbjNi_l0.js.map → PkToolRequestOAuthConnection-BXf5ZRzR.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowArtifact-hBmAAfsd.js → PkToolShowArtifact-BsfbvfVC.js} +2 -2
  93. package/dist-vue/_chunks/{PkToolShowArtifact-hBmAAfsd.js.map → PkToolShowArtifact-BsfbvfVC.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkToolShowContactForm-BHsm_W2R.js → PkToolShowContactForm-C-YbtBlG.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowContactForm-BHsm_W2R.js.map → PkToolShowContactForm-C-YbtBlG.js.map} +1 -1
  96. package/dist-vue/_chunks/{PkToolShowDiagram-De2XvRnq.js → PkToolShowDiagram-CIHVrQ3e.js} +3 -3
  97. package/dist-vue/_chunks/{PkToolShowDiagram-De2XvRnq.js.map → PkToolShowDiagram-CIHVrQ3e.js.map} +1 -1
  98. package/dist-vue/_chunks/{PkToolShowEmail-D1mXZrT-.js → PkToolShowEmail-C591LR5N.js} +2 -2
  99. package/dist-vue/_chunks/{PkToolShowEmail-D1mXZrT-.js.map → PkToolShowEmail-C591LR5N.js.map} +1 -1
  100. package/dist-vue/_chunks/{PkToolShowForm-Ce_GpcBt.js → PkToolShowForm-BwYJhEVO.js} +6 -6
  101. package/dist-vue/_chunks/{PkToolShowForm-Ce_GpcBt.js.map → PkToolShowForm-BwYJhEVO.js.map} +1 -1
  102. package/dist-vue/_chunks/PkToolShowImageGallery-1A9zyOVn.js +88 -0
  103. package/dist-vue/_chunks/PkToolShowImageGallery-1A9zyOVn.js.map +1 -0
  104. package/dist-vue/_chunks/{PkToolShowMessage-lNPZxw2v.js → PkToolShowMessage-CbXERPHI.js} +2 -2
  105. package/dist-vue/_chunks/{PkToolShowMessage-lNPZxw2v.js.map → PkToolShowMessage-CbXERPHI.js.map} +1 -1
  106. package/dist-vue/_chunks/PkToolShowProductList-D61i6AMs.js +72 -0
  107. package/dist-vue/_chunks/PkToolShowProductList-D61i6AMs.js.map +1 -0
  108. package/dist-vue/_chunks/{PkToolShowSources-B1Nhrk7O.js → PkToolShowSources-BQpdJE_m.js} +4 -4
  109. package/dist-vue/_chunks/{PkToolShowSources-B1Nhrk7O.js.map → PkToolShowSources-BQpdJE_m.js.map} +1 -1
  110. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Bmzygdww.js → PkToolShowSuggestedReply-D3jLsbKJ.js} +2 -2
  111. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Bmzygdww.js.map → PkToolShowSuggestedReply-D3jLsbKJ.js.map} +1 -1
  112. package/dist-vue/_chunks/PkToolShowVideo-DUdkb3qb.js +141 -0
  113. package/dist-vue/_chunks/PkToolShowVideo-DUdkb3qb.js.map +1 -0
  114. package/dist-vue/_chunks/PkToolShowWebPages-BeeBiv9R.js +86 -0
  115. package/dist-vue/_chunks/PkToolShowWebPages-BeeBiv9R.js.map +1 -0
  116. package/dist-vue/_chunks/{PkUrl-E12f7rn_.js → PkUrl-CN1kkZiH.js} +2 -2
  117. package/dist-vue/_chunks/{PkUrl-E12f7rn_.js.map → PkUrl-CN1kkZiH.js.map} +1 -1
  118. package/dist-vue/_chunks/{createChatbotApiClient-B_mkyrEl.js → createChatbotApiClient-CDrs7NwO.js} +13 -9
  119. package/dist-vue/_chunks/{createChatbotApiClient-B_mkyrEl.js.map → createChatbotApiClient-CDrs7NwO.js.map} +1 -1
  120. package/dist-vue/_chunks/{useChatbotStore-DEELIJ89.js → useChatbotStore-D6YNk8Rx.js} +6 -4
  121. package/dist-vue/_chunks/useChatbotStore-D6YNk8Rx.js.map +1 -0
  122. package/dist-vue/_chunks/useShortUrlResolver-DI8ycJiO.js +71 -0
  123. package/dist-vue/_chunks/useShortUrlResolver-DI8ycJiO.js.map +1 -0
  124. package/dist-vue/_chunks/utils-roi6YVNC.js +199 -0
  125. package/dist-vue/_chunks/utils-roi6YVNC.js.map +1 -0
  126. package/dist-vue/api.js +1 -1
  127. package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +2 -0
  128. package/dist-vue/composables.js +73 -13
  129. package/dist-vue/composables.js.map +1 -1
  130. package/dist-vue/index.js +3614 -3559
  131. package/dist-vue/index.js.map +1 -1
  132. package/dist-vue/locales.js +26 -14
  133. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +6 -2
  134. package/dist-vue/packages/components/src/chat/PkChatbotFilePreview.d.ts +5 -0
  135. package/dist-vue/packages/components/src/chat/PkHeldImage.d.ts +21 -0
  136. package/dist-vue/packages/components/src/chat/PkToolEditSpreadsheet.d.ts +14 -0
  137. package/dist-vue/packages/components/src/chat/chatImagePolicy.d.ts +55 -0
  138. package/dist-vue/packages/components/src/chat/index.d.ts +1 -0
  139. package/dist-vue/packages/components/src/chat/markdownHtml.d.ts +17 -1
  140. package/dist-vue/packages/components/src/chat/utils.d.ts +8 -0
  141. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +7 -1
  142. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +18 -0
  143. package/dist-vue/packages/composable/src/useFileRow.d.ts +21 -0
  144. package/dist-vue/packages/models/src/schema/Agent.d.ts +28 -0
  145. package/dist-vue/packages/models/src/schema/Document.d.ts +173 -0
  146. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -0
  147. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -0
  148. package/dist-vue/packages/models/src/schema/Tabular.d.ts +181 -0
  149. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  150. package/dist-vue/style.css +1 -1
  151. package/package.json +1 -1
  152. package/dist/_chunks/Agent-Cu04vBnd.js.map +0 -1
  153. package/dist/_chunks/PkStreamingMarkdown-Qk9Tk_N7.js.map +0 -1
  154. package/dist/_chunks/PkToolShowImageGallery-FubPWFCb.js +0 -75
  155. package/dist/_chunks/PkToolShowImageGallery-FubPWFCb.js.map +0 -1
  156. package/dist/_chunks/PkToolShowProductList-DFy2jxn4.js +0 -65
  157. package/dist/_chunks/PkToolShowProductList-DFy2jxn4.js.map +0 -1
  158. package/dist/_chunks/PkToolShowVideo-DClps9oP.js +0 -123
  159. package/dist/_chunks/PkToolShowVideo-DClps9oP.js.map +0 -1
  160. package/dist/_chunks/PkToolShowWebPages-BOxbTe2X.js.map +0 -1
  161. package/dist/_chunks/markdown-_p-gd9w8.js.map +0 -1
  162. package/dist-vue/_chunks/Agent-KbZm8GvA.js.map +0 -1
  163. package/dist-vue/_chunks/Document-DCSWwcRE.js.map +0 -1
  164. package/dist-vue/_chunks/PkChatbot-CRb-U8e3.js +0 -272
  165. package/dist-vue/_chunks/PkChatbot-CRb-U8e3.js.map +0 -1
  166. package/dist-vue/_chunks/PkChatbotFilePreview-CwiVQDF2.js.map +0 -1
  167. package/dist-vue/_chunks/PkChatbotMessages-UT72KC_z.js +0 -769
  168. package/dist-vue/_chunks/PkChatbotMessages-UT72KC_z.js.map +0 -1
  169. package/dist-vue/_chunks/PkChatbotSteps-Y6kQ00ui.js +0 -191
  170. package/dist-vue/_chunks/PkChatbotViewChat-D3PwREDw.js +0 -784
  171. package/dist-vue/_chunks/PkChatbotViewChat-D3PwREDw.js.map +0 -1
  172. package/dist-vue/_chunks/PkChatbotViewFiles-BStYLY2B.js +0 -111
  173. package/dist-vue/_chunks/PkChatbotViewFiles-BStYLY2B.js.map +0 -1
  174. package/dist-vue/_chunks/PkStreamingMarkdown-CJlfq7ub.js.map +0 -1
  175. package/dist-vue/_chunks/PkToolShowImageGallery-DmhZLnBk.js +0 -75
  176. package/dist-vue/_chunks/PkToolShowImageGallery-DmhZLnBk.js.map +0 -1
  177. package/dist-vue/_chunks/PkToolShowProductList-BW5pRFe4.js +0 -65
  178. package/dist-vue/_chunks/PkToolShowProductList-BW5pRFe4.js.map +0 -1
  179. package/dist-vue/_chunks/PkToolShowVideo-BZOTu2Qe.js +0 -122
  180. package/dist-vue/_chunks/PkToolShowVideo-BZOTu2Qe.js.map +0 -1
  181. package/dist-vue/_chunks/PkToolShowWebPages-BiIBRV_n.js +0 -79
  182. package/dist-vue/_chunks/PkToolShowWebPages-BiIBRV_n.js.map +0 -1
  183. package/dist-vue/_chunks/useChatbotStore-DEELIJ89.js.map +0 -1
  184. package/dist-vue/_chunks/utils-CtD8DCrq.js +0 -184
  185. package/dist-vue/_chunks/utils-CtD8DCrq.js.map +0 -1
@@ -1,784 +0,0 @@
1
- import { a as e, n as t, t as n } from "./useChatbotStore-DEELIJ89.js";
2
- import { t as r } from "./src-DT8FLE4_.js";
3
- import { t as i } from "./PkChatbotMessages-UT72KC_z.js";
4
- import { t as a } from "./useLocalizedString-PfaKjIQY.js";
5
- import { a as o } from "./utils-CtD8DCrq.js";
6
- import { t as s } from "./PkAvatar-paEJByEA.js";
7
- import { n as c, t as l } from "./PkChatbotInput-D8ykcHKJ.js";
8
- import { t as u } from "./PkChatbotEmptyState-CO7-vlsZ.js";
9
- import { VvIcon as d } from "@volverjs/ui-vue/components";
10
- import { Fragment as f, Transition as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createSlots as y, createTextVNode as b, createVNode as x, defineAsyncComponent as S, defineComponent as C, isRef as w, nextTick as ee, normalizeClass as T, onBeforeUnmount as te, onMounted as ne, onScopeDispose as re, onUnmounted as ie, openBlock as E, ref as D, renderList as ae, shallowRef as O, toDisplayString as k, toValue as A, unref as j, useTemplateRef as oe, watch as se, withCtx as M } from "vue";
11
- import { useI18n as ce } from "vue-i18n";
12
- import { useDropZone as le } from "@vueuse/core";
13
- import { storeToRefs as ue } from "pinia";
14
- //#region ../../packages/composable/src/chatbot/useGreeting.ts
15
- function de(e, t) {
16
- let { locale: n, t: r, te: i } = ce({ useScope: "global" });
17
- return m(() => {
18
- let a = A(e);
19
- return N(a?.greeting?.[0]?.[n.value] || a?.initialMessage?.[n.value] || (i("message.defaultAgentWelcome") ? r("message.defaultAgentWelcome") : ""), A(t));
20
- });
21
- }
22
- function N(e, t) {
23
- return (t ? e.replace(/\{name\}/g, t) : e.replace(/[,\s]*\{name\}[!?]?/g, "")).trim();
24
- }
25
- //#endregion
26
- //#region ../../packages/components/src/chat/PkAuroraCanvas.vue?vue&type=script&setup=true&lang.ts
27
- var P = {
28
- class: "pk-aurora",
29
- "aria-hidden": "true"
30
- }, F = {
31
- key: 1,
32
- class: "pk-aurora__fallback"
33
- }, fe = "\nattribute vec2 a_position;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n}", pe = "\nprecision mediump float;\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_color;\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\n vec2 radii = vec2(u_half.x * 0.95, u_half.y * 6.5)\n * u_spread\n * breath\n * 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 // Premultiplied alpha (default canvas compositing)\n gl_FragColor = vec4(u_color * alpha, alpha);\n}", me = /* @__PURE__ */ C({
34
- __name: "PkAuroraCanvas",
35
- props: { sourceSelector: {} },
36
- setup(e) {
37
- let t = e, n = oe("canvasEl"), r = D(!1), i = null, a = 0, o = null, s = null, c = null, l = null, u = null, d = null, f = performance.now(), p = (e, t) => {
38
- if (!i) return null;
39
- let n = i.createShader(e);
40
- return !n || (i.shaderSource(n, t), i.compileShader(n), !i.getShaderParameter(n, i.COMPILE_STATUS)) ? null : n;
41
- }, m = () => {
42
- if (!n.value) return null;
43
- let e = getComputedStyle(n.value).color.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/);
44
- return e ? [
45
- Number(e[1]) / 255,
46
- Number(e[2]) / 255,
47
- Number(e[3]) / 255
48
- ] : null;
49
- }, h = () => {
50
- if (!i || !n.value) return;
51
- let e = Math.min(window.devicePixelRatio || 1, 1.5), { clientWidth: r, clientHeight: a } = n.value;
52
- n.value.width = Math.max(1, Math.round(r * e)), n.value.height = Math.max(1, Math.round(a * e)), i.viewport(0, 0, n.value.width, n.value.height);
53
- let o = n.value.parentElement?.offsetParent, s = (t.sourceSelector ? o?.querySelector(t.sourceSelector) : o) ?? o, c = n.value.getBoundingClientRect(), f = s?.getBoundingClientRect();
54
- if (f && c.width > 0) {
55
- let e = n.value.width / c.width, t = n.value.height / c.height, r = (f.left + f.width / 2 - c.left) * e, a = (c.bottom - (f.top + f.height / 2)) * t, o = f.width / 2 * e, s = f.height / 2 * t;
56
- i.uniform2f(l, r, a), i.uniform2f(u, o, s);
57
- let p = Number.parseFloat(getComputedStyle(n.value).getPropertyValue("--aurora-spread"));
58
- i.uniform1f(d, Number.isNaN(p) ? 1 : p);
59
- }
60
- v(g() ? 10 : void 0);
61
- }, g = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, v = (e) => {
62
- i && n.value && (i.uniform1f(s, e ?? (performance.now() - f) / 1e3), i.uniform2f(c, n.value.width, n.value.height), i.drawArrays(i.TRIANGLE_STRIP, 0, 4));
63
- }, y = () => {
64
- v(), a = requestAnimationFrame(y);
65
- };
66
- return ne(() => {
67
- let e = n.value;
68
- i = e?.getContext("webgl", { alpha: !0 }) ?? null;
69
- let t = m();
70
- if (!e || !i || !t) {
71
- r.value = !0;
72
- return;
73
- }
74
- let a = p(i.VERTEX_SHADER, fe), f = p(i.FRAGMENT_SHADER, pe), _ = i.createProgram();
75
- if (!a || !f || !_ || (i.attachShader(_, a), i.attachShader(_, f), i.linkProgram(_), !i.getProgramParameter(_, i.LINK_STATUS))) {
76
- r.value = !0;
77
- return;
78
- }
79
- i.useProgram(_);
80
- let b = i.createBuffer();
81
- i.bindBuffer(i.ARRAY_BUFFER, b), i.bufferData(i.ARRAY_BUFFER, new Float32Array([
82
- -1,
83
- -1,
84
- 1,
85
- -1,
86
- -1,
87
- 1,
88
- 1,
89
- 1
90
- ]), i.STATIC_DRAW);
91
- let x = i.getAttribLocation(_, "a_position");
92
- i.enableVertexAttribArray(x), i.vertexAttribPointer(x, 2, i.FLOAT, !1, 0, 0), s = i.getUniformLocation(_, "u_time"), c = i.getUniformLocation(_, "u_resolution"), l = i.getUniformLocation(_, "u_center"), u = i.getUniformLocation(_, "u_half"), d = i.getUniformLocation(_, "u_spread"), i.uniform3f(i.getUniformLocation(_, "u_color"), ...t), o = new ResizeObserver(h), o.observe(e), h(), ee(h), g() ? v(10) : y();
93
- }), te(() => {
94
- cancelAnimationFrame(a), o?.disconnect();
95
- }), ie(() => {
96
- let e = i;
97
- i = null, setTimeout(() => {
98
- e?.getExtension("WEBGL_lose_context")?.loseContext();
99
- }, 150);
100
- }), (e, t) => (E(), _("div", P, [r.value ? (E(), _("div", F)) : (E(), _("canvas", {
101
- key: 0,
102
- ref_key: "canvasEl",
103
- ref: n,
104
- class: "pk-aurora__canvas"
105
- }, null, 512))]));
106
- }
107
- }), I = .18, he = .35, L = /* @__PURE__ */ C({
108
- __name: "PkVoiceOrb",
109
- props: {
110
- sample: {},
111
- spectrum: {
112
- type: Function,
113
- default: void 0
114
- },
115
- state: {},
116
- bars: { default: 5 }
117
- },
118
- setup(e) {
119
- let t = e, n = oe("barsEl"), r = Array.from({ length: t.bars }, () => I), i, a = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === !0, o = () => {
120
- let e = Math.min(1, Math.max(0, t.sample())), n = t.spectrum?.(), i = r.length;
121
- if (!n?.length) {
122
- let t = Date.now() / 260;
123
- return Array.from({ length: i }, (n, r) => {
124
- let i = .65 + .35 * Math.sin(t + r * .9);
125
- return I + e * 2.4 * i;
126
- });
127
- }
128
- let a = Math.max(1, Math.floor(n.length / 2)), o = Math.max(1, Math.floor(a / i));
129
- return Array.from({ length: i }, (e, t) => {
130
- let r = 0;
131
- for (let e = 0; e < o; e += 1) r += n[t * o + e] ?? 0;
132
- return I + r / o / 255 * 2.2;
133
- });
134
- }, s = () => {
135
- let e = n.value?.children;
136
- e && r.forEach((t, n) => {
137
- e[n]?.style.setProperty("--pk-voice-orb-scale", String(t));
138
- });
139
- }, c = () => {
140
- let e = o();
141
- r = r.map((t, n) => t + (Math.min(1, Math.max(I, e[n] ?? I)) - t) * he), s(), i = requestAnimationFrame(c);
142
- }, l = () => {
143
- i !== void 0 && (cancelAnimationFrame(i), i = void 0);
144
- };
145
- return se(() => t.state, async (e) => {
146
- e !== "listening" && e !== "speaking" || a() ? (l(), r = r.map(() => I * 1.6), await ee(), s()) : i === void 0 && (i = requestAnimationFrame(c));
147
- }, { immediate: !0 }), te(l), (t, r) => (E(), _("div", {
148
- class: T(["pk-voice-orb", `pk-voice-orb--${e.state}`]),
149
- "aria-hidden": "true"
150
- }, [v("div", {
151
- ref_key: "barsEl",
152
- ref: n,
153
- class: "pk-voice-orb__bars"
154
- }, [(E(!0), _(f, null, ae(e.bars, (e) => (E(), _("span", {
155
- key: e,
156
- class: "pk-voice-orb__bar"
157
- }))), 128))], 512)], 2));
158
- }
159
- }), ge = {
160
- key: 0,
161
- class: "pk-voice-session__badge",
162
- "aria-hidden": "true"
163
- }, _e = {
164
- class: "pk-voice-session__status",
165
- role: "status"
166
- }, ve = {
167
- key: 0,
168
- class: "pk-voice-session__live-dot",
169
- "aria-hidden": "true"
170
- }, ye = ["title"], be = ["title"], xe = { class: "pk-voice-session__actions" }, Se = /* @__PURE__ */ C({
171
- __name: "PkVoiceSession",
172
- props: {
173
- state: {},
174
- sample: { type: Function },
175
- spectrum: { type: Function },
176
- remainingSeconds: {},
177
- muted: { type: Boolean },
178
- error: {},
179
- rawError: {},
180
- live: { type: Boolean }
181
- },
182
- emits: [
183
- "toggle-mute",
184
- "hang-up",
185
- "retry",
186
- "dismiss"
187
- ],
188
- setup(e, { emit: t }) {
189
- let n = e, r = t, { t: i } = ce({ useScope: "global" }), a = m(() => 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 = m(() => {
190
- if (n.remainingSeconds === void 0) return;
191
- let e = Math.floor(n.remainingSeconds / 60), t = n.remainingSeconds % 60;
192
- return `${e}:${String(t).padStart(2, "0")}`;
193
- }), s = m(() => n.remainingSeconds !== void 0 && n.remainingSeconds <= 30), l = m(() => !n.error && (n.state === "listening" || n.state === "speaking")), u = m(() => {
194
- if (l.value) return n.state === "speaking" ? "speaking" : n.muted ? void 0 : "listening";
195
- });
196
- return (t, n) => {
197
- let p = d;
198
- return E(), _("div", { class: T(["pk-voice-session", { "pk-voice-session--failed": !!e.error }]) }, [
199
- e.error ? (E(), _("span", ge, [x(p, { name: "ri:error-warning-line" })])) : (E(), h(L, {
200
- key: 1,
201
- state: e.state,
202
- sample: e.sample,
203
- spectrum: e.spectrum
204
- }, null, 8, [
205
- "state",
206
- "sample",
207
- "spectrum"
208
- ])),
209
- v("div", _e, [v("span", { class: T(["pk-voice-session__state", u.value && `pk-voice-session__state--${u.value}`]) }, [l.value ? (E(), _("span", ve)) : g("", !0), b(" " + k(a.value), 1)], 2), e.error ? (E(), _("p", {
210
- key: 0,
211
- class: "pk-voice-session__detail",
212
- title: e.rawError ?? e.error
213
- }, k(e.error), 9, ye)) : g("", !0)]),
214
- o.value ? (E(), _("span", {
215
- key: 2,
216
- class: T(["pk-voice-session__timer", { "pk-voice-session__timer--warning": s.value }]),
217
- title: j(i)("hint.voiceRemaining"),
218
- "aria-hidden": "true"
219
- }, k(o.value), 11, be)) : g("", !0),
220
- v("div", xe, [e.error ? (E(), _(f, { key: 0 }, [x(c, {
221
- icon: "ri:refresh-line",
222
- label: j(i)("action.retry"),
223
- onClick: n[0] ||= (e) => r("retry")
224
- }, null, 8, ["label"]), e.live ? (E(), h(c, {
225
- key: 0,
226
- icon: "ri:stop-circle-line",
227
- modifiers: "danger",
228
- title: j(i)("action.hangUp"),
229
- "aria-label": j(i)("action.hangUp"),
230
- onClick: n[1] ||= (e) => r("hang-up")
231
- }, null, 8, ["title", "aria-label"])) : (E(), h(c, {
232
- key: 1,
233
- icon: "ri:close-line",
234
- label: j(i)("action.close"),
235
- onClick: n[2] ||= (e) => r("dismiss")
236
- }, null, 8, ["label"]))], 64)) : (E(), _(f, { key: 1 }, [x(c, {
237
- icon: e.muted ? "ri:mic-off-line" : "ri:mic-line",
238
- title: e.muted ? j(i)("action.unmute") : j(i)("action.mute"),
239
- "aria-label": e.muted ? j(i)("action.unmute") : j(i)("action.mute"),
240
- "aria-pressed": e.muted,
241
- onClick: n[3] ||= (e) => r("toggle-mute")
242
- }, null, 8, [
243
- "icon",
244
- "title",
245
- "aria-label",
246
- "aria-pressed"
247
- ]), x(c, {
248
- icon: "ri:stop-circle-line",
249
- modifiers: "danger",
250
- title: j(i)("action.hangUp"),
251
- "aria-label": j(i)("action.hangUp"),
252
- onClick: n[4] ||= (e) => r("hang-up")
253
- }, null, 8, ["title", "aria-label"])], 64))])
254
- ], 2);
255
- };
256
- }
257
- }), Ce = (e) => {
258
- let t = O(), n = D("disconnected"), i = D("listening"), a = D(), o = D([]), s = D(), c = D(), l, u, d = 0, f = !1, p = () => {
259
- u &&= (clearInterval(u), void 0), s.value = void 0;
260
- }, h = (e) => {
261
- let t = Date.now() + e * 1e3, n = () => {
262
- let e = Math.max(0, Math.ceil((t - Date.now()) / 1e3));
263
- s.value = e, e === 0 && _();
264
- };
265
- n(), u = setInterval(n, 1e3);
266
- }, g = async (t) => {
267
- t && (l === t && (l = void 0), await e.closeGrant?.(t).catch(() => void 0));
268
- }, _ = async () => {
269
- d += 1, p();
270
- let e = l;
271
- l = void 0;
272
- let r = t.value;
273
- t.value = void 0, await r?.endSession().catch(() => void 0), await g(e), n.value = "disconnected", i.value = "listening";
274
- }, v = async () => {
275
- if (f || t.value || n.value === "connecting") return;
276
- a.value = void 0, o.value = [], i.value = "listening", c.value = void 0, n.value = "connecting", d += 1;
277
- let r = d, s = () => r === d && !f, u;
278
- try {
279
- let r = import("./web-Gpsdxd4m.js");
280
- r.catch(() => void 0);
281
- let d = await e.fetchGrant();
282
- if (!s()) {
283
- await e.closeGrant?.(d.sessionId).catch(() => void 0);
284
- return;
285
- }
286
- l = d.sessionId, u = d.sessionId, c.value = d.chatId;
287
- let { VoiceConversation: f } = await r;
288
- if (!s()) {
289
- await g(d.sessionId);
290
- return;
291
- }
292
- let m = await f.startSession({
293
- signedUrl: d.signedUrl,
294
- customLlmExtraBody: { voice_session_id: d.sessionId },
295
- onStatusChange: ({ status: e }) => {
296
- s() && (n.value = e);
297
- },
298
- onModeChange: ({ mode: t }) => {
299
- if (!s()) return;
300
- let n = i.value === "speaking";
301
- i.value = t, n && t !== "speaking" && e.onTurnEnd?.();
302
- },
303
- onMessage: ({ message: t, role: n }) => {
304
- if (!s()) return;
305
- let r = {
306
- role: n,
307
- text: t
308
- };
309
- o.value = [...o.value, r], e.onTranscript?.(r);
310
- },
311
- onError: (e) => {
312
- s() && (a.value = e);
313
- },
314
- onDisconnect: (r) => {
315
- s() && (p(), t.value = void 0, n.value = "disconnected", i.value = "listening", r.reason === "error" && (a.value = r.message), g(d.sessionId), e.onTurnEnd?.());
316
- }
317
- });
318
- if (!s()) {
319
- await m.endSession().catch(() => void 0), await g(d.sessionId);
320
- return;
321
- }
322
- t.value = m, h(d.maxSessionSeconds);
323
- } catch (e) {
324
- if (await g(u), !s()) return;
325
- t.value = void 0, p(), n.value = "disconnected", a.value = e instanceof Error ? e.message : String(e);
326
- }
327
- }, y = () => {
328
- a.value = void 0;
329
- }, b = (e) => {
330
- t.value?.setMicMuted(e);
331
- }, x = (e) => {
332
- let n = t.value;
333
- if (!n || !e.trim()) return !1;
334
- try {
335
- return n.sendUserMessage(e), !0;
336
- } catch (e) {
337
- return r.warn("The spoken answer could not be sent", e), !1;
338
- }
339
- }, S = (e) => {
340
- let n = t.value;
341
- if (!n) return 0;
342
- try {
343
- return e === "input" ? n.getInputVolume() : n.getOutputVolume();
344
- } catch {
345
- return 0;
346
- }
347
- }, C = (e) => {
348
- let n = t.value;
349
- if (n) try {
350
- return e === "input" ? n.getInputByteFrequencyData() : n.getOutputByteFrequencyData();
351
- } catch {
352
- return;
353
- }
354
- }, w = () => {
355
- let e = l;
356
- l = void 0, d += 1, p(), g(e);
357
- let r = t.value;
358
- t.value = void 0, r?.endSession().catch(() => void 0), n.value = "disconnected";
359
- };
360
- return typeof window < "u" && window.addEventListener("pagehide", w), re(() => {
361
- f = !0, typeof window < "u" && window.removeEventListener("pagehide", w), _();
362
- }), {
363
- status: n,
364
- mode: i,
365
- error: a,
366
- transcript: o,
367
- remainingSeconds: s,
368
- chatId: c,
369
- isActive: m(() => n.value === "connected" || n.value === "connecting"),
370
- isConnecting: m(() => n.value === "connecting"),
371
- isSpeaking: m(() => n.value === "connected" && i.value === "speaking"),
372
- isListening: m(() => n.value === "connected" && i.value === "listening"),
373
- start: v,
374
- stop: _,
375
- dismissError: y,
376
- setMuted: b,
377
- sendUserMessage: x,
378
- readLevel: S,
379
- readSpectrum: C
380
- };
381
- }, we = { class: "pk-chatbot-view-chat__input-stage" }, Te = {
382
- key: 0,
383
- class: "p-md border-t border-surface-3 text-center text-12 text-danger bg-surface-danger"
384
- }, Ee = { class: "pk-chatbot-view-chat__agent-chip" }, De = {
385
- key: 0,
386
- class: "pk-chatbot-view-chat__agent-chip-name"
387
- }, Oe = {
388
- key: 0,
389
- class: "pk-chatbot-view-chat__drop-overlay"
390
- }, ke = 3e3, Ae = 6e4, je = 3e5, Me = 6e5, Ne = /* @__PURE__ */ C({
391
- __name: "PkChatbotViewChat",
392
- props: {
393
- agentId: {},
394
- modifier: {},
395
- userName: {}
396
- },
397
- emits: ["show-info", "revise"],
398
- setup(r, { emit: c }) {
399
- let f = S(() => import("./PkToolShowForm-Ce_GpcBt.js").then((e) => e.n)), b = S(() => import("./PkToolShowContactForm-BHsm_W2R.js").then((e) => e.n)), C = S(() => import("./PkToolShowSuggestedReply-Bmzygdww.js").then((e) => e.n)), ee = S(() => import("./PkToolShowSources-B1Nhrk7O.js").then((e) => e.n)), ne = S(() => import("./PkToolRequestGeolocation-C8sLjD6g.js")), re = S(() => import("./PkToolRequestOAuthConnection-rbjNi_l0.js")), ie = S(() => import("./PkToolShowLocation-Bv6sLN5P.js").then((e) => e.n)), ae = S(() => import("./PkToolShowDiagram-De2XvRnq.js")), O = r, A = c, N = t(O.agentId), { agentInterface: P, agentFileUpload: F, agentVoice: fe, actions: pe, revisedAnswers: I, messages: he, chat: L, messageFeedbacks: ge, feedbackDialogMessage: _e, isFeedbackSubmitting: ve, isFeedbackSubmitted: ye, feedbackSubmitError: be, isLeadSubmitted: xe, isLoadingSubmitLead: Ne, submitLeadError: Pe, input: R, inputMessagePlaceholder: Fe, isConversationBlocked: Ie, baseUrl: Le, pendingAttachments: Re, isAttachmentLimitReached: ze, fileLimitError: Be, apiClient: z, isDark: Ve } = ue(N), { handleSubmit: He, stopGeneration: Ue, regenerate: We, onUpvote: Ge, onDownvote: Ke, onFeedback: qe, onFeedbackSubmit: Je, onLeadSubmit: Ye, startNewChat: Xe, addToolOutput: B, addToolApprovalResponse: Ze, handleFileSelect: Qe, clearFileLimitError: $e, refreshMessages: et, appendMessage: tt } = N, { t: V } = ce({ useScope: "global" }), nt = m(() => {
400
- let e = Be.value;
401
- if (e) return e.reason === "per-chat" ? V("message.fileLimitPerChat", { max: e.max }) : V("message.fileLimitPerMessage", { max: e.max });
402
- }), rt = a(() => P.value?.dismissableNotice), it = m(() => he.value.some((e) => e.role === "user")), at = m(() => O.modifier === "fullscreen" && !it.value), ot = de(P, () => O.userName), st = oe("chatViewEl"), ct = async (e) => (await z.value.expandSourceContext(O.agentId, e.documentId, e.chunkIndex)).content, lt = async (e) => {
403
- let t = await z.value.downloadSourceDocument(O.agentId, e);
404
- window.open(t.downloadUrl, "_blank");
405
- }, { isOverDropZone: ut } = le(st, {
406
- dataTypes: m(() => F.value?.allowedMimeTypes ?? []),
407
- onDrop: (e) => {
408
- if (F.value?.enabled && e) for (let t of e) Qe(t);
409
- }
410
- }), H = D(!1), U = !1, W = D(!1), dt = [
411
- 3e3,
412
- 5e3,
413
- 1e4
414
- ], G, K, q = !1, J = 0, ft = !1;
415
- function pt() {
416
- clearTimeout(G), G = void 0, K = void 0, q = !1, J = 0, W.value = !1;
417
- }
418
- function Y(e) {
419
- U || (clearTimeout(G), G = setTimeout(() => {
420
- mt();
421
- }, e));
422
- }
423
- async function mt() {
424
- if (U || ft) return;
425
- ft = !0;
426
- let e;
427
- try {
428
- e = await et();
429
- } finally {
430
- ft = !1;
431
- }
432
- if (U) return;
433
- if (e === "caught-up" && (W.value = !1), X.isActive.value) {
434
- K = void 0, q = !1, J = 0, Y(ke);
435
- return;
436
- }
437
- K === void 0 && (K = Date.now(), q = !!X.error.value);
438
- let t = Date.now() - K;
439
- if (e === "caught-up" && t >= (q ? je : Ae) || t >= Me) {
440
- pt();
441
- return;
442
- }
443
- let n = dt[Math.min(J, dt.length - 1)];
444
- J += 1, Y(n);
445
- }
446
- let ht = (e = 1200) => {
447
- Y(e);
448
- }, X = Ce({
449
- fetchGrant: async () => {
450
- let e = await z.value.createVoiceSession(O.agentId, N.localChatId, {
451
- deviceContext: N.buildDeviceContext(),
452
- externalContext: N.externalContext
453
- });
454
- return e.chatId !== N.localChatId && (N.localChatId = e.chatId), e;
455
- },
456
- closeGrant: (e) => z.value.closeVoiceSession(O.agentId, e),
457
- onTranscript: (t) => {
458
- t.role === "user" ? (W.value = !0, tt({
459
- id: `${n}user-${e()}`,
460
- role: "user",
461
- parts: [{
462
- type: "text",
463
- text: t.text
464
- }]
465
- })) : W.value = !1;
466
- },
467
- onTurnEnd: () => {
468
- ht();
469
- }
470
- });
471
- se(() => X.error.value, (e) => {
472
- e && (W.value = !1);
473
- });
474
- let gt = m(() => fe.value?.enabled === !0), _t = m(() => X.error.value ? "error" : X.isConnecting.value ? "connecting" : X.isSpeaking.value ? "speaking" : X.isActive.value ? "listening" : "idle"), vt = m(() => {
475
- let e = X.error.value;
476
- if (e) return /took too long/i.test(e) ? V("message.voiceTookTooLong") : /cascade|no response|custom_llm_error/i.test(e) ? V("message.voiceNoAnswer") : V("message.voiceInterrupted");
477
- }), yt = m(() => X.isSpeaking.value ? "output" : "input"), bt = () => X.readLevel(yt.value), xt = () => X.readSpectrum(yt.value), St = async () => {
478
- H.value = !1, await X.start(), X.isActive.value && (pt(), Y(ke));
479
- }, Ct = async () => {
480
- W.value = !1, await X.stop(), !U && ht(0);
481
- }, wt = () => {
482
- X.dismissError();
483
- }, Tt = async () => {
484
- X.dismissError(), await X.stop(), await St();
485
- }, Z = (e) => e?.toolCallId ?? "", Q = D(/* @__PURE__ */ new Set()), Et = (e) => Q.value.has(Z(e)), Dt = D(/* @__PURE__ */ new Map()), $ = (e, t) => X.isActive.value ? (X.sendUserMessage(t) && (Q.value = new Set(Q.value).add(Z(e)), ht()), !0) : !1, Ot = (e, t, n) => {
486
- $(t, o(t, n)) || B({
487
- tool: e,
488
- toolCallId: Z(t),
489
- output: n
490
- });
491
- }, kt = (e) => {
492
- let t = e.confirmed ? V("message.voiceConfirmed") : V("message.voiceCancelled");
493
- $({ toolCallId: e.toolCallId }, t) ? Q.value.has(e.toolCallId) && (Dt.value = new Map(Dt.value).set(e.toolCallId, e.confirmed)) : B({
494
- tool: "requestConfirm",
495
- toolCallId: e.toolCallId,
496
- output: e.confirmed ? "confirmed" : "cancelled"
497
- });
498
- }, At = (e, t) => {
499
- $(e, t) || (R.value = t, He());
500
- }, jt = (e, t) => {
501
- let n = t.error ? V("message.voiceLocationRefused") : V("message.voiceLocationShared", { place: t.displayName ?? `${t.latitude}, ${t.longitude}` });
502
- $(e, n) || B({
503
- tool: "requestGeolocation",
504
- toolCallId: Z(e),
505
- output: t
506
- });
507
- }, Mt = (e, t) => {
508
- $(e, V("message.voiceConnectionDone")) || B({
509
- tool: "requestOAuthConnection",
510
- toolCallId: Z(e),
511
- output: {
512
- connected: !0,
513
- mcpServerId: t
514
- }
515
- });
516
- }, Nt = () => {
517
- H.value = !H.value, X.setMuted(H.value);
518
- };
519
- return te(() => {
520
- U = !0, pt();
521
- }), (e, t) => {
522
- let n = d;
523
- return E(), _("div", {
524
- ref_key: "chatViewEl",
525
- ref: st,
526
- class: T(["pk-chatbot-view-chat", {
527
- "pk-chatbot-view-chat--dragover": j(ut) && j(F)?.enabled,
528
- "pk-chatbot-view-chat--empty": at.value
529
- }])
530
- }, [
531
- x(p, {
532
- name: "pk-chatbot-view-chat-fade",
533
- mode: "out-in"
534
- }, {
535
- default: M(() => [at.value ? (E(), h(u, {
536
- key: 0,
537
- greeting: j(ot),
538
- logo: j(P)?.logo,
539
- name: j(N).name
540
- }, null, 8, [
541
- "greeting",
542
- "logo",
543
- "name"
544
- ])) : (E(), h(i, {
545
- key: 1,
546
- class: "flex flex-col flex-1 min-h-0 p-md overflow-y-auto",
547
- interactive: "",
548
- messages: j(he),
549
- "confirm-verdicts-on-call": Dt.value,
550
- status: j(L).status,
551
- error: j(L).error,
552
- "main-color": j(P)?.mainColor,
553
- "text-color": j(P)?.textColor,
554
- "revised-answers": j(I),
555
- actions: j(pe),
556
- "message-feedbacks": j(ge),
557
- "feedback-message-id": j(_e)?.id,
558
- "feedback-loading": j(ve),
559
- "feedback-submitted": j(ye),
560
- "feedback-error": j(be),
561
- "show-extended-steps": j(P)?.showExtendedSteps,
562
- "awaiting-spoken-answer": W.value,
563
- "is-dark": j(Ve),
564
- "show-scroll-to-bottom": r.modifier === "fullscreen",
565
- onFeedbackSubmit: t[0] ||= (e) => j(Je)(e),
566
- onFeedbackClose: t[1] ||= (e) => _e.value = void 0,
567
- onRegenerate: j(We),
568
- onAutoRetry: j(We),
569
- onResetChat: j(Xe),
570
- onShowInfo: t[2] ||= (e) => A("show-info", e),
571
- onRevise: t[3] ||= (e) => A("revise", e),
572
- onUpvote: j(Ge),
573
- onDownvote: j(Ke),
574
- onFeedback: j(qe),
575
- onApprovalRespond: j(Ze),
576
- onConfirmRespond: kt
577
- }, {
578
- "tool-showContactForm": M(({ part: e }) => [x(j(b), {
579
- part: e,
580
- readonly: !j(Le),
581
- submitted: j(xe),
582
- loading: j(Ne),
583
- error: j(Pe),
584
- "privacy-policy-notice": j(P)?.privacyPolicyNotice,
585
- onSubmit: j(Ye)
586
- }, null, 8, [
587
- "part",
588
- "readonly",
589
- "submitted",
590
- "loading",
591
- "error",
592
- "privacy-policy-notice",
593
- "onSubmit"
594
- ])]),
595
- "tool-showSuggestedReply": M(({ part: e }) => [x(j(C), {
596
- part: e,
597
- onSelect: (t) => At(e, t)
598
- }, null, 8, ["part", "onSelect"])]),
599
- "tool-showSources": M(({ part: e }) => [x(j(ee), {
600
- part: e,
601
- "on-expand-context": ct,
602
- "on-download": lt
603
- }, null, 8, ["part"])]),
604
- "tool-showForm": M(({ part: e }) => [x(p, { mode: "out-in" }, {
605
- default: M(() => [x(j(f), {
606
- part: e,
607
- answered: Et(e),
608
- onSelect: (t) => Ot("showForm", e, t)
609
- }, null, 8, [
610
- "part",
611
- "answered",
612
- "onSelect"
613
- ])]),
614
- _: 2
615
- }, 1024)]),
616
- "tool-showMultipleChoice": M(({ part: e }) => [x(p, { mode: "out-in" }, {
617
- default: M(() => [x(j(f), {
618
- part: e,
619
- "allow-custom-answer": "",
620
- answered: Et(e),
621
- onSelect: (t) => Ot("showMultipleChoice", e, t)
622
- }, null, 8, [
623
- "part",
624
- "answered",
625
- "onSelect"
626
- ])]),
627
- _: 2
628
- }, 1024)]),
629
- "tool-requestOAuthConnection": M(({ part: e }) => [x(j(re), {
630
- part: e,
631
- "backend-url": j(Le),
632
- "resolve-connection": (e) => j(z).getOAuthAuthorizeUrl(O.agentId, e),
633
- "check-connection": (e) => j(z).getOAuthConnectionStatus(O.agentId, e),
634
- onConnected: (t) => Mt(e, t)
635
- }, null, 8, [
636
- "part",
637
- "backend-url",
638
- "resolve-connection",
639
- "check-connection",
640
- "onConnected"
641
- ])]),
642
- "tool-requestGeolocation": M(({ part: e }) => [x(j(ne), {
643
- part: e,
644
- "call-live": j(X).isActive.value,
645
- "reverse-geocode": (e, t) => j(z).reverseGeocode(e, t),
646
- onResult: (t) => jt(e, t)
647
- }, null, 8, [
648
- "part",
649
- "call-live",
650
- "reverse-geocode",
651
- "onResult"
652
- ])]),
653
- "tool-showLocation": M(({ part: e }) => [x(j(ie), {
654
- part: e,
655
- "is-dark": j(Ve),
656
- "main-color": j(P)?.mainColor,
657
- "forward-geocode": (e, t) => j(z).forwardGeocode(e, t)
658
- }, null, 8, [
659
- "part",
660
- "is-dark",
661
- "main-color",
662
- "forward-geocode"
663
- ])]),
664
- "tool-showDiagram": M(({ part: e }) => [x(j(ae), {
665
- part: e,
666
- "is-dark": j(Ve)
667
- }, null, 8, ["part", "is-dark"])]),
668
- _: 1
669
- }, 8, [
670
- "messages",
671
- "confirm-verdicts-on-call",
672
- "status",
673
- "error",
674
- "main-color",
675
- "text-color",
676
- "revised-answers",
677
- "actions",
678
- "message-feedbacks",
679
- "feedback-message-id",
680
- "feedback-loading",
681
- "feedback-submitted",
682
- "feedback-error",
683
- "show-extended-steps",
684
- "awaiting-spoken-answer",
685
- "is-dark",
686
- "show-scroll-to-bottom",
687
- "onRegenerate",
688
- "onAutoRetry",
689
- "onResetChat",
690
- "onUpvote",
691
- "onDownvote",
692
- "onFeedback",
693
- "onApprovalRespond"
694
- ]))]),
695
- _: 1
696
- }),
697
- v("div", we, [x(p, { name: "pk-chatbot-view-chat-fade" }, {
698
- default: M(() => [at.value ? (E(), h(me, {
699
- key: 0,
700
- class: "pk-chatbot-view-chat__aurora",
701
- "source-selector": ".pk-chatbot-input__form"
702
- })) : g("", !0)]),
703
- _: 1
704
- }), j(Ie) ? (E(), _("div", Te, k(j(V)("message.chatErrorConversationBlocked")), 1)) : _t.value === "idle" ? (E(), h(l, {
705
- key: 2,
706
- modelValue: j(R),
707
- "onUpdate:modelValue": t[4] ||= (e) => w(R) ? R.value = e : null,
708
- "pending-attachments": j(Re),
709
- "onUpdate:pendingAttachments": t[5] ||= (e) => w(Re) ? Re.value = e : null,
710
- placeholder: j(Fe),
711
- "dismissable-notice": j(rt) && j(L).messages.length <= 1 ? j(rt) : void 0,
712
- status: j(L).status,
713
- "max-message-length": j(P)?.maxMessageLength,
714
- "file-upload": j(F),
715
- "attachment-limit-reached": j(ze),
716
- "attachment-notice": nt.value,
717
- "voice-enabled": gt.value,
718
- onStopGeneration: j(Ue),
719
- onSubmit: j(He),
720
- onFileSelect: j(Qe),
721
- onDismissAttachmentNotice: j($e),
722
- onVoiceStart: St
723
- }, y({ _: 2 }, [r.modifier === "fullscreen" ? {
724
- name: "prepend",
725
- fn: M(() => [v("span", Ee, [x(s, {
726
- modifiers: "surface",
727
- class: "pk-chatbot-view-chat__agent-chip-avatar",
728
- "img-src": j(P)?.logo,
729
- name: j(N).name
730
- }, null, 8, ["img-src", "name"]), j(N).name ? (E(), _("strong", De, k(j(N).name), 1)) : g("", !0)])]),
731
- key: "0"
732
- } : void 0]), 1032, [
733
- "modelValue",
734
- "pending-attachments",
735
- "placeholder",
736
- "dismissable-notice",
737
- "status",
738
- "max-message-length",
739
- "file-upload",
740
- "attachment-limit-reached",
741
- "attachment-notice",
742
- "voice-enabled",
743
- "onStopGeneration",
744
- "onSubmit",
745
- "onFileSelect",
746
- "onDismissAttachmentNotice"
747
- ])) : (E(), h(Se, {
748
- key: 1,
749
- state: _t.value,
750
- sample: bt,
751
- spectrum: xt,
752
- "remaining-seconds": j(X).remainingSeconds.value,
753
- muted: H.value,
754
- error: vt.value,
755
- "raw-error": j(X).error.value,
756
- live: j(X).isActive.value,
757
- class: "pk-chatbot-view-chat__voice",
758
- onToggleMute: Nt,
759
- onHangUp: Ct,
760
- onRetry: Tt,
761
- onDismiss: wt
762
- }, null, 8, [
763
- "state",
764
- "remaining-seconds",
765
- "muted",
766
- "error",
767
- "raw-error",
768
- "live"
769
- ]))]),
770
- x(p, null, {
771
- default: M(() => [j(ut) && j(F)?.enabled ? (E(), _("div", Oe, [x(n, {
772
- name: "ri:upload-cloud-2-line",
773
- class: "pk-chatbot-view-chat__drop-overlay-icon"
774
- }), v("span", null, k(j(V)("action.dropFile")), 1)])) : g("", !0)]),
775
- _: 1
776
- })
777
- ], 2);
778
- };
779
- }
780
- });
781
- //#endregion
782
- export { me as i, Se as n, L as r, Ne as t };
783
-
784
- //# sourceMappingURL=PkChatbotViewChat-D3PwREDw.js.map