@8wave/ai-elements 0.125.0-beta.7 → 0.125.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/_chunks/Agent-DZhK49jg.js.map +1 -1
  2. package/dist/_chunks/PkToolShowCalendarEvent-DWtTo28t.js +148 -0
  3. package/dist/_chunks/PkToolShowCalendarEvent-DWtTo28t.js.map +1 -0
  4. package/dist/_chunks/{PkToolShowQrCode-e6DxEcWY.js → PkToolShowQrCode-DGMhVUbp.js} +28 -22
  5. package/dist/_chunks/PkToolShowQrCode-DGMhVUbp.js.map +1 -0
  6. package/dist/ai-elements.es.js +2 -2
  7. package/dist-vue/PkChatbot.js +1 -1
  8. package/dist-vue/PkChatbotMessages.js +1 -1
  9. package/dist-vue/PkChatbotViewChat.js +1 -1
  10. package/dist-vue/_chunks/Agent-BtXBSGy6.js.map +1 -1
  11. package/dist-vue/_chunks/{PkChatbot-Qrk8yEM0.js → PkChatbot-CLOfTLQy.js} +2 -2
  12. package/dist-vue/_chunks/{PkChatbot-Qrk8yEM0.js.map → PkChatbot-CLOfTLQy.js.map} +1 -1
  13. package/dist-vue/_chunks/{PkChatbotMessages-DAwGWRtd.js → PkChatbotMessages-BxkCGmqV.js} +3 -3
  14. package/dist-vue/_chunks/{PkChatbotMessages-DAwGWRtd.js.map → PkChatbotMessages-BxkCGmqV.js.map} +1 -1
  15. package/dist-vue/_chunks/{PkChatbotViewChat-CMFc4eLD.js → PkChatbotViewChat-BwXOt2WW.js} +2 -2
  16. package/dist-vue/_chunks/{PkChatbotViewChat-CMFc4eLD.js.map → PkChatbotViewChat-BwXOt2WW.js.map} +1 -1
  17. package/dist-vue/_chunks/PkToolShowCalendarEvent-CAejFLQI.js +148 -0
  18. package/dist-vue/_chunks/PkToolShowCalendarEvent-CAejFLQI.js.map +1 -0
  19. package/dist-vue/_chunks/PkToolShowQrCode-96KzD1rX.js +78 -0
  20. package/dist-vue/_chunks/PkToolShowQrCode-96KzD1rX.js.map +1 -0
  21. package/dist-vue/index.js +5 -5
  22. package/dist-vue/packages/models/src/schema/Agent.d.ts +9 -0
  23. package/package.json +1 -1
  24. package/dist/_chunks/PkToolShowCalendarEvent-mVY2FS24.js +0 -148
  25. package/dist/_chunks/PkToolShowCalendarEvent-mVY2FS24.js.map +0 -1
  26. package/dist/_chunks/PkToolShowQrCode-e6DxEcWY.js.map +0 -1
  27. package/dist-vue/_chunks/PkToolShowCalendarEvent-BsAOYLjp.js +0 -148
  28. package/dist-vue/_chunks/PkToolShowCalendarEvent-BsAOYLjp.js.map +0 -1
  29. package/dist-vue/_chunks/PkToolShowQrCode-skWaARYV.js +0 -72
  30. package/dist-vue/_chunks/PkToolShowQrCode-skWaARYV.js.map +0 -1
