@8wave/ai-elements 0.123.0-beta.16 → 0.123.0-beta.17
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.
- package/dist/_chunks/PkFilePreview-DXmgMwwu.js +1143 -0
- package/dist/_chunks/PkFilePreview-DXmgMwwu.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-nibxELSF.js → PkFilePreviewDialog-Bzt534GA.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-nibxELSF.js.map → PkFilePreviewDialog-Bzt534GA.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-C6cFkf82.js → PkStreamingMarkdown-PQ3X83Fq.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-C6cFkf82.js.map → PkStreamingMarkdown-PQ3X83Fq.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-5t_1vL81.js → PkToolChatFile-CYxqugvO.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-5t_1vL81.js.map → PkToolChatFile-CYxqugvO.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-DV78g_yD.js → PkToolShowArtifact-BIpD-GkV.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-DV78g_yD.js.map → PkToolShowArtifact-BIpD-GkV.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Bnjy0g50.js → PkToolShowContactForm-2_YDqjeM.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-Bnjy0g50.js.map → PkToolShowContactForm-2_YDqjeM.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CT5_ln9b.js → PkToolShowForm-Bu4igmQL.js} +5 -5
- package/dist/_chunks/{PkToolShowForm-CT5_ln9b.js.map → PkToolShowForm-Bu4igmQL.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js → PkToolShowSources-DKtdU_Bq.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js.map → PkToolShowSources-DKtdU_Bq.js.map} +1 -1
- package/dist/_chunks/{utils-B5VcWm3g.js → utils-Bz1Gb3iO.js} +114 -77
- package/dist/_chunks/utils-Bz1Gb3iO.js.map +1 -0
- package/dist/ai-elements.es.js +252 -252
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-tq-fJUij.js → PkChatbot-MEYD0XUR.js} +5 -5
- package/dist-vue/_chunks/{PkChatbot-tq-fJUij.js.map → PkChatbot-MEYD0XUR.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-Dp0_UPJm.js → PkChatbotEmptyState-qKpfIuvI.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-Dp0_UPJm.js.map → PkChatbotEmptyState-qKpfIuvI.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-B_kPnNNB.js → PkChatbotInput-DSH5IrO6.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-B_kPnNNB.js.map → PkChatbotInput-DSH5IrO6.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-BTZOic9V.js → PkChatbotMessages-BcHNPZUB.js} +327 -327
- package/dist-vue/_chunks/{PkChatbotMessages-BTZOic9V.js.map → PkChatbotMessages-BcHNPZUB.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-CoGCHBhJ.js → PkChatbotStepPayload-BT-Xg18D.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-CoGCHBhJ.js.map → PkChatbotStepPayload-BT-Xg18D.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJtIZBF0.js → PkChatbotStepToolDetail-Cs322RDk.js} +16 -16
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJtIZBF0.js.map → PkChatbotStepToolDetail-Cs322RDk.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-CEJNclG4.js → PkChatbotSteps-Dd62GEXJ.js} +23 -23
- package/dist-vue/_chunks/{PkChatbotSteps-CEJNclG4.js.map → PkChatbotSteps-Dd62GEXJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-CnEOSH32.js → PkChatbotViewChat-CfpGWukX.js} +9 -9
- package/dist-vue/_chunks/{PkChatbotViewChat-CnEOSH32.js.map → PkChatbotViewChat-CfpGWukX.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-D7j5P1RO.js → PkChatbotViewConversations-JCrQIoGf.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-D7j5P1RO.js.map → PkChatbotViewConversations-JCrQIoGf.js.map} +1 -1
- package/dist-vue/_chunks/PkFilePreview-CFqcO3vY.js +1126 -0
- package/dist-vue/_chunks/PkFilePreview-CFqcO3vY.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-Cic7gmVR.js → PkFilePreviewDialog-DeNnbXWq.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-Cic7gmVR.js.map → PkFilePreviewDialog-DeNnbXWq.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-CYlCIfA0.js → PkStreamingMarkdown-QDsT-4jC.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-CYlCIfA0.js.map → PkStreamingMarkdown-QDsT-4jC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-B_PeJef8.js → PkToolChatFile-UZeUytvT.js} +2 -2
- package/dist-vue/_chunks/{PkToolChatFile-B_PeJef8.js.map → PkToolChatFile-UZeUytvT.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-Bh-jIo0V.js → PkToolShowArtifact-ldnH-U3h.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-Bh-jIo0V.js.map → PkToolShowArtifact-ldnH-U3h.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BjfRuNuj.js → PkToolShowContactForm-4hISKYqb.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BjfRuNuj.js.map → PkToolShowContactForm-4hISKYqb.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-_NnrFDGT.js → PkToolShowDiagram-uHFCQ0FJ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-_NnrFDGT.js.map → PkToolShowDiagram-uHFCQ0FJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-AqEY4_do.js → PkToolShowForm-DiUz5_Ct.js} +5 -5
- package/dist-vue/_chunks/{PkToolShowForm-AqEY4_do.js.map → PkToolShowForm-DiUz5_Ct.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-DM5AJNZ3.js → PkToolShowImageGallery-CEzeXupr.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-DM5AJNZ3.js.map → PkToolShowImageGallery-CEzeXupr.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-CAV8be9a.js → PkToolShowProductList-h4Dqvk1V.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-CAV8be9a.js.map → PkToolShowProductList-h4Dqvk1V.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-CriswKr_.js → PkToolShowSources-BJd4zYAY.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-CriswKr_.js.map → PkToolShowSources-BJd4zYAY.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-FSWM5MOl.js → PkToolShowVideo-DgkpZriW.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-FSWM5MOl.js.map → PkToolShowVideo-DgkpZriW.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CPhm2ba3.js → PkToolShowWebPages-DQr3SEGC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CPhm2ba3.js.map → PkToolShowWebPages-DQr3SEGC.js.map} +1 -1
- package/dist-vue/_chunks/{utils-BgvjC1Pu.js → utils-DmBnucJs.js} +129 -92
- package/dist-vue/_chunks/utils-DmBnucJs.js.map +1 -0
- package/dist-vue/composables.js +1 -1
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +32 -32
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +3 -1
- package/dist-vue/packages/components/src/chat/PkWordPreviewBlock.d.ts +9 -3
- package/dist-vue/packages/components/src/chat/PkWordPreviewPart.d.ts +20 -0
- package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +12 -3
- package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +420 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +49 -1
- package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +339 -0
- package/dist-vue/packages/models/src/schema/WordPreview.d.ts +571 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-Bcdfci6i.js +0 -948
- package/dist/_chunks/PkFilePreview-Bcdfci6i.js.map +0 -1
- package/dist/_chunks/utils-B5VcWm3g.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-BKwnNsyV.js +0 -934
- package/dist-vue/_chunks/PkFilePreview-BKwnNsyV.js.map +0 -1
- package/dist-vue/_chunks/utils-BgvjC1Pu.js.map +0 -1
package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js.map → PkToolShowSources-DKtdU_Bq.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowSources-DhZ5I_J-.js","names":["_hoisted_1","_hoisted_2","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_createVNode","_createElementVNode","_toDisplayString","_unref","_createCommentVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_createElementVNode","_toDisplayString","_createCommentVNode","PkUrl","_sfc_main","$t","__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_createTextVNode","_toDisplayString","_Fragment","_renderList","PkDocumentHeader","_createCommentVNode","_createBlock","PkStreamingMarkdown","PkChunkPreview","_Transition","_withCtx","_normalizeClass","_sfc_main","normalizeClass","createVNode","init_shared_esm_bundler","renderList","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","reactive","init_reactivity_esm_bundler","init_runtime_dom_esm_bundler","Transition","withCtx","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","PkStreamingMarkdown_default","getTypeIcon","stripMarkdown","Ce","VvButtonLocalized","PkUrl_default","_hoisted_1$2","_hoisted_2$2","PkChunkPreview_default","props","__props","similarityPercent","max","_component_VvIcon","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","PkDocumentHeader_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","PkToolShowSources_default","toolPart","sources","groupedSources","groups","source","existing","maxSimilarity","s","expandedDocuments","expandedChunks","contextData","loadingContext","toggleDocument","documentId","toggleChunk","chunkId","handleExpandContext","content","clearContext","showMore","visibleGroups","hasMore","_component_VvButton","_ctx","group","chunk","_cache"],"sources":["../../../../packages/components/src/chat/PkChunkPreview.vue","../../../../packages/components/src/chat/PkChunkPreview.vue","../../../../packages/components/src/chat/PkDocumentHeader.vue","../../../../packages/components/src/chat/PkDocumentHeader.vue","../../../../packages/components/src/chat/PkToolShowSources.vue","../../../../packages/components/src/chat/PkToolShowSources.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { stripMarkdown } from 'utils'\n\n const props = defineProps<{\n content: string\n similarity?: number\n maxSimilarity?: number\n expanded: boolean\n }>()\n\n const similarityPercent = computed(() => {\n if (props.similarity == null) {\n return null\n }\n const max =\n props.maxSimilarity && props.maxSimilarity > 0\n ? props.maxSimilarity\n : 1\n return Math.round((props.similarity / max) * 100)\n })\n</script>\n\n<template>\n <VvIcon name=\"ri:text-snippet\" class=\"shrink-0 text-12 text-word-4\" />\n <span class=\"text-10 text-word-2 truncate flex-1\" :title=\"content\">\n {{ stripMarkdown(content) }}\n </span>\n <span v-if=\"similarityPercent != null\" class=\"text-10 text-word-4 shrink-0\">\n {{ similarityPercent }}%\n </span>\n <VvIcon\n :name=\"expanded ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-14 text-word-4 shrink-0\" />\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { stripMarkdown } from 'utils'\n\n const props = defineProps<{\n content: string\n similarity?: number\n maxSimilarity?: number\n expanded: boolean\n }>()\n\n const similarityPercent = computed(() => {\n if (props.similarity == null) {\n return null\n }\n const max =\n props.maxSimilarity && props.maxSimilarity > 0\n ? props.maxSimilarity\n : 1\n return Math.round((props.similarity / max) * 100)\n })\n</script>\n\n<template>\n <VvIcon name=\"ri:text-snippet\" class=\"shrink-0 text-12 text-word-4\" />\n <span class=\"text-10 text-word-2 truncate flex-1\" :title=\"content\">\n {{ stripMarkdown(content) }}\n </span>\n <span v-if=\"similarityPercent != null\" class=\"text-10 text-word-4 shrink-0\">\n {{ similarityPercent }}%\n </span>\n <VvIcon\n :name=\"expanded ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-14 text-word-4 shrink-0\" />\n</template>\n","<script setup lang=\"ts\">\n import type { DocumentType } from 'models'\n import { getTypeIcon } from 'models'\n import PkUrl from '../PkUrl.vue'\n\n defineProps<{\n type: string\n name: string\n url?: string\n filename?: string\n /**\n * The address as text, not a link: for a header drawn inside a button,\n * where a link is invalid HTML and its click also toggles the row\n */\n mutedUrl?: boolean\n }>()\n</script>\n\n<template>\n <VvIcon\n :name=\"getTypeIcon(type as DocumentType)\"\n class=\"shrink-0 text-14 text-word-3\" />\n <div class=\"flex flex-col gap-2 min-w-0 flex-1\">\n <strong class=\"font-bold text-12 text-word-1 truncate block\">\n {{ name }}\n </strong>\n <span v-if=\"filename\" class=\"text-10 text-word-4 truncate\">\n {{ filename }}\n </span>\n <span\n v-if=\"url\"\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-10\" />\n <PkUrl :url=\"url\" :muted=\"mutedUrl\" />\n </span>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import type { DocumentType } from 'models'\n import { getTypeIcon } from 'models'\n import PkUrl from '../PkUrl.vue'\n\n defineProps<{\n type: string\n name: string\n url?: string\n filename?: string\n /**\n * The address as text, not a link: for a header drawn inside a button,\n * where a link is invalid HTML and its click also toggles the row\n */\n mutedUrl?: boolean\n }>()\n</script>\n\n<template>\n <VvIcon\n :name=\"getTypeIcon(type as DocumentType)\"\n class=\"shrink-0 text-14 text-word-3\" />\n <div class=\"flex flex-col gap-2 min-w-0 flex-1\">\n <strong class=\"font-bold text-12 text-word-1 truncate block\">\n {{ name }}\n </strong>\n <span v-if=\"filename\" class=\"text-10 text-word-4 truncate\">\n {{ filename }}\n </span>\n <span\n v-if=\"url\"\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-10\" />\n <PkUrl :url=\"url\" :muted=\"mutedUrl\" />\n </span>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive } from 'vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChunkPreview from './PkChunkPreview.vue'\n import PkDocumentHeader from './PkDocumentHeader.vue'\n\n interface SourceItem {\n chunkId: string\n documentId: string\n documentName: string\n documentType: string\n language: string\n content: string\n chunkIndex?: number | null\n similarity?: number\n sourceUrl?: string\n sourceFilename?: string\n sourceDescription?: string\n sourceImageUrl?: string\n }\n\n const props = defineProps<{\n part: unknown\n onExpandContext?: (payload: {\n documentId: string\n chunkIndex: number\n }) => Promise<string>\n onDownload?: (documentId: string) => void\n }>()\n\n const toolPart = computed(() => {\n return props.part as {\n input?: {\n sources: SourceItem[]\n }\n }\n })\n\n const sources = computed(() => toolPart.value.input?.sources || [])\n\n const groupedSources = computed(() => {\n const groups = new Map<\n string,\n { document: SourceItem; chunks: SourceItem[] }\n >()\n for (const source of sources.value) {\n const existing = groups.get(source.documentId)\n if (existing) {\n existing.chunks.push(source)\n } else {\n groups.set(source.documentId, {\n document: source,\n chunks: [source],\n })\n }\n }\n return [...groups.values()]\n })\n\n const maxSimilarity = computed(() => {\n return Math.max(...sources.value.map((s) => s.similarity ?? 0), 0)\n })\n\n const expandedDocuments = reactive(new Set<string>())\n const expandedChunks = reactive(new Set<string>())\n const contextData = reactive(new Map<string, string>())\n const loadingContext = reactive(new Set<string>())\n\n const toggleDocument = (documentId: string) => {\n if (expandedDocuments.has(documentId)) {\n expandedDocuments.delete(documentId)\n } else {\n expandedDocuments.add(documentId)\n }\n }\n\n const toggleChunk = (chunkId: string) => {\n if (expandedChunks.has(chunkId)) {\n expandedChunks.delete(chunkId)\n } else {\n expandedChunks.add(chunkId)\n }\n }\n\n const handleExpandContext = async (source: SourceItem) => {\n if (source.chunkIndex == null || !props.onExpandContext) {\n return\n }\n loadingContext.add(source.chunkId)\n try {\n const content = await props.onExpandContext({\n documentId: source.documentId,\n chunkIndex: source.chunkIndex,\n })\n contextData.set(source.chunkId, content)\n } finally {\n loadingContext.delete(source.chunkId)\n }\n }\n\n const clearContext = (chunkId: string) => {\n contextData.delete(chunkId)\n }\n\n const showMore = ref(false)\n const visibleGroups = computed(() => {\n if (showMore.value) {\n return groupedSources.value\n }\n return groupedSources.value.slice(0, 3)\n })\n const hasMore = computed(() => groupedSources.value.length > 3)\n</script>\n\n<template>\n <div v-if=\"sources.length\" class=\"flex flex-col gap-xs w-full\">\n <div class=\"flex items-center gap-4 text-12 text-word-3 font-semibold\">\n <VvIcon name=\"ri:article-line\" class=\"text-14\" />\n {{ $t('label.sources') }}\n <span class=\"text-word-4 font-normal\">\n ({{ groupedSources.length }})\n </span>\n </div>\n\n <ul class=\"flex flex-col gap-xs\">\n <li\n v-for=\"group in visibleGroups\"\n :key=\"group.document.documentId\"\n class=\"border border-surface-3 rounded-xl overflow-hidden\">\n <!-- Document header: the toggle, and beside it the link to\n the source, because a link inside a button is invalid\n HTML and its click also toggled the row -->\n <div\n class=\"flex items-center hover:bg-surface-1 transition-colors\">\n <button\n type=\"button\"\n class=\"flex items-center gap-8 p-8 flex-1 min-w-0 text-left cursor-pointer\"\n :aria-expanded=\"\n expandedDocuments.has(group.document.documentId)\n \"\n @click=\"toggleDocument(group.document.documentId)\">\n <PkDocumentHeader\n :type=\"group.document.documentType\"\n :name=\"group.document.documentName\"\n :url=\"group.document.sourceUrl\"\n :filename=\"group.document.sourceFilename\"\n muted-url />\n <div class=\"flex items-center gap-4 shrink-0\">\n <span\n v-if=\"group.chunks.length > 1\"\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2\">\n {{ group.chunks.length }}\n </span>\n <span\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2 uppercase\">\n {{ group.document.language }}\n </span>\n <VvIcon\n :name=\"\n expandedDocuments.has(\n group.document.documentId,\n )\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"text-16 text-word-3\" />\n </div>\n </button>\n <VvButton\n v-if=\"group.document.sourceUrl\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:external-link-line\"\n class=\"text-10 shrink-0 mr-8\"\n :href=\"group.document.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :title=\"$t('action.open')\"\n :aria-label=\"$t('action.open')\" />\n </div>\n\n <!-- Expanded content -->\n <div\n v-if=\"expandedDocuments.has(group.document.documentId)\"\n class=\"border-t border-surface-3\">\n <PkStreamingMarkdown\n v-if=\"group.document.sourceDescription\"\n :markdown=\"group.document.sourceDescription\"\n class=\"px-8 py-4 text-10 text-word-3 bg-surface-1 border-b border-surface-3\" />\n\n <!-- Chunk excerpts -->\n <div\n v-for=\"chunk in group.chunks\"\n :key=\"chunk.chunkId\"\n class=\"border-b border-surface-3 last:border-b-0\">\n <button\n class=\"flex items-center gap-8 px-8 py-6 w-full text-left hover:bg-surface-1 transition-colors cursor-pointer\"\n @click=\"toggleChunk(chunk.chunkId)\">\n <PkChunkPreview\n :content=\"chunk.content\"\n :similarity=\"chunk.similarity\"\n :max-similarity=\"maxSimilarity\"\n :expanded=\"expandedChunks.has(chunk.chunkId)\" />\n </button>\n\n <!-- Expanded chunk content -->\n <div\n v-if=\"expandedChunks.has(chunk.chunkId)\"\n class=\"bg-surface-1 border-t border-surface-3\">\n <div class=\"p-8 text-10 text-word-3\">\n <transition mode=\"out-in\">\n <!-- Context expansion -->\n <PkStreamingMarkdown\n v-if=\"contextData.has(chunk.chunkId)\"\n :markdown=\"\n contextData.get(chunk.chunkId)!\n \"\n class=\"wysiwyg\" />\n\n <!-- Chunk content -->\n <PkStreamingMarkdown\n v-else\n :markdown=\"chunk.content\"\n class=\"wysiwyg\" />\n </transition>\n </div>\n\n <!-- Actions bar -->\n <div\n class=\"flex items-center gap-8 px-8 py-6 border-t border-surface-3 bg-surface\">\n <!-- Expand / collapse context -->\n <button\n v-if=\"\n onExpandContext &&\n chunk.chunkIndex != null &&\n !contextData.has(chunk.chunkId)\n \"\n class=\"text-10 text-word-3 hover:text-word flex items-center gap-4 cursor-pointer\"\n :disabled=\"\n loadingContext.has(chunk.chunkId)\n \"\n @click=\"handleExpandContext(chunk)\">\n <VvIcon\n :name=\"\n loadingContext.has(chunk.chunkId)\n ? 'loading-loop'\n : 'ri:expand-up-down-line'\n \"\n class=\"text-12\" />\n {{ $t('label.expandContext') }}\n </button>\n <button\n v-else-if=\"contextData.has(chunk.chunkId)\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n @click=\"clearContext(chunk.chunkId)\">\n <VvIcon\n name=\"ri:collapse-vertical-line\"\n class=\"text-12\" />\n {{ $t('label.collapseContext') }}\n </button>\n\n <!-- Open source URL -->\n <a\n v-if=\"chunk.sourceUrl\"\n :href=\"chunk.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 ml-auto\">\n <VvIcon\n name=\"ri:external-link-line\"\n class=\"text-12\" />\n {{ $t('label.openSource') }}\n </a>\n\n <!-- Download file -->\n <button\n v-if=\"\n onDownload &&\n chunk.documentType === 'file'\n \"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n :class=\"{\n 'ml-auto': !chunk.sourceUrl,\n }\"\n @click=\"onDownload(chunk.documentId)\">\n <VvIcon\n name=\"ri:download-line\"\n class=\"text-12\" />\n {{ $t('label.downloadFile') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n\n <!-- Show more -->\n <button\n v-if=\"hasMore\"\n class=\"text-12 text-word-3 cursor-pointer hover:underline flex items-center gap-4 mx-auto\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: groupedSources.length - 3,\n })\n }}\n </button>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive } from 'vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChunkPreview from './PkChunkPreview.vue'\n import PkDocumentHeader from './PkDocumentHeader.vue'\n\n interface SourceItem {\n chunkId: string\n documentId: string\n documentName: string\n documentType: string\n language: string\n content: string\n chunkIndex?: number | null\n similarity?: number\n sourceUrl?: string\n sourceFilename?: string\n sourceDescription?: string\n sourceImageUrl?: string\n }\n\n const props = defineProps<{\n part: unknown\n onExpandContext?: (payload: {\n documentId: string\n chunkIndex: number\n }) => Promise<string>\n onDownload?: (documentId: string) => void\n }>()\n\n const toolPart = computed(() => {\n return props.part as {\n input?: {\n sources: SourceItem[]\n }\n }\n })\n\n const sources = computed(() => toolPart.value.input?.sources || [])\n\n const groupedSources = computed(() => {\n const groups = new Map<\n string,\n { document: SourceItem; chunks: SourceItem[] }\n >()\n for (const source of sources.value) {\n const existing = groups.get(source.documentId)\n if (existing) {\n existing.chunks.push(source)\n } else {\n groups.set(source.documentId, {\n document: source,\n chunks: [source],\n })\n }\n }\n return [...groups.values()]\n })\n\n const maxSimilarity = computed(() => {\n return Math.max(...sources.value.map((s) => s.similarity ?? 0), 0)\n })\n\n const expandedDocuments = reactive(new Set<string>())\n const expandedChunks = reactive(new Set<string>())\n const contextData = reactive(new Map<string, string>())\n const loadingContext = reactive(new Set<string>())\n\n const toggleDocument = (documentId: string) => {\n if (expandedDocuments.has(documentId)) {\n expandedDocuments.delete(documentId)\n } else {\n expandedDocuments.add(documentId)\n }\n }\n\n const toggleChunk = (chunkId: string) => {\n if (expandedChunks.has(chunkId)) {\n expandedChunks.delete(chunkId)\n } else {\n expandedChunks.add(chunkId)\n }\n }\n\n const handleExpandContext = async (source: SourceItem) => {\n if (source.chunkIndex == null || !props.onExpandContext) {\n return\n }\n loadingContext.add(source.chunkId)\n try {\n const content = await props.onExpandContext({\n documentId: source.documentId,\n chunkIndex: source.chunkIndex,\n })\n contextData.set(source.chunkId, content)\n } finally {\n loadingContext.delete(source.chunkId)\n }\n }\n\n const clearContext = (chunkId: string) => {\n contextData.delete(chunkId)\n }\n\n const showMore = ref(false)\n const visibleGroups = computed(() => {\n if (showMore.value) {\n return groupedSources.value\n }\n return groupedSources.value.slice(0, 3)\n })\n const hasMore = computed(() => groupedSources.value.length > 3)\n</script>\n\n<template>\n <div v-if=\"sources.length\" class=\"flex flex-col gap-xs w-full\">\n <div class=\"flex items-center gap-4 text-12 text-word-3 font-semibold\">\n <VvIcon name=\"ri:article-line\" class=\"text-14\" />\n {{ $t('label.sources') }}\n <span class=\"text-word-4 font-normal\">\n ({{ groupedSources.length }})\n </span>\n </div>\n\n <ul class=\"flex flex-col gap-xs\">\n <li\n v-for=\"group in visibleGroups\"\n :key=\"group.document.documentId\"\n class=\"border border-surface-3 rounded-xl overflow-hidden\">\n <!-- Document header: the toggle, and beside it the link to\n the source, because a link inside a button is invalid\n HTML and its click also toggled the row -->\n <div\n class=\"flex items-center hover:bg-surface-1 transition-colors\">\n <button\n type=\"button\"\n class=\"flex items-center gap-8 p-8 flex-1 min-w-0 text-left cursor-pointer\"\n :aria-expanded=\"\n expandedDocuments.has(group.document.documentId)\n \"\n @click=\"toggleDocument(group.document.documentId)\">\n <PkDocumentHeader\n :type=\"group.document.documentType\"\n :name=\"group.document.documentName\"\n :url=\"group.document.sourceUrl\"\n :filename=\"group.document.sourceFilename\"\n muted-url />\n <div class=\"flex items-center gap-4 shrink-0\">\n <span\n v-if=\"group.chunks.length > 1\"\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2\">\n {{ group.chunks.length }}\n </span>\n <span\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2 uppercase\">\n {{ group.document.language }}\n </span>\n <VvIcon\n :name=\"\n expandedDocuments.has(\n group.document.documentId,\n )\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"text-16 text-word-3\" />\n </div>\n </button>\n <VvButton\n v-if=\"group.document.sourceUrl\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:external-link-line\"\n class=\"text-10 shrink-0 mr-8\"\n :href=\"group.document.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :title=\"$t('action.open')\"\n :aria-label=\"$t('action.open')\" />\n </div>\n\n <!-- Expanded content -->\n <div\n v-if=\"expandedDocuments.has(group.document.documentId)\"\n class=\"border-t border-surface-3\">\n <PkStreamingMarkdown\n v-if=\"group.document.sourceDescription\"\n :markdown=\"group.document.sourceDescription\"\n class=\"px-8 py-4 text-10 text-word-3 bg-surface-1 border-b border-surface-3\" />\n\n <!-- Chunk excerpts -->\n <div\n v-for=\"chunk in group.chunks\"\n :key=\"chunk.chunkId\"\n class=\"border-b border-surface-3 last:border-b-0\">\n <button\n class=\"flex items-center gap-8 px-8 py-6 w-full text-left hover:bg-surface-1 transition-colors cursor-pointer\"\n @click=\"toggleChunk(chunk.chunkId)\">\n <PkChunkPreview\n :content=\"chunk.content\"\n :similarity=\"chunk.similarity\"\n :max-similarity=\"maxSimilarity\"\n :expanded=\"expandedChunks.has(chunk.chunkId)\" />\n </button>\n\n <!-- Expanded chunk content -->\n <div\n v-if=\"expandedChunks.has(chunk.chunkId)\"\n class=\"bg-surface-1 border-t border-surface-3\">\n <div class=\"p-8 text-10 text-word-3\">\n <transition mode=\"out-in\">\n <!-- Context expansion -->\n <PkStreamingMarkdown\n v-if=\"contextData.has(chunk.chunkId)\"\n :markdown=\"\n contextData.get(chunk.chunkId)!\n \"\n class=\"wysiwyg\" />\n\n <!-- Chunk content -->\n <PkStreamingMarkdown\n v-else\n :markdown=\"chunk.content\"\n class=\"wysiwyg\" />\n </transition>\n </div>\n\n <!-- Actions bar -->\n <div\n class=\"flex items-center gap-8 px-8 py-6 border-t border-surface-3 bg-surface\">\n <!-- Expand / collapse context -->\n <button\n v-if=\"\n onExpandContext &&\n chunk.chunkIndex != null &&\n !contextData.has(chunk.chunkId)\n \"\n class=\"text-10 text-word-3 hover:text-word flex items-center gap-4 cursor-pointer\"\n :disabled=\"\n loadingContext.has(chunk.chunkId)\n \"\n @click=\"handleExpandContext(chunk)\">\n <VvIcon\n :name=\"\n loadingContext.has(chunk.chunkId)\n ? 'loading-loop'\n : 'ri:expand-up-down-line'\n \"\n class=\"text-12\" />\n {{ $t('label.expandContext') }}\n </button>\n <button\n v-else-if=\"contextData.has(chunk.chunkId)\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n @click=\"clearContext(chunk.chunkId)\">\n <VvIcon\n name=\"ri:collapse-vertical-line\"\n class=\"text-12\" />\n {{ $t('label.collapseContext') }}\n </button>\n\n <!-- Open source URL -->\n <a\n v-if=\"chunk.sourceUrl\"\n :href=\"chunk.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 ml-auto\">\n <VvIcon\n name=\"ri:external-link-line\"\n class=\"text-12\" />\n {{ $t('label.openSource') }}\n </a>\n\n <!-- Download file -->\n <button\n v-if=\"\n onDownload &&\n chunk.documentType === 'file'\n \"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n :class=\"{\n 'ml-auto': !chunk.sourceUrl,\n }\"\n @click=\"onDownload(chunk.documentId)\">\n <VvIcon\n name=\"ri:download-line\"\n class=\"text-12\" />\n {{ $t('label.downloadFile') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n\n <!-- Show more -->\n <button\n v-if=\"hasMore\"\n class=\"text-12 text-word-3 cursor-pointer hover:underline flex items-center gap-4 mx-auto\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: groupedSources.length - 3,\n })\n }}\n </button>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAII,IAAM8E,IAAQC,GAORC,IAAoBzB,QAAe;GACrC,IAAIuB,EAAM,cAAc,MACpB,OAAO;GAEX,IAAMG,IACFH,EAAM,iBAAiBA,EAAM,gBAAgB,IACvCA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EAAA,MAAe,SAAM,E"}
|
|
1
|
+
{"version":3,"file":"PkToolShowSources-DKtdU_Bq.js","names":["_hoisted_1","_hoisted_2","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_createVNode","_createElementVNode","_toDisplayString","_unref","_createCommentVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_createElementVNode","_toDisplayString","_createCommentVNode","PkUrl","_sfc_main","$t","__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_createTextVNode","_toDisplayString","_Fragment","_renderList","PkDocumentHeader","_createCommentVNode","_createBlock","PkStreamingMarkdown","PkChunkPreview","_Transition","_withCtx","_normalizeClass","_sfc_main","normalizeClass","createVNode","init_shared_esm_bundler","renderList","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","reactive","init_reactivity_esm_bundler","init_runtime_dom_esm_bundler","Transition","withCtx","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","PkStreamingMarkdown_default","getTypeIcon","stripMarkdown","Ce","VvButtonLocalized","PkUrl_default","_hoisted_1$2","_hoisted_2$2","PkChunkPreview_default","props","__props","similarityPercent","max","_component_VvIcon","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","PkDocumentHeader_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","PkToolShowSources_default","toolPart","sources","groupedSources","groups","source","existing","maxSimilarity","s","expandedDocuments","expandedChunks","contextData","loadingContext","toggleDocument","documentId","toggleChunk","chunkId","handleExpandContext","content","clearContext","showMore","visibleGroups","hasMore","_component_VvButton","_ctx","group","chunk","_cache"],"sources":["../../../../packages/components/src/chat/PkChunkPreview.vue","../../../../packages/components/src/chat/PkChunkPreview.vue","../../../../packages/components/src/chat/PkDocumentHeader.vue","../../../../packages/components/src/chat/PkDocumentHeader.vue","../../../../packages/components/src/chat/PkToolShowSources.vue","../../../../packages/components/src/chat/PkToolShowSources.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { stripMarkdown } from 'utils'\n\n const props = defineProps<{\n content: string\n similarity?: number\n maxSimilarity?: number\n expanded: boolean\n }>()\n\n const similarityPercent = computed(() => {\n if (props.similarity == null) {\n return null\n }\n const max =\n props.maxSimilarity && props.maxSimilarity > 0\n ? props.maxSimilarity\n : 1\n return Math.round((props.similarity / max) * 100)\n })\n</script>\n\n<template>\n <VvIcon name=\"ri:text-snippet\" class=\"shrink-0 text-12 text-word-4\" />\n <span class=\"text-10 text-word-2 truncate flex-1\" :title=\"content\">\n {{ stripMarkdown(content) }}\n </span>\n <span v-if=\"similarityPercent != null\" class=\"text-10 text-word-4 shrink-0\">\n {{ similarityPercent }}%\n </span>\n <VvIcon\n :name=\"expanded ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-14 text-word-4 shrink-0\" />\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { stripMarkdown } from 'utils'\n\n const props = defineProps<{\n content: string\n similarity?: number\n maxSimilarity?: number\n expanded: boolean\n }>()\n\n const similarityPercent = computed(() => {\n if (props.similarity == null) {\n return null\n }\n const max =\n props.maxSimilarity && props.maxSimilarity > 0\n ? props.maxSimilarity\n : 1\n return Math.round((props.similarity / max) * 100)\n })\n</script>\n\n<template>\n <VvIcon name=\"ri:text-snippet\" class=\"shrink-0 text-12 text-word-4\" />\n <span class=\"text-10 text-word-2 truncate flex-1\" :title=\"content\">\n {{ stripMarkdown(content) }}\n </span>\n <span v-if=\"similarityPercent != null\" class=\"text-10 text-word-4 shrink-0\">\n {{ similarityPercent }}%\n </span>\n <VvIcon\n :name=\"expanded ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-14 text-word-4 shrink-0\" />\n</template>\n","<script setup lang=\"ts\">\n import type { DocumentType } from 'models'\n import { getTypeIcon } from 'models'\n import PkUrl from '../PkUrl.vue'\n\n defineProps<{\n type: string\n name: string\n url?: string\n filename?: string\n /**\n * The address as text, not a link: for a header drawn inside a button,\n * where a link is invalid HTML and its click also toggles the row\n */\n mutedUrl?: boolean\n }>()\n</script>\n\n<template>\n <VvIcon\n :name=\"getTypeIcon(type as DocumentType)\"\n class=\"shrink-0 text-14 text-word-3\" />\n <div class=\"flex flex-col gap-2 min-w-0 flex-1\">\n <strong class=\"font-bold text-12 text-word-1 truncate block\">\n {{ name }}\n </strong>\n <span v-if=\"filename\" class=\"text-10 text-word-4 truncate\">\n {{ filename }}\n </span>\n <span\n v-if=\"url\"\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-10\" />\n <PkUrl :url=\"url\" :muted=\"mutedUrl\" />\n </span>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import type { DocumentType } from 'models'\n import { getTypeIcon } from 'models'\n import PkUrl from '../PkUrl.vue'\n\n defineProps<{\n type: string\n name: string\n url?: string\n filename?: string\n /**\n * The address as text, not a link: for a header drawn inside a button,\n * where a link is invalid HTML and its click also toggles the row\n */\n mutedUrl?: boolean\n }>()\n</script>\n\n<template>\n <VvIcon\n :name=\"getTypeIcon(type as DocumentType)\"\n class=\"shrink-0 text-14 text-word-3\" />\n <div class=\"flex flex-col gap-2 min-w-0 flex-1\">\n <strong class=\"font-bold text-12 text-word-1 truncate block\">\n {{ name }}\n </strong>\n <span v-if=\"filename\" class=\"text-10 text-word-4 truncate\">\n {{ filename }}\n </span>\n <span\n v-if=\"url\"\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-10\" />\n <PkUrl :url=\"url\" :muted=\"mutedUrl\" />\n </span>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive } from 'vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChunkPreview from './PkChunkPreview.vue'\n import PkDocumentHeader from './PkDocumentHeader.vue'\n\n interface SourceItem {\n chunkId: string\n documentId: string\n documentName: string\n documentType: string\n language: string\n content: string\n chunkIndex?: number | null\n similarity?: number\n sourceUrl?: string\n sourceFilename?: string\n sourceDescription?: string\n sourceImageUrl?: string\n }\n\n const props = defineProps<{\n part: unknown\n onExpandContext?: (payload: {\n documentId: string\n chunkIndex: number\n }) => Promise<string>\n onDownload?: (documentId: string) => void\n }>()\n\n const toolPart = computed(() => {\n return props.part as {\n input?: {\n sources: SourceItem[]\n }\n }\n })\n\n const sources = computed(() => toolPart.value.input?.sources || [])\n\n const groupedSources = computed(() => {\n const groups = new Map<\n string,\n { document: SourceItem; chunks: SourceItem[] }\n >()\n for (const source of sources.value) {\n const existing = groups.get(source.documentId)\n if (existing) {\n existing.chunks.push(source)\n } else {\n groups.set(source.documentId, {\n document: source,\n chunks: [source],\n })\n }\n }\n return [...groups.values()]\n })\n\n const maxSimilarity = computed(() => {\n return Math.max(...sources.value.map((s) => s.similarity ?? 0), 0)\n })\n\n const expandedDocuments = reactive(new Set<string>())\n const expandedChunks = reactive(new Set<string>())\n const contextData = reactive(new Map<string, string>())\n const loadingContext = reactive(new Set<string>())\n\n const toggleDocument = (documentId: string) => {\n if (expandedDocuments.has(documentId)) {\n expandedDocuments.delete(documentId)\n } else {\n expandedDocuments.add(documentId)\n }\n }\n\n const toggleChunk = (chunkId: string) => {\n if (expandedChunks.has(chunkId)) {\n expandedChunks.delete(chunkId)\n } else {\n expandedChunks.add(chunkId)\n }\n }\n\n const handleExpandContext = async (source: SourceItem) => {\n if (source.chunkIndex == null || !props.onExpandContext) {\n return\n }\n loadingContext.add(source.chunkId)\n try {\n const content = await props.onExpandContext({\n documentId: source.documentId,\n chunkIndex: source.chunkIndex,\n })\n contextData.set(source.chunkId, content)\n } finally {\n loadingContext.delete(source.chunkId)\n }\n }\n\n const clearContext = (chunkId: string) => {\n contextData.delete(chunkId)\n }\n\n const showMore = ref(false)\n const visibleGroups = computed(() => {\n if (showMore.value) {\n return groupedSources.value\n }\n return groupedSources.value.slice(0, 3)\n })\n const hasMore = computed(() => groupedSources.value.length > 3)\n</script>\n\n<template>\n <div v-if=\"sources.length\" class=\"flex flex-col gap-xs w-full\">\n <div class=\"flex items-center gap-4 text-12 text-word-3 font-semibold\">\n <VvIcon name=\"ri:article-line\" class=\"text-14\" />\n {{ $t('label.sources') }}\n <span class=\"text-word-4 font-normal\">\n ({{ groupedSources.length }})\n </span>\n </div>\n\n <ul class=\"flex flex-col gap-xs\">\n <li\n v-for=\"group in visibleGroups\"\n :key=\"group.document.documentId\"\n class=\"border border-surface-3 rounded-xl overflow-hidden\">\n <!-- Document header: the toggle, and beside it the link to\n the source, because a link inside a button is invalid\n HTML and its click also toggled the row -->\n <div\n class=\"flex items-center hover:bg-surface-1 transition-colors\">\n <button\n type=\"button\"\n class=\"flex items-center gap-8 p-8 flex-1 min-w-0 text-left cursor-pointer\"\n :aria-expanded=\"\n expandedDocuments.has(group.document.documentId)\n \"\n @click=\"toggleDocument(group.document.documentId)\">\n <PkDocumentHeader\n :type=\"group.document.documentType\"\n :name=\"group.document.documentName\"\n :url=\"group.document.sourceUrl\"\n :filename=\"group.document.sourceFilename\"\n muted-url />\n <div class=\"flex items-center gap-4 shrink-0\">\n <span\n v-if=\"group.chunks.length > 1\"\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2\">\n {{ group.chunks.length }}\n </span>\n <span\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2 uppercase\">\n {{ group.document.language }}\n </span>\n <VvIcon\n :name=\"\n expandedDocuments.has(\n group.document.documentId,\n )\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"text-16 text-word-3\" />\n </div>\n </button>\n <VvButton\n v-if=\"group.document.sourceUrl\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:external-link-line\"\n class=\"text-10 shrink-0 mr-8\"\n :href=\"group.document.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :title=\"$t('action.open')\"\n :aria-label=\"$t('action.open')\" />\n </div>\n\n <!-- Expanded content -->\n <div\n v-if=\"expandedDocuments.has(group.document.documentId)\"\n class=\"border-t border-surface-3\">\n <PkStreamingMarkdown\n v-if=\"group.document.sourceDescription\"\n :markdown=\"group.document.sourceDescription\"\n class=\"px-8 py-4 text-10 text-word-3 bg-surface-1 border-b border-surface-3\" />\n\n <!-- Chunk excerpts -->\n <div\n v-for=\"chunk in group.chunks\"\n :key=\"chunk.chunkId\"\n class=\"border-b border-surface-3 last:border-b-0\">\n <button\n class=\"flex items-center gap-8 px-8 py-6 w-full text-left hover:bg-surface-1 transition-colors cursor-pointer\"\n @click=\"toggleChunk(chunk.chunkId)\">\n <PkChunkPreview\n :content=\"chunk.content\"\n :similarity=\"chunk.similarity\"\n :max-similarity=\"maxSimilarity\"\n :expanded=\"expandedChunks.has(chunk.chunkId)\" />\n </button>\n\n <!-- Expanded chunk content -->\n <div\n v-if=\"expandedChunks.has(chunk.chunkId)\"\n class=\"bg-surface-1 border-t border-surface-3\">\n <div class=\"p-8 text-10 text-word-3\">\n <transition mode=\"out-in\">\n <!-- Context expansion -->\n <PkStreamingMarkdown\n v-if=\"contextData.has(chunk.chunkId)\"\n :markdown=\"\n contextData.get(chunk.chunkId)!\n \"\n class=\"wysiwyg\" />\n\n <!-- Chunk content -->\n <PkStreamingMarkdown\n v-else\n :markdown=\"chunk.content\"\n class=\"wysiwyg\" />\n </transition>\n </div>\n\n <!-- Actions bar -->\n <div\n class=\"flex items-center gap-8 px-8 py-6 border-t border-surface-3 bg-surface\">\n <!-- Expand / collapse context -->\n <button\n v-if=\"\n onExpandContext &&\n chunk.chunkIndex != null &&\n !contextData.has(chunk.chunkId)\n \"\n class=\"text-10 text-word-3 hover:text-word flex items-center gap-4 cursor-pointer\"\n :disabled=\"\n loadingContext.has(chunk.chunkId)\n \"\n @click=\"handleExpandContext(chunk)\">\n <VvIcon\n :name=\"\n loadingContext.has(chunk.chunkId)\n ? 'loading-loop'\n : 'ri:expand-up-down-line'\n \"\n class=\"text-12\" />\n {{ $t('label.expandContext') }}\n </button>\n <button\n v-else-if=\"contextData.has(chunk.chunkId)\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n @click=\"clearContext(chunk.chunkId)\">\n <VvIcon\n name=\"ri:collapse-vertical-line\"\n class=\"text-12\" />\n {{ $t('label.collapseContext') }}\n </button>\n\n <!-- Open source URL -->\n <a\n v-if=\"chunk.sourceUrl\"\n :href=\"chunk.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 ml-auto\">\n <VvIcon\n name=\"ri:external-link-line\"\n class=\"text-12\" />\n {{ $t('label.openSource') }}\n </a>\n\n <!-- Download file -->\n <button\n v-if=\"\n onDownload &&\n chunk.documentType === 'file'\n \"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n :class=\"{\n 'ml-auto': !chunk.sourceUrl,\n }\"\n @click=\"onDownload(chunk.documentId)\">\n <VvIcon\n name=\"ri:download-line\"\n class=\"text-12\" />\n {{ $t('label.downloadFile') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n\n <!-- Show more -->\n <button\n v-if=\"hasMore\"\n class=\"text-12 text-word-3 cursor-pointer hover:underline flex items-center gap-4 mx-auto\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: groupedSources.length - 3,\n })\n }}\n </button>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, reactive } from 'vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import PkChunkPreview from './PkChunkPreview.vue'\n import PkDocumentHeader from './PkDocumentHeader.vue'\n\n interface SourceItem {\n chunkId: string\n documentId: string\n documentName: string\n documentType: string\n language: string\n content: string\n chunkIndex?: number | null\n similarity?: number\n sourceUrl?: string\n sourceFilename?: string\n sourceDescription?: string\n sourceImageUrl?: string\n }\n\n const props = defineProps<{\n part: unknown\n onExpandContext?: (payload: {\n documentId: string\n chunkIndex: number\n }) => Promise<string>\n onDownload?: (documentId: string) => void\n }>()\n\n const toolPart = computed(() => {\n return props.part as {\n input?: {\n sources: SourceItem[]\n }\n }\n })\n\n const sources = computed(() => toolPart.value.input?.sources || [])\n\n const groupedSources = computed(() => {\n const groups = new Map<\n string,\n { document: SourceItem; chunks: SourceItem[] }\n >()\n for (const source of sources.value) {\n const existing = groups.get(source.documentId)\n if (existing) {\n existing.chunks.push(source)\n } else {\n groups.set(source.documentId, {\n document: source,\n chunks: [source],\n })\n }\n }\n return [...groups.values()]\n })\n\n const maxSimilarity = computed(() => {\n return Math.max(...sources.value.map((s) => s.similarity ?? 0), 0)\n })\n\n const expandedDocuments = reactive(new Set<string>())\n const expandedChunks = reactive(new Set<string>())\n const contextData = reactive(new Map<string, string>())\n const loadingContext = reactive(new Set<string>())\n\n const toggleDocument = (documentId: string) => {\n if (expandedDocuments.has(documentId)) {\n expandedDocuments.delete(documentId)\n } else {\n expandedDocuments.add(documentId)\n }\n }\n\n const toggleChunk = (chunkId: string) => {\n if (expandedChunks.has(chunkId)) {\n expandedChunks.delete(chunkId)\n } else {\n expandedChunks.add(chunkId)\n }\n }\n\n const handleExpandContext = async (source: SourceItem) => {\n if (source.chunkIndex == null || !props.onExpandContext) {\n return\n }\n loadingContext.add(source.chunkId)\n try {\n const content = await props.onExpandContext({\n documentId: source.documentId,\n chunkIndex: source.chunkIndex,\n })\n contextData.set(source.chunkId, content)\n } finally {\n loadingContext.delete(source.chunkId)\n }\n }\n\n const clearContext = (chunkId: string) => {\n contextData.delete(chunkId)\n }\n\n const showMore = ref(false)\n const visibleGroups = computed(() => {\n if (showMore.value) {\n return groupedSources.value\n }\n return groupedSources.value.slice(0, 3)\n })\n const hasMore = computed(() => groupedSources.value.length > 3)\n</script>\n\n<template>\n <div v-if=\"sources.length\" class=\"flex flex-col gap-xs w-full\">\n <div class=\"flex items-center gap-4 text-12 text-word-3 font-semibold\">\n <VvIcon name=\"ri:article-line\" class=\"text-14\" />\n {{ $t('label.sources') }}\n <span class=\"text-word-4 font-normal\">\n ({{ groupedSources.length }})\n </span>\n </div>\n\n <ul class=\"flex flex-col gap-xs\">\n <li\n v-for=\"group in visibleGroups\"\n :key=\"group.document.documentId\"\n class=\"border border-surface-3 rounded-xl overflow-hidden\">\n <!-- Document header: the toggle, and beside it the link to\n the source, because a link inside a button is invalid\n HTML and its click also toggled the row -->\n <div\n class=\"flex items-center hover:bg-surface-1 transition-colors\">\n <button\n type=\"button\"\n class=\"flex items-center gap-8 p-8 flex-1 min-w-0 text-left cursor-pointer\"\n :aria-expanded=\"\n expandedDocuments.has(group.document.documentId)\n \"\n @click=\"toggleDocument(group.document.documentId)\">\n <PkDocumentHeader\n :type=\"group.document.documentType\"\n :name=\"group.document.documentName\"\n :url=\"group.document.sourceUrl\"\n :filename=\"group.document.sourceFilename\"\n muted-url />\n <div class=\"flex items-center gap-4 shrink-0\">\n <span\n v-if=\"group.chunks.length > 1\"\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2\">\n {{ group.chunks.length }}\n </span>\n <span\n class=\"text-10 text-word-4 bg-surface-2 rounded px-4 py-2 uppercase\">\n {{ group.document.language }}\n </span>\n <VvIcon\n :name=\"\n expandedDocuments.has(\n group.document.documentId,\n )\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"text-16 text-word-3\" />\n </div>\n </button>\n <VvButton\n v-if=\"group.document.sourceUrl\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:external-link-line\"\n class=\"text-10 shrink-0 mr-8\"\n :href=\"group.document.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :title=\"$t('action.open')\"\n :aria-label=\"$t('action.open')\" />\n </div>\n\n <!-- Expanded content -->\n <div\n v-if=\"expandedDocuments.has(group.document.documentId)\"\n class=\"border-t border-surface-3\">\n <PkStreamingMarkdown\n v-if=\"group.document.sourceDescription\"\n :markdown=\"group.document.sourceDescription\"\n class=\"px-8 py-4 text-10 text-word-3 bg-surface-1 border-b border-surface-3\" />\n\n <!-- Chunk excerpts -->\n <div\n v-for=\"chunk in group.chunks\"\n :key=\"chunk.chunkId\"\n class=\"border-b border-surface-3 last:border-b-0\">\n <button\n class=\"flex items-center gap-8 px-8 py-6 w-full text-left hover:bg-surface-1 transition-colors cursor-pointer\"\n @click=\"toggleChunk(chunk.chunkId)\">\n <PkChunkPreview\n :content=\"chunk.content\"\n :similarity=\"chunk.similarity\"\n :max-similarity=\"maxSimilarity\"\n :expanded=\"expandedChunks.has(chunk.chunkId)\" />\n </button>\n\n <!-- Expanded chunk content -->\n <div\n v-if=\"expandedChunks.has(chunk.chunkId)\"\n class=\"bg-surface-1 border-t border-surface-3\">\n <div class=\"p-8 text-10 text-word-3\">\n <transition mode=\"out-in\">\n <!-- Context expansion -->\n <PkStreamingMarkdown\n v-if=\"contextData.has(chunk.chunkId)\"\n :markdown=\"\n contextData.get(chunk.chunkId)!\n \"\n class=\"wysiwyg\" />\n\n <!-- Chunk content -->\n <PkStreamingMarkdown\n v-else\n :markdown=\"chunk.content\"\n class=\"wysiwyg\" />\n </transition>\n </div>\n\n <!-- Actions bar -->\n <div\n class=\"flex items-center gap-8 px-8 py-6 border-t border-surface-3 bg-surface\">\n <!-- Expand / collapse context -->\n <button\n v-if=\"\n onExpandContext &&\n chunk.chunkIndex != null &&\n !contextData.has(chunk.chunkId)\n \"\n class=\"text-10 text-word-3 hover:text-word flex items-center gap-4 cursor-pointer\"\n :disabled=\"\n loadingContext.has(chunk.chunkId)\n \"\n @click=\"handleExpandContext(chunk)\">\n <VvIcon\n :name=\"\n loadingContext.has(chunk.chunkId)\n ? 'loading-loop'\n : 'ri:expand-up-down-line'\n \"\n class=\"text-12\" />\n {{ $t('label.expandContext') }}\n </button>\n <button\n v-else-if=\"contextData.has(chunk.chunkId)\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n @click=\"clearContext(chunk.chunkId)\">\n <VvIcon\n name=\"ri:collapse-vertical-line\"\n class=\"text-12\" />\n {{ $t('label.collapseContext') }}\n </button>\n\n <!-- Open source URL -->\n <a\n v-if=\"chunk.sourceUrl\"\n :href=\"chunk.sourceUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 ml-auto\">\n <VvIcon\n name=\"ri:external-link-line\"\n class=\"text-12\" />\n {{ $t('label.openSource') }}\n </a>\n\n <!-- Download file -->\n <button\n v-if=\"\n onDownload &&\n chunk.documentType === 'file'\n \"\n class=\"text-10 text-word-3 hover:text-word-1 flex items-center gap-4 cursor-pointer\"\n :class=\"{\n 'ml-auto': !chunk.sourceUrl,\n }\"\n @click=\"onDownload(chunk.documentId)\">\n <VvIcon\n name=\"ri:download-line\"\n class=\"text-12\" />\n {{ $t('label.downloadFile') }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n\n <!-- Show more -->\n <button\n v-if=\"hasMore\"\n class=\"text-12 text-word-3 cursor-pointer hover:underline flex items-center gap-4 mx-auto\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: groupedSources.length - 3,\n })\n }}\n </button>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAII,IAAM8E,IAAQC,GAORC,IAAoBzB,QAAe;G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tBC,EACI2F,EAAA,QAA+BnG,EAAAA,GAAE,iBAAA,IAA0CA,EAAAA,GAAE,mBAAA,EAAuD,OAAAkF,EAAA,MAAe,SAAM,E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./vue.runtime.esm-bundler-C2U5uTqB.js";
|
|
1
2
|
import { I as e, _ as t, d as n, p as r, t as i, y as a } from "./Agent-CsSvagZw.js";
|
|
2
3
|
import "./src-JJyCGvqH.js";
|
|
3
4
|
import { n as o, t as s } from "./text-5F7L8EHi.js";
|
|
@@ -51,13 +52,13 @@ function h(e) {
|
|
|
51
52
|
function ee(e) {
|
|
52
53
|
return e ? e.parts.some((e) => c(e)) : !1;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function te(e) {
|
|
55
56
|
if (!e) return;
|
|
56
57
|
let t = e.parts;
|
|
57
58
|
if (Array.isArray(t)) return t.find((e) => c(e))?.text;
|
|
58
59
|
}
|
|
59
60
|
// ../../packages/components/src/chat/utils.ts
|
|
60
|
-
function
|
|
61
|
+
function g(e) {
|
|
61
62
|
let t = [];
|
|
62
63
|
for (let n of e) {
|
|
63
64
|
if (!c(n)) {
|
|
@@ -72,11 +73,11 @@ function _(e) {
|
|
|
72
73
|
}
|
|
73
74
|
return t;
|
|
74
75
|
}
|
|
75
|
-
var
|
|
76
|
-
function
|
|
76
|
+
var _ = (e) => l(e) && a(u(e));
|
|
77
|
+
function v(e) {
|
|
77
78
|
let t = /* @__PURE__ */ new Map();
|
|
78
|
-
for (let [n, r] of e.entries())
|
|
79
|
-
return e.filter((e, n) => !(
|
|
79
|
+
for (let [n, r] of e.entries()) _(r) && r.state !== "output-error" && !w(r) && t.set(r.type, n);
|
|
80
|
+
return e.filter((e, n) => !(_(e) && e.state === "output-error" && (t.get(e.type) ?? -1) > n));
|
|
80
81
|
}
|
|
81
82
|
var y = /* @__PURE__ */ new Set([
|
|
82
83
|
"tool-editSpreadsheet",
|
|
@@ -141,21 +142,21 @@ var re = {
|
|
|
141
142
|
icon: "ri:links-line",
|
|
142
143
|
label: "messagePart.pageTool.navigate"
|
|
143
144
|
}
|
|
144
|
-
},
|
|
145
|
+
}, ie = Symbol("hostStepTitles"), ae = {
|
|
145
146
|
icon: "ri:survey-line",
|
|
146
147
|
label: "messagePart.pageTool.form"
|
|
147
|
-
},
|
|
148
|
-
function
|
|
148
|
+
}, S = (e) => e.toolMetadata?.provider === "page" ? re[e.toolName] ?? (e.toolName.startsWith("form_") ? ae : void 0) : void 0;
|
|
149
|
+
function C(e) {
|
|
149
150
|
return x(e)?.toolMetadata?.readOnly === !1;
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function w(e) {
|
|
152
153
|
return e && "state" in e ? e.state === "streaming" || e.state === "input-streaming" : !1;
|
|
153
154
|
}
|
|
154
|
-
var
|
|
155
|
-
function
|
|
155
|
+
var T = 4e3, E = /^[ \t]*(?:(?:[-*+]|\d{1,9}[.)])[ \t]+|>[ \t]?)*(`{3,}|~{3,})(.*)$/gm;
|
|
156
|
+
function D(e, t) {
|
|
156
157
|
if (e.length <= t) return e;
|
|
157
158
|
let n = e.length - t, r = n + t / 2, i = (e, t) => e !== -1 && e < r ? e + t : void 0, a = i(e.indexOf("\n\n", n), 2) ?? i(e.indexOf("\n", n), 1) ?? n, o;
|
|
158
|
-
for (let t of e.matchAll(
|
|
159
|
+
for (let t of e.matchAll(E)) {
|
|
159
160
|
if (t.index >= a) break;
|
|
160
161
|
let [, e, n] = t;
|
|
161
162
|
if (o) e[0] === o[0] && e.length >= o.length && !n.trim() && (o = void 0);
|
|
@@ -166,34 +167,34 @@ function k(e, t) {
|
|
|
166
167
|
}
|
|
167
168
|
return `…\n\n${o ? `${o}\n` : ""}${e.slice(a)}`;
|
|
168
169
|
}
|
|
169
|
-
var
|
|
170
|
+
var O = /* @__PURE__ */ new Set([
|
|
170
171
|
"approval-requested",
|
|
171
172
|
"approval-responded",
|
|
172
173
|
"output-denied"
|
|
173
174
|
]);
|
|
174
|
-
function
|
|
175
|
-
return l(e) ?
|
|
175
|
+
function k(e) {
|
|
176
|
+
return l(e) ? O.has(e.state) ? !0 : e.approval != null : !1;
|
|
176
177
|
}
|
|
177
|
-
var
|
|
178
|
-
function
|
|
178
|
+
var A = "requestConfirm";
|
|
179
|
+
function j(e) {
|
|
179
180
|
return l(e) && e.type === "tool-requestConfirm";
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
-
return
|
|
182
|
+
function M(e) {
|
|
183
|
+
return k(e) || j(e);
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
+
function N(e) {
|
|
185
186
|
if (l(e)) return e.approval?.id;
|
|
186
187
|
}
|
|
187
|
-
function
|
|
188
|
+
function P(e) {
|
|
188
189
|
if (e && "state" in e) return e.state;
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
+
function F(e = "000000") {
|
|
191
192
|
let t = e.replace("#", "");
|
|
192
193
|
t.length === 3 && (t = t.split("").map((e) => e + e).join(""));
|
|
193
194
|
let n = parseInt(t.substring(0, 2), 16) / 255, r = parseInt(t.substring(2, 4), 16) / 255, i = parseInt(t.substring(4, 6), 16) / 255, a = (e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
194
195
|
return .2126 * a(n) + .7152 * a(r) + .0722 * a(i) > .179 ? "black" : "white";
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function I(e) {
|
|
197
198
|
let t = e?.trim().replace("#", "") ?? "";
|
|
198
199
|
if (/^[0-9a-f]{3}$/i.test(t) && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-f]{6}$/i.test(t)) return !1;
|
|
199
200
|
let n = [
|
|
@@ -203,10 +204,10 @@ function R(e) {
|
|
|
203
204
|
].map((e) => parseInt(t.substring(e, e + 2), 16));
|
|
204
205
|
return Math.max(...n) - Math.min(...n) < 32;
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
-
return e === "white" || e === "black" ? e :
|
|
207
|
+
function L(e, t) {
|
|
208
|
+
return e === "white" || e === "black" ? e : F(t);
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
+
function R(e, t) {
|
|
210
211
|
if (e) return {
|
|
211
212
|
"--chatbot-main-color": e,
|
|
212
213
|
"--chatbot-contrast-color": t,
|
|
@@ -215,10 +216,10 @@ function B(e, t) {
|
|
|
215
216
|
"--input-focus-color": "var(--color-brand-graphic)"
|
|
216
217
|
};
|
|
217
218
|
}
|
|
218
|
-
function
|
|
219
|
+
function z(e, t) {
|
|
219
220
|
if (!(t === void 0 || t < 50)) return e(t / 1e3, "seconds");
|
|
220
221
|
}
|
|
221
|
-
function
|
|
222
|
+
function B(e) {
|
|
222
223
|
if (e !== void 0) {
|
|
223
224
|
if (typeof e == "string") return e.trim() || void 0;
|
|
224
225
|
try {
|
|
@@ -229,10 +230,10 @@ function H(e) {
|
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
|
-
function
|
|
233
|
-
return
|
|
233
|
+
function V(e) {
|
|
234
|
+
return B(e) !== void 0;
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function H(e, t) {
|
|
236
237
|
let n = e?.input;
|
|
237
238
|
if (typeof t == "string") {
|
|
238
239
|
let e = n?.question ?? n?.steps?.[0]?.question;
|
|
@@ -244,14 +245,14 @@ function W(e, t) {
|
|
|
244
245
|
return i ? `${i} ${n}` : n;
|
|
245
246
|
}).join(". ");
|
|
246
247
|
}
|
|
247
|
-
function
|
|
248
|
+
function U(e) {
|
|
248
249
|
return e?.options ? e.options.map((e) => ({
|
|
249
250
|
label: e.label,
|
|
250
251
|
value: e.label,
|
|
251
252
|
description: e.description
|
|
252
253
|
})) : [];
|
|
253
254
|
}
|
|
254
|
-
function
|
|
255
|
+
function W(e, t) {
|
|
255
256
|
let n = {};
|
|
256
257
|
if (t == null) return n;
|
|
257
258
|
if (typeof t == "string") return e.length === 1 && (n[0] = t), n;
|
|
@@ -267,7 +268,7 @@ function K(e, t) {
|
|
|
267
268
|
for (let [e, n] of Object.entries(t)) n !== void 0 && r(e, n);
|
|
268
269
|
return n;
|
|
269
270
|
}
|
|
270
|
-
var
|
|
271
|
+
var G = t.map((e) => `tool-${e}`), K = /* @__PURE__ */ new Set([
|
|
271
272
|
"tool-searchInKnowledgeBase",
|
|
272
273
|
"tool-retrieveRevisedAnswers",
|
|
273
274
|
"tool-expandChunkContext",
|
|
@@ -276,63 +277,63 @@ var q = t.map((e) => `tool-${e}`), J = /* @__PURE__ */ new Set([
|
|
|
276
277
|
"tool-geocode",
|
|
277
278
|
"tool-recallUserMemory",
|
|
278
279
|
"tool-saveUserMemory",
|
|
279
|
-
...
|
|
280
|
+
...G
|
|
280
281
|
]);
|
|
281
|
-
function
|
|
282
|
-
return l(e) &&
|
|
282
|
+
function oe(e) {
|
|
283
|
+
return l(e) && K.has(e.type);
|
|
283
284
|
}
|
|
284
|
-
var
|
|
285
|
+
var q = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, J = (e, ...t) => {
|
|
285
286
|
for (let n of t) {
|
|
286
287
|
let t = e?.[n];
|
|
287
288
|
if (typeof t == "string" && t.trim()) return t;
|
|
288
289
|
}
|
|
289
290
|
};
|
|
290
|
-
function
|
|
291
|
+
function se(e) {
|
|
291
292
|
if (!l(e)) return;
|
|
292
|
-
let t =
|
|
293
|
-
if (e.type === "tool-searchInKnowledgeBase" ||
|
|
293
|
+
let t = q("input" in e ? e.input : void 0), n = q("output" in e ? e.output : void 0);
|
|
294
|
+
if (e.type === "tool-searchInKnowledgeBase" || G.includes(e.type)) {
|
|
294
295
|
let e = t?.queries;
|
|
295
296
|
if (Array.isArray(e)) {
|
|
296
297
|
let t = e.filter((e) => typeof e == "string" && !!e.trim());
|
|
297
298
|
return t.length ? t.join(" · ") : void 0;
|
|
298
299
|
}
|
|
299
|
-
return
|
|
300
|
+
return J(t, "query", "objective");
|
|
300
301
|
}
|
|
301
|
-
if (e.type === "tool-retrieveRevisedAnswers") return
|
|
302
|
-
if (e.type === "tool-getWeather") return
|
|
303
|
-
if (e.type === "tool-geocode") return
|
|
304
|
-
if (e.type === "tool-expandChunkContext") return
|
|
305
|
-
if (e.type === "tool-readDocumentFile" || e.type === "tool-readChatAttachment" || e.type === "tool-sendChatFile" || e.type === "tool-shareDocument") return
|
|
302
|
+
if (e.type === "tool-retrieveRevisedAnswers") return J(t, "query");
|
|
303
|
+
if (e.type === "tool-getWeather") return J(n, "location") ?? J(t, "locationName");
|
|
304
|
+
if (e.type === "tool-geocode") return J(t, "locationName");
|
|
305
|
+
if (e.type === "tool-expandChunkContext") return J(n, "documentName");
|
|
306
|
+
if (e.type === "tool-readDocumentFile" || e.type === "tool-readChatAttachment" || e.type === "tool-sendChatFile" || e.type === "tool-shareDocument") return J(n, "name");
|
|
306
307
|
if (e.type === "tool-readSpreadsheet") {
|
|
307
|
-
let e =
|
|
308
|
+
let e = J(t, "sheet"), n = J(t, "range");
|
|
308
309
|
return e && n ? `${e}!${n}` : e;
|
|
309
310
|
}
|
|
310
|
-
if (e.type === "tool-editSpreadsheet") return
|
|
311
|
-
if (e.type === "tool-readWordDocument") return
|
|
312
|
-
if (e.type === "tool-editWordDocument") return
|
|
313
|
-
if (e.type === "tool-createSpreadsheet" || e.type === "tool-createWordDocument") return
|
|
314
|
-
if (e.type === "tool-querySpreadsheet") return
|
|
315
|
-
if (e.type === "tool-recallUserMemory") return
|
|
316
|
-
if (e.type === "tool-saveUserMemory") return
|
|
317
|
-
}
|
|
318
|
-
function
|
|
311
|
+
if (e.type === "tool-editSpreadsheet") return J(n, "filename");
|
|
312
|
+
if (e.type === "tool-readWordDocument") return J(t, "search") ?? J(t, "from");
|
|
313
|
+
if (e.type === "tool-editWordDocument") return J(n, "filename");
|
|
314
|
+
if (e.type === "tool-createSpreadsheet" || e.type === "tool-createWordDocument") return J(n, "filename") ?? J(t, "filename");
|
|
315
|
+
if (e.type === "tool-querySpreadsheet") return J(n, "file");
|
|
316
|
+
if (e.type === "tool-recallUserMemory") return J(t, "query");
|
|
317
|
+
if (e.type === "tool-saveUserMemory") return J(t, "content", "query");
|
|
318
|
+
}
|
|
319
|
+
function ce(e) {
|
|
319
320
|
let t = x(e);
|
|
320
|
-
if (t) return
|
|
321
|
-
if (l(e)) return e.type.includes("tool-subagent") ? "ri:robot-2-line" : e.type === "tool-runWorker" ? "ri:flow-chart" : e.type === "tool-scheduleWakeup" ? "ri:alarm-line" : e.type === "tool-fetchTeamsChannelHistory" ? "ri:chat-history-line" : e.type === "tool-readEarlierMessages" ? "ri:history-line" : e.type === "tool-readChatAttachment" ? "ri:attachment-line" : e.type === "tool-sendChatFile" ? "ri:send-plane-line" : e.type === "tool-enableTools" ? "ri:toggle-line" : e.type.includes("tool-mcp") ? "mcp" : e.type === "tool-retrieveRevisedAnswers" ? "ri:file-edit-line" : e.type === "tool-searchInKnowledgeBase" ? "ri:search-line" : e.type === "tool-expandChunkContext" ? "ri:file-search-line" : e.type === "tool-readDocumentFile" ? "ri:file-text-line" : e.type === "tool-readSpreadsheet" ? "ri:table-line" : e.type === "tool-editSpreadsheet" || e.type === "tool-createSpreadsheet" ? "ri:file-excel-2-line" : e.type === "tool-shareDocument" ? "ri:file-download-line" : e.type === "tool-readWordDocument" ? "ri:file-text-line" : e.type === "tool-editWordDocument" || e.type === "tool-createWordDocument" ? "ri:file-word-2-line" : e.type === "tool-querySpreadsheet" ? "ri:database-2-line" : e.type === "tool-geocode" ? "ri:map-2-line" : e.type === "tool-getWeather" ? "ri:sun-cloudy-line" : e.type === "tool-recallUserMemory" ? "ri:brain-line" : e.type === "tool-saveUserMemory" ? "ri:save-3-line" : e.type === "tool-showWeather" ? "ri:sun-line" : e.type === "tool-showDiagram" ? "ri:flow-chart" : e.type === "tool-showSources" ? "ri:book-2-line" : e.type === "tool-showForm" ? "ri:survey-line" : e.type === "tool-showMultipleChoice" ? "ri:checkbox-multiple-line" : e.type === "tool-showArtifact" ? "ri:file-code-line" : e.type === "tool-showEmail" ? "ri:mail-line" : e.type === "tool-showMessage" ? "ri:chat-1-line" : e.type === "tool-showWebPages" ? "ri:pages-line" : e.type === "tool-showProductList" ? "ri:shopping-bag-line" : e.type === "tool-showContactForm" ? "ri:send-plane-2-line" : e.type === "tool-showCalendarEvent" ? "ri:calendar-event-line" : e.type === "tool-showComparison" ? "ri:scales-line" : e.type === "tool-showLocation" ? "ri:map-pin-line" : e.type === "tool-showQrCode" ? "ri:qr-code-line" : e.type === "tool-showImageGallery" ? "ri:image-line" : e.type === "tool-showVideo" ? "ri:film-line" : e.type === "tool-showSuggestedReply" ? "ri:corner-down-right-line" : e.type === "tool-requestGeolocation" ? "ri:map-pin-user-line" : e.type === "tool-disconnectOAuthConnection" ? "ri:link-unlink" : e.type === "tool-requestAccountLink" ? "ri:link" : e.type === "tool-unlinkAccount" ? "ri:link-unlink" :
|
|
321
|
+
if (t) return S(t)?.icon ?? "ri:apps-line";
|
|
322
|
+
if (l(e)) return e.type.includes("tool-subagent") ? "ri:robot-2-line" : e.type === "tool-runWorker" ? "ri:flow-chart" : e.type === "tool-scheduleWakeup" ? "ri:alarm-line" : e.type === "tool-fetchTeamsChannelHistory" ? "ri:chat-history-line" : e.type === "tool-readEarlierMessages" ? "ri:history-line" : e.type === "tool-readChatAttachment" ? "ri:attachment-line" : e.type === "tool-sendChatFile" ? "ri:send-plane-line" : e.type === "tool-enableTools" ? "ri:toggle-line" : e.type.includes("tool-mcp") ? "mcp" : e.type === "tool-retrieveRevisedAnswers" ? "ri:file-edit-line" : e.type === "tool-searchInKnowledgeBase" ? "ri:search-line" : e.type === "tool-expandChunkContext" ? "ri:file-search-line" : e.type === "tool-readDocumentFile" ? "ri:file-text-line" : e.type === "tool-readSpreadsheet" ? "ri:table-line" : e.type === "tool-editSpreadsheet" || e.type === "tool-createSpreadsheet" ? "ri:file-excel-2-line" : e.type === "tool-shareDocument" ? "ri:file-download-line" : e.type === "tool-readWordDocument" ? "ri:file-text-line" : e.type === "tool-editWordDocument" || e.type === "tool-createWordDocument" ? "ri:file-word-2-line" : e.type === "tool-querySpreadsheet" ? "ri:database-2-line" : e.type === "tool-geocode" ? "ri:map-2-line" : e.type === "tool-getWeather" ? "ri:sun-cloudy-line" : e.type === "tool-recallUserMemory" ? "ri:brain-line" : e.type === "tool-saveUserMemory" ? "ri:save-3-line" : e.type === "tool-showWeather" ? "ri:sun-line" : e.type === "tool-showDiagram" ? "ri:flow-chart" : e.type === "tool-showSources" ? "ri:book-2-line" : e.type === "tool-showForm" ? "ri:survey-line" : e.type === "tool-showMultipleChoice" ? "ri:checkbox-multiple-line" : e.type === "tool-showArtifact" ? "ri:file-code-line" : e.type === "tool-showEmail" ? "ri:mail-line" : e.type === "tool-showMessage" ? "ri:chat-1-line" : e.type === "tool-showWebPages" ? "ri:pages-line" : e.type === "tool-showProductList" ? "ri:shopping-bag-line" : e.type === "tool-showContactForm" ? "ri:send-plane-2-line" : e.type === "tool-showCalendarEvent" ? "ri:calendar-event-line" : e.type === "tool-showComparison" ? "ri:scales-line" : e.type === "tool-showLocation" ? "ri:map-pin-line" : e.type === "tool-showQrCode" ? "ri:qr-code-line" : e.type === "tool-showImageGallery" ? "ri:image-line" : e.type === "tool-showVideo" ? "ri:film-line" : e.type === "tool-showSuggestedReply" ? "ri:corner-down-right-line" : e.type === "tool-requestGeolocation" ? "ri:map-pin-user-line" : e.type === "tool-disconnectOAuthConnection" ? "ri:link-unlink" : e.type === "tool-requestAccountLink" ? "ri:link" : e.type === "tool-unlinkAccount" ? "ri:link-unlink" : G.includes(e.type) ? "ri:global-line" : "ri:tools-line";
|
|
322
323
|
if (h(e)) return "ri:lightbulb-line";
|
|
323
324
|
if (c(e)) return "ri:double-quotes-r";
|
|
324
325
|
}
|
|
325
|
-
var
|
|
326
|
+
var le = [
|
|
326
327
|
i,
|
|
327
328
|
n,
|
|
328
329
|
r
|
|
329
330
|
];
|
|
330
|
-
function
|
|
331
|
+
function Y(e, { t, te: n }) {
|
|
331
332
|
if (n(`agent.tool.${e}`)) return t(`agent.tool.${e}`);
|
|
332
|
-
let r =
|
|
333
|
+
let r = le.find((t) => e.startsWith(t)), i = r ? e.slice(r.length) : e;
|
|
333
334
|
return s(o(i).trim().toLowerCase());
|
|
334
335
|
}
|
|
335
|
-
var
|
|
336
|
+
var ue = {
|
|
336
337
|
custom: (e) => e("messagePart.type.custom"),
|
|
337
338
|
data: (e) => e("messagePart.type.data"),
|
|
338
339
|
file: (e) => e("messagePart.type.file"),
|
|
@@ -342,13 +343,13 @@ var $ = {
|
|
|
342
343
|
"step-start": (e) => e("messagePart.type.stepStart"),
|
|
343
344
|
text: (e) => e("messagePart.type.text")
|
|
344
345
|
};
|
|
345
|
-
function
|
|
346
|
-
if (l(e)) return
|
|
347
|
-
if (e.type === "dynamic-tool") return
|
|
348
|
-
let n =
|
|
346
|
+
function de(e, t) {
|
|
347
|
+
if (l(e)) return Y(u(e), t);
|
|
348
|
+
if (e.type === "dynamic-tool") return Y(e.toolName, t);
|
|
349
|
+
let n = ue[e.type.startsWith("data-") ? "data" : e.type];
|
|
349
350
|
return n ? n(t.t) : s(o(e.type));
|
|
350
351
|
}
|
|
351
|
-
function
|
|
352
|
+
function fe(e, t) {
|
|
352
353
|
if (!e) return e;
|
|
353
354
|
let n = {
|
|
354
355
|
Intent: t("conversationSummary.intent"),
|
|
@@ -358,17 +359,17 @@ function ce(e, t) {
|
|
|
358
359
|
};
|
|
359
360
|
return e.replace(/\*\*(Intent|Topics covered|Key facts|Open questions)(:?)\*\*/g, (e, t, r) => `**${n[t]}${r}**`);
|
|
360
361
|
}
|
|
361
|
-
function
|
|
362
|
+
function pe(e, t, n) {
|
|
362
363
|
let r = x(t);
|
|
363
364
|
if (r) {
|
|
364
365
|
let t = r.toolCallId ? n?.[r.toolCallId] : void 0;
|
|
365
366
|
if (t) return t;
|
|
366
|
-
let i =
|
|
367
|
+
let i = S(r);
|
|
367
368
|
return i ? e(i.label) : r.title || r.toolName;
|
|
368
369
|
}
|
|
369
|
-
return l(t) ? t.type.includes("tool-subagent") ? e("messagePart.runSubagent") : t.type === "tool-runWorker" ? e("messagePart.runWorker") : t.type === "tool-scheduleWakeup" ? e("messagePart.scheduleWakeup") : t.type === "tool-fetchTeamsChannelHistory" ? e("messagePart.fetchTeamsChannelHistory") : t.type === "tool-readEarlierMessages" ? e("messagePart.readEarlierMessages") : t.type === "tool-readChatAttachment" ? e("messagePart.readChatAttachment") : t.type === "tool-sendChatFile" ? e("messagePart.sendChatFile") : t.type === "tool-enableTools" ? e("messagePart.enableTools") : t.type === "tool-retrieveRevisedAnswers" ? e("messagePart.revisedAnswers") : t.type === "tool-searchInKnowledgeBase" ? e("messagePart.searchingDocuments") : t.type === "tool-expandChunkContext" ? e("messagePart.expandChunkContext") : t.type === "tool-readDocumentFile" ? e("messagePart.readDocumentFile") : t.type === "tool-readSpreadsheet" ? e("messagePart.readSpreadsheet") : t.type === "tool-editSpreadsheet" ? e("messagePart.editSpreadsheet") : t.type === "tool-shareDocument" ? e("messagePart.shareDocument") : t.type === "tool-readWordDocument" ? e("messagePart.readWordDocument") : t.type === "tool-editWordDocument" ? e("messagePart.editWordDocument") : t.type === "tool-createSpreadsheet" ? e("messagePart.createSpreadsheet") : t.type === "tool-createWordDocument" ? e("messagePart.createWordDocument") : t.type === "tool-querySpreadsheet" ? e("messagePart.querySpreadsheet") : t.type === "tool-geocode" ? e("messagePart.geocode") : t.type === "tool-getWeather" ? e("messagePart.getWeather") : t.type === "tool-recallUserMemory" ? e("messagePart.recallUserMemory") : t.type === "tool-saveUserMemory" ? e("messagePart.saveUserMemory") : t.type === "tool-showWeather" ? e("messagePart.showWeather") : t.type === "tool-showForm" ? e("messagePart.showForm") : t.type === "tool-showDiagram" ? e("messagePart.showDiagram") : t.type === "tool-showSources" ? e("messagePart.showSources") : t.type === "tool-showMultipleChoice" ? e("messagePart.showMultipleChoice") : t.type === "tool-showArtifact" ? e("messagePart.showArtifact") : t.type === "tool-showEmail" ? e("messagePart.showEmail") : t.type === "tool-showMessage" ? e("messagePart.showMessage") : t.type === "tool-showWebPages" ? e("messagePart.showWebPages") : t.type === "tool-showProducts" ? e("messagePart.showProducts") : t.type === "tool-showContactForm" ? e("messagePart.showContactForm") : t.type === "tool-showCalendarEvent" ? e("messagePart.showCalendarEvent") : t.type === "tool-showComparison" ? e("messagePart.showComparison") : t.type === "tool-showLocation" ? e("messagePart.showLocation") : t.type === "tool-showQrCode" ? e("messagePart.showQrCode") : t.type === "tool-showImageGallery" ? e("messagePart.showImageGallery") : t.type === "tool-showVideo" ? e("messagePart.showVideo") : t.type === "tool-showSuggestedReply" ? e("messagePart.showSuggestedReply") : t.type === "tool-requestGeolocation" ? e("messagePart.requestGeolocation") : t.type === "tool-disconnectOAuthConnection" ? e("messagePart.disconnectOAuthConnection") : t.type === "tool-requestAccountLink" ? e("messagePart.requestAccountLink") : t.type === "tool-unlinkAccount" ? e("messagePart.unlinkAccount") :
|
|
370
|
+
return l(t) ? t.type.includes("tool-subagent") ? e("messagePart.runSubagent") : t.type === "tool-runWorker" ? e("messagePart.runWorker") : t.type === "tool-scheduleWakeup" ? e("messagePart.scheduleWakeup") : t.type === "tool-fetchTeamsChannelHistory" ? e("messagePart.fetchTeamsChannelHistory") : t.type === "tool-readEarlierMessages" ? e("messagePart.readEarlierMessages") : t.type === "tool-readChatAttachment" ? e("messagePart.readChatAttachment") : t.type === "tool-sendChatFile" ? e("messagePart.sendChatFile") : t.type === "tool-enableTools" ? e("messagePart.enableTools") : t.type === "tool-retrieveRevisedAnswers" ? e("messagePart.revisedAnswers") : t.type === "tool-searchInKnowledgeBase" ? e("messagePart.searchingDocuments") : t.type === "tool-expandChunkContext" ? e("messagePart.expandChunkContext") : t.type === "tool-readDocumentFile" ? e("messagePart.readDocumentFile") : t.type === "tool-readSpreadsheet" ? e("messagePart.readSpreadsheet") : t.type === "tool-editSpreadsheet" ? e("messagePart.editSpreadsheet") : t.type === "tool-shareDocument" ? e("messagePart.shareDocument") : t.type === "tool-readWordDocument" ? e("messagePart.readWordDocument") : t.type === "tool-editWordDocument" ? e("messagePart.editWordDocument") : t.type === "tool-createSpreadsheet" ? e("messagePart.createSpreadsheet") : t.type === "tool-createWordDocument" ? e("messagePart.createWordDocument") : t.type === "tool-querySpreadsheet" ? e("messagePart.querySpreadsheet") : t.type === "tool-geocode" ? e("messagePart.geocode") : t.type === "tool-getWeather" ? e("messagePart.getWeather") : t.type === "tool-recallUserMemory" ? e("messagePart.recallUserMemory") : t.type === "tool-saveUserMemory" ? e("messagePart.saveUserMemory") : t.type === "tool-showWeather" ? e("messagePart.showWeather") : t.type === "tool-showForm" ? e("messagePart.showForm") : t.type === "tool-showDiagram" ? e("messagePart.showDiagram") : t.type === "tool-showSources" ? e("messagePart.showSources") : t.type === "tool-showMultipleChoice" ? e("messagePart.showMultipleChoice") : t.type === "tool-showArtifact" ? e("messagePart.showArtifact") : t.type === "tool-showEmail" ? e("messagePart.showEmail") : t.type === "tool-showMessage" ? e("messagePart.showMessage") : t.type === "tool-showWebPages" ? e("messagePart.showWebPages") : t.type === "tool-showProducts" ? e("messagePart.showProducts") : t.type === "tool-showContactForm" ? e("messagePart.showContactForm") : t.type === "tool-showCalendarEvent" ? e("messagePart.showCalendarEvent") : t.type === "tool-showComparison" ? e("messagePart.showComparison") : t.type === "tool-showLocation" ? e("messagePart.showLocation") : t.type === "tool-showQrCode" ? e("messagePart.showQrCode") : t.type === "tool-showImageGallery" ? e("messagePart.showImageGallery") : t.type === "tool-showVideo" ? e("messagePart.showVideo") : t.type === "tool-showSuggestedReply" ? e("messagePart.showSuggestedReply") : t.type === "tool-requestGeolocation" ? e("messagePart.requestGeolocation") : t.type === "tool-disconnectOAuthConnection" ? e("messagePart.disconnectOAuthConnection") : t.type === "tool-requestAccountLink" ? e("messagePart.requestAccountLink") : t.type === "tool-unlinkAccount" ? e("messagePart.unlinkAccount") : G.includes(t.type) ? e("messagePart.webSearch") : e("messagePart.tool") : h(t) ? e("messagePart.reasoning") : e("messagePart.streaming");
|
|
370
371
|
}
|
|
371
|
-
var
|
|
372
|
+
var me = {
|
|
372
373
|
calibri: "Calibri, Carlito, \"Segoe UI\", Arial, sans-serif",
|
|
373
374
|
"calibri light": "\"Calibri Light\", Calibri, Carlito, \"Segoe UI\", sans-serif",
|
|
374
375
|
aptos: "Aptos, Calibri, Carlito, \"Segoe UI\", Arial, sans-serif",
|
|
@@ -382,7 +383,7 @@ var ue = {
|
|
|
382
383
|
georgia: "Georgia, serif",
|
|
383
384
|
verdana: "Verdana, \"DejaVu Sans\", sans-serif",
|
|
384
385
|
tahoma: "Tahoma, Verdana, sans-serif"
|
|
385
|
-
},
|
|
386
|
+
}, he = {
|
|
386
387
|
calibri: 1.22,
|
|
387
388
|
"calibri light": 1.22,
|
|
388
389
|
cambria: 1.17,
|
|
@@ -393,7 +394,43 @@ var ue = {
|
|
|
393
394
|
georgia: 1.14,
|
|
394
395
|
verdana: 1.22,
|
|
395
396
|
tahoma: 1.21
|
|
396
|
-
},
|
|
397
|
-
|
|
397
|
+
}, ge = (e) => he[e.toLowerCase()] ?? 1.17, X = (e) => me[e.toLowerCase()] ?? `"${e.replace(/"/g, "")}", ${/roman|garamond|cambria|georgia|serif|book|times/i.test(e) ? "Georgia, serif" : "Calibri, Carlito, \"Segoe UI\", Arial, sans-serif"}`, _e = Symbol("wordPreviewImages"), ve = (e, t) => {
|
|
398
|
+
let n = e?.[t];
|
|
399
|
+
return n?.startsWith("data:image/webp;base64,") ? n : void 0;
|
|
400
|
+
}, ye = (e, t) => {
|
|
401
|
+
let n = e.anchor;
|
|
402
|
+
return {
|
|
403
|
+
left: `${n.xFrom === "page" ? n.x : t.margins.left + n.x}pt`,
|
|
404
|
+
top: `${n.yFrom === "page" ? n.y : t.margins.top + n.y}pt`,
|
|
405
|
+
width: `${e.width}pt`,
|
|
406
|
+
height: `${e.height}pt`,
|
|
407
|
+
zIndex: n.wrap === "behind" ? -1 : 1
|
|
408
|
+
};
|
|
409
|
+
}, Z = (e) => {
|
|
410
|
+
let t = e.anchor;
|
|
411
|
+
return t ? t.wrap === "around" ? "around" : t.wrap === "block" ? "block" : t.yFrom === "paragraph" ? "paragraph" : "page" : "inline";
|
|
412
|
+
}, Q = (e, t) => e.filter((e) => t === "accepted" ? e.change !== "deleted" : t !== "original" || e.change !== "inserted"), $ = (e) => e.some((e) => e.image || e.text.trim()), be = (e, t) => {
|
|
413
|
+
let n = [], r = !1, i, a = (e, t, a, o, s) => {
|
|
414
|
+
let c = s ?? i;
|
|
415
|
+
n.push({
|
|
416
|
+
key: e,
|
|
417
|
+
block: t,
|
|
418
|
+
...a === void 0 ? {} : { row: a },
|
|
419
|
+
breakBefore: o || r,
|
|
420
|
+
...c === void 0 ? {} : { section: c }
|
|
421
|
+
}), r = !1, i = void 0;
|
|
422
|
+
}, o = (e, t) => {
|
|
423
|
+
r ||= e && t !== void 0, i = t ?? i;
|
|
424
|
+
};
|
|
425
|
+
return e.forEach((e, n) => {
|
|
426
|
+
if (e.kind === "table") {
|
|
427
|
+
let r = !!e.pageBreakBefore, i = e.section;
|
|
428
|
+
e.rows.forEach((e, o) => {
|
|
429
|
+
(!e.some((e) => e.runs.length) || e.some((e) => $(Q(e.runs, t)))) && (a(`${n}:${o}`, n, o, r, i), r = !1, i = void 0);
|
|
430
|
+
}), o(r, i);
|
|
431
|
+
} else !e.runs.length || $(Q(e.runs, t)) ? a(`${n}`, n, void 0, !!e.style?.pageBreakBefore, e.section) : o(!!e.style?.pageBreakBefore, e.section);
|
|
432
|
+
}), n;
|
|
433
|
+
}, xe = (e, t) => e.flatMap((e) => e.kind === "table" ? [] : Q(e.runs, t).flatMap((e) => e.picture && Z(e.picture) === "page" ? [e.picture] : [])), Se = (e, t) => t ? e.replace(RegExp(` \\(v${t}\\)(\\.\\w+)$`), "$1") : e;
|
|
434
|
+
export { g as A, xe as B, oe as C, w as D, C as E, be as F, te as G, ve as H, X as I, d as J, u as K, Q as L, L as M, B as N, j as O, Y as P, m as Q, ge as R, V as S, M as T, f as U, Z as V, p as W, c as X, h as Y, l as Z, P as _, _e as a, pe as b, v as c, W as d, U as f, ce as g, D as h, G as i, b as j, fe as k, ne as l, x as m, ie as n, R as o, z as p, ee as q, T as r, Se as s, A as t, H as u, de as v, I as w, se as x, N as y, ye as z };
|
|
398
435
|
|
|
399
|
-
//# sourceMappingURL=utils-
|
|
436
|
+
//# sourceMappingURL=utils-Bz1Gb3iO.js.map
|