@plaisolutions/react 0.14.0 → 0.16.0
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/components/index.d.ts +47 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1408 -50
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +76 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1490 -60
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { HttpStatusError, PlaiChat } from "@plaisolutions/client";
|
|
2
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { Bot, Brain, Check, CheckCircle2, ChevronDown, CircleAlert, CircleX, Copy, Database, File, FileText, Globe, LoaderCircle, MessageSquare, Minus, Plug, Plus, RotateCcw, ThumbsDown, ThumbsUp, Workflow, XCircle } from "lucide-react";
|
|
2
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { Bot, Brain, CalendarDays, Check, CheckCircle2, ChevronDown, CircleAlert, CircleX, Clock, Copy, Database, ExternalLink, File, FileText, Globe, LoaderCircle, Mail, MessageSquare, Minus, Plug, Plus, RotateCcw, ThumbsDown, ThumbsUp, Video, Workflow, XCircle } from "lucide-react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/use-chat.ts
|
|
7
7
|
function useChat(options) {
|
|
8
8
|
const optionsRef = useRef(options);
|
|
9
9
|
optionsRef.current = options;
|
|
10
|
+
const external = options.chat;
|
|
10
11
|
const { transport, conversationId } = options;
|
|
11
|
-
const
|
|
12
|
+
const owned = useMemo(() => {
|
|
13
|
+
if (external || !transport) return null;
|
|
12
14
|
return new PlaiChat({
|
|
13
15
|
transport,
|
|
14
16
|
initialMessages: optionsRef.current.initialMessages,
|
|
@@ -16,17 +18,19 @@ function useChat(options) {
|
|
|
16
18
|
onEvent: (event) => optionsRef.current.onEvent?.(event),
|
|
17
19
|
onError: (error) => optionsRef.current.onError?.(error)
|
|
18
20
|
});
|
|
19
|
-
}, [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
}, [
|
|
22
|
+
external,
|
|
23
|
+
conversationId,
|
|
24
|
+
transport
|
|
25
|
+
]);
|
|
26
|
+
const chat = external ?? owned;
|
|
27
|
+
const state = useSyncExternalStore(useCallback((onStoreChange) => chat.subscribe(onStoreChange), [chat]), useCallback(() => chat.getState(), [chat]), useCallback(() => chat.getInitialState(), [chat]));
|
|
25
28
|
useEffect(() => {
|
|
29
|
+
if (!owned) return;
|
|
26
30
|
return () => {
|
|
27
|
-
|
|
31
|
+
owned.stop();
|
|
28
32
|
};
|
|
29
|
-
}, [
|
|
33
|
+
}, [owned]);
|
|
30
34
|
const actions = useMemo(() => ({
|
|
31
35
|
sendMessage: chat.sendMessage.bind(chat),
|
|
32
36
|
rateMessage: chat.rateMessage.bind(chat),
|
|
@@ -52,6 +56,74 @@ function useChat(options) {
|
|
|
52
56
|
};
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/use-chat-registry.ts
|
|
61
|
+
/**
|
|
62
|
+
* Owns a registry for the lifetime of the component and of `resetKey`.
|
|
63
|
+
*
|
|
64
|
+
* Creation and disposal are symmetric: a disposed registry is never handed out
|
|
65
|
+
* again, so the extra setup → cleanup → setup of StrictMode, or a change of
|
|
66
|
+
* `resetKey` (for example the chat session), yields a fresh registry.
|
|
67
|
+
*/
|
|
68
|
+
function useOwnedChatRegistry(create, resetKey) {
|
|
69
|
+
const createRef = useRef(create);
|
|
70
|
+
createRef.current = create;
|
|
71
|
+
let [owned, setOwned] = useState(() => ({
|
|
72
|
+
resetKey,
|
|
73
|
+
registry: create()
|
|
74
|
+
}));
|
|
75
|
+
if (!Object.is(owned.resetKey, resetKey)) {
|
|
76
|
+
owned = {
|
|
77
|
+
resetKey,
|
|
78
|
+
registry: create()
|
|
79
|
+
};
|
|
80
|
+
setOwned(owned);
|
|
81
|
+
}
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (owned.registry.isDisposed()) {
|
|
84
|
+
setOwned({
|
|
85
|
+
resetKey: owned.resetKey,
|
|
86
|
+
registry: createRef.current()
|
|
87
|
+
});
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const { registry } = owned;
|
|
91
|
+
return () => {
|
|
92
|
+
registry.dispose();
|
|
93
|
+
};
|
|
94
|
+
}, [owned]);
|
|
95
|
+
return owned.registry;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Instance of `key` in `registry`, retained while the component is mounted.
|
|
99
|
+
* Unmounting only drops the retention; it never stops the stream.
|
|
100
|
+
*/
|
|
101
|
+
function useRegistryChat(registry, key) {
|
|
102
|
+
const subscribe = useCallback((onStoreChange) => registry.subscribe(onStoreChange), [registry]);
|
|
103
|
+
const getSnapshot = useCallback(() => registry.getOrCreate(key), [registry, key]);
|
|
104
|
+
const chat = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
return registry.retain(key);
|
|
107
|
+
}, [
|
|
108
|
+
registry,
|
|
109
|
+
key,
|
|
110
|
+
chat
|
|
111
|
+
]);
|
|
112
|
+
return chat;
|
|
113
|
+
}
|
|
114
|
+
/** Keys with an operation, a stream or an upload in progress. */
|
|
115
|
+
function useChatRegistryBusy(registry) {
|
|
116
|
+
const subscribe = useCallback((onStoreChange) => registry.subscribe(onStoreChange), [registry]);
|
|
117
|
+
const getSnapshot = useCallback(() => registry.busyKeys(), [registry]);
|
|
118
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
119
|
+
}
|
|
120
|
+
/** Occupied slots and limit of a shared coordinator. */
|
|
121
|
+
function useStreamCoordinator(coordinator) {
|
|
122
|
+
const subscribe = useCallback((onStoreChange) => coordinator.subscribe(onStoreChange), [coordinator]);
|
|
123
|
+
const getSnapshot = useCallback(() => coordinator.getSnapshot(), [coordinator]);
|
|
124
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
125
|
+
}
|
|
126
|
+
|
|
55
127
|
//#endregion
|
|
56
128
|
//#region src/components/internal/join-classes.ts
|
|
57
129
|
function joinClasses(...classes) {
|
|
@@ -2377,7 +2449,7 @@ function SourceCard({ source, locale, variant = "card" }) {
|
|
|
2377
2449
|
});
|
|
2378
2450
|
}
|
|
2379
2451
|
function getTotalSourceCount(cards) {
|
|
2380
|
-
return cards.reduce((count, source) => count + (source.kind === "web" ? getWebSearchResults(source.part).length : 1), 0);
|
|
2452
|
+
return cards.reduce((count$1, source) => count$1 + (source.kind === "web" ? getWebSearchResults(source.part).length : 1), 0);
|
|
2381
2453
|
}
|
|
2382
2454
|
function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, getResourceDownloadUrl }) {
|
|
2383
2455
|
const cards = getAggregatedCards(parts, locale, getResourceDownloadUrl);
|
|
@@ -2429,7 +2501,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
2429
2501
|
|
|
2430
2502
|
//#endregion
|
|
2431
2503
|
//#region src/components/memory-proposal-card.tsx
|
|
2432
|
-
const COPY = {
|
|
2504
|
+
const COPY$1 = {
|
|
2433
2505
|
en: {
|
|
2434
2506
|
title: "Memory proposal",
|
|
2435
2507
|
user: "Personal memory",
|
|
@@ -2653,7 +2725,7 @@ const COPY = {
|
|
|
2653
2725
|
};
|
|
2654
2726
|
const REDACTED = "[redacted]";
|
|
2655
2727
|
function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale, className }) {
|
|
2656
|
-
const copy = COPY[getSupportedToolLocale(locale)];
|
|
2728
|
+
const copy = COPY$1[getSupportedToolLocale(locale)];
|
|
2657
2729
|
const [proposal, setProposal] = useState(initial);
|
|
2658
2730
|
const [resolving, setResolving] = useState(false);
|
|
2659
2731
|
const [error, setError] = useState(null);
|
|
@@ -2964,7 +3036,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
2964
3036
|
children: copy.agent
|
|
2965
3037
|
}),
|
|
2966
3038
|
/* @__PURE__ */ jsx("span", {
|
|
2967
|
-
className: "min-w-0 truncate text-neutral-
|
|
3039
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
2968
3040
|
children: agentName
|
|
2969
3041
|
}),
|
|
2970
3042
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3092,9 +3164,7 @@ function ToolResultBrowserCard({ part, className, locale }) {
|
|
|
3092
3164
|
const preview = getPreview(toOutput(part.result));
|
|
3093
3165
|
const url = getUrl(part.input);
|
|
3094
3166
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
3095
|
-
const
|
|
3096
|
-
const credits = metadata?.scraper_api_tokens ?? metadata?.firecrawl_credits;
|
|
3097
|
-
const subtitle = [scraperLabel, typeof credits === "number" ? `${credits} ${credits === 1 ? copy.credit : copy.credits}` : null].filter(Boolean).join(" · ");
|
|
3167
|
+
const subtitle = metadata?.scraper_type ? SCRAPER_LABELS[metadata.scraper_type] : null;
|
|
3098
3168
|
const failed = part.state === "error";
|
|
3099
3169
|
const pending = part.state === "pending";
|
|
3100
3170
|
const canExpand = Boolean(preview || error || url);
|
|
@@ -3113,7 +3183,7 @@ function ToolResultBrowserCard({ part, className, locale }) {
|
|
|
3113
3183
|
children: copy.browser
|
|
3114
3184
|
}),
|
|
3115
3185
|
subtitle ? /* @__PURE__ */ jsx("span", {
|
|
3116
|
-
className: "min-w-0 truncate text-xs text-neutral-500",
|
|
3186
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
3117
3187
|
children: subtitle
|
|
3118
3188
|
}) : null,
|
|
3119
3189
|
/* @__PURE__ */ jsxs("span", {
|
|
@@ -3251,7 +3321,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3251
3321
|
}), /* @__PURE__ */ jsxs("div", {
|
|
3252
3322
|
className: "flex items-center gap-2",
|
|
3253
3323
|
children: [/* @__PURE__ */ jsx("span", {
|
|
3254
|
-
className: joinClasses("rounded-full border px-2 py-0.5 text-xs
|
|
3324
|
+
className: joinClasses("rounded-full uppercase border px-2 py-0.5 text-xs", statusClass),
|
|
3255
3325
|
children: getUiStatusLabel(part.state, copy)
|
|
3256
3326
|
}), /* @__PURE__ */ jsx("button", {
|
|
3257
3327
|
type: "button",
|
|
@@ -3260,28 +3330,31 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3260
3330
|
"aria-controls": `tool-email-details-${part.id}`,
|
|
3261
3331
|
className: "inline-flex h-6 w-6 items-center justify-center rounded border border-slate-300 bg-white text-xs text-slate-700 hover:bg-slate-100",
|
|
3262
3332
|
onClick: () => setIsExpanded((previous) => !previous),
|
|
3263
|
-
children: /* @__PURE__ */ jsx(
|
|
3264
|
-
className: "
|
|
3265
|
-
|
|
3333
|
+
children: isExpanded ? /* @__PURE__ */ jsx(Minus, {
|
|
3334
|
+
className: "h-3 w-3",
|
|
3335
|
+
"aria-hidden": "true"
|
|
3336
|
+
}) : /* @__PURE__ */ jsx(Plus, {
|
|
3337
|
+
className: "h-3 w-3",
|
|
3338
|
+
"aria-hidden": "true"
|
|
3266
3339
|
})
|
|
3267
3340
|
})]
|
|
3268
3341
|
})]
|
|
3269
3342
|
}),
|
|
3270
3343
|
emailInput.subject ? /* @__PURE__ */ jsxs("div", {
|
|
3271
|
-
className: "
|
|
3272
|
-
children: [/* @__PURE__ */
|
|
3344
|
+
className: "flex items-center gap-1",
|
|
3345
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3273
3346
|
className: "text-xs font-semibold text-slate-600",
|
|
3274
|
-
children: copy.subject
|
|
3347
|
+
children: [copy.subject, ":"]
|
|
3275
3348
|
}), /* @__PURE__ */ jsx("p", {
|
|
3276
|
-
className: "text-
|
|
3349
|
+
className: "text-xs text-slate-900",
|
|
3277
3350
|
children: emailInput.subject
|
|
3278
3351
|
})]
|
|
3279
3352
|
}) : null,
|
|
3280
3353
|
/* @__PURE__ */ jsxs("div", {
|
|
3281
|
-
className: "
|
|
3282
|
-
children: [/* @__PURE__ */
|
|
3354
|
+
className: "flex items-center gap-1",
|
|
3355
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3283
3356
|
className: "text-xs font-semibold text-slate-600",
|
|
3284
|
-
children: copy.to
|
|
3357
|
+
children: [copy.to, ":"]
|
|
3285
3358
|
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3286
3359
|
className: "flex flex-wrap gap-2",
|
|
3287
3360
|
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
@@ -3289,7 +3362,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3289
3362
|
children: recipient
|
|
3290
3363
|
}, recipient))
|
|
3291
3364
|
}) : /* @__PURE__ */ jsx("p", {
|
|
3292
|
-
className: "text-
|
|
3365
|
+
className: "text-xs text-slate-500",
|
|
3293
3366
|
children: copy.noRecipientsProvided
|
|
3294
3367
|
})]
|
|
3295
3368
|
}),
|
|
@@ -3299,22 +3372,22 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3299
3372
|
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
3300
3373
|
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
3301
3374
|
className: "space-y-1",
|
|
3302
|
-
children: [/* @__PURE__ */
|
|
3375
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3303
3376
|
className: "text-xs font-semibold text-slate-600",
|
|
3304
|
-
children: copy.body
|
|
3377
|
+
children: [copy.body, ":"]
|
|
3305
3378
|
}), /* @__PURE__ */ jsx("p", {
|
|
3306
|
-
className: "whitespace-pre-wrap rounded border border-slate-200 bg-
|
|
3379
|
+
className: "whitespace-pre-wrap rounded border border-slate-200 bg-white p-2 text-sm text-slate-700",
|
|
3307
3380
|
children: emailInput.text
|
|
3308
3381
|
})]
|
|
3309
3382
|
}) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
3310
|
-
className: "space-y-2 rounded border border-slate-200 bg-
|
|
3383
|
+
className: "space-y-2 rounded border border-slate-200 bg-slate-50 p-3",
|
|
3311
3384
|
children: [
|
|
3312
3385
|
/* @__PURE__ */ jsx("p", {
|
|
3313
3386
|
className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
|
|
3314
3387
|
children: copy.delivery
|
|
3315
3388
|
}),
|
|
3316
3389
|
emailResult.status ? /* @__PURE__ */ jsxs("p", {
|
|
3317
|
-
className: "text-
|
|
3390
|
+
className: "text-xs text-slate-700",
|
|
3318
3391
|
children: [
|
|
3319
3392
|
/* @__PURE__ */ jsxs("span", {
|
|
3320
3393
|
className: "font-semibold text-slate-900",
|
|
@@ -3325,7 +3398,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3325
3398
|
]
|
|
3326
3399
|
}) : null,
|
|
3327
3400
|
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
3328
|
-
className: "text-
|
|
3401
|
+
className: "text-xs text-slate-700",
|
|
3329
3402
|
children: [
|
|
3330
3403
|
/* @__PURE__ */ jsxs("span", {
|
|
3331
3404
|
className: "font-semibold text-slate-900",
|
|
@@ -3336,7 +3409,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3336
3409
|
]
|
|
3337
3410
|
}) : null,
|
|
3338
3411
|
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
3339
|
-
className: "text-
|
|
3412
|
+
className: "text-xs text-slate-700",
|
|
3340
3413
|
children: [
|
|
3341
3414
|
/* @__PURE__ */ jsxs("span", {
|
|
3342
3415
|
className: "font-semibold text-slate-900",
|
|
@@ -3347,7 +3420,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3347
3420
|
]
|
|
3348
3421
|
}) : null,
|
|
3349
3422
|
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
3350
|
-
className: "break-all text-
|
|
3423
|
+
className: "break-all text-xs text-slate-700",
|
|
3351
3424
|
children: [
|
|
3352
3425
|
/* @__PURE__ */ jsxs("span", {
|
|
3353
3426
|
className: "font-semibold text-slate-900",
|
|
@@ -3358,7 +3431,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3358
3431
|
]
|
|
3359
3432
|
}) : null,
|
|
3360
3433
|
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
3361
|
-
className: "text-
|
|
3434
|
+
className: "text-xs text-slate-700",
|
|
3362
3435
|
children: [
|
|
3363
3436
|
/* @__PURE__ */ jsxs("span", {
|
|
3364
3437
|
className: "font-semibold text-slate-900",
|
|
@@ -3369,7 +3442,7 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3369
3442
|
]
|
|
3370
3443
|
}) : null,
|
|
3371
3444
|
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
3372
|
-
className: "whitespace-pre-wrap text-
|
|
3445
|
+
className: "whitespace-pre-wrap text-xs text-slate-700",
|
|
3373
3446
|
children: emailResult.raw
|
|
3374
3447
|
}) : null
|
|
3375
3448
|
]
|
|
@@ -3682,7 +3755,7 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3682
3755
|
|
|
3683
3756
|
//#endregion
|
|
3684
3757
|
//#region src/components/tool-result-mcp-card.tsx
|
|
3685
|
-
function text(value) {
|
|
3758
|
+
function text$1(value) {
|
|
3686
3759
|
if (typeof value === "string") return value;
|
|
3687
3760
|
if (value == null) return null;
|
|
3688
3761
|
try {
|
|
@@ -3696,7 +3769,7 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3696
3769
|
const meta = part.metadata;
|
|
3697
3770
|
const server = meta?.mcp_server_url ?? meta?.server_name;
|
|
3698
3771
|
const tool = meta?.mcp_tool_name ?? meta?.tool_name ?? part.name;
|
|
3699
|
-
const result = text(part.result);
|
|
3772
|
+
const result = text$1(part.result);
|
|
3700
3773
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
3701
3774
|
const failed = part.state === "error";
|
|
3702
3775
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
@@ -3714,7 +3787,7 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3714
3787
|
children: "MCP"
|
|
3715
3788
|
}),
|
|
3716
3789
|
/* @__PURE__ */ jsx("span", {
|
|
3717
|
-
className: "min-w-0 truncate text-neutral-
|
|
3790
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
3718
3791
|
children: tool
|
|
3719
3792
|
}),
|
|
3720
3793
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3823,7 +3896,7 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3823
3896
|
children: copy.officeDocuments
|
|
3824
3897
|
}),
|
|
3825
3898
|
/* @__PURE__ */ jsx("span", {
|
|
3826
|
-
className: "truncate text-xs text-neutral-500",
|
|
3899
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
3827
3900
|
children: part.state === "pending" ? copy.pending : `${files.length} ${fileLabel}`
|
|
3828
3901
|
}),
|
|
3829
3902
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3898,6 +3971,1318 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3898
3971
|
})] });
|
|
3899
3972
|
}
|
|
3900
3973
|
|
|
3974
|
+
//#endregion
|
|
3975
|
+
//#region src/components/internal/personal-connector-copy.ts
|
|
3976
|
+
const ENGLISH = {
|
|
3977
|
+
searchingMail: "Searching {{service}}",
|
|
3978
|
+
readingMail: "Reading an email in {{service}}",
|
|
3979
|
+
checkingCalendar: "Checking {{service}}",
|
|
3980
|
+
savingDraft: "Saving a draft in {{service}}",
|
|
3981
|
+
preparingMail: "Preparing an email in {{service}}",
|
|
3982
|
+
preparingEvent: "Preparing a change in {{service}}",
|
|
3983
|
+
runningConfirmed: "Running the confirmed actions",
|
|
3984
|
+
openIn: "Open in {{service}}",
|
|
3985
|
+
emailCountOne: "1 email",
|
|
3986
|
+
emailCountOther: "{{count}} emails",
|
|
3987
|
+
eventCountOne: "1 event",
|
|
3988
|
+
eventCountOther: "{{count}} events",
|
|
3989
|
+
noEmails: "No emails found",
|
|
3990
|
+
noEvents: "No events in this period",
|
|
3991
|
+
showAll: "Show all ({{count}})",
|
|
3992
|
+
showLess: "Show less",
|
|
3993
|
+
showMore: "Show more",
|
|
3994
|
+
allDay: "All day",
|
|
3995
|
+
to: "To",
|
|
3996
|
+
cc: "Cc",
|
|
3997
|
+
draftSaved: "Draft saved",
|
|
3998
|
+
openDraft: "Open draft",
|
|
3999
|
+
attendeesOne: "1 attendee",
|
|
4000
|
+
attendeesOther: "{{count}} attendees",
|
|
4001
|
+
noSubject: "(no subject)",
|
|
4002
|
+
unread: "Unread",
|
|
4003
|
+
joinMeeting: "Join",
|
|
4004
|
+
awaitingConfirmation: "Awaiting your confirmation",
|
|
4005
|
+
confirmHint: "Reply “yes” to confirm, or tell the agent what to change.",
|
|
4006
|
+
subject: "Subject",
|
|
4007
|
+
newEvent: "New event",
|
|
4008
|
+
eventChange: "Event change",
|
|
4009
|
+
deleteEvent: "Delete event",
|
|
4010
|
+
attendeesNotified: "Attendees will be notified.",
|
|
4011
|
+
title: "Title",
|
|
4012
|
+
when: "When",
|
|
4013
|
+
location: "Location",
|
|
4014
|
+
attendees: "Attendees",
|
|
4015
|
+
description: "Description",
|
|
4016
|
+
emailSent: "Email sent",
|
|
4017
|
+
eventCreated: "Event created",
|
|
4018
|
+
eventUpdated: "Event updated",
|
|
4019
|
+
eventDeleted: "Event deleted",
|
|
4020
|
+
actionDone: "{{tool}} done",
|
|
4021
|
+
actionFailed: "Failed",
|
|
4022
|
+
openEmail: "Open email",
|
|
4023
|
+
openEvent: "Open event",
|
|
4024
|
+
replyInThread: "Reply in the same thread"
|
|
4025
|
+
};
|
|
4026
|
+
const COPY = {
|
|
4027
|
+
en: {},
|
|
4028
|
+
es: {
|
|
4029
|
+
searchingMail: "Buscando en {{service}}",
|
|
4030
|
+
readingMail: "Leyendo un correo en {{service}}",
|
|
4031
|
+
checkingCalendar: "Consultando {{service}}",
|
|
4032
|
+
savingDraft: "Guardando un borrador en {{service}}",
|
|
4033
|
+
preparingMail: "Preparando un correo en {{service}}",
|
|
4034
|
+
preparingEvent: "Preparando un cambio en {{service}}",
|
|
4035
|
+
runningConfirmed: "Ejecutando las acciones confirmadas",
|
|
4036
|
+
openIn: "Abrir en {{service}}",
|
|
4037
|
+
emailCountOne: "1 correo",
|
|
4038
|
+
emailCountOther: "{{count}} correos",
|
|
4039
|
+
eventCountOne: "1 evento",
|
|
4040
|
+
eventCountOther: "{{count}} eventos",
|
|
4041
|
+
noEmails: "No se han encontrado correos",
|
|
4042
|
+
noEvents: "No hay eventos en este periodo",
|
|
4043
|
+
showAll: "Ver todos ({{count}})",
|
|
4044
|
+
showLess: "Ver menos",
|
|
4045
|
+
showMore: "Ver más",
|
|
4046
|
+
allDay: "Todo el día",
|
|
4047
|
+
to: "Para",
|
|
4048
|
+
cc: "CC",
|
|
4049
|
+
draftSaved: "Borrador guardado",
|
|
4050
|
+
openDraft: "Abrir borrador",
|
|
4051
|
+
attendeesOne: "1 asistente",
|
|
4052
|
+
attendeesOther: "{{count}} asistentes",
|
|
4053
|
+
noSubject: "(sin asunto)",
|
|
4054
|
+
unread: "No leído",
|
|
4055
|
+
joinMeeting: "Unirse",
|
|
4056
|
+
awaitingConfirmation: "Pendiente de tu confirmación",
|
|
4057
|
+
confirmHint: "Responde «sí» para confirmar, o dile al agente qué cambiar.",
|
|
4058
|
+
subject: "Asunto",
|
|
4059
|
+
newEvent: "Nuevo evento",
|
|
4060
|
+
eventChange: "Cambio en el evento",
|
|
4061
|
+
deleteEvent: "Borrar evento",
|
|
4062
|
+
attendeesNotified: "Se avisará a los asistentes.",
|
|
4063
|
+
title: "Título",
|
|
4064
|
+
when: "Cuándo",
|
|
4065
|
+
location: "Ubicación",
|
|
4066
|
+
attendees: "Asistentes",
|
|
4067
|
+
description: "Descripción",
|
|
4068
|
+
emailSent: "Correo enviado",
|
|
4069
|
+
eventCreated: "Evento creado",
|
|
4070
|
+
eventUpdated: "Evento actualizado",
|
|
4071
|
+
eventDeleted: "Evento borrado",
|
|
4072
|
+
actionDone: "{{tool}} hecho",
|
|
4073
|
+
actionFailed: "Error",
|
|
4074
|
+
openEmail: "Abrir correo",
|
|
4075
|
+
openEvent: "Abrir evento",
|
|
4076
|
+
replyInThread: "Respuesta en el mismo hilo"
|
|
4077
|
+
},
|
|
4078
|
+
ca: {
|
|
4079
|
+
searchingMail: "Cercant a {{service}}",
|
|
4080
|
+
readingMail: "Llegint un correu a {{service}}",
|
|
4081
|
+
checkingCalendar: "Consultant {{service}}",
|
|
4082
|
+
savingDraft: "Desant un esborrany a {{service}}",
|
|
4083
|
+
preparingMail: "Preparant un correu a {{service}}",
|
|
4084
|
+
preparingEvent: "Preparant un canvi a {{service}}",
|
|
4085
|
+
runningConfirmed: "Executant les accions confirmades",
|
|
4086
|
+
openIn: "Obre a {{service}}",
|
|
4087
|
+
emailCountOne: "1 correu",
|
|
4088
|
+
emailCountOther: "{{count}} correus",
|
|
4089
|
+
eventCountOne: "1 esdeveniment",
|
|
4090
|
+
eventCountOther: "{{count}} esdeveniments",
|
|
4091
|
+
noEmails: "No s’han trobat correus",
|
|
4092
|
+
noEvents: "No hi ha esdeveniments en aquest període",
|
|
4093
|
+
showAll: "Mostra-ho tot ({{count}})",
|
|
4094
|
+
showLess: "Mostra’n menys",
|
|
4095
|
+
showMore: "Mostra’n més",
|
|
4096
|
+
allDay: "Tot el dia",
|
|
4097
|
+
to: "Per a",
|
|
4098
|
+
cc: "CC",
|
|
4099
|
+
draftSaved: "Esborrany desat",
|
|
4100
|
+
openDraft: "Obre l’esborrany",
|
|
4101
|
+
attendeesOne: "1 assistent",
|
|
4102
|
+
attendeesOther: "{{count}} assistents",
|
|
4103
|
+
noSubject: "(sense assumpte)",
|
|
4104
|
+
unread: "No llegit",
|
|
4105
|
+
joinMeeting: "Uneix-t’hi",
|
|
4106
|
+
awaitingConfirmation: "Pendent de la teva confirmació",
|
|
4107
|
+
confirmHint: "Respon «sí» per confirmar, o digues a l’agent què ha de canviar.",
|
|
4108
|
+
subject: "Assumpte",
|
|
4109
|
+
newEvent: "Nou esdeveniment",
|
|
4110
|
+
eventChange: "Canvi a l’esdeveniment",
|
|
4111
|
+
deleteEvent: "Esborrar esdeveniment",
|
|
4112
|
+
attendeesNotified: "S’avisarà els assistents.",
|
|
4113
|
+
title: "Títol",
|
|
4114
|
+
when: "Quan",
|
|
4115
|
+
location: "Ubicació",
|
|
4116
|
+
attendees: "Assistents",
|
|
4117
|
+
description: "Descripció",
|
|
4118
|
+
emailSent: "Correu enviat",
|
|
4119
|
+
eventCreated: "Esdeveniment creat",
|
|
4120
|
+
eventUpdated: "Esdeveniment actualitzat",
|
|
4121
|
+
eventDeleted: "Esdeveniment esborrat",
|
|
4122
|
+
actionDone: "{{tool}} fet",
|
|
4123
|
+
actionFailed: "Error",
|
|
4124
|
+
openEmail: "Obre el correu",
|
|
4125
|
+
openEvent: "Obre l’esdeveniment",
|
|
4126
|
+
replyInThread: "Resposta al mateix fil"
|
|
4127
|
+
},
|
|
4128
|
+
fr: {
|
|
4129
|
+
searchingMail: "Recherche dans {{service}}",
|
|
4130
|
+
readingMail: "Lecture d’un e-mail dans {{service}}",
|
|
4131
|
+
checkingCalendar: "Consultation de {{service}}",
|
|
4132
|
+
savingDraft: "Enregistrement d’un brouillon dans {{service}}",
|
|
4133
|
+
preparingMail: "Préparation d’un e-mail dans {{service}}",
|
|
4134
|
+
preparingEvent: "Préparation d’une modification dans {{service}}",
|
|
4135
|
+
runningConfirmed: "Exécution des actions confirmées",
|
|
4136
|
+
openIn: "Ouvrir dans {{service}}",
|
|
4137
|
+
emailCountOne: "1 e-mail",
|
|
4138
|
+
emailCountOther: "{{count}} e-mails",
|
|
4139
|
+
eventCountOne: "1 événement",
|
|
4140
|
+
eventCountOther: "{{count}} événements",
|
|
4141
|
+
noEmails: "Aucun e-mail trouvé",
|
|
4142
|
+
noEvents: "Aucun événement sur cette période",
|
|
4143
|
+
showAll: "Tout afficher ({{count}})",
|
|
4144
|
+
showLess: "Afficher moins",
|
|
4145
|
+
showMore: "Afficher plus",
|
|
4146
|
+
allDay: "Toute la journée",
|
|
4147
|
+
to: "À",
|
|
4148
|
+
cc: "Cc",
|
|
4149
|
+
draftSaved: "Brouillon enregistré",
|
|
4150
|
+
openDraft: "Ouvrir le brouillon",
|
|
4151
|
+
attendeesOne: "1 participant",
|
|
4152
|
+
attendeesOther: "{{count}} participants",
|
|
4153
|
+
noSubject: "(sans objet)",
|
|
4154
|
+
unread: "Non lu",
|
|
4155
|
+
joinMeeting: "Rejoindre",
|
|
4156
|
+
awaitingConfirmation: "En attente de votre confirmation",
|
|
4157
|
+
confirmHint: "Répondez « oui » pour confirmer, ou dites à l’agent quoi modifier.",
|
|
4158
|
+
subject: "Objet",
|
|
4159
|
+
newEvent: "Nouvel événement",
|
|
4160
|
+
eventChange: "Modification de l’événement",
|
|
4161
|
+
deleteEvent: "Supprimer l’événement",
|
|
4162
|
+
attendeesNotified: "Les participants seront prévenus.",
|
|
4163
|
+
title: "Titre",
|
|
4164
|
+
when: "Quand",
|
|
4165
|
+
location: "Lieu",
|
|
4166
|
+
attendees: "Participants",
|
|
4167
|
+
description: "Description",
|
|
4168
|
+
emailSent: "E-mail envoyé",
|
|
4169
|
+
eventCreated: "Événement créé",
|
|
4170
|
+
eventUpdated: "Événement mis à jour",
|
|
4171
|
+
eventDeleted: "Événement supprimé",
|
|
4172
|
+
actionDone: "{{tool}} terminé",
|
|
4173
|
+
actionFailed: "Échec",
|
|
4174
|
+
openEmail: "Ouvrir l’e-mail",
|
|
4175
|
+
openEvent: "Ouvrir l’événement",
|
|
4176
|
+
replyInThread: "Réponse dans le même fil"
|
|
4177
|
+
},
|
|
4178
|
+
it: {
|
|
4179
|
+
searchingMail: "Ricerca in {{service}}",
|
|
4180
|
+
readingMail: "Lettura di un’email in {{service}}",
|
|
4181
|
+
checkingCalendar: "Consultazione di {{service}}",
|
|
4182
|
+
savingDraft: "Salvataggio di una bozza in {{service}}",
|
|
4183
|
+
preparingMail: "Preparazione di un’email in {{service}}",
|
|
4184
|
+
preparingEvent: "Preparazione di una modifica in {{service}}",
|
|
4185
|
+
runningConfirmed: "Esecuzione delle azioni confermate",
|
|
4186
|
+
openIn: "Apri in {{service}}",
|
|
4187
|
+
emailCountOne: "1 email",
|
|
4188
|
+
emailCountOther: "{{count}} email",
|
|
4189
|
+
eventCountOne: "1 evento",
|
|
4190
|
+
eventCountOther: "{{count}} eventi",
|
|
4191
|
+
noEmails: "Nessuna email trovata",
|
|
4192
|
+
noEvents: "Nessun evento in questo periodo",
|
|
4193
|
+
showAll: "Mostra tutto ({{count}})",
|
|
4194
|
+
showLess: "Mostra meno",
|
|
4195
|
+
showMore: "Mostra di più",
|
|
4196
|
+
allDay: "Tutto il giorno",
|
|
4197
|
+
to: "A",
|
|
4198
|
+
cc: "Cc",
|
|
4199
|
+
draftSaved: "Bozza salvata",
|
|
4200
|
+
openDraft: "Apri bozza",
|
|
4201
|
+
attendeesOne: "1 partecipante",
|
|
4202
|
+
attendeesOther: "{{count}} partecipanti",
|
|
4203
|
+
noSubject: "(nessun oggetto)",
|
|
4204
|
+
unread: "Non letta",
|
|
4205
|
+
joinMeeting: "Partecipa",
|
|
4206
|
+
awaitingConfirmation: "In attesa della tua conferma",
|
|
4207
|
+
confirmHint: "Rispondi «sì» per confermare, o di’ all’agente cosa cambiare.",
|
|
4208
|
+
subject: "Oggetto",
|
|
4209
|
+
newEvent: "Nuovo evento",
|
|
4210
|
+
eventChange: "Modifica dell’evento",
|
|
4211
|
+
deleteEvent: "Elimina evento",
|
|
4212
|
+
attendeesNotified: "I partecipanti verranno avvisati.",
|
|
4213
|
+
title: "Titolo",
|
|
4214
|
+
when: "Quando",
|
|
4215
|
+
location: "Luogo",
|
|
4216
|
+
attendees: "Partecipanti",
|
|
4217
|
+
description: "Descrizione",
|
|
4218
|
+
emailSent: "Email inviata",
|
|
4219
|
+
eventCreated: "Evento creato",
|
|
4220
|
+
eventUpdated: "Evento aggiornato",
|
|
4221
|
+
eventDeleted: "Evento eliminato",
|
|
4222
|
+
actionDone: "{{tool}} completato",
|
|
4223
|
+
actionFailed: "Errore",
|
|
4224
|
+
openEmail: "Apri email",
|
|
4225
|
+
openEvent: "Apri evento",
|
|
4226
|
+
replyInThread: "Risposta nello stesso thread"
|
|
4227
|
+
},
|
|
4228
|
+
de: {
|
|
4229
|
+
searchingMail: "Suche in {{service}}",
|
|
4230
|
+
readingMail: "E-Mail in {{service}} wird gelesen",
|
|
4231
|
+
checkingCalendar: "{{service}} wird abgefragt",
|
|
4232
|
+
savingDraft: "Entwurf wird in {{service}} gespeichert",
|
|
4233
|
+
preparingMail: "E-Mail in {{service}} wird vorbereitet",
|
|
4234
|
+
preparingEvent: "Änderung in {{service}} wird vorbereitet",
|
|
4235
|
+
runningConfirmed: "Bestätigte Aktionen werden ausgeführt",
|
|
4236
|
+
openIn: "In {{service}} öffnen",
|
|
4237
|
+
emailCountOne: "1 E-Mail",
|
|
4238
|
+
emailCountOther: "{{count}} E-Mails",
|
|
4239
|
+
eventCountOne: "1 Termin",
|
|
4240
|
+
eventCountOther: "{{count}} Termine",
|
|
4241
|
+
noEmails: "Keine E-Mails gefunden",
|
|
4242
|
+
noEvents: "Keine Termine in diesem Zeitraum",
|
|
4243
|
+
showAll: "Alle anzeigen ({{count}})",
|
|
4244
|
+
showLess: "Weniger anzeigen",
|
|
4245
|
+
showMore: "Mehr anzeigen",
|
|
4246
|
+
allDay: "Ganztägig",
|
|
4247
|
+
to: "An",
|
|
4248
|
+
cc: "Cc",
|
|
4249
|
+
draftSaved: "Entwurf gespeichert",
|
|
4250
|
+
openDraft: "Entwurf öffnen",
|
|
4251
|
+
attendeesOne: "1 Teilnehmer",
|
|
4252
|
+
attendeesOther: "{{count}} Teilnehmer",
|
|
4253
|
+
noSubject: "(kein Betreff)",
|
|
4254
|
+
unread: "Ungelesen",
|
|
4255
|
+
joinMeeting: "Teilnehmen",
|
|
4256
|
+
awaitingConfirmation: "Wartet auf deine Bestätigung",
|
|
4257
|
+
confirmHint: "Antworte mit „ja“, um zu bestätigen, oder sag dem Agenten, was er ändern soll.",
|
|
4258
|
+
subject: "Betreff",
|
|
4259
|
+
newEvent: "Neuer Termin",
|
|
4260
|
+
eventChange: "Terminänderung",
|
|
4261
|
+
deleteEvent: "Termin löschen",
|
|
4262
|
+
attendeesNotified: "Die Teilnehmer werden benachrichtigt.",
|
|
4263
|
+
title: "Titel",
|
|
4264
|
+
when: "Wann",
|
|
4265
|
+
location: "Ort",
|
|
4266
|
+
attendees: "Teilnehmer",
|
|
4267
|
+
description: "Beschreibung",
|
|
4268
|
+
emailSent: "E-Mail gesendet",
|
|
4269
|
+
eventCreated: "Termin erstellt",
|
|
4270
|
+
eventUpdated: "Termin aktualisiert",
|
|
4271
|
+
eventDeleted: "Termin gelöscht",
|
|
4272
|
+
actionDone: "{{tool}} erledigt",
|
|
4273
|
+
actionFailed: "Fehlgeschlagen",
|
|
4274
|
+
openEmail: "E-Mail öffnen",
|
|
4275
|
+
openEvent: "Termin öffnen",
|
|
4276
|
+
replyInThread: "Antwort im selben Verlauf"
|
|
4277
|
+
},
|
|
4278
|
+
da: {
|
|
4279
|
+
searchingMail: "Søger i {{service}}",
|
|
4280
|
+
readingMail: "Læser en e-mail i {{service}}",
|
|
4281
|
+
checkingCalendar: "Tjekker {{service}}",
|
|
4282
|
+
savingDraft: "Gemmer en kladde i {{service}}",
|
|
4283
|
+
preparingMail: "Forbereder en e-mail i {{service}}",
|
|
4284
|
+
preparingEvent: "Forbereder en ændring i {{service}}",
|
|
4285
|
+
runningConfirmed: "Udfører de bekræftede handlinger",
|
|
4286
|
+
openIn: "Åbn i {{service}}",
|
|
4287
|
+
emailCountOne: "1 e-mail",
|
|
4288
|
+
emailCountOther: "{{count}} e-mails",
|
|
4289
|
+
eventCountOne: "1 begivenhed",
|
|
4290
|
+
eventCountOther: "{{count}} begivenheder",
|
|
4291
|
+
noEmails: "Ingen e-mails fundet",
|
|
4292
|
+
noEvents: "Ingen begivenheder i denne periode",
|
|
4293
|
+
showAll: "Vis alle ({{count}})",
|
|
4294
|
+
showLess: "Vis mindre",
|
|
4295
|
+
showMore: "Vis mere",
|
|
4296
|
+
allDay: "Hele dagen",
|
|
4297
|
+
to: "Til",
|
|
4298
|
+
cc: "Cc",
|
|
4299
|
+
draftSaved: "Kladde gemt",
|
|
4300
|
+
openDraft: "Åbn kladde",
|
|
4301
|
+
attendeesOne: "1 deltager",
|
|
4302
|
+
attendeesOther: "{{count}} deltagere",
|
|
4303
|
+
noSubject: "(intet emne)",
|
|
4304
|
+
unread: "Ulæst",
|
|
4305
|
+
joinMeeting: "Deltag",
|
|
4306
|
+
awaitingConfirmation: "Afventer din bekræftelse",
|
|
4307
|
+
confirmHint: "Svar “ja” for at bekræfte, eller fortæl agenten, hvad der skal ændres.",
|
|
4308
|
+
subject: "Emne",
|
|
4309
|
+
newEvent: "Ny begivenhed",
|
|
4310
|
+
eventChange: "Ændring af begivenhed",
|
|
4311
|
+
deleteEvent: "Slet begivenhed",
|
|
4312
|
+
attendeesNotified: "Deltagerne får besked.",
|
|
4313
|
+
title: "Titel",
|
|
4314
|
+
when: "Hvornår",
|
|
4315
|
+
location: "Sted",
|
|
4316
|
+
attendees: "Deltagere",
|
|
4317
|
+
description: "Beskrivelse",
|
|
4318
|
+
emailSent: "E-mail sendt",
|
|
4319
|
+
eventCreated: "Begivenhed oprettet",
|
|
4320
|
+
eventUpdated: "Begivenhed opdateret",
|
|
4321
|
+
eventDeleted: "Begivenhed slettet",
|
|
4322
|
+
actionDone: "{{tool}} udført",
|
|
4323
|
+
actionFailed: "Mislykkedes",
|
|
4324
|
+
openEmail: "Åbn e-mail",
|
|
4325
|
+
openEvent: "Åbn begivenhed",
|
|
4326
|
+
replyInThread: "Svar i samme tråd"
|
|
4327
|
+
},
|
|
4328
|
+
sv: {
|
|
4329
|
+
searchingMail: "Söker i {{service}}",
|
|
4330
|
+
readingMail: "Läser ett mejl i {{service}}",
|
|
4331
|
+
checkingCalendar: "Kollar {{service}}",
|
|
4332
|
+
savingDraft: "Sparar ett utkast i {{service}}",
|
|
4333
|
+
preparingMail: "Förbereder ett mejl i {{service}}",
|
|
4334
|
+
preparingEvent: "Förbereder en ändring i {{service}}",
|
|
4335
|
+
runningConfirmed: "Utför de bekräftade åtgärderna",
|
|
4336
|
+
openIn: "Öppna i {{service}}",
|
|
4337
|
+
emailCountOne: "1 mejl",
|
|
4338
|
+
emailCountOther: "{{count}} mejl",
|
|
4339
|
+
eventCountOne: "1 händelse",
|
|
4340
|
+
eventCountOther: "{{count}} händelser",
|
|
4341
|
+
noEmails: "Inga mejl hittades",
|
|
4342
|
+
noEvents: "Inga händelser under perioden",
|
|
4343
|
+
showAll: "Visa alla ({{count}})",
|
|
4344
|
+
showLess: "Visa mindre",
|
|
4345
|
+
showMore: "Visa mer",
|
|
4346
|
+
allDay: "Heldag",
|
|
4347
|
+
to: "Till",
|
|
4348
|
+
cc: "Kopia",
|
|
4349
|
+
draftSaved: "Utkast sparat",
|
|
4350
|
+
openDraft: "Öppna utkast",
|
|
4351
|
+
attendeesOne: "1 deltagare",
|
|
4352
|
+
attendeesOther: "{{count}} deltagare",
|
|
4353
|
+
noSubject: "(inget ämne)",
|
|
4354
|
+
unread: "Oläst",
|
|
4355
|
+
joinMeeting: "Anslut",
|
|
4356
|
+
awaitingConfirmation: "Väntar på din bekräftelse",
|
|
4357
|
+
confirmHint: "Svara ”ja” för att bekräfta, eller säg till agenten vad som ska ändras.",
|
|
4358
|
+
subject: "Ämne",
|
|
4359
|
+
newEvent: "Ny händelse",
|
|
4360
|
+
eventChange: "Ändring av händelse",
|
|
4361
|
+
deleteEvent: "Ta bort händelse",
|
|
4362
|
+
attendeesNotified: "Deltagarna meddelas.",
|
|
4363
|
+
title: "Titel",
|
|
4364
|
+
when: "När",
|
|
4365
|
+
location: "Plats",
|
|
4366
|
+
attendees: "Deltagare",
|
|
4367
|
+
description: "Beskrivning",
|
|
4368
|
+
emailSent: "Mejl skickat",
|
|
4369
|
+
eventCreated: "Händelse skapad",
|
|
4370
|
+
eventUpdated: "Händelse uppdaterad",
|
|
4371
|
+
eventDeleted: "Händelse borttagen",
|
|
4372
|
+
actionDone: "{{tool}} klar",
|
|
4373
|
+
actionFailed: "Misslyckades",
|
|
4374
|
+
openEmail: "Öppna mejl",
|
|
4375
|
+
openEvent: "Öppna händelse",
|
|
4376
|
+
replyInThread: "Svar i samma tråd"
|
|
4377
|
+
},
|
|
4378
|
+
no: {
|
|
4379
|
+
searchingMail: "Søker i {{service}}",
|
|
4380
|
+
readingMail: "Leser en e-post i {{service}}",
|
|
4381
|
+
checkingCalendar: "Sjekker {{service}}",
|
|
4382
|
+
savingDraft: "Lagrer et utkast i {{service}}",
|
|
4383
|
+
preparingMail: "Forbereder en e-post i {{service}}",
|
|
4384
|
+
preparingEvent: "Forbereder en endring i {{service}}",
|
|
4385
|
+
runningConfirmed: "Utfører de bekreftede handlingene",
|
|
4386
|
+
openIn: "Åpne i {{service}}",
|
|
4387
|
+
emailCountOne: "1 e-post",
|
|
4388
|
+
emailCountOther: "{{count}} e-poster",
|
|
4389
|
+
eventCountOne: "1 hendelse",
|
|
4390
|
+
eventCountOther: "{{count}} hendelser",
|
|
4391
|
+
noEmails: "Fant ingen e-poster",
|
|
4392
|
+
noEvents: "Ingen hendelser i denne perioden",
|
|
4393
|
+
showAll: "Vis alle ({{count}})",
|
|
4394
|
+
showLess: "Vis mindre",
|
|
4395
|
+
showMore: "Vis mer",
|
|
4396
|
+
allDay: "Hele dagen",
|
|
4397
|
+
to: "Til",
|
|
4398
|
+
cc: "Kopi",
|
|
4399
|
+
draftSaved: "Utkast lagret",
|
|
4400
|
+
openDraft: "Åpne utkast",
|
|
4401
|
+
attendeesOne: "1 deltaker",
|
|
4402
|
+
attendeesOther: "{{count}} deltakere",
|
|
4403
|
+
noSubject: "(intet emne)",
|
|
4404
|
+
unread: "Ulest",
|
|
4405
|
+
joinMeeting: "Bli med",
|
|
4406
|
+
awaitingConfirmation: "Venter på bekreftelsen din",
|
|
4407
|
+
confirmHint: "Svar «ja» for å bekrefte, eller si til agenten hva som skal endres.",
|
|
4408
|
+
subject: "Emne",
|
|
4409
|
+
newEvent: "Ny hendelse",
|
|
4410
|
+
eventChange: "Endring av hendelse",
|
|
4411
|
+
deleteEvent: "Slett hendelse",
|
|
4412
|
+
attendeesNotified: "Deltakerne blir varslet.",
|
|
4413
|
+
title: "Tittel",
|
|
4414
|
+
when: "Når",
|
|
4415
|
+
location: "Sted",
|
|
4416
|
+
attendees: "Deltakere",
|
|
4417
|
+
description: "Beskrivelse",
|
|
4418
|
+
emailSent: "E-post sendt",
|
|
4419
|
+
eventCreated: "Hendelse opprettet",
|
|
4420
|
+
eventUpdated: "Hendelse oppdatert",
|
|
4421
|
+
eventDeleted: "Hendelse slettet",
|
|
4422
|
+
actionDone: "{{tool}} fullført",
|
|
4423
|
+
actionFailed: "Mislyktes",
|
|
4424
|
+
openEmail: "Åpne e-post",
|
|
4425
|
+
openEvent: "Åpne hendelse",
|
|
4426
|
+
replyInThread: "Svar i samme tråd"
|
|
4427
|
+
},
|
|
4428
|
+
pt: {
|
|
4429
|
+
searchingMail: "Pesquisando no {{service}}",
|
|
4430
|
+
readingMail: "Lendo um e-mail no {{service}}",
|
|
4431
|
+
checkingCalendar: "Consultando o {{service}}",
|
|
4432
|
+
savingDraft: "Salvando um rascunho no {{service}}",
|
|
4433
|
+
preparingMail: "Preparando um e-mail no {{service}}",
|
|
4434
|
+
preparingEvent: "Preparando uma alteração no {{service}}",
|
|
4435
|
+
runningConfirmed: "Executando as ações confirmadas",
|
|
4436
|
+
openIn: "Abrir no {{service}}",
|
|
4437
|
+
emailCountOne: "1 e-mail",
|
|
4438
|
+
emailCountOther: "{{count}} e-mails",
|
|
4439
|
+
eventCountOne: "1 evento",
|
|
4440
|
+
eventCountOther: "{{count}} eventos",
|
|
4441
|
+
noEmails: "Nenhum e-mail encontrado",
|
|
4442
|
+
noEvents: "Nenhum evento neste período",
|
|
4443
|
+
showAll: "Ver todos ({{count}})",
|
|
4444
|
+
showLess: "Ver menos",
|
|
4445
|
+
showMore: "Ver mais",
|
|
4446
|
+
allDay: "Dia inteiro",
|
|
4447
|
+
to: "Para",
|
|
4448
|
+
cc: "Cc",
|
|
4449
|
+
draftSaved: "Rascunho salvo",
|
|
4450
|
+
openDraft: "Abrir rascunho",
|
|
4451
|
+
attendeesOne: "1 participante",
|
|
4452
|
+
attendeesOther: "{{count}} participantes",
|
|
4453
|
+
noSubject: "(sem assunto)",
|
|
4454
|
+
unread: "Não lido",
|
|
4455
|
+
joinMeeting: "Entrar",
|
|
4456
|
+
awaitingConfirmation: "Aguardando sua confirmação",
|
|
4457
|
+
confirmHint: "Responda “sim” para confirmar, ou diga ao agente o que mudar.",
|
|
4458
|
+
subject: "Assunto",
|
|
4459
|
+
newEvent: "Novo evento",
|
|
4460
|
+
eventChange: "Alteração do evento",
|
|
4461
|
+
deleteEvent: "Excluir evento",
|
|
4462
|
+
attendeesNotified: "Os participantes serão avisados.",
|
|
4463
|
+
title: "Título",
|
|
4464
|
+
when: "Quando",
|
|
4465
|
+
location: "Local",
|
|
4466
|
+
attendees: "Participantes",
|
|
4467
|
+
description: "Descrição",
|
|
4468
|
+
emailSent: "E-mail enviado",
|
|
4469
|
+
eventCreated: "Evento criado",
|
|
4470
|
+
eventUpdated: "Evento atualizado",
|
|
4471
|
+
eventDeleted: "Evento excluído",
|
|
4472
|
+
actionDone: "{{tool}} concluído",
|
|
4473
|
+
actionFailed: "Falhou",
|
|
4474
|
+
openEmail: "Abrir e-mail",
|
|
4475
|
+
openEvent: "Abrir evento",
|
|
4476
|
+
replyInThread: "Resposta na mesma conversa"
|
|
4477
|
+
}
|
|
4478
|
+
};
|
|
4479
|
+
function getPersonalConnectorCopy(locale) {
|
|
4480
|
+
return {
|
|
4481
|
+
...ENGLISH,
|
|
4482
|
+
...COPY[getSupportedToolLocale(locale)]
|
|
4483
|
+
};
|
|
4484
|
+
}
|
|
4485
|
+
function fillCopy(template, values) {
|
|
4486
|
+
return template.replace(/\{\{(\w+)\}\}/g, (match, key) => key in values ? String(values[key]) : match);
|
|
4487
|
+
}
|
|
4488
|
+
|
|
4489
|
+
//#endregion
|
|
4490
|
+
//#region src/components/tool-result-personal-connector-card.tsx
|
|
4491
|
+
const COLLAPSED_ITEMS = 5;
|
|
4492
|
+
const COLLAPSED_BODY_CHARS = 600;
|
|
4493
|
+
const EVENT_OPERATIONS = [
|
|
4494
|
+
"create_event",
|
|
4495
|
+
"update_event",
|
|
4496
|
+
"delete_event"
|
|
4497
|
+
];
|
|
4498
|
+
function isEventOperation(value) {
|
|
4499
|
+
return EVENT_OPERATIONS.includes(value);
|
|
4500
|
+
}
|
|
4501
|
+
function asRecord(value) {
|
|
4502
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
4503
|
+
}
|
|
4504
|
+
function text(value) {
|
|
4505
|
+
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
4506
|
+
}
|
|
4507
|
+
function hasId(value) {
|
|
4508
|
+
return typeof asRecord(value)?.id === "string";
|
|
4509
|
+
}
|
|
4510
|
+
function getView(part) {
|
|
4511
|
+
const metadata = asRecord(part.metadata);
|
|
4512
|
+
if (!metadata || metadata.error) return null;
|
|
4513
|
+
const result = metadata.result;
|
|
4514
|
+
const pending = asRecord(metadata.pending_confirmation);
|
|
4515
|
+
if (pending) {
|
|
4516
|
+
const confirmation = pending;
|
|
4517
|
+
if (!asRecord(confirmation.action)) return null;
|
|
4518
|
+
if (metadata.action === "send") return {
|
|
4519
|
+
kind: "pending-mail",
|
|
4520
|
+
pending: confirmation
|
|
4521
|
+
};
|
|
4522
|
+
return isEventOperation(metadata.action) ? {
|
|
4523
|
+
kind: "pending-event",
|
|
4524
|
+
operation: metadata.action,
|
|
4525
|
+
pending: confirmation
|
|
4526
|
+
} : null;
|
|
4527
|
+
}
|
|
4528
|
+
switch (metadata.action) {
|
|
4529
|
+
case "search": return Array.isArray(result) ? {
|
|
4530
|
+
kind: "mail-list",
|
|
4531
|
+
messages: result.filter(hasId)
|
|
4532
|
+
} : null;
|
|
4533
|
+
case "read": return hasId(result) ? {
|
|
4534
|
+
kind: "mail",
|
|
4535
|
+
message: result
|
|
4536
|
+
} : null;
|
|
4537
|
+
case "list_events": return Array.isArray(result) ? {
|
|
4538
|
+
kind: "events",
|
|
4539
|
+
events: result.filter(hasId)
|
|
4540
|
+
} : null;
|
|
4541
|
+
case "create_draft": {
|
|
4542
|
+
const input = asRecord(part.input);
|
|
4543
|
+
return {
|
|
4544
|
+
kind: "draft",
|
|
4545
|
+
link: text(asRecord(result)?.link),
|
|
4546
|
+
to: Array.isArray(input?.to) ? input.to.filter((item) => typeof item === "string") : [],
|
|
4547
|
+
subject: text(input?.subject),
|
|
4548
|
+
body: text(input?.body)
|
|
4549
|
+
};
|
|
4550
|
+
}
|
|
4551
|
+
default: return null;
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
/** Whether the part has a dedicated view; otherwise the generic card renders it. */
|
|
4555
|
+
function hasPersonalConnectorView(part) {
|
|
4556
|
+
return part.state === "completed" && getView(part) !== null;
|
|
4557
|
+
}
|
|
4558
|
+
function getConnector(part) {
|
|
4559
|
+
const connector = asRecord(asRecord(part.metadata)?.connector);
|
|
4560
|
+
return connector && typeof connector.label === "string" ? connector : null;
|
|
4561
|
+
}
|
|
4562
|
+
function isCalendar(connector) {
|
|
4563
|
+
return connector?.capability.includes("calendar") ?? false;
|
|
4564
|
+
}
|
|
4565
|
+
function dateFormatter(locale, options) {
|
|
4566
|
+
try {
|
|
4567
|
+
return new Intl.DateTimeFormat(locale ?? void 0, options);
|
|
4568
|
+
} catch {
|
|
4569
|
+
return new Intl.DateTimeFormat(void 0, options);
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
/** All-day values come as "YYYY-MM-DD": read them as local dates, not UTC. */
|
|
4573
|
+
function parseDate(value) {
|
|
4574
|
+
if (!value) return null;
|
|
4575
|
+
const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
4576
|
+
const date = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : new Date(value);
|
|
4577
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
4578
|
+
}
|
|
4579
|
+
function isSameDay(a, b) {
|
|
4580
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
4581
|
+
}
|
|
4582
|
+
function formatMailDate(value, locale) {
|
|
4583
|
+
const date = parseDate(value);
|
|
4584
|
+
if (!date) return value ?? null;
|
|
4585
|
+
return isSameDay(date, /* @__PURE__ */ new Date()) ? dateFormatter(locale, {
|
|
4586
|
+
hour: "2-digit",
|
|
4587
|
+
minute: "2-digit"
|
|
4588
|
+
}).format(date) : dateFormatter(locale, {
|
|
4589
|
+
day: "numeric",
|
|
4590
|
+
month: "short"
|
|
4591
|
+
}).format(date);
|
|
4592
|
+
}
|
|
4593
|
+
function formatFullDate(value, locale) {
|
|
4594
|
+
const date = parseDate(value);
|
|
4595
|
+
if (!date) return value ?? null;
|
|
4596
|
+
return dateFormatter(locale, {
|
|
4597
|
+
dateStyle: "medium",
|
|
4598
|
+
timeStyle: "short"
|
|
4599
|
+
}).format(date);
|
|
4600
|
+
}
|
|
4601
|
+
/** "Ana Pérez <ana@acme.com>" → "Ana Pérez". */
|
|
4602
|
+
function displayName(address) {
|
|
4603
|
+
if (!address) return null;
|
|
4604
|
+
const match = /^\s*"?([^"<]+?)"?\s*<[^>]+>\s*$/.exec(address);
|
|
4605
|
+
return match ? match[1] : address;
|
|
4606
|
+
}
|
|
4607
|
+
function count(copy, n, one, other) {
|
|
4608
|
+
return n === 1 ? one : fillCopy(other, { count: n });
|
|
4609
|
+
}
|
|
4610
|
+
function ExternalAnchor({ href, className, children, label }) {
|
|
4611
|
+
return /* @__PURE__ */ jsx("a", {
|
|
4612
|
+
href,
|
|
4613
|
+
target: "_blank",
|
|
4614
|
+
rel: "noreferrer noopener",
|
|
4615
|
+
"aria-label": label,
|
|
4616
|
+
className: joinClasses("inline-flex items-center gap-1 text-xs font-medium text-neutral-700 hover:text-neutral-950 hover:underline", className),
|
|
4617
|
+
children
|
|
4618
|
+
});
|
|
4619
|
+
}
|
|
4620
|
+
function ShowAllToggle({ total, expanded, onToggle, copy }) {
|
|
4621
|
+
if (total <= COLLAPSED_ITEMS) return null;
|
|
4622
|
+
return /* @__PURE__ */ jsx("button", {
|
|
4623
|
+
type: "button",
|
|
4624
|
+
onClick: onToggle,
|
|
4625
|
+
className: "w-full border-t border-neutral-200 px-3 py-2 text-left text-xs font-medium text-neutral-600 hover:bg-neutral-50 hover:text-neutral-950",
|
|
4626
|
+
children: expanded ? copy.showLess : fillCopy(copy.showAll, { count: total })
|
|
4627
|
+
});
|
|
4628
|
+
}
|
|
4629
|
+
function MailRow({ message, locale, copy }) {
|
|
4630
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4631
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4632
|
+
className: "flex items-baseline gap-2",
|
|
4633
|
+
children: [
|
|
4634
|
+
/* @__PURE__ */ jsx("span", {
|
|
4635
|
+
"aria-label": message.unread ? copy.unread : void 0,
|
|
4636
|
+
className: joinClasses("h-2 w-2 shrink-0 self-center rounded-full", message.unread ? "bg-blue-600" : "bg-transparent")
|
|
4637
|
+
}),
|
|
4638
|
+
/* @__PURE__ */ jsx("span", {
|
|
4639
|
+
className: joinClasses("min-w-0 flex-1 truncate text-sm", message.unread ? "font-semibold text-neutral-950" : "text-neutral-800"),
|
|
4640
|
+
children: displayName(message.from) ?? "—"
|
|
4641
|
+
}),
|
|
4642
|
+
/* @__PURE__ */ jsx("span", {
|
|
4643
|
+
className: "shrink-0 text-xs text-neutral-500",
|
|
4644
|
+
children: formatMailDate(message.date, locale)
|
|
4645
|
+
})
|
|
4646
|
+
]
|
|
4647
|
+
}),
|
|
4648
|
+
/* @__PURE__ */ jsx("p", {
|
|
4649
|
+
className: joinClasses("truncate pl-4 text-sm", message.unread ? "font-medium text-neutral-950" : "text-neutral-700"),
|
|
4650
|
+
children: text(message.subject) ?? copy.noSubject
|
|
4651
|
+
}),
|
|
4652
|
+
text(message.snippet) ? /* @__PURE__ */ jsx("p", {
|
|
4653
|
+
className: "line-clamp-1 pl-4 text-xs text-neutral-500",
|
|
4654
|
+
children: message.snippet
|
|
4655
|
+
}) : null
|
|
4656
|
+
] });
|
|
4657
|
+
const className = "block space-y-0.5 px-3 py-2";
|
|
4658
|
+
return message.link ? /* @__PURE__ */ jsx("a", {
|
|
4659
|
+
href: message.link,
|
|
4660
|
+
target: "_blank",
|
|
4661
|
+
rel: "noreferrer noopener",
|
|
4662
|
+
className: joinClasses(className, "hover:bg-neutral-50"),
|
|
4663
|
+
children: content
|
|
4664
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
4665
|
+
className,
|
|
4666
|
+
children: content
|
|
4667
|
+
});
|
|
4668
|
+
}
|
|
4669
|
+
function MailList({ messages, locale, copy }) {
|
|
4670
|
+
const [expanded, setExpanded] = useState(false);
|
|
4671
|
+
if (messages.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
4672
|
+
className: "px-3 py-3 text-sm text-neutral-600",
|
|
4673
|
+
children: copy.noEmails
|
|
4674
|
+
});
|
|
4675
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("ul", {
|
|
4676
|
+
className: "divide-y divide-neutral-100",
|
|
4677
|
+
children: (expanded ? messages : messages.slice(0, COLLAPSED_ITEMS)).map((message) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(MailRow, {
|
|
4678
|
+
message,
|
|
4679
|
+
locale,
|
|
4680
|
+
copy
|
|
4681
|
+
}) }, message.id))
|
|
4682
|
+
}), /* @__PURE__ */ jsx(ShowAllToggle, {
|
|
4683
|
+
total: messages.length,
|
|
4684
|
+
expanded,
|
|
4685
|
+
onToggle: () => setExpanded((value) => !value),
|
|
4686
|
+
copy
|
|
4687
|
+
})] });
|
|
4688
|
+
}
|
|
4689
|
+
function MailMessageView({ message, connector, locale, copy }) {
|
|
4690
|
+
const [expanded, setExpanded] = useState(false);
|
|
4691
|
+
const body = text(message.body);
|
|
4692
|
+
const long = (body?.length ?? 0) > COLLAPSED_BODY_CHARS;
|
|
4693
|
+
const shownBody = body && long && !expanded ? `${body.slice(0, COLLAPSED_BODY_CHARS).trimEnd()}…` : body;
|
|
4694
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4695
|
+
className: "space-y-3 px-3 py-3",
|
|
4696
|
+
children: [
|
|
4697
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4698
|
+
className: "space-y-1",
|
|
4699
|
+
children: [
|
|
4700
|
+
/* @__PURE__ */ jsx("h4", {
|
|
4701
|
+
className: "text-sm font-semibold text-neutral-950",
|
|
4702
|
+
children: text(message.subject) ?? copy.noSubject
|
|
4703
|
+
}),
|
|
4704
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4705
|
+
className: "flex items-baseline gap-2 text-xs text-neutral-600",
|
|
4706
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4707
|
+
className: "min-w-0 flex-1 truncate font-medium text-neutral-800",
|
|
4708
|
+
children: message.from ?? "—"
|
|
4709
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4710
|
+
className: "shrink-0",
|
|
4711
|
+
children: formatFullDate(message.date, locale)
|
|
4712
|
+
})]
|
|
4713
|
+
}),
|
|
4714
|
+
text(message.to) ? /* @__PURE__ */ jsxs("p", {
|
|
4715
|
+
className: "truncate text-xs text-neutral-500",
|
|
4716
|
+
children: [
|
|
4717
|
+
copy.to,
|
|
4718
|
+
": ",
|
|
4719
|
+
message.to
|
|
4720
|
+
]
|
|
4721
|
+
}) : null,
|
|
4722
|
+
text(message.cc) ? /* @__PURE__ */ jsxs("p", {
|
|
4723
|
+
className: "truncate text-xs text-neutral-500",
|
|
4724
|
+
children: [
|
|
4725
|
+
copy.cc,
|
|
4726
|
+
": ",
|
|
4727
|
+
message.cc
|
|
4728
|
+
]
|
|
4729
|
+
}) : null
|
|
4730
|
+
]
|
|
4731
|
+
}),
|
|
4732
|
+
shownBody ? /* @__PURE__ */ jsx("p", {
|
|
4733
|
+
className: "whitespace-pre-wrap break-words text-sm leading-6 text-neutral-800",
|
|
4734
|
+
children: shownBody
|
|
4735
|
+
}) : null,
|
|
4736
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4737
|
+
className: "flex items-center gap-4",
|
|
4738
|
+
children: [long ? /* @__PURE__ */ jsx("button", {
|
|
4739
|
+
type: "button",
|
|
4740
|
+
onClick: () => setExpanded((value) => !value),
|
|
4741
|
+
className: "text-xs font-medium text-neutral-600 hover:text-neutral-950",
|
|
4742
|
+
children: expanded ? copy.showLess : copy.showMore
|
|
4743
|
+
}) : null, message.link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
4744
|
+
href: message.link,
|
|
4745
|
+
children: [fillCopy(copy.openIn, { service: connector?.label ?? "" }), /* @__PURE__ */ jsx(ExternalLink, {
|
|
4746
|
+
className: "h-3 w-3",
|
|
4747
|
+
"aria-hidden": "true"
|
|
4748
|
+
})]
|
|
4749
|
+
}) : null]
|
|
4750
|
+
})
|
|
4751
|
+
]
|
|
4752
|
+
});
|
|
4753
|
+
}
|
|
4754
|
+
function eventTime(event, locale, copy) {
|
|
4755
|
+
if (event.all_day) return copy.allDay;
|
|
4756
|
+
const start = parseDate(event.start);
|
|
4757
|
+
const end = parseDate(event.end);
|
|
4758
|
+
if (!start) return null;
|
|
4759
|
+
const time = dateFormatter(locale, {
|
|
4760
|
+
hour: "2-digit",
|
|
4761
|
+
minute: "2-digit"
|
|
4762
|
+
});
|
|
4763
|
+
return end ? `${time.format(start)} – ${time.format(end)}` : time.format(start);
|
|
4764
|
+
}
|
|
4765
|
+
function groupByDay(events) {
|
|
4766
|
+
const groups = [];
|
|
4767
|
+
for (const event of events) {
|
|
4768
|
+
const day = parseDate(event.start);
|
|
4769
|
+
const last = groups[groups.length - 1];
|
|
4770
|
+
if (last && (last.day && day && isSameDay(last.day, day) || !last.day && !day)) last.events.push(event);
|
|
4771
|
+
else groups.push({
|
|
4772
|
+
day,
|
|
4773
|
+
events: [event]
|
|
4774
|
+
});
|
|
4775
|
+
}
|
|
4776
|
+
return groups;
|
|
4777
|
+
}
|
|
4778
|
+
function EventRow({ event, locale, copy }) {
|
|
4779
|
+
const attendees = event.attendees?.length ?? 0;
|
|
4780
|
+
const details = [text(event.location), attendees > 0 ? count(copy, attendees, copy.attendeesOne, copy.attendeesOther) : null].filter(Boolean);
|
|
4781
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
4782
|
+
className: "flex gap-3 px-3 py-2",
|
|
4783
|
+
children: [
|
|
4784
|
+
/* @__PURE__ */ jsx("span", {
|
|
4785
|
+
className: "w-24 shrink-0 pt-0.5 text-xs tabular-nums text-neutral-600",
|
|
4786
|
+
children: eventTime(event, locale, copy)
|
|
4787
|
+
}),
|
|
4788
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4789
|
+
className: "min-w-0 flex-1 space-y-0.5",
|
|
4790
|
+
children: [event.link ? /* @__PURE__ */ jsx("a", {
|
|
4791
|
+
href: event.link,
|
|
4792
|
+
target: "_blank",
|
|
4793
|
+
rel: "noreferrer noopener",
|
|
4794
|
+
className: "block truncate text-sm font-medium text-neutral-950 hover:underline",
|
|
4795
|
+
children: text(event.title) ?? copy.noSubject
|
|
4796
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
4797
|
+
className: "truncate text-sm font-medium text-neutral-950",
|
|
4798
|
+
children: text(event.title) ?? copy.noSubject
|
|
4799
|
+
}), details.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
4800
|
+
className: "truncate text-xs text-neutral-500",
|
|
4801
|
+
children: details.join(" · ")
|
|
4802
|
+
}) : null]
|
|
4803
|
+
}),
|
|
4804
|
+
event.online_meeting_url ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
4805
|
+
href: event.online_meeting_url,
|
|
4806
|
+
className: "shrink-0 self-start",
|
|
4807
|
+
children: [/* @__PURE__ */ jsx(Video, {
|
|
4808
|
+
className: "h-3.5 w-3.5",
|
|
4809
|
+
"aria-hidden": "true"
|
|
4810
|
+
}), copy.joinMeeting]
|
|
4811
|
+
}) : null
|
|
4812
|
+
]
|
|
4813
|
+
});
|
|
4814
|
+
}
|
|
4815
|
+
function Agenda({ events, locale, copy }) {
|
|
4816
|
+
const [expanded, setExpanded] = useState(false);
|
|
4817
|
+
if (events.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
4818
|
+
className: "px-3 py-3 text-sm text-neutral-600",
|
|
4819
|
+
children: copy.noEvents
|
|
4820
|
+
});
|
|
4821
|
+
const visible = expanded ? events : events.slice(0, COLLAPSED_ITEMS);
|
|
4822
|
+
const dayFormat = dateFormatter(locale, {
|
|
4823
|
+
weekday: "long",
|
|
4824
|
+
day: "numeric",
|
|
4825
|
+
month: "long"
|
|
4826
|
+
});
|
|
4827
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
4828
|
+
className: "divide-y divide-neutral-100",
|
|
4829
|
+
children: groupByDay(visible).map((group, index) => /* @__PURE__ */ jsxs("section", { children: [group.day ? /* @__PURE__ */ jsx("h4", {
|
|
4830
|
+
className: "bg-neutral-50 px-3 py-1 text-xs font-medium capitalize text-neutral-600",
|
|
4831
|
+
children: dayFormat.format(group.day)
|
|
4832
|
+
}) : null, /* @__PURE__ */ jsx("ul", {
|
|
4833
|
+
className: "divide-y divide-neutral-100",
|
|
4834
|
+
children: group.events.map((event) => /* @__PURE__ */ jsx(EventRow, {
|
|
4835
|
+
event,
|
|
4836
|
+
locale,
|
|
4837
|
+
copy
|
|
4838
|
+
}, event.id))
|
|
4839
|
+
})] }, group.day?.toISOString() ?? `undated-${index}`))
|
|
4840
|
+
}), /* @__PURE__ */ jsx(ShowAllToggle, {
|
|
4841
|
+
total: events.length,
|
|
4842
|
+
expanded,
|
|
4843
|
+
onToggle: () => setExpanded((value) => !value),
|
|
4844
|
+
copy
|
|
4845
|
+
})] });
|
|
4846
|
+
}
|
|
4847
|
+
function CollapsibleBody({ body, copy }) {
|
|
4848
|
+
const [expanded, setExpanded] = useState(false);
|
|
4849
|
+
if (!body) return null;
|
|
4850
|
+
const long = body.length > COLLAPSED_BODY_CHARS;
|
|
4851
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4852
|
+
className: "space-y-1",
|
|
4853
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4854
|
+
className: "whitespace-pre-wrap break-words text-sm leading-6 text-neutral-800",
|
|
4855
|
+
children: long && !expanded ? `${body.slice(0, COLLAPSED_BODY_CHARS).trimEnd()}…` : body
|
|
4856
|
+
}), long ? /* @__PURE__ */ jsx("button", {
|
|
4857
|
+
type: "button",
|
|
4858
|
+
onClick: () => setExpanded((value) => !value),
|
|
4859
|
+
className: "text-xs font-medium text-neutral-600 hover:text-neutral-950",
|
|
4860
|
+
children: expanded ? copy.showLess : copy.showMore
|
|
4861
|
+
}) : null]
|
|
4862
|
+
});
|
|
4863
|
+
}
|
|
4864
|
+
function DraftView({ view, copy }) {
|
|
4865
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4866
|
+
className: "space-y-2 px-3 py-3",
|
|
4867
|
+
children: [
|
|
4868
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4869
|
+
className: "space-y-1",
|
|
4870
|
+
children: [
|
|
4871
|
+
/* @__PURE__ */ jsx("p", {
|
|
4872
|
+
className: "text-sm font-medium text-neutral-950",
|
|
4873
|
+
children: copy.draftSaved
|
|
4874
|
+
}),
|
|
4875
|
+
view.subject ? /* @__PURE__ */ jsx("p", {
|
|
4876
|
+
className: "truncate text-sm text-neutral-800",
|
|
4877
|
+
children: view.subject
|
|
4878
|
+
}) : null,
|
|
4879
|
+
view.to.length > 0 ? /* @__PURE__ */ jsxs("p", {
|
|
4880
|
+
className: "truncate text-xs text-neutral-500",
|
|
4881
|
+
children: [
|
|
4882
|
+
copy.to,
|
|
4883
|
+
": ",
|
|
4884
|
+
view.to.join(", ")
|
|
4885
|
+
]
|
|
4886
|
+
}) : null
|
|
4887
|
+
]
|
|
4888
|
+
}),
|
|
4889
|
+
/* @__PURE__ */ jsx(CollapsibleBody, {
|
|
4890
|
+
body: view.body,
|
|
4891
|
+
copy
|
|
4892
|
+
}),
|
|
4893
|
+
view.link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
4894
|
+
href: view.link,
|
|
4895
|
+
children: [copy.openDraft, /* @__PURE__ */ jsx(ExternalLink, {
|
|
4896
|
+
className: "h-3 w-3",
|
|
4897
|
+
"aria-hidden": "true"
|
|
4898
|
+
})]
|
|
4899
|
+
}) : null
|
|
4900
|
+
]
|
|
4901
|
+
});
|
|
4902
|
+
}
|
|
4903
|
+
function strings(value) {
|
|
4904
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
4905
|
+
}
|
|
4906
|
+
function Field({ label, children }) {
|
|
4907
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4908
|
+
className: "flex gap-3 text-sm",
|
|
4909
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
4910
|
+
className: "w-24 shrink-0 text-xs leading-5 text-neutral-500",
|
|
4911
|
+
children: label
|
|
4912
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
4913
|
+
className: "min-w-0 flex-1 break-words text-neutral-900",
|
|
4914
|
+
children
|
|
4915
|
+
})]
|
|
4916
|
+
});
|
|
4917
|
+
}
|
|
4918
|
+
function PendingMailView({ pending, copy }) {
|
|
4919
|
+
const mail = pending.action;
|
|
4920
|
+
const to = strings(mail.to);
|
|
4921
|
+
const cc = strings(mail.cc);
|
|
4922
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4923
|
+
className: "space-y-3 px-3 py-3",
|
|
4924
|
+
children: [
|
|
4925
|
+
/* @__PURE__ */ jsxs("dl", {
|
|
4926
|
+
className: "space-y-1.5",
|
|
4927
|
+
children: [
|
|
4928
|
+
/* @__PURE__ */ jsx(Field, {
|
|
4929
|
+
label: copy.to,
|
|
4930
|
+
children: to.join(", ") || "—"
|
|
4931
|
+
}),
|
|
4932
|
+
cc.length > 0 ? /* @__PURE__ */ jsx(Field, {
|
|
4933
|
+
label: copy.cc,
|
|
4934
|
+
children: cc.join(", ")
|
|
4935
|
+
}) : null,
|
|
4936
|
+
/* @__PURE__ */ jsx(Field, {
|
|
4937
|
+
label: copy.subject,
|
|
4938
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
4939
|
+
className: "font-medium",
|
|
4940
|
+
children: text(mail.subject) ?? copy.noSubject
|
|
4941
|
+
})
|
|
4942
|
+
})
|
|
4943
|
+
]
|
|
4944
|
+
}),
|
|
4945
|
+
text(mail.reply_to_message_id) ? /* @__PURE__ */ jsx("p", {
|
|
4946
|
+
className: "text-xs text-neutral-500",
|
|
4947
|
+
children: copy.replyInThread
|
|
4948
|
+
}) : null,
|
|
4949
|
+
/* @__PURE__ */ jsx("div", {
|
|
4950
|
+
className: "rounded-md border border-neutral-200 bg-neutral-50 px-3 py-2",
|
|
4951
|
+
children: /* @__PURE__ */ jsx(CollapsibleBody, {
|
|
4952
|
+
body: text(mail.body),
|
|
4953
|
+
copy
|
|
4954
|
+
})
|
|
4955
|
+
})
|
|
4956
|
+
]
|
|
4957
|
+
});
|
|
4958
|
+
}
|
|
4959
|
+
function formatRange(start, end, allDay, locale, copy) {
|
|
4960
|
+
const from = parseDate(text(start));
|
|
4961
|
+
if (!from) return null;
|
|
4962
|
+
const day = dateFormatter(locale, {
|
|
4963
|
+
weekday: "short",
|
|
4964
|
+
day: "numeric",
|
|
4965
|
+
month: "short"
|
|
4966
|
+
}).format(from);
|
|
4967
|
+
if (allDay) return `${day} · ${copy.allDay}`;
|
|
4968
|
+
const time = dateFormatter(locale, {
|
|
4969
|
+
hour: "2-digit",
|
|
4970
|
+
minute: "2-digit"
|
|
4971
|
+
});
|
|
4972
|
+
const to = parseDate(text(end));
|
|
4973
|
+
return to ? `${day} · ${time.format(from)} – ${time.format(to)}` : `${day} · ${time.format(from)}`;
|
|
4974
|
+
}
|
|
4975
|
+
/** Old value struck through next to the new one; only the new one if unknown. */
|
|
4976
|
+
function Change({ before, after }) {
|
|
4977
|
+
if (before === null || before === void 0 || before === after) return /* @__PURE__ */ jsx(Fragment, { children: after });
|
|
4978
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
4979
|
+
className: "flex flex-wrap items-baseline gap-x-2",
|
|
4980
|
+
children: [
|
|
4981
|
+
/* @__PURE__ */ jsx("span", {
|
|
4982
|
+
className: "text-neutral-500 line-through",
|
|
4983
|
+
children: before
|
|
4984
|
+
}),
|
|
4985
|
+
/* @__PURE__ */ jsx("span", {
|
|
4986
|
+
"aria-hidden": "true",
|
|
4987
|
+
children: "→"
|
|
4988
|
+
}),
|
|
4989
|
+
/* @__PURE__ */ jsx("span", { children: after })
|
|
4990
|
+
]
|
|
4991
|
+
});
|
|
4992
|
+
}
|
|
4993
|
+
function PendingEventView({ operation, pending, locale, copy }) {
|
|
4994
|
+
const action = pending.action;
|
|
4995
|
+
const current = asRecord(pending.current);
|
|
4996
|
+
const has = (key) => action[key] !== void 0 && action[key] !== null;
|
|
4997
|
+
if (operation === "delete_event") return /* @__PURE__ */ jsxs("div", {
|
|
4998
|
+
className: "space-y-1 px-3 py-3",
|
|
4999
|
+
children: [
|
|
5000
|
+
/* @__PURE__ */ jsx("p", {
|
|
5001
|
+
className: "text-xs font-medium uppercase tracking-wide text-rose-700",
|
|
5002
|
+
children: copy.deleteEvent
|
|
5003
|
+
}),
|
|
5004
|
+
/* @__PURE__ */ jsx("p", {
|
|
5005
|
+
className: "text-sm font-medium text-neutral-900 line-through",
|
|
5006
|
+
children: text(current?.title) ?? text(action.event_id) ?? copy.noSubject
|
|
5007
|
+
}),
|
|
5008
|
+
current ? /* @__PURE__ */ jsx("p", {
|
|
5009
|
+
className: "text-xs text-neutral-500",
|
|
5010
|
+
children: formatRange(current.start, current.end, Boolean(current.all_day), locale, copy)
|
|
5011
|
+
}) : null,
|
|
5012
|
+
(current?.attendees?.length ?? 0) > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5013
|
+
className: "pt-1 text-xs text-neutral-600",
|
|
5014
|
+
children: copy.attendeesNotified
|
|
5015
|
+
}) : null
|
|
5016
|
+
]
|
|
5017
|
+
});
|
|
5018
|
+
const isUpdate = operation === "update_event";
|
|
5019
|
+
const before = (key) => isUpdate && current ? current[key] : null;
|
|
5020
|
+
const attendees = strings(action.attendees);
|
|
5021
|
+
const timesChanged = has("start") || has("end");
|
|
5022
|
+
const newWhen = formatRange(action.start ?? current?.start, action.end ?? current?.end, Boolean(current?.all_day) && !timesChanged, locale, copy);
|
|
5023
|
+
const oldWhen = isUpdate && current && timesChanged ? formatRange(current.start, current.end, Boolean(current.all_day), locale, copy) : null;
|
|
5024
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5025
|
+
className: "space-y-2 px-3 py-3",
|
|
5026
|
+
children: [
|
|
5027
|
+
/* @__PURE__ */ jsx("p", {
|
|
5028
|
+
className: "text-xs font-medium uppercase tracking-wide text-neutral-500",
|
|
5029
|
+
children: isUpdate ? copy.eventChange : copy.newEvent
|
|
5030
|
+
}),
|
|
5031
|
+
/* @__PURE__ */ jsxs("dl", {
|
|
5032
|
+
className: "space-y-1.5",
|
|
5033
|
+
children: [
|
|
5034
|
+
has("title") || !isUpdate ? /* @__PURE__ */ jsx(Field, {
|
|
5035
|
+
label: copy.title,
|
|
5036
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5037
|
+
className: "font-medium",
|
|
5038
|
+
children: /* @__PURE__ */ jsx(Change, {
|
|
5039
|
+
before: text(before("title")),
|
|
5040
|
+
after: text(action.title) ?? copy.noSubject
|
|
5041
|
+
})
|
|
5042
|
+
})
|
|
5043
|
+
}) : current ? /* @__PURE__ */ jsx(Field, {
|
|
5044
|
+
label: copy.title,
|
|
5045
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5046
|
+
className: "font-medium",
|
|
5047
|
+
children: text(current.title)
|
|
5048
|
+
})
|
|
5049
|
+
}) : null,
|
|
5050
|
+
newWhen && (timesChanged || !isUpdate) ? /* @__PURE__ */ jsx(Field, {
|
|
5051
|
+
label: copy.when,
|
|
5052
|
+
children: /* @__PURE__ */ jsx(Change, {
|
|
5053
|
+
before: oldWhen,
|
|
5054
|
+
after: newWhen
|
|
5055
|
+
})
|
|
5056
|
+
}) : null,
|
|
5057
|
+
has("location") ? /* @__PURE__ */ jsx(Field, {
|
|
5058
|
+
label: copy.location,
|
|
5059
|
+
children: /* @__PURE__ */ jsx(Change, {
|
|
5060
|
+
before: text(before("location")),
|
|
5061
|
+
after: text(action.location)
|
|
5062
|
+
})
|
|
5063
|
+
}) : null,
|
|
5064
|
+
has("attendees") ? /* @__PURE__ */ jsx(Field, {
|
|
5065
|
+
label: copy.attendees,
|
|
5066
|
+
children: /* @__PURE__ */ jsx(Change, {
|
|
5067
|
+
before: strings(before("attendees")).join(", ") || null,
|
|
5068
|
+
after: attendees.join(", ") || "—"
|
|
5069
|
+
})
|
|
5070
|
+
}) : null,
|
|
5071
|
+
has("description") ? /* @__PURE__ */ jsx(Field, {
|
|
5072
|
+
label: copy.description,
|
|
5073
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5074
|
+
className: "whitespace-pre-wrap",
|
|
5075
|
+
children: text(action.description)
|
|
5076
|
+
})
|
|
5077
|
+
}) : null
|
|
5078
|
+
]
|
|
5079
|
+
}),
|
|
5080
|
+
attendees.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5081
|
+
className: "text-xs text-neutral-600",
|
|
5082
|
+
children: copy.attendeesNotified
|
|
5083
|
+
}) : null
|
|
5084
|
+
]
|
|
5085
|
+
});
|
|
5086
|
+
}
|
|
5087
|
+
function PendingBadge({ copy }) {
|
|
5088
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
5089
|
+
className: "ml-auto inline-flex shrink-0 items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 font-medium text-amber-800",
|
|
5090
|
+
children: [/* @__PURE__ */ jsx(Clock, {
|
|
5091
|
+
className: "h-3 w-3",
|
|
5092
|
+
"aria-hidden": "true"
|
|
5093
|
+
}), copy.awaitingConfirmation]
|
|
5094
|
+
});
|
|
5095
|
+
}
|
|
5096
|
+
function PendingFooter({ copy }) {
|
|
5097
|
+
return /* @__PURE__ */ jsx("p", {
|
|
5098
|
+
className: "border-t border-amber-100 bg-amber-50/60 px-3 py-2 text-xs text-neutral-700",
|
|
5099
|
+
children: copy.confirmHint
|
|
5100
|
+
});
|
|
5101
|
+
}
|
|
5102
|
+
function headerCount(view, copy) {
|
|
5103
|
+
if (view.kind === "mail-list") return count(copy, view.messages.length, copy.emailCountOne, copy.emailCountOther);
|
|
5104
|
+
if (view.kind === "events") return count(copy, view.events.length, copy.eventCountOne, copy.eventCountOther);
|
|
5105
|
+
return null;
|
|
5106
|
+
}
|
|
5107
|
+
function ToolResultPersonalConnectorCard({ part, locale, className }) {
|
|
5108
|
+
const view = getView(part);
|
|
5109
|
+
if (!view) return null;
|
|
5110
|
+
const copy = getPersonalConnectorCopy(locale);
|
|
5111
|
+
const connector = getConnector(part);
|
|
5112
|
+
const Icon = isCalendar(connector) ? CalendarDays : Mail;
|
|
5113
|
+
const total = headerCount(view, copy);
|
|
5114
|
+
const isPending = view.kind === "pending-mail" || view.kind === "pending-event";
|
|
5115
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
5116
|
+
className: joinClasses("plai-tool-result-personal-connector-card overflow-hidden rounded-lg border border-neutral-200 bg-white text-neutral-950", className),
|
|
5117
|
+
"data-tool-call-id": part.id,
|
|
5118
|
+
"data-tool-call-state": part.state,
|
|
5119
|
+
"data-connector-action": view.kind,
|
|
5120
|
+
children: [
|
|
5121
|
+
/* @__PURE__ */ jsxs("header", {
|
|
5122
|
+
className: "flex items-center gap-2 border-b border-neutral-200 px-3 py-2 text-xs text-neutral-600",
|
|
5123
|
+
children: [
|
|
5124
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
5125
|
+
className: "h-4 w-4 shrink-0 text-neutral-700",
|
|
5126
|
+
"aria-hidden": "true"
|
|
5127
|
+
}),
|
|
5128
|
+
/* @__PURE__ */ jsx("span", {
|
|
5129
|
+
className: "shrink-0 font-medium text-neutral-900",
|
|
5130
|
+
children: connector?.label
|
|
5131
|
+
}),
|
|
5132
|
+
connector?.account_email ? /* @__PURE__ */ jsx("span", {
|
|
5133
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
5134
|
+
children: connector.account_email
|
|
5135
|
+
}) : null,
|
|
5136
|
+
isPending ? /* @__PURE__ */ jsx(PendingBadge, { copy }) : total ? /* @__PURE__ */ jsx("span", {
|
|
5137
|
+
className: "ml-auto shrink-0",
|
|
5138
|
+
children: total
|
|
5139
|
+
}) : null
|
|
5140
|
+
]
|
|
5141
|
+
}),
|
|
5142
|
+
view.kind === "mail-list" ? /* @__PURE__ */ jsx(MailList, {
|
|
5143
|
+
messages: view.messages,
|
|
5144
|
+
locale,
|
|
5145
|
+
copy
|
|
5146
|
+
}) : view.kind === "mail" ? /* @__PURE__ */ jsx(MailMessageView, {
|
|
5147
|
+
message: view.message,
|
|
5148
|
+
connector,
|
|
5149
|
+
locale,
|
|
5150
|
+
copy
|
|
5151
|
+
}) : view.kind === "events" ? /* @__PURE__ */ jsx(Agenda, {
|
|
5152
|
+
events: view.events,
|
|
5153
|
+
locale,
|
|
5154
|
+
copy
|
|
5155
|
+
}) : view.kind === "pending-mail" ? /* @__PURE__ */ jsx(PendingMailView, {
|
|
5156
|
+
pending: view.pending,
|
|
5157
|
+
copy
|
|
5158
|
+
}) : view.kind === "pending-event" ? /* @__PURE__ */ jsx(PendingEventView, {
|
|
5159
|
+
operation: view.operation,
|
|
5160
|
+
pending: view.pending,
|
|
5161
|
+
locale,
|
|
5162
|
+
copy
|
|
5163
|
+
}) : /* @__PURE__ */ jsx(DraftView, {
|
|
5164
|
+
view,
|
|
5165
|
+
copy
|
|
5166
|
+
}),
|
|
5167
|
+
isPending ? /* @__PURE__ */ jsx(PendingFooter, { copy }) : null
|
|
5168
|
+
]
|
|
5169
|
+
});
|
|
5170
|
+
}
|
|
5171
|
+
const DONE_LABELS = {
|
|
5172
|
+
send: "emailSent",
|
|
5173
|
+
create_event: "eventCreated",
|
|
5174
|
+
update_event: "eventUpdated",
|
|
5175
|
+
delete_event: "eventDeleted"
|
|
5176
|
+
};
|
|
5177
|
+
function getConfirmedActions(part) {
|
|
5178
|
+
const actions = asRecord(part.metadata)?.actions;
|
|
5179
|
+
return Array.isArray(actions) ? actions.filter((action) => typeof asRecord(action)?.action_id === "string") : [];
|
|
5180
|
+
}
|
|
5181
|
+
/** Whether the confirmation result can be shown as a list of outcomes. */
|
|
5182
|
+
function hasToolConfirmationView(part) {
|
|
5183
|
+
return part.state !== "pending" && getConfirmedActions(part).length > 0;
|
|
5184
|
+
}
|
|
5185
|
+
function ConfirmedActionRow({ action, copy }) {
|
|
5186
|
+
const metadata = asRecord(action.metadata);
|
|
5187
|
+
const connector = asRecord(metadata?.connector);
|
|
5188
|
+
const operation = typeof metadata?.action === "string" ? metadata.action : "";
|
|
5189
|
+
const doneKey = DONE_LABELS[operation];
|
|
5190
|
+
const failed = action.status === "failed";
|
|
5191
|
+
const label = doneKey ? copy[doneKey] : fillCopy(copy.actionDone, { tool: action.tool_name });
|
|
5192
|
+
const link = text(asRecord(metadata?.result)?.link);
|
|
5193
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
5194
|
+
className: "flex items-start gap-2 px-3 py-2",
|
|
5195
|
+
children: [
|
|
5196
|
+
failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
5197
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-rose-600",
|
|
5198
|
+
"aria-hidden": "true"
|
|
5199
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5200
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-emerald-600",
|
|
5201
|
+
"aria-hidden": "true"
|
|
5202
|
+
}),
|
|
5203
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5204
|
+
className: "min-w-0 flex-1 space-y-0.5",
|
|
5205
|
+
children: [
|
|
5206
|
+
/* @__PURE__ */ jsx("p", {
|
|
5207
|
+
className: "text-sm font-medium text-neutral-950",
|
|
5208
|
+
children: failed ? `${copy.actionFailed}: ${label}` : label
|
|
5209
|
+
}),
|
|
5210
|
+
connector ? /* @__PURE__ */ jsxs("div", {
|
|
5211
|
+
className: "flex items-center gap-2 truncate text-xs text-neutral-500",
|
|
5212
|
+
children: [connector.label, connector.account_email ? /* @__PURE__ */ jsx("span", {
|
|
5213
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
5214
|
+
children: connector.account_email
|
|
5215
|
+
}) : null]
|
|
5216
|
+
}) : null,
|
|
5217
|
+
failed && text(action.error) ? /* @__PURE__ */ jsx("p", {
|
|
5218
|
+
className: "line-clamp-2 text-xs text-rose-700",
|
|
5219
|
+
children: action.error
|
|
5220
|
+
}) : null
|
|
5221
|
+
]
|
|
5222
|
+
}),
|
|
5223
|
+
!failed && link ? /* @__PURE__ */ jsx(ExternalAnchor, {
|
|
5224
|
+
href: link,
|
|
5225
|
+
className: "shrink-0",
|
|
5226
|
+
children: operation === "send" ? copy.openEmail : copy.openEvent
|
|
5227
|
+
}) : null
|
|
5228
|
+
]
|
|
5229
|
+
});
|
|
5230
|
+
}
|
|
5231
|
+
function ToolResultToolConfirmationCard({ part, locale, className }) {
|
|
5232
|
+
const actions = getConfirmedActions(part);
|
|
5233
|
+
if (actions.length === 0) return null;
|
|
5234
|
+
const copy = getPersonalConnectorCopy(locale);
|
|
5235
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
5236
|
+
className: joinClasses("plai-tool-result-tool-confirmation-card divide-y divide-neutral-100 overflow-hidden rounded-lg border border-neutral-200 bg-white text-neutral-950", className),
|
|
5237
|
+
"data-tool-call-id": part.id,
|
|
5238
|
+
"data-tool-call-state": part.state,
|
|
5239
|
+
children: actions.map((action) => /* @__PURE__ */ jsx(ConfirmedActionRow, {
|
|
5240
|
+
action,
|
|
5241
|
+
copy
|
|
5242
|
+
}, action.action_id))
|
|
5243
|
+
});
|
|
5244
|
+
}
|
|
5245
|
+
function getPendingConfirmation(part) {
|
|
5246
|
+
const pending = asRecord(asRecord(part.metadata)?.pending_confirmation);
|
|
5247
|
+
return pending && asRecord(pending.action) ? pending : null;
|
|
5248
|
+
}
|
|
5249
|
+
function formatValue(value) {
|
|
5250
|
+
if (typeof value === "string") return value;
|
|
5251
|
+
return JSON.stringify(value, null, 2);
|
|
5252
|
+
}
|
|
5253
|
+
/** Generic preview of a held tool call: its name and the exact arguments. */
|
|
5254
|
+
function ToolResultPendingConfirmationCard({ part, locale, className }) {
|
|
5255
|
+
const pending = getPendingConfirmation(part);
|
|
5256
|
+
if (!pending) return null;
|
|
5257
|
+
const copy = getPersonalConnectorCopy(locale);
|
|
5258
|
+
const entries = Object.entries(pending.action).filter(([key, value]) => key !== "operation" && value !== null && value !== void 0);
|
|
5259
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
5260
|
+
className: joinClasses("plai-tool-result-pending-confirmation-card overflow-hidden rounded-lg border border-neutral-200 bg-white text-neutral-950", className),
|
|
5261
|
+
"data-tool-call-id": part.id,
|
|
5262
|
+
"data-tool-call-state": part.state,
|
|
5263
|
+
children: [
|
|
5264
|
+
/* @__PURE__ */ jsxs("header", {
|
|
5265
|
+
className: "flex items-center gap-2 border-b border-neutral-200 px-3 py-2 text-xs text-neutral-600",
|
|
5266
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5267
|
+
className: "truncate font-mono font-medium text-neutral-900",
|
|
5268
|
+
children: part.name
|
|
5269
|
+
}), /* @__PURE__ */ jsx(PendingBadge, { copy })]
|
|
5270
|
+
}),
|
|
5271
|
+
entries.length > 0 ? /* @__PURE__ */ jsx("dl", {
|
|
5272
|
+
className: "space-y-1.5 px-3 py-3",
|
|
5273
|
+
children: entries.map(([key, value]) => /* @__PURE__ */ jsx(Field, {
|
|
5274
|
+
label: key,
|
|
5275
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5276
|
+
className: "whitespace-pre-wrap font-mono text-xs",
|
|
5277
|
+
children: formatValue(value)
|
|
5278
|
+
})
|
|
5279
|
+
}, key))
|
|
5280
|
+
}) : null,
|
|
5281
|
+
/* @__PURE__ */ jsx(PendingFooter, { copy })
|
|
5282
|
+
]
|
|
5283
|
+
});
|
|
5284
|
+
}
|
|
5285
|
+
|
|
3901
5286
|
//#endregion
|
|
3902
5287
|
//#region src/components/tool-result-workflow-dispatch-card.tsx
|
|
3903
5288
|
function parseResult(value) {
|
|
@@ -3948,7 +5333,7 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
3948
5333
|
children: copy.workflow
|
|
3949
5334
|
}),
|
|
3950
5335
|
/* @__PURE__ */ jsx("span", {
|
|
3951
|
-
className: "min-w-0 truncate text-neutral-
|
|
5336
|
+
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
3952
5337
|
children: workflowName
|
|
3953
5338
|
}),
|
|
3954
5339
|
/* @__PURE__ */ jsxs("span", {
|
|
@@ -4039,7 +5424,9 @@ const TOOL_USE_ACTIONS = {
|
|
|
4039
5424
|
mcp_tool: "request",
|
|
4040
5425
|
office_documents: "documents",
|
|
4041
5426
|
perplexity: "web",
|
|
5427
|
+
personal_connector: "tool",
|
|
4042
5428
|
structured_datasource: "query",
|
|
5429
|
+
tool_confirmation: "tool",
|
|
4043
5430
|
workflow_dispatch: "workflow",
|
|
4044
5431
|
unknown: "tool"
|
|
4045
5432
|
};
|
|
@@ -4155,7 +5542,35 @@ const TOOL_USE_TRANSLATIONS = {
|
|
|
4155
5542
|
workflow: "Executando o fluxo {{toolName}}"
|
|
4156
5543
|
}
|
|
4157
5544
|
};
|
|
5545
|
+
const PERSONAL_CONNECTOR_SERVICES = {
|
|
5546
|
+
gmail: "Gmail",
|
|
5547
|
+
google_calendar: "Google Calendar",
|
|
5548
|
+
outlook_mail: "Outlook Mail",
|
|
5549
|
+
outlook_calendar: "Outlook Calendar"
|
|
5550
|
+
};
|
|
5551
|
+
const PERSONAL_CONNECTOR_ACTIONS = {
|
|
5552
|
+
search: "searchingMail",
|
|
5553
|
+
read: "readingMail",
|
|
5554
|
+
list_events: "checkingCalendar",
|
|
5555
|
+
create_draft: "savingDraft",
|
|
5556
|
+
send: "preparingMail",
|
|
5557
|
+
create_event: "preparingEvent",
|
|
5558
|
+
update_event: "preparingEvent",
|
|
5559
|
+
delete_event: "preparingEvent"
|
|
5560
|
+
};
|
|
5561
|
+
const PERSONAL_CONNECTOR_TOOL_NAME = /^(gmail|google_calendar|outlook_mail|outlook_calendar)_(.+?)(?:_\d+)?$/;
|
|
5562
|
+
function getPersonalConnectorLabel(name, locale) {
|
|
5563
|
+
const match = PERSONAL_CONNECTOR_TOOL_NAME.exec(name);
|
|
5564
|
+
const key = match ? PERSONAL_CONNECTOR_ACTIONS[match[2]] : void 0;
|
|
5565
|
+
if (!match || !key) return null;
|
|
5566
|
+
return fillCopy(getPersonalConnectorCopy(locale)[key], { service: PERSONAL_CONNECTOR_SERVICES[match[1]] });
|
|
5567
|
+
}
|
|
4158
5568
|
function getToolUseLabel(part, locale) {
|
|
5569
|
+
if (part.toolType === "personal_connector") {
|
|
5570
|
+
const label = getPersonalConnectorLabel(part.name, locale);
|
|
5571
|
+
if (label) return label;
|
|
5572
|
+
}
|
|
5573
|
+
if (part.toolType === "tool_confirmation") return getPersonalConnectorCopy(locale).runningConfirmed;
|
|
4159
5574
|
const action = part.toolType ? TOOL_USE_ACTIONS[part.toolType] ?? "tool" : "tool";
|
|
4160
5575
|
return TOOL_USE_TRANSLATIONS[getSupportedToolLocale(locale)][action].replaceAll("{{toolName}}", part.name);
|
|
4161
5576
|
}
|
|
@@ -4209,11 +5624,21 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
4209
5624
|
locale,
|
|
4210
5625
|
className
|
|
4211
5626
|
});
|
|
5627
|
+
if (part.toolType === "tool_confirmation" && hasToolConfirmationView(part)) return /* @__PURE__ */ jsx(ToolResultToolConfirmationCard, {
|
|
5628
|
+
part,
|
|
5629
|
+
locale,
|
|
5630
|
+
className
|
|
5631
|
+
});
|
|
4212
5632
|
if (part.state === "error") return /* @__PURE__ */ jsx(ToolError, {
|
|
4213
5633
|
part,
|
|
4214
5634
|
locale,
|
|
4215
5635
|
className
|
|
4216
5636
|
});
|
|
5637
|
+
if (part.toolType !== "personal_connector" && getPendingConfirmation(part)) return /* @__PURE__ */ jsx(ToolResultPendingConfirmationCard, {
|
|
5638
|
+
part,
|
|
5639
|
+
locale,
|
|
5640
|
+
className
|
|
5641
|
+
});
|
|
4217
5642
|
const officeMediaFiles = getOfficeDocumentMediaFiles(part);
|
|
4218
5643
|
const datasourceResources = getDatasourceResources$1(part);
|
|
4219
5644
|
if (part.toolType === "email_send") return /* @__PURE__ */ jsx(ToolResultEmailSendCard, {
|
|
@@ -4252,6 +5677,11 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
4252
5677
|
locale,
|
|
4253
5678
|
className
|
|
4254
5679
|
});
|
|
5680
|
+
if (part.toolType === "personal_connector" && hasPersonalConnectorView(part)) return /* @__PURE__ */ jsx(ToolResultPersonalConnectorCard, {
|
|
5681
|
+
part,
|
|
5682
|
+
locale,
|
|
5683
|
+
className
|
|
5684
|
+
});
|
|
4255
5685
|
if (part.toolType === "workflow_dispatch") return /* @__PURE__ */ jsx(ToolResultWorkflowDispatchCard, {
|
|
4256
5686
|
part,
|
|
4257
5687
|
locale,
|
|
@@ -4280,7 +5710,7 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
4280
5710
|
className: "text-sm font-semibold text-slate-900",
|
|
4281
5711
|
children: part.name
|
|
4282
5712
|
}), /* @__PURE__ */ jsx("span", {
|
|
4283
|
-
className: "rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs
|
|
5713
|
+
className: "rounded-full border uppercase border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs text-emerald-800",
|
|
4284
5714
|
children: copy.completed
|
|
4285
5715
|
})]
|
|
4286
5716
|
}),
|
|
@@ -4756,14 +6186,14 @@ function Message(props) {
|
|
|
4756
6186
|
|
|
4757
6187
|
//#endregion
|
|
4758
6188
|
//#region src/components/clipboard.tsx
|
|
4759
|
-
async function writeTextToClipboard(text$
|
|
6189
|
+
async function writeTextToClipboard(text$2) {
|
|
4760
6190
|
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
|
|
4761
|
-
await navigator.clipboard.writeText(text$
|
|
6191
|
+
await navigator.clipboard.writeText(text$2);
|
|
4762
6192
|
return;
|
|
4763
6193
|
}
|
|
4764
6194
|
if (typeof document === "undefined") throw new Error("Clipboard is not available in this environment.");
|
|
4765
6195
|
const textarea = document.createElement("textarea");
|
|
4766
|
-
textarea.value = text$
|
|
6196
|
+
textarea.value = text$2;
|
|
4767
6197
|
textarea.setAttribute("readonly", "");
|
|
4768
6198
|
textarea.style.position = "fixed";
|
|
4769
6199
|
textarea.style.opacity = "0";
|
|
@@ -4775,7 +6205,7 @@ async function writeTextToClipboard(text$1) {
|
|
|
4775
6205
|
textarea.remove();
|
|
4776
6206
|
}
|
|
4777
6207
|
}
|
|
4778
|
-
function Clipboard({ text: text$
|
|
6208
|
+
function Clipboard({ text: text$2, onCopy, copiedDuration = 2e3, copyLabel, copiedLabel, locale, children, className, disabled, onClick, type = "button",...props }) {
|
|
4779
6209
|
const copy = getUiCopy(locale);
|
|
4780
6210
|
const resolvedCopyLabel = copyLabel ?? copy.copy;
|
|
4781
6211
|
const resolvedCopiedLabel = copiedLabel ?? copy.copied;
|
|
@@ -4790,12 +6220,12 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel, copi
|
|
|
4790
6220
|
if (event.defaultPrevented || disabled || isCopying) return;
|
|
4791
6221
|
setIsCopying(true);
|
|
4792
6222
|
try {
|
|
4793
|
-
await writeTextToClipboard(text$
|
|
6223
|
+
await writeTextToClipboard(text$2);
|
|
4794
6224
|
setIsCopied(true);
|
|
4795
6225
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4796
6226
|
timeoutRef.current = setTimeout(() => setIsCopied(false), copiedDuration);
|
|
4797
6227
|
try {
|
|
4798
|
-
await onCopy?.(text$
|
|
6228
|
+
await onCopy?.(text$2);
|
|
4799
6229
|
} catch {}
|
|
4800
6230
|
} catch {
|
|
4801
6231
|
setIsCopied(false);
|
|
@@ -5015,10 +6445,10 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
5015
6445
|
if (!canSubmit) return;
|
|
5016
6446
|
setIsSubmitting(true);
|
|
5017
6447
|
try {
|
|
5018
|
-
const text$
|
|
6448
|
+
const text$2 = value.trim();
|
|
5019
6449
|
const selectedFiles = [...files];
|
|
5020
6450
|
await onSubmit({
|
|
5021
|
-
text: text$
|
|
6451
|
+
text: text$2,
|
|
5022
6452
|
...enabledTools ? { enabledTools } : {},
|
|
5023
6453
|
files: selectedFiles
|
|
5024
6454
|
});
|
|
@@ -5245,10 +6675,10 @@ function useSpeechToText({ transcribe, onTranscriptionComplete, onTranscriptionE
|
|
|
5245
6675
|
if (operationIdRef.current !== operationId) return null;
|
|
5246
6676
|
const transcription = await optionsRef.current.transcribe(audio, abortController.signal);
|
|
5247
6677
|
if (operationIdRef.current !== operationId) return null;
|
|
5248
|
-
const text$
|
|
5249
|
-
if (!text$
|
|
5250
|
-
optionsRef.current.onTranscriptionComplete?.(text$
|
|
5251
|
-
return text$
|
|
6678
|
+
const text$2 = transcription.trim();
|
|
6679
|
+
if (!text$2) return null;
|
|
6680
|
+
optionsRef.current.onTranscriptionComplete?.(text$2);
|
|
6681
|
+
return text$2;
|
|
5252
6682
|
} catch (error) {
|
|
5253
6683
|
if (operationIdRef.current !== operationId || abortController.signal.aborted || isAbortError(error)) return null;
|
|
5254
6684
|
optionsRef.current.onTranscriptionError?.(normalizeError(error, "Transcription failed"));
|
|
@@ -5352,5 +6782,5 @@ async function dummyTranscribeAudio(_audio, signal) {
|
|
|
5352
6782
|
}
|
|
5353
6783
|
|
|
5354
6784
|
//#endregion
|
|
5355
|
-
export { AggregatedSourceResults, ArrowUp, AssistantMessage, ChatError, Clipboard, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getLocalizedOpenGraphValue, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useChat, useSpeechToText };
|
|
6785
|
+
export { AggregatedSourceResults, ArrowUp, AssistantMessage, ChatError, Clipboard, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultPendingConfirmationCard, ToolResultPersonalConnectorCard, ToolResultToolConfirmationCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getLocalizedOpenGraphValue, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useChat, useChatRegistryBusy, useOwnedChatRegistry, useRegistryChat, useSpeechToText, useStreamCoordinator };
|
|
5356
6786
|
//# sourceMappingURL=index.js.map
|