@8wave/ai-elements 0.104.0 → 0.105.0-beta.1

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 (125) hide show
  1. package/dist/_chunks/{Agent-DG4nPG72.js → Agent-VhugusRf.js} +2 -2
  2. package/dist/_chunks/Agent-VhugusRf.js.map +1 -0
  3. package/dist/_chunks/{Document-DXkvvAnt.js → Document-DjNrISX1.js} +2 -2
  4. package/dist/_chunks/{Document-DXkvvAnt.js.map → Document-DjNrISX1.js.map} +1 -1
  5. package/dist/_chunks/{Media-3Mo4NRj7.js → Media-hjgDyEMr.js} +2 -2
  6. package/dist/_chunks/Media-hjgDyEMr.js.map +1 -0
  7. package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js → PkStreamingMarkdown-B4eMb97I.js} +2 -2
  8. package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js.map → PkStreamingMarkdown-B4eMb97I.js.map} +1 -1
  9. package/dist/_chunks/{PkToolRequestGeolocation-sf6LpUN_.js → PkToolRequestGeolocation-Bp-D2nDb.js} +3 -3
  10. package/{dist-vue/_chunks/PkToolRequestGeolocation-BdX5DzEN.js.map → dist/_chunks/PkToolRequestGeolocation-Bp-D2nDb.js.map} +1 -1
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js → PkToolRequestOAuthConnection-CjjyDj9A.js} +3 -3
  12. package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js.map → PkToolRequestOAuthConnection-CjjyDj9A.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js → PkToolShowArtifact-Dl8f7Q7q.js} +2 -2
  14. package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js.map → PkToolShowArtifact-Dl8f7Q7q.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js → PkToolShowCalendarEvent-B_QmZrlZ.js} +2 -2
  16. package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js.map → PkToolShowCalendarEvent-B_QmZrlZ.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js → PkToolShowContactForm-CXE0485W.js} +14 -14
  18. package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js.map → PkToolShowContactForm-CXE0485W.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js → PkToolShowDiagram-D-TyCkCB.js} +2 -2
  20. package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js.map → PkToolShowDiagram-D-TyCkCB.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowForm-DdBAG0Qs.js → PkToolShowForm-BzaibKAz.js} +101 -115
  22. package/dist/_chunks/PkToolShowForm-BzaibKAz.js.map +1 -0
  23. package/dist/_chunks/{PkToolShowSources-0qudS-bu.js → PkToolShowSources-CoTIoupP.js} +3 -3
  24. package/dist/_chunks/{PkToolShowSources-0qudS-bu.js.map → PkToolShowSources-CoTIoupP.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js → PkToolShowSuggestedReply-DA2Bi7k4.js} +2 -2
  26. package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js.map → PkToolShowSuggestedReply-DA2Bi7k4.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js → PkToolShowWeather-ChDHtOLz.js} +2 -2
  28. package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js.map → PkToolShowWeather-ChDHtOLz.js.map} +1 -1
  29. package/dist/_chunks/{browser-DuzNfJq0.js → browser-BXy4OnXA.js} +804 -779
  30. package/dist/_chunks/browser-BXy4OnXA.js.map +1 -0
  31. package/dist/_chunks/index.es-CnpsLhp_.js +1006 -0
  32. package/dist/_chunks/index.es-CnpsLhp_.js.map +1 -0
  33. package/dist/_chunks/utils-DtJdKlnF.js +185 -0
  34. package/dist/_chunks/utils-DtJdKlnF.js.map +1 -0
  35. package/dist/_chunks/{vue-i18n-_ouwlDGE.js → vue-i18n-C3J36GV4.js} +2 -2
  36. package/dist/_chunks/{vue-i18n-_ouwlDGE.js.map → vue-i18n-C3J36GV4.js.map} +1 -1
  37. package/dist/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
  38. package/dist/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
  39. package/dist/ai-elements.es.js +2100 -2159
  40. package/dist/ai-elements.es.js.map +1 -1
  41. package/dist-vue/PkChatbot.js +1 -1
  42. package/dist-vue/PkChatbotMessages.js +1 -1
  43. package/dist-vue/PkChatbotStepPayload.js +1 -1
  44. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  45. package/dist-vue/PkChatbotSteps.js +1 -1
  46. package/dist-vue/PkChatbotViewChat.js +1 -1
  47. package/dist-vue/PkChatbotViewConversations.js +1 -1
  48. package/dist-vue/PkChatbotViewFiles.js +1 -1
  49. package/dist-vue/PkChatbotViewProfile.js +1 -1
  50. package/dist-vue/_chunks/{Agent-gCuDMxHN.js → Agent-CpIgGdU4.js} +2 -2
  51. package/dist-vue/_chunks/Agent-CpIgGdU4.js.map +1 -0
  52. package/dist-vue/_chunks/{Document-iH61Cw06.js → Document-CiaGPYTR.js} +2 -2
  53. package/dist-vue/_chunks/{Document-iH61Cw06.js.map → Document-CiaGPYTR.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js → PkChatbot-xmjKbljL.js} +7 -7
  55. package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js.map → PkChatbot-xmjKbljL.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js → PkChatbotMessages-tHQ2JQrb.js} +75 -75
  57. package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js.map → PkChatbotMessages-tHQ2JQrb.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js → PkChatbotStepPayload-BtsnkJIV.js} +2 -2
  59. package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js.map → PkChatbotStepPayload-BtsnkJIV.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-B0WU0HcD.js → PkChatbotStepToolDetail-CCa95eBO.js} +116 -101
  61. package/dist-vue/_chunks/PkChatbotStepToolDetail-CCa95eBO.js.map +1 -0
  62. package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js +180 -0
  63. package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js.map +1 -0
  64. package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js → PkChatbotViewChat-CdiPjQLq.js} +6 -6
  65. package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js.map → PkChatbotViewChat-CdiPjQLq.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js → PkChatbotViewConversations-BP-NJvlK.js} +2 -2
  67. package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js.map → PkChatbotViewConversations-BP-NJvlK.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js → PkChatbotViewFiles-DRUVmxU5.js} +3 -3
  69. package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js.map → PkChatbotViewFiles-DRUVmxU5.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js → PkChatbotViewProfile-ywvIs6N5.js} +2 -2
  71. package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js.map → PkChatbotViewProfile-ywvIs6N5.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolRequestGeolocation-BdX5DzEN.js → PkToolRequestGeolocation-BdIyXoPQ.js} +2 -2
  73. package/{dist/_chunks/PkToolRequestGeolocation-sf6LpUN_.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BdIyXoPQ.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js → PkToolRequestOAuthConnection-Dnch7xAB.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js.map → PkToolRequestOAuthConnection-Dnch7xAB.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js → PkToolShowDiagram-DgLxNNp7.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js.map → PkToolShowDiagram-DgLxNNp7.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolShowForm-D2n2rA6J.js → PkToolShowForm-6eLi6Wr0.js} +103 -117
  79. package/dist-vue/_chunks/PkToolShowForm-6eLi6Wr0.js.map +1 -0
  80. package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js → PkToolShowSources-DTJgvDiB.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js.map → PkToolShowSources-DTJgvDiB.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js → PkToolShowSuggestedReply-D9RY2h6Z.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js.map → PkToolShowSuggestedReply-D9RY2h6Z.js.map} +1 -1
  84. package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js → createChatbotApiClient-12eL7hul.js} +2 -2
  85. package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js.map → createChatbotApiClient-12eL7hul.js.map} +1 -1
  86. package/dist-vue/_chunks/{useChatbotStore-Rj18hAUf.js → useChatbotStore-Chtzi5jc.js} +1086 -1016
  87. package/dist-vue/_chunks/useChatbotStore-Chtzi5jc.js.map +1 -0
  88. package/dist-vue/_chunks/{utils-B0jsOUqd.js → utils-DKNWwMTQ.js} +46 -23
  89. package/dist-vue/_chunks/utils-DKNWwMTQ.js.map +1 -0
  90. package/dist-vue/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
  91. package/dist-vue/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
  92. package/dist-vue/api.js +1 -1
  93. package/dist-vue/composables.js +3 -3
  94. package/dist-vue/index.js +259 -259
  95. package/dist-vue/index.js.map +1 -1
  96. package/dist-vue/locales.js +10 -4
  97. package/dist-vue/packages/components/src/PkEditorRepeater.d.ts +1 -1
  98. package/dist-vue/packages/components/src/chat/constants.d.ts +12 -0
  99. package/dist-vue/packages/components/src/chat/utils.d.ts +37 -0
  100. package/dist-vue/packages/models/src/schema/Agent.d.ts +24 -16
  101. package/dist-vue/packages/models/src/schema/AgentChatStatistics.d.ts +1 -1
  102. package/dist-vue/packages/models/src/schema/Chat.d.ts +9 -9
  103. package/dist-vue/packages/models/src/schema/Document.d.ts +6 -6
  104. package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +0 -1
  105. package/dist-vue/packages/models/src/schema/McpServer.d.ts +2 -2
  106. package/dist-vue/packages/models/src/schema/Member.d.ts +2 -2
  107. package/dist-vue/packages/models/src/schema/Organization.d.ts +4 -4
  108. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +29 -29
  109. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -20
  110. package/dist-vue/packages/models/src/schema/User.d.ts +6 -6
  111. package/dist-vue/packages/models/src/schema/constants.d.ts +2 -0
  112. package/package.json +10 -5
  113. package/dist/_chunks/Agent-DG4nPG72.js.map +0 -1
  114. package/dist/_chunks/Media-3Mo4NRj7.js.map +0 -1
  115. package/dist/_chunks/PkToolShowForm-DdBAG0Qs.js.map +0 -1
  116. package/dist/_chunks/browser-DuzNfJq0.js.map +0 -1
  117. package/dist/_chunks/index.es-DXx8DNKf.js +0 -2986
  118. package/dist/_chunks/index.es-DXx8DNKf.js.map +0 -1
  119. package/dist-vue/_chunks/Agent-gCuDMxHN.js.map +0 -1
  120. package/dist-vue/_chunks/PkChatbotStepToolDetail-B0WU0HcD.js.map +0 -1
  121. package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js +0 -177
  122. package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js.map +0 -1
  123. package/dist-vue/_chunks/PkToolShowForm-D2n2rA6J.js.map +0 -1
  124. package/dist-vue/_chunks/useChatbotStore-Rj18hAUf.js.map +0 -1
  125. package/dist-vue/_chunks/utils-B0jsOUqd.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { C as e, F as t, L as n, O as r, Tt as i, _ as a, b as o, bt as s, d as c, h as l, it as u, m as d, v as f, x as p, xt as m } from "./vue.runtime.esm-bundler-D6KKITU0.js";
2
- import { n as h } from "./vue-i18n-_ouwlDGE.js";
2
+ import { r as h } from "./vue-i18n-C3J36GV4.js";
3
3
  import { p as g } from "./index.es-BOEs7Pvh.js";
4
- import { u as _ } from "./Agent-DG4nPG72.js";
4
+ import { u as _ } from "./Agent-VhugusRf.js";
5
5
  r(), u(), m();