@@ -0,0 +1,148 @@
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { t } from "./VvButtonLocalized-C-vx25u4.js";
3
+ import "./src-nb8MU1sh.js";
4
+ import { n } from "./url-validation-CJV9pp4v.js";
5
+ import { n as r } from "./useShortUrlResolver-KJDk7QLj.js";
6
+ import { VvButtonGroup as i, VvDropdown as a, VvDropdownAction as o, VvIcon as s } from "@volverjs/ui-vue/components";
7
+ import { computed as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, guardReactiveProps as h, normalizeProps as g, openBlock as _, toDisplayString as v, unref as y, withCtx as b } from "vue";
8
+ import { useI18n as x } from "vue-i18n";
9
+ import { useClipboard as S } from "@vueuse/core";
10
+ // ../../packages/components/src/chat/PkToolShowCalendarEvent.vue?vue&type=script&setup=true&lang.ts
11
+ var C = {
12
+ key: 0,
13
+ class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
14
+ }, w = { 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" }, T = { class: "font-bold" }, E = { class: "p-sm flex gap-sm items-start" }, D = { class: "shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center" }, O = { class: "bg-brand px-8 py-2 text-brand-contrast text-10 font-bold uppercase tracking-wide" }, k = { class: "bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none" }, A = { class: "flex flex-col gap-4 min-w-0" }, j = { class: "font-semibold text-word-1 text-14" }, M = { class: "flex items-center gap-8 text-12 text-word-3" }, N = ["datetime"], P = {
15
+ key: 0,
16
+ class: "flex items-center gap-8 text-12 text-word-3"
17
+ }, F = [
18
+ "href",
19
+ "target",
20
+ "rel"
21
+ ], I = { key: 1 }, L = {
22
+ key: 1,
23
+ class: "flex items-start gap-8 text-12 text-word-3"
24
+ }, R = /*@__PURE__*/ m({
25
+ __name: "PkToolShowCalendarEvent",
26
+ props: { part: {} },
27
+ setup(e) {
28
+ let m = e, { copy: R, copied: z } = S(), { d: B } = x(), V = c(() => m.part), { resolveText: H } = r(), U = H(() => V.value.input?.title), W = H(() => V.value.input?.location), G = H(() => V.value.input?.additionalInfo), K = c(() => {
29
+ let e = V.value.input;
30
+ if (!e) return "";
31
+ let { startDate: t, endDate: n, allDay: r } = e, i = new Date(t), a = new Date(n), o = t.slice(0, 10), s = n.slice(0, 10);
32
+ return r ? o === s ? B(i, "date-medium") : `${B(i, "date-medium")} - ${B(a, "date-medium")}` : o === s ? `${B(i, "date-time-medium")} - ${B(a, "time")}` : `${B(i, "date-time-medium")} - ${B(a, "date-time-medium")}`;
33
+ }), q = c(() => V.value.input ? new Date(V.value.input.startDate) : null), J = c(() => q.value?.getDate().toString() ?? ""), Y = c(() => q.value ? B(q.value, "month-short") : ""), X = (e) => e.replace(/[-:]/g, "").replace(/\.\d{3}$/, ""), Z = (e) => e.replace(/\\/g, "\\\\").replace(/;/g, "\\;").replace(/,/g, "\\,").replace(/\n/g, "\\n"), Q = () => {
34
+ let e = V.value.input;
35
+ if (!e) return;
36
+ let { startDate: t, endDate: n } = e, r = [
37
+ "BEGIN:VCALENDAR",
38
+ "VERSION:2.0",
39
+ "PRODID:-//8wave//8bot//EN",
40
+ "BEGIN:VEVENT",
41
+ `DTSTART:${X(t)}`,
42
+ `DTEND:${X(n)}`,
43
+ `SUMMARY:${Z(U.value)}`,
44
+ W.value ? `LOCATION:${Z(W.value)}` : "",
45
+ G.value ? `DESCRIPTION:${Z(G.value)}` : "",
46
+ `DTSTAMP:${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "")}`,
47
+ `UID:${crypto.randomUUID()}@8bot.ai`,
48
+ "END:VEVENT",
49
+ "END:VCALENDAR"
50
+ ].filter(Boolean).join("\r\n"), i = new Blob([r], { type: "text/calendar;charset=utf-8" }), a = URL.createObjectURL(i), o = document.createElement("a");
51
+ o.href = a, o.download = `${U.value.replace(/[^\p{L}\p{N}\s-]/gu, "").trim() || "event"}.ics`, o.click(), URL.revokeObjectURL(a);
52
+ }, $ = () => {
53
+ let e = V.value.input;
54
+ if (!e) return;
55
+ let t = X(e.startDate), n = X(e.endDate), r = new URLSearchParams({
56
+ action: "TEMPLATE",
57
+ text: U.value,
58
+ dates: `${t}/${n}`
59
+ });
60
+ W.value && r.set("location", W.value), G.value && r.set("details", G.value), window.open(`https://calendar.google.com/calendar/render?${r.toString()}`, "_blank");
61
+ }, ee = () => {
62
+ let e = V.value.input;
63
+ if (!e) return;
64
+ let t = new URLSearchParams({
65
+ subject: U.value,
66
+ startdt: e.startDate,
67
+ enddt: e.endDate
68
+ });
69
+ W.value && t.set("location", W.value), G.value && t.set("body", G.value), window.open(`https://outlook.office.com/calendar/0/action/compose?${t.toString()}`, "_blank");
70
+ }, te = () => {
71
+ if (!V.value.input) return;
72
+ let e = [U.value, K.value];
73
+ W.value && e.push(W.value), G.value && e.push(G.value), R(e.join("\n"));
74
+ };
75
+ return (e, r) => {
76
+ let c = s, m = t, x = o, S = a, R = i;
77
+ return V.value?.input ? (_(), u("div", C, [d("div", w, [
78
+ p(c, {
79
+ name: "ri:calendar-event-line",
80
+ class: "text-16"
81
+ }),
82
+ d("strong", T, v(e.$t("label.calendarEvent")), 1),
83
+ p(R, {
84
+ modifiers: "compact",
85
+ class: "ml-auto shrink-0"
86
+ }, {
87
+ default: b(() => [p(m, {
88
+ modifiers: "action-quiet-small",
89
+ icon: y(z) ? "ri:check-line" : "ri:file-copy-line",
90
+ label: y(z) ? e.$t("action.copied") : e.$t("action.copy"),
91
+ onClick: te
92
+ }, null, 8, ["icon", "label"]), p(S, g(h({
93
+ placement: "bottom-end",
94
+ modifiers: "menu",
95
+ flip: !0,
96
+ offset: 3,
97
+ strategy: "fixed"
98
+ })), {
99
+ items: b(() => [
100
+ p(x, { onClick: $ }, {
101
+ default: b(() => [p(c, { name: "ri:google-line" }), r[0] ||= f(" Google Calendar ", -1)]),
102
+ _: 1
103
+ }),
104
+ p(x, { onClick: ee }, {
105
+ default: b(() => [p(c, { name: "ri:microsoft-line" }), r[1] ||= f(" Outlook ", -1)]),
106
+ _: 1
107
+ }),
108
+ p(x, { onClick: Q }, {
109
+ default: b(() => [p(c, { name: "ri:download-line" }), f(" " + v(e.$t("action.downloadIcs")), 1)]),
110
+ _: 1
111
+ })
112
+ ]),
113
+ default: b(() => [p(m, {
114
+ icon: "ri:calendar-line",
115
+ modifiers: "action-quiet-small",
116
+ label: e.$t("action.addToCalendar")
117
+ }, null, 8, ["label"])]),
118
+ _: 1
119
+ }, 16)]),
120
+ _: 1
121
+ })
122
+ ]), d("div", E, [d("div", D, [d("div", O, v(Y.value), 1), d("div", k, v(J.value), 1)]), d("div", A, [
123
+ d("p", j, v(y(U)), 1),
124
+ d("div", M, [p(c, {
125
+ name: "ri:time-line",
126
+ class: "text-14 shrink-0"
127
+ }), d("time", { datetime: V.value.input.startDate }, v(K.value), 9, N)]),
128
+ y(W) ? (_(), u("div", P, [p(c, {
129
+ name: "ri:map-pin-line",
130
+ class: "text-14 shrink-0"
131
+ }), y(W).startsWith("http") ? (_(), u("a", {
132
+ key: 0,
133
+ href: y(W),
134
+ target: y(n)(y(W)) ? void 0 : "_blank",
135
+ rel: y(n)(y(W)) ? void 0 : "noopener noreferrer",
136
+ class: "underline truncate"
137
+ }, v(y(W)), 9, F)) : (_(), u("span", I, v(y(W)), 1))])) : l("", !0),
138
+ y(G) ? (_(), u("div", L, [p(c, {
139
+ name: "ri:sticky-note-line",
140
+ class: "text-14 shrink-0 mt-1"
141
+ }), d("span", null, v(y(G)), 1)])) : l("", !0)
142
+ ])])])) : l("", !0);
143
+ };
144
+ }
145
+ }), z = /* @__PURE__ */ e({ default: () => B }), B = R;
146
+ export { z as n, B as t };
147
+
148
+ //# sourceMappingURL=PkToolShowCalendarEvent-CAejFLQI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PkToolShowCalendarEvent-CAejFLQI.js","names":["$t","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_withCtx","_unref","_normalizeProps","_guardReactiveProps","_createTextVNode","_createCommentVNode","_sfc_main","__exportAll","useShortUrlResolver","_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","PkToolShowCalendarEvent_vue_vue_type_script_setup_true_lang_default","props","__props","useClipboard","useI18n","toolPart","computed","title","resolveText","eventLocation","additionalInfo","dateDisplay","input","start","startDate","end","endDate","startDay","endDay","allDay","d","calendarStart","calendarDay","calendarMonth","toIcsDateTime","iso","escapeIcs","str","generateIcs","ics","blob","url","a","openGoogleCalendar","params","openOutlook","copyEvent","lines","copy","_component_VvIcon","VvIcon","_component_VvButton","VvButtonLocalized","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","_component_VvButtonGroup","VvButtonGroup","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","withCtx","unref","copied","normalizeProps","guardReactiveProps","_cache","createTextVNode","isSameSite","createCommentVNode","PkToolShowCalendarEvent_exports","PkToolShowCalendarEvent_default"],"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 import { useShortUrlResolver } from 'composables'\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 // The event leaves the app (an .ics file, Google or Outlook, the\n // clipboard), so a short url the model copied from a tool becomes its real\n // target there, and on the card that shows what will go out.\n const { resolveText } = useShortUrlResolver()\n const title = resolveText(() => toolPart.value.input?.title)\n const eventLocation = resolveText(() => toolPart.value.input?.location)\n const additionalInfo = resolveText(\n () => toolPart.value.input?.additionalInfo,\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 { startDate, endDate } = 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.value)}`,\n eventLocation.value\n ? `LOCATION:${escapeIcs(eventLocation.value)}`\n : '',\n additionalInfo.value\n ? `DESCRIPTION:${escapeIcs(additionalInfo.value)}`\n : '',\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 // Letters of any alphabet: \"Riunione è\" kept its accent out, and a\n // title of none left a file called \".ics\".\n const fileName = title.value.replace(/[^\\p{L}\\p{N}\\s-]/gu, '').trim()\n a.download = `${fileName || 'event'}.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 start = toIcsDateTime(input.startDate)\n const end = toIcsDateTime(input.endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title.value,\n dates: `${start}/${end}`,\n })\n if (eventLocation.value) {\n params.set('location', eventLocation.value)\n }\n if (additionalInfo.value) {\n params.set('details', additionalInfo.value)\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 params = new URLSearchParams({\n subject: title.value,\n startdt: input.startDate,\n enddt: input.endDate,\n })\n if (eventLocation.value) {\n params.set('location', eventLocation.value)\n }\n if (additionalInfo.value) {\n params.set('body', additionalInfo.value)\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 = [title.value, dateDisplay.value]\n if (eventLocation.value) {\n lines.push(eventLocation.value)\n }\n if (additionalInfo.value) {\n lines.push(additionalInfo.value)\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\">\n <div\n class=\"bg-brand px-8 py-2 text-brand-contrast 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 {{ 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=\"eventLocation\"\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=\"eventLocation.startsWith('http')\"\n :href=\"eventLocation\"\n :target=\"\n isSameSite(eventLocation) ? undefined : '_blank'\n \"\n :rel=\"\n isSameSite(eventLocation)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ eventLocation }}\n </a>\n <span v-else>{{ eventLocation }}</span>\n </div>\n <div\n v-if=\"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>{{ 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 import { useShortUrlResolver } from 'composables'\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 // The event leaves the app (an .ics file, Google or Outlook, the\n // clipboard), so a short url the model copied from a tool becomes its real\n // target there, and on the card that shows what will go out.\n const { resolveText } = useShortUrlResolver()\n const title = resolveText(() => toolPart.value.input?.title)\n const eventLocation = resolveText(() => toolPart.value.input?.location)\n const additionalInfo = resolveText(\n () => toolPart.value.input?.additionalInfo,\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 { startDate, endDate } = 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.value)}`,\n eventLocation.value\n ? `LOCATION:${escapeIcs(eventLocation.value)}`\n : '',\n additionalInfo.value\n ? `DESCRIPTION:${escapeIcs(additionalInfo.value)}`\n : '',\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 // Letters of any alphabet: \"Riunione è\" kept its accent out, and a\n // title of none left a file called \".ics\".\n const fileName = title.value.replace(/[^\\p{L}\\p{N}\\s-]/gu, '').trim()\n a.download = `${fileName || 'event'}.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 start = toIcsDateTime(input.startDate)\n const end = toIcsDateTime(input.endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title.value,\n dates: `${start}/${end}`,\n })\n if (eventLocation.value) {\n params.set('location', eventLocation.value)\n }\n if (additionalInfo.value) {\n params.set('details', additionalInfo.value)\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 params = new URLSearchParams({\n subject: title.value,\n startdt: input.startDate,\n enddt: input.endDate,\n })\n if (eventLocation.value) {\n params.set('location', eventLocation.value)\n }\n if (additionalInfo.value) {\n params.set('body', additionalInfo.value)\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 = [title.value, dateDisplay.value]\n if (eventLocation.value) {\n lines.push(eventLocation.value)\n }\n if (additionalInfo.value) {\n lines.push(additionalInfo.value)\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\">\n <div\n class=\"bg-brand px-8 py-2 text-brand-contrast 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 {{ 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=\"eventLocation\"\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=\"eventLocation.startsWith('http')\"\n :href=\"eventLocation\"\n :target=\"\n isSameSite(eventLocation) ? undefined : '_blank'\n \"\n :rel=\"\n isSameSite(eventLocation)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ eventLocation }}\n </a>\n <span v-else>{{ eventLocation }}</span>\n </div>\n <div\n v-if=\"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>{{ additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAOI,IAAMoC,IAAQC,GAIR,EAAE,SAAM,cAAWC,EAAa,GAChC,EAAE,SAAMC,EAAQ,GAEhBC,IAAWC,QACAL,EAAM,IAWtB,GAKK,EAAE,mBAAgBjB,EAAoB,GACtCuB,IAAQC,QAAkBH,EAAS,MAAM,OAAO,KAAK,GACrDI,IAAgBD,QAAkBH,EAAS,MAAM,OAAO,QAAQ,GAChEK,IAAiBF,QACbH,EAAS,MAAM,OAAO,cAChC,GAEMM,IAAcL,QAAe;GAC/B,IAAMM,IAAQP,EAAS,MAAM;GAC7B,IAAI,CAACO,GACD,OAAO;GAEX,IAAM,EAAE,cAAW,YAAS,cAAWA,GACjCC,IAAQ,IAAI,KAAKC,CAAS,GAC1BC,IAAM,IAAI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AvBE,EAAAgC,CAAA,CAAa,GAAA,CAAA,E;IAGvBhC,EAAAiC,CAAA,KADVvC,EAAA,GAAAC,EAOM,OAPN2B,GAOM,CAJFzB,EAEoCiE,GAAA;KADhC,MAAK;KACL,OAAM;I,IACVlE,EAAiC,QAAA,MAAAE,EAAxBE,EAAAiC,CAAA,CAAc,GAAA,CAAA,C"}
@@ -0,0 +1,78 @@
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { t } from "./VvButtonLocalized-C-vx25u4.js";
3
+ import { n } from "./useShortUrlResolver-KJDk7QLj.js";
4
+ import { VvButtonGroup as r, VvIcon as i } from "@volverjs/ui-vue/components";
5
+ import { computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, openBlock as d, ref as f, toDisplayString as p, unref as m, watch as h, withCtx as g } from "vue";
6
+ import { useClipboard as _ } from "@vueuse/core";
7
+ // ../../packages/components/src/chat/PkToolShowQrCode.vue?vue&type=script&setup=true&lang.ts
8
+ var v = {
9
+ key: 0,
10
+ class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
11
+ }, y = { 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" }, b = { class: "font-bold" }, x = { class: "p-sm flex flex-col items-center" }, S = ["innerHTML"], C = {
12
+ key: 0,
13
+ class: "text-12 text-word-3 text-center"
14
+ }, w = /*@__PURE__*/ u({
15
+ __name: "PkToolShowQrCode",
16
+ props: { part: {} },
17
+ setup(e) {
18
+ let u = e, { copy: w, copied: T } = _(), E = a(() => u.part), { resolveText: D } = n(), O = D(() => E.value.input?.content), k = f(""), A = f();
19
+ h(O, async (e) => {
20
+ if (!e) return;
21
+ let { default: t } = await import("qrcode"), n = async (e) => {
22
+ try {
23
+ return await t.toString(e, { type: "svg" });
24
+ } catch {
25
+ return;
26
+ }
27
+ }, r = await n(e) ?? await n(E.value.input?.content ?? "");
28
+ r && O.value === e && (k.value = r);
29
+ }, { immediate: !0 });
30
+ let j = async () => {
31
+ let e = A.value?.querySelector("svg");
32
+ if (!e) return;
33
+ let t = new XMLSerializer().serializeToString(e), n = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("canvas");
34
+ i.width = 512, i.height = 512;
35
+ let a = i.getContext("2d"), o = new Image();
36
+ o.onload = () => {
37
+ a?.drawImage(o, 0, 0, 512, 512), URL.revokeObjectURL(r);
38
+ let e = document.createElement("a");
39
+ e.href = i.toDataURL("image/png"), e.download = "qrcode.png", e.click();
40
+ }, o.src = r;
41
+ };
42
+ return (e, n) => {
43
+ let a = i, u = t, f = r;
44
+ return E.value?.input ? (d(), s("div", v, [c("div", y, [
45
+ l(a, {
46
+ name: "ri:qr-code-line",
47
+ class: "text-16"
48
+ }),
49
+ c("strong", b, p(e.$t("label.qrCode")), 1),
50
+ l(f, {
51
+ modifiers: "compact",
52
+ class: "ml-auto shrink-0"
53
+ }, {
54
+ default: g(() => [l(u, {
55
+ modifiers: "action-quiet-small",
56
+ icon: m(T) ? "ri:check-line" : "ri:file-copy-line",
57
+ label: m(T) ? e.$t("action.copied") : e.$t("action.copy"),
58
+ onClick: n[0] ||= (e) => m(w)(m(O))
59
+ }, null, 8, ["icon", "label"]), l(u, {
60
+ modifiers: "action-quiet-small",
61
+ icon: "ri:download-line",
62
+ label: e.$t("action.download"),
63
+ onClick: j
64
+ }, null, 8, ["label"])]),
65
+ _: 1
66
+ })
67
+ ]), c("div", x, [c("div", {
68
+ ref_key: "qrContainerRef",
69
+ ref: A,
70
+ class: "w-144 h-144",
71
+ innerHTML: k.value
72
+ }, null, 8, S), E.value.input.label ? (d(), s("p", C, p(E.value.input.label), 1)) : o("", !0)])])) : o("", !0);
73
+ };
74
+ }
75
+ }), T = /* @__PURE__ */ e({ default: () => E }), E = w;
76
+ export { T as n, E as t };
77
+
78
+ //# sourceMappingURL=PkToolShowQrCode-96KzD1rX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PkToolShowQrCode-96KzD1rX.js","names":["$t","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_withCtx","_unref","_createCommentVNode","_sfc_main","__exportAll","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","PkToolShowQrCode_vue_vue_type_script_setup_true_lang_default","props","__props","useClipboard","toolPart","computed","useShortUrlResolver","content","resolveText","svgContent","ref","qrContainerRef","value","QRCode","draw","text","svg","downloadQr","svgEl","svgData","svgBlob","svgUrl","canvas","ctx","img","a","_component_VvIcon","VvIcon","_component_VvButton","VvButtonLocalized","_component_VvButtonGroup","VvButtonGroup","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","withCtx","unref","copied","_cache","copy","createCommentVNode","PkToolShowQrCode_exports","PkToolShowQrCode_default"],"sources":["../../../../packages/components/src/chat/PkToolShowQrCode.vue","../../../../packages/components/src/chat/PkToolShowQrCode.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useShortUrlResolver } from 'composables'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n content: string\n label?: string\n }\n }\n return part\n })\n\n // The code leaves the app (scanned, downloaded, copied): a short url the\n // model copied from a tool is encoded as its real target, drawn again\n // once the resolver answers.\n const { resolveText } = useShortUrlResolver()\n const content = resolveText(() => toolPart.value.input?.content)\n\n const svgContent = ref('')\n const qrContainerRef = ref<HTMLElement>()\n\n watch(\n content,\n async (value) => {\n if (!value) {\n return\n }\n const { default: QRCode } = await import('qrcode')\n const draw = async (text: string) => {\n try {\n return await QRCode.toString(text, { type: 'svg' })\n } catch {\n return undefined\n }\n }\n // An address past what a QR code holds: the short link the model\n // wrote still fits, and still leads there.\n const svg =\n (await draw(value)) ??\n (await draw(toolPart.value.input?.content ?? ''))\n // A later value may have been drawn while this one was.\n if (svg && content.value === value) {\n svgContent.value = svg\n }\n },\n { immediate: true },\n )\n\n const downloadQr = async () => {\n const svgEl = qrContainerRef.value?.querySelector('svg')\n if (!svgEl) {\n return\n }\n const svgData = new XMLSerializer().serializeToString(svgEl)\n const svgBlob = new Blob([svgData], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const svgUrl = URL.createObjectURL(svgBlob)\n\n const canvas = document.createElement('canvas')\n canvas.width = 512\n canvas.height = 512\n const ctx = canvas.getContext('2d')\n const img = new Image()\n img.onload = () => {\n ctx?.drawImage(img, 0, 0, 512, 512)\n URL.revokeObjectURL(svgUrl)\n const a = document.createElement('a')\n a.href = canvas.toDataURL('image/png')\n a.download = 'qrcode.png'\n a.click()\n }\n img.src = svgUrl\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:qr-code-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.qrCode') }}</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=\"copy(content)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadQr\" />\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex flex-col items-center\">\n <div ref=\"qrContainerRef\" class=\"w-144 h-144\" v-html=\"svgContent\" />\n <p\n v-if=\"toolPart.input.label\"\n class=\"text-12 text-word-3 text-center\">\n {{ toolPart.input.label }}\n </p>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useShortUrlResolver } from 'composables'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n content: string\n label?: string\n }\n }\n return part\n })\n\n // The code leaves the app (scanned, downloaded, copied): a short url the\n // model copied from a tool is encoded as its real target, drawn again\n // once the resolver answers.\n const { resolveText } = useShortUrlResolver()\n const content = resolveText(() => toolPart.value.input?.content)\n\n const svgContent = ref('')\n const qrContainerRef = ref<HTMLElement>()\n\n watch(\n content,\n async (value) => {\n if (!value) {\n return\n }\n const { default: QRCode } = await import('qrcode')\n const draw = async (text: string) => {\n try {\n return await QRCode.toString(text, { type: 'svg' })\n } catch {\n return undefined\n }\n }\n // An address past what a QR code holds: the short link the model\n // wrote still fits, and still leads there.\n const svg =\n (await draw(value)) ??\n (await draw(toolPart.value.input?.content ?? ''))\n // A later value may have been drawn while this one was.\n if (svg && content.value === value) {\n svgContent.value = svg\n }\n },\n { immediate: true },\n )\n\n const downloadQr = async () => {\n const svgEl = qrContainerRef.value?.querySelector('svg')\n if (!svgEl) {\n return\n }\n const svgData = new XMLSerializer().serializeToString(svgEl)\n const svgBlob = new Blob([svgData], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const svgUrl = URL.createObjectURL(svgBlob)\n\n const canvas = document.createElement('canvas')\n canvas.width = 512\n canvas.height = 512\n const ctx = canvas.getContext('2d')\n const img = new Image()\n img.onload = () => {\n ctx?.drawImage(img, 0, 0, 512, 512)\n URL.revokeObjectURL(svgUrl)\n const a = document.createElement('a')\n a.href = canvas.toDataURL('image/png')\n a.download = 'qrcode.png'\n a.click()\n }\n img.src = svgUrl\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:qr-code-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.qrCode') }}</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=\"copy(content)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadQr\" />\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex flex-col items-center\">\n <div ref=\"qrContainerRef\" class=\"w-144 h-144\" v-html=\"svgContent\" />\n <p\n v-if=\"toolPart.input.label\"\n class=\"text-12 text-word-3 text-center\">\n {{ toolPart.input.label }}\n </p>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAKI,IAAMqB,IAAQC,GAIR,EAAE,SAAM,cAAWC,EAAa,GAEhCC,IAAWC,QACAJ,EAAM,IAOtB,GAKK,EAAE,mBAAgBK,EAAoB,GACtCC,IAAUC,QAAkBJ,EAAS,MAAM,OAAO,OAAO,GAEzDK,IAAaC,EAAI,EAAE,GACnBC,IAAiBD,EAAiB;EAExC,EACIH,GACA,OAAO,MAAU;GACb,IAAI,CAACK,GACD;GAEJ,IAAM,EAAE,SAASC,MAAW,MAAM,OAAO,WACnCC,IAAO,OAAO,MAAiB;IACjC,IAAI;KACA,OAAO,MAAMD,EAAO,SAASE,GAAM,EAAE,MAAM,MAAM,CAAC;IACtD,QAAQ;KACJ;IACJ;GACJ,GAGMC,IACD,MAAMF,EAAKF,CAAK,KAChB,MAAME,EAAKV,EAAS,MAAM,OAAO,WAAW,EAAE;GAEnD,AAAIY,KAAOT,EAAQ,UAAUK,MACzB,EAAW,QAAQI;EAE3B,GACA,EAAE,WAAW,GAAK,CACtB;EAEA,IAAMC,IAAa,YAAY;GAC3B,IAAMC,IAAQP,EAAe,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E,iBAAA;MACT,SAAOqC;;;;G,IAGpB/B,EAOM,OAPNW,GAOM,CANFX,EAAoE,OAAA;IAA3D,SAAA;IAAJ,KAAIyB;IAAiB,OAAM;IAAc,WAAQF,EAAA;G,gBAE5CL,EAAA,MAAS,MAAM,SADzBpB,EAAA,GAAAC,EAII,KAJJc,GAIIX,EADGgB,EAAA,MAAS,MAAM,KAAK,GAAA,CAAA,K"}
package/dist-vue/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./_chunks/rolldown-runtime-CGnMp29N.js";
2
2
  import { t } from "./_chunks/PkEditorRadioButtons-Bw576DPQ.js";
