@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
@@ -0,0 +1,789 @@
1
+ import { a as e, n as t, t as n } from "./useChatbotStore-D6YNk8Rx.js";
2
+ import { t as r } from "./src-DT8FLE4_.js";
3
+ import { t as i } from "./PkChatbotMessages-3RZER9PO.js";
4
+ import { t as a } from "./useLocalizedString-PfaKjIQY.js";
5
+ import { f as o, o as s } from "./utils-roi6YVNC.js";
6
+ import { t as c } from "./PkAvatar-paEJByEA.js";
7
+ import { n as l, t as u } from "./PkChatbotInput-C5l6QDQY.js";
8
+ import { t as d } from "./PkChatbotEmptyState-BY3f3T0T.js";
9
+ import { VvIcon as f } from "@volverjs/ui-vue/components";
10
+ import { Fragment as p, Transition as m, computed as h, createBlock as g, createCommentVNode as _, createElementBlock as v, createElementVNode as y, createSlots as ee, createTextVNode as b, createVNode as x, defineAsyncComponent as S, defineComponent as C, isRef as te, nextTick as w, normalizeClass as T, onBeforeUnmount as ne, onMounted as re, onScopeDispose as ie, onUnmounted as ae, openBlock as E, ref as D, renderList as oe, shallowRef as se, toDisplayString as O, toValue as k, unref as A, useTemplateRef as ce, watch as le, withCtx as j } from "vue";
11
+ import { useI18n as ue } from "vue-i18n";
12
+ import { useDropZone as de } from "@vueuse/core";
13
+ import { storeToRefs as fe } from "pinia";
14
+ //#region ../../packages/composable/src/chatbot/useGreeting.ts
15
+ function pe(e, t) {
16
+ let { locale: n, t: r, te: i } = ue({ useScope: "global" });
17
+ return h(() => {
18
+ let a = k(e);
19
+ return me(a?.greeting?.[0]?.[n.value] || a?.initialMessage?.[n.value] || (i("message.defaultAgentWelcome") ? r("message.defaultAgentWelcome") : ""), k(t));
20
+ });
21
+ }
22
+ function me(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 M = {
28
+ class: "pk-aurora",
29
+ "aria-hidden": "true"
30
+ }, N = {
31
+ key: 1,
32
+ class: "pk-aurora__fallback"
33
+ }, P = "\nattribute vec2 a_position;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n}", he = "\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}", ge = /* @__PURE__ */ C({
34
+ __name: "PkAuroraCanvas",
35
+ props: { sourceSelector: {} },
36
+ setup(e) {
37
+ let t = e, n = ce("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
+ _(g() ? 10 : void 0);
61
+ }, g = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, _ = (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
+ _(), a = requestAnimationFrame(y);
65
+ };
66
+ return re(() => {
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, P), f = p(i.FRAGMENT_SHADER, he), v = i.createProgram();
75
+ if (!a || !f || !v || (i.attachShader(v, a), i.attachShader(v, f), i.linkProgram(v), !i.getProgramParameter(v, i.LINK_STATUS))) {
76
+ r.value = !0;
77
+ return;
78
+ }
79
+ i.useProgram(v);
80
+ let ee = i.createBuffer();
81
+ i.bindBuffer(i.ARRAY_BUFFER, ee), 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 b = i.getAttribLocation(v, "a_position");
92
+ i.enableVertexAttribArray(b), i.vertexAttribPointer(b, 2, i.FLOAT, !1, 0, 0), s = i.getUniformLocation(v, "u_time"), c = i.getUniformLocation(v, "u_resolution"), l = i.getUniformLocation(v, "u_center"), u = i.getUniformLocation(v, "u_half"), d = i.getUniformLocation(v, "u_spread"), i.uniform3f(i.getUniformLocation(v, "u_color"), ...t), o = new ResizeObserver(h), o.observe(e), h(), w(h), g() ? _(10) : y();
93
+ }), ne(() => {
94
+ cancelAnimationFrame(a), o?.disconnect();
95
+ }), ae(() => {
96
+ let e = i;
97
+ i = null, setTimeout(() => {
98
+ e?.getExtension("WEBGL_lose_context")?.loseContext();
99
+ }, 150);
100
+ }), (e, t) => (E(), v("div", M, [r.value ? (E(), v("div", N)) : (E(), v("canvas", {
101
+ key: 0,
102
+ ref_key: "canvasEl",
103
+ ref: n,
104
+ class: "pk-aurora__canvas"
105
+ }, null, 512))]));
106
+ }
107
+ }), F = .18, _e = .35, I = /* @__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 = ce("barsEl"), r = Array.from({ length: t.bars }, () => F), 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 F + 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 F + 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(F, e[n] ?? F)) - t) * _e), s(), i = requestAnimationFrame(c);
142
+ }, l = () => {
143
+ i !== void 0 && (cancelAnimationFrame(i), i = void 0);
144
+ };
145
+ return le(() => t.state, async (e) => {
146
+ e !== "listening" && e !== "speaking" || a() ? (l(), r = r.map(() => F * 1.6), await w(), s()) : i === void 0 && (i = requestAnimationFrame(c));
147
+ }, { immediate: !0 }), ne(l), (t, r) => (E(), v("div", {
148
+ class: T(["pk-voice-orb", `pk-voice-orb--${e.state}`]),
149
+ "aria-hidden": "true"
150
+ }, [y("div", {
151
+ ref_key: "barsEl",
152
+ ref: n,
153
+ class: "pk-voice-orb__bars"
154
+ }, [(E(!0), v(p, null, oe(e.bars, (e) => (E(), v("span", {
155
+ key: e,
156
+ class: "pk-voice-orb__bar"
157
+ }))), 128))], 512)], 2));
158
+ }
159
+ }), L = {
160
+ key: 0,
161
+ class: "pk-voice-session__badge",
162
+ "aria-hidden": "true"
163
+ }, ve = {
164
+ class: "pk-voice-session__status",
165
+ role: "status"
166
+ }, ye = {
167
+ key: 0,
168
+ class: "pk-voice-session__live-dot",
169
+ "aria-hidden": "true"
170
+ }, be = ["title"], xe = ["title"], Se = { class: "pk-voice-session__actions" }, Ce = /* @__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 } = ue({ useScope: "global" }), a = h(() => 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 = h(() => {
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 = h(() => n.remainingSeconds !== void 0 && n.remainingSeconds <= 30), c = h(() => !n.error && (n.state === "listening" || n.state === "speaking")), u = h(() => {
194
+ if (c.value) return n.state === "speaking" ? "speaking" : n.muted ? void 0 : "listening";
195
+ });
196
+ return (t, n) => {
197
+ let d = f;
198
+ return E(), v("div", { class: T(["pk-voice-session", { "pk-voice-session--failed": !!e.error }]) }, [
199
+ e.error ? (E(), v("span", L, [x(d, { name: "ri:error-warning-line" })])) : (E(), g(I, {
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
+ y("div", ve, [y("span", { class: T(["pk-voice-session__state", u.value && `pk-voice-session__state--${u.value}`]) }, [c.value ? (E(), v("span", ye)) : _("", !0), b(" " + O(a.value), 1)], 2), e.error ? (E(), v("p", {
210
+ key: 0,
211
+ class: "pk-voice-session__detail",
212
+ title: e.rawError ?? e.error
213
+ }, O(e.error), 9, be)) : _("", !0)]),
214
+ o.value ? (E(), v("span", {
215
+ key: 2,
216
+ class: T(["pk-voice-session__timer", { "pk-voice-session__timer--warning": s.value }]),
217
+ title: A(i)("hint.voiceRemaining"),
218
+ "aria-hidden": "true"
219
+ }, O(o.value), 11, xe)) : _("", !0),
220
+ y("div", Se, [e.error ? (E(), v(p, { key: 0 }, [x(l, {
221
+ icon: "ri:refresh-line",
222
+ label: A(i)("action.retry"),
223
+ onClick: n[0] ||= (e) => r("retry")
224
+ }, null, 8, ["label"]), e.live ? (E(), g(l, {
225
+ key: 0,
226
+ icon: "ri:stop-circle-line",
227
+ modifiers: "danger",
228
+ title: A(i)("action.hangUp"),
229
+ "aria-label": A(i)("action.hangUp"),
230
+ onClick: n[1] ||= (e) => r("hang-up")
231
+ }, null, 8, ["title", "aria-label"])) : (E(), g(l, {
232
+ key: 1,
233
+ icon: "ri:close-line",
234
+ label: A(i)("action.close"),
235
+ onClick: n[2] ||= (e) => r("dismiss")
236
+ }, null, 8, ["label"]))], 64)) : (E(), v(p, { key: 1 }, [x(l, {
237
+ icon: e.muted ? "ri:mic-off-line" : "ri:mic-line",
238
+ title: e.muted ? A(i)("action.unmute") : A(i)("action.mute"),
239
+ "aria-label": e.muted ? A(i)("action.unmute") : A(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(l, {
248
+ icon: "ri:stop-circle-line",
249
+ modifiers: "danger",
250
+ title: A(i)("action.hangUp"),
251
+ "aria-label": A(i)("action.hangUp"),
252
+ onClick: n[4] ||= (e) => r("hang-up")
253
+ }, null, 8, ["title", "aria-label"])], 64))])
254
+ ], 2);
255
+ };
256
+ }
257
+ }), we = (e) => {
258
+ let t = se(), 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
+ }, m = (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 h = 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 h.endSession().catch(() => void 0), await g(d.sessionId);
320
+ return;
321
+ }
322
+ t.value = h, m(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
+ }, ee = (e) => {
330
+ t.value?.setMicMuted(e);
331
+ }, b = (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
+ }, x = (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
+ }, S = (e) => {
348
+ let n = t.value;
349
+ if (n) try {
350
+ return e === "input" ? n.getInputByteFrequencyData() : n.getOutputByteFrequencyData();
351
+ } catch {
352
+ return;
353
+ }
354
+ }, C = () => {
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", C), ie(() => {
361
+ f = !0, typeof window < "u" && window.removeEventListener("pagehide", C), _();
362
+ }), {
363
+ status: n,
364
+ mode: i,
365
+ error: a,
366
+ transcript: o,
367
+ remainingSeconds: s,
368
+ chatId: c,
369
+ isActive: h(() => n.value === "connected" || n.value === "connecting"),
370
+ isConnecting: h(() => n.value === "connecting"),
371
+ isSpeaking: h(() => n.value === "connected" && i.value === "speaking"),
372
+ isListening: h(() => n.value === "connected" && i.value === "listening"),
373
+ start: v,
374
+ stop: _,
375
+ dismissError: y,
376
+ setMuted: ee,
377
+ sendUserMessage: b,
378
+ readLevel: x,
379
+ readSpectrum: S
380
+ };
381
+ }, Te = { class: "pk-chatbot-view-chat__input-stage" }, Ee = {
382
+ key: 0,
383
+ class: "p-md border-t border-surface-3 text-center text-12 text-danger bg-surface-danger"
384
+ }, De = { class: "pk-chatbot-view-chat__agent-chip" }, Oe = {
385
+ key: 0,
386
+ class: "pk-chatbot-view-chat__agent-chip-name"
387
+ }, ke = {
388
+ key: 0,
389
+ class: "pk-chatbot-view-chat__drop-overlay"
390
+ }, Ae = 3e3, je = 6e4, Me = 3e5, Ne = 6e5, Pe = /* @__PURE__ */ C({
391
+ __name: "PkChatbotViewChat",
392
+ props: {
393
+ agentId: {},
394
+ modifier: {},
395
+ userName: {}
396
+ },
397
+ emits: ["show-info", "revise"],
398
+ setup(r, { emit: l }) {
399
+ let p = S(() => import("./PkToolShowForm-BwYJhEVO.js").then((e) => e.n)), b = S(() => import("./PkToolShowContactForm-C-YbtBlG.js").then((e) => e.n)), C = S(() => import("./PkToolShowSuggestedReply-D3jLsbKJ.js").then((e) => e.n)), w = S(() => import("./PkToolShowSources-BQpdJE_m.js").then((e) => e.n)), re = S(() => import("./PkToolRequestGeolocation-Ccbhljmn.js")), ie = S(() => import("./PkToolRequestOAuthConnection-BXf5ZRzR.js")), ae = S(() => import("./PkToolShowLocation-Bv6sLN5P.js").then((e) => e.n)), oe = S(() => import("./PkToolShowDiagram-CIHVrQ3e.js")), se = S(() => import("./PkToolEditSpreadsheet-BHh7NUdR.js")), k = r, me = l, M = t(k.agentId), { agentInterface: N, agentFileUpload: P, agentVoice: he, actions: F, revisedAnswers: _e, messages: I, chat: L, messageFeedbacks: ve, feedbackDialogMessage: ye, isFeedbackSubmitting: be, isFeedbackSubmitted: xe, feedbackSubmitError: Se, isLeadSubmitted: Pe, isLoadingSubmitLead: Fe, submitLeadError: Ie, input: R, inputMessagePlaceholder: Le, isConversationBlocked: Re, baseUrl: ze, pendingAttachments: Be, isAttachmentLimitReached: Ve, fileLimitError: He, apiClient: z, isDark: Ue } = fe(M), We = (e) => z.value.getMediaDownloadUrl(k.agentId, M.localChatId, e), { handleSubmit: Ge, stopGeneration: Ke, regenerate: qe, onUpvote: Je, onDownvote: Ye, onFeedback: Xe, onFeedbackSubmit: Ze, onLeadSubmit: Qe, startNewChat: $e, addToolOutput: B, addToolApprovalResponse: et, handleFileSelect: tt, clearFileLimitError: nt, refreshMessages: rt, appendMessage: it } = M, { t: V } = ue({ useScope: "global" }), at = h(() => {
400
+ let e = He.value;
401
+ if (e) return e.reason === "per-chat" ? V("message.fileLimitPerChat", { max: e.max }) : V("message.fileLimitPerMessage", { max: e.max });
402
+ }), ot = a(() => N.value?.dismissableNotice), st = h(() => I.value.some((e) => e.role === "user")), ct = h(() => k.modifier === "fullscreen" && !st.value), lt = pe(N, () => k.userName), ut = ce("chatViewEl"), dt = async (e) => (await z.value.expandSourceContext(k.agentId, e.documentId, e.chunkIndex)).content, ft = async (e) => {
403
+ let t = await z.value.downloadSourceDocument(k.agentId, e);
404
+ window.open(t.downloadUrl, "_blank");
405
+ }, { isOverDropZone: pt } = de(ut, {
406
+ dataTypes: h(() => P.value?.allowedMimeTypes ?? []),
407
+ onDrop: (e) => {
408
+ if (P.value?.enabled && e) for (let t of e) tt(t);
409
+ }
410
+ }), H = D(!1), U = !1, W = D(!1), mt = [
411
+ 3e3,
412
+ 5e3,
413
+ 1e4
414
+ ], G, K, q = !1, J = 0, ht = !1;
415
+ function gt() {
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
+ _t();
421
+ }, e));
422
+ }
423
+ async function _t() {
424
+ if (U || ht) return;
425
+ ht = !0;
426
+ let e;
427
+ try {
428
+ e = await rt();
429
+ } finally {
430
+ ht = !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(Ae);
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 ? Me : je) || t >= Ne) {
440
+ gt();
441
+ return;
442
+ }
443
+ let n = mt[Math.min(J, mt.length - 1)];
444
+ J += 1, Y(n);
445
+ }
446
+ let vt = (e = 1200) => {
447
+ Y(e);
448
+ }, X = we({
449
+ fetchGrant: async () => {
450
+ let e = await z.value.createVoiceSession(k.agentId, M.localChatId, {
451
+ deviceContext: M.buildDeviceContext(),
452
+ externalContext: M.externalContext
453
+ });
454
+ return e.chatId !== M.localChatId && (M.localChatId = e.chatId), e;
455
+ },
456
+ closeGrant: (e) => z.value.closeVoiceSession(k.agentId, e),
457
+ onTranscript: (t) => {
458
+ t.role === "user" ? (W.value = !0, it({
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
+ vt();
469
+ }
470
+ });
471
+ le(() => X.error.value, (e) => {
472
+ e && (W.value = !1);
473
+ });
474
+ let yt = h(() => he.value?.enabled === !0), bt = h(() => X.error.value ? "error" : X.isConnecting.value ? "connecting" : X.isSpeaking.value ? "speaking" : X.isActive.value ? "listening" : "idle"), xt = h(() => {
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
+ }), St = h(() => X.isSpeaking.value ? "output" : "input"), Ct = () => X.readLevel(St.value), wt = () => X.readSpectrum(St.value), Tt = async () => {
478
+ H.value = !1, await X.start(), X.isActive.value && (gt(), Y(Ae));
479
+ }, Et = async () => {
480
+ W.value = !1, await X.stop(), !U && vt(0);
481
+ }, Dt = () => {
482
+ X.dismissError();
483
+ }, Ot = async () => {
484
+ X.dismissError(), await X.stop(), await Tt();
485
+ }, Z = (e) => e?.toolCallId ?? "", Q = D(/* @__PURE__ */ new Set()), kt = (e) => Q.value.has(Z(e)), At = D(/* @__PURE__ */ new Map()), $ = (e, t) => X.isActive.value ? (X.sendUserMessage(t) && (Q.value = new Set(Q.value).add(Z(e)), vt()), !0) : !1, jt = (e, t, n) => {
486
+ $(t, s(t, n)) || B({
487
+ tool: e,
488
+ toolCallId: Z(t),
489
+ output: n
490
+ });
491
+ }, Mt = (e) => {
492
+ let t = e.confirmed ? V("message.voiceConfirmed") : V("message.voiceCancelled");
493
+ $({ toolCallId: e.toolCallId }, t) ? Q.value.has(e.toolCallId) && (At.value = new Map(At.value).set(e.toolCallId, e.confirmed)) : B({
494
+ tool: "requestConfirm",
495
+ toolCallId: e.toolCallId,
496
+ output: e.confirmed ? "confirmed" : "cancelled"
497
+ });
498
+ }, Nt = (e, t) => {
499
+ $(e, t) || (R.value = t, Ge());
500
+ }, Pt = (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
+ }, Ft = (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
+ }, It = () => {
517
+ H.value = !H.value, X.setMuted(H.value);
518
+ };
519
+ return ne(() => {
520
+ U = !0, gt();
521
+ }), (e, t) => {
522
+ let n = f;
523
+ return E(), v("div", {
524
+ ref_key: "chatViewEl",
525
+ ref: ut,
526
+ class: T(["pk-chatbot-view-chat", {
527
+ "pk-chatbot-view-chat--dragover": A(pt) && A(P)?.enabled,
528
+ "pk-chatbot-view-chat--empty": ct.value
529
+ }])
530
+ }, [
531
+ x(m, {
532
+ name: "pk-chatbot-view-chat-fade",
533
+ mode: "out-in"
534
+ }, {
535
+ default: j(() => [ct.value ? (E(), g(d, {
536
+ key: 0,
537
+ greeting: A(lt),
538
+ logo: A(N)?.logo,
539
+ name: A(M).name
540
+ }, null, 8, [
541
+ "greeting",
542
+ "logo",
543
+ "name"
544
+ ])) : (E(), g(i, {
545
+ key: 1,
546
+ class: "flex flex-col flex-1 min-h-0 p-md overflow-y-auto",
547
+ interactive: "",
548
+ messages: A(I),
549
+ "confirm-verdicts-on-call": At.value,
550
+ status: A(L).status,
551
+ error: A(L).error,
552
+ "main-color": A(N)?.mainColor,
553
+ "text-color": A(N)?.textColor,
554
+ "revised-answers": A(_e),
555
+ actions: A(F),
556
+ "message-feedbacks": A(ve),
557
+ "feedback-message-id": A(ye)?.id,
558
+ "feedback-loading": A(be),
559
+ "feedback-submitted": A(xe),
560
+ "feedback-error": A(Se),
561
+ "show-extended-steps": A(N)?.showExtendedSteps,
562
+ "awaiting-spoken-answer": W.value,
563
+ "is-dark": A(Ue),
564
+ "show-scroll-to-bottom": r.modifier === "fullscreen",
565
+ onFeedbackSubmit: t[0] ||= (e) => A(Ze)(e),
566
+ onFeedbackClose: t[1] ||= (e) => ye.value = void 0,
567
+ onRegenerate: A(qe),
568
+ onAutoRetry: A(qe),
569
+ onResetChat: A($e),
570
+ onShowInfo: t[2] ||= (e) => me("show-info", e),
571
+ onRevise: t[3] ||= (e) => me("revise", e),
572
+ onUpvote: A(Je),
573
+ onDownvote: A(Ye),
574
+ onFeedback: A(Xe),
575
+ onApprovalRespond: A(et),
576
+ onConfirmRespond: Mt
577
+ }, {
578
+ "tool-showContactForm": j(({ part: e }) => [x(A(b), {
579
+ part: e,
580
+ readonly: !A(ze),
581
+ submitted: A(Pe),
582
+ loading: A(Fe),
583
+ error: A(Ie),
584
+ "privacy-policy-notice": A(N)?.privacyPolicyNotice,
585
+ onSubmit: A(Qe)
586
+ }, null, 8, [
587
+ "part",
588
+ "readonly",
589
+ "submitted",
590
+ "loading",
591
+ "error",
592
+ "privacy-policy-notice",
593
+ "onSubmit"
594
+ ])]),
595
+ "tool-showSuggestedReply": j(({ part: e }) => [x(A(C), {
596
+ part: e,
597
+ onSelect: (t) => Nt(e, t)
598
+ }, null, 8, ["part", "onSelect"])]),
599
+ "tool-showSources": j(({ part: e }) => [x(A(w), {
600
+ part: e,
601
+ "on-expand-context": dt,
602
+ "on-download": ft
603
+ }, null, 8, ["part"])]),
604
+ "tool-showForm": j(({ part: e }) => [x(m, { mode: "out-in" }, {
605
+ default: j(() => [x(A(p), {
606
+ part: e,
607
+ answered: kt(e),
608
+ onSelect: (t) => jt("showForm", e, t)
609
+ }, null, 8, [
610
+ "part",
611
+ "answered",
612
+ "onSelect"
613
+ ])]),
614
+ _: 2
615
+ }, 1024)]),
616
+ "tool-showMultipleChoice": j(({ part: e }) => [x(m, { mode: "out-in" }, {
617
+ default: j(() => [x(A(p), {
618
+ part: e,
619
+ "allow-custom-answer": "",
620
+ answered: kt(e),
621
+ onSelect: (t) => jt("showMultipleChoice", e, t)
622
+ }, null, 8, [
623
+ "part",
624
+ "answered",
625
+ "onSelect"
626
+ ])]),
627
+ _: 2
628
+ }, 1024)]),
629
+ "tool-requestOAuthConnection": j(({ part: e }) => [x(A(ie), {
630
+ part: e,
631
+ "backend-url": A(ze),
632
+ "resolve-connection": (e) => A(z).getOAuthAuthorizeUrl(k.agentId, e),
633
+ "check-connection": (e) => A(z).getOAuthConnectionStatus(k.agentId, e),
634
+ onConnected: (t) => Ft(e, t)
635
+ }, null, 8, [
636
+ "part",
637
+ "backend-url",
638
+ "resolve-connection",
639
+ "check-connection",
640
+ "onConnected"
641
+ ])]),
642
+ "tool-requestGeolocation": j(({ part: e }) => [x(A(re), {
643
+ part: e,
644
+ "call-live": A(X).isActive.value,
645
+ "reverse-geocode": (e, t) => A(z).reverseGeocode(e, t),
646
+ onResult: (t) => Pt(e, t)
647
+ }, null, 8, [
648
+ "part",
649
+ "call-live",
650
+ "reverse-geocode",
651
+ "onResult"
652
+ ])]),
653
+ "tool-showLocation": j(({ part: e }) => [x(A(ae), {
654
+ part: e,
655
+ "is-dark": A(Ue),
656
+ "main-color": A(N)?.mainColor,
657
+ "forward-geocode": (e, t) => A(z).forwardGeocode(e, t)
658
+ }, null, 8, [
659
+ "part",
660
+ "is-dark",
661
+ "main-color",
662
+ "forward-geocode"
663
+ ])]),
664
+ "tool-showDiagram": j(({ part: e }) => [x(A(oe), {
665
+ part: e,
666
+ "is-dark": A(Ue)
667
+ }, null, 8, ["part", "is-dark"])]),
668
+ "tool-editSpreadsheet": j(({ part: e }) => [(E(), g(A(se), {
669
+ key: A(o)(e),
670
+ part: e,
671
+ "file-url": We
672
+ }, null, 8, ["part"]))]),
673
+ _: 1
674
+ }, 8, [
675
+ "messages",
676
+ "confirm-verdicts-on-call",
677
+ "status",
678
+ "error",
679
+ "main-color",
680
+ "text-color",
681
+ "revised-answers",
682
+ "actions",
683
+ "message-feedbacks",
684
+ "feedback-message-id",
685
+ "feedback-loading",
686
+ "feedback-submitted",
687
+ "feedback-error",
688
+ "show-extended-steps",
689
+ "awaiting-spoken-answer",
690
+ "is-dark",
691
+ "show-scroll-to-bottom",
692
+ "onRegenerate",
693
+ "onAutoRetry",
694
+ "onResetChat",
695
+ "onUpvote",
696
+ "onDownvote",
697
+ "onFeedback",
698
+ "onApprovalRespond"
699
+ ]))]),
700
+ _: 1
701
+ }),
702
+ y("div", Te, [x(m, { name: "pk-chatbot-view-chat-fade" }, {
703
+ default: j(() => [ct.value ? (E(), g(ge, {
704
+ key: 0,
705
+ class: "pk-chatbot-view-chat__aurora",
706
+ "source-selector": ".pk-chatbot-input__form"
707
+ })) : _("", !0)]),
708
+ _: 1
709
+ }), A(Re) ? (E(), v("div", Ee, O(A(V)("message.chatErrorConversationBlocked")), 1)) : bt.value === "idle" ? (E(), g(u, {
710
+ key: 2,
711
+ modelValue: A(R),
712
+ "onUpdate:modelValue": t[4] ||= (e) => te(R) ? R.value = e : null,
713
+ "pending-attachments": A(Be),
714
+ "onUpdate:pendingAttachments": t[5] ||= (e) => te(Be) ? Be.value = e : null,
715
+ placeholder: A(Le),
716
+ "dismissable-notice": A(ot) && A(L).messages.length <= 1 ? A(ot) : void 0,
717
+ status: A(L).status,
718
+ "max-message-length": A(N)?.maxMessageLength,
719
+ "file-upload": A(P),
720
+ "attachment-limit-reached": A(Ve),
721
+ "attachment-notice": at.value,
722
+ "voice-enabled": yt.value,
723
+ onStopGeneration: A(Ke),
724
+ onSubmit: A(Ge),
725
+ onFileSelect: A(tt),
726
+ onDismissAttachmentNotice: A(nt),
727
+ onVoiceStart: Tt
728
+ }, ee({ _: 2 }, [r.modifier === "fullscreen" ? {
729
+ name: "prepend",
730
+ fn: j(() => [y("span", De, [x(c, {
731
+ modifiers: "surface",
732
+ class: "pk-chatbot-view-chat__agent-chip-avatar",
733
+ "img-src": A(N)?.logo,
734
+ name: A(M).name
735
+ }, null, 8, ["img-src", "name"]), A(M).name ? (E(), v("strong", Oe, O(A(M).name), 1)) : _("", !0)])]),
736
+ key: "0"
737
+ } : void 0]), 1032, [
738
+ "modelValue",
739
+ "pending-attachments",
740
+ "placeholder",
741
+ "dismissable-notice",
742
+ "status",
743
+ "max-message-length",
744
+ "file-upload",
745
+ "attachment-limit-reached",
746
+ "attachment-notice",
747
+ "voice-enabled",
748
+ "onStopGeneration",
749
+ "onSubmit",
750
+ "onFileSelect",
751
+ "onDismissAttachmentNotice"
752
+ ])) : (E(), g(Ce, {
753
+ key: 1,
754
+ state: bt.value,
755
+ sample: Ct,
756
+ spectrum: wt,
757
+ "remaining-seconds": A(X).remainingSeconds.value,
758
+ muted: H.value,
759
+ error: xt.value,
760
+ "raw-error": A(X).error.value,
761
+ live: A(X).isActive.value,
762
+ class: "pk-chatbot-view-chat__voice",
763
+ onToggleMute: It,
764
+ onHangUp: Et,
765
+ onRetry: Ot,
766
+ onDismiss: Dt
767
+ }, null, 8, [
768
+ "state",
769
+ "remaining-seconds",
770
+ "muted",
771
+ "error",
772
+ "raw-error",
773
+ "live"
774
+ ]))]),
775
+ x(m, null, {
776
+ default: j(() => [A(pt) && A(P)?.enabled ? (E(), v("div", ke, [x(n, {
777
+ name: "ri:upload-cloud-2-line",
778
+ class: "pk-chatbot-view-chat__drop-overlay-icon"
779
+ }), y("span", null, O(A(V)("action.dropFile")), 1)])) : _("", !0)]),
780
+ _: 1
781
+ })
782
+ ], 2);
783
+ };
784
+ }
785
+ });
786
+ //#endregion
787
+ export { ge as i, Ce as n, I as r, Pe as t };
788
+
789
+ //# sourceMappingURL=PkChatbotViewChat-BFImSy1X.js.map