6
6
  var v = { class: "flex items-center gap-6 text-12 text-word-3 border border-surface-3 rounded-xl px-sm py-10" }, y = /* @__PURE__ */ e({
7
7
  __name: "PkToolRequestGeolocation",
@@ -66,4 +66,4 @@ var v = { class: "flex items-center gap-6 text-12 text-word-3 border border-surf
66
66
  //#endregion
67
67
  export { y as default };
68
68
 
69
- //# sourceMappingURL=PkToolRequestGeolocation-sf6LpUN_.js.map
69
+ //# sourceMappingURL=PkToolRequestGeolocation-Bp-D2nDb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PkToolRequestGeolocation-BdX5DzEN.js","names":["$n"],"sources":["../../../../packages/components/src/chat/PkToolRequestGeolocation.vue","../../../../packages/components/src/chat/PkToolRequestGeolocation.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, onMounted } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n import type { ReverseGeocodeFn } from 'utils/src/device-context'\n\n type GeolocationOutput =\n | {\n latitude: number\n longitude: number\n accuracy?: number\n city?: string\n }\n | { error: 'permission_denied' | 'position_unavailable' | 'timeout' }\n\n const props = defineProps<{\n part: unknown\n reverseGeocode?: ReverseGeocodeFn\n /**\n * Whether a voice call is on the line right now. A request drawn\n * during a call arrives already resolved with the render ack, and the\n * browser prompt must fire only while the caller who was asked is\n * still there: reopening the conversation later must not ask again.\n */\n callLive?: boolean\n }>()\n\n const emit = defineEmits<{\n result: [output: GeolocationOutput]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: { reason?: string }\n /** The position, or the voice render ack (a string). */\n output?: GeolocationOutput | string\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n\n /**\n * The ack is not a position: it only says the card was drawn during a\n * call (see `isVoiceRenderAck`, same rule as the forms). Besides gating\n * the prompt below, it must be kept away from the output parsing: `in`\n * on a string throws, which broke this card on every spoken turn.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isOutputAvailable = computed(\n () => state.value === 'output-available' && !isRenderAck.value,\n )\n\n const successOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || 'error' in out) {\n return undefined\n }\n return out\n })\n\n const errorOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || !('error' in out)) {\n return undefined\n }\n return out\n })\n\n /** Maps GeolocationPositionError.code to a typed string */\n function mapGeolocationError(\n code: number,\n ): 'permission_denied' | 'position_unavailable' | 'timeout' {\n if (code === 1) {\n return 'permission_denied'\n }\n if (code === 3) {\n return 'timeout'\n }\n return 'position_unavailable'\n }\n\n onMounted(() => {\n const isAwaitingPosition =\n state.value === 'input-available' ||\n (isRenderAck.value && props.callLive === true)\n if (!isAwaitingPosition) {\n return\n }\n\n if (!navigator.geolocation) {\n emit('result', { error: 'position_unavailable' })\n return\n }\n\n navigator.geolocation.getCurrentPosition(\n async (position) => {\n const { latitude, longitude, accuracy } = position.coords\n const city = props.reverseGeocode\n ? await props\n .reverseGeocode(latitude, longitude)\n .catch(() => undefined)\n : undefined\n emit('result', { latitude, longitude, accuracy, city })\n },\n (error) => {\n emit('result', { error: mapGeolocationError(error.code) })\n },\n { timeout: 15000 },\n )\n })\n</script>\n\n<template>\n <div\n class=\"flex items-center gap-6 text-12 text-word-3 border border-surface-3 rounded-xl px-sm py-10\">\n <!-- Loading state -->\n <template v-if=\"!isOutputAvailable\">\n <VvIcon name=\"line-md:loading-loop\" class=\"text-16\" />\n <span>{{ $t('messagePart.requestGeolocation') }}</span>\n </template>\n\n <!-- Success state -->\n <template v-else-if=\"successOutput\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-16\" />\n <span>\n {{\n $n(successOutput.latitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }},\n {{\n $n(successOutput.longitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }}\n <template v-if=\"successOutput.accuracy !== undefined\">\n (±{{\n $n(successOutput.accuracy, {\n style: 'unit',\n unit: 'meter',\n })\n }})\n </template>\n </span>\n </template>\n\n <!-- Error state -->\n <template v-else-if=\"errorOutput\">\n <span class=\"i-vv-alert-circle text-16 shrink-0 text-danger\" />\n <span>\n {{\n errorOutput.error === 'permission_denied'\n ? $t('message.geolocationPermissionDenied')\n : $t('message.geolocationUnavailable')\n }}\n </span>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, onMounted } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n import type { ReverseGeocodeFn } from 'utils/src/device-context'\n\n type GeolocationOutput =\n | {\n latitude: number\n longitude: number\n accuracy?: number\n city?: string\n }\n | { error: 'permission_denied' | 'position_unavailable' | 'timeout' }\n\n const props = defineProps<{\n part: unknown\n reverseGeocode?: ReverseGeocodeFn\n /**\n * Whether a voice call is on the line right now. A request drawn\n * during a call arrives already resolved with the render ack, and the\n * browser prompt must fire only while the caller who was asked is\n * still there: reopening the conversation later must not ask again.\n */\n callLive?: boolean\n }>()\n\n const emit = defineEmits<{\n result: [output: GeolocationOutput]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: { reason?: string }\n /** The position, or the voice render ack (a string). */\n output?: GeolocationOutput | string\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n\n /**\n * The ack is not a position: it only says the card was drawn during a\n * call (see `isVoiceRenderAck`, same rule as the forms). Besides gating\n * the prompt below, it must be kept away from the output parsing: `in`\n * on a string throws, which broke this card on every spoken turn.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isOutputAvailable = computed(\n () => state.value === 'output-available' && !isRenderAck.value,\n )\n\n const successOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || 'error' in out) {\n return undefined\n }\n return out\n })\n\n const errorOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || !('error' in out)) {\n return undefined\n }\n return out\n })\n\n /** Maps GeolocationPositionError.code to a typed string */\n function mapGeolocationError(\n code: number,\n ): 'permission_denied' | 'position_unavailable' | 'timeout' {\n if (code === 1) {\n return 'permission_denied'\n }\n if (code === 3) {\n return 'timeout'\n }\n return 'position_unavailable'\n }\n\n onMounted(() => {\n const isAwaitingPosition =\n state.value === 'input-available' ||\n (isRenderAck.value && props.callLive === true)\n if (!isAwaitingPosition) {\n return\n }\n\n if (!navigator.geolocation) {\n emit('result', { error: 'position_unavailable' })\n return\n }\n\n navigator.geolocation.getCurrentPosition(\n async (position) => {\n const { latitude, longitude, accuracy } = position.coords\n const city = props.reverseGeocode\n ? await props\n .reverseGeocode(latitude, longitude)\n .catch(() => undefined)\n : undefined\n emit('result', { latitude, longitude, accuracy, city })\n },\n (error) => {\n emit('result', { error: mapGeolocationError(error.code) })\n },\n { timeout: 15000 },\n )\n })\n</script>\n\n<template>\n <div\n class=\"flex items-center gap-6 text-12 text-word-3 border border-surface-3 rounded-xl px-sm py-10\">\n <!-- Loading state -->\n <template v-if=\"!isOutputAvailable\">\n <VvIcon name=\"line-md:loading-loop\" class=\"text-16\" />\n <span>{{ $t('messagePart.requestGeolocation') }}</span>\n </template>\n\n <!-- Success state -->\n <template v-else-if=\"successOutput\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-16\" />\n <span>\n {{\n $n(successOutput.latitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }},\n {{\n $n(successOutput.longitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }}\n <template v-if=\"successOutput.accuracy !== undefined\">\n (±{{\n $n(successOutput.accuracy, {\n style: 'unit',\n unit: 'meter',\n })\n }})\n </template>\n </span>\n </template>\n\n <!-- Error state -->\n <template v-else-if=\"errorOutput\">\n <span class=\"i-vv-alert-circle text-16 shrink-0 text-danger\" />\n <span>\n {{\n errorOutput.error === 'permission_denied'\n ? $t('message.geolocationPermissionDenied')\n : $t('message.geolocationUnavailable')\n }}\n </span>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAgBI,IAAM,IAAQ,GAYR,IAAO,GAIP,EAAE,GAAG,MAAO,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1C,IAAW,QACN,EAAM,IAMhB,GAEK,IAAQ,QAAe,EAAS,MAAM,SAAS,SAAS,GAQxD,IAAc,QAAe,EAAiB,EAAS,MAAM,MAAM,CAAC,GAEpE,IAAoB,QAChB,EAAM,UAAU,sBAAsB,CAAC,EAAY,KAC7D,GAEM,IAAgB,QAAe;GACjC,IAAM,IAAM,EAAS,MAAM;GACvB,OAAC,KAAO,OAAO,KAAQ,YAAY,WAAW,IAGlD,OAAO;EACX,CAAC,GAEK,IAAc,QAAe;GAC/B,IAAM,IAAM,EAAS,MAAM;GACvB,OAAC,KAAO,OAAO,KAAQ,YAAY,EAAE,WAAW,KAGpD,OAAO;EACX,CAAC;EAG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AArB,EAAA,GAAA,EASW,GAAA,EAAA,KAAA,EAAA,GAAA,CARP,AAAA,EAAA,OAAA,EAA+D,QAAA,EAAzD,OAAM,iDAAgD,GAAA,MAAA,EAAA,GAC5D,EAMO,QAAA,MAAA,EAJC,EAAA,MAAY,UAAK,sBAAmD,EAAA,CAAA,CAAE,CAAA,qCAAA,IAAkE,EAAA,CAAA,CAAE,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA,KAAA,EAAA,IAAA,EAAA,KAvCtJ,EAAA,GAAA,EAGW,GAAA,EAAA,KAAA,EAAA,GAAA,CAFP,EAAsD,GAAA;IAA9C,MAAK;IAAuB,OAAM;GAC1C,CAAA,GAAA,EAAuD,QAAA,MAAA,EAA9C,EAAA,CAAA,CAAE,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA,EAqCuI,CAAA"}
1
+ {"version":3,"file":"PkToolRequestGeolocation-Bp-D2nDb.js","names":["$n"],"sources":["../../../../packages/components/src/chat/PkToolRequestGeolocation.vue","../../../../packages/components/src/chat/PkToolRequestGeolocation.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, onMounted } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n import type { ReverseGeocodeFn } from 'utils/src/device-context'\n\n type GeolocationOutput =\n | {\n latitude: number\n longitude: number\n accuracy?: number\n city?: string\n }\n | { error: 'permission_denied' | 'position_unavailable' | 'timeout' }\n\n const props = defineProps<{\n part: unknown\n reverseGeocode?: ReverseGeocodeFn\n /**\n * Whether a voice call is on the line right now. A request drawn\n * during a call arrives already resolved with the render ack, and the\n * browser prompt must fire only while the caller who was asked is\n * still there: reopening the conversation later must not ask again.\n */\n callLive?: boolean\n }>()\n\n const emit = defineEmits<{\n result: [output: GeolocationOutput]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: { reason?: string }\n /** The position, or the voice render ack (a string). */\n output?: GeolocationOutput | string\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n\n /**\n * The ack is not a position: it only says the card was drawn during a\n * call (see `isVoiceRenderAck`, same rule as the forms). Besides gating\n * the prompt below, it must be kept away from the output parsing: `in`\n * on a string throws, which broke this card on every spoken turn.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isOutputAvailable = computed(\n () => state.value === 'output-available' && !isRenderAck.value,\n )\n\n const successOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || 'error' in out) {\n return undefined\n }\n return out\n })\n\n const errorOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || !('error' in out)) {\n return undefined\n }\n return out\n })\n\n /** Maps GeolocationPositionError.code to a typed string */\n function mapGeolocationError(\n code: number,\n ): 'permission_denied' | 'position_unavailable' | 'timeout' {\n if (code === 1) {\n return 'permission_denied'\n }\n if (code === 3) {\n return 'timeout'\n }\n return 'position_unavailable'\n }\n\n onMounted(() => {\n const isAwaitingPosition =\n state.value === 'input-available' ||\n (isRenderAck.value && props.callLive === true)\n if (!isAwaitingPosition) {\n return\n }\n\n if (!navigator.geolocation) {\n emit('result', { error: 'position_unavailable' })\n return\n }\n\n navigator.geolocation.getCurrentPosition(\n async (position) => {\n const { latitude, longitude, accuracy } = position.coords\n const city = props.reverseGeocode\n ? await props\n .reverseGeocode(latitude, longitude)\n .catch(() => undefined)\n : undefined\n emit('result', { latitude, longitude, accuracy, city })\n },\n (error) => {\n emit('result', { error: mapGeolocationError(error.code) })\n },\n { timeout: 15000 },\n )\n })\n</script>\n\n<template>\n <div\n class=\"flex items-center gap-6 text-12 text-word-3 border border-surface-3 rounded-xl px-sm py-10\">\n <!-- Loading state -->\n <template v-if=\"!isOutputAvailable\">\n <VvIcon name=\"line-md:loading-loop\" class=\"text-16\" />\n <span>{{ $t('messagePart.requestGeolocation') }}</span>\n </template>\n\n <!-- Success state -->\n <template v-else-if=\"successOutput\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-16\" />\n <span>\n {{\n $n(successOutput.latitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }},\n {{\n $n(successOutput.longitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }}\n <template v-if=\"successOutput.accuracy !== undefined\">\n (±{{\n $n(successOutput.accuracy, {\n style: 'unit',\n unit: 'meter',\n })\n }})\n </template>\n </span>\n </template>\n\n <!-- Error state -->\n <template v-else-if=\"errorOutput\">\n <span class=\"i-vv-alert-circle text-16 shrink-0 text-danger\" />\n <span>\n {{\n errorOutput.error === 'permission_denied'\n ? $t('message.geolocationPermissionDenied')\n : $t('message.geolocationUnavailable')\n }}\n </span>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, onMounted } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n import type { ReverseGeocodeFn } from 'utils/src/device-context'\n\n type GeolocationOutput =\n | {\n latitude: number\n longitude: number\n accuracy?: number\n city?: string\n }\n | { error: 'permission_denied' | 'position_unavailable' | 'timeout' }\n\n const props = defineProps<{\n part: unknown\n reverseGeocode?: ReverseGeocodeFn\n /**\n * Whether a voice call is on the line right now. A request drawn\n * during a call arrives already resolved with the render ack, and the\n * browser prompt must fire only while the caller who was asked is\n * still there: reopening the conversation later must not ask again.\n */\n callLive?: boolean\n }>()\n\n const emit = defineEmits<{\n result: [output: GeolocationOutput]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: { reason?: string }\n /** The position, or the voice render ack (a string). */\n output?: GeolocationOutput | string\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n\n /**\n * The ack is not a position: it only says the card was drawn during a\n * call (see `isVoiceRenderAck`, same rule as the forms). Besides gating\n * the prompt below, it must be kept away from the output parsing: `in`\n * on a string throws, which broke this card on every spoken turn.\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n const isOutputAvailable = computed(\n () => state.value === 'output-available' && !isRenderAck.value,\n )\n\n const successOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || 'error' in out) {\n return undefined\n }\n return out\n })\n\n const errorOutput = computed(() => {\n const out = toolPart.value.output\n if (!out || typeof out === 'string' || !('error' in out)) {\n return undefined\n }\n return out\n })\n\n /** Maps GeolocationPositionError.code to a typed string */\n function mapGeolocationError(\n code: number,\n ): 'permission_denied' | 'position_unavailable' | 'timeout' {\n if (code === 1) {\n return 'permission_denied'\n }\n if (code === 3) {\n return 'timeout'\n }\n return 'position_unavailable'\n }\n\n onMounted(() => {\n const isAwaitingPosition =\n state.value === 'input-available' ||\n (isRenderAck.value && props.callLive === true)\n if (!isAwaitingPosition) {\n return\n }\n\n if (!navigator.geolocation) {\n emit('result', { error: 'position_unavailable' })\n return\n }\n\n navigator.geolocation.getCurrentPosition(\n async (position) => {\n const { latitude, longitude, accuracy } = position.coords\n const city = props.reverseGeocode\n ? await props\n .reverseGeocode(latitude, longitude)\n .catch(() => undefined)\n : undefined\n emit('result', { latitude, longitude, accuracy, city })\n },\n (error) => {\n emit('result', { error: mapGeolocationError(error.code) })\n },\n { timeout: 15000 },\n )\n })\n</script>\n\n<template>\n <div\n class=\"flex items-center gap-6 text-12 text-word-3 border border-surface-3 rounded-xl px-sm py-10\">\n <!-- Loading state -->\n <template v-if=\"!isOutputAvailable\">\n <VvIcon name=\"line-md:loading-loop\" class=\"text-16\" />\n <span>{{ $t('messagePart.requestGeolocation') }}</span>\n </template>\n\n <!-- Success state -->\n <template v-else-if=\"successOutput\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-16\" />\n <span>\n {{\n $n(successOutput.latitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }},\n {{\n $n(successOutput.longitude, {\n style: 'decimal',\n minimumFractionDigits: 5,\n maximumFractionDigits: 5,\n })\n }}\n <template v-if=\"successOutput.accuracy !== undefined\">\n (±{{\n $n(successOutput.accuracy, {\n style: 'unit',\n unit: 'meter',\n })\n }})\n </template>\n </span>\n </template>\n\n <!-- Error state -->\n <template v-else-if=\"errorOutput\">\n <span class=\"i-vv-alert-circle text-16 shrink-0 text-danger\" />\n <span>\n {{\n errorOutput.error === 'permission_denied'\n ? $t('message.geolocationPermissionDenied')\n : $t('message.geolocationUnavailable')\n }}\n </span>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAgBI,IAAM,IAAQ,GAYR,IAAO,GAIP,EAAE,GAAG,MAAO,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1C,IAAW,QACN,EAAM,IAMhB,GAEK,IAAQ,QAAe,EAAS,MAAM,SAAS,SAAS,GAQxD,IAAc,QAAe,EAAiB,EAAS,MAAM,MAAM,CAAC,GAEpE,IAAoB,QAChB,EAAM,UAAU,sBAAsB,CAAC,EAAY,KAC7D,GAEM,IAAgB,QAAe;GACjC,IAAM,IAAM,EAAS,MAAM;GACvB,OAAC,KAAO,OAAO,KAAQ,YAAY,WAAW,IAGlD,OAAO;EACX,CAAC,GAEK,IAAc,QAAe;GAC/B,IAAM,IAAM,EAAS,MAAM;GACvB,OAAC,KAAO,OAAO,KAAQ,YAAY,EAAE,WAAW,KAGpD,OAAO;EACX,CAAC;EAGD,SAAS,EACL,GACwD;GAOxD,OANI,MAAS,IACF,sBAEP,MAAS,IACF,YAEJ;EACX;SAEA,QAAgB;GAER,MAAM,UAAU,qBACf,EAAY,SAAS,EAAM,aAAa,IAK7C;QAAI,CAAC,UAAU,aAAa;KACxB,EAAK,UAAU,EAAE,OAAO,uBAAuB,CAAC;KAChD;IACJ;IAEA,UAAU,YAAY,mBAClB,OAAO,MAAa;KAChB,IAAM,EAAE,aAAU,cAAW,gBAAa,EAAS,QAC7C,IAAO,EAAM,iBACb,MAAM,EACD,eAAe,GAAU,CAAS,CAA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A,EAAA,GAAA,CAFP,EAAsD,GAAA;IAA9C,MAAK;IAAuB,OAAM;GAC1C,CAAA,GAAA,EAAuD,QAAA,MAAA,EAA9C,EAAA,CAAA,CAAE,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA,EAqCuI,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { C as e, F as t, I as n, L as r, O as i, Tt as a, _ as o, bt as s, d as c, g as l, h as u, it as d, m as f, pt as p, v as m, x as h, xt as g } from "./vue.runtime.esm-bundler-D6KKITU0.js";
2
- import { n as _ } from "./vue-i18n-_ouwlDGE.js";
2
+ import { r as _ } from "./vue-i18n-C3J36GV4.js";
3
3
  import { o as v, p as y } from "./index.es-BOEs7Pvh.js";
4
- import { u as b } from "./Agent-DG4nPG72.js";
4
+ import { u as b } from "./Agent-VhugusRf.js";
5
5
  i(), d(), g();
6
6
  var x = { class: "w-full overflow-hidden bg-surface-1 p-sm rounded-xl text-12" }, S = {
7
7
  key: 0,
@@ -113,4 +113,4 @@ var x = { class: "w-full overflow-hidden bg-surface-1 p-sm rounded-xl text-12" }
113
113
  //#endregion
114
114
  export { M as default };
115
115
 
116
- //# sourceMappingURL=PkToolRequestOAuthConnection-BB8mlQit.js.map
116
+ //# sourceMappingURL=PkToolRequestOAuthConnection-CjjyDj9A.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PkToolRequestOAuthConnection-BB8mlQit.js","names":[],"sources":["../../../../packages/components/src/chat/PkToolRequestOAuthConnection.vue","../../../../packages/components/src/chat/PkToolRequestOAuthConnection.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, onMounted, onUnmounted, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n const props = defineProps<{\n part: unknown\n resolveConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; authorizeUrl: string }>\n checkConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; connected: boolean }>\n }>()\n\n const emit = defineEmits<{\n connected: [mcpServerId: string]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n /** How often the connection is re-read while the sign-in window is out. */\n const POLL_INTERVAL_MS = 2000\n /**\n * How long we keep asking. The only end to a sign-in nobody finishes:\n * `popup.closed` cannot be that signal, because the browser disowns the\n * handle when the provider severs the opener (that is what\n * `Cross-Origin-Opener-Policy` does), so it reads as closed from the first\n * check of the very flow this watch exists for. Long enough for a password\n * manager and a second factor.\n */\n const POLL_TIMEOUT_MS = 5 * 60 * 1000\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n toolCallId?: string\n input?: { serverName: string }\n output?: unknown\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n const serverName = computed(() => toolPart.value.input?.serverName)\n\n /**\n * A card drawn during a CALL arrives already \"answered\": the turn could\n * not wait for the connection, so the backend closed the tool with a note\n * saying the card was drawn (see `isVoiceRenderAck`, same rule as the\n * forms). That note is not a connection, and without this the card\n * rendered its inert fallback: the caller was told to connect the account\n * and given nothing to click (measured 2026-08-07).\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n /** The output this card wrote itself once the connection went through. */\n const isConnectedByOutput = computed(\n () =>\n (toolPart.value.output as { connected?: unknown } | undefined)\n ?.connected === true,\n )\n\n const isAwaitingConnection = computed(\n () => state.value === 'input-available' || isRenderAck.value,\n )\n\n const mcpServerId = ref<string | null>(null)\n /**\n * Set once THIS card's sign-in went through, and never from a plain read of\n * the connection: a card still asking is the turn saying it could not use\n * that integration, and a token row can outlive its usefulness (a refresh\n * that failed transiently keeps the row, so the turn sees no usable token\n * while a status read still sees one). Trusting the read there would have\n * left the card claiming success, with no button, on a turn still waiting.\n * It doubles as the guard that resumes the turn exactly once, whichever\n * channel got there first.\n */\n const hasConnected = ref(false)\n /** A sign-in window we opened is still out there. */\n const isSigningIn = ref(false)\n const oauthError = ref<string | null>(null)\n\n const isDone = computed(\n () => hasConnected.value || isConnectedByOutput.value,\n )\n const canConnect = computed(\n () => Boolean(serverName.value) && Boolean(props.resolveConnection),\n )\n\n /**\n * Whether the server says this user has connected, asked without minting\n * anything: no OAuth `state` is burned by looking.\n */\n async function isConnectedNow(): Promise<boolean> {\n if (!serverName.value || !props.checkConnection) {\n return false\n }\n try {\n const status = await props.checkConnection(serverName.value)\n mcpServerId.value = status.mcpServerId\n return status.connected\n } catch {\n // Not knowing is not an error to show: the sign-in window is still\n // out there and the next read may well answer.\n return false\n }\n }\n\n let pollTimer: ReturnType<typeof setTimeout> | undefined\n /**\n * Which sign-in a running tick belongs to. A tick suspended on its read\n * outlives the attempt that scheduled it: without this it woke up inside\n * the NEXT attempt, restarted its own chain over that one's timer and then\n * stopped it on its own older deadline.\n */\n let signInAttempt = 0\n /** The window this attempt opened, the only sender we accept a report from. */\n let signInWindow: Window | null = null\n\n function stopWatching() {\n if (pollTimer !== undefined) {\n clearTimeout(pollTimer)\n pollTimer = undefined\n }\n signInAttempt += 1\n signInWindow = null\n isSigningIn.value = false\n }\n\n function settleConnected(connectedServerId: string) {\n stopWatching()\n if (hasConnected.value) {\n return\n }\n hasConnected.value = true\n mcpServerId.value = connectedServerId\n oauthError.value = null\n emit('connected', connectedServerId)\n }\n\n /**\n * Watches the connection from THIS window while the sign-in window is away.\n *\n * The callback page reports through `window.opener`, and a provider that\n * sends `Cross-Origin-Opener-Policy` anywhere in its redirect chain takes\n * that opener away: the connection then succeeds with nobody listening, the\n * card stays on its button and the suspended turn is never resumed\n * (reported 2026-08-27). This channel never goes through that window, so it\n * survives whatever the provider does to it. Chained rather than periodic:\n * a read slower than the interval would otherwise overlap the next one.\n */\n function watchForConnection(popup: Window) {\n stopWatching()\n const attempt = signInAttempt\n signInWindow = popup\n isSigningIn.value = true\n const deadline = Date.now() + POLL_TIMEOUT_MS\n const tick = async () => {\n if (attempt !== signInAttempt || Date.now() > deadline) {\n if (attempt === signInAttempt) {\n stopWatching()\n }\n return\n }\n const connected = await isConnectedNow()\n if (attempt !== signInAttempt) {\n return\n }\n if (connected && mcpServerId.value) {\n settleConnected(mcpServerId.value)\n return\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n\n /**\n * The callback page's own report, when the browser let it through: faster\n * than the poll, and the only channel carrying the failure reason.\n *\n * Accepted only from the window this card opened, and only while that\n * sign-in is out: the listener stays up for as long as the card is on\n * screen, and nothing else with a handle on this page may resume a turn by\n * posting a message at it.\n */\n function onMessage(event: MessageEvent) {\n if (\n event.data?.type !== 'mcp-oauth-complete' ||\n !isSigningIn.value ||\n event.source !== signInWindow\n ) {\n return\n }\n const reportedServerId = event.data.mcpServerId as string | undefined\n if (\n reportedServerId &&\n mcpServerId.value &&\n reportedServerId !== mcpServerId.value\n ) {\n return\n }\n if (!event.data.success) {\n // A failure carries no server id: the callback never got that far.\n stopWatching()\n oauthError.value = event.data.error ?? 'Unknown error'\n return\n }\n const connectedServerId = reportedServerId ?? mcpServerId.value\n if (connectedServerId) {\n settleConnected(connectedServerId)\n }\n }\n\n /**\n * Opens the provider's sign-in, on an authorize URL minted NOW.\n *\n * The URL carries an OAuth `state` that lives ten minutes server-side.\n * Minted when the card rendered, it was routinely expired by the time\n * anyone clicked, and the callback then failed on a sign-in the user had\n * just completed. The window is opened blank first, synchronously, or the\n * popup blocker kills it while we wait for the URL.\n */\n async function openAuthWindow() {\n if (\n !serverName.value ||\n !props.resolveConnection ||\n isSigningIn.value\n ) {\n return\n }\n oauthError.value = null\n const popup = window.open(\n '',\n 'mcp_oauth',\n 'width=600,height=700,menubar=no,toolbar=no',\n )\n if (!popup) {\n oauthError.value = $t('auth.popupBlocked')\n return\n }\n watchForConnection(popup)\n try {\n const connection = await props.resolveConnection(serverName.value)\n mcpServerId.value = connection.mcpServerId\n popup.location.href = connection.authorizeUrl\n } catch (err) {\n stopWatching()\n popup.close()\n oauthError.value =\n err instanceof Error ? err.message : 'Failed to resolve OAuth'\n }\n }\n\n // For the card's whole life, not just between the click and the answer: a\n // card that re-renders while the sign-in window is away used to lose the\n // listener with it, and the completion landed on nobody.\n onMounted(() => window.addEventListener('message', onMessage))\n onUnmounted(() => {\n window.removeEventListener('message', onMessage)\n stopWatching()\n })\n</script>\n\n<template>\n <div class=\"w-full overflow-hidden bg-surface-1 p-sm rounded-xl text-12\">\n <!-- Connected: just now, or by this card on an earlier visit -->\n <template v-if=\"isDone\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:check-line\" />\n <strong class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionSuccess', {\n name: serverName,\n })\n }}\n </strong>\n </div>\n </template>\n\n <!-- Signing in: the window is out and we are watching for it -->\n <template v-else-if=\"isSigningIn\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"line-md:loading-loop\" />\n <span class=\"text-10\">{{\n $t('messagePart.requestOAuthConnection')\n }}</span>\n </div>\n </template>\n\n <!-- OAuth error -->\n <template v-else-if=\"oauthError\">\n <div class=\"flex flex-col gap-xs\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:close-line\" class=\"text-danger\" />\n <strong class=\"text-10\">\n {{ oauthError }}\n </strong>\n </div>\n <VvButton\n v-if=\"canConnect\"\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </div>\n </template>\n\n <!-- Waiting on the user: show the connect button -->\n <template v-else-if=\"isAwaitingConnection && canConnect\">\n <div class=\"flex items-center gap-6 text-word-3 mb-xs\">\n <span>\n {{\n $t('messagePart.requestOAuthConnectionPrompt', {\n name: serverName,\n })\n }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </template>\n <!-- Fallback for unknown state -->\n <template v-else>\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:link-m\" />\n <span class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionInfo', {\n name: serverName,\n })\n }}\n </span>\n </div>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, onMounted, onUnmounted, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n const props = defineProps<{\n part: unknown\n resolveConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; authorizeUrl: string }>\n checkConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; connected: boolean }>\n }>()\n\n const emit = defineEmits<{\n connected: [mcpServerId: string]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n /** How often the connection is re-read while the sign-in window is out. */\n const POLL_INTERVAL_MS = 2000\n /**\n * How long we keep asking. The only end to a sign-in nobody finishes:\n * `popup.closed` cannot be that signal, because the browser disowns the\n * handle when the provider severs the opener (that is what\n * `Cross-Origin-Opener-Policy` does), so it reads as closed from the first\n * check of the very flow this watch exists for. Long enough for a password\n * manager and a second factor.\n */\n const POLL_TIMEOUT_MS = 5 * 60 * 1000\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n toolCallId?: string\n input?: { serverName: string }\n output?: unknown\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n const serverName = computed(() => toolPart.value.input?.serverName)\n\n /**\n * A card drawn during a CALL arrives already \"answered\": the turn could\n * not wait for the connection, so the backend closed the tool with a note\n * saying the card was drawn (see `isVoiceRenderAck`, same rule as the\n * forms). That note is not a connection, and without this the card\n * rendered its inert fallback: the caller was told to connect the account\n * and given nothing to click (measured 2026-08-07).\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n /** The output this card wrote itself once the connection went through. */\n const isConnectedByOutput = computed(\n () =>\n (toolPart.value.output as { connected?: unknown } | undefined)\n ?.connected === true,\n )\n\n const isAwaitingConnection = computed(\n () => state.value === 'input-available' || isRenderAck.value,\n )\n\n const mcpServerId = ref<string | null>(null)\n /**\n * Set once THIS card's sign-in went through, and never from a plain read of\n * the connection: a card still asking is the turn saying it could not use\n * that integration, and a token row can outlive its usefulness (a refresh\n * that failed transiently keeps the row, so the turn sees no usable token\n * while a status read still sees one). Trusting the read there would have\n * left the card claiming success, with no button, on a turn still waiting.\n * It doubles as the guard that resumes the turn exactly once, whichever\n * channel got there first.\n */\n const hasConnected = ref(false)\n /** A sign-in window we opened is still out there. */\n const isSigningIn = ref(false)\n const oauthError = ref<string | null>(null)\n\n const isDone = computed(\n () => hasConnected.value || isConnectedByOutput.value,\n )\n const canConnect = computed(\n () => Boolean(serverName.value) && Boolean(props.resolveConnection),\n )\n\n /**\n * Whether the server says this user has connected, asked without minting\n * anything: no OAuth `state` is burned by looking.\n */\n async function isConnectedNow(): Promise<boolean> {\n if (!serverName.value || !props.checkConnection) {\n return false\n }\n try {\n const status = await props.checkConnection(serverName.value)\n mcpServerId.value = status.mcpServerId\n return status.connected\n } catch {\n // Not knowing is not an error to show: the sign-in window is still\n // out there and the next read may well answer.\n return false\n }\n }\n\n let pollTimer: ReturnType<typeof setTimeout> | undefined\n /**\n * Which sign-in a running tick belongs to. A tick suspended on its read\n * outlives the attempt that scheduled it: without this it woke up inside\n * the NEXT attempt, restarted its own chain over that one's timer and then\n * stopped it on its own older deadline.\n */\n let signInAttempt = 0\n /** The window this attempt opened, the only sender we accept a report from. */\n let signInWindow: Window | null = null\n\n function stopWatching() {\n if (pollTimer !== undefined) {\n clearTimeout(pollTimer)\n pollTimer = undefined\n }\n signInAttempt += 1\n signInWindow = null\n isSigningIn.value = false\n }\n\n function settleConnected(connectedServerId: string) {\n stopWatching()\n if (hasConnected.value) {\n return\n }\n hasConnected.value = true\n mcpServerId.value = connectedServerId\n oauthError.value = null\n emit('connected', connectedServerId)\n }\n\n /**\n * Watches the connection from THIS window while the sign-in window is away.\n *\n * The callback page reports through `window.opener`, and a provider that\n * sends `Cross-Origin-Opener-Policy` anywhere in its redirect chain takes\n * that opener away: the connection then succeeds with nobody listening, the\n * card stays on its button and the suspended turn is never resumed\n * (reported 2026-08-27). This channel never goes through that window, so it\n * survives whatever the provider does to it. Chained rather than periodic:\n * a read slower than the interval would otherwise overlap the next one.\n */\n function watchForConnection(popup: Window) {\n stopWatching()\n const attempt = signInAttempt\n signInWindow = popup\n isSigningIn.value = true\n const deadline = Date.now() + POLL_TIMEOUT_MS\n const tick = async () => {\n if (attempt !== signInAttempt || Date.now() > deadline) {\n if (attempt === signInAttempt) {\n stopWatching()\n }\n return\n }\n const connected = await isConnectedNow()\n if (attempt !== signInAttempt) {\n return\n }\n if (connected && mcpServerId.value) {\n settleConnected(mcpServerId.value)\n return\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n\n /**\n * The callback page's own report, when the browser let it through: faster\n * than the poll, and the only channel carrying the failure reason.\n *\n * Accepted only from the window this card opened, and only while that\n * sign-in is out: the listener stays up for as long as the card is on\n * screen, and nothing else with a handle on this page may resume a turn by\n * posting a message at it.\n */\n function onMessage(event: MessageEvent) {\n if (\n event.data?.type !== 'mcp-oauth-complete' ||\n !isSigningIn.value ||\n event.source !== signInWindow\n ) {\n return\n }\n const reportedServerId = event.data.mcpServerId as string | undefined\n if (\n reportedServerId &&\n mcpServerId.value &&\n reportedServerId !== mcpServerId.value\n ) {\n return\n }\n if (!event.data.success) {\n // A failure carries no server id: the callback never got that far.\n stopWatching()\n oauthError.value = event.data.error ?? 'Unknown error'\n return\n }\n const connectedServerId = reportedServerId ?? mcpServerId.value\n if (connectedServerId) {\n settleConnected(connectedServerId)\n }\n }\n\n /**\n * Opens the provider's sign-in, on an authorize URL minted NOW.\n *\n * The URL carries an OAuth `state` that lives ten minutes server-side.\n * Minted when the card rendered, it was routinely expired by the time\n * anyone clicked, and the callback then failed on a sign-in the user had\n * just completed. The window is opened blank first, synchronously, or the\n * popup blocker kills it while we wait for the URL.\n */\n async function openAuthWindow() {\n if (\n !serverName.value ||\n !props.resolveConnection ||\n isSigningIn.value\n ) {\n return\n }\n oauthError.value = null\n const popup = window.open(\n '',\n 'mcp_oauth',\n 'width=600,height=700,menubar=no,toolbar=no',\n )\n if (!popup) {\n oauthError.value = $t('auth.popupBlocked')\n return\n }\n watchForConnection(popup)\n try {\n const connection = await props.resolveConnection(serverName.value)\n mcpServerId.value = connection.mcpServerId\n popup.location.href = connection.authorizeUrl\n } catch (err) {\n stopWatching()\n popup.close()\n oauthError.value =\n err instanceof Error ? err.message : 'Failed to resolve OAuth'\n }\n }\n\n // For the card's whole life, not just between the click and the answer: a\n // card that re-renders while the sign-in window is away used to lose the\n // listener with it, and the completion landed on nobody.\n onMounted(() => window.addEventListener('message', onMessage))\n onUnmounted(() => {\n window.removeEventListener('message', onMessage)\n stopWatching()\n })\n</script>\n\n<template>\n <div class=\"w-full overflow-hidden bg-surface-1 p-sm rounded-xl text-12\">\n <!-- Connected: just now, or by this card on an earlier visit -->\n <template v-if=\"isDone\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:check-line\" />\n <strong class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionSuccess', {\n name: serverName,\n })\n }}\n </strong>\n </div>\n </template>\n\n <!-- Signing in: the window is out and we are watching for it -->\n <template v-else-if=\"isSigningIn\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"line-md:loading-loop\" />\n <span class=\"text-10\">{{\n $t('messagePart.requestOAuthConnection')\n }}</span>\n </div>\n </template>\n\n <!-- OAuth error -->\n <template v-else-if=\"oauthError\">\n <div class=\"flex flex-col gap-xs\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:close-line\" class=\"text-danger\" />\n <strong class=\"text-10\">\n {{ oauthError }}\n </strong>\n </div>\n <VvButton\n v-if=\"canConnect\"\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </div>\n </template>\n\n <!-- Waiting on the user: show the connect button -->\n <template v-else-if=\"isAwaitingConnection && canConnect\">\n <div class=\"flex items-center gap-6 text-word-3 mb-xs\">\n <span>\n {{\n $t('messagePart.requestOAuthConnectionPrompt', {\n name: serverName,\n })\n }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </template>\n <!-- Fallback for unknown state -->\n <template v-else>\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:link-m\" />\n <span class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionInfo', {\n name: serverName,\n })\n }}\n </span>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;8BAsBU,IAAmB,KASnB,IAAkB;;;;;;;;;EA1BxB,IAAM,IAAQ,GAUR,IAAO,GAIP,EAAE,GAAG,MAAO,EAAQ,EAAE,UAAU,SAAS,CAAC,GAc1C,IAAW,QACN,EAAM,IAMhB,GAEK,IAAQ,QAAe,EAAS,MAAM,SAAS,SAAS,GACxD,IAAa,QAAe,EAAS,MAAM,OAAO,UAAU,GAU5D,IAAc,QAAe,EAAiB,EAAS,MAAM,MAAM,CAAC,GAGpE,IAAsB,QAEnB,EAAS,MAAM,QACV,cAAc,EAC5B,GAEM,IAAuB,QACnB,EAAM,UAAU,qBAAqB,EAAY,KAC3D,GAEM,IAAc,EAAmB,IAAI,GAWrC,IAAe,EAAI,EAAK,GAExB,IAAc,EAAI,EAAK,GACvB,IAAa,EAAmB,IAAI,GAEpC,IAAS,QACL,EAAa,SAAS,EAAoB,KACpD,GACM,IAAa,QACT,EAAQ,EAAW,SAAU,EAAQ,EAAM,iBACrD;EAMA,eAAe,IAAmC;GAC9C,IAAI,CAA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AA,KAAU,GAAA,CAAA,CAAA,CAAA,GAIX,EAAA,SADV,EAAA,GAAA,EAS8B,GAAA;;IAP1B,WAAU;IACV,MAAK;IACJ,OAAgC,EAAA,CAAA,CAAE,CAAA,4CAAA,EAAiF,MAAA,EAAA,MAAA,CAAA;IAKnH,SAAO;GAKC,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA,KAAA,EAAA,SAAwB,EAAA,SAA7C,EAAA,GAAA,EAmBW,GAAA,EAAA,KAAA,EAAA,GAAA,CAlBP,EAQM,OARN,GAQM,CAPF,EAMO,QAAA,MAAA,EAJC,EAAA,CAAA,CAAE,CAAA,4CAAA,EAAiF,MAAA,EAAA,MAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,GAM/F,EAQ8B,GAAA;IAP1B,WAAU;IACV,MAAK;IACJ,OAA4B,EAAA,CAAA,CAAE,CAAA,4CAAA,EAA6E,MAAA,EAAA,MAAA,CAAA;IAK3G,SAAO;GAIZ,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,EASM,OATN,IASM,CARF,EAA2B,GAAA,EAAnB,MAAK,YAAW,CAAA,GACxB,EAMO,QANP,IAMO,EAJC,EAAA,CAAA,CAAE,CAAA,0CAAA,EAA+E,MAAA,EAAA,MAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"PkToolRequestOAuthConnection-CjjyDj9A.js","names":[],"sources":["../../../../packages/components/src/chat/PkToolRequestOAuthConnection.vue","../../../../packages/components/src/chat/PkToolRequestOAuthConnection.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, onMounted, onUnmounted, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n const props = defineProps<{\n part: unknown\n resolveConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; authorizeUrl: string }>\n checkConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; connected: boolean }>\n }>()\n\n const emit = defineEmits<{\n connected: [mcpServerId: string]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n /** How often the connection is re-read while the sign-in window is out. */\n const POLL_INTERVAL_MS = 2000\n /**\n * How long we keep asking. The only end to a sign-in nobody finishes:\n * `popup.closed` cannot be that signal, because the browser disowns the\n * handle when the provider severs the opener (that is what\n * `Cross-Origin-Opener-Policy` does), so it reads as closed from the first\n * check of the very flow this watch exists for. Long enough for a password\n * manager and a second factor.\n */\n const POLL_TIMEOUT_MS = 5 * 60 * 1000\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n toolCallId?: string\n input?: { serverName: string }\n output?: unknown\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n const serverName = computed(() => toolPart.value.input?.serverName)\n\n /**\n * A card drawn during a CALL arrives already \"answered\": the turn could\n * not wait for the connection, so the backend closed the tool with a note\n * saying the card was drawn (see `isVoiceRenderAck`, same rule as the\n * forms). That note is not a connection, and without this the card\n * rendered its inert fallback: the caller was told to connect the account\n * and given nothing to click (measured 2026-08-07).\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n /** The output this card wrote itself once the connection went through. */\n const isConnectedByOutput = computed(\n () =>\n (toolPart.value.output as { connected?: unknown } | undefined)\n ?.connected === true,\n )\n\n const isAwaitingConnection = computed(\n () => state.value === 'input-available' || isRenderAck.value,\n )\n\n const mcpServerId = ref<string | null>(null)\n /**\n * Set once THIS card's sign-in went through, and never from a plain read of\n * the connection: a card still asking is the turn saying it could not use\n * that integration, and a token row can outlive its usefulness (a refresh\n * that failed transiently keeps the row, so the turn sees no usable token\n * while a status read still sees one). Trusting the read there would have\n * left the card claiming success, with no button, on a turn still waiting.\n * It doubles as the guard that resumes the turn exactly once, whichever\n * channel got there first.\n */\n const hasConnected = ref(false)\n /** A sign-in window we opened is still out there. */\n const isSigningIn = ref(false)\n const oauthError = ref<string | null>(null)\n\n const isDone = computed(\n () => hasConnected.value || isConnectedByOutput.value,\n )\n const canConnect = computed(\n () => Boolean(serverName.value) && Boolean(props.resolveConnection),\n )\n\n /**\n * Whether the server says this user has connected, asked without minting\n * anything: no OAuth `state` is burned by looking.\n */\n async function isConnectedNow(): Promise<boolean> {\n if (!serverName.value || !props.checkConnection) {\n return false\n }\n try {\n const status = await props.checkConnection(serverName.value)\n mcpServerId.value = status.mcpServerId\n return status.connected\n } catch {\n // Not knowing is not an error to show: the sign-in window is still\n // out there and the next read may well answer.\n return false\n }\n }\n\n let pollTimer: ReturnType<typeof setTimeout> | undefined\n /**\n * Which sign-in a running tick belongs to. A tick suspended on its read\n * outlives the attempt that scheduled it: without this it woke up inside\n * the NEXT attempt, restarted its own chain over that one's timer and then\n * stopped it on its own older deadline.\n */\n let signInAttempt = 0\n /** The window this attempt opened, the only sender we accept a report from. */\n let signInWindow: Window | null = null\n\n function stopWatching() {\n if (pollTimer !== undefined) {\n clearTimeout(pollTimer)\n pollTimer = undefined\n }\n signInAttempt += 1\n signInWindow = null\n isSigningIn.value = false\n }\n\n function settleConnected(connectedServerId: string) {\n stopWatching()\n if (hasConnected.value) {\n return\n }\n hasConnected.value = true\n mcpServerId.value = connectedServerId\n oauthError.value = null\n emit('connected', connectedServerId)\n }\n\n /**\n * Watches the connection from THIS window while the sign-in window is away.\n *\n * The callback page reports through `window.opener`, and a provider that\n * sends `Cross-Origin-Opener-Policy` anywhere in its redirect chain takes\n * that opener away: the connection then succeeds with nobody listening, the\n * card stays on its button and the suspended turn is never resumed\n * (reported 2026-08-27). This channel never goes through that window, so it\n * survives whatever the provider does to it. Chained rather than periodic:\n * a read slower than the interval would otherwise overlap the next one.\n */\n function watchForConnection(popup: Window) {\n stopWatching()\n const attempt = signInAttempt\n signInWindow = popup\n isSigningIn.value = true\n const deadline = Date.now() + POLL_TIMEOUT_MS\n const tick = async () => {\n if (attempt !== signInAttempt || Date.now() > deadline) {\n if (attempt === signInAttempt) {\n stopWatching()\n }\n return\n }\n const connected = await isConnectedNow()\n if (attempt !== signInAttempt) {\n return\n }\n if (connected && mcpServerId.value) {\n settleConnected(mcpServerId.value)\n return\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n\n /**\n * The callback page's own report, when the browser let it through: faster\n * than the poll, and the only channel carrying the failure reason.\n *\n * Accepted only from the window this card opened, and only while that\n * sign-in is out: the listener stays up for as long as the card is on\n * screen, and nothing else with a handle on this page may resume a turn by\n * posting a message at it.\n */\n function onMessage(event: MessageEvent) {\n if (\n event.data?.type !== 'mcp-oauth-complete' ||\n !isSigningIn.value ||\n event.source !== signInWindow\n ) {\n return\n }\n const reportedServerId = event.data.mcpServerId as string | undefined\n if (\n reportedServerId &&\n mcpServerId.value &&\n reportedServerId !== mcpServerId.value\n ) {\n return\n }\n if (!event.data.success) {\n // A failure carries no server id: the callback never got that far.\n stopWatching()\n oauthError.value = event.data.error ?? 'Unknown error'\n return\n }\n const connectedServerId = reportedServerId ?? mcpServerId.value\n if (connectedServerId) {\n settleConnected(connectedServerId)\n }\n }\n\n /**\n * Opens the provider's sign-in, on an authorize URL minted NOW.\n *\n * The URL carries an OAuth `state` that lives ten minutes server-side.\n * Minted when the card rendered, it was routinely expired by the time\n * anyone clicked, and the callback then failed on a sign-in the user had\n * just completed. The window is opened blank first, synchronously, or the\n * popup blocker kills it while we wait for the URL.\n */\n async function openAuthWindow() {\n if (\n !serverName.value ||\n !props.resolveConnection ||\n isSigningIn.value\n ) {\n return\n }\n oauthError.value = null\n const popup = window.open(\n '',\n 'mcp_oauth',\n 'width=600,height=700,menubar=no,toolbar=no',\n )\n if (!popup) {\n oauthError.value = $t('auth.popupBlocked')\n return\n }\n watchForConnection(popup)\n try {\n const connection = await props.resolveConnection(serverName.value)\n mcpServerId.value = connection.mcpServerId\n popup.location.href = connection.authorizeUrl\n } catch (err) {\n stopWatching()\n popup.close()\n oauthError.value =\n err instanceof Error ? err.message : 'Failed to resolve OAuth'\n }\n }\n\n // For the card's whole life, not just between the click and the answer: a\n // card that re-renders while the sign-in window is away used to lose the\n // listener with it, and the completion landed on nobody.\n onMounted(() => window.addEventListener('message', onMessage))\n onUnmounted(() => {\n window.removeEventListener('message', onMessage)\n stopWatching()\n })\n</script>\n\n<template>\n <div class=\"w-full overflow-hidden bg-surface-1 p-sm rounded-xl text-12\">\n <!-- Connected: just now, or by this card on an earlier visit -->\n <template v-if=\"isDone\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:check-line\" />\n <strong class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionSuccess', {\n name: serverName,\n })\n }}\n </strong>\n </div>\n </template>\n\n <!-- Signing in: the window is out and we are watching for it -->\n <template v-else-if=\"isSigningIn\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"line-md:loading-loop\" />\n <span class=\"text-10\">{{\n $t('messagePart.requestOAuthConnection')\n }}</span>\n </div>\n </template>\n\n <!-- OAuth error -->\n <template v-else-if=\"oauthError\">\n <div class=\"flex flex-col gap-xs\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:close-line\" class=\"text-danger\" />\n <strong class=\"text-10\">\n {{ oauthError }}\n </strong>\n </div>\n <VvButton\n v-if=\"canConnect\"\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </div>\n </template>\n\n <!-- Waiting on the user: show the connect button -->\n <template v-else-if=\"isAwaitingConnection && canConnect\">\n <div class=\"flex items-center gap-6 text-word-3 mb-xs\">\n <span>\n {{\n $t('messagePart.requestOAuthConnectionPrompt', {\n name: serverName,\n })\n }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </template>\n <!-- Fallback for unknown state -->\n <template v-else>\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:link-m\" />\n <span class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionInfo', {\n name: serverName,\n })\n }}\n </span>\n </div>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, onMounted, onUnmounted, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { isVoiceRenderAck } from 'models'\n\n const props = defineProps<{\n part: unknown\n resolveConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; authorizeUrl: string }>\n checkConnection?: (\n serverName: string,\n ) => Promise<{ mcpServerId: string; connected: boolean }>\n }>()\n\n const emit = defineEmits<{\n connected: [mcpServerId: string]\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n /** How often the connection is re-read while the sign-in window is out. */\n const POLL_INTERVAL_MS = 2000\n /**\n * How long we keep asking. The only end to a sign-in nobody finishes:\n * `popup.closed` cannot be that signal, because the browser disowns the\n * handle when the provider severs the opener (that is what\n * `Cross-Origin-Opener-Policy` does), so it reads as closed from the first\n * check of the very flow this watch exists for. Long enough for a password\n * manager and a second factor.\n */\n const POLL_TIMEOUT_MS = 5 * 60 * 1000\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n toolCallId?: string\n input?: { serverName: string }\n output?: unknown\n }\n })\n\n const state = computed(() => toolPart.value.state ?? 'unknown')\n const serverName = computed(() => toolPart.value.input?.serverName)\n\n /**\n * A card drawn during a CALL arrives already \"answered\": the turn could\n * not wait for the connection, so the backend closed the tool with a note\n * saying the card was drawn (see `isVoiceRenderAck`, same rule as the\n * forms). That note is not a connection, and without this the card\n * rendered its inert fallback: the caller was told to connect the account\n * and given nothing to click (measured 2026-08-07).\n */\n const isRenderAck = computed(() => isVoiceRenderAck(toolPart.value.output))\n\n /** The output this card wrote itself once the connection went through. */\n const isConnectedByOutput = computed(\n () =>\n (toolPart.value.output as { connected?: unknown } | undefined)\n ?.connected === true,\n )\n\n const isAwaitingConnection = computed(\n () => state.value === 'input-available' || isRenderAck.value,\n )\n\n const mcpServerId = ref<string | null>(null)\n /**\n * Set once THIS card's sign-in went through, and never from a plain read of\n * the connection: a card still asking is the turn saying it could not use\n * that integration, and a token row can outlive its usefulness (a refresh\n * that failed transiently keeps the row, so the turn sees no usable token\n * while a status read still sees one). Trusting the read there would have\n * left the card claiming success, with no button, on a turn still waiting.\n * It doubles as the guard that resumes the turn exactly once, whichever\n * channel got there first.\n */\n const hasConnected = ref(false)\n /** A sign-in window we opened is still out there. */\n const isSigningIn = ref(false)\n const oauthError = ref<string | null>(null)\n\n const isDone = computed(\n () => hasConnected.value || isConnectedByOutput.value,\n )\n const canConnect = computed(\n () => Boolean(serverName.value) && Boolean(props.resolveConnection),\n )\n\n /**\n * Whether the server says this user has connected, asked without minting\n * anything: no OAuth `state` is burned by looking.\n */\n async function isConnectedNow(): Promise<boolean> {\n if (!serverName.value || !props.checkConnection) {\n return false\n }\n try {\n const status = await props.checkConnection(serverName.value)\n mcpServerId.value = status.mcpServerId\n return status.connected\n } catch {\n // Not knowing is not an error to show: the sign-in window is still\n // out there and the next read may well answer.\n return false\n }\n }\n\n let pollTimer: ReturnType<typeof setTimeout> | undefined\n /**\n * Which sign-in a running tick belongs to. A tick suspended on its read\n * outlives the attempt that scheduled it: without this it woke up inside\n * the NEXT attempt, restarted its own chain over that one's timer and then\n * stopped it on its own older deadline.\n */\n let signInAttempt = 0\n /** The window this attempt opened, the only sender we accept a report from. */\n let signInWindow: Window | null = null\n\n function stopWatching() {\n if (pollTimer !== undefined) {\n clearTimeout(pollTimer)\n pollTimer = undefined\n }\n signInAttempt += 1\n signInWindow = null\n isSigningIn.value = false\n }\n\n function settleConnected(connectedServerId: string) {\n stopWatching()\n if (hasConnected.value) {\n return\n }\n hasConnected.value = true\n mcpServerId.value = connectedServerId\n oauthError.value = null\n emit('connected', connectedServerId)\n }\n\n /**\n * Watches the connection from THIS window while the sign-in window is away.\n *\n * The callback page reports through `window.opener`, and a provider that\n * sends `Cross-Origin-Opener-Policy` anywhere in its redirect chain takes\n * that opener away: the connection then succeeds with nobody listening, the\n * card stays on its button and the suspended turn is never resumed\n * (reported 2026-08-27). This channel never goes through that window, so it\n * survives whatever the provider does to it. Chained rather than periodic:\n * a read slower than the interval would otherwise overlap the next one.\n */\n function watchForConnection(popup: Window) {\n stopWatching()\n const attempt = signInAttempt\n signInWindow = popup\n isSigningIn.value = true\n const deadline = Date.now() + POLL_TIMEOUT_MS\n const tick = async () => {\n if (attempt !== signInAttempt || Date.now() > deadline) {\n if (attempt === signInAttempt) {\n stopWatching()\n }\n return\n }\n const connected = await isConnectedNow()\n if (attempt !== signInAttempt) {\n return\n }\n if (connected && mcpServerId.value) {\n settleConnected(mcpServerId.value)\n return\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n pollTimer = setTimeout(tick, POLL_INTERVAL_MS)\n }\n\n /**\n * The callback page's own report, when the browser let it through: faster\n * than the poll, and the only channel carrying the failure reason.\n *\n * Accepted only from the window this card opened, and only while that\n * sign-in is out: the listener stays up for as long as the card is on\n * screen, and nothing else with a handle on this page may resume a turn by\n * posting a message at it.\n */\n function onMessage(event: MessageEvent) {\n if (\n event.data?.type !== 'mcp-oauth-complete' ||\n !isSigningIn.value ||\n event.source !== signInWindow\n ) {\n return\n }\n const reportedServerId = event.data.mcpServerId as string | undefined\n if (\n reportedServerId &&\n mcpServerId.value &&\n reportedServerId !== mcpServerId.value\n ) {\n return\n }\n if (!event.data.success) {\n // A failure carries no server id: the callback never got that far.\n stopWatching()\n oauthError.value = event.data.error ?? 'Unknown error'\n return\n }\n const connectedServerId = reportedServerId ?? mcpServerId.value\n if (connectedServerId) {\n settleConnected(connectedServerId)\n }\n }\n\n /**\n * Opens the provider's sign-in, on an authorize URL minted NOW.\n *\n * The URL carries an OAuth `state` that lives ten minutes server-side.\n * Minted when the card rendered, it was routinely expired by the time\n * anyone clicked, and the callback then failed on a sign-in the user had\n * just completed. The window is opened blank first, synchronously, or the\n * popup blocker kills it while we wait for the URL.\n */\n async function openAuthWindow() {\n if (\n !serverName.value ||\n !props.resolveConnection ||\n isSigningIn.value\n ) {\n return\n }\n oauthError.value = null\n const popup = window.open(\n '',\n 'mcp_oauth',\n 'width=600,height=700,menubar=no,toolbar=no',\n )\n if (!popup) {\n oauthError.value = $t('auth.popupBlocked')\n return\n }\n watchForConnection(popup)\n try {\n const connection = await props.resolveConnection(serverName.value)\n mcpServerId.value = connection.mcpServerId\n popup.location.href = connection.authorizeUrl\n } catch (err) {\n stopWatching()\n popup.close()\n oauthError.value =\n err instanceof Error ? err.message : 'Failed to resolve OAuth'\n }\n }\n\n // For the card's whole life, not just between the click and the answer: a\n // card that re-renders while the sign-in window is away used to lose the\n // listener with it, and the completion landed on nobody.\n onMounted(() => window.addEventListener('message', onMessage))\n onUnmounted(() => {\n window.removeEventListener('message', onMessage)\n stopWatching()\n })\n</script>\n\n<template>\n <div class=\"w-full overflow-hidden bg-surface-1 p-sm rounded-xl text-12\">\n <!-- Connected: just now, or by this card on an earlier visit -->\n <template v-if=\"isDone\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:check-line\" />\n <strong class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionSuccess', {\n name: serverName,\n })\n }}\n </strong>\n </div>\n </template>\n\n <!-- Signing in: the window is out and we are watching for it -->\n <template v-else-if=\"isSigningIn\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"line-md:loading-loop\" />\n <span class=\"text-10\">{{\n $t('messagePart.requestOAuthConnection')\n }}</span>\n </div>\n </template>\n\n <!-- OAuth error -->\n <template v-else-if=\"oauthError\">\n <div class=\"flex flex-col gap-xs\">\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:close-line\" class=\"text-danger\" />\n <strong class=\"text-10\">\n {{ oauthError }}\n </strong>\n </div>\n <VvButton\n v-if=\"canConnect\"\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </div>\n </template>\n\n <!-- Waiting on the user: show the connect button -->\n <template v-else-if=\"isAwaitingConnection && canConnect\">\n <div class=\"flex items-center gap-6 text-word-3 mb-xs\">\n <span>\n {{\n $t('messagePart.requestOAuthConnectionPrompt', {\n name: serverName,\n })\n }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary-small\"\n icon=\"ri:external-link-line\"\n :label=\"\n $t('messagePart.requestOAuthConnectionButton', {\n name: serverName,\n })\n \"\n @click=\"openAuthWindow\" />\n </template>\n <!-- Fallback for unknown state -->\n <template v-else>\n <div class=\"flex items-center gap-8 text-word-3\">\n <VvIcon name=\"ri:link-m\" />\n <span class=\"text-10\">\n {{\n $t('messagePart.requestOAuthConnectionInfo', {\n name: serverName,\n })\n }}\n </span>\n </div>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;8BAsBU,IAAmB,KASnB,IAAkB;;;;;;;;;EA1BxB,IAAM,IAAQ,GAUR,IAAO,GAIP,EAAE,GAAG,MAAO,EAAQ,EAAE,UAAU,SAAS,CAAC,GAc1C,IAAW,QACN,EAAM,IAMhB,GAEK,IAAQ,QAAe,EAAS,MAAM,SAAS,SAAS,GACxD,IAAa,QAAe,EAAS,MAAM,OAAO,UAAU,GAU5D,IAAc,QAAe,EAAiB,EAAS,MAAM,MAAM,CAAC,GAGpE,IAAsB,QAEnB,EAAS,MAAM,QACV,cAAc,EAC5B,GAEM,IAAuB,QACnB,EAAM,UAAU,qBAAqB,EAAY,KAC3D,GAEM,IAAc,EAAmB,IAAI,GAWrC,IAAe,EAAI,EAAK,GAExB,IAAc,EAAI,EAAK,GACvB,IAAa,EAAmB,IAAI,GAEpC,IAAS,QACL,EAAa,SAAS,EAAoB,KACpD,GACM,IAAa,QACT,EA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GAAA;IAA3C,MAAK;IAAgB,OAAM;GACnC,CAAA,GAAA,EAES,UAFT,GAES,EADF,EAAA,KAAU,GAAA,CAAA,CAAA,CAAA,GAIX,EAAA,SADV,EAAA,GAAA,EAS8B,GAAA;;IAP1B,WAAU;IACV,MAAK;IACJ,OAAgC,EAAA,CAAA,CAAE,CAAA,4CAAA,EAAiF,MAAA,EAAA,MAAA,CAAA;IAKnH,SAAO;GAKC,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA,KAAA,EAAA,SAAwB,EAAA,SAA7C,EAAA,GAAA,EAmBW,GAAA,EAAA,KAAA,EAAA,GAAA,CAlBP,EAQM,OARN,GAQM,CAPF,EAMO,QAAA,MAAA,EAJC,EAAA,CAAA,CAAE,CAAA,4CAAA,EAAiF,MAAA,EAAA,MAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,GAM/F,EAQ8B,GAAA;IAP1B,WAAU;IACV,MAAK;IACJ,OAA4B,EAAA,CAAA,CAAE,CAAA,4CAAA,EAA6E,MAAA,EAAA,MAAA,CAAA;IAK3G,SAAO;GAIZ,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,EASM,OATN,IASM,CARF,EAA2B,GAAA,EAAnB,MAAK,YAAW,CAAA,GACxB,EAMO,QANP,IAMO,EAJC,EAAA,CAAA,CAAE,CAAA,0CAAA,EAA+E,MAAA,EAAA,MAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,EAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { C as e, L as t, O as n, St as r, Tt as i, X as a, b as o, bt as s, g as c, h as l, it as u, m as d, pt as f, v as p, x as m, xt as h } from "./vue.runtime.esm-bundler-D6KKITU0.js";
2
- import { t as g } from "./PkStreamingMarkdown-YKd9F3xU.js";
2
+ import { t as g } from "./PkStreamingMarkdown-B4eMb97I.js";
3
3
  import { i as _ } from "./dist-vbhhaYbZ.js";
4
4
  import { o as v } from "./index.es-BOEs7Pvh.js";
5
5
  n(), h(), u();
@@ -90,4 +90,4 @@ var x = { class: "border border-surface-3 rounded-xl w-full overflow-hidden" },
90
90
  //#endregion
91
91
  export { E as default };
92
92
 
93
- //# sourceMappingURL=PkToolShowArtifact-54saXXCe.js.map
93
+ //# sourceMappingURL=PkToolShowArtifact-Dl8f7Q7q.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PkToolShowArtifact-54saXXCe.js","names":["$attrs","$t"],"sources":["../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAOI,IAAM,IAAQ,GAMR,IAAkB,EAAI,EAAE,GAExB,IAAU,QACR,OAAO,EAAM,QAAS,WACf,EAAM,OAEV,KAAK,UAAU,EAAM,MAAM,MAAM,CAAC,CAC5C;EAED,eAAe,IAAY;GACvB,IAAM,KAAQ,MAAM,OAAO,6DAAA,CAA4B;GACvD,IAAI;IACA,IAAM,IAAS,EAAM,WACf,EAAK,UAAU,EAAQ,OAAO,EAAE,UAAU,EAAM,SAAS,CAAC,IAC1D,EAAK,cAAc,EAAQ,KAAK;IACtC,EAAgB,QAAQ,EAAO;GACnC,QAAQ;IACJ,EAAgB,QAAQ,EAAQ,MAC3B,QAAQ,MAAM,OAAO,CAAA,CACrB,QAAQ,MAAM,MAAM,CAAA,CACpB,QAAQ,MAAM,MAAM;GAC7B;EACJ;SAEA,EAAM,GAAS,GAAW,EAAE,WAAW,GAAK,CAAC,cAI7C,EAAA,GAAA,EAOM,OAAA,EAND,OAAK,EAAeA,EAAAA,OAAO,QAAwBA,EAAAA,OAAO,QAAA,kDAAA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EO,EADA,EAAA,KAAiB,IAAA,EAAM,EAAA,KAAa,GAAA,CAAA,CAAA,CAAA,GAG/C,EAMoD,GAAA;IAL/C,MAAM,EAAA,CAAA,IAAM,kBAAA;IACZ,OAAO,EAAA,CAAA,IAASC,EAAAA,GAAE,eAAA,IAAoBA,EAAAA,GAAE,aAAA;IACzC,WAAU;IACT,OAAOA,EAAAA,GAAE,aAAA;IACV,OAAM;IACL,SAAK,AAAA,EAAA,QAAA,MAAE,EAAA,CAAA,CAAI,CAAC,EAAA,OAAU,OAAO,WAAO,EAAA;;;;;GAE7C,CAAA,CAAA,CAAA,GAAA,EAkBM,OAlBN,GAkBM,CAhBQ,EAAA,SADV,EAAA,GAAA,EAG+B,GAAA;;IAD1B,MAAM,EAAA,OAAU,OAAO;IACvB,UAAU,EAAA;GAEA,GAAA,MAAA,GAAA,CAAA,QAAA,UAAA,CAAA,KAAA,EAAA,SADf,EAAA,GAAA,EAGkC,GAAA;;IAD7B,UAAU,EAAA,OAAU,OAAO;IAC5B,OAAM;GACV,GAAA,MAAA,GAAA,CAAA,UAAA,CAAA,MAAA,EAAA,GAAA,EAQyC,OAAA;;IANrC,OAAK,EAAA,CAAC,+CAA6C,EAAA,QACW,EAAA,OAAU,OAAO,iBAAY,cAA2C,EAAA,OAAU,OAAO,iBAAY,OAAA,CAAA,CAAA;GAK/J,GAAA,EAAA,EAAA,OAAU,OAAO,OAAO,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"PkToolShowArtifact-Dl8f7Q7q.js","names":["$attrs","$t"],"sources":["../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;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,GAAA;;IAD7B,UAAU,EAAA,OAAU,OAAO;IAC5B,OAAM;GACV,GAAA,MAAA,GAAA,CAAA,UAAA,CAAA,MAAA,EAAA,GAAA,EAQyC,OAAA;;IANrC,OAAK,EAAA,CAAC,+CAA6C,EAAA,QACW,EAAA,OAAU,OAAO,iBAAY,cAA2C,EAAA,OAAU,OAAO,iBAAY,OAAA,CAAA,CAAA;GAK/J,GAAA,EAAA,EAAA,OAAU,OAAO,OAAO,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { $ as e, C as t, Ct as n, L as r, O as i, T as a, Tt as o, _ as s, b as c, bt as l, h as u, it as d, m as f, v as p, x as m, xt as h } from "./vue.runtime.esm-bundler-D6KKITU0.js";
2
- import { n as g } from "./vue-i18n-_ouwlDGE.js";
2
+ import { r as g } from "./vue-i18n-C3J36GV4.js";
3
3
  import "./src-Co0-iQeD.js";
4
4
  import { n as _ } from "./url-validation-uLMZ5-AU.js";
5
5
  import { i as v } from "./dist-vbhhaYbZ.js";
@@ -144,4 +144,4 @@ var w = {
144
144
  //#endregion
145
145
  export { z as default };
146
146
 
147
- //# sourceMappingURL=PkToolShowCalendarEvent-B_HPVUDk.js.map
147
+ //# sourceMappingURL=PkToolShowCalendarEvent-B_QmZrlZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PkToolShowCalendarEvent-B_HPVUDk.js","names":["$t"],"sources":["../../../../packages/components/src/chat/PkToolShowCalendarEvent.vue","../../../../packages/components/src/chat/PkToolShowCalendarEvent.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useClipboard } from '@vueuse/core'\n import { isSameSite } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n const { d } = useI18n()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n startDate: string\n endDate: string\n location?: string\n additionalInfo?: string\n allDay?: boolean\n }\n }\n return part\n })\n\n const dateDisplay = computed(() => {\n const input = toolPart.value.input\n if (!input) {\n return ''\n }\n const { startDate, endDate, allDay } = input\n const start = new Date(startDate)\n const end = new Date(endDate)\n const startDay = startDate.slice(0, 10)\n const endDay = endDate.slice(0, 10)\n if (allDay) {\n if (startDay === endDay) {\n return d(start, 'date-medium')\n }\n return `${d(start, 'date-medium')} - ${d(end, 'date-medium')}`\n }\n if (startDay === endDay) {\n return `${d(start, 'date-time-medium')} - ${d(end, 'time')}`\n }\n return `${d(start, 'date-time-medium')} - ${d(end, 'date-time-medium')}`\n })\n\n const calendarStart = computed(() =>\n toolPart.value.input ? new Date(toolPart.value.input.startDate) : null,\n )\n\n const calendarDay = computed(\n () => calendarStart.value?.getDate().toString() ?? '',\n )\n\n const calendarMonth = computed(() =>\n calendarStart.value ? d(calendarStart.value, 'month-short') : '',\n )\n\n // Floating time: remove dashes/colons without converting to UTC\n const toIcsDateTime = (iso: string) =>\n iso.replace(/[-:]/g, '').replace(/\\.\\d{3}$/, '')\n\n const escapeIcs = (str: string) =>\n str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\n/g, '\\\\n')\n\n const generateIcs = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const ics = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//8wave//8bot//EN',\n 'BEGIN:VEVENT',\n `DTSTART:${toIcsDateTime(startDate)}`,\n `DTEND:${toIcsDateTime(endDate)}`,\n `SUMMARY:${escapeIcs(title)}`,\n location ? `LOCATION:${escapeIcs(location)}` : '',\n additionalInfo ? `DESCRIPTION:${escapeIcs(additionalInfo)}` : '',\n `DTSTAMP:${new Date()\n .toISOString()\n .replace(/[-:]/g, '')\n .replace(/\\.\\d{3}/, '')}`,\n `UID:${crypto.randomUUID()}@8bot.ai`,\n 'END:VEVENT',\n 'END:VCALENDAR',\n ]\n .filter(Boolean)\n .join('\\r\\n')\n\n const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${title.replace(/[^a-zA-Z0-9\\s-]/g, '')}.ics`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n const openGoogleCalendar = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const start = toIcsDateTime(startDate)\n const end = toIcsDateTime(endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title,\n dates: `${start}/${end}`,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('details', additionalInfo)\n }\n window.open(\n `https://calendar.google.com/calendar/render?${params.toString()}`,\n '_blank',\n )\n }\n\n const openOutlook = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const params = new URLSearchParams({\n subject: title,\n startdt: startDate,\n enddt: endDate,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('body', additionalInfo)\n }\n window.open(\n `https://outlook.office.com/calendar/0/action/compose?${params.toString()}`,\n '_blank',\n )\n }\n\n const copyEvent = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const lines = [input.title, dateDisplay.value]\n if (input.location) {\n lines.push(input.location)\n }\n if (input.additionalInfo) {\n lines.push(input.additionalInfo)\n }\n copy(lines.join('\\n'))\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:calendar-event-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.calendarEvent') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyEvent\" />\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:calendar-line\"\n modifiers=\"action-quiet-small\"\n :label=\"$t('action.addToCalendar')\" />\n <template #items>\n <VvDropdownAction @click=\"openGoogleCalendar\">\n <VvIcon name=\"ri:google-line\" />\n Google Calendar\n </VvDropdownAction>\n <VvDropdownAction @click=\"openOutlook\">\n <VvIcon name=\"ri:microsoft-line\" />\n Outlook\n </VvDropdownAction>\n <VvDropdownAction @click=\"generateIcs\">\n <VvIcon name=\"ri:download-line\" />\n {{ $t('action.downloadIcs') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex gap-sm items-start\">\n <div\n class=\"shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center select-none\">\n <div\n class=\"bg-brand px-8 py-2 text-white text-10 font-bold uppercase tracking-wide\">\n {{ calendarMonth }}\n </div>\n <div\n class=\"bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none\">\n {{ calendarDay }}\n </div>\n </div>\n <div class=\"flex flex-col gap-4 min-w-0\">\n <p class=\"font-semibold text-word-1 text-14\">\n {{ toolPart.input.title }}\n </p>\n <div class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:time-line\" class=\"text-14 shrink-0\" />\n <time :datetime=\"toolPart.input.startDate\">{{\n dateDisplay\n }}</time>\n </div>\n <div\n v-if=\"toolPart.input.location\"\n class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-14 shrink-0\" />\n <a\n v-if=\"toolPart.input.location.startsWith('http')\"\n :href=\"toolPart.input.location\"\n :target=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : '_blank'\n \"\n :rel=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ toolPart.input.location }}\n </a>\n <span v-else>{{ toolPart.input.location }}</span>\n </div>\n <div\n v-if=\"toolPart.input.additionalInfo\"\n class=\"flex items-start gap-8 text-12 text-word-3\">\n <VvIcon\n name=\"ri:sticky-note-line\"\n class=\"text-14 shrink-0 mt-1\" />\n <span>{{ toolPart.input.additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useClipboard } from '@vueuse/core'\n import { isSameSite } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n const { d } = useI18n()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n startDate: string\n endDate: string\n location?: string\n additionalInfo?: string\n allDay?: boolean\n }\n }\n return part\n })\n\n const dateDisplay = computed(() => {\n const input = toolPart.value.input\n if (!input) {\n return ''\n }\n const { startDate, endDate, allDay } = input\n const start = new Date(startDate)\n const end = new Date(endDate)\n const startDay = startDate.slice(0, 10)\n const endDay = endDate.slice(0, 10)\n if (allDay) {\n if (startDay === endDay) {\n return d(start, 'date-medium')\n }\n return `${d(start, 'date-medium')} - ${d(end, 'date-medium')}`\n }\n if (startDay === endDay) {\n return `${d(start, 'date-time-medium')} - ${d(end, 'time')}`\n }\n return `${d(start, 'date-time-medium')} - ${d(end, 'date-time-medium')}`\n })\n\n const calendarStart = computed(() =>\n toolPart.value.input ? new Date(toolPart.value.input.startDate) : null,\n )\n\n const calendarDay = computed(\n () => calendarStart.value?.getDate().toString() ?? '',\n )\n\n const calendarMonth = computed(() =>\n calendarStart.value ? d(calendarStart.value, 'month-short') : '',\n )\n\n // Floating time: remove dashes/colons without converting to UTC\n const toIcsDateTime = (iso: string) =>\n iso.replace(/[-:]/g, '').replace(/\\.\\d{3}$/, '')\n\n const escapeIcs = (str: string) =>\n str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\n/g, '\\\\n')\n\n const generateIcs = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const ics = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//8wave//8bot//EN',\n 'BEGIN:VEVENT',\n `DTSTART:${toIcsDateTime(startDate)}`,\n `DTEND:${toIcsDateTime(endDate)}`,\n `SUMMARY:${escapeIcs(title)}`,\n location ? `LOCATION:${escapeIcs(location)}` : '',\n additionalInfo ? `DESCRIPTION:${escapeIcs(additionalInfo)}` : '',\n `DTSTAMP:${new Date()\n .toISOString()\n .replace(/[-:]/g, '')\n .replace(/\\.\\d{3}/, '')}`,\n `UID:${crypto.randomUUID()}@8bot.ai`,\n 'END:VEVENT',\n 'END:VCALENDAR',\n ]\n .filter(Boolean)\n .join('\\r\\n')\n\n const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${title.replace(/[^a-zA-Z0-9\\s-]/g, '')}.ics`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n const openGoogleCalendar = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const start = toIcsDateTime(startDate)\n const end = toIcsDateTime(endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title,\n dates: `${start}/${end}`,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('details', additionalInfo)\n }\n window.open(\n `https://calendar.google.com/calendar/render?${params.toString()}`,\n '_blank',\n )\n }\n\n const openOutlook = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const params = new URLSearchParams({\n subject: title,\n startdt: startDate,\n enddt: endDate,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('body', additionalInfo)\n }\n window.open(\n `https://outlook.office.com/calendar/0/action/compose?${params.toString()}`,\n '_blank',\n )\n }\n\n const copyEvent = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const lines = [input.title, dateDisplay.value]\n if (input.location) {\n lines.push(input.location)\n }\n if (input.additionalInfo) {\n lines.push(input.additionalInfo)\n }\n copy(lines.join('\\n'))\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:calendar-event-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.calendarEvent') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyEvent\" />\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:calendar-line\"\n modifiers=\"action-quiet-small\"\n :label=\"$t('action.addToCalendar')\" />\n <template #items>\n <VvDropdownAction @click=\"openGoogleCalendar\">\n <VvIcon name=\"ri:google-line\" />\n Google Calendar\n </VvDropdownAction>\n <VvDropdownAction @click=\"openOutlook\">\n <VvIcon name=\"ri:microsoft-line\" />\n Outlook\n </VvDropdownAction>\n <VvDropdownAction @click=\"generateIcs\">\n <VvIcon name=\"ri:download-line\" />\n {{ $t('action.downloadIcs') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex gap-sm items-start\">\n <div\n class=\"shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center select-none\">\n <div\n class=\"bg-brand px-8 py-2 text-white text-10 font-bold uppercase tracking-wide\">\n {{ calendarMonth }}\n </div>\n <div\n class=\"bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none\">\n {{ calendarDay }}\n </div>\n </div>\n <div class=\"flex flex-col gap-4 min-w-0\">\n <p class=\"font-semibold text-word-1 text-14\">\n {{ toolPart.input.title }}\n </p>\n <div class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:time-line\" class=\"text-14 shrink-0\" />\n <time :datetime=\"toolPart.input.startDate\">{{\n dateDisplay\n }}</time>\n </div>\n <div\n v-if=\"toolPart.input.location\"\n class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-14 shrink-0\" />\n <a\n v-if=\"toolPart.input.location.startsWith('http')\"\n :href=\"toolPart.input.location\"\n :target=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : '_blank'\n \"\n :rel=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ toolPart.input.location }}\n </a>\n <span v-else>{{ toolPart.input.location }}</span>\n </div>\n <div\n v-if=\"toolPart.input.additionalInfo\"\n class=\"flex items-start gap-8 text-12 text-word-3\">\n <VvIcon\n name=\"ri:sticky-note-line\"\n class=\"text-14 shrink-0 mt-1\" />\n <span>{{ toolPart.input.additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAMI,IAAM,IAAQ,GAIR,EAAE,SAAM,cAAW,EAAa,GAChC,EAAE,SAAM,EAAQ,GAEhB,IAAW,QACA,EAAM,IAWtB,GAEK,IAAc,QAAe;GAC/B,IAAM,IAAQ,EAAS,MAAM;GAC7B,IAAI,CAAC,GACD,OAAO;GAEX,IAAM,EAAE,cAAW,YAAS,cAAW,GACjC,IAAQ,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IACV,CAAA,GAAA,EAAgD,QAAA,MAAA,EAAvC,EAAA,MAAS,MAAM,cAAc,GAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
1
+ {"version":3,"file":"PkToolShowCalendarEvent-B_QmZrlZ.js","names":["$t"],"sources":["../../../../packages/components/src/chat/PkToolShowCalendarEvent.vue","../../../../packages/components/src/chat/PkToolShowCalendarEvent.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useClipboard } from '@vueuse/core'\n import { isSameSite } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n const { d } = useI18n()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n startDate: string\n endDate: string\n location?: string\n additionalInfo?: string\n allDay?: boolean\n }\n }\n return part\n })\n\n const dateDisplay = computed(() => {\n const input = toolPart.value.input\n if (!input) {\n return ''\n }\n const { startDate, endDate, allDay } = input\n const start = new Date(startDate)\n const end = new Date(endDate)\n const startDay = startDate.slice(0, 10)\n const endDay = endDate.slice(0, 10)\n if (allDay) {\n if (startDay === endDay) {\n return d(start, 'date-medium')\n }\n return `${d(start, 'date-medium')} - ${d(end, 'date-medium')}`\n }\n if (startDay === endDay) {\n return `${d(start, 'date-time-medium')} - ${d(end, 'time')}`\n }\n return `${d(start, 'date-time-medium')} - ${d(end, 'date-time-medium')}`\n })\n\n const calendarStart = computed(() =>\n toolPart.value.input ? new Date(toolPart.value.input.startDate) : null,\n )\n\n const calendarDay = computed(\n () => calendarStart.value?.getDate().toString() ?? '',\n )\n\n const calendarMonth = computed(() =>\n calendarStart.value ? d(calendarStart.value, 'month-short') : '',\n )\n\n // Floating time: remove dashes/colons without converting to UTC\n const toIcsDateTime = (iso: string) =>\n iso.replace(/[-:]/g, '').replace(/\\.\\d{3}$/, '')\n\n const escapeIcs = (str: string) =>\n str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\n/g, '\\\\n')\n\n const generateIcs = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const ics = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//8wave//8bot//EN',\n 'BEGIN:VEVENT',\n `DTSTART:${toIcsDateTime(startDate)}`,\n `DTEND:${toIcsDateTime(endDate)}`,\n `SUMMARY:${escapeIcs(title)}`,\n location ? `LOCATION:${escapeIcs(location)}` : '',\n additionalInfo ? `DESCRIPTION:${escapeIcs(additionalInfo)}` : '',\n `DTSTAMP:${new Date()\n .toISOString()\n .replace(/[-:]/g, '')\n .replace(/\\.\\d{3}/, '')}`,\n `UID:${crypto.randomUUID()}@8bot.ai`,\n 'END:VEVENT',\n 'END:VCALENDAR',\n ]\n .filter(Boolean)\n .join('\\r\\n')\n\n const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${title.replace(/[^a-zA-Z0-9\\s-]/g, '')}.ics`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n const openGoogleCalendar = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const start = toIcsDateTime(startDate)\n const end = toIcsDateTime(endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title,\n dates: `${start}/${end}`,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('details', additionalInfo)\n }\n window.open(\n `https://calendar.google.com/calendar/render?${params.toString()}`,\n '_blank',\n )\n }\n\n const openOutlook = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const params = new URLSearchParams({\n subject: title,\n startdt: startDate,\n enddt: endDate,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('body', additionalInfo)\n }\n window.open(\n `https://outlook.office.com/calendar/0/action/compose?${params.toString()}`,\n '_blank',\n )\n }\n\n const copyEvent = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const lines = [input.title, dateDisplay.value]\n if (input.location) {\n lines.push(input.location)\n }\n if (input.additionalInfo) {\n lines.push(input.additionalInfo)\n }\n copy(lines.join('\\n'))\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:calendar-event-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.calendarEvent') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyEvent\" />\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:calendar-line\"\n modifiers=\"action-quiet-small\"\n :label=\"$t('action.addToCalendar')\" />\n <template #items>\n <VvDropdownAction @click=\"openGoogleCalendar\">\n <VvIcon name=\"ri:google-line\" />\n Google Calendar\n </VvDropdownAction>\n <VvDropdownAction @click=\"openOutlook\">\n <VvIcon name=\"ri:microsoft-line\" />\n Outlook\n </VvDropdownAction>\n <VvDropdownAction @click=\"generateIcs\">\n <VvIcon name=\"ri:download-line\" />\n {{ $t('action.downloadIcs') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex gap-sm items-start\">\n <div\n class=\"shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center select-none\">\n <div\n class=\"bg-brand px-8 py-2 text-white text-10 font-bold uppercase tracking-wide\">\n {{ calendarMonth }}\n </div>\n <div\n class=\"bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none\">\n {{ calendarDay }}\n </div>\n </div>\n <div class=\"flex flex-col gap-4 min-w-0\">\n <p class=\"font-semibold text-word-1 text-14\">\n {{ toolPart.input.title }}\n </p>\n <div class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:time-line\" class=\"text-14 shrink-0\" />\n <time :datetime=\"toolPart.input.startDate\">{{\n dateDisplay\n }}</time>\n </div>\n <div\n v-if=\"toolPart.input.location\"\n class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-14 shrink-0\" />\n <a\n v-if=\"toolPart.input.location.startsWith('http')\"\n :href=\"toolPart.input.location\"\n :target=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : '_blank'\n \"\n :rel=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ toolPart.input.location }}\n </a>\n <span v-else>{{ toolPart.input.location }}</span>\n </div>\n <div\n v-if=\"toolPart.input.additionalInfo\"\n class=\"flex items-start gap-8 text-12 text-word-3\">\n <VvIcon\n name=\"ri:sticky-note-line\"\n class=\"text-14 shrink-0 mt-1\" />\n <span>{{ toolPart.input.additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useClipboard } from '@vueuse/core'\n import { isSameSite } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n const { d } = useI18n()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n startDate: string\n endDate: string\n location?: string\n additionalInfo?: string\n allDay?: boolean\n }\n }\n return part\n })\n\n const dateDisplay = computed(() => {\n const input = toolPart.value.input\n if (!input) {\n return ''\n }\n const { startDate, endDate, allDay } = input\n const start = new Date(startDate)\n const end = new Date(endDate)\n const startDay = startDate.slice(0, 10)\n const endDay = endDate.slice(0, 10)\n if (allDay) {\n if (startDay === endDay) {\n return d(start, 'date-medium')\n }\n return `${d(start, 'date-medium')} - ${d(end, 'date-medium')}`\n }\n if (startDay === endDay) {\n return `${d(start, 'date-time-medium')} - ${d(end, 'time')}`\n }\n return `${d(start, 'date-time-medium')} - ${d(end, 'date-time-medium')}`\n })\n\n const calendarStart = computed(() =>\n toolPart.value.input ? new Date(toolPart.value.input.startDate) : null,\n )\n\n const calendarDay = computed(\n () => calendarStart.value?.getDate().toString() ?? '',\n )\n\n const calendarMonth = computed(() =>\n calendarStart.value ? d(calendarStart.value, 'month-short') : '',\n )\n\n // Floating time: remove dashes/colons without converting to UTC\n const toIcsDateTime = (iso: string) =>\n iso.replace(/[-:]/g, '').replace(/\\.\\d{3}$/, '')\n\n const escapeIcs = (str: string) =>\n str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\n/g, '\\\\n')\n\n const generateIcs = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const ics = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//8wave//8bot//EN',\n 'BEGIN:VEVENT',\n `DTSTART:${toIcsDateTime(startDate)}`,\n `DTEND:${toIcsDateTime(endDate)}`,\n `SUMMARY:${escapeIcs(title)}`,\n location ? `LOCATION:${escapeIcs(location)}` : '',\n additionalInfo ? `DESCRIPTION:${escapeIcs(additionalInfo)}` : '',\n `DTSTAMP:${new Date()\n .toISOString()\n .replace(/[-:]/g, '')\n .replace(/\\.\\d{3}/, '')}`,\n `UID:${crypto.randomUUID()}@8bot.ai`,\n 'END:VEVENT',\n 'END:VCALENDAR',\n ]\n .filter(Boolean)\n .join('\\r\\n')\n\n const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${title.replace(/[^a-zA-Z0-9\\s-]/g, '')}.ics`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n const openGoogleCalendar = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const start = toIcsDateTime(startDate)\n const end = toIcsDateTime(endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title,\n dates: `${start}/${end}`,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('details', additionalInfo)\n }\n window.open(\n `https://calendar.google.com/calendar/render?${params.toString()}`,\n '_blank',\n )\n }\n\n const openOutlook = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const params = new URLSearchParams({\n subject: title,\n startdt: startDate,\n enddt: endDate,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('body', additionalInfo)\n }\n window.open(\n `https://outlook.office.com/calendar/0/action/compose?${params.toString()}`,\n '_blank',\n )\n }\n\n const copyEvent = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const lines = [input.title, dateDisplay.value]\n if (input.location) {\n lines.push(input.location)\n }\n if (input.additionalInfo) {\n lines.push(input.additionalInfo)\n }\n copy(lines.join('\\n'))\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:calendar-event-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.calendarEvent') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyEvent\" />\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:calendar-line\"\n modifiers=\"action-quiet-small\"\n :label=\"$t('action.addToCalendar')\" />\n <template #items>\n <VvDropdownAction @click=\"openGoogleCalendar\">\n <VvIcon name=\"ri:google-line\" />\n Google Calendar\n </VvDropdownAction>\n <VvDropdownAction @click=\"openOutlook\">\n <VvIcon name=\"ri:microsoft-line\" />\n Outlook\n </VvDropdownAction>\n <VvDropdownAction @click=\"generateIcs\">\n <VvIcon name=\"ri:download-line\" />\n {{ $t('action.downloadIcs') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex gap-sm items-start\">\n <div\n class=\"shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center select-none\">\n <div\n class=\"bg-brand px-8 py-2 text-white text-10 font-bold uppercase tracking-wide\">\n {{ calendarMonth }}\n </div>\n <div\n class=\"bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none\">\n {{ calendarDay }}\n </div>\n </div>\n <div class=\"flex flex-col gap-4 min-w-0\">\n <p class=\"font-semibold text-word-1 text-14\">\n {{ toolPart.input.title }}\n </p>\n <div class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:time-line\" class=\"text-14 shrink-0\" />\n <time :datetime=\"toolPart.input.startDate\">{{\n dateDisplay\n }}</time>\n </div>\n <div\n v-if=\"toolPart.input.location\"\n class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-14 shrink-0\" />\n <a\n v-if=\"toolPart.input.location.startsWith('http')\"\n :href=\"toolPart.input.location\"\n :target=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : '_blank'\n \"\n :rel=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ toolPart.input.location }}\n </a>\n <span v-else>{{ toolPart.input.location }}</span>\n </div>\n <div\n v-if=\"toolPart.input.additionalInfo\"\n class=\"flex items-start gap-8 text-12 text-word-3\">\n <VvIcon\n name=\"ri:sticky-note-line\"\n class=\"text-14 shrink-0 mt-1\" />\n <span>{{ toolPart.input.additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAMI,IAAM,IAAQ,GAIR,EAAE,SAAM,cAAW,EAAa,GAChC,EAAE,SAAM,EAAQ,GAEhB,IAAW,QACA,EAAM,IAWtB,GAEK,IAAc,QAAe;GAC/B,IAAM,IAAQ,EAAS,MAAM;GAC7B,IAAI,CAAC,GACD,OAAO;GAEX,IAAM,EAAE,cAAW,YAAS,cAAW,GACjC,IAAQ,IAAI,KAAK,CAAS,GAC1B,IAAM,IAAI,KAAK,CAAO,GACtB,IAAW,EAAU,MAAM,GAAG,EAAE,GAChC,IAAS,EAAQ,MAAM,GAAG,EAAE;GAUlC,OATI,IACI,MAAa,IACN,EAAE,GAAO,aAAa,IAE1B,GAAG,EAAE,GAAO,aAAa,EAAE,KAAK,EAAE,GAAK,aAAa,MAE3D,MAAa,IACN,GAAG,EAAE,GAAO,kBAAkB,EAAE,KAAK,EAAE,GAAK,MAAM,MAEtD,GAAG,EAAE,GAAO,kBAAkB,EAAE,KAAK,EAAE,GAAK,kBAAkB;EACzE,CAAC,GAEK,IAAgB,QAClB,EAAS,MAAM,QAAQ,IAAI,KAAK,EAAS,MAAM,MAAM,SAAS,IAAI,IACtE,GAEM,IAAc,QACV,EAAc,OAAO,QAAQ,CAAC,CAAC,SAAS,KAAK,EACvD,GAEM,IAAgB,QAClB,EAAc,QAAQ,EAAE,EAAc,OAAO,aAAa,IAAI,EAClE,GAGM,KAAiB,MACnB,EAAI,QAAQ,SAAS,EAAE,CAAC,CAAC,QAAQ,YAAY,EAAE,GAE7C,KAAa,MACf,EACK,QAAQ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KAD5C,EAAA,GAAA,EAeI,KAAA;;KAbC,MAAM,EAAA,MAAS,MAAM;KACrB,QAAqC,EAAA,CAAA,CAAU,CAAC,EAAA,MAAS,MAAM,QAAQ,IAAoC,KAAA,IAAA;KAK3G,KAAkC,EAAA,CAAA,CAAU,CAAC,EAAA,MAAS,MAAM,QAAQ,IAAoC,KAAA,IAAA;KAKzG,OAAM;IACH,GAAA,EAAA,EAAA,MAAS,MAAM,QAAQ,GAAA,GAAA,CAAA,MAE9B,EAAA,GAAA,EAAiD,QAAA,GAAA,EAAjC,EAAA,MAAS,MAAM,QAAQ,GAAA,CAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA;IAGjC,EAAA,MAAS,MAAM,kBADzB,EAAA,GAAA,EAOM,OAPN,GAOM,CAJF,EAEoC,GAAA;KADhC,MAAK;KACL,OAAM;IACV,CAAA,GAAA,EAAgD,QAAA,MAAA,EAAvC,EAAA,MAAS,MAAM,cAAc,GAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
@@ -1,9 +1,9 @@
1
1
  import { $ as e, C as t, L as n, O as r, Tt as i, X as a, bt as o, ct as s, h as c, it as l, m as u, r as d, t as f, v as p, x as m, xt as h } from "./vue.runtime.esm-bundler-D6KKITU0.js";
2
- import { n as g, r as _, t as v } from "./index.es-DXx8DNKf.js";
3
- import { n as y } from "./vue-i18n-_ouwlDGE.js";
4
- import { t as b } from "./PkStreamingMarkdown-YKd9F3xU.js";
5
- import { o as x, p as S } from "./index.es-BOEs7Pvh.js";
6
- import { g as C, u as w, v as T } from "./schemas-U769m8P5.js";
2
+ import { r as g } from "./vue-i18n-C3J36GV4.js";
3
+ import { t as _ } from "./PkStreamingMarkdown-B4eMb97I.js";
4
+ import { o as v, p as y } from "./index.es-BOEs7Pvh.js";
5
+ import { g as b, u as x, v as S } from "./schemas-U769m8P5.js";
6
+ import { n as C, r as w, t as T } from "./index.es-CnpsLhp_.js";
7
7
  r(), l(), h(), d();
8
8
  var E = { class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface" }, D = { class: "px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40" }, O = { class: "font-bold" }, k = {
9
9
  key: 0,
@@ -23,11 +23,11 @@ var E = { class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-s
23
23
  },
24
24
  emits: ["submit"],
25
25
  setup(t, { emit: r }) {
26
- let { t: l } = y({ useScope: "global" }), d = t, h = u(() => d.part), I = u(() => h.value.input), L = _(u(() => `${h.value.toolCallId}-${h.value.type}-submitted`), !1), R = C({
27
- name: T().min(1).max(255).default(""),
28
- email: w().max(255).default(""),
29
- phone: T().max(50).regex(/^[+0-9\s\-.()]*$/, l("validation.invalidPhoneNumber")).optional()
30
- }), z = r, { VvForm: B, VvFormField: V, formData: H } = v(R, { lazyLoad: !0 });
26
+ let { t: l } = g({ useScope: "global" }), d = t, h = u(() => d.part), I = u(() => h.value.input), L = w(u(() => `${h.value.toolCallId}-${h.value.type}-submitted`), !1), R = b({
27
+ name: S().min(1).max(255).default(""),
28
+ email: x().max(255).default(""),
29
+ phone: S().max(50).regex(/^[+0-9\s\-.()]*$/, l("validation.invalidPhoneNumber")).optional()
30
+ }), z = r, { VvForm: B, VvFormField: V, formData: H } = T(R, { lazyLoad: !0 });
31
31
  a(I, (e) => {
32
32
  H.value = {
33
33
  name: e?.name || "",
@@ -42,9 +42,9 @@ var E = { class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-s
42
42
  ...e,
43
43
  metadata: I.value?.conversationContext
44
44
  });
45
- }, G = g(() => d.privacyPolicyNotice, "message.defaultPrivacyPolicyNotice");
45
+ }, G = C(() => d.privacyPolicyNotice, "message.defaultPrivacyPolicyNotice");
46
46
  return (r, a) => {
47
- let u = S, d = x;
47
+ let u = y, d = v;
48
48
  return n(), p("div", E, [c("div", D, [m(u, {
49
49
  name: "ri:send-plane-2-line",
50
50
  class: "text-16"
@@ -89,7 +89,7 @@ var E = { class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-s
89
89
  c("div", A, [c("div", j, [m(u, {
90
90
  name: "ri:shield-check-line",
91
91
  class: "text-16 shrink-0"
92
- }), m(b, {
92
+ }), m(_, {
93
93
  markdown: o(G),
94
94
  class: "wysiwyg"
95
95
  }, null, 8, ["markdown"])]), m(d, {
@@ -116,4 +116,4 @@ var E = { class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-s
116
116
  //#endregion
117
117
  export { I as default };
118
118
 
119
- //# sourceMappingURL=PkToolShowContactForm-BtcNCixq.js.map
119
+ //# sourceMappingURL=PkToolShowContactForm-CXE0485W.js.map