3
3
  import { E as n, S as r, T as i, _ as a, f as o, m as s, o as c, r as l, s as u, u as d, v as f, w as p, x as m, y as h } from "./_chunks/schemas-BO5QlXAp.js";
4
- import { t as g } from "./_chunks/PkChatbotMessages-DAwGWRtd.js";
4
+ import { t as g } from "./_chunks/PkChatbotMessages-BxkCGmqV.js";
5
5
  import { a as _, i as v, l as y, n as b, r as x } from "./_chunks/Media-DylqhvaF.js";
6
6
  import { B as S, D as C, E as w, F as ee, I as te, J as ne, K as re, L as ie, N as ae, P as oe, R as se, S as ce, T as le, U as ue, X as de, Y as fe, Z as pe, a as me, at as he, ct as ge, d as _e, f as ve, i as ye, it as be, lt as xe, ot as Se, p as Ce, pt as we, q as Te, r as T, rt as Ee, s as De, st as Oe, t as ke, ut as Ae, w as je, x as Me, y as Ne, z as Pe } from "./_chunks/Agent-BtXBSGy6.js";
7
7
  import { c as Fe, d as Ie, l as Le, r as Re, s as ze, t as Be, u as Ve } from "./_chunks/Document-DERAWuR0.js";
@@ -16,7 +16,7 @@ import { E as nt, F as rt, J as it, L as at, M as ot, X as st, Y as ct, b as lt,
16
16
  import { t as ht } from "./_chunks/useSafeLocalStorage-Bn4SsL8C.js";
17
17
  import { t as gt } from "./_chunks/useDialogConfirm-fn7iV-iE.js";
18
18
  import { i as _t, n as vt, r as yt, t as bt } from "./_chunks/PkChatbotViewConversations-CtxE_a1O.js";
19
- import { a as xt, i as St, n as Ct, o as wt, r as Tt, t as Et } from "./_chunks/PkChatbotViewChat-CMFc4eLD.js";
19
+ import { a as xt, i as St, n as Ct, o as wt, r as Tt, t as Et } from "./_chunks/PkChatbotViewChat-BwXOt2WW.js";
20
20
  import { t as Dt } from "./_chunks/PkChatbotError-BS84xuiu.js";
21
21
  import { t as Ot } from "./_chunks/useImageFallback-HUe4GHah.js";
22
22
  import { t as kt } from "./_chunks/useLocalizedString-Dmn92nix.js";
@@ -38,7 +38,7 @@ import { t as rr } from "./_chunks/PkChatbotStepToolDetail-B0tC33x6.js";
38
38
  import { n as ir, t as ar } from "./_chunks/PkChatbotInput-Bs8nn-Jz.js";
39
39
  import { t as or } from "./_chunks/PkChatbotEmptyState-C9aUiynZ.js";
40
40
  import { t as sr } from "./_chunks/PkChatbotViewProfile-BSKRU7Ae.js";
41
- import { t as cr } from "./_chunks/PkChatbot-Qrk8yEM0.js";
41
+ import { t as cr } from "./_chunks/PkChatbot-CLOfTLQy.js";
42
42
  import { i as lr, r as ur, t as dr } from "./_chunks/PkToolShowSources-D4zjssdh.js";
43
43
  import { t as fr } from "./_chunks/mcpOAuthReport-D-MtFYwN.js";
44
44
  import { t as pr } from "./_chunks/PkToolShowEmail-BehvoNsz.js";
@@ -46,10 +46,10 @@ import { t as mr } from "./_chunks/PkToolShowMessage-Cca7K7GQ.js";
46
46
  import { t as hr } from "./_chunks/PkToolShowWebPages-D_tqGI6o.js";
47
47
  import { t as gr } from "./_chunks/PkToolShowProductList-DPDDeVu4.js";
48
48
  import { t as _r } from "./_chunks/PkToolShowContactForm-K6Z5MUXk.js";
49
- import { t as vr } from "./_chunks/PkToolShowCalendarEvent-BsAOYLjp.js";
49
+ import { t as vr } from "./_chunks/PkToolShowCalendarEvent-CAejFLQI.js";
50
50
  import { t as yr } from "./_chunks/PkToolShowComparison-BEHyRNXE.js";
51
51
  import { t as br } from "./_chunks/PkToolShowLocation-DAQEuCuQ.js";
52
- import { t as xr } from "./_chunks/PkToolShowQrCode-skWaARYV.js";
52
+ import { t as xr } from "./_chunks/PkToolShowQrCode-96KzD1rX.js";
53
53
  import { t as Sr } from "./_chunks/PkToolShowImageGallery-sCyrPOIT.js";
54
54
  import { t as Cr } from "./_chunks/PkToolShowSuggestedReply-smfC1hlT.js";
55
55
  import { t as wr } from "./_chunks/PkToolShareDocument-CsS5OTDj.js";
@@ -587,6 +587,15 @@ export declare function isVoiceRenderAck(output: unknown): boolean;
587
587
  export declare function isVoiceRenderedTool(toolName: string): boolean;
588
588
  /** Single availability rule for a client tool, shared by tool set and prompt. */
589
589
  export declare function supportsClientTool(surface: ClientToolSurface, toolName: string): boolean;
590
+ /**
591
+ * True when what the model writes is shown by the chat component, which turns
592
+ * a short link (`/api/r/<hash>`) back into its URL: the web chat and the
593
+ * widget, and voice, whose conversation is that chat. Only there may a tool
594
+ * hand the model short links to save tokens. Anywhere else the answer leaves
595
+ * the platform (a Teams or WhatsApp message, a program on the
596
+ * OpenAI-compatible API) and its URLs must be the real ones.
597
+ */
598
+ export declare function surfaceResolvesShortLinks(surface: ClientToolSurface): boolean;
590
599
  /**
591
600
  * Surface of a transport. Unknown transports are treated as Web, which is the
592
601
  * historical behaviour: a new caller has to opt into being headless, so adding
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8wave/ai-elements",
3
3
  "private": false,
4
- "version": "0.125.0-beta.7",
4
+ "version": "0.125.0-beta.8",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite --port 8082 --open --host",
@@ -1,148 +0,0 @@
1
- import { Dt as e, E as t, S as n, Tt as r, g as i, h as a, k as o, kt as s, ot as c, tt as l, v as u, w as d, wt as f, x as p, y as m, z as h } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
2
- import { r as g } from "./vue-i18n-POtLvOl1.js";
3
- import "./src-JJyCGvqH.js";
4
- import { n as _ } from "./url-validation-CJV9pp4v.js";
5
- import { i as v } from "./dist-B3-I_01H.js";
6
- import { a as y, p as b, t as x, u as S } from "./index.es-C7ON2BA3.js";
7
- import { t as C } from "./VvButtonLocalized-KEhD3ono.js";
8
- // ../../packages/components/src/chat/PkToolShowCalendarEvent.vue?vue&type=script&setup=true&lang.ts
9
- o(), r(), c();
10
- var w = {
11
- key: 0,
12
- class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
13
- }, T = { 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" }, E = { class: "font-bold" }, D = { class: "p-sm flex gap-sm items-start" }, O = { class: "shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center" }, k = { class: "bg-brand px-8 py-2 text-brand-contrast text-10 font-bold uppercase tracking-wide" }, A = { class: "bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none" }, j = { class: "flex flex-col gap-4 min-w-0" }, M = { class: "font-semibold text-word-1 text-14" }, N = { class: "flex items-center gap-8 text-12 text-word-3" }, P = ["datetime"], F = {
14
- key: 0,
15
- class: "flex items-center gap-8 text-12 text-word-3"
16
- }, I = [
17
- "href",
18
- "target",
19
- "rel"
20
- ], L = { key: 1 }, R = {
21
- key: 1,
22
- class: "flex items-start gap-8 text-12 text-word-3"
23
- }, z = /* @__PURE__ */ d({
24
- __name: "PkToolShowCalendarEvent",
25
- props: { part: { type: null } },
26
- setup(r) {
27
- let o = r, { copy: c, copied: d } = v(), { d: z } = g(), B = a(() => o.part), V = a(() => {
28
- let e = B.value.input;
29
- if (!e) return "";
30
- let { startDate: t, endDate: n, allDay: r } = e, i = new Date(t), a = new Date(n), o = t.slice(0, 10), s = n.slice(0, 10);
31
- return r ? o === s ? z(i, "date-medium") : `${z(i, "date-medium")} - ${z(a, "date-medium")}` : o === s ? `${z(i, "date-time-medium")} - ${z(a, "time")}` : `${z(i, "date-time-medium")} - ${z(a, "date-time-medium")}`;
32
- }), H = a(() => B.value.input ? new Date(B.value.input.startDate) : null), U = a(() => H.value?.getDate().toString() ?? ""), W = a(() => H.value ? z(H.value, "month-short") : ""), G = (e) => e.replace(/[-:]/g, "").replace(/\.\d{3}$/, ""), K = (e) => e.replace(/\\/g, "\\\\").replace(/;/g, "\\;").replace(/,/g, "\\,").replace(/\n/g, "\\n"), q = () => {
33
- let e = B.value.input;
34
- if (!e) return;
35
- let { title: t, startDate: n, endDate: r, location: i, additionalInfo: a } = e, o = [
36
- "BEGIN:VCALENDAR",
37
- "VERSION:2.0",
38
- "PRODID:-//8wave//8bot//EN",
39
- "BEGIN:VEVENT",
40
- `DTSTART:${G(n)}`,
41
- `DTEND:${G(r)}`,
42
- `SUMMARY:${K(t)}`,
43
- i ? `LOCATION:${K(i)}` : "",
44
- a ? `DESCRIPTION:${K(a)}` : "",
45
- `DTSTAMP:${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "")}`,
46
- `UID:${crypto.randomUUID()}@8bot.ai`,
47
- "END:VEVENT",
48
- "END:VCALENDAR"
49
- ].filter(Boolean).join("\r\n"), s = new Blob([o], { type: "text/calendar;charset=utf-8" }), c = URL.createObjectURL(s), l = document.createElement("a");
50
- l.href = c, l.download = `${t.replace(/[^a-zA-Z0-9\s-]/g, "")}.ics`, l.click(), URL.revokeObjectURL(c);
51
- }, J = () => {
52
- let e = B.value.input;
53
- if (!e) return;
54
- let { title: t, startDate: n, endDate: r, location: i, additionalInfo: a } = e, o = G(n), s = G(r), c = new URLSearchParams({
55
- action: "TEMPLATE",
56
- text: t,
57
- dates: `${o}/${s}`
58
- });
59
- i && c.set("location", i), a && c.set("details", a), window.open(`https://calendar.google.com/calendar/render?${c.toString()}`, "_blank");
60
- }, Y = () => {
61
- let e = B.value.input;
62
- if (!e) return;
63
- let { title: t, startDate: n, endDate: r, location: i, additionalInfo: a } = e, o = new URLSearchParams({
64
- subject: t,
65
- startdt: n,
66
- enddt: r
67
- });
68
- i && o.set("location", i), a && o.set("body", a), window.open(`https://outlook.office.com/calendar/0/action/compose?${o.toString()}`, "_blank");
69
- }, X = () => {
70
- let e = B.value.input;
71
- if (!e) return;
72
- let t = [e.title, V.value];
73
- e.location && t.push(e.location), e.additionalInfo && t.push(e.additionalInfo), c(t.join("\n"));
74
- };
75
- return (r, a) => {
76
- let o = x, c = C, g = b, v = S, z = y;
77
- return B.value?.input ? (h(), m("div", w, [i("div", T, [
78
- n(o, {
79
- name: "ri:calendar-event-line",
80
- class: "text-16"
81
- }),
82
- i("strong", E, s(r.$t("label.calendarEvent")), 1),
83
- n(z, {
84
- modifiers: "compact",
85
- class: "ml-auto shrink-0"
86
- }, {
87
- default: l(() => [n(c, {
88
- modifiers: "action-quiet-small",
89
- icon: f(d) ? "ri:check-line" : "ri:file-copy-line",
90
- label: f(d) ? r.$t("action.copied") : r.$t("action.copy"),
91
- onClick: X
92
- }, null, 8, ["icon", "label"]), n(v, e(t({
93
- placement: "bottom-end",
94
- modifiers: "menu",
95
- flip: !0,
96
- offset: 3,
97
- strategy: "fixed"
98
- })), {
99
- items: l(() => [
100
- n(g, { onClick: J }, {
101
- default: l(() => [n(o, { name: "ri:google-line" }), a[0] ||= p(" Google Calendar ", -1)]),
102
- _: 1
103
- }),
104
- n(g, { onClick: Y }, {
105
- default: l(() => [n(o, { name: "ri:microsoft-line" }), a[1] ||= p(" Outlook ", -1)]),
106
- _: 1
107
- }),
108
- n(g, { onClick: q }, {
109
- default: l(() => [n(o, { name: "ri:download-line" }), p(" " + s(r.$t("action.downloadIcs")), 1)]),
110
- _: 1
111
- })
112
- ]),
113
- default: l(() => [n(c, {
114
- icon: "ri:calendar-line",
115
- modifiers: "action-quiet-small",
116
- label: r.$t("action.addToCalendar")
117
- }, null, 8, ["label"])]),
118
- _: 1
119
- }, 16)]),
120
- _: 1
121
- })
122
- ]), i("div", D, [i("div", O, [i("div", k, s(W.value), 1), i("div", A, s(U.value), 1)]), i("div", j, [
123
- i("p", M, s(B.value.input.title), 1),
124
- i("div", N, [n(o, {
125
- name: "ri:time-line",
126
- class: "text-14 shrink-0"
127
- }), i("time", { datetime: B.value.input.startDate }, s(V.value), 9, P)]),
128
- B.value.input.location ? (h(), m("div", F, [n(o, {
129
- name: "ri:map-pin-line",
130
- class: "text-14 shrink-0"
131
- }), B.value.input.location.startsWith("http") ? (h(), m("a", {
132
- key: 0,
133
- href: B.value.input.location,
134
- target: f(_)(B.value.input.location) ? void 0 : "_blank",
135
- rel: f(_)(B.value.input.location) ? void 0 : "noopener noreferrer",
136
- class: "underline truncate"
137
- }, s(B.value.input.location), 9, I)) : (h(), m("span", L, s(B.value.input.location), 1))])) : u("", !0),
138
- B.value.input.additionalInfo ? (h(), m("div", R, [n(o, {
139
- name: "ri:sticky-note-line",
140
- class: "text-14 shrink-0 mt-1"
141
- }), i("span", null, s(B.value.input.additionalInfo), 1)])) : u("", !0)
142
- ])])])) : u("", !0);
143
- };
144
- }
145
- });
146
- export { z as default };
147
-
148
- //# sourceMappingURL=PkToolShowCalendarEvent-mVY2FS24.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolShowCalendarEvent-mVY2FS24.js","names":["$t","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_withCtx","_unref","_normalizeProps","_guardReactiveProps","_createTextVNode","_createCommentVNode","_sfc_main","normalizeProps","guardReactiveProps","createVNode","init_shared_esm_bundler","createBaseVNode","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","withCtx","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","useI18n","isSameSite","useClipboard","au","su","Ce","na","VvButtonLocalized","_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","PkToolShowCalendarEvent_default","props","__props","toolPart","dateDisplay","input","start","startDate","end","endDate","startDay","endDay","allDay","d","calendarStart","calendarDay","calendarMonth","toIcsDateTime","iso","escapeIcs","str","generateIcs","ics","title","location","additionalInfo","blob","url","a","openGoogleCalendar","params","openOutlook","copyEvent","lines","copy","_component_VvIcon","_component_VvButton","_component_VvDropdownAction","_component_VvDropdown","_component_VvButtonGroup","_ctx","copied","_cache"],"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\">\n <div\n class=\"bg-brand px-8 py-2 text-brand-contrast 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\">\n <div\n class=\"bg-brand px-8 py-2 text-brand-contrast 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,IAAM0D,IAAQC,GAIR,EAAE,SAAM,cAAWvB,EAAa,GAChC,EAAE,SAAMF,EAAQ,GAEhB0B,IAAWrC,QACAmC,EAAM,IAWtB,GAEKG,IAActC,QAAe;GAC/B,IAAMuC,IAAQF,EAAS,MAAM;GAC7B,IAAI,CAACE,GACD,OAAO;GAEX,IAAM,EAAE,cAAW,YAAS,cAAWA,GACjCC,IAAQ,IAAI,KAAKC,CAAS,GAC1BC,IAAM,IAAI,KAAKC,CAAO,GACtBC,IAAWH,EAAU,MAAM,GAAG,EAAE,GAChCI,IAASF,EAAQ,MAAM,GAAG,EAAE;GAUlC,OATIG,IACIF,MAAaC,IACNE,EAAEP,GAAO,aAAa,IAE1B,GAAGO,EAAEP,GAAO,aAAa,EAAE,KAAKO,EAAEL,GAAK,aAAa,MAE3DE,MAAaC,IACN,GAAGE,EAAEP,GAAO,kBAAkB,EAAE,KAAKO,EAAEL,GAAK,MAAM,MAEtD,GAAGK,EAAEP,GAAO,kBAAkB,EAAE,KAAKO,EAAEL,GAAK,kBAAkB;EACzE,CAAC,GAEKM,IAAgBhD,QAClBqC,EAAS,MAAM,QAAQ,IAAI,KAAKA,EAAS,MAAM,MAAM,SAAS,IAAI,IACtE,GAEMY,IAAcjD,QACVgD,EAAc,OAAO,QAAQ,CAAC,CAAC,SAAS,KAAK,EACvD,GAEME,IAAgBlD,QAClBgD,EAAc,QAAQD,EAAEC,EAAc,OAAO,aAAa,IAAI,EAClE,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