@8wave/ai-elements 0.111.0-beta.3 → 0.111.0-beta.8

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 (209) hide show
  1. package/dist/_chunks/{Agent-Su_LDF9_.js → Agent-tE7ZJPxG.js} +80 -78
  2. package/dist/_chunks/Agent-tE7ZJPxG.js.map +1 -0
  3. package/dist/_chunks/{Document-DecVclEe.js → Document-Bmx6774B.js} +33 -21
  4. package/dist/_chunks/Document-Bmx6774B.js.map +1 -0
  5. package/dist/_chunks/Media-Cft7Pwrh.js +108 -0
  6. package/dist/_chunks/Media-Cft7Pwrh.js.map +1 -0
  7. package/dist/_chunks/{PkLazyImg-ClL4nr95.js → PkLazyImg-Dbj2dDXA.js} +2 -2
  8. package/dist/_chunks/{PkLazyImg-ClL4nr95.js.map → PkLazyImg-Dbj2dDXA.js.map} +1 -1
  9. package/dist/_chunks/{PkStreamingMarkdown-CwqsJnJJ.js → PkStreamingMarkdown-CNI8aV8t.js} +636 -427
  10. package/dist/_chunks/PkStreamingMarkdown-CNI8aV8t.js.map +1 -0
  11. package/dist/_chunks/{PkToolRequestGeolocation-OokLeTf1.js → PkToolRequestGeolocation-Bzy4IYSp.js} +3 -3
  12. package/{dist-vue/_chunks/PkToolRequestGeolocation-Bxqz9oSo.js.map → dist/_chunks/PkToolRequestGeolocation-Bzy4IYSp.js.map} +1 -1
  13. package/dist/_chunks/{PkToolRequestOAuthConnection-CtqKG6Yb.js → PkToolRequestOAuthConnection-CWEKoD71.js} +3 -3
  14. package/dist/_chunks/{PkToolRequestOAuthConnection-CtqKG6Yb.js.map → PkToolRequestOAuthConnection-CWEKoD71.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowArtifact-M6jlSmyJ.js → PkToolShowArtifact-CGbHDEie.js} +4 -4
  16. package/dist/_chunks/{PkToolShowArtifact-M6jlSmyJ.js.map → PkToolShowArtifact-CGbHDEie.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowCalendarEvent-C41JgOUA.js → PkToolShowCalendarEvent-DIFX_rUz.js} +3 -3
  18. package/dist/_chunks/{PkToolShowCalendarEvent-C41JgOUA.js.map → PkToolShowCalendarEvent-DIFX_rUz.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowComparison-DbbUD9pg.js → PkToolShowComparison-B38hHWq2.js} +3 -3
  20. package/dist/_chunks/{PkToolShowComparison-DbbUD9pg.js.map → PkToolShowComparison-B38hHWq2.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowContactForm-D_dW59Dl.js → PkToolShowContactForm-DUw_bZiJ.js} +4 -4
  22. package/dist/_chunks/{PkToolShowContactForm-D_dW59Dl.js.map → PkToolShowContactForm-DUw_bZiJ.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowDiagram-BdmG9gm8.js → PkToolShowDiagram-Dx1Ba0PG.js} +3 -3
  24. package/dist/_chunks/PkToolShowDiagram-Dx1Ba0PG.js.map +1 -0
  25. package/dist/_chunks/{PkToolShowEmail-Dn3JHYIR.js → PkToolShowEmail-DnFFgzom.js} +3 -3
  26. package/dist/_chunks/{PkToolShowEmail-Dn3JHYIR.js.map → PkToolShowEmail-DnFFgzom.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowForm-DbJHMDbt.js → PkToolShowForm-CKQQltJ6.js} +6 -7
  28. package/dist/_chunks/PkToolShowForm-CKQQltJ6.js.map +1 -0
  29. package/dist/_chunks/{PkToolShowImageGallery-C1lzlO0y.js → PkToolShowImageGallery-D99N_Plf.js} +2 -2
  30. package/dist/_chunks/{PkToolShowImageGallery-C1lzlO0y.js.map → PkToolShowImageGallery-D99N_Plf.js.map} +1 -1
  31. package/dist/_chunks/{PkToolShowLocation-CKhPxKFA.js → PkToolShowLocation-AfnrtFVJ.js} +3 -3
  32. package/dist/_chunks/{PkToolShowLocation-CKhPxKFA.js.map → PkToolShowLocation-AfnrtFVJ.js.map} +1 -1
  33. package/dist/_chunks/{PkToolShowMessage-U9CCU7eG.js → PkToolShowMessage-DUo2c-im.js} +3 -3
  34. package/dist/_chunks/{PkToolShowMessage-U9CCU7eG.js.map → PkToolShowMessage-DUo2c-im.js.map} +1 -1
  35. package/dist/_chunks/{PkToolShowProductList-UeiRMLHu.js → PkToolShowProductList-BN6Qk1_y.js} +3 -3
  36. package/dist/_chunks/{PkToolShowProductList-UeiRMLHu.js.map → PkToolShowProductList-BN6Qk1_y.js.map} +1 -1
  37. package/dist/_chunks/{PkToolShowQrCode-CypLrfh5.js → PkToolShowQrCode-BLqeBecX.js} +3 -3
  38. package/dist/_chunks/{PkToolShowQrCode-CypLrfh5.js.map → PkToolShowQrCode-BLqeBecX.js.map} +1 -1
  39. package/dist/_chunks/{PkToolShowSources-Dot-W0Mj.js → PkToolShowSources-DpZb5FUP.js} +4 -4
  40. package/dist/_chunks/{PkToolShowSources-Dot-W0Mj.js.map → PkToolShowSources-DpZb5FUP.js.map} +1 -1
  41. package/dist/_chunks/{PkToolShowSuggestedReply-CKxSH0Y9.js → PkToolShowSuggestedReply-C10nNgBs.js} +3 -3
  42. package/dist/_chunks/{PkToolShowSuggestedReply-CKxSH0Y9.js.map → PkToolShowSuggestedReply-C10nNgBs.js.map} +1 -1
  43. package/dist/_chunks/{PkToolShowVideo-BgKxdBcC.js → PkToolShowVideo-S9b4QHUj.js} +2 -2
  44. package/dist/_chunks/{PkToolShowVideo-BgKxdBcC.js.map → PkToolShowVideo-S9b4QHUj.js.map} +1 -1
  45. package/dist/_chunks/{PkToolShowWeather-LPd3tC77.js → PkToolShowWeather-CqhG430w.js} +2 -2
  46. package/dist/_chunks/PkToolShowWeather-CqhG430w.js.map +1 -0
  47. package/dist/_chunks/{PkToolShowWebPages-ep_erFF0.js → PkToolShowWebPages-txAZi_iG.js} +3 -3
  48. package/dist/_chunks/{PkToolShowWebPages-ep_erFF0.js.map → PkToolShowWebPages-txAZi_iG.js.map} +1 -1
  49. package/dist/_chunks/PkUrl-BPbjZJ1A.js.map +1 -1
  50. package/dist/_chunks/{VvCheckboxGroup.es-Bdu2gFLN.js → VvCheckboxGroup.es-CTrF3pue.js} +2 -2
  51. package/dist/_chunks/{VvCheckboxGroup.es-Bdu2gFLN.js.map → VvCheckboxGroup.es-CTrF3pue.js.map} +1 -1
  52. package/dist/_chunks/{VvCombobox.es-C0wpJIr_.js → VvCombobox.es-BWiXmQ_S.js} +10 -10
  53. package/dist/_chunks/{VvCombobox.es-C0wpJIr_.js.map → VvCombobox.es-BWiXmQ_S.js.map} +1 -1
  54. package/dist/_chunks/{VvInputText.es-Zgtw2YNw.js → VvInputText.es-Bo9I6g8H.js} +6 -6
  55. package/dist/_chunks/{VvInputText.es-Zgtw2YNw.js.map → VvInputText.es-Bo9I6g8H.js.map} +1 -1
  56. package/dist/_chunks/{VvRadioGroup.es-DZLL19SC.js → VvRadioGroup.es-9ooHCuik.js} +2 -2
  57. package/dist/_chunks/{VvRadioGroup.es-DZLL19SC.js.map → VvRadioGroup.es-9ooHCuik.js.map} +1 -1
  58. package/dist/_chunks/{VvSelect.es-ovnZRHG5.js → VvSelect.es-DG0VuWtP.js} +2 -2
  59. package/dist/_chunks/{VvSelect.es-ovnZRHG5.js.map → VvSelect.es-DG0VuWtP.js.map} +1 -1
  60. package/dist/_chunks/{VvTextarea.es-DbP5Lt2T.js → VvTextarea.es-Dg3pxdZy.js} +6 -6
  61. package/dist/_chunks/{VvTextarea.es-DbP5Lt2T.js.map → VvTextarea.es-Dg3pxdZy.js.map} +1 -1
  62. package/dist/_chunks/{browser-NgY6LXg-.js → browser-B0Xnbqi7.js} +726 -751
  63. package/dist/_chunks/browser-B0Xnbqi7.js.map +1 -0
  64. package/dist/_chunks/{dist-n5iFNYf-.js → dist-QdjZA6MJ.js} +143 -133
  65. package/dist/_chunks/{dist-n5iFNYf-.js.map → dist-QdjZA6MJ.js.map} +1 -1
  66. package/dist/_chunks/{index.es-dtdl3VFG.js → index.es-0YpCa4c5.js} +6 -6
  67. package/dist/_chunks/{index.es-dtdl3VFG.js.map → index.es-0YpCa4c5.js.map} +1 -1
  68. package/dist/_chunks/{index.es-BJnUA_36.js → index.es-CHkJ2TMJ.js} +10 -10
  69. package/dist/_chunks/{index.es-BJnUA_36.js.map → index.es-CHkJ2TMJ.js.map} +1 -1
  70. package/dist/_chunks/text-DbSEK8si.js.map +1 -1
  71. package/dist/ai-elements.es.js +3064 -3094
  72. package/dist/ai-elements.es.js.map +1 -1
  73. package/dist-vue/PkChatbot.js +1 -1
  74. package/dist-vue/PkChatbotEmptyState.js +1 -1
  75. package/dist-vue/PkChatbotError.js +1 -1
  76. package/dist-vue/PkChatbotInput.js +1 -1
  77. package/dist-vue/PkChatbotMessages.js +1 -1
  78. package/dist-vue/PkChatbotStepPayload.js +1 -1
  79. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  80. package/dist-vue/PkChatbotSteps.js +1 -1
  81. package/dist-vue/PkChatbotViewChat.js +1 -1
  82. package/dist-vue/PkChatbotViewConversations.js +1 -1
  83. package/dist-vue/PkChatbotViewFiles.js +1 -1
  84. package/dist-vue/PkChatbotViewProfile.js +1 -1
  85. package/dist-vue/_chunks/{Agent-C8BsTAxk.js → Agent-De2gFNjR.js} +165 -176
  86. package/dist-vue/_chunks/Agent-De2gFNjR.js.map +1 -0
  87. package/dist-vue/_chunks/{Document-CaUfI_SZ.js → Document-8umjeTVS.js} +84 -72
  88. package/dist-vue/_chunks/Document-8umjeTVS.js.map +1 -0
  89. package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
  90. package/dist-vue/_chunks/{PkChatbot-BPKSPIeC.js → PkChatbot-DE1bKmDi.js} +61 -61
  91. package/dist-vue/_chunks/PkChatbot-DE1bKmDi.js.map +1 -0
  92. package/dist-vue/_chunks/{PkChatbotEmptyState-BvaeBxhx.js → PkChatbotEmptyState-BtzBYOHJ.js} +2 -2
  93. package/dist-vue/_chunks/{PkChatbotEmptyState-BvaeBxhx.js.map → PkChatbotEmptyState-BtzBYOHJ.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkChatbotError-CBP2mf-n.js → PkChatbotError-gvDpRcEz.js} +21 -19
  95. package/dist-vue/_chunks/PkChatbotError-gvDpRcEz.js.map +1 -0
  96. package/dist-vue/_chunks/{PkChatbotInput-JnHaRlfk.js → PkChatbotInput-MSpF6SB6.js} +139 -124
  97. package/dist-vue/_chunks/PkChatbotInput-MSpF6SB6.js.map +1 -0
  98. package/dist-vue/_chunks/PkChatbotMessages-B6ONEJnZ.js +776 -0
  99. package/dist-vue/_chunks/PkChatbotMessages-B6ONEJnZ.js.map +1 -0
  100. package/dist-vue/_chunks/{PkChatbotStepPayload-BH6piqOi.js → PkChatbotStepPayload-XW4gT9AZ.js} +2 -2
  101. package/dist-vue/_chunks/{PkChatbotStepPayload-BH6piqOi.js.map → PkChatbotStepPayload-XW4gT9AZ.js.map} +1 -1
  102. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJ7xUvgi.js → PkChatbotStepToolDetail-C4-K6Glw.js} +3 -3
  103. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJ7xUvgi.js.map → PkChatbotStepToolDetail-C4-K6Glw.js.map} +1 -1
  104. package/dist-vue/_chunks/PkChatbotSteps-CrqjWpv0.js +190 -0
  105. package/dist-vue/_chunks/PkChatbotSteps-CrqjWpv0.js.map +1 -0
  106. package/dist-vue/_chunks/{PkChatbotViewChat-CEqzF1G9.js → PkChatbotViewChat-BMQtx1Gi.js} +10 -10
  107. package/dist-vue/_chunks/{PkChatbotViewChat-CEqzF1G9.js.map → PkChatbotViewChat-BMQtx1Gi.js.map} +1 -1
  108. package/dist-vue/_chunks/{PkChatbotViewConversations-C787v5ll.js → PkChatbotViewConversations-3LaZPFyw.js} +2 -2
  109. package/dist-vue/_chunks/{PkChatbotViewConversations-C787v5ll.js.map → PkChatbotViewConversations-3LaZPFyw.js.map} +1 -1
  110. package/dist-vue/_chunks/{PkChatbotViewFiles-CNFLt8YO.js → PkChatbotViewFiles-CTqnbsCj.js} +3 -3
  111. package/dist-vue/_chunks/{PkChatbotViewFiles-CNFLt8YO.js.map → PkChatbotViewFiles-CTqnbsCj.js.map} +1 -1
  112. package/dist-vue/_chunks/{PkChatbotViewProfile-7p0ci3qm.js → PkChatbotViewProfile-B-Mp1jGQ.js} +2 -2
  113. package/dist-vue/_chunks/{PkChatbotViewProfile-7p0ci3qm.js.map → PkChatbotViewProfile-B-Mp1jGQ.js.map} +1 -1
  114. package/dist-vue/_chunks/PkRelativeTime--1cIphlA.js.map +1 -1
  115. package/dist-vue/_chunks/{PkStreamingMarkdown-D8_LwZMR.js → PkStreamingMarkdown-D0IOaETI.js} +432 -419
  116. package/dist-vue/_chunks/PkStreamingMarkdown-D0IOaETI.js.map +1 -0
  117. package/dist-vue/_chunks/PkSvgViewer-D-0M5bqg.js.map +1 -1
  118. package/dist-vue/_chunks/{PkToolRequestGeolocation-Bxqz9oSo.js → PkToolRequestGeolocation-Q3N3jlO8.js} +2 -2
  119. package/{dist/_chunks/PkToolRequestGeolocation-OokLeTf1.js.map → dist-vue/_chunks/PkToolRequestGeolocation-Q3N3jlO8.js.map} +1 -1
  120. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-C6rXgb0s.js → PkToolRequestOAuthConnection-C0LW5Evp.js} +2 -2
  121. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-C6rXgb0s.js.map → PkToolRequestOAuthConnection-C0LW5Evp.js.map} +1 -1
  122. package/dist-vue/_chunks/{PkToolShowArtifact-CEXdfOGG.js → PkToolShowArtifact-DHdJuzDi.js} +2 -2
  123. package/dist-vue/_chunks/{PkToolShowArtifact-CEXdfOGG.js.map → PkToolShowArtifact-DHdJuzDi.js.map} +1 -1
  124. package/dist-vue/_chunks/{PkToolShowContactForm-DHmzAIVF.js → PkToolShowContactForm-BB2X4UdQ.js} +2 -2
  125. package/dist-vue/_chunks/{PkToolShowContactForm-DHmzAIVF.js.map → PkToolShowContactForm-BB2X4UdQ.js.map} +1 -1
  126. package/dist-vue/_chunks/{PkToolShowDiagram-dwCVZ1up.js → PkToolShowDiagram-BH6ihikd.js} +2 -2
  127. package/dist-vue/_chunks/PkToolShowDiagram-BH6ihikd.js.map +1 -0
  128. package/dist-vue/_chunks/{PkToolShowEmail-CavhsPvi.js → PkToolShowEmail-DF__nKpR.js} +2 -2
  129. package/dist-vue/_chunks/{PkToolShowEmail-CavhsPvi.js.map → PkToolShowEmail-DF__nKpR.js.map} +1 -1
  130. package/dist-vue/_chunks/{PkToolShowForm-CO5A_j9L.js → PkToolShowForm-DUKIyj9V.js} +6 -6
  131. package/dist-vue/_chunks/PkToolShowForm-DUKIyj9V.js.map +1 -0
  132. package/dist-vue/_chunks/{PkToolShowMessage-DQojxDiV.js → PkToolShowMessage-Ck6VP-gw.js} +2 -2
  133. package/dist-vue/_chunks/{PkToolShowMessage-DQojxDiV.js.map → PkToolShowMessage-Ck6VP-gw.js.map} +1 -1
  134. package/dist-vue/_chunks/{PkToolShowProductList-Cn0yewM3.js → PkToolShowProductList-zfM8cx-l.js} +2 -2
  135. package/dist-vue/_chunks/{PkToolShowProductList-Cn0yewM3.js.map → PkToolShowProductList-zfM8cx-l.js.map} +1 -1
  136. package/dist-vue/_chunks/{PkToolShowSources-7Q5Iogxi.js → PkToolShowSources-Dlaz2Y77.js} +4 -4
  137. package/dist-vue/_chunks/{PkToolShowSources-7Q5Iogxi.js.map → PkToolShowSources-Dlaz2Y77.js.map} +1 -1
  138. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DQFOVonE.js → PkToolShowSuggestedReply-DWLkUh2L.js} +2 -2
  139. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DQFOVonE.js.map → PkToolShowSuggestedReply-DWLkUh2L.js.map} +1 -1
  140. package/dist-vue/_chunks/PkToolShowWeather-Bzqalzh8.js.map +1 -1
  141. package/dist-vue/_chunks/{PkToolShowWebPages-Bzkkn9GV.js → PkToolShowWebPages-CosBYLrE.js} +2 -2
  142. package/dist-vue/_chunks/{PkToolShowWebPages-Bzkkn9GV.js.map → PkToolShowWebPages-CosBYLrE.js.map} +1 -1
  143. package/dist-vue/_chunks/{PkUrl-xUBKVJCv.js → PkUrl-B5CNTQj9.js} +2 -2
  144. package/dist-vue/_chunks/PkUrl-B5CNTQj9.js.map +1 -0
  145. package/dist-vue/_chunks/{createChatbotApiClient-D9f69brW.js → createChatbotApiClient-MkaPbGWB.js} +2 -2
  146. package/dist-vue/_chunks/createChatbotApiClient-MkaPbGWB.js.map +1 -0
  147. package/dist-vue/_chunks/{useChatbotStore-9Cw_oR6J.js → useChatbotStore-BzfqjiYz.js} +6 -3
  148. package/dist-vue/_chunks/useChatbotStore-BzfqjiYz.js.map +1 -0
  149. package/dist-vue/_chunks/useDialogConfirm-KWz0ohCQ.js.map +1 -1
  150. package/dist-vue/_chunks/{utils-Coqik0XI.js → utils-C1666_6C.js} +58 -43
  151. package/dist-vue/_chunks/utils-C1666_6C.js.map +1 -0
  152. package/dist-vue/api.js +1 -1
  153. package/dist-vue/composables.js +3 -3
  154. package/dist-vue/index.js +3853 -3485
  155. package/dist-vue/index.js.map +1 -1
  156. package/dist-vue/locales.js +36 -8
  157. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +20 -3
  158. package/dist-vue/packages/components/src/chat/PkChatButton.d.ts +3 -2
  159. package/dist-vue/packages/components/src/chat/PkLanguageModel.d.ts +26 -2
  160. package/dist-vue/packages/components/src/chat/PkLanguageModelCombobox.d.ts +53 -1
  161. package/dist-vue/packages/components/src/chat/PkModelOption.d.ts +19 -0
  162. package/dist-vue/packages/components/src/chat/PkReasoningSettings.d.ts +6 -0
  163. package/dist-vue/packages/components/src/chat/PkStreamingMarkdown.d.ts +6 -0
  164. package/dist-vue/packages/components/src/chat/PkStreamingMarkdownAutoscroll.d.ts +1 -0
  165. package/dist-vue/packages/components/src/chat/constants.d.ts +5 -18
  166. package/dist-vue/packages/components/src/chat/index.d.ts +3 -1
  167. package/dist-vue/packages/components/src/chat/modelCatalog.d.ts +46 -0
  168. package/dist-vue/packages/components/src/chat/utils.d.ts +16 -0
  169. package/dist-vue/packages/components/src/table/PkTableSortable.d.ts +5 -1
  170. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +18 -0
  171. package/dist-vue/packages/composable/src/useChatbotError.d.ts +2 -0
  172. package/dist-vue/packages/models/src/schema/Agent.d.ts +70 -10
  173. package/dist-vue/packages/models/src/schema/Chat.d.ts +10 -0
  174. package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +316 -0
  175. package/dist-vue/packages/models/src/schema/Organization.d.ts +142 -2
  176. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +20 -0
  177. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -0
  178. package/dist-vue/packages/models/src/schema/UserOverview.d.ts +41 -0
  179. package/dist-vue/packages/models/src/schema/constants.d.ts +56 -91
  180. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  181. package/dist-vue/style.css +1 -1
  182. package/package.json +1 -1
  183. package/dist/_chunks/Agent-Su_LDF9_.js.map +0 -1
  184. package/dist/_chunks/Document-DecVclEe.js.map +0 -1
  185. package/dist/_chunks/Media-C6SOQfJZ.js +0 -122
  186. package/dist/_chunks/Media-C6SOQfJZ.js.map +0 -1
  187. package/dist/_chunks/PkStreamingMarkdown-CwqsJnJJ.js.map +0 -1
  188. package/dist/_chunks/PkToolShowDiagram-BdmG9gm8.js.map +0 -1
  189. package/dist/_chunks/PkToolShowForm-DbJHMDbt.js.map +0 -1
  190. package/dist/_chunks/PkToolShowWeather-LPd3tC77.js.map +0 -1
  191. package/dist/_chunks/browser-NgY6LXg-.js.map +0 -1
  192. package/dist/_chunks/utils-YJ0ZOLDG.js +0 -185
  193. package/dist/_chunks/utils-YJ0ZOLDG.js.map +0 -1
  194. package/dist-vue/_chunks/Agent-C8BsTAxk.js.map +0 -1
  195. package/dist-vue/_chunks/Document-CaUfI_SZ.js.map +0 -1
  196. package/dist-vue/_chunks/PkChatbot-BPKSPIeC.js.map +0 -1
  197. package/dist-vue/_chunks/PkChatbotError-CBP2mf-n.js.map +0 -1
  198. package/dist-vue/_chunks/PkChatbotInput-JnHaRlfk.js.map +0 -1
  199. package/dist-vue/_chunks/PkChatbotMessages-DAlkoMkY.js +0 -771
  200. package/dist-vue/_chunks/PkChatbotMessages-DAlkoMkY.js.map +0 -1
  201. package/dist-vue/_chunks/PkChatbotSteps-rommD48p.js +0 -180
  202. package/dist-vue/_chunks/PkChatbotSteps-rommD48p.js.map +0 -1
  203. package/dist-vue/_chunks/PkStreamingMarkdown-D8_LwZMR.js.map +0 -1
  204. package/dist-vue/_chunks/PkToolShowDiagram-dwCVZ1up.js.map +0 -1
  205. package/dist-vue/_chunks/PkToolShowForm-CO5A_j9L.js.map +0 -1
  206. package/dist-vue/_chunks/PkUrl-xUBKVJCv.js.map +0 -1
  207. package/dist-vue/_chunks/createChatbotApiClient-D9f69brW.js.map +0 -1
  208. package/dist-vue/_chunks/useChatbotStore-9Cw_oR6J.js.map +0 -1
  209. package/dist-vue/_chunks/utils-Coqik0XI.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolShowForm-CO5A_j9L.js","names":[],"sources":["../../../../packages/components/src/PkEditorRadioButtons.vue","../../../../packages/components/src/PkEditorRadioButtons.vue","../../../../packages/components/src/PkEditorCheckboxButtons.vue","../../../../packages/components/src/PkEditorCheckboxButtons.vue","../../../../packages/components/src/chat/PkToolShowForm.vue","../../../../packages/components/src/chat/PkToolShowForm.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n import { computed, useId } from 'vue'\n\n const props = defineProps<{\n name: string\n label?: string\n hintLabel?: string\n invalid?: boolean\n invalidLabel?: string | string[]\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n modifiers?: string | string[]\n /**\n * Render the options as one segmented control (a recessed track with\n * the chosen option raised) instead of a row of boxed cards. Suits a\n * choice between a few short named states, such as a level or a mode.\n */\n segmented?: boolean\n }>()\n\n const modelValue = defineModel<\n string | number | boolean | symbol | unknown[] | undefined\n >({ default: undefined })\n\n // Native radios group by their name attribute across the whole document, so\n // two instances sharing one name become a single group: the browser unchecks\n // the other instance's inputs and Vue never puts them back, because its own\n // model did not change. It happened with \"theme\", offered by the profile\n // menu and the agent settings panel at the same time, and it can happen to\n // any two tool forms with the same step id. Scope the name to the instance.\n const uid = useId()\n const groupName = computed(() => `${props.name}-${uid}`)\n\n const radioModifiers = computed(() => {\n const toReturn = props.modifiers\n ? Array.isArray(props.modifiers)\n ? props.modifiers\n : [props.modifiers]\n : []\n return [...toReturn, props.segmented ? 'segment' : 'button']\n })\n</script>\n\n<template>\n <VvRadioGroup\n v-model=\"modelValue\"\n :name=\"groupName\"\n :label\n :hint-label=\"hintLabel\"\n :invalid\n :invalid-label=\"invalidLabel\"\n :modifiers=\"segmented ? 'segmented' : 'buttons'\">\n <VvRadio\n v-for=\"(option, key) in options\"\n :key\n :name=\"groupName\"\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n :modifiers=\"radioModifiers\">\n <slot :name=\"option.value\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvRadio>\n </VvRadioGroup>\n</template>\n","<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n import { computed, useId } from 'vue'\n\n const props = defineProps<{\n name: string\n label?: string\n hintLabel?: string\n invalid?: boolean\n invalidLabel?: string | string[]\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n modifiers?: string | string[]\n /**\n * Render the options as one segmented control (a recessed track with\n * the chosen option raised) instead of a row of boxed cards. Suits a\n * choice between a few short named states, such as a level or a mode.\n */\n segmented?: boolean\n }>()\n\n const modelValue = defineModel<\n string | number | boolean | symbol | unknown[] | undefined\n >({ default: undefined })\n\n // Native radios group by their name attribute across the whole document, so\n // two instances sharing one name become a single group: the browser unchecks\n // the other instance's inputs and Vue never puts them back, because its own\n // model did not change. It happened with \"theme\", offered by the profile\n // menu and the agent settings panel at the same time, and it can happen to\n // any two tool forms with the same step id. Scope the name to the instance.\n const uid = useId()\n const groupName = computed(() => `${props.name}-${uid}`)\n\n const radioModifiers = computed(() => {\n const toReturn = props.modifiers\n ? Array.isArray(props.modifiers)\n ? props.modifiers\n : [props.modifiers]\n : []\n return [...toReturn, props.segmented ? 'segment' : 'button']\n })\n</script>\n\n<template>\n <VvRadioGroup\n v-model=\"modelValue\"\n :name=\"groupName\"\n :label\n :hint-label=\"hintLabel\"\n :invalid\n :invalid-label=\"invalidLabel\"\n :modifiers=\"segmented ? 'segmented' : 'buttons'\">\n <VvRadio\n v-for=\"(option, key) in options\"\n :key\n :name=\"groupName\"\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n :modifiers=\"radioModifiers\">\n <slot :name=\"option.value\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvRadio>\n </VvRadioGroup>\n</template>\n","<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n\n defineProps<{\n name: string\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n }>()\n\n const modelValue = defineModel<unknown[] | undefined>({\n default: undefined,\n })\n</script>\n\n<template>\n <VvCheckboxGroup v-model=\"modelValue\" :name modifiers=\"buttons\">\n <VvCheckbox\n v-for=\"(option, key) in options\"\n :key\n :name\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n modifiers=\"button\">\n <slot :name=\"String(option.value)\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvCheckbox>\n </VvCheckboxGroup>\n</template>\n","<script setup lang=\"ts\">\n import type { Option } from '@volverjs/ui-vue'\n\n defineProps<{\n name: string\n required?: boolean\n options: Option[]\n readonly?: boolean\n disabled?: boolean\n }>()\n\n const modelValue = defineModel<unknown[] | undefined>({\n default: undefined,\n })\n</script>\n\n<template>\n <VvCheckboxGroup v-model=\"modelValue\" :name modifiers=\"buttons\">\n <VvCheckbox\n v-for=\"(option, key) in options\"\n :key\n :name\n :required\n :readonly\n :disabled\n :value=\"option.value\"\n modifiers=\"button\">\n <slot :name=\"String(option.value)\" v-bind=\"{ option }\">\n {{ option.label }}\n </slot>\n </VvCheckbox>\n </VvCheckboxGroup>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n import { formAnswerSlots, formStepOptions } from './utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkEditorRadioButtons from '../PkEditorRadioButtons.vue'\n import PkEditorCheckboxButtons from '../PkEditorCheckboxButtons.vue'\n\n // --- Types ---\n\n interface FormOption {\n label: string\n description?: string\n }\n\n interface FormStep {\n id: string\n question: string\n message?: string\n type?: 'text' | 'number' | 'date'\n options?: FormOption[]\n multiSelect?: boolean\n allowFreeformInput?: boolean\n placeholder?: string\n }\n\n interface FormAnswer {\n id: string\n value: string | string[] | number | null\n }\n\n interface ToolPartShape {\n state?: 'input-available' | 'output-available' | 'output-error'\n toolCallId?: string\n // AI SDK v5 encodes the tool name in `type` (e.g. 'tool-showMultipleChoice').\n // `toolName` is kept for backward compatibility but is normally absent.\n type?: string\n toolName?: string\n input?: {\n title?: string\n steps?: FormStep[]\n // Legacy showMultipleChoice fields\n question?: string\n options?: (string | FormOption)[]\n }\n // The web card submits `{ answers: [...] }`; the platform channels\n // (Teams modal) submit a flat record keyed by step id.\n output?: string | { answers: FormAnswer[] } | Record<string, unknown>\n }\n\n type AnswerValue = string | string[] | number | null\n\n // --- Props & Emits ---\n\n const props = defineProps<{\n part: unknown\n allowCustomAnswer?: boolean\n /**\n * Answered during a call. Nothing in the part says so (the answer went\n * to the agent as speech, not to the tool call), so the surface that\n * sent it is the only one that knows, and without it the same form\n * could be submitted again and again.\n */\n answered?: boolean\n }>()\n\n const emit = defineEmits<{\n select: [answer: string | { answers: FormAnswer[] }]\n }>()\n\n const { t: $t, d: $d } = useI18n({ useScope: 'global' })\n\n // --- Parsed tool part ---\n\n const toolPart = computed(\n () => JSON.parse(JSON.stringify(props.part)) as ToolPartShape,\n )\n\n const isLegacy = computed(\n () =>\n toolPart.value.toolName === 'showMultipleChoice' ||\n toolPart.value.type === 'tool-showMultipleChoice',\n )\n\n /**\n * A form drawn during a CALL is already \"answered\" as far as the tool loop\n * is concerned: the turn could not wait for it, so the backend closed it\n * with a note saying the widget was drawn (see `isVoiceRenderAck`). That\n * note is not an answer, and the caller still has to give one.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isInteractive = computed(\n () =>\n !props.answered &&\n (toolPart.value.state === 'input-available' || isRenderAck.value),\n )\n\n /** Single-step with no custom-answer and no freeform → auto-submit on option pick */\n const isAutoSubmitStep = computed(() => {\n const step = currentStep.value\n if (!step) return false\n return (\n steps.value.length === 1 &&\n !step.allowFreeformInput &&\n !props.allowCustomAnswer\n )\n })\n\n /** Legacy tool should auto-submit on option pick regardless of allowCustomAnswer */\n const isLegacyAutoSubmit = computed(\n () =>\n isLegacy.value &&\n steps.value.length === 1 &&\n !currentStep.value?.multiSelect,\n )\n\n /**\n * True only for the steps that send themselves as soon as an option is\n * picked: the single case where the footer button would be redundant.\n * Every other shape needs it, single-step forms included: with\n * `allowFreeformInput` (or `allowCustomAnswer`) the radio pick no longer\n * auto-submits, so without the footer the user was left with a chosen\n * option and no way to send it.\n */\n const isSelfSubmitting = computed(\n () =>\n Boolean(currentStep.value?.options) &&\n !currentStep.value?.multiSelect &&\n (isAutoSubmitStep.value || isLegacyAutoSubmit.value),\n )\n\n // --- Steps ---\n\n const steps = computed<FormStep[]>(() => {\n const input = toolPart.value.input\n if (input?.steps?.length) {\n return input.steps\n }\n // Legacy showMultipleChoice → normalize into a single step\n if (input?.question && input?.options) {\n return [\n {\n id: 'legacy',\n question: input.question,\n options: input.options.map((o) =>\n typeof o === 'string' ? { label: o } : o,\n ),\n },\n ]\n }\n return []\n })\n\n /**\n * The reason the card has nothing to draw. A call the SDK rejected keeps\n * `state: 'output-error'` and moves the arguments it could not validate to\n * `rawInput`, so `input` is empty and there are no steps: without this the\n * component rendered NOTHING, and the user was left with a question that\n * had been announced and never appeared.\n */\n const hasFailed = computed(\n () => toolPart.value.state === 'output-error' && !steps.value.length,\n )\n\n // --- Navigation state ---\n\n const currentStepIndex = ref(0)\n const currentStep = computed(() => steps.value[currentStepIndex.value])\n const canGoBack = computed(() => currentStepIndex.value > 0)\n const canGoNext = computed(\n () => currentStepIndex.value < steps.value.length - 1,\n )\n const isMultiStep = computed(() => steps.value.length > 1)\n\n const progress = computed(() => {\n if (!isMultiStep.value) return null\n return Math.round(\n ((currentStepIndex.value + 1) / steps.value.length) * 100,\n )\n })\n\n // --- Answers ---\n\n /**\n * One slot PER STEP, keyed by position and not by step id: the ids come\n * from the model and nothing enforces they are unique, and keyed by id two\n * steps sharing one collapsed onto a single answer. See `formAnswerSlots`.\n */\n const answers = reactive<Record<number, AnswerValue>>({})\n const customAnswer = ref('')\n\n // The freeform field belongs to the step showing it: text left behind\n // (unsubmitted, or arriving from a late input update) must not follow the\n // user to the next or previous question.\n watch(currentStepIndex, () => {\n customAnswer.value = ''\n })\n\n // Single scalar answer shared by radio buttons and freeform text/number/date inputs.\n const scalarValue = computed<string | number | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n if (val == null || Array.isArray(val)) return undefined\n return val\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = val ?? null\n }\n },\n })\n\n const activeCheckboxValue = computed<unknown[] | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n return Array.isArray(val) ? val : []\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = (val as string[]) ?? []\n }\n },\n })\n\n // --- Initialize answers from existing output ---\n\n /** The `{ answers: [...] }` list, when the output carries one. */\n function outputAnswers(output: ToolPartShape['output']) {\n if (!output || typeof output === 'string') return undefined\n const list = (output as { answers?: unknown }).answers\n return Array.isArray(list) ? (list as FormAnswer[]) : undefined\n }\n\n watch(\n () => toolPart.value.output,\n (output) => {\n if (!output || isVoiceRenderAck(output)) return\n // Every shape an answered form comes back in (the web card's list,\n // a legacy plain string, the flat record a platform channel posts)\n // lands on the same per-position slots: see `formAnswerSlots`.\n Object.assign(\n answers,\n formAnswerSlots(steps.value, output) as Record<\n number,\n AnswerValue\n >,\n )\n },\n { immediate: true },\n )\n\n // --- Restore custom answer from output when it doesn't match any option ---\n\n const normalizedOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || isVoiceRenderAck(out)) return undefined\n if (typeof out === 'string') return out\n const list = outputAnswers(out)\n if (list?.length === 1) {\n const val = list[0].value\n return Array.isArray(val) ? val.join(', ') : String(val)\n }\n return undefined\n })\n\n watch(\n normalizedOutput,\n (value) => {\n if (!value || !currentStep.value) return\n const optionLabels = (currentStep.value.options ?? []).map(\n (o) => o.label,\n )\n if (!optionLabels.includes(value)) {\n customAnswer.value = value\n }\n },\n { immediate: true },\n )\n\n // --- Option mapping for radio/checkbox components ---\n\n const radioOptions = computed(() => formStepOptions(currentStep.value))\n\n // --- Navigation & Submission ---\n\n /** Footer button, and Enter on a pure freeform step. */\n function goNext() {\n // A typed freeform answer wins over the picked option: it is the more\n // recent intent, and the footer button is now the visible way to send\n // it (the freeform field only submits on Enter).\n if (customAnswer.value.trim()) {\n submitCustomAnswer()\n return\n }\n if (canGoNext.value) {\n currentStepIndex.value++\n } else {\n submitForm()\n }\n }\n\n function goBack() {\n if (canGoBack.value) {\n currentStepIndex.value--\n }\n }\n\n function submitForm() {\n if (!isInteractive.value) return\n\n const finalAnswers: FormAnswer[] = steps.value.map((step, index) => ({\n id: step.id,\n value: answers[index] ?? null,\n }))\n\n // Legacy backward compatibility: single-step, single-select → return plain string\n if (\n isLegacyAutoSubmit.value &&\n !currentStep.value?.allowFreeformInput\n ) {\n const val = finalAnswers[0].value\n emit('select', Array.isArray(val) ? val[0] : (val as string))\n } else {\n emit('select', { answers: finalAnswers })\n }\n }\n\n /** Enter inside the freeform field shown alongside the options. */\n function submitCustomAnswer() {\n const value = customAnswer.value.trim()\n if (!value) return\n\n answers[currentStepIndex.value] = value\n // Cleared before navigating: `goNext()` reads it back to route a typed\n // answer here, so leaving it set would recurse.\n customAnswer.value = ''\n if (steps.value.length === 1) {\n submitForm()\n } else {\n goNext()\n }\n }\n\n function onRadioChange() {\n if (!isInteractive.value) return\n if (isAutoSubmitStep.value || isLegacyAutoSubmit.value) {\n submitForm()\n }\n }\n\n // --- Summary helpers ---\n\n function getSummaryValue(step: FormStep, index: number) {\n const val = answers[index]\n if (val == null) return '—'\n if (Array.isArray(val)) return val.join(', ')\n if (step.type === 'date') return $d(new Date(val), 'short')\n return val\n }\n</script>\n\n<template>\n <div\n v-if=\"hasFailed\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <span class=\"i-vv-alert-circle text-16 shrink-0\" />\n <span>{{ $t('message.formRenderError') }}</span>\n </div>\n <div\n v-else-if=\"steps.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden flex flex-col bg-surface\">\n <!-- Header -->\n <div\n v-if=\"toolPart.input?.title || (isInteractive && steps.length > 1)\"\n class=\"text-12 border-b border-surface-3 text-word-3 bg-surface-1\">\n <div\n v-if=\"toolPart.input?.title\"\n class=\"px-sm py-10 font-bold\"\n :class=\"{\n 'border-b border-surface-3':\n isInteractive && steps.length > 1,\n }\">\n {{ toolPart.input?.title }}\n </div>\n <!-- Progress for multi-step -->\n <div\n v-if=\"isInteractive && steps.length > 1\"\n class=\"flex flex-col gap-4 p-sm\">\n <div class=\"flex justify-between text-10 text-word-3\">\n <span>\n {{\n $t('showForm.step', {\n current: currentStepIndex + 1,\n total: steps.length,\n })\n }}\n </span>\n <span>{{ progress }}%</span>\n </div>\n <div class=\"h-4 bg-surface-3 rounded-full overflow-hidden\">\n <div\n class=\"h-full bg-word-4 transition-all duration-300\"\n :style=\"{ width: `${progress}%` }\"></div>\n </div>\n </div>\n </div>\n\n <!-- Input Available State -->\n <template v-if=\"isInteractive\">\n <!-- Current Step Content -->\n <div class=\"px-sm py-16 flex flex-col gap-12\">\n <div class=\"leading-normal text-12\">\n <strong class=\"font-semibold\">\n {{ currentStep.question }}\n </strong>\n <PkStreamingMarkdown\n v-if=\"currentStep.message\"\n :markdown=\"currentStep.message\"\n class=\"text-word-2 mt-4\" />\n </div>\n\n <!-- Checkbox list for multi-select -->\n <PkEditorCheckboxButtons\n v-if=\"currentStep.options && currentStep.multiSelect\"\n v-model=\"activeCheckboxValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n class=\"mb-0\"\n vertical>\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorCheckboxButtons>\n\n <!-- Radio buttons for single-select -->\n <PkEditorRadioButtons\n v-else-if=\"currentStep.options && !currentStep.multiSelect\"\n v-model=\"scalarValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n vertical\n class=\"mb-0\"\n @update:model-value=\"onRadioChange\">\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorRadioButtons>\n\n <!-- Pure Freeform Input (text, number, date) -->\n <div\n v-else-if=\"!currentStep.options\"\n class=\"flex flex-col gap-6 w-full\">\n <VvInputText\n :key=\"currentStep.id\"\n v-model=\"scalarValue\"\n :placeholder=\"\n currentStep.placeholder || $t('placeholder.insert')\n \"\n :type=\"currentStep.type\"\n class=\"w-full\"\n :name=\"currentStep.id\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n @keyup.enter=\"goNext\" />\n </div>\n </div>\n\n <!-- Custom footer freeform input (shown alongside options when allowFreeformInput) -->\n <div\n v-if=\"currentStep.allowFreeformInput && currentStep.options\"\n class=\"px-sm pb-sm border-t border-surface-3\">\n <form\n class=\"flex gap-xs pt-sm\"\n @submit.prevent=\"submitCustomAnswer\">\n <VvInputText\n :key=\"`${currentStep.id}-custom`\"\n v-model=\"customAnswer\"\n class=\"flex-1\"\n :name=\"`${currentStep.id}-custom`\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n :placeholder=\"\n currentStep.placeholder ||\n $t('showForm.otherPlaceholder')\n \" />\n </form>\n </div>\n\n <!-- Footer navigation: shown for every step that does not submit\n itself on option pick (see `isSelfSubmitting`). -->\n <div\n v-if=\"!isSelfSubmitting\"\n class=\"px-sm py-10 bg-surface border-t border-surface-3 flex justify-between gap-12\">\n <VvButton\n v-if=\"canGoBack\"\n modifiers=\"action-quiet\"\n icon=\"ri:arrow-left-s-line\"\n :label=\"$t('action.back')\"\n @click.stop=\"goBack\" />\n <div v-else></div>\n\n <VvButton\n :modifiers=\"canGoNext ? 'action-quiet' : 'action-primary'\"\n :icon=\"\n canGoNext\n ? 'ri:arrow-right-s-line'\n : 'ri:send-plane-2-line'\n \"\n icon-position=\"right\"\n :label=\"canGoNext ? $t('action.next') : $t('action.submit')\"\n @click.stop=\"goNext\" />\n </div>\n </template>\n\n <!-- Output Available State (Multi-step Summary) -->\n <template v-else>\n <div class=\"px-sm py-12 bg-surface space-y-10\">\n <ul class=\"flex flex-col gap-8\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"index\"\n class=\"leading-normal\">\n <div class=\"text-12 text-word-3\">\n {{ step.question }}\n </div>\n <span class=\"text-12 text-word-2 font-semibold\">\n {{ getSummaryValue(step, index) }}\n </span>\n </li>\n </ul>\n </div>\n <div\n class=\"px-sm py-12 bg-surface border-t border-surface-3 flex items-center gap-10\">\n <VvIcon name=\"ri:check-line\" class=\"text-16 text-word-3\" />\n <div class=\"flex flex-col\">\n <span class=\"font-medium text-12 text-word-1 leading-tight\">\n {{ $t('showForm.completed') }}\n </span>\n </div>\n </div>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n import { formAnswerSlots, formStepOptions } from './utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkEditorRadioButtons from '../PkEditorRadioButtons.vue'\n import PkEditorCheckboxButtons from '../PkEditorCheckboxButtons.vue'\n\n // --- Types ---\n\n interface FormOption {\n label: string\n description?: string\n }\n\n interface FormStep {\n id: string\n question: string\n message?: string\n type?: 'text' | 'number' | 'date'\n options?: FormOption[]\n multiSelect?: boolean\n allowFreeformInput?: boolean\n placeholder?: string\n }\n\n interface FormAnswer {\n id: string\n value: string | string[] | number | null\n }\n\n interface ToolPartShape {\n state?: 'input-available' | 'output-available' | 'output-error'\n toolCallId?: string\n // AI SDK v5 encodes the tool name in `type` (e.g. 'tool-showMultipleChoice').\n // `toolName` is kept for backward compatibility but is normally absent.\n type?: string\n toolName?: string\n input?: {\n title?: string\n steps?: FormStep[]\n // Legacy showMultipleChoice fields\n question?: string\n options?: (string | FormOption)[]\n }\n // The web card submits `{ answers: [...] }`; the platform channels\n // (Teams modal) submit a flat record keyed by step id.\n output?: string | { answers: FormAnswer[] } | Record<string, unknown>\n }\n\n type AnswerValue = string | string[] | number | null\n\n // --- Props & Emits ---\n\n const props = defineProps<{\n part: unknown\n allowCustomAnswer?: boolean\n /**\n * Answered during a call. Nothing in the part says so (the answer went\n * to the agent as speech, not to the tool call), so the surface that\n * sent it is the only one that knows, and without it the same form\n * could be submitted again and again.\n */\n answered?: boolean\n }>()\n\n const emit = defineEmits<{\n select: [answer: string | { answers: FormAnswer[] }]\n }>()\n\n const { t: $t, d: $d } = useI18n({ useScope: 'global' })\n\n // --- Parsed tool part ---\n\n const toolPart = computed(\n () => JSON.parse(JSON.stringify(props.part)) as ToolPartShape,\n )\n\n const isLegacy = computed(\n () =>\n toolPart.value.toolName === 'showMultipleChoice' ||\n toolPart.value.type === 'tool-showMultipleChoice',\n )\n\n /**\n * A form drawn during a CALL is already \"answered\" as far as the tool loop\n * is concerned: the turn could not wait for it, so the backend closed it\n * with a note saying the widget was drawn (see `isVoiceRenderAck`). That\n * note is not an answer, and the caller still has to give one.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isInteractive = computed(\n () =>\n !props.answered &&\n (toolPart.value.state === 'input-available' || isRenderAck.value),\n )\n\n /** Single-step with no custom-answer and no freeform → auto-submit on option pick */\n const isAutoSubmitStep = computed(() => {\n const step = currentStep.value\n if (!step) return false\n return (\n steps.value.length === 1 &&\n !step.allowFreeformInput &&\n !props.allowCustomAnswer\n )\n })\n\n /** Legacy tool should auto-submit on option pick regardless of allowCustomAnswer */\n const isLegacyAutoSubmit = computed(\n () =>\n isLegacy.value &&\n steps.value.length === 1 &&\n !currentStep.value?.multiSelect,\n )\n\n /**\n * True only for the steps that send themselves as soon as an option is\n * picked: the single case where the footer button would be redundant.\n * Every other shape needs it, single-step forms included: with\n * `allowFreeformInput` (or `allowCustomAnswer`) the radio pick no longer\n * auto-submits, so without the footer the user was left with a chosen\n * option and no way to send it.\n */\n const isSelfSubmitting = computed(\n () =>\n Boolean(currentStep.value?.options) &&\n !currentStep.value?.multiSelect &&\n (isAutoSubmitStep.value || isLegacyAutoSubmit.value),\n )\n\n // --- Steps ---\n\n const steps = computed<FormStep[]>(() => {\n const input = toolPart.value.input\n if (input?.steps?.length) {\n return input.steps\n }\n // Legacy showMultipleChoice → normalize into a single step\n if (input?.question && input?.options) {\n return [\n {\n id: 'legacy',\n question: input.question,\n options: input.options.map((o) =>\n typeof o === 'string' ? { label: o } : o,\n ),\n },\n ]\n }\n return []\n })\n\n /**\n * The reason the card has nothing to draw. A call the SDK rejected keeps\n * `state: 'output-error'` and moves the arguments it could not validate to\n * `rawInput`, so `input` is empty and there are no steps: without this the\n * component rendered NOTHING, and the user was left with a question that\n * had been announced and never appeared.\n */\n const hasFailed = computed(\n () => toolPart.value.state === 'output-error' && !steps.value.length,\n )\n\n // --- Navigation state ---\n\n const currentStepIndex = ref(0)\n const currentStep = computed(() => steps.value[currentStepIndex.value])\n const canGoBack = computed(() => currentStepIndex.value > 0)\n const canGoNext = computed(\n () => currentStepIndex.value < steps.value.length - 1,\n )\n const isMultiStep = computed(() => steps.value.length > 1)\n\n const progress = computed(() => {\n if (!isMultiStep.value) return null\n return Math.round(\n ((currentStepIndex.value + 1) / steps.value.length) * 100,\n )\n })\n\n // --- Answers ---\n\n /**\n * One slot PER STEP, keyed by position and not by step id: the ids come\n * from the model and nothing enforces they are unique, and keyed by id two\n * steps sharing one collapsed onto a single answer. See `formAnswerSlots`.\n */\n const answers = reactive<Record<number, AnswerValue>>({})\n const customAnswer = ref('')\n\n // The freeform field belongs to the step showing it: text left behind\n // (unsubmitted, or arriving from a late input update) must not follow the\n // user to the next or previous question.\n watch(currentStepIndex, () => {\n customAnswer.value = ''\n })\n\n // Single scalar answer shared by radio buttons and freeform text/number/date inputs.\n const scalarValue = computed<string | number | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n if (val == null || Array.isArray(val)) return undefined\n return val\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = val ?? null\n }\n },\n })\n\n const activeCheckboxValue = computed<unknown[] | undefined>({\n get: () => {\n const val = currentStep.value\n ? answers[currentStepIndex.value]\n : undefined\n return Array.isArray(val) ? val : []\n },\n set: (val) => {\n if (currentStep.value) {\n answers[currentStepIndex.value] = (val as string[]) ?? []\n }\n },\n })\n\n // --- Initialize answers from existing output ---\n\n /** The `{ answers: [...] }` list, when the output carries one. */\n function outputAnswers(output: ToolPartShape['output']) {\n if (!output || typeof output === 'string') return undefined\n const list = (output as { answers?: unknown }).answers\n return Array.isArray(list) ? (list as FormAnswer[]) : undefined\n }\n\n watch(\n () => toolPart.value.output,\n (output) => {\n if (!output || isVoiceRenderAck(output)) return\n // Every shape an answered form comes back in (the web card's list,\n // a legacy plain string, the flat record a platform channel posts)\n // lands on the same per-position slots: see `formAnswerSlots`.\n Object.assign(\n answers,\n formAnswerSlots(steps.value, output) as Record<\n number,\n AnswerValue\n >,\n )\n },\n { immediate: true },\n )\n\n // --- Restore custom answer from output when it doesn't match any option ---\n\n const normalizedOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || isVoiceRenderAck(out)) return undefined\n if (typeof out === 'string') return out\n const list = outputAnswers(out)\n if (list?.length === 1) {\n const val = list[0].value\n return Array.isArray(val) ? val.join(', ') : String(val)\n }\n return undefined\n })\n\n watch(\n normalizedOutput,\n (value) => {\n if (!value || !currentStep.value) return\n const optionLabels = (currentStep.value.options ?? []).map(\n (o) => o.label,\n )\n if (!optionLabels.includes(value)) {\n customAnswer.value = value\n }\n },\n { immediate: true },\n )\n\n // --- Option mapping for radio/checkbox components ---\n\n const radioOptions = computed(() => formStepOptions(currentStep.value))\n\n // --- Navigation & Submission ---\n\n /** Footer button, and Enter on a pure freeform step. */\n function goNext() {\n // A typed freeform answer wins over the picked option: it is the more\n // recent intent, and the footer button is now the visible way to send\n // it (the freeform field only submits on Enter).\n if (customAnswer.value.trim()) {\n submitCustomAnswer()\n return\n }\n if (canGoNext.value) {\n currentStepIndex.value++\n } else {\n submitForm()\n }\n }\n\n function goBack() {\n if (canGoBack.value) {\n currentStepIndex.value--\n }\n }\n\n function submitForm() {\n if (!isInteractive.value) return\n\n const finalAnswers: FormAnswer[] = steps.value.map((step, index) => ({\n id: step.id,\n value: answers[index] ?? null,\n }))\n\n // Legacy backward compatibility: single-step, single-select → return plain string\n if (\n isLegacyAutoSubmit.value &&\n !currentStep.value?.allowFreeformInput\n ) {\n const val = finalAnswers[0].value\n emit('select', Array.isArray(val) ? val[0] : (val as string))\n } else {\n emit('select', { answers: finalAnswers })\n }\n }\n\n /** Enter inside the freeform field shown alongside the options. */\n function submitCustomAnswer() {\n const value = customAnswer.value.trim()\n if (!value) return\n\n answers[currentStepIndex.value] = value\n // Cleared before navigating: `goNext()` reads it back to route a typed\n // answer here, so leaving it set would recurse.\n customAnswer.value = ''\n if (steps.value.length === 1) {\n submitForm()\n } else {\n goNext()\n }\n }\n\n function onRadioChange() {\n if (!isInteractive.value) return\n if (isAutoSubmitStep.value || isLegacyAutoSubmit.value) {\n submitForm()\n }\n }\n\n // --- Summary helpers ---\n\n function getSummaryValue(step: FormStep, index: number) {\n const val = answers[index]\n if (val == null) return '—'\n if (Array.isArray(val)) return val.join(', ')\n if (step.type === 'date') return $d(new Date(val), 'short')\n return val\n }\n</script>\n\n<template>\n <div\n v-if=\"hasFailed\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <span class=\"i-vv-alert-circle text-16 shrink-0\" />\n <span>{{ $t('message.formRenderError') }}</span>\n </div>\n <div\n v-else-if=\"steps.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden flex flex-col bg-surface\">\n <!-- Header -->\n <div\n v-if=\"toolPart.input?.title || (isInteractive && steps.length > 1)\"\n class=\"text-12 border-b border-surface-3 text-word-3 bg-surface-1\">\n <div\n v-if=\"toolPart.input?.title\"\n class=\"px-sm py-10 font-bold\"\n :class=\"{\n 'border-b border-surface-3':\n isInteractive && steps.length > 1,\n }\">\n {{ toolPart.input?.title }}\n </div>\n <!-- Progress for multi-step -->\n <div\n v-if=\"isInteractive && steps.length > 1\"\n class=\"flex flex-col gap-4 p-sm\">\n <div class=\"flex justify-between text-10 text-word-3\">\n <span>\n {{\n $t('showForm.step', {\n current: currentStepIndex + 1,\n total: steps.length,\n })\n }}\n </span>\n <span>{{ progress }}%</span>\n </div>\n <div class=\"h-4 bg-surface-3 rounded-full overflow-hidden\">\n <div\n class=\"h-full bg-word-4 transition-all duration-300\"\n :style=\"{ width: `${progress}%` }\"></div>\n </div>\n </div>\n </div>\n\n <!-- Input Available State -->\n <template v-if=\"isInteractive\">\n <!-- Current Step Content -->\n <div class=\"px-sm py-16 flex flex-col gap-12\">\n <div class=\"leading-normal text-12\">\n <strong class=\"font-semibold\">\n {{ currentStep.question }}\n </strong>\n <PkStreamingMarkdown\n v-if=\"currentStep.message\"\n :markdown=\"currentStep.message\"\n class=\"text-word-2 mt-4\" />\n </div>\n\n <!-- Checkbox list for multi-select -->\n <PkEditorCheckboxButtons\n v-if=\"currentStep.options && currentStep.multiSelect\"\n v-model=\"activeCheckboxValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n class=\"mb-0\"\n vertical>\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorCheckboxButtons>\n\n <!-- Radio buttons for single-select -->\n <PkEditorRadioButtons\n v-else-if=\"currentStep.options && !currentStep.multiSelect\"\n v-model=\"scalarValue\"\n :name=\"currentStep.id\"\n :options=\"radioOptions\"\n :readonly=\"!isInteractive\"\n vertical\n class=\"mb-0\"\n @update:model-value=\"onRadioChange\">\n <template\n v-for=\"option in radioOptions\"\n :key=\"option.value\"\n #[option.value]>\n <!-- Shared option layout: label + optional description -->\n <div class=\"text-12\">\n <div class=\"font-semibold\">{{ option.label }}</div>\n <div v-if=\"option.description\" class=\"text-word-3\">\n {{ option.description }}\n </div>\n </div>\n </template>\n </PkEditorRadioButtons>\n\n <!-- Pure Freeform Input (text, number, date) -->\n <div\n v-else-if=\"!currentStep.options\"\n class=\"flex flex-col gap-6 w-full\">\n <VvInputText\n :key=\"currentStep.id\"\n v-model=\"scalarValue\"\n :placeholder=\"\n currentStep.placeholder || $t('placeholder.insert')\n \"\n :type=\"currentStep.type\"\n class=\"w-full\"\n :name=\"currentStep.id\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n @keyup.enter=\"goNext\" />\n </div>\n </div>\n\n <!-- Custom footer freeform input (shown alongside options when allowFreeformInput) -->\n <div\n v-if=\"currentStep.allowFreeformInput && currentStep.options\"\n class=\"px-sm pb-sm border-t border-surface-3\">\n <form\n class=\"flex gap-xs pt-sm\"\n @submit.prevent=\"submitCustomAnswer\">\n <VvInputText\n :key=\"`${currentStep.id}-custom`\"\n v-model=\"customAnswer\"\n class=\"flex-1\"\n :name=\"`${currentStep.id}-custom`\"\n modifiers=\"compact\"\n :disabled=\"!isInteractive\"\n :placeholder=\"\n currentStep.placeholder ||\n $t('showForm.otherPlaceholder')\n \" />\n </form>\n </div>\n\n <!-- Footer navigation: shown for every step that does not submit\n itself on option pick (see `isSelfSubmitting`). -->\n <div\n v-if=\"!isSelfSubmitting\"\n class=\"px-sm py-10 bg-surface border-t border-surface-3 flex justify-between gap-12\">\n <VvButton\n v-if=\"canGoBack\"\n modifiers=\"action-quiet\"\n icon=\"ri:arrow-left-s-line\"\n :label=\"$t('action.back')\"\n @click.stop=\"goBack\" />\n <div v-else></div>\n\n <VvButton\n :modifiers=\"canGoNext ? 'action-quiet' : 'action-primary'\"\n :icon=\"\n canGoNext\n ? 'ri:arrow-right-s-line'\n : 'ri:send-plane-2-line'\n \"\n icon-position=\"right\"\n :label=\"canGoNext ? $t('action.next') : $t('action.submit')\"\n @click.stop=\"goNext\" />\n </div>\n </template>\n\n <!-- Output Available State (Multi-step Summary) -->\n <template v-else>\n <div class=\"px-sm py-12 bg-surface space-y-10\">\n <ul class=\"flex flex-col gap-8\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"index\"\n class=\"leading-normal\">\n <div class=\"text-12 text-word-3\">\n {{ step.question }}\n </div>\n <span class=\"text-12 text-word-2 font-semibold\">\n {{ getSummaryValue(step, index) }}\n </span>\n </li>\n </ul>\n </div>\n <div\n class=\"px-sm py-12 bg-surface border-t border-surface-3 flex items-center gap-10\">\n <VvIcon name=\"ri:check-line\" class=\"text-16 text-word-3\" />\n <div class=\"flex flex-col\">\n <span class=\"font-medium text-12 text-word-1 leading-tight\">\n {{ $t('showForm.completed') }}\n </span>\n </div>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAII,IAAM,IAAQ,GAmBR,IAAa,EAElB,GAAA,YAAuB,GAQlB,IAAM,EAAM,GACZ,IAAY,QAAe,GAAG,EAAM,KAAK,GAAG,GAAK,GAEjD,IAAiB,QAMZ,CAAC,GALS,EAAM,YACjB,MAAM,QAAQ,EAAM,SAAS,IACzB,EAAM,YACN,CAAC,EAAM,SAAS,IACpB,CAAC,GACc,EAAM,YAAY,YAAY,QAAQ,CAC9D;;;GAID,OAAA,EAAA,GAAA,EAqBe,GAAA;IApBF,YAAA,EAAA;IAAA,uBAAA,AAAA,EAAA,QAAA,MAAA,EAAU,QAAA;IAClB,MAAM,EAAA;IACN,OAAA,EAAA;IACA,cAAY,EAAA;IACZ,SAAA,EAAA;IACA,iBAAe,EAAA;IACf,WAAW,EAAA,YAAS,cAAA;;IAEjB,SAAA,QAAgC,EADpC,EAAA,EAAA,GAAA,EAYU,GAAA,MAAA,EAXkB,EAAA,UAAhB,GAAQ,OADpB,EAAA,GAAA,EAYU,GAAA;KAVL;KACA,MAAM,EAAA;KACN,UAAA,EAAA;KACA,UAAA,EAAA;KACA,UAAA,EAAA;KACA,OAAO,EAAO;KACd,WAAW,EAAA;;KACZ,SAAA,QAEO,CAFP,EAEO,EAAA,QAFM,EAAO,OAApB,EAEO,EAAA,SAAA,GAAA,GAAA,EAF8B,UAAM,CAAA,SAEpC,CADA,EAAA,EAAA,EAAO,KAAK,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EEtD3B,IAAM,IAAa,EAAkC,GAAA,YAEpD;;;GAID,OAAA,EAAA,GAAA,EAckB,GAAA;IAdQ,YAAA,EAAA;IAAA,uBAAA,AAAA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EO,EADA,GAAgB,GAAM,CAAK,CAAA,GAAA,CAAA,CAAA,CAAA,EAK9C,GAAA,GAAA,EAAA,CAAA,CAAA,CAAA,GAAA,EAQM,OARN,IAQM,CANF,EAA2D,GAAA;IAAnD,MAAK;IAAgB,OAAM;GACnC,CAAA,GAAA,EAIM,OAJN,GAIM,CAHF,EAEO,QAFP,IAEO,EADA,EAAA,CAAA,CAAE,CAAA,oBAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkUrl-xUBKVJCv.js","names":[],"sources":["../../../../packages/components/src/PkUrl.vue","../../../../packages/components/src/PkUrl.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useShortUrlResolver } from 'composables'\n\n interface Props {\n url: string\n maxLength?: number\n domainClass?: string\n target?: '_blank' | '_self' | '_parent' | '_top'\n rel?: string\n muted?: boolean\n }\n\n const props = withDefaults(defineProps<Props>(), {\n maxLength: 60,\n domainClass: undefined,\n target: '_blank',\n rel: 'noopener noreferrer',\n muted: false,\n })\n\n // Only the displayed URL text is resolved to its real target; the href is\n // kept as the short url so the redirect endpoint still handles tracking.\n const { resolve } = useShortUrlResolver()\n const resolved = resolve(() => props.url)\n const displayUrl = computed(() => resolved.value.url)\n const isResolving = computed(() => resolved.value.loading)\n\n const parsedUrl = computed(() => {\n try {\n const urlObj = new URL(displayUrl.value ?? props.url)\n let hostname = urlObj.hostname\n\n // Remove www. prefix\n if (hostname.startsWith('www.')) hostname = hostname.substring(4)\n\n // Get pathname and remove trailing slash\n let pathname = urlObj.pathname\n if (pathname === '/') pathname = ''\n\n // Split pathname into segments\n const segments = pathname\n .split('/')\n .filter((segment) => segment.length > 0)\n\n return {\n domain: hostname,\n segments,\n fullPath: hostname + pathname,\n }\n } catch {\n // If URL parsing fails, return the original URL\n const fallback = displayUrl.value ?? props.url\n return {\n domain: fallback,\n segments: [],\n fullPath: fallback,\n }\n }\n })\n\n const truncatedUrl = computed(() => {\n if (parsedUrl.value.fullPath.length <= props.maxLength)\n return parsedUrl.value\n\n // If too long, truncate segments from the beginning\n const domain = parsedUrl.value.domain\n const allSegments = parsedUrl.value.segments\n\n // Always show at least the last segment\n if (allSegments.length === 0) {\n return {\n domain,\n segments: [],\n fullPath: domain,\n }\n }\n\n const segments: string[] = []\n\n // Calculate from the end\n let currentLength = domain.length\n\n // Try to fit segments from the end\n for (let i = allSegments.length - 1; i >= 0; i--) {\n const segment = allSegments[i]\n\n // Always include at least the last segment\n if (segments.length === 0) {\n currentLength += segment.length + 1\n segments.unshift(segment)\n } else if (currentLength + segment.length + 1 <= props.maxLength) {\n currentLength += segment.length + 1\n segments.unshift(segment)\n } else {\n segments.unshift('...')\n break\n }\n }\n\n return {\n domain,\n segments,\n fullPath: domain + '/' + segments.join('/'),\n }\n })\n</script>\n\n<template>\n <Component\n :is=\"muted ? 'span' : 'a'\"\n class=\"pk-url\"\n :href=\"muted ? undefined : props.url\"\n :target=\"muted ? undefined : props.target\"\n :rel=\"muted ? undefined : props.rel\">\n <span v-if=\"isResolving\" class=\"pk-url__skeleton vv-skeleton\">\n <span class=\"vv-skeleton__item\" />\n </span>\n <template v-else>\n <span :class=\"['pk-url__domain', domainClass]\">{{\n truncatedUrl.domain\n }}</span>\n <template\n v-for=\"(segment, index) in truncatedUrl.segments\"\n :key=\"index\">\n <span class=\"pk-url__separator\">›</span>\n <span class=\"pk-url__segment\">{{ segment }}</span>\n </template>\n </template>\n </Component>\n</template>\n\n<style lang=\"scss\">\n @layer volver.components {\n .pk-url {\n display: inline-flex;\n align-items: center;\n gap: 0.5ch;\n }\n\n .pk-url__skeleton {\n display: inline-flex;\n width: 12ch;\n max-width: 100%;\n\n .vv-skeleton__item {\n width: 100%;\n height: 1em;\n border-radius: 0.25em;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useShortUrlResolver } from 'composables'\n\n interface Props {\n url: string\n maxLength?: number\n domainClass?: string\n target?: '_blank' | '_self' | '_parent' | '_top'\n rel?: string\n muted?: boolean\n }\n\n const props = withDefaults(defineProps<Props>(), {\n maxLength: 60,\n domainClass: undefined,\n target: '_blank',\n rel: 'noopener noreferrer',\n muted: false,\n })\n\n // Only the displayed URL text is resolved to its real target; the href is\n // kept as the short url so the redirect endpoint still handles tracking.\n const { resolve } = useShortUrlResolver()\n const resolved = resolve(() => props.url)\n const displayUrl = computed(() => resolved.value.url)\n const isResolving = computed(() => resolved.value.loading)\n\n const parsedUrl = computed(() => {\n try {\n const urlObj = new URL(displayUrl.value ?? props.url)\n let hostname = urlObj.hostname\n\n // Remove www. prefix\n if (hostname.startsWith('www.')) hostname = hostname.substring(4)\n\n // Get pathname and remove trailing slash\n let pathname = urlObj.pathname\n if (pathname === '/') pathname = ''\n\n // Split pathname into segments\n const segments = pathname\n .split('/')\n .filter((segment) => segment.length > 0)\n\n return {\n domain: hostname,\n segments,\n fullPath: hostname + pathname,\n }\n } catch {\n // If URL parsing fails, return the original URL\n const fallback = displayUrl.value ?? props.url\n return {\n domain: fallback,\n segments: [],\n fullPath: fallback,\n }\n }\n })\n\n const truncatedUrl = computed(() => {\n if (parsedUrl.value.fullPath.length <= props.maxLength)\n return parsedUrl.value\n\n // If too long, truncate segments from the beginning\n const domain = parsedUrl.value.domain\n const allSegments = parsedUrl.value.segments\n\n // Always show at least the last segment\n if (allSegments.length === 0) {\n return {\n domain,\n segments: [],\n fullPath: domain,\n }\n }\n\n const segments: string[] = []\n\n // Calculate from the end\n let currentLength = domain.length\n\n // Try to fit segments from the end\n for (let i = allSegments.length - 1; i >= 0; i--) {\n const segment = allSegments[i]\n\n // Always include at least the last segment\n if (segments.length === 0) {\n currentLength += segment.length + 1\n segments.unshift(segment)\n } else if (currentLength + segment.length + 1 <= props.maxLength) {\n currentLength += segment.length + 1\n segments.unshift(segment)\n } else {\n segments.unshift('...')\n break\n }\n }\n\n return {\n domain,\n segments,\n fullPath: domain + '/' + segments.join('/'),\n }\n })\n</script>\n\n<template>\n <Component\n :is=\"muted ? 'span' : 'a'\"\n class=\"pk-url\"\n :href=\"muted ? undefined : props.url\"\n :target=\"muted ? undefined : props.target\"\n :rel=\"muted ? undefined : props.rel\">\n <span v-if=\"isResolving\" class=\"pk-url__skeleton vv-skeleton\">\n <span class=\"vv-skeleton__item\" />\n </span>\n <template v-else>\n <span :class=\"['pk-url__domain', domainClass]\">{{\n truncatedUrl.domain\n }}</span>\n <template\n v-for=\"(segment, index) in truncatedUrl.segments\"\n :key=\"index\">\n <span class=\"pk-url__separator\">›</span>\n <span class=\"pk-url__segment\">{{ segment }}</span>\n </template>\n </template>\n </Component>\n</template>\n\n<style lang=\"scss\">\n @layer volver.components {\n .pk-url {\n display: inline-flex;\n align-items: center;\n gap: 0.5ch;\n }\n\n .pk-url__skeleton {\n display: inline-flex;\n width: 12ch;\n max-width: 100%;\n\n .vv-skeleton__item {\n width: 100%;\n height: 1em;\n border-radius: 0.25em;\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAaI,IAAM,IAAQ,GAUR,EAAE,eAAY,EAAoB,GAClC,IAAW,QAAc,EAAM,GAAG,GAClC,IAAa,QAAe,EAAS,MAAM,GAAG,GAC9C,IAAc,QAAe,EAAS,MAAM,OAAO,GAEnD,IAAY,QAAe;GAC7B,IAAI;IACA,IAAM,IAAS,IAAI,IAAI,EAAW,SAAS,EAAM,GAAG,GAChD,IAAW,EAAO;IAGtB,AAAI,EAAS,WAAW,MAAM,MAAG,IAAW,EAAS,UAAU,CAAC;IAGhE,IAAI,IAAW,EAAO;IACtB,AAAI,MAAa,QAAK,IAAW;IAGjC,IAAM,IAAW,EACZ,MAAM,GAAG,CAAA,CACT,QAAQ,MAAY,EAAQ,SAAS,CAAC;IAE3C,OAAO;KACH,QAAQ;KACR;KACA,UAAU,IAAW;IACzB;GACJ,QAAQ;IAEJ,IAAM,IA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qB,EAAA,WAAW,CAAA,EACxC,GAAA,EAAA,EAAA,MAAa,MAAM,GAAA,CAAA,IAEvB,EAAA,EAAA,GAAA,EAKW,GAAA,MAAA,EAJoB,EAAA,MAAa,WAAhC,GAAS,OACX,EAAA,GAAA,EAAA,GAAA,EAAA,KAAA,EAAK,GAAA,CACX,AAAA,EAAA,OAAA,EAAwC,QAAA,EAAlC,OAAM,oBAAmB,GAAC,KAAC,EAAA,GACjC,EAAkD,QAAlD,GAAkD,EAAjB,CAAO,GAAA,CAAA,CAAA,GAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createChatbotApiClient-D9f69brW.js","names":["c","l","d","f","s","n","e","t","i","r"],"sources":["../../../../packages/models/src/schema/ConversationAnalysis.ts","../../../../packages/models/src/schema/Chat.ts","../../../../node_modules/.pnpm/@ucast+core@2.0.0/node_modules/@ucast/core/dist/esm/index.mjs","../../../../node_modules/.pnpm/@ucast+mongo@3.0.0/node_modules/@ucast/mongo/dist/esm/index.mjs","../../../../packages/ability/src/types.ts","../../../../packages/ability/src/roles/User.ts","../../../../packages/ability/src/index.ts","../../../../packages/composable/src/chatbot/api/resolveShortUrls.ts","../../../../packages/composable/src/chatbot/api/createChatbotApiClient.ts"],"sourcesContent":["import * as z from 'zod'\n\nexport enum AbuseCategory {\n Harassment = 'harassment',\n HateSpeech = 'hate_speech',\n SexualContent = 'sexual_content',\n SelfHarm = 'self_harm',\n Violence = 'violence',\n PromptInjection = 'prompt_injection',\n DataExtraction = 'data_extraction',\n Spam = 'spam',\n OffTopicPersistent = 'off_topic_persistent',\n Impersonation = 'impersonation',\n}\n\nexport enum AbuseConfidence {\n Low = 'low',\n Medium = 'medium',\n High = 'high',\n}\n\nexport enum LlmIssueCategory {\n FalseSuccess = 'false_success',\n Hallucination = 'hallucination',\n OffBrand = 'off_brand',\n DataLeak = 'data_leak',\n InappropriateTone = 'inappropriate_tone',\n RefusalLoop = 'refusal_loop',\n Repetition = 'repetition',\n}\n\nexport enum ConversationAnalysisTrigger {\n SummaryCycle = 'summary_cycle',\n AgentRequest = 'agent_request',\n Manual = 'manual',\n}\n\nexport enum UserEngagement {\n High = 'high',\n Medium = 'medium',\n Low = 'low',\n Disengaged = 'disengaged',\n}\n\nexport enum UserTone {\n Polite = 'polite',\n Neutral = 'neutral',\n Impatient = 'impatient',\n Aggressive = 'aggressive',\n Abusive = 'abusive',\n}\n\nexport enum Sentiment {\n Positive = 'positive',\n Neutral = 'neutral',\n Negative = 'negative',\n Frustrated = 'frustrated',\n Excited = 'excited',\n}\n\nexport enum SentimentTrend {\n Improving = 'improving',\n Stable = 'stable',\n Degrading = 'degrading',\n}\n\nexport const ConversationAnalysisSchema = z.object({\n // --- Metadata (set programmatically, not by the LLM) ---\n analyzedAt: z.coerce.date().describe('When the analysis was generated.'),\n analysisTrigger: z\n .enum(ConversationAnalysisTrigger)\n .describe('What triggered this analysis run.'),\n\n // --- Sentiment & Tone ---\n sentiment: z\n .enum(Sentiment)\n .describe('Overall user sentiment in the conversation.'),\n sentimentTrend: z\n .enum(SentimentTrend)\n .describe('How the user sentiment evolved during the conversation.'),\n userTone: z\n .enum(UserTone)\n .describe('Predominant tone of the user messages.'),\n\n // --- Language ---\n language: z\n .string()\n .max(10)\n .describe(\n 'ISO 639-1 language code of the conversation (e.g. \"en\", \"it\").',\n ),\n\n // --- Topics ---\n topics: z\n .array(z.string().max(100))\n .max(10)\n .describe('Main topics discussed, as short lowercase labels.'),\n\n // --- User Abuse Detection ---\n userAbuseDetected: z\n .boolean()\n .describe(\n 'Whether user abuse was detected. If false, userAbuseCategories MUST be empty.',\n ),\n userAbuseCategories: z\n .array(z.enum(AbuseCategory))\n .default([])\n .describe(\n 'Abuse categories detected. Non-empty only if userAbuseDetected is true.',\n ),\n userAbuseConfidence: z\n .enum(AbuseConfidence)\n .optional()\n .describe(\n 'Confidence level of the abuse detection. Set only if userAbuseDetected is true.',\n ),\n userAbuseSummary: z\n .string()\n .max(500)\n .optional()\n .describe(\n 'Brief description of the abusive behavior detected. Always write in English. Set only if userAbuseDetected is true.',\n ),\n\n // --- LLM Quality Issues ---\n llmIssueDetected: z\n .boolean()\n .describe(\n 'Whether an LLM quality issue was detected. If false, llmIssueCategories MUST be empty.',\n ),\n llmIssueCategories: z\n .array(z.enum(LlmIssueCategory))\n .default([])\n .describe(\n 'LLM issue categories detected. Non-empty only if llmIssueDetected is true.',\n ),\n llmIssueSummary: z\n .string()\n .max(500)\n .optional()\n .describe(\n 'Brief description of the LLM quality issue detected. Always write in English. Set only if llmIssueDetected is true.',\n ),\n\n // --- Engagement ---\n userEngagement: z\n .enum(UserEngagement)\n .describe('Level of user engagement in the conversation.'),\n conversationGoalMet: z\n .boolean()\n .optional()\n .describe(\n 'Whether the user seems to have achieved what they came for. Leave undefined if unclear.',\n ),\n\n // --- Risk Score ---\n riskScore: z\n .number()\n .int()\n .min(0)\n .max(100)\n .describe(\n 'Overall risk score (0 = safe, 100 = critical). Combination of abuse severity, persistence and escalation.',\n ),\n})\n\nexport type ConversationAnalysis = z.infer<typeof ConversationAnalysisSchema>\n","import * as z from 'zod'\nimport { zodQs } from '../utils'\nimport type { UIMessage, LanguageModelUsage } from 'ai'\nimport { ConversationAnalysisSchema } from './ConversationAnalysis'\nimport {\n AgentBuiltInTool,\n AgentGatewayOptionsSchema,\n AgentReasoningSchema,\n AgentWebSearchSchema,\n AgentSearchMode,\n AgentRankingSchema,\n} from './Agent'\nimport { MIME_TYPE_REGEX } from './Media'\nimport type { PlatformContext } from './Platform'\n\nimport { DeviceContextSchema, type DeviceContext } from './DeviceContext'\n\nexport { DeviceContextSchema, type DeviceContext }\n\nconst TextPartSchema = z.object({\n type: z.literal('text'),\n text: z.string(),\n})\n\nconst FilePartSchema = z.object({\n type: z.literal('file'),\n mediaType: z.string().regex(MIME_TYPE_REGEX),\n url: z.url(),\n filename: z.string().optional(),\n providerMetadata: z\n .record(z.string(), z.record(z.string(), z.unknown()))\n .optional(),\n})\n\nconst MessagePartSchema = z.discriminatedUnion('type', [\n TextPartSchema,\n FilePartSchema,\n])\n\nexport const ChatRequestSchema = z.object({\n id: z.string(),\n messages: z.array(\n z.object({\n id: z.string().optional(),\n role: z.enum(['assistant', 'user']),\n content: z.string(),\n parts: z.array(MessagePartSchema),\n createdAt: z.string().optional(),\n }),\n ),\n model: z.string().optional(),\n temperature: z.number().optional(),\n prompt: z.string().optional(),\n maxOutputTokens: z.number().positive().optional(),\n presencePenalty: z.number().min(-2).max(2).optional(),\n frequencyPenalty: z.number().min(-2).max(2).optional(),\n searchMode: z.enum(AgentSearchMode).optional(),\n limit: z.number().optional(),\n ranking: AgentRankingSchema.optional(),\n reasoning: AgentReasoningSchema,\n webSearch: AgentWebSearchSchema.optional(),\n maxStepCount: z.number().int().min(1).max(40).optional(),\n disabledTools: z.array(z.enum(AgentBuiltInTool)).optional(),\n fallbackModels: z.array(z.string()).optional(),\n gatewayOptions: AgentGatewayOptionsSchema.partial().optional(),\n deviceContext: DeviceContextSchema.optional(),\n externalContext: z.record(z.string(), z.unknown()).optional(),\n smoothStream: z.boolean().optional(),\n})\n\nexport type ChatRequest = z.infer<typeof ChatRequestSchema>\n\n/**\n * What the chat route validates on the way in.\n *\n * Deliberately not `ChatRequestSchema`: a turn resumed after a client tool or\n * a tool approval posts the assistant message back, whose parts are tool\n * calls, and the part union above accepts text and files only. Pinning the\n * body to it would answer 400 to a legitimate resume. So this validates the\n * envelope the turn cannot run without and lets the rest through untouched\n * (`loose`), which is also why the overrides the client sends still reach the\n * service.\n *\n * The id is minted by the client and read back as a row key: without it the\n * lookup ran with `undefined` and the route answered 500 instead of 400\n * (found 2026-09-21).\n */\nexport const ChatRequestEnvelopeSchema = z\n .object({\n id: z.string().min(1),\n messages: z.array(z.object({ role: z.string() }).loose()).min(1),\n })\n .loose()\n\nexport enum BlockedReasonCode {\n SevereAbuse = 'severe_abuse',\n HighRiskScore = 'high_risk_score',\n RepeatedWarnings = 'repeated_warnings',\n}\n\nexport type ChatMetadata = {\n ipAddress: string\n /** HTTP `Origin` of the request, empty for a server-to-server caller. */\n origin: string\n userAgent: string\n /**\n * Non-default transport the conversation arrived through (for example\n * `openai-api`), so cost and usage reports can isolate it. Absent for the\n * web and widget chat.\n */\n transport?: string\n}\n\n/**\n * Channel a conversation arrived through, as the analytics slice it.\n *\n * Derived at read time and never stored: a platform conversation is identified\n * by `chats.metadata.platform` ({@link PlatformType}), every other non-web\n * surface by `chats.metadata.transport` ({@link ChatTransport}), and a chat\n * carrying neither marker is the web chat or the widget (the historical\n * default, which is why those rows have nothing to read). `reasoning_chats`\n * and `agent_endpoint_logs` have no metadata at all, so each of those tables\n * is a channel by itself.\n *\n * Not to be confused with {@link AgentChannel}, which says where an agent is\n * published (frontoffice, app, widget): this says where a conversation came\n * from.\n *\n * Only the platforms we actually run are listed. `PlatformType` declares five\n * more, and one of those appearing in the data is reported under its own raw\n * value rather than folded into a bucket, so a channel nobody expected shows\n * up in the dashboard instead of hiding inside `other`.\n */\nexport enum ChatChannel {\n /** Web chat and embeddable widget: no marker on the row. */\n Web = 'web',\n WhatsApp = 'whatsapp',\n Teams = 'teams',\n /** Spoken session opened by us, `transport = voice`. */\n Voice = 'voice',\n /** OpenAI-compatible REST surface, `transport = openai-api`. */\n Api = 'api',\n /** Every row of `reasoning_chats`: the reasoning endpoint. */\n Reasoning = 'reasoning',\n /** Every row of `agent_endpoint_logs`: the custom agent endpoints. */\n Endpoint = 'endpoint',\n}\n\nexport const ChatChannelSchema = z.enum(ChatChannel)\n\nexport type ChatMessageActions =\n 'show-info' | 'revise' | 'regenerate' | 'upvote' | 'downvote' | 'feedback'\n\nexport type Chat = z.infer<typeof ChatSchema>\nexport type ChatsQuerystring = z.infer<typeof ChatsQuerystringSchema>\n\nexport type UIChatMessageDeviceContext = DeviceContext\n\nexport type UIChatMessageMetadata = {\n /** Unix timestamp (ms) when the stream started */\n createdAt?: number\n /** Unix timestamp (ms) when the stream finished */\n completedAt?: number\n /** Canonical model ID used for the request (e.g. `google/gemini-3-flash`) */\n model?: string\n /** Total tokens consumed across all steps */\n totalTokens?: number\n /** Per-tool-call durations in ms, keyed by tool call ID */\n partTimings?: Record<string, number>\n /** Client device context sent with the request */\n deviceContext?: UIChatMessageDeviceContext\n /** Platform channel context (WhatsApp/Teams), the device-context equivalent for platform turns */\n platformContext?: PlatformContext\n /** External context provided by the host application and validated server-side */\n externalContext?: Record<string, unknown>\n /** Provider that ultimately served the request (e.g. `vertex`, `openai`) */\n resolvedProvider?: string\n /** Actual model ID as exposed by the resolved provider (e.g. `gemini-3-flash-preview`) */\n resolvedModelId?: string\n /** Market cost of the request in USD, as a numeric string */\n cost?: string\n /** Number of model-level routing attempts made by the gateway */\n modelAttemptCount?: number\n /** Total number of provider-level attempts (includes retries across providers) */\n totalProviderAttemptCount?: number\n /** Whether Zero Data Retention was active for this request */\n zeroDataRetention?: boolean\n /** Whether the provider was instructed not to use the prompt for model training */\n disallowPromptTraining?: boolean\n /** Vercel AI Gateway generation ID, useful for tracing in the Vercel dashboard */\n generationId?: string\n /** Tokens served from the provider's prompt cache (e.g. Gemini context caching) */\n cachedTokens?: number\n /** Provider traffic tier (e.g. `PROVISIONED_THROUGHPUT`, `ON_DEMAND`) */\n trafficType?: string\n /**\n * Transport the message travelled through ({@link ChatTransport}), when it\n * was not the web chat itself: `voice` marks a spoken exchange (the user\n * text is the call transcription, the assistant text was read aloud),\n * `openai-api` an API turn. Absent on plain web messages.\n */\n transport?: string\n}\n\nexport type UIChatMessage = UIMessage & {\n metadata?: UIChatMessageMetadata\n}\n\n/**\n * States in which a tool invocation part waits for nothing more.\n *\n * Two readers, one meaning: the backend leaves such a part alone instead of\n * forcing it to a terminal state (`completeUnresolvedToolInvocations`), and the\n * web client counts it as answered when deciding whether to resume a suspended\n * turn (`sendAutomaticallyWhen` in `useChatbotStore`). They used to keep a copy\n * each, with different membership.\n */\nexport const TOOL_TERMINAL_STATES: ReadonlySet<string> = new Set([\n 'output-available',\n 'output-error',\n 'output-denied',\n])\n\nexport const ChatSchema = z.object({\n id: z.string(),\n messages: z.array(z.unknown()) as unknown as z.ZodType<UIChatMessage[]>,\n title: z.string().nullable(),\n summary: z.string().nullable(),\n messageCountAtLastSummary: z.string().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n metadata: z.record(z.string(), z.unknown()),\n totalCostInUSD: z.string(),\n usage: z.unknown() as unknown as z.ZodType<LanguageModelUsage>,\n agentId: z.string().nullable(),\n userId: z.string(),\n organizationId: z.string(),\n deleted: z.boolean(),\n deletedAt: z.coerce.date().nullable(),\n deletedBy: z.string().nullable(),\n conversationAnalysis: ConversationAnalysisSchema.nullable().optional(),\n blocked: z.boolean(),\n blockedAt: z.coerce.date().nullable(),\n blockedReasonCode: z.enum(BlockedReasonCode).nullable(),\n blockedReason: z.string().nullable(),\n warningCount: z.number(),\n lastMessageAt: z.coerce.date(),\n})\n\nexport const ChatsQuerystringSchema = z.object({\n ...zodQs.pagination(),\n ...zodQs.sort(['updatedAt', 'createdAt', 'lastMessageAt']),\n ...zodQs.filters(['agentId', 'userId']),\n ...zodQs.range('updatedAt'),\n ...zodQs.range('lastMessageAt'),\n ...zodQs.ids(),\n startDate: z.string().optional(),\n endDate: z.string().optional(),\n})\n\nexport const ChatsPublicSchema = z.object({\n id: z.string(),\n agentId: z.string().optional(),\n organizationId: z.string(),\n summary: z.string().optional(),\n title: z.string().optional(),\n userId: z.string(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n lastMessageAt: z.coerce.date(),\n messages: z.array(z.unknown()),\n blocked: z.boolean(),\n})\n\nexport type ChatPublic = z.infer<typeof ChatsPublicSchema>\n","var e=class{constructor(e,t){this.operator=e,this.value=t,Object.defineProperty(this,`_notes`,{writable:!0})}get notes(){return this._notes}addNote(e){this._notes=this._notes||[],this._notes.push(e)}},t=class extends e{},n=class extends t{constructor(e,t){if(!Array.isArray(t))throw Error(`\"${e}\" operator expects to receive an array of conditions`);super(e,t)}};const r=`__itself__`;var i=class extends e{constructor(e,t,n){super(e,n),this.field=t}};const a=new t(`__null__`,null),o=Object.hasOwn||((e,t)=>Object.prototype.hasOwnProperty.call(e,t));function s(e,t){return t instanceof n&&t.operator===e}function c(e,t){let r;for(let i=0,a=t.length;i<a;i++){let a=t[i];if(a instanceof n){if(a.operator!==e){r&&r.push(a);continue}if(a.value.length===0)continue;r||(r=t.slice(0,i));let n=a.value;for(let e=0,t=n.length;e<t;e++)r.push(n[e])}else r&&r.push(a)}return r||t}function l(e,t){if(t.length===1)return t[0];if(t.length===0)return new n(e,t);let r=c(e,t);return r.length===1?r[0]:(r.length,new n(e,r))}const u=e=>e,d=()=>Object.create(null),f=Object.defineProperty(d(),`__@type@__`,{value:`ignore value`});function p(e,t,n=!1){if(!e||e&&e.constructor!==Object)return!1;for(let r in e)if(o(e,r)&&o(t,r)&&(!n||e[r]!==f))return!0;return!1}function m(e){let t=[];for(let n in e)o(e,n)&&e[n]!==f&&t.push(n);return t}function h(e,t){t!==a&&e.push(t)}const g=e=>l(`and`,e),_=e=>l(`or`,e);function v(e,t){let n=e[t];if(typeof n!=`function`)throw Error(`Unable to interpret \"${String(t)}\" condition. Did you forget to register interpreter for it?`);return n}function y(e){return e.operator}function b(e,t){let n=t,r=n&&n.getInterpreterName||y,i;switch(n?n.numberOfArguments:0){case 1:i=(t=>v(e,r(t,n))(t,a));break;case 3:i=((t,i,o)=>v(e,r(t,n))(t,i,o,a));break;default:i=((t,i)=>v(e,r(t,n))(t,i,a));break}let a={...n,interpret:i};return a.interpret}const x={compound(e,t,r){let i=(Array.isArray(t)?t:[t]).map(e=>r.parse(e));return new n(e.name,i)},field(e,t,n){return new i(e.name,n.field,t)},document(e,n){return new t(e.name,n)}};var S=class{constructor(e,t=d()){this.parse=this.parse.bind(this),this._options={operatorToConditionName:t.operatorToConditionName||u,defaultOperatorName:t.defaultOperatorName||`eq`,mergeFinalConditions:t.mergeFinalConditions||g},this._instructions=Object.keys(e).reduce((t,n)=>(t[n]={name:this._options.operatorToConditionName(n),...e[n]},t),{}),this._fieldInstructionContext={...t.fieldContext,field:``,query:{},parse:this.parse,hasOperators:e=>p(e,this._instructions,t.useIgnoreValue)},this._documentInstructionContext={...t.documentContext,parse:this.parse,query:{}},this._objectKeys=t.useIgnoreValue?m:Object.keys}setParse(e){this.parse=e,this._fieldInstructionContext.parse=e,this._documentInstructionContext.parse=e}parseField(e,t,n,r){let i=this._instructions[t];if(!i)throw Error(`Unsupported operator \"${t}\"`);if(i.type!==`field`)throw Error(`Unexpected ${i.type} operator \"${t}\" at field level`);return this._fieldInstructionContext.field=e,this._fieldInstructionContext.query=r,this.parseInstruction(i,n,this._fieldInstructionContext)}parseInstruction(e,t,n){return typeof e.validate==`function`&&e.validate(e,t),(e.parse||x[e.type])(e,t,n)}parseFieldOperators(e,t){let n=[],r=this._objectKeys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i];if(!this._instructions[a])throw Error(`Field query for \"${e}\" may contain only operators or a plain object as a value`);h(n,this.parseField(e,a,t[a],t))}return n}parse(e){let t=[],n=this._objectKeys(e);this._documentInstructionContext.query=e;for(let r=0,i=n.length;r<i;r++){let i=n[r],a=e[i],o=this._instructions[i];if(o){if(o.type!==`document`&&o.type!==`compound`)throw Error(`Cannot use parsing instruction for operator \"${i}\" in \"document\" context as it is supposed to be used in \"${o.type}\" context`);h(t,this.parseInstruction(o,a,this._documentInstructionContext))}else this._fieldInstructionContext.hasOperators(a)?t.push(...this.parseFieldOperators(i,a)):h(t,this.parseField(i,this._options.defaultOperatorName,a,e))}return this._options.mergeFinalConditions(t)}};function C(e,t){return(n,...r)=>{let i=e(n,...r),a=t.bind(null,i);return Object.defineProperty(a,`ast`,{value:i}),a}}export{n as CompoundCondition,e as Condition,t as DocumentCondition,i as FieldCondition,r as ITSELF,a as NULL_CONDITION,S as ObjectQueryParser,g as buildAnd,_ as buildOr,b as createInterpreter,C as createTranslatorFactory,x as defaultInstructionParsers,p as hasOperators,u as identity,f as ignoreValue,s as isCompound,d as object,l as optimizedCompoundCondition};\n//# sourceMappingURL=index.mjs.map","import{CompoundCondition as e,FieldCondition as t,ITSELF as n,NULL_CONDITION as r,ObjectQueryParser as i,buildAnd as a,defaultInstructionParsers as o,optimizedCompoundCondition as s}from\"@ucast/core\";var c=Object.defineProperty,l=((e,t)=>{let n={};for(var r in e)c(n,r,{get:e[r],enumerable:!0});return t||c(n,Symbol.toStringTag,{value:`Module`}),n})({$all:()=>y,$and:()=>u,$elemMatch:()=>h,$eq:()=>E,$exists:()=>x,$gt:()=>C,$gte:()=>S,$in:()=>_,$lt:()=>w,$lte:()=>T,$mod:()=>b,$ne:()=>D,$nin:()=>v,$nor:()=>f,$not:()=>m,$options:()=>k,$or:()=>d,$regex:()=>O,$size:()=>g,$where:()=>A});const u={type:`compound`,validate:M,parse(e,t,n){let r=p(e,t,n);return s(e.name,r)}},d=u,f={type:`compound`,validate:M,parse(t,n,r){let i=p(t,n,r);return new e(t.name,i)}};function p(e,t,n){let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i];F(e,a,i),r[i]=n.parse(a)}return r}const m={type:`field`,validate(e,t){if(!(t&&(t instanceof RegExp||t.constructor===Object)))throw Error(`\"${e.name}\" expects to receive either regular expression or object of field operators`)},parse(n,r,i){let a=r instanceof RegExp?new t(`regex`,i.field,r):i.parse(r,i);return new e(n.name,[a])}},h={type:`field`,validate(e,t){if(!t||t.constructor!==Object)throw Error(`\"${e.name}\" expects to receive an object with nested query or field level operators`)},parse(e,r,{parse:i,field:a,hasOperators:o}){let s=o(r)?i(r,{field:n}):i(r);return new t(e.name,a,s)}},g={type:`field`,validate:P(`number`)},_={type:`field`,validate:j},v=_,y=_,b={type:`field`,validate(e,t){if(!Array.isArray(t)||t.length!==2)throw Error(`\"${e.name}\" expects an array with 2 numeric elements`)}},x={type:`field`,validate:P(`boolean`)},S={type:`field`,validate:N},C=S,w=C,T=C,E={type:`field`},D=E,O={type:`field`,validate(e,t){if(!(t instanceof RegExp)&&typeof t!=`string`)throw Error(`\"${e.name}\" expects value to be a regular expression or a string that represents regular expression`)},parse(e,n,r){let i=typeof n==`string`?new RegExp(n,r.query.$options||``):n;return new t(e.name,r.field,i)}},k={type:`field`,parse:()=>r},A={type:`document`,validate:P(`function`)};function j(e,t){if(!Array.isArray(t))throw Error(`\"${e.name}\" expects value to be an array`)}function M(e,t){if(j(e,t),!t.length)throw Error(`\"${e.name}\" expects to have at least one element in array`)}function N(e,t){if(!(typeof t==`string`||typeof t==`number`||t instanceof Date))throw Error(`\"${e.name}\" expects value to be comparable (i.e., string, number or date)`)}function P(e){return(t,n)=>{if(typeof n!==e)throw Error(`\"${t.name}\" expects value to be a \"${e}\"`)}}function F(e,t,n){let r=t;if(!r||r.constructor!==Object)throw Error(`\"${e.name}\" expects item at index ${n} to be an object`)}var I=class extends i{constructor(e){super(e,{defaultOperatorName:`$eq`,operatorToConditionName:e=>e.slice(1)})}parse(e,t){return t&&t.field?a(this.parseFieldOperators(t.field,e)):super.parse(e)}};const L=l;export{y as $all,u as $and,h as $elemMatch,E as $eq,x as $exists,C as $gt,S as $gte,_ as $in,w as $lt,T as $lte,b as $mod,D as $ne,v as $nin,f as $nor,m as $not,k as $options,d as $or,O as $regex,g as $size,A as $where,I as MongoQueryParser,L as allParsingInstructions,o as defaultParsers};\n//# sourceMappingURL=index.mjs.map","import type { MongoQuery } from '@ucast/mongo2js'\n\n// Minimal structural shape of the better-auth session consumed here.\n// Declared locally to avoid a workspace dependency cycle with `auth`\n// (auth depends on `ability` for its access-control config).\n// The full `auth` Session is structurally assignable to this type.\nexport type Session = {\n session: {\n activeOrganizationId?: string | null\n organizationRole?: string | null\n }\n user: {\n id?: string\n role?: string | null\n }\n}\n\nexport enum Audience {\n Backoffice = 'backoffice',\n Frontoffice = 'frontoffice',\n System = 'system',\n Public = 'public',\n}\n\nexport enum Subject {\n All = 'all',\n Todo = 'todo',\n User = 'user',\n Chat = 'chat',\n Agent = 'agent',\n SubAgent = 'subAgent',\n Document = 'document',\n AgentDocument = 'agent_document',\n AgentAnalytic = 'agent_analytic',\n McpServer = 'mcp_server',\n Media = 'media',\n RevisedAnswer = 'revised_answer',\n Organization = 'organization',\n Member = 'member',\n Lead = 'lead',\n MessageFeedback = 'message_feedback',\n Backoffice = 'backoffice',\n Frontoffice = 'frontoffice',\n System = 'system',\n Invitation = 'invitation',\n Crawler = 'crawler',\n ReasoningChat = 'reasoning_chat',\n TimeTrackerChat = 'time_tracker_chat',\n OrganizationExternalAuth = 'organization_external_auth',\n AgentEndpoint = 'agent_endpoint',\n AgentEndpointLog = 'agent_endpoint_log',\n AgentApiTool = 'agent_api_tool',\n DocumentFolder = 'document_folder',\n Integration = 'integration',\n Notification = 'notification',\n PlatformConnection = 'platform_connection',\n}\n\n// action\nexport type Action =\n | 'create'\n | 'read'\n | 'update'\n | 'delete'\n | 'manage'\n | 'impersonate'\n | 'invite'\n | 'access'\n | 'clone'\n | 'ban'\n | 'unban'\n | 'change-role'\n | 'resend'\n | 'cancel'\n | 'execute'\n | 'refill'\n\nexport type Capability = {\n action: Action\n subject: Subject\n fields?: string[]\n condition?: MongoQuery\n inverted?: boolean\n}\n\nexport type CapabilitiesFactory = (\n currentSession?: Session | null,\n) => Capability[]\n","import { AgentStatus } from 'models'\nimport type { CapabilitiesFactory } from '../types'\nimport { Subject } from '../types'\n\nconst GuestCapabilities: CapabilitiesFactory = (currentSession) => {\n if (!currentSession) {\n return []\n }\n return [\n // chats\n {\n subject: Subject.Chat,\n action: 'create',\n },\n {\n subject: Subject.Chat,\n action: 'read',\n condition: {\n createdBy: {\n $eq: currentSession.user?.id,\n },\n },\n },\n {\n subject: Subject.Chat,\n action: 'update',\n },\n {\n subject: Subject.Chat,\n action: 'delete',\n },\n // agents\n {\n subject: Subject.Agent,\n action: 'read',\n condition: {\n status: {\n $eq: AgentStatus.Active,\n },\n },\n },\n // feedbacks\n {\n subject: Subject.MessageFeedback,\n action: 'create',\n },\n {\n subject: Subject.MessageFeedback,\n action: 'read',\n condition: {\n createdBy: {\n $eq: currentSession.user?.id,\n },\n },\n },\n ]\n}\nexport default GuestCapabilities\n","import type { MongoAbility, InferSubjects, ForcedSubject } from '@casl/ability'\nimport type { MongoQuery } from '@ucast/mongo2js'\nimport { Action, Capability, Subject, type Session } from './types'\nimport { $or } from '@ucast/mongo2js'\nimport {\n AbilityBuilder,\n createMongoAbility,\n buildMongoQueryMatcher,\n Ability as PureAbility,\n createAliasResolver,\n FieldMatcher,\n subject as caslSubject,\n} from '@casl/ability'\nimport { organizationCapabilitiesByRole, userCapabilitiesByRole } from './roles'\nimport DefaultCapabilities from './roles/User'\nimport { createAccessControl } from 'better-auth/plugins'\nimport {\n adminAc,\n defaultStatements,\n memberAc,\n ownerAc,\n} from 'better-auth/plugins/organization/access'\n\nexport const OrganizationRoles = {\n admin: 'admin',\n owner: 'owner',\n member: 'member',\n user: 'user',\n} as const\n\nexport const UserRoles = {\n admin: 'admin',\n user: 'user',\n} as const\n\n// action alias\nconst resolveAction = createAliasResolver({\n modify: ['read', 'update', 'delete'],\n})\n\n// subject\nexport type AbilitySubject =\n | InferSubjects<'all' | Subject, true>\n | ForcedSubject<InferSubjects<'all' | Subject, true>>\ntype Ability = MongoAbility<[Action, AbilitySubject]>\n\n// matcher\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst conditionsMatcher = buildMongoQueryMatcher({ $or } as Record<string, any>)\nconst fieldMatcher: FieldMatcher = (fields) => (field) => fields.includes(field)\n\n// ability\nexport const ability = new PureAbility<[Action, AbilitySubject], MongoQuery>(\n DefaultCapabilities(),\n {\n conditionsMatcher,\n resolveAction,\n fieldMatcher,\n },\n)\n\nexport const isValidOrganizationRole = (\n role?: string | null,\n): role is keyof typeof OrganizationRoles => {\n if (!role) {\n return false\n }\n return role in OrganizationRoles\n}\n\nexport const isValidUserRole = (\n role?: string | null,\n): role is keyof typeof UserRoles => {\n if (!role) {\n return false\n }\n return role in UserRoles\n}\n\nexport const getOrganizationRoleCapabilities = (\n currentSession?: Session | null,\n): Capability[] => {\n const organizationRole = currentSession?.session?.organizationRole\n if (!isValidOrganizationRole(organizationRole)) {\n return DefaultCapabilities(currentSession)\n }\n const capabilities = organizationCapabilitiesByRole[organizationRole]\n if (typeof capabilities === 'function') {\n return capabilities(currentSession)\n }\n return capabilities\n}\n\nexport const getUserRoleCapabilities = (\n currentSession?: Session | null,\n): Capability[] => {\n const userRole = currentSession?.user?.role\n if (!isValidUserRole(userRole)) {\n return DefaultCapabilities(currentSession)\n }\n const capabilities = userCapabilitiesByRole[userRole]\n if (typeof capabilities === 'function') {\n return capabilities(currentSession)\n }\n return capabilities\n}\n\n/**\n * Builds a standalone ability instance for a session, without touching the\n * shared singleton. Use for per-call checks outside the HTTP request flow\n * (e.g. MCP tool handlers).\n */\nexport const buildAbilityForSession = (\n currentSession?: Session | null,\n): Ability => {\n const { can, build, cannot } = new AbilityBuilder<Ability>(\n createMongoAbility,\n )\n const organizationRoleCapabilities =\n getOrganizationRoleCapabilities(currentSession)\n const userRoleCapabilities = getUserRoleCapabilities(currentSession)\n const capabilities = [\n ...organizationRoleCapabilities,\n ...userRoleCapabilities,\n ]\n capabilities.forEach((capability) => {\n const { action, subject, fields, condition, inverted } = capability\n if (inverted) {\n cannot(action, subject, fields, condition)\n return\n }\n can(action, subject, fields, condition)\n })\n return build({\n conditionsMatcher,\n resolveAction,\n fieldMatcher,\n })\n}\n\nexport const updateAbilityFromSession = (currentSession?: Session | null) => {\n ability.update(buildAbilityForSession(currentSession).rules)\n}\n\nexport type PermissionMap = Partial<Record<Action, Subject>>\n\n/**\n * Evaluates a route-style permission map ({ action: Subject }) against an\n * ability instance. When `payload` is provided it is bound as subject\n * conditions, same as the HTTP route preHandler does with `request.body`.\n * Returns the first denied pair, or null when every check passes.\n * Single source of truth for both the HTTP preHandler and the Platform MCP\n * tool handlers.\n */\nexport const findDeniedPermission = (\n abilityInstance: Pick<Ability, 'can'>,\n permissions: PermissionMap,\n payload?: unknown,\n): { action: Action; subject: Subject } | null => {\n let action: Action\n for (action in permissions) {\n const actionSubject = permissions[action]\n if (!actionSubject) {\n continue\n }\n const target = payload\n ? caslSubject(\n actionSubject,\n payload as Record<PropertyKey, unknown>,\n )\n : actionSubject\n if (!abilityInstance.can(action, target)) {\n return { action, subject: actionSubject }\n }\n }\n return null\n}\n\nconst ac = createAccessControl(defaultStatements)\nconst adminRole = ac.newRole(adminAc.statements)\nconst ownerRole = ac.newRole(ownerAc.statements)\nconst memberRole = ac.newRole(memberAc.statements)\nconst userRole = ac.newRole(memberAc.statements)\n\nexport const betterAuthOrganizationSettings = {\n ac,\n roles: {\n owner: ownerRole,\n admin: adminRole,\n member: memberRole,\n user: userRole,\n },\n}\n\n/**\n * Whether a user is currently banned. A ban with no expiry is permanent, one\n * with an expiry in the future is still in force, one already elapsed is not.\n * Every admission path (API key, Platform MCP, voice callback) must apply the\n * same rule: a ban that holds in one path and not another is a hole.\n */\nexport const isUserBanned = (\n user:\n | { banned?: boolean | null; banExpires?: Date | null }\n | null\n | undefined,\n): boolean =>\n user?.banned === true &&\n (user.banExpires === null ||\n user.banExpires === undefined ||\n user.banExpires > new Date())\n\nexport * from './types'\nexport { subject } from '@casl/ability'\n","import { removeTrailingSlash } from 'utils'\n\nexport interface ResolveShortUrlsOptions {\n /** Extra headers to send (e.g. auth). */\n headers?: Record<string, string>\n /** Fetch credentials mode. Defaults to `'include'`. */\n credentials?: RequestCredentials\n}\n\n/**\n * Single implementation of the short-url batch resolve used across apps\n * (chatbot api client, frontend app root). Maps `/api/r/<hash>` short urls back\n * to their real target via `POST <backend>/api/r/resolve`.\n *\n * The redirect endpoint lives at `/api/r`, outside the JSON:API basePath, and\n * is unauthenticated. Returns an empty map (short urls left untouched) on any\n * failure so callers never have to handle errors.\n */\nexport async function resolveShortUrls(\n backendUrl: string,\n hashes: string[],\n options: ResolveShortUrlsOptions = {},\n): Promise<Record<string, string>> {\n try {\n const root = removeTrailingSlash(backendUrl)\n const response = await fetch(`${root}/api/r/resolve`, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n headers: {\n ...options.headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ hashes }),\n })\n if (!response.ok) {\n return {}\n }\n const data = (await response.json()) as {\n urls?: Record<string, string>\n }\n return data.urls ?? {}\n } catch {\n return {}\n }\n}\n","import { Audience } from 'ability'\nimport { ChatSchema, ChatsPublicSchema, VoiceSessionSchema } from 'models'\nimport type {\n AgentAccess,\n Chat,\n DeviceContext,\n MessageFeedback,\n AgentPublic,\n MediaSource,\n VoiceSession,\n} from 'models'\nimport { addInitialSlash, removeTrailingSlash } from 'utils'\nimport { resolveShortUrls as resolveShortUrlsRequest } from './resolveShortUrls'\n\n// The chats endpoints respond with the full shape (frontoffice) or the\n// trimmed public one — same union the backend declares. Parsing coerces the\n// date fields (plain JSON strings otherwise); on mismatch keep the raw\n// payload instead of failing.\nconst ConversationSchema = ChatSchema.or(ChatsPublicSchema)\nfunction parseConversation(raw: unknown): Chat {\n const result = ConversationSchema.safeParse(raw)\n return (result.success ? result.data : raw) as Chat\n}\n\n/**\n * What went wrong, in words, from the problem+json the backend answers with\n * (`{ type, title, status, message }`). Falling straight back to the status\n * produced \"API error: 409\" on screen, which tells the reader nothing and hides\n * a message that was already there and already explains the fix.\n */\nasync function readErrorMessage(response: Response): Promise<string> {\n const fallback = `${response.status} ${response.statusText}`.trim()\n try {\n const body = (await response.json()) as {\n message?: string\n title?: string\n }\n return body.message?.trim() || body.title?.trim() || fallback\n } catch {\n return fallback\n }\n}\n\nexport interface ChatbotApiClientOptions {\n baseUrl: string\n basePath?: string\n headers?: () => Record<string, string> | undefined\n credentials?: RequestCredentials\n}\n\nexport interface SubmitFeedbackPayload {\n messageId: string\n chatId: string\n agentId: string\n vote?: 'upvote' | 'downvote'\n userQuestion: string\n assistantMessage: string\n comment?: string\n}\n\nexport interface SubmitLeadPayload {\n agentId: string\n chatId: string\n [key: string]: unknown\n}\n\n/** A file from the user's \"My files\" KB, as listed for a chat. */\nexport interface ChatbotFile {\n documentId: string\n name: string | null\n mimeType: string | null\n indexStatus: string\n createdAt: string\n}\n\nexport interface ChatbotApiClient {\n getConversations(\n agentId: string,\n userId: string | undefined,\n ): Promise<Chat[]>\n getChat(agentId: string, chatId: string): Promise<Chat | null>\n updateChatTitle(\n agentId: string,\n chatId: string,\n title: string,\n ): Promise<Chat>\n deleteChat(agentId: string, chatId: string): Promise<void>\n getMessageFeedbacks(chatId: string): Promise<MessageFeedback[]>\n submitMessageFeedback(\n payload: SubmitFeedbackPayload,\n ): Promise<MessageFeedback>\n submitLead(payload: SubmitLeadPayload): Promise<void>\n getAgent(orgSlug: string, agentId: string): Promise<AgentPublic>\n getAgentAccess(orgSlug: string, agentId: string): Promise<AgentAccess>\n getMediaUrl(agentId: string, chatId: string, storedFileName: string): string\n appendAuthToken(url: string): string\n uploadMedia(\n agentId: string,\n chatId: string,\n file: File,\n ): Promise<MediaSource>\n getChatEndpoint(agentId: string, type?: 'chat' | 'reasoning'): string\n expandSourceContext(\n agentId: string,\n documentId: string,\n chunkIndex: number,\n windowSize?: number,\n ): Promise<{ content: string }>\n downloadSourceDocument(\n agentId: string,\n documentId: string,\n ): Promise<{ downloadUrl: string; filename: string; mimeType: string }>\n reverseGeocode(\n lat: number,\n lon: number,\n lang?: string,\n ): Promise<string | undefined>\n forwardGeocode(\n query: string,\n lang?: string,\n ): Promise<\n { latitude: number; longitude: number; displayName: string } | undefined\n >\n getOAuthAuthorizeUrl(\n agentId: string,\n serverName: string,\n ): Promise<{ mcpServerId: string; authorizeUrl: string }>\n getOAuthConnectionStatus(\n agentId: string,\n serverName: string,\n ): Promise<{ mcpServerId: string; connected: boolean }>\n resolveShortUrls(hashes: string[]): Promise<Record<string, string>>\n getChatFiles(chatId: string): Promise<ChatbotFile[]>\n getChatFileDownloadUrl(documentId: string, inline?: boolean): string\n getChatFilePreviewUrl(documentId: string): string\n deleteChatFile(documentId: string): Promise<void>\n createVoiceSession(\n agentId: string,\n chatId?: string,\n /**\n * Everything the call inherits from the page it starts on. Sent once,\n * because the spoken turns arrive from the voice provider and carry\n * none of it.\n */\n context?: {\n deviceContext?: DeviceContext\n externalContext?: Record<string, unknown>\n },\n ): Promise<VoiceSession>\n closeVoiceSession(agentId: string, sessionId: string): Promise<void>\n}\n\nexport function createChatbotApiClient(\n options: ChatbotApiClientOptions,\n): ChatbotApiClient {\n const basePath = options.basePath\n ? addInitialSlash(options.basePath)\n : `/api/v1/${Audience.Public}`\n\n const baseUrl = `${removeTrailingSlash(options.baseUrl)}${basePath}`\n\n // \"My files\" lives under the frontoffice audience, not the agent's base\n // (which may be public, backoffice, …) — derive it by swapping the trailing\n // audience segment of basePath for `frontoffice`.\n const frontofficeBase = `${removeTrailingSlash(options.baseUrl)}${basePath.replace(\n /\\/[^/]+$/,\n `/${Audience.Frontoffice}`,\n )}`\n\n async function request<T>(\n url: string,\n init?: RequestInit,\n responseType: 'json' | 'void' = 'json',\n ): Promise<T> {\n const response = await fetch(`${baseUrl}${url}`, {\n credentials: options.credentials ?? 'include',\n ...init,\n headers: {\n ...options.headers?.(),\n ...init?.headers,\n },\n })\n\n if (!response.ok) {\n throw new Error(await readErrorMessage(response))\n }\n\n if (responseType === 'void' || response.status === 204) {\n return undefined as T\n }\n\n return response.json() as Promise<T>\n }\n\n return {\n async getConversations(agentId, userId) {\n const userFilter = userId\n ? `&filter[userId]=${encodeURIComponent(userId)}`\n : ''\n const conversations = await request<unknown[]>(\n `/agents/${encodeURIComponent(agentId)}/chats?sort=-lastMessageAt&page[size]=100${userFilter}`,\n )\n return conversations.map(parseConversation)\n },\n\n async getChatFiles(chatId) {\n const response = await fetch(\n `${frontofficeBase}/me/documents?filter[chatId]=${encodeURIComponent(chatId)}&page[size]=100`,\n {\n credentials: options.credentials ?? 'include',\n headers: { ...options.headers?.() },\n },\n )\n if (!response.ok) {\n throw new Error(\n `API error: ${response.status} ${response.statusText}`,\n )\n }\n return (await response.json()) as ChatbotFile[]\n },\n\n getChatFileDownloadUrl(documentId, inline) {\n const suffix = inline ? '?inline=true' : ''\n // appendAuthToken carries a bearer in the query so <img>/<a>\n // subresources (which can't set an Authorization header) authorize\n // cross-origin in the embedded widget; no-op for cookie auth.\n return this.appendAuthToken(\n `${frontofficeBase}/me/documents/${encodeURIComponent(documentId)}/download${suffix}`,\n )\n },\n\n getChatFilePreviewUrl(documentId) {\n // Small resized preview blob for row thumbnails (see download\n // endpoint ?preview=true); auth token carried for cross-origin <img>.\n return this.appendAuthToken(\n `${frontofficeBase}/me/documents/${encodeURIComponent(documentId)}/download?preview=true`,\n )\n },\n\n async deleteChatFile(documentId) {\n const response = await fetch(\n `${frontofficeBase}/me/documents/${encodeURIComponent(documentId)}`,\n {\n method: 'DELETE',\n credentials: options.credentials ?? 'include',\n headers: { ...options.headers?.() },\n },\n )\n if (!response.ok) {\n throw new Error(\n `API error: ${response.status} ${response.statusText}`,\n )\n }\n },\n\n async getChat(agentId, chatId) {\n const result = await request<Chat | undefined>(\n `/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}`,\n )\n return result ? parseConversation(result) : null\n },\n\n async updateChatTitle(agentId, chatId, title) {\n return parseConversation(\n await request<Chat>(\n `/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}`,\n {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ title }),\n },\n ),\n )\n },\n\n async deleteChat(agentId, chatId) {\n await request<void>(\n `/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}`,\n { method: 'DELETE' },\n 'void',\n )\n },\n\n async getMessageFeedbacks(chatId) {\n return request<MessageFeedback[]>(\n `/message-feedbacks?filter[chatId]=${encodeURIComponent(chatId)}&page[size]=200`,\n )\n },\n\n async submitMessageFeedback(payload) {\n return request<MessageFeedback>('/message-feedbacks', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n })\n },\n\n async submitLead(payload) {\n await request<void>(\n '/leads',\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n },\n 'void',\n )\n },\n\n async getAgent(orgSlug, agentId) {\n return request<AgentPublic>(\n `/organizations/${encodeURIComponent(orgSlug)}/agents/${encodeURIComponent(agentId)}`,\n )\n },\n\n async getAgentAccess(orgSlug, agentId) {\n return request<AgentAccess>(\n `/organizations/${encodeURIComponent(orgSlug)}/agents/${encodeURIComponent(agentId)}/access`,\n )\n },\n\n async uploadMedia(agentId, chatId, file) {\n const formData = new FormData()\n formData.append('file', file)\n const response = await fetch(\n `${baseUrl}/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}/media/upload`,\n {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n // Do NOT set Content-Type — browser sets multipart/form-data with boundary automatically\n headers: options.headers?.(),\n body: formData,\n },\n )\n if (!response.ok) {\n const text = await response.text().catch(() => '')\n let title = `Upload failed: ${response.status}`\n try {\n title =\n (JSON.parse(text) as { title?: string }).title ?? title\n } catch {\n // ignore parse errors\n }\n throw new Error(title)\n }\n return response.json() as Promise<MediaSource>\n },\n\n getChatEndpoint(agentId, type = 'chat') {\n const path = type === 'reasoning' ? 'reasoning-chat' : 'chat'\n return `${baseUrl}/agents/${encodeURIComponent(agentId)}/${path}`\n },\n\n appendAuthToken(url) {\n const bearer = options\n .headers?.()\n ?.[`Authorization`]?.slice('Bearer '.length)\n if (!bearer) {\n return url\n }\n const separator = url.includes('?') ? '&' : '?'\n return `${url}${separator}token=${encodeURIComponent(bearer)}`\n },\n\n getMediaUrl(agentId, chatId, storedFileName) {\n const base = `${baseUrl}/agents/${encodeURIComponent(agentId)}/chats/${encodeURIComponent(chatId)}/media/${encodeURIComponent(storedFileName)}/view`\n return this.appendAuthToken(base)\n },\n\n async expandSourceContext(\n agentId,\n documentId,\n chunkIndex,\n windowSize = 2,\n ) {\n return request<{ content: string }>(\n `/agents/${encodeURIComponent(agentId)}/sources/expand-context`,\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n documentId,\n chunkIndex,\n windowSize,\n }),\n },\n )\n },\n\n async downloadSourceDocument(agentId, documentId) {\n return request<{\n downloadUrl: string\n filename: string\n mimeType: string\n }>(\n `/agents/${encodeURIComponent(agentId)}/sources/documents/${encodeURIComponent(documentId)}/download`,\n )\n },\n\n async reverseGeocode(lat, lon, lang) {\n const params = new URLSearchParams({\n lat: String(lat),\n lon: String(lon),\n })\n if (lang) {\n params.set('lang', lang)\n }\n try {\n const data = await request<{ displayName?: string }>(\n `/geocoder/reverse?${params}`,\n )\n return data.displayName\n } catch {\n return undefined\n }\n },\n\n async forwardGeocode(query, lang) {\n const params = new URLSearchParams({ q: query })\n if (lang) {\n params.set('lang', lang)\n }\n try {\n return await request<{\n latitude: number\n longitude: number\n displayName: string\n }>(`/geocoder/forward?${params}`)\n } catch {\n return undefined\n }\n },\n\n async getOAuthAuthorizeUrl(agentId, serverName) {\n const params = new URLSearchParams({ serverName })\n return request<{ mcpServerId: string; authorizeUrl: string }>(\n `/agents/${encodeURIComponent(agentId)}/mcp-oauth/authorize?${params}`,\n )\n },\n\n async getOAuthConnectionStatus(agentId, serverName) {\n const params = new URLSearchParams({ serverName })\n return request<{ mcpServerId: string; connected: boolean }>(\n `/agents/${encodeURIComponent(agentId)}/mcp-oauth/status?${params}`,\n )\n },\n\n /**\n * Opens a voice session on the conversation currently on screen, so the\n * spoken turns land in the same thread the user can keep typing into.\n * The signed URL it returns is short-lived and per session: the provider\n * credential stays on the server.\n */\n async createVoiceSession(agentId, chatId, context) {\n return VoiceSessionSchema.parse(\n await request<unknown>(\n `/agents/${encodeURIComponent(agentId)}/voice/session`,\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n ...(chatId ? { chatId } : {}),\n // Sent once for the whole call: the spoken turns\n // come from the provider and carry nothing about\n // this browser nor about the page it runs on.\n ...(context?.deviceContext\n ? { deviceContext: context.deviceContext }\n : {}),\n ...(context?.externalContext\n ? { externalContext: context.externalContext }\n : {}),\n }),\n },\n ),\n )\n },\n\n /**\n * `keepalive` on purpose: this is the call that settles the minutes of a\n * session, and it is often made while the page is going away (hang up on\n * unload, tab closed). Without it the browser is free to cancel it.\n */\n async closeVoiceSession(agentId, sessionId) {\n await request<void>(\n `/agents/${encodeURIComponent(agentId)}/voice/session/${encodeURIComponent(sessionId)}`,\n { method: 'DELETE', keepalive: true },\n 'void',\n )\n },\n\n resolveShortUrls(hashes) {\n return resolveShortUrlsRequest(options.baseUrl, hashes, {\n headers: options.headers?.(),\n credentials: options.credentials,\n })\n },\n }\n}\n"],"x_google_ignoreList":[2,3],"mappings":";;;;;;;;;AAEA,IAAY,KAAL,yBAAA,GAAA;QACH,EAAA,aAAA,cACA,EAAA,aAAA,eACA,EAAA,gBAAA,kBACA,EAAA,WAAA,aACA,EAAA,WAAA,YACA,EAAA,kBAAA,oBACA,EAAA,iBAAA,mBACA,EAAA,OAAA,QACA,EAAA,qBAAA,wBACA,EAAA,gBAAA;AACJ,EAAA,CAAA,CAAA,GAEY,KAAL,yBAAA,GAAA;QACH,EAAA,MAAA,OACA,EAAA,SAAA,UACA,EAAA,OAAA;AACJ,EAAA,CAAA,CAAA,GAEY,KAAL,yBAAA,GAAA;QACH,EAAA,eAAA,iBACA,EAAA,gBAAA,iBACA,EAAA,WAAA,aACA,EAAA,WAAA,aACA,EAAA,oBAAA,sBACA,EAAA,cAAA,gBACA,EAAA,aAAA;AACJ,EAAA,CAAA,CAAA,GAEY,IAAL,yBAAA,GAAA;QACH,EAAA,eAAA,iBACA,EAAA,eAAA,iBACA,EAAA,SAAA;AACJ,EAAA,CAAA,CAAA,GAEY,IAAL,yBAAA,GAAA;QACH,EAAA,OAAA,QACA,EAAA,SAAA,UACA,EAAA,MAAA,OACA,EAAA,aAAA;AACJ,EAAA,CAAA,CAAA,GAEY,IAAL,yBAAA,GAAA;QACH,EAAA,SAAA,UACA,EAAA,UAAA,WACA,EAAA,YAAA,aACA,EAAA,aAAA,cACA,EAAA,UAAA;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