@paymanai/payman-ask-sdk 1.2.23 → 1.2.25

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/index.js CHANGED
@@ -11,6 +11,7 @@ var jsxRuntime = require('react/jsx-runtime');
11
11
  var ReactMarkdown = require('react-markdown');
12
12
  var remarkGfm = require('remark-gfm');
13
13
  var reactDom = require('react-dom');
14
+ var flubber = require('flubber');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
17
 
@@ -479,7 +480,7 @@ function ImageLightbox({
479
480
  background: "rgba(2, 6, 23, 0.92)",
480
481
  isolation: "isolate"
481
482
  };
482
- const frameStyle = {
483
+ const frameStyle2 = {
483
484
  position: "relative",
484
485
  width: "min(92vw, 1280px)",
485
486
  height: "min(88vh, 920px)",
@@ -539,7 +540,7 @@ function ImageLightbox({
539
540
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
540
541
  }
541
542
  ),
542
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: frameStyle, onClick: (event) => event.stopPropagation(), children: [
543
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: frameStyle2, onClick: (event) => event.stopPropagation(), children: [
543
544
  !isImageLoaded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-2", children: [
544
545
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin text-white/80" }),
545
546
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-white/90", children: "Loading image" }),
@@ -1423,6 +1424,101 @@ function MessageList({
1423
1424
  }
1424
1425
  ) });
1425
1426
  }
1427
+ function ResetSessionConfirmModal({
1428
+ isOpen,
1429
+ onClose,
1430
+ onConfirm
1431
+ }) {
1432
+ const handleKeyDown = react.useCallback(
1433
+ (event) => {
1434
+ if (event.key === "Escape") {
1435
+ onClose();
1436
+ }
1437
+ },
1438
+ [onClose]
1439
+ );
1440
+ react.useEffect(() => {
1441
+ if (!isOpen || typeof document === "undefined") return;
1442
+ document.addEventListener("keydown", handleKeyDown);
1443
+ const previousOverflow = document.body.style.overflow;
1444
+ document.body.style.overflow = "hidden";
1445
+ return () => {
1446
+ document.removeEventListener("keydown", handleKeyDown);
1447
+ document.body.style.overflow = previousOverflow;
1448
+ };
1449
+ }, [handleKeyDown, isOpen]);
1450
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsxRuntime.jsxs(
1451
+ framerMotion.motion.div,
1452
+ {
1453
+ className: "payman-reset-session-modal-backdrop",
1454
+ initial: { opacity: 0 },
1455
+ animate: { opacity: 1 },
1456
+ exit: { opacity: 0 },
1457
+ transition: { duration: 0.18 },
1458
+ onClick: onClose,
1459
+ role: "presentation",
1460
+ children: [
1461
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-reset-session-modal-overlay" }),
1462
+ /* @__PURE__ */ jsxRuntime.jsxs(
1463
+ framerMotion.motion.div,
1464
+ {
1465
+ initial: { opacity: 0, y: 12, scale: 0.98 },
1466
+ animate: { opacity: 1, y: 0, scale: 1 },
1467
+ exit: { opacity: 0, y: 8, scale: 0.98 },
1468
+ transition: { duration: 0.2, ease: [0.16, 1, 0.3, 1] },
1469
+ className: "payman-reset-session-modal-dialog",
1470
+ onClick: (event) => event.stopPropagation(),
1471
+ role: "dialog",
1472
+ "aria-modal": "true",
1473
+ "aria-labelledby": "payman-reset-session-title",
1474
+ "aria-describedby": "payman-reset-session-description",
1475
+ children: [
1476
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-reset-session-modal-copy", children: [
1477
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-reset-session-modal-eyebrow", children: "New Session" }),
1478
+ /* @__PURE__ */ jsxRuntime.jsx(
1479
+ "h2",
1480
+ {
1481
+ id: "payman-reset-session-title",
1482
+ className: "payman-reset-session-modal-title",
1483
+ children: "Start a new session?"
1484
+ }
1485
+ ),
1486
+ /* @__PURE__ */ jsxRuntime.jsx(
1487
+ "p",
1488
+ {
1489
+ id: "payman-reset-session-description",
1490
+ className: "payman-reset-session-modal-description",
1491
+ children: "This will clear the current conversation and start fresh."
1492
+ }
1493
+ )
1494
+ ] }),
1495
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-reset-session-modal-actions", children: [
1496
+ /* @__PURE__ */ jsxRuntime.jsx(
1497
+ "button",
1498
+ {
1499
+ type: "button",
1500
+ onClick: onClose,
1501
+ className: "payman-reset-session-modal-btn payman-reset-session-modal-btn-secondary",
1502
+ children: "Cancel"
1503
+ }
1504
+ ),
1505
+ /* @__PURE__ */ jsxRuntime.jsx(
1506
+ "button",
1507
+ {
1508
+ type: "button",
1509
+ onClick: onConfirm,
1510
+ className: "payman-reset-session-modal-btn payman-reset-session-modal-btn-primary",
1511
+ children: "New Session"
1512
+ }
1513
+ )
1514
+ ] })
1515
+ ]
1516
+ }
1517
+ )
1518
+ ]
1519
+ }
1520
+ ) : null });
1521
+ }
1426
1522
 
1427
1523
  // src/assets/payman-mono-crop-blue.png
1428
1524
  var payman_mono_crop_blue_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAMMCAYAAADDyBY0AAAACXBIWXMAAG66AABuugHW3rEXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAGA7SURBVHgB7d07kFt3luf5cy4eophUDOTVbFWJINXRUc6Mkp7EpEJgKFOhsZT0ui0mvVmLpLW9FpPW7Fgkre2xmPS6LKYidqfVYmoItki2xmKWVxNRTUFSGesV1MqkqARw//v/45FPPC6Ae4H7+H6i1UyRrCoVKwH87jn/c/4qAJAgpUql3NgrlOyXi76akud5Z8Vv2b/XsrF/dX6XKUv61FW0Zv+71Y2xX+e8mu/73+U9r2aMX8/nm7V6tVoTAAhABQBipFRZLTX2dsv2y0XjmbIac/Yg3KU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ABABMZt51MAATigwAIAAhVqVIpN5v58vF2sg2A2wRAAACADHHtZAEAAAAAAAAAAAAAAECY/n+sv/W59por5gAAAABJRU5ErkJggg==";
@@ -2079,139 +2175,2304 @@ function UserActionModal({
2079
2175
  }
2080
2176
  );
2081
2177
  }
2082
- var DEFAULT_USER_ACTION_STATE = {
2083
- request: null,
2084
- clearOtpTrigger: 0
2085
- };
2086
- var NOOP_ASYNC = async () => {
2087
- };
2088
- var PaymanChat = react.forwardRef(function PaymanChat2({
2089
- config,
2090
- callbacks = {},
2091
- className,
2092
- style,
2093
- children,
2094
- onLoadMoreMessages,
2095
- isLoadingMoreMessages = false,
2096
- hasMoreMessages = false
2097
- }, ref) {
2098
- const [inputValue, setInputValue] = react.useState("");
2099
- const prevInputValueRef = react.useRef(inputValue);
2100
- const [hasEverSentMessage, setHasEverSentMessage] = react.useState(false);
2178
+ function ActionTooltipV2({ label, children }) {
2179
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-tooltip", children: [
2180
+ children,
2181
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "payman-v2-tooltip-content", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-tooltip-text", children: [
2182
+ label,
2183
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-tooltip-arrow" })
2184
+ ] }) })
2185
+ ] });
2186
+ }
2187
+ function formatMessageTime(timestamp) {
2188
+ const value = new Date(timestamp);
2189
+ if (Number.isNaN(value.getTime())) return "";
2190
+ return new Intl.DateTimeFormat(void 0, {
2191
+ hour: "numeric",
2192
+ minute: "2-digit"
2193
+ }).format(value);
2194
+ }
2195
+ function UserMessageV2({
2196
+ message,
2197
+ onEdit,
2198
+ onRetry,
2199
+ retryDisabled = false,
2200
+ actions
2201
+ }) {
2202
+ const [copied, setCopied] = react.useState(false);
2203
+ const [toast, setToast] = react.useState(null);
2204
+ const copyResetTimerRef = react.useRef(null);
2205
+ const toastTimerRef = react.useRef(null);
2206
+ const showCopyAction = actions?.copy ?? true;
2207
+ const showEditAction = actions?.edit ?? false;
2208
+ const showRetryAction = actions?.retry ?? false;
2101
2209
  react.useEffect(() => {
2102
- if (config.sentryDsn) {
2103
- initSentryIfNeeded(config.sentryDsn);
2210
+ return () => {
2211
+ if (copyResetTimerRef.current) clearTimeout(copyResetTimerRef.current);
2212
+ if (toastTimerRef.current) clearTimeout(toastTimerRef.current);
2213
+ };
2214
+ }, []);
2215
+ const showToast = (label, tone) => {
2216
+ if (toastTimerRef.current) clearTimeout(toastTimerRef.current);
2217
+ setToast({ label, tone });
2218
+ toastTimerRef.current = setTimeout(() => setToast(null), 1800);
2219
+ };
2220
+ const handleCopy = async () => {
2221
+ try {
2222
+ if (!navigator.clipboard?.writeText) {
2223
+ throw new Error("Clipboard unavailable");
2224
+ }
2225
+ await navigator.clipboard.writeText(message.content);
2226
+ if (copyResetTimerRef.current) clearTimeout(copyResetTimerRef.current);
2227
+ setCopied(true);
2228
+ copyResetTimerRef.current = setTimeout(() => setCopied(false), 1800);
2229
+ showToast("Copied to clipboard", "success");
2230
+ } catch {
2231
+ setCopied(false);
2232
+ showToast("Could not copy", "error");
2104
2233
  }
2105
- }, [config.sentryDsn]);
2106
- const sentryCtxRef = react.useRef({});
2107
- const callbacksRef = react.useRef(callbacks);
2108
- callbacksRef.current = callbacks;
2109
- const initialSessionId = config.initialSessionId;
2110
- const apiHeaders = config.api.headers;
2234
+ };
2235
+ const timestamp = formatMessageTime(message.timestamp);
2236
+ const hasVisibleActions = showCopyAction || showEditAction && !!onEdit || showRetryAction && !!onRetry;
2237
+ const toastPortal = typeof document !== "undefined" ? reactDom.createPortal(
2238
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: toast && /* @__PURE__ */ jsxRuntime.jsx(
2239
+ framerMotion.motion.div,
2240
+ {
2241
+ initial: { opacity: 0, y: -18, scale: 0.96 },
2242
+ animate: { opacity: 1, y: 0, scale: 1 },
2243
+ exit: { opacity: 0, y: -12, scale: 0.96 },
2244
+ transition: {
2245
+ type: "spring",
2246
+ stiffness: 360,
2247
+ damping: 26,
2248
+ mass: 0.7
2249
+ },
2250
+ className: "payman-v2-toast",
2251
+ role: "status",
2252
+ "aria-live": "polite",
2253
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
2254
+ "div",
2255
+ {
2256
+ className: cn(
2257
+ "payman-v2-toast-inner",
2258
+ toast.tone === "success" ? "payman-v2-toast-success" : "payman-v2-toast-error"
2259
+ ),
2260
+ children: [
2261
+ toast.tone === "success" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4", style: { color: "#059669" } }) : /* @__PURE__ */ jsxRuntime.jsx(
2262
+ lucideReact.AlertCircle,
2263
+ {
2264
+ className: "h-4 w-4",
2265
+ style: { color: "#ef4444" }
2266
+ }
2267
+ ),
2268
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: toast.label })
2269
+ ]
2270
+ }
2271
+ )
2272
+ }
2273
+ ) }),
2274
+ document.body
2275
+ ) : null;
2276
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2277
+ toastPortal,
2278
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-user-msg payman-v2-fade-in", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-user-msg-group", children: [
2279
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-user-msg-bubble", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-user-msg-text", children: message.content }) }),
2280
+ message.isError && message.errorDetails && (() => {
2281
+ const resolvedError = getConflictErrorMessage(message.errorDetails) ?? message.errorDetails;
2282
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-user-msg-error", children: [
2283
+ /* @__PURE__ */ jsxRuntime.jsx(
2284
+ lucideReact.AlertCircle,
2285
+ {
2286
+ className: "h-3.5 w-3.5 shrink-0",
2287
+ style: { color: "rgba(239, 68, 68, 0.7)", marginTop: "2px" }
2288
+ }
2289
+ ),
2290
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-user-msg-error-text", children: resolvedError })
2291
+ ] });
2292
+ })(),
2293
+ (timestamp || hasVisibleActions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-user-msg-actions", children: [
2294
+ timestamp ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-user-msg-timestamp", children: timestamp }) : null,
2295
+ showCopyAction && /* @__PURE__ */ jsxRuntime.jsx(ActionTooltipV2, { label: "Copy", children: /* @__PURE__ */ jsxRuntime.jsx(
2296
+ "button",
2297
+ {
2298
+ type: "button",
2299
+ onClick: () => void handleCopy(),
2300
+ className: "payman-v2-user-msg-action-btn",
2301
+ "aria-label": "Copy message",
2302
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx(
2303
+ lucideReact.Check,
2304
+ {
2305
+ className: "h-3.5 w-3.5",
2306
+ style: { color: "#059669" }
2307
+ }
2308
+ ) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "h-3.5 w-3.5" })
2309
+ }
2310
+ ) }),
2311
+ showEditAction && onEdit && /* @__PURE__ */ jsxRuntime.jsx(ActionTooltipV2, { label: "Edit", children: /* @__PURE__ */ jsxRuntime.jsx(
2312
+ "button",
2313
+ {
2314
+ type: "button",
2315
+ onClick: () => onEdit(message.id),
2316
+ className: "payman-v2-user-msg-action-btn",
2317
+ "aria-label": "Edit message",
2318
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-3.5 w-3.5" })
2319
+ }
2320
+ ) }),
2321
+ showRetryAction && onRetry && /* @__PURE__ */ jsxRuntime.jsx(ActionTooltipV2, { label: "Retry", children: /* @__PURE__ */ jsxRuntime.jsx(
2322
+ "button",
2323
+ {
2324
+ type: "button",
2325
+ onClick: () => onRetry(message.id),
2326
+ disabled: retryDisabled,
2327
+ className: "payman-v2-user-msg-action-btn",
2328
+ "aria-label": "Retry message",
2329
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "h-3.5 w-3.5" })
2330
+ }
2331
+ ) })
2332
+ ] })
2333
+ ] }) })
2334
+ ] });
2335
+ }
2336
+ var RAG_IMAGE_PATH_REGEX2 = /^(?:https?:\/\/[^/\s]+)?\/api\/rag\/chunks\/[^"'\s]+\/image(?:[?#][^"'\s]*)?$/;
2337
+ function isUnresolvedRagImageSource2(src) {
2338
+ return RAG_IMAGE_PATH_REGEX2.test(src);
2339
+ }
2340
+ var frameStyle = {
2341
+ width: "min(100%, 32rem)",
2342
+ maxWidth: "100%"
2343
+ };
2344
+ var imgStyle = {
2345
+ display: "block",
2346
+ width: "100%",
2347
+ height: "auto",
2348
+ maxWidth: "100%",
2349
+ maxHeight: "22rem",
2350
+ objectFit: "contain"
2351
+ };
2352
+ function MarkdownImageV2({
2353
+ src,
2354
+ alt,
2355
+ isResolving = false,
2356
+ onImageClick
2357
+ }) {
2358
+ const [isVisible, setIsVisible] = react.useState(false);
2359
+ const [isLoaded, setIsLoaded] = react.useState(false);
2360
+ const [hasError, setHasError] = react.useState(false);
2361
+ const [retryCount, setRetryCount] = react.useState(0);
2362
+ const sentinelRef = react.useRef(null);
2363
+ const isUnresolvedRag = react.useMemo(
2364
+ () => src ? isUnresolvedRagImageSource2(src) : false,
2365
+ [src]
2366
+ );
2367
+ const isResolvingRag = Boolean(isResolving && isUnresolvedRag);
2111
2368
  react.useEffect(() => {
2112
- sentryCtxRef.current.workflowName = config.workflowName;
2113
- sentryCtxRef.current.sessionOwnerId = config.sessionParams?.id;
2114
- if (initialSessionId) {
2115
- sentryCtxRef.current.sessionId = initialSessionId;
2116
- }
2117
- if (apiHeaders) {
2118
- sentryCtxRef.current.customerId = apiHeaders["x-paygent-wf-mcp-customer-id"] ?? sentryCtxRef.current.customerId;
2119
- sentryCtxRef.current.customerEmail = apiHeaders["x-paygent-wf-mcp-customer-email"] ?? sentryCtxRef.current.customerEmail;
2120
- }
2121
- }, [
2122
- config.workflowName,
2123
- config.sessionParams?.id,
2124
- initialSessionId,
2125
- apiHeaders
2126
- ]);
2369
+ setIsLoaded(false);
2370
+ setHasError(false);
2371
+ setRetryCount(0);
2372
+ setIsVisible(false);
2373
+ }, [src]);
2127
2374
  react.useEffect(() => {
2128
- const endpoint = config.api.streamEndpoint || "/api/workflows/ask/stream";
2129
- return subscribeToCfRay(endpoint, (cfRay) => {
2130
- sentryCtxRef.current.cfRay = cfRay;
2131
- });
2132
- }, [config.api.streamEndpoint]);
2133
- const sentryCallbacks = react.useMemo(
2134
- () => ({
2135
- onMessageSent: (msg) => callbacksRef.current.onMessageSent?.(msg),
2136
- onStreamStart: () => callbacksRef.current.onStreamStart?.(),
2137
- onStreamComplete: (message) => {
2138
- if (message.executionId)
2139
- sentryCtxRef.current.executionId = message.executionId;
2140
- if (message.sessionId)
2141
- sentryCtxRef.current.sessionId = message.sessionId;
2142
- const content = message.content ?? "";
2143
- const looksLikeRawErr = content.length >= 10 && (content.includes("errorType=") || /failed:\s*\{/.test(content));
2144
- const completedEmpty = !message.isStreaming && !message.isCancelled && content.length === 0 && (message.streamProgress === "completed" || message.streamProgress === "error");
2145
- const hasConflict = !!getConflictErrorMessage(message.errorDetails);
2146
- const hasFriendlyErr = isFriendlyWorkflowError(message.errorDetails);
2147
- const shouldCapture = message.isError || hasConflict || hasFriendlyErr || looksLikeRawErr || completedEmpty;
2148
- if (shouldCapture) {
2149
- sentryCtxRef.current.route = typeof window !== "undefined" ? window.location.pathname : void 0;
2150
- captureSentryError(
2151
- `Workflow error: ${message.errorDetails || content || "Unknown error"}`,
2152
- { ...sentryCtxRef.current }
2153
- );
2375
+ const el = sentinelRef.current;
2376
+ if (!el || !src) return;
2377
+ const observer = new IntersectionObserver(
2378
+ ([entry]) => {
2379
+ if (entry.isIntersecting) {
2380
+ setIsVisible(true);
2381
+ observer.disconnect();
2154
2382
  }
2155
- callbacksRef.current.onStreamComplete?.(message);
2156
2383
  },
2157
- onError: (error) => {
2158
- sentryCtxRef.current.route = typeof window !== "undefined" ? window.location.pathname : void 0;
2159
- captureSentryError(error, { ...sentryCtxRef.current });
2160
- callbacksRef.current.onError?.(error);
2384
+ { rootMargin: "200px" }
2385
+ );
2386
+ observer.observe(el);
2387
+ return () => observer.disconnect();
2388
+ }, [src]);
2389
+ if (!src) return null;
2390
+ if (isResolvingRag) {
2391
+ return /* @__PURE__ */ jsxRuntime.jsx(
2392
+ "span",
2393
+ {
2394
+ className: cn("payman-v2-md-image", "payman-v2-md-image-resolving"),
2395
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "payman-v2-md-image-resolving-inner", children: [
2396
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payman-v2-md-image-loading", "aria-hidden": true }),
2397
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading image" }),
2398
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Reference image" })
2399
+ ] })
2400
+ }
2401
+ );
2402
+ }
2403
+ if (hasError) {
2404
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("payman-v2-md-image", "payman-v2-md-image-error"), children: [
2405
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ImageOff, { "aria-hidden": true }),
2406
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Unable to load image" }),
2407
+ alt ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: alt }) : null,
2408
+ retryCount < 3 ? /* @__PURE__ */ jsxRuntime.jsx(
2409
+ "button",
2410
+ {
2411
+ type: "button",
2412
+ className: "payman-v2-md-image-error-retry",
2413
+ onClick: () => {
2414
+ setHasError(false);
2415
+ setRetryCount((c) => c + 1);
2416
+ },
2417
+ children: "Retry"
2418
+ }
2419
+ ) : null
2420
+ ] });
2421
+ }
2422
+ const imgSrc = retryCount > 0 ? `${src}${src.includes("?") ? "&" : "?"}_r=${retryCount}` : src;
2423
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ref: sentinelRef, className: "payman-v2-md-image", children: isVisible ? /* @__PURE__ */ jsxRuntime.jsxs(
2424
+ "button",
2425
+ {
2426
+ type: "button",
2427
+ className: "payman-v2-md-image-button",
2428
+ onClick: () => {
2429
+ if (isLoaded && src) onImageClick?.(src, alt || "Image");
2161
2430
  },
2162
- onSessionIdChange: (sessionId) => {
2163
- sentryCtxRef.current.sessionId = sessionId;
2164
- callbacksRef.current.onSessionIdChange?.(sessionId);
2431
+ disabled: !isLoaded,
2432
+ "aria-busy": !isLoaded,
2433
+ style: {
2434
+ ...frameStyle,
2435
+ ...!isLoaded ? { minHeight: "10rem" } : {}
2165
2436
  },
2166
- onExecutionTraceClick: (data) => callbacksRef.current.onExecutionTraceClick?.(data),
2167
- onResetSession: () => callbacksRef.current.onResetSession?.(),
2168
- onUserActionRequired: (req) => callbacksRef.current.onUserActionRequired?.(req),
2169
- onUserActionEvent: (evType, msg) => callbacksRef.current.onUserActionEvent?.(evType, msg)
2170
- }),
2171
- // eslint-disable-next-line react-hooks/exhaustive-deps
2172
- []
2173
- );
2174
- const chat = paymanTypescriptAskSdk.useChat(config, sentryCallbacks);
2175
- const {
2176
- messages,
2177
- sendMessage,
2178
- isWaitingForResponse,
2179
- resetSession,
2180
- clearMessages,
2181
- prependMessages,
2182
- cancelStream,
2183
- getSessionId,
2184
- getMessages
2185
- } = chat;
2186
- react.useEffect(() => {
2187
- if (messages.length > 0 && !hasEverSentMessage) {
2188
- setHasEverSentMessage(true);
2437
+ children: [
2438
+ !isLoaded && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "payman-v2-md-image-placeholder", children: [
2439
+ /* @__PURE__ */ jsxRuntime.jsx(
2440
+ lucideReact.Loader2,
2441
+ {
2442
+ className: "payman-v2-md-image-loading",
2443
+ "aria-hidden": true
2444
+ }
2445
+ ),
2446
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading image\u2026" })
2447
+ ] }),
2448
+ /* @__PURE__ */ jsxRuntime.jsx(
2449
+ "img",
2450
+ {
2451
+ src: imgSrc,
2452
+ alt: alt || "",
2453
+ className: "payman-v2-md-image-img",
2454
+ style: {
2455
+ ...imgStyle,
2456
+ opacity: isLoaded ? 1 : 0
2457
+ },
2458
+ onLoad: () => {
2459
+ setHasError(false);
2460
+ setIsLoaded(true);
2461
+ },
2462
+ onError: () => {
2463
+ setIsLoaded(false);
2464
+ setHasError(true);
2465
+ }
2466
+ }
2467
+ ),
2468
+ isLoaded ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-md-image-overlay", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-md-image-overlay-icon", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, {}) }) }) : null
2469
+ ]
2189
2470
  }
2190
- }, [messages.length, hasEverSentMessage]);
2191
- const userActionState = chat.userActionState ?? DEFAULT_USER_ACTION_STATE;
2192
- const approveUserAction = chat.approveUserAction ?? NOOP_ASYNC;
2193
- const rejectUserAction = chat.rejectUserAction ?? NOOP_ASYNC;
2194
- const resendOtp = chat.resendOtp ?? NOOP_ASYNC;
2195
- const isUserActionSupported = typeof chat.approveUserAction === "function" && typeof chat.rejectUserAction === "function" && typeof chat.resendOtp === "function";
2196
- const {
2197
- isAvailable: voiceAvailable,
2198
- isRecording,
2199
- startRecording,
2200
- stopRecording,
2201
- clearTranscript
2202
- } = paymanTypescriptAskSdk.useVoice(
2203
- {
2204
- lang: config.voiceLang || "en-US",
2205
- interimResults: config.voiceInterimResults !== false,
2206
- continuous: config.voiceContinuous !== false
2207
- },
2471
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2472
+ "span",
2208
2473
  {
2209
- onResult: (text) => {
2210
- setInputValue(text);
2211
- },
2212
- onEnd: () => {
2213
- },
2214
- onError: (error) => {
2474
+ className: "payman-v2-md-image-placeholder",
2475
+ style: { ...frameStyle, minHeight: "10rem" },
2476
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Image" })
2477
+ }
2478
+ ) });
2479
+ }
2480
+ function buildComponents(onImageClick, isResolvingImages) {
2481
+ return {
2482
+ p: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("p", { children }),
2483
+ code: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("code", { children }),
2484
+ pre: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-markdown-pre", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { children }) }),
2485
+ ul: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { children }),
2486
+ ol: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { children }),
2487
+ li: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("li", { children }),
2488
+ h1: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h1", { children }),
2489
+ h2: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h2", { children }),
2490
+ h3: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { children }),
2491
+ strong: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { children }),
2492
+ em: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("em", { children }),
2493
+ blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { children }),
2494
+ hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", {}),
2495
+ a: ({ href, children }) => /* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noopener noreferrer", children }),
2496
+ img: ({ src, alt }) => /* @__PURE__ */ jsxRuntime.jsx(
2497
+ MarkdownImageV2,
2498
+ {
2499
+ src: typeof src === "string" ? src : void 0,
2500
+ alt: typeof alt === "string" ? alt : void 0,
2501
+ isResolving: isResolvingImages,
2502
+ onImageClick
2503
+ }
2504
+ ),
2505
+ table: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-markdown-table-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "payman-v2-markdown-table", children }) }),
2506
+ thead: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "payman-v2-markdown-thead", children }),
2507
+ tbody: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "payman-v2-markdown-tbody", children }),
2508
+ th: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "payman-v2-markdown-th", children }),
2509
+ td: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: "payman-v2-markdown-td", children })
2510
+ };
2511
+ }
2512
+ function MarkdownRendererV2({
2513
+ content,
2514
+ isStreaming,
2515
+ isResolvingImages,
2516
+ onImageClick
2517
+ }) {
2518
+ const components = react.useMemo(
2519
+ () => buildComponents(onImageClick, isResolvingImages),
2520
+ [onImageClick, isResolvingImages]
2521
+ );
2522
+ return /* @__PURE__ */ jsxRuntime.jsx(
2523
+ "div",
2524
+ {
2525
+ className: cn(
2526
+ "payman-v2-markdown",
2527
+ isStreaming && "payman-v2-streaming-cursor"
2528
+ ),
2529
+ children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown__default.default, { remarkPlugins: [remarkGfm__default.default], components, children: content })
2530
+ }
2531
+ );
2532
+ }
2533
+ var PAYMAN_PATH = "M174.005 38.1616C159.62 18.4068 138.406 5.43014 114.263 1.62485C90.1187 -2.18045 65.9302 3.63155 46.1599 17.9906C21.9565 35.5752 6.06885 61.5137 1.39776 91.0344C-3.27333 120.555 3.85231 150.135 21.4358 174.305C43.0508 204.004 74.9451 223.506 111.243 229.244L122.415 231.013V171.273C121.968 171.273 121.522 171.302 121.076 171.302C116.955 171.302 112.82 170.975 108.684 170.321C106.795 170.024 104.92 169.638 103.076 169.207V207.839C76.5368 201.031 53.4045 185.364 37.0706 162.934C22.5218 142.941 16.6309 118.474 20.4838 94.037C24.3515 69.6148 37.502 48.1505 57.5103 33.5983C73.1004 22.2715 92.1865 17.6784 111.228 20.6811C130.269 23.6837 147.005 33.9253 158.355 49.5032C167.117 61.5583 170.673 76.2889 168.337 91.0047C166.016 105.72 158.087 118.653 146.038 127.408C136.815 134.112 125.524 136.832 114.248 135.048C102.972 133.264 93.079 127.214 86.355 117.984C81.2823 111.027 79.2443 102.51 80.5831 94.0073C81.922 85.5049 86.5038 78.0429 93.4658 72.9741C98.6129 69.2283 104.92 67.7121 111.213 68.7081C117.506 69.704 123.039 73.0782 126.788 78.2362C129.481 81.9374 130.567 86.4711 129.853 90.9898C129.139 95.5086 126.699 99.4774 122.995 102.183H146.648C147.719 99.5815 148.492 96.8464 148.939 94.0073C150.456 84.39 148.135 74.743 142.408 66.8797C135.625 57.5597 125.613 51.4207 114.218 49.637C102.823 47.8384 91.4129 50.5734 82.0707 57.3665C70.9285 65.4676 63.6095 77.4037 61.4525 91.0047C59.2955 104.606 62.5831 118.221 70.6905 129.355C80.4344 142.748 94.8195 151.548 111.198 154.134C127.577 156.72 143.97 152.781 157.373 143.03C173.603 131.228 184.269 113.822 187.408 94.0073C190.547 74.193 185.757 54.349 173.96 38.117L174.005 38.1616Z";
2534
+ var CIRCLE_PATH = "M95 36C139.183 36 175 71.817 175 116C175 160.183 139.183 196 95 196C50.817 196 15 160.183 15 116C15 71.817 50.817 36 95 36Z";
2535
+ function easeInOut(t) {
2536
+ return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
2537
+ }
2538
+ var TIMINGS = {
2539
+ // Total loop cycle = sum of all phases (ms)
2540
+ holdLogoMs: 900,
2541
+ morphToCircleMs: 550,
2542
+ holdCircleMs: 1100,
2543
+ morphToLogoMs: 550
2544
+ };
2545
+ var TOTAL_CYCLE = TIMINGS.holdLogoMs + TIMINGS.morphToCircleMs + TIMINGS.holdCircleMs + TIMINGS.morphToLogoMs;
2546
+ function phaseAtTime(elapsed) {
2547
+ let t = elapsed % TOTAL_CYCLE;
2548
+ if (t < TIMINGS.holdLogoMs) {
2549
+ return { kind: "hold-logo" };
2550
+ }
2551
+ t -= TIMINGS.holdLogoMs;
2552
+ if (t < TIMINGS.morphToCircleMs) {
2553
+ return {
2554
+ kind: "morph",
2555
+ direction: 1,
2556
+ progress: easeInOut(t / TIMINGS.morphToCircleMs)
2557
+ };
2558
+ }
2559
+ t -= TIMINGS.morphToCircleMs;
2560
+ if (t < TIMINGS.holdCircleMs) {
2561
+ return { kind: "hold-circle", progress: t / TIMINGS.holdCircleMs };
2562
+ }
2563
+ t -= TIMINGS.holdCircleMs;
2564
+ return {
2565
+ kind: "morph",
2566
+ direction: -1,
2567
+ progress: easeInOut(t / TIMINGS.morphToLogoMs)
2568
+ };
2569
+ }
2570
+ var RING_CX = 95;
2571
+ var RING_CY = 116;
2572
+ var RING_R = 65;
2573
+ var RING_STROKE_WIDTH = 22;
2574
+ var RING_CIRCUMFERENCE = 2 * Math.PI * RING_R;
2575
+ var RING_ARC_FRACTION = 0.3;
2576
+ var cachedInterpolators = null;
2577
+ var pendingInterpolators = null;
2578
+ function buildInterpolators() {
2579
+ const opts = { maxSegmentLength: 8 };
2580
+ return {
2581
+ forward: flubber.interpolate(PAYMAN_PATH, CIRCLE_PATH, opts),
2582
+ backward: flubber.interpolate(CIRCLE_PATH, PAYMAN_PATH, opts)
2583
+ };
2584
+ }
2585
+ function loadInterpolatorsAsync() {
2586
+ if (cachedInterpolators) return Promise.resolve(cachedInterpolators);
2587
+ if (pendingInterpolators) return pendingInterpolators;
2588
+ pendingInterpolators = new Promise((resolve) => {
2589
+ const run = () => {
2590
+ cachedInterpolators = buildInterpolators();
2591
+ resolve(cachedInterpolators);
2592
+ };
2593
+ const ric = globalThis.requestIdleCallback;
2594
+ if (typeof ric === "function") {
2595
+ ric(run, { timeout: 200 });
2596
+ } else {
2597
+ setTimeout(run, 0);
2598
+ }
2599
+ });
2600
+ return pendingInterpolators;
2601
+ }
2602
+ function PaymanMark() {
2603
+ const pathRef = react.useRef(null);
2604
+ const ringGroupRef = react.useRef(null);
2605
+ react.useEffect(() => {
2606
+ const reduced = window.matchMedia(
2607
+ "(prefers-reduced-motion: reduce)"
2608
+ ).matches;
2609
+ if (reduced) {
2610
+ pathRef.current?.setAttribute("d", PAYMAN_PATH);
2611
+ pathRef.current?.setAttribute("fill-opacity", "1");
2612
+ ringGroupRef.current?.setAttribute("opacity", "0");
2613
+ return;
2614
+ }
2615
+ let raf = 0;
2616
+ let cancelled = false;
2617
+ const start = performance.now();
2618
+ let interpolators = cachedInterpolators;
2619
+ const tick = (now) => {
2620
+ const elapsed = now - start;
2621
+ const phase = phaseAtTime(elapsed);
2622
+ let d;
2623
+ let fillOpacity = 1;
2624
+ let ringOpacity = 0;
2625
+ const spin = elapsed / 900 * 360;
2626
+ switch (phase.kind) {
2627
+ case "hold-logo":
2628
+ d = PAYMAN_PATH;
2629
+ fillOpacity = 1;
2630
+ ringOpacity = 0;
2631
+ break;
2632
+ case "morph": {
2633
+ if (!interpolators) {
2634
+ d = PAYMAN_PATH;
2635
+ fillOpacity = 1;
2636
+ ringOpacity = 0;
2637
+ break;
2638
+ }
2639
+ d = phase.direction === 1 ? interpolators.forward(phase.progress) : interpolators.backward(phase.progress);
2640
+ const p = phase.direction === 1 ? phase.progress : 1 - phase.progress;
2641
+ fillOpacity = p < 0.6 ? 1 : 1 - (p - 0.6) / 0.4;
2642
+ ringOpacity = p < 0.55 ? 0 : (p - 0.55) / 0.45;
2643
+ break;
2644
+ }
2645
+ case "hold-circle":
2646
+ d = CIRCLE_PATH;
2647
+ fillOpacity = 0;
2648
+ ringOpacity = 1;
2649
+ break;
2650
+ }
2651
+ if (pathRef.current) {
2652
+ pathRef.current.setAttribute("d", d);
2653
+ pathRef.current.setAttribute("fill-opacity", fillOpacity.toFixed(3));
2654
+ }
2655
+ if (ringGroupRef.current) {
2656
+ ringGroupRef.current.setAttribute("opacity", ringOpacity.toFixed(3));
2657
+ ringGroupRef.current.setAttribute(
2658
+ "transform",
2659
+ `rotate(${spin.toFixed(2)} ${RING_CX} ${RING_CY})`
2660
+ );
2661
+ }
2662
+ raf = requestAnimationFrame(tick);
2663
+ };
2664
+ raf = requestAnimationFrame(tick);
2665
+ if (!interpolators) {
2666
+ void loadInterpolatorsAsync().then((result) => {
2667
+ if (!cancelled) interpolators = result;
2668
+ });
2669
+ }
2670
+ return () => {
2671
+ cancelled = true;
2672
+ cancelAnimationFrame(raf);
2673
+ };
2674
+ }, []);
2675
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2676
+ "svg",
2677
+ {
2678
+ className: "payman-v2-thinking-mark",
2679
+ viewBox: "0 0 190 232",
2680
+ "aria-hidden": true,
2681
+ focusable: "false",
2682
+ children: [
2683
+ /* @__PURE__ */ jsxRuntime.jsx("path", { ref: pathRef, d: PAYMAN_PATH, fill: "currentColor" }),
2684
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { ref: ringGroupRef, opacity: 0, children: [
2685
+ /* @__PURE__ */ jsxRuntime.jsx(
2686
+ "circle",
2687
+ {
2688
+ cx: RING_CX,
2689
+ cy: RING_CY,
2690
+ r: RING_R,
2691
+ fill: "none",
2692
+ stroke: "currentColor",
2693
+ strokeWidth: RING_STROKE_WIDTH,
2694
+ strokeOpacity: 0.16
2695
+ }
2696
+ ),
2697
+ /* @__PURE__ */ jsxRuntime.jsx(
2698
+ "circle",
2699
+ {
2700
+ cx: RING_CX,
2701
+ cy: RING_CY,
2702
+ r: RING_R,
2703
+ fill: "none",
2704
+ stroke: "currentColor",
2705
+ strokeWidth: RING_STROKE_WIDTH,
2706
+ strokeLinecap: "round",
2707
+ strokeDasharray: `${RING_CIRCUMFERENCE * RING_ARC_FRACTION} ${RING_CIRCUMFERENCE}`
2708
+ }
2709
+ )
2710
+ ] })
2711
+ ]
2712
+ }
2713
+ );
2714
+ }
2715
+ var CURSOR_MESSAGES = [
2716
+ "Analyzing",
2717
+ "Processing",
2718
+ "Calculating",
2719
+ "Reviewing",
2720
+ "Verifying",
2721
+ "Assessing",
2722
+ "Evaluating",
2723
+ "Checking",
2724
+ "Planning",
2725
+ "Working",
2726
+ "Updating",
2727
+ "Validating",
2728
+ "Monitoring",
2729
+ "Optimizing",
2730
+ "Reconciling",
2731
+ "Forecasting",
2732
+ "Inspecting",
2733
+ "Organizing",
2734
+ "Sorting",
2735
+ "Scanning",
2736
+ "Balancing",
2737
+ "Summarizing",
2738
+ "Predicting",
2739
+ "Comparing",
2740
+ "Tracking",
2741
+ "Adjusting",
2742
+ "Examining",
2743
+ "Mapping",
2744
+ "Modeling",
2745
+ "Reporting",
2746
+ "Confirming"
2747
+ ];
2748
+ var FINAL_CURSOR_MESSAGE = "Finishing up";
2749
+ function getMaxDuration(...values) {
2750
+ const defined = values.filter(
2751
+ (value) => typeof value === "number" && Number.isFinite(value)
2752
+ );
2753
+ return defined.length > 0 ? Math.max(...defined) : void 0;
2754
+ }
2755
+ function parseThinkingContent(content) {
2756
+ const lines = content.split("\n");
2757
+ const out = [];
2758
+ for (const raw of lines) {
2759
+ const line = raw.trim();
2760
+ if (!line) continue;
2761
+ const stmt = line.match(/^\*\*(.+)\*\*$/);
2762
+ if (stmt) {
2763
+ out.push({ type: "statement", text: stmt[1].trim() });
2764
+ continue;
2765
+ }
2766
+ if (line.startsWith("\u2713 ")) {
2767
+ out.push({
2768
+ type: "status",
2769
+ variant: "success",
2770
+ text: line.slice(2).trim()
2771
+ });
2772
+ continue;
2773
+ }
2774
+ if (line.startsWith("\u2717 ")) {
2775
+ out.push({
2776
+ type: "status",
2777
+ variant: "error",
2778
+ text: line.slice(2).trim()
2779
+ });
2780
+ continue;
2781
+ }
2782
+ out.push({ type: "detail", text: line });
2783
+ }
2784
+ return out;
2785
+ }
2786
+ function AnimatedSeconds({
2787
+ value,
2788
+ className,
2789
+ ariaLabel
2790
+ }) {
2791
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("payman-v2-thinking-seconds", className), "aria-label": ariaLabel, children: [
2792
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-thinking-seconds-track", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: /* @__PURE__ */ jsxRuntime.jsx(
2793
+ framerMotion.motion.span,
2794
+ {
2795
+ className: "payman-v2-thinking-seconds-value",
2796
+ initial: { opacity: 0, y: 6, filter: "blur(2px)" },
2797
+ animate: { opacity: 1, y: 0, filter: "blur(0px)" },
2798
+ exit: { opacity: 0, y: -6, filter: "blur(2px)" },
2799
+ transition: { duration: 0.2, ease: [0.22, 1, 0.36, 1] },
2800
+ children: value
2801
+ },
2802
+ value
2803
+ ) }) }),
2804
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-thinking-seconds-suffix", "aria-hidden": "true", children: "s" })
2805
+ ] });
2806
+ }
2807
+ function ThinkingBlockV2({
2808
+ content,
2809
+ isStreaming,
2810
+ durationSec,
2811
+ startedAt
2812
+ }) {
2813
+ const [open, setOpen] = react.useState(true);
2814
+ const [cursorIdx, setCursorIdx] = react.useState(0);
2815
+ const [elapsedSec, setElapsedSec] = react.useState(
2816
+ () => startedAt ? Math.max(0, Math.floor((Date.now() - startedAt) / 1e3)) : 0
2817
+ );
2818
+ const frozenSecRef = react.useRef(null);
2819
+ const prevStreaming = react.useRef(isStreaming);
2820
+ const parsed = react.useMemo(() => parseThinkingContent(content), [content]);
2821
+ const isFinalizingPhase = react.useMemo(() => {
2822
+ const statements = parsed.filter(
2823
+ (l) => l.type === "statement"
2824
+ );
2825
+ return statements.length > 0 && statements[statements.length - 1].text === "Finalizing";
2826
+ }, [parsed]);
2827
+ react.useEffect(() => {
2828
+ if (prevStreaming.current && !isStreaming) {
2829
+ setOpen(false);
2830
+ if (startedAt) {
2831
+ frozenSecRef.current = Math.max(
2832
+ 0,
2833
+ Math.floor((Date.now() - startedAt) / 1e3)
2834
+ );
2835
+ }
2836
+ }
2837
+ prevStreaming.current = isStreaming;
2838
+ }, [isStreaming, startedAt]);
2839
+ react.useEffect(() => {
2840
+ if (!isStreaming || !startedAt) return;
2841
+ const tick = () => {
2842
+ setElapsedSec(
2843
+ Math.max(0, Math.floor((Date.now() - startedAt) / 1e3))
2844
+ );
2845
+ };
2846
+ tick();
2847
+ const id = window.setInterval(tick, 1e3);
2848
+ return () => window.clearInterval(id);
2849
+ }, [isStreaming, startedAt]);
2850
+ react.useEffect(() => {
2851
+ if (!isStreaming || isFinalizingPhase) return;
2852
+ const id = window.setInterval(() => {
2853
+ setCursorIdx((i) => (i + 1) % CURSOR_MESSAGES.length);
2854
+ }, 4e3);
2855
+ return () => window.clearInterval(id);
2856
+ }, [isStreaming, isFinalizingPhase]);
2857
+ const justStoppedSec = !isStreaming && prevStreaming.current && startedAt ? Math.max(0, Math.floor((Date.now() - startedAt) / 1e3)) : void 0;
2858
+ const finalSec = getMaxDuration(
2859
+ durationSec,
2860
+ frozenSecRef.current,
2861
+ justStoppedSec,
2862
+ !isStreaming ? elapsedSec : void 0
2863
+ );
2864
+ const headerLabel = isStreaming ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "payman-v2-thinking-header-label", children: [
2865
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-thinking-shimmer", children: "Working on it\u2026" }),
2866
+ startedAt !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
2867
+ AnimatedSeconds,
2868
+ {
2869
+ className: "payman-v2-thinking-timer",
2870
+ ariaLabel: `Elapsed ${elapsedSec} seconds`,
2871
+ value: elapsedSec
2872
+ }
2873
+ )
2874
+ ] }) : finalSec !== null && finalSec !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "payman-v2-thinking-header-label", children: [
2875
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Thought for" }),
2876
+ /* @__PURE__ */ jsxRuntime.jsx(
2877
+ AnimatedSeconds,
2878
+ {
2879
+ className: "payman-v2-thinking-duration",
2880
+ ariaLabel: `Thought for ${finalSec} seconds`,
2881
+ value: finalSec
2882
+ }
2883
+ )
2884
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Thought" });
2885
+ const cursorKey = isFinalizingPhase ? "finalizing" : String(cursorIdx);
2886
+ const cursorText = isFinalizingPhase ? FINAL_CURSOR_MESSAGE : CURSOR_MESSAGES[cursorIdx];
2887
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-thinking", children: [
2888
+ /* @__PURE__ */ jsxRuntime.jsxs(
2889
+ "button",
2890
+ {
2891
+ type: "button",
2892
+ className: "payman-v2-thinking-toggle",
2893
+ onClick: () => setOpen((o) => !o),
2894
+ "aria-expanded": open,
2895
+ children: [
2896
+ /* @__PURE__ */ jsxRuntime.jsx(
2897
+ lucideReact.ChevronRight,
2898
+ {
2899
+ className: cn(
2900
+ "payman-v2-thinking-chevron",
2901
+ open && "payman-v2-thinking-chevron-open"
2902
+ ),
2903
+ "aria-hidden": true
2904
+ }
2905
+ ),
2906
+ headerLabel
2907
+ ]
2908
+ }
2909
+ ),
2910
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-thinking-border", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: open && /* @__PURE__ */ jsxRuntime.jsx(
2911
+ framerMotion.motion.div,
2912
+ {
2913
+ className: "payman-v2-thinking-content",
2914
+ initial: { height: 0, opacity: 0 },
2915
+ animate: { height: "auto", opacity: 1 },
2916
+ exit: { height: 0, opacity: 0 },
2917
+ transition: { duration: 0.2, ease: "easeInOut" },
2918
+ style: { overflow: "hidden" },
2919
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2920
+ parsed.map((item, i) => {
2921
+ if (item.type === "statement") {
2922
+ return /* @__PURE__ */ jsxRuntime.jsx(
2923
+ "div",
2924
+ {
2925
+ className: "payman-v2-thinking-statement",
2926
+ children: item.text
2927
+ },
2928
+ i
2929
+ );
2930
+ }
2931
+ if (item.type === "detail") {
2932
+ return /* @__PURE__ */ jsxRuntime.jsx(
2933
+ "div",
2934
+ {
2935
+ className: "payman-v2-thinking-detail",
2936
+ children: item.text
2937
+ },
2938
+ i
2939
+ );
2940
+ }
2941
+ return /* @__PURE__ */ jsxRuntime.jsx(
2942
+ "span",
2943
+ {
2944
+ className: cn(
2945
+ "payman-v2-thinking-status",
2946
+ item.variant === "success" ? "payman-v2-thinking-status-success" : "payman-v2-thinking-status-error"
2947
+ ),
2948
+ children: item.text
2949
+ },
2950
+ i
2951
+ );
2952
+ }),
2953
+ isStreaming && /* @__PURE__ */ jsxRuntime.jsxs(
2954
+ "div",
2955
+ {
2956
+ className: "payman-v2-thinking-cursor",
2957
+ "aria-live": "polite",
2958
+ children: [
2959
+ /* @__PURE__ */ jsxRuntime.jsx(PaymanMark, {}),
2960
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsx(
2961
+ framerMotion.motion.span,
2962
+ {
2963
+ className: "payman-v2-thinking-cursor-label payman-v2-thinking-shimmer",
2964
+ initial: { opacity: 0, y: 2 },
2965
+ animate: { opacity: 1, y: 0 },
2966
+ exit: { opacity: 0, y: -2 },
2967
+ transition: { duration: 0.24, ease: [0.4, 0, 0.2, 1] },
2968
+ children: cursorText
2969
+ },
2970
+ cursorKey
2971
+ ) })
2972
+ ]
2973
+ }
2974
+ )
2975
+ ] })
2976
+ },
2977
+ "thinking-content"
2978
+ ) }) })
2979
+ ] });
2980
+ }
2981
+ var THINKING_SPEED = {
2982
+ normal: [6, 8],
2983
+ fast: 1,
2984
+ punctuation: [20, 30],
2985
+ newline: [12, 18],
2986
+ idle: 30
2987
+ };
2988
+ var RESPONSE_SPEED = {
2989
+ normal: [4, 8],
2990
+ fast: 1,
2991
+ punctuation: [20, 30],
2992
+ newline: [10, 15],
2993
+ idle: 30
2994
+ };
2995
+ function charDelay(char, speed) {
2996
+ if (char === "*") return speed.fast;
2997
+ if (char === "\n") return speed.newline[0] + Math.random() * speed.newline[1];
2998
+ if (".!?,;:".includes(char))
2999
+ return speed.punctuation[0] + Math.random() * speed.punctuation[1];
3000
+ return speed.normal[0] + Math.random() * speed.normal[1];
3001
+ }
3002
+ function useTypingEffect(targetText, enabled, speed = RESPONSE_SPEED, initialDisplayedText) {
3003
+ const [displayedText, setDisplayedText] = react.useState("");
3004
+ const displayedRef = react.useRef("");
3005
+ const targetRef = react.useRef(targetText);
3006
+ const enabledRef = react.useRef(enabled);
3007
+ const initialDisplayedRef = react.useRef(initialDisplayedText);
3008
+ const timerRef = react.useRef(null);
3009
+ const runningRef = react.useRef(false);
3010
+ targetRef.current = targetText;
3011
+ enabledRef.current = enabled;
3012
+ initialDisplayedRef.current = initialDisplayedText;
3013
+ react.useEffect(() => {
3014
+ if (!enabled) {
3015
+ if (timerRef.current) {
3016
+ clearTimeout(timerRef.current);
3017
+ timerRef.current = null;
3018
+ }
3019
+ runningRef.current = false;
3020
+ displayedRef.current = targetText;
3021
+ setDisplayedText(targetText);
3022
+ return;
3023
+ }
3024
+ if (displayedRef.current.length === 0 && initialDisplayedRef.current && targetRef.current.startsWith(initialDisplayedRef.current)) {
3025
+ displayedRef.current = initialDisplayedRef.current;
3026
+ setDisplayedText(initialDisplayedRef.current);
3027
+ }
3028
+ if (runningRef.current) return;
3029
+ runningRef.current = true;
3030
+ const tick = () => {
3031
+ if (!enabledRef.current) {
3032
+ runningRef.current = false;
3033
+ return;
3034
+ }
3035
+ if (displayedRef.current.length < targetRef.current.length) {
3036
+ const nextChar = targetRef.current[displayedRef.current.length];
3037
+ displayedRef.current += nextChar;
3038
+ setDisplayedText(displayedRef.current);
3039
+ const delay = charDelay(nextChar, speed);
3040
+ timerRef.current = setTimeout(tick, delay);
3041
+ } else {
3042
+ timerRef.current = setTimeout(tick, speed.idle);
3043
+ }
3044
+ };
3045
+ tick();
3046
+ return () => {
3047
+ if (timerRef.current) {
3048
+ clearTimeout(timerRef.current);
3049
+ timerRef.current = null;
3050
+ }
3051
+ runningRef.current = false;
3052
+ };
3053
+ }, [enabled]);
3054
+ const isTyping = enabled && displayedRef.current.length < targetRef.current.length;
3055
+ return {
3056
+ displayedText: enabled ? displayedText : targetText,
3057
+ isTyping
3058
+ };
3059
+ }
3060
+ var INITIAL_THINKING_PLACEHOLDER = [
3061
+ "**Getting things ready**",
3062
+ "Putting things together"
3063
+ ].join("\n");
3064
+ function getFormattedThinking(message, includeInitialPlaceholder = false) {
3065
+ const plainThinkingText = message.allThinkingText || message.activeThinkingText || "";
3066
+ const baseText = message.formattedThinkingText || paymanTypescriptAskSdk.buildFormattedThinking(message.steps, plainThinkingText);
3067
+ if (includeInitialPlaceholder && baseText) {
3068
+ return INITIAL_THINKING_PLACEHOLDER + "\n" + baseText;
3069
+ }
3070
+ if (includeInitialPlaceholder) {
3071
+ return INITIAL_THINKING_PLACEHOLDER;
3072
+ }
3073
+ return baseText;
3074
+ }
3075
+ function AssistantMessageV2({
3076
+ message,
3077
+ onImageClick,
3078
+ onExecutionTraceClick,
3079
+ actions
3080
+ }) {
3081
+ const [copied, setCopied] = react.useState(false);
3082
+ const [toast, setToast] = react.useState(null);
3083
+ const copyResetTimerRef = react.useRef(null);
3084
+ const toastTimerRef = react.useRef(null);
3085
+ const showCopyAction = actions?.copy ?? true;
3086
+ const showTraceAction = (actions?.trace ?? true) && !!onExecutionTraceClick;
3087
+ const hasEverStreamed = react.useRef(!!message.isStreaming);
3088
+ const hasShownInitialThinking = react.useRef(
3089
+ message.streamProgress === "processing"
3090
+ );
3091
+ if (message.isStreaming) hasEverStreamed.current = true;
3092
+ react.useEffect(() => {
3093
+ return () => {
3094
+ if (copyResetTimerRef.current) clearTimeout(copyResetTimerRef.current);
3095
+ if (toastTimerRef.current) clearTimeout(toastTimerRef.current);
3096
+ };
3097
+ }, []);
3098
+ const rawResponseContent = (() => {
3099
+ const raw = message.isStreaming ? message.streamingContent || message.content : message.content;
3100
+ if (!raw) return "";
3101
+ return raw.replace(/\\n/g, "\n");
3102
+ })();
3103
+ const hasReadyStreamPhase = message.streamProgress === "processing" || Boolean(message.steps?.length) || Boolean(message.allThinkingText) || Boolean(message.activeThinkingText) || Boolean(rawResponseContent);
3104
+ if (hasReadyStreamPhase && !message.isError) {
3105
+ hasShownInitialThinking.current = true;
3106
+ }
3107
+ const includeInitialPlaceholder = hasShownInitialThinking.current && !message.isError;
3108
+ const rawThinkingContent = react.useMemo(
3109
+ () => getFormattedThinking(message, includeInitialPlaceholder),
3110
+ [message, includeInitialPlaceholder]
3111
+ );
3112
+ const isThinkingStreaming = !!message.isStreaming && !rawResponseContent && !message.isError;
3113
+ const { displayedText: thinkingContent } = useTypingEffect(
3114
+ rawThinkingContent,
3115
+ hasEverStreamed.current && isThinkingStreaming,
3116
+ THINKING_SPEED,
3117
+ includeInitialPlaceholder ? INITIAL_THINKING_PLACEHOLDER : void 0
3118
+ );
3119
+ const hasThinkingContent = Boolean(thinkingContent);
3120
+ const showThinkingBlock = hasThinkingContent || isThinkingStreaming;
3121
+ const showLegacyThinkingPhase = !!message.isStreaming && !message.isError && !rawResponseContent && message.streamProgress === "started";
3122
+ const responseTypingEnabled = hasEverStreamed.current && Boolean(rawResponseContent) && !message.isError;
3123
+ const { displayedText: displayContent, isTyping: isResponseTyping } = useTypingEffect(rawResponseContent, responseTypingEnabled, RESPONSE_SPEED);
3124
+ const resolvedErrorText = (() => {
3125
+ const conflictErrorMessage2 = getConflictErrorMessage(message.errorDetails);
3126
+ if (conflictErrorMessage2) {
3127
+ return conflictErrorMessage2;
3128
+ }
3129
+ if (isFriendlyWorkflowError(message.errorDetails) && !message.errorDetails) {
3130
+ return "Oops, something went wrong. Please try again.";
3131
+ }
3132
+ return message.errorDetails;
3133
+ })();
3134
+ const requestStartedAt = react.useMemo(() => {
3135
+ if (!message.timestamp) return void 0;
3136
+ const t = Date.parse(message.timestamp);
3137
+ return Number.isFinite(t) ? t : void 0;
3138
+ }, [message.timestamp]);
3139
+ const thinkingDuration = (() => {
3140
+ const steps = message.steps;
3141
+ if (!steps || steps.length === 0) return void 0;
3142
+ const last = steps[steps.length - 1];
3143
+ if (requestStartedAt && last.timestamp) {
3144
+ return Math.max(
3145
+ 0,
3146
+ Math.round((last.timestamp - requestStartedAt) / 1e3)
3147
+ );
3148
+ }
3149
+ const first = steps[0];
3150
+ if (first.timestamp && last.timestamp) {
3151
+ return Math.round((last.timestamp - first.timestamp) / 1e3);
3152
+ }
3153
+ const total = steps.reduce((sum, s) => sum + (s.elapsedMs || 0), 0);
3154
+ return total > 0 ? Math.round(total / 1e3) : void 0;
3155
+ })();
3156
+ const conflictErrorMessage = getConflictErrorMessage(message.errorDetails);
3157
+ const isConflictError = Boolean(conflictErrorMessage);
3158
+ if (isConflictError) {
3159
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-assistant-msg payman-v2-fade-in", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-assistant-msg-error", children: [
3160
+ /* @__PURE__ */ jsxRuntime.jsx(
3161
+ lucideReact.AlertCircle,
3162
+ {
3163
+ className: "payman-v2-assistant-msg-error-icon",
3164
+ style: { width: 16, height: 16 }
3165
+ }
3166
+ ),
3167
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-assistant-msg-error-text", children: conflictErrorMessage }) })
3168
+ ] }) });
3169
+ }
3170
+ if (message.isError && !displayContent && !hasThinkingContent) {
3171
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-assistant-msg payman-v2-fade-in", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-assistant-msg-error", children: [
3172
+ /* @__PURE__ */ jsxRuntime.jsx(
3173
+ lucideReact.AlertCircle,
3174
+ {
3175
+ className: "payman-v2-assistant-msg-error-icon",
3176
+ style: { width: 16, height: 16 }
3177
+ }
3178
+ ),
3179
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: resolvedErrorText ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-assistant-msg-error-text", children: resolvedErrorText }) : null })
3180
+ ] }) });
3181
+ }
3182
+ if (showLegacyThinkingPhase) {
3183
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-assistant-msg payman-v2-fade-in", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-assistant-msg-thinking-only payman-v2-thinking-shimmer", children: "Working on it\u2026" }) });
3184
+ }
3185
+ const showToast = (label, tone) => {
3186
+ if (toastTimerRef.current) clearTimeout(toastTimerRef.current);
3187
+ setToast({ label, tone });
3188
+ toastTimerRef.current = setTimeout(() => setToast(null), 1800);
3189
+ };
3190
+ const handleCopy = async () => {
3191
+ try {
3192
+ if (!navigator.clipboard?.writeText) {
3193
+ throw new Error("Clipboard unavailable");
3194
+ }
3195
+ await navigator.clipboard.writeText(displayContent);
3196
+ if (copyResetTimerRef.current) clearTimeout(copyResetTimerRef.current);
3197
+ setCopied(true);
3198
+ copyResetTimerRef.current = setTimeout(() => setCopied(false), 1800);
3199
+ showToast("Copied to clipboard", "success");
3200
+ } catch {
3201
+ setCopied(false);
3202
+ showToast("Could not copy", "error");
3203
+ }
3204
+ };
3205
+ const handleTrace = () => {
3206
+ onExecutionTraceClick?.({
3207
+ message,
3208
+ tracingData: message.tracingData,
3209
+ executionId: message.executionId
3210
+ });
3211
+ };
3212
+ const hasPartialError = message.isError && displayContent && !isConflictError;
3213
+ const isDone = !message.isStreaming && displayContent && !hasPartialError && !isResponseTyping;
3214
+ const hasVisibleDoneActions = showCopyAction || showTraceAction;
3215
+ const isCancelled = message.isCancelled;
3216
+ const toastPortal = typeof document !== "undefined" ? reactDom.createPortal(
3217
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: toast && /* @__PURE__ */ jsxRuntime.jsx(
3218
+ framerMotion.motion.div,
3219
+ {
3220
+ initial: { opacity: 0, y: -18, scale: 0.96 },
3221
+ animate: { opacity: 1, y: 0, scale: 1 },
3222
+ exit: { opacity: 0, y: -12, scale: 0.96 },
3223
+ transition: {
3224
+ type: "spring",
3225
+ stiffness: 360,
3226
+ damping: 26,
3227
+ mass: 0.7
3228
+ },
3229
+ className: "payman-v2-toast",
3230
+ role: "status",
3231
+ "aria-live": "polite",
3232
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3233
+ "div",
3234
+ {
3235
+ className: cn(
3236
+ "payman-v2-toast-inner",
3237
+ toast.tone === "success" ? "payman-v2-toast-success" : "payman-v2-toast-error"
3238
+ ),
3239
+ children: [
3240
+ toast.tone === "success" ? /* @__PURE__ */ jsxRuntime.jsx(
3241
+ lucideReact.Check,
3242
+ {
3243
+ className: "h-4 w-4",
3244
+ style: { color: "#059669" }
3245
+ }
3246
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3247
+ lucideReact.AlertCircle,
3248
+ {
3249
+ className: "h-4 w-4",
3250
+ style: { color: "#ef4444" }
3251
+ }
3252
+ ),
3253
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: toast.label })
3254
+ ]
3255
+ }
3256
+ )
3257
+ }
3258
+ ) }),
3259
+ document.body
3260
+ ) : null;
3261
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3262
+ toastPortal,
3263
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-assistant-msg payman-v2-fade-in", children: [
3264
+ showThinkingBlock && /* @__PURE__ */ jsxRuntime.jsx(
3265
+ ThinkingBlockV2,
3266
+ {
3267
+ content: thinkingContent,
3268
+ isStreaming: isThinkingStreaming,
3269
+ durationSec: thinkingDuration,
3270
+ startedAt: requestStartedAt
3271
+ }
3272
+ ),
3273
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-assistant-msg-content-area", children: displayContent ? /* @__PURE__ */ jsxRuntime.jsx(
3274
+ MarkdownRendererV2,
3275
+ {
3276
+ content: displayContent,
3277
+ isStreaming: message.isStreaming && !isCancelled || isResponseTyping,
3278
+ isResolvingImages: message.isResolvingImages,
3279
+ onImageClick
3280
+ }
3281
+ ) : !isThinkingStreaming && !hasThinkingContent ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-assistant-msg-placeholder", children: "..." }) : null }),
3282
+ isCancelled && message.isStreaming && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-assistant-msg-paused", children: [
3283
+ /* @__PURE__ */ jsxRuntime.jsx(
3284
+ lucideReact.WifiOff,
3285
+ {
3286
+ style: { width: 14, height: 14, color: "rgba(217, 119, 6, 0.7)", flexShrink: 0 }
3287
+ }
3288
+ ),
3289
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-assistant-msg-paused-text", children: "Connection slow - resuming\u2026" })
3290
+ ] }),
3291
+ hasPartialError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-assistant-msg-partial-error", children: [
3292
+ /* @__PURE__ */ jsxRuntime.jsx(
3293
+ lucideReact.AlertCircle,
3294
+ {
3295
+ className: "payman-v2-assistant-msg-error-icon",
3296
+ style: { width: 16, height: 16 }
3297
+ }
3298
+ ),
3299
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: resolvedErrorText ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-assistant-msg-error-text", children: resolvedErrorText }) : null })
3300
+ ] }),
3301
+ isDone && hasVisibleDoneActions && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-assistant-msg-actions", children: [
3302
+ showCopyAction && /* @__PURE__ */ jsxRuntime.jsx(ActionTooltipV2, { label: "Copy", children: /* @__PURE__ */ jsxRuntime.jsx(
3303
+ "button",
3304
+ {
3305
+ onClick: () => void handleCopy(),
3306
+ className: cn(
3307
+ "payman-v2-assistant-msg-action-btn",
3308
+ copied && "payman-v2-assistant-msg-action-btn-active"
3309
+ ),
3310
+ "aria-label": "Copy",
3311
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { style: { width: 16, height: 16 } }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { style: { width: 16, height: 16 } })
3312
+ }
3313
+ ) }),
3314
+ showTraceAction && /* @__PURE__ */ jsxRuntime.jsx(ActionTooltipV2, { label: "Trace", children: /* @__PURE__ */ jsxRuntime.jsx(
3315
+ "button",
3316
+ {
3317
+ onClick: handleTrace,
3318
+ className: "payman-v2-assistant-msg-action-btn",
3319
+ "aria-label": "Trace response",
3320
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchCode, { style: { width: 16, height: 16 } })
3321
+ }
3322
+ ) })
3323
+ ] })
3324
+ ] })
3325
+ ] });
3326
+ }
3327
+ var DEFAULT_MAX_LENGTH2 = 6;
3328
+ var MAX_SUPPORTED_LENGTH2 = 12;
3329
+ var AUTO_FOCUS_DELAY_MS2 = 250;
3330
+ function OtpInputV2({
3331
+ value,
3332
+ onChange,
3333
+ maxLength,
3334
+ disabled = false,
3335
+ error = false
3336
+ }) {
3337
+ const inputRefs = react.useRef([]);
3338
+ const safeMaxLength = Number.isInteger(maxLength) && maxLength > 0 ? Math.min(maxLength, MAX_SUPPORTED_LENGTH2) : DEFAULT_MAX_LENGTH2;
3339
+ const digits = value.split("").concat(Array(safeMaxLength).fill("")).slice(0, safeMaxLength);
3340
+ react.useEffect(() => {
3341
+ if (disabled) return;
3342
+ const timer = window.setTimeout(() => {
3343
+ inputRefs.current[0]?.focus();
3344
+ }, AUTO_FOCUS_DELAY_MS2);
3345
+ return () => window.clearTimeout(timer);
3346
+ }, [disabled]);
3347
+ const focusInput = (index) => {
3348
+ if (index >= 0 && index < safeMaxLength) {
3349
+ inputRefs.current[index]?.focus();
3350
+ }
3351
+ };
3352
+ const updateValue = (newDigits) => {
3353
+ onChange(newDigits.join("").slice(0, safeMaxLength));
3354
+ };
3355
+ const handleChange = (index, char) => {
3356
+ if (char && !/^\d$/.test(char)) return;
3357
+ const newDigits = [...digits];
3358
+ newDigits[index] = char;
3359
+ updateValue(newDigits);
3360
+ if (char && index < safeMaxLength - 1) focusInput(index + 1);
3361
+ };
3362
+ const handleKeyDown = (index, e) => {
3363
+ if (e.key === "Enter") {
3364
+ e.preventDefault();
3365
+ return;
3366
+ }
3367
+ if (e.key === "Backspace") {
3368
+ e.preventDefault();
3369
+ if (digits[index]) {
3370
+ const newDigits = [...digits];
3371
+ newDigits[index] = "";
3372
+ updateValue(newDigits);
3373
+ } else if (index > 0) {
3374
+ const newDigits = [...digits];
3375
+ newDigits[index - 1] = "";
3376
+ updateValue(newDigits);
3377
+ focusInput(index - 1);
3378
+ }
3379
+ return;
3380
+ }
3381
+ if (e.key === "ArrowLeft") {
3382
+ e.preventDefault();
3383
+ focusInput(index - 1);
3384
+ } else if (e.key === "ArrowRight") {
3385
+ e.preventDefault();
3386
+ focusInput(index + 1);
3387
+ }
3388
+ };
3389
+ const handlePaste = (e) => {
3390
+ e.preventDefault();
3391
+ const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, safeMaxLength);
3392
+ if (!pasted) return;
3393
+ const newDigits = pasted.split("").concat(Array(safeMaxLength).fill("")).slice(0, safeMaxLength);
3394
+ updateValue(newDigits);
3395
+ focusInput(Math.min(pasted.length, safeMaxLength - 1));
3396
+ };
3397
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("payman-v2-otp", error && "payman-v2-shake"), children: digits.map((digit, i) => /* @__PURE__ */ jsxRuntime.jsx(
3398
+ "input",
3399
+ {
3400
+ ref: (el) => {
3401
+ inputRefs.current[i] = el;
3402
+ },
3403
+ type: "text",
3404
+ inputMode: "numeric",
3405
+ maxLength: 1,
3406
+ value: digit,
3407
+ disabled,
3408
+ onChange: (e) => handleChange(i, e.target.value.slice(-1)),
3409
+ onKeyDown: (e) => handleKeyDown(i, e),
3410
+ onPaste: handlePaste,
3411
+ onFocus: (e) => e.target.select(),
3412
+ "aria-label": `Digit ${i + 1}`,
3413
+ className: cn(
3414
+ "payman-v2-otp-digit",
3415
+ digit && "payman-v2-otp-digit-filled",
3416
+ error && "payman-v2-otp-digit-error"
3417
+ )
3418
+ },
3419
+ i
3420
+ )) });
3421
+ }
3422
+ var RESEND_COOLDOWN_S = 30;
3423
+ var OTP_LEN = 6;
3424
+ function VerificationCardV2({
3425
+ messageId,
3426
+ action,
3427
+ status,
3428
+ onApprove,
3429
+ onReject,
3430
+ onResend
3431
+ }) {
3432
+ const [otp, setOtp] = react.useState("");
3433
+ const [otpErrored, setOtpErrored] = react.useState(false);
3434
+ const [resendSec, setResendSec] = react.useState(0);
3435
+ const lastSubmittedRef = react.useRef(null);
3436
+ const resendTimerRef = react.useRef(void 0);
3437
+ react.useEffect(() => {
3438
+ if (status !== "error") {
3439
+ setOtpErrored(false);
3440
+ return;
3441
+ }
3442
+ setOtpErrored(true);
3443
+ const t = window.setTimeout(() => {
3444
+ setOtp("");
3445
+ setOtpErrored(false);
3446
+ lastSubmittedRef.current = null;
3447
+ }, 600);
3448
+ return () => window.clearTimeout(t);
3449
+ }, [status]);
3450
+ react.useEffect(() => {
3451
+ if (otp.length < OTP_LEN) {
3452
+ lastSubmittedRef.current = null;
3453
+ }
3454
+ }, [otp]);
3455
+ react.useEffect(() => {
3456
+ if (otp.length !== OTP_LEN || !/^\d+$/.test(otp) || status !== "pending") {
3457
+ return;
3458
+ }
3459
+ if (lastSubmittedRef.current === otp) return;
3460
+ lastSubmittedRef.current = otp;
3461
+ void onApprove(messageId, otp);
3462
+ }, [messageId, onApprove, otp, status]);
3463
+ react.useEffect(() => {
3464
+ return () => {
3465
+ if (typeof resendTimerRef.current === "number") {
3466
+ window.clearInterval(resendTimerRef.current);
3467
+ }
3468
+ };
3469
+ }, []);
3470
+ const startResendCooldown = react.useCallback(() => {
3471
+ setResendSec(RESEND_COOLDOWN_S);
3472
+ if (typeof resendTimerRef.current === "number") {
3473
+ window.clearInterval(resendTimerRef.current);
3474
+ }
3475
+ resendTimerRef.current = window.setInterval(() => {
3476
+ setResendSec((s) => {
3477
+ if (s <= 1) {
3478
+ if (typeof resendTimerRef.current === "number") {
3479
+ window.clearInterval(resendTimerRef.current);
3480
+ resendTimerRef.current = void 0;
3481
+ }
3482
+ return 0;
3483
+ }
3484
+ return s - 1;
3485
+ });
3486
+ }, 1e3);
3487
+ }, []);
3488
+ const handleResend = react.useCallback(async () => {
3489
+ if (resendSec > 0 || status === "verifying") return;
3490
+ await onResend(messageId);
3491
+ startResendCooldown();
3492
+ }, [messageId, onResend, resendSec, startResendCooldown, status]);
3493
+ const handleCancel = react.useCallback(async () => {
3494
+ await onReject(messageId);
3495
+ }, [messageId, onReject]);
3496
+ react.useCallback(async () => {
3497
+ if (otp.length !== OTP_LEN || !/^\d+$/.test(otp) || status !== "pending") {
3498
+ return;
3499
+ }
3500
+ if (lastSubmittedRef.current === otp) return;
3501
+ lastSubmittedRef.current = otp;
3502
+ await onApprove(messageId, otp);
3503
+ }, [messageId, onApprove, otp, status]);
3504
+ const busy = status === "verifying";
3505
+ status === "pending" && otp.length === OTP_LEN && /^\d+$/.test(otp);
3506
+ if (status === "approved" || status === "rejected") {
3507
+ return null;
3508
+ }
3509
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3510
+ framerMotion.motion.div,
3511
+ {
3512
+ className: "payman-v2-verification",
3513
+ initial: { opacity: 0, y: 10 },
3514
+ animate: { opacity: 1, y: 0 },
3515
+ transition: { type: "spring", stiffness: 320, damping: 28 },
3516
+ children: [
3517
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-verification-card", children: [
3518
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-verification-header", children: [
3519
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-verification-header-row", children: [
3520
+ /* @__PURE__ */ jsxRuntime.jsx(
3521
+ lucideReact.ShieldCheck,
3522
+ {
3523
+ className: "payman-v2-verification-icon",
3524
+ size: 18,
3525
+ strokeWidth: 1.75,
3526
+ "aria-hidden": true
3527
+ }
3528
+ ),
3529
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-verification-title", children: "Verify" }),
3530
+ action.amount != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-verification-amount", children: action.amount }) : action.payeeName ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-verification-payee", children: action.payeeName }) : null
3531
+ ] }),
3532
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-verification-description", children: "Enter the 6-digit code sent to your phone" }),
3533
+ /* @__PURE__ */ jsxRuntime.jsx(
3534
+ OtpInputV2,
3535
+ {
3536
+ value: otp,
3537
+ onChange: setOtp,
3538
+ maxLength: OTP_LEN,
3539
+ disabled: busy,
3540
+ error: otpErrored
3541
+ }
3542
+ ),
3543
+ busy ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-verification-submitting", children: [
3544
+ /* @__PURE__ */ jsxRuntime.jsx(
3545
+ framerMotion.motion.span,
3546
+ {
3547
+ "aria-hidden": true,
3548
+ style: { display: "inline-flex" },
3549
+ animate: { rotate: 360 },
3550
+ transition: {
3551
+ repeat: Infinity,
3552
+ duration: 0.7,
3553
+ ease: "linear"
3554
+ },
3555
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 14, strokeWidth: 2 })
3556
+ }
3557
+ ),
3558
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-verification-submitting-text", children: "Verifying..." })
3559
+ ] }) : null
3560
+ ] }),
3561
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-verification-actions", children: /* @__PURE__ */ jsxRuntime.jsx(
3562
+ "button",
3563
+ {
3564
+ type: "button",
3565
+ className: "payman-v2-verification-cancel-btn",
3566
+ disabled: busy,
3567
+ onClick: () => void handleCancel(),
3568
+ children: "Cancel"
3569
+ }
3570
+ ) })
3571
+ ] }),
3572
+ /* @__PURE__ */ jsxRuntime.jsx(
3573
+ "button",
3574
+ {
3575
+ type: "button",
3576
+ className: "payman-v2-verification-resend-link",
3577
+ disabled: busy || resendSec > 0,
3578
+ onClick: () => void handleResend(),
3579
+ children: resendSec > 0 ? `Resend (${resendSec}s)` : "Resend"
3580
+ }
3581
+ )
3582
+ ]
3583
+ }
3584
+ );
3585
+ }
3586
+ var SCROLL_THRESHOLD2 = 100;
3587
+ var MessageListV2 = react.forwardRef(
3588
+ function MessageListV22({
3589
+ messages,
3590
+ isStreaming: _isStreaming = false,
3591
+ onEditUserMessage,
3592
+ onRetryUserMessage,
3593
+ onImageClick,
3594
+ onExecutionTraceClick,
3595
+ messageActions,
3596
+ retryDisabled = false,
3597
+ userAction,
3598
+ onApproveAction,
3599
+ onRejectAction,
3600
+ onResendAction
3601
+ }, ref) {
3602
+ const scrollRef = react.useRef(null);
3603
+ const scrollInnerRef = react.useRef(null);
3604
+ const isNearBottomRef = react.useRef(true);
3605
+ const [showScrollBtn, setShowScrollBtn] = react.useState(false);
3606
+ const prevCountRef = react.useRef(messages.length);
3607
+ const pauseStickUntilUserMessageRef = react.useRef(false);
3608
+ const followingBottomRef = react.useRef(true);
3609
+ const isProgrammaticScrollRef = react.useRef(false);
3610
+ const getDistanceFromBottom = react.useCallback(() => {
3611
+ const el = scrollRef.current;
3612
+ if (!el) return 0;
3613
+ return el.scrollHeight - el.scrollTop - el.clientHeight;
3614
+ }, []);
3615
+ const scrollToBottom = react.useCallback(
3616
+ (behavior = "smooth") => {
3617
+ const el = scrollRef.current;
3618
+ if (!el) return;
3619
+ isProgrammaticScrollRef.current = true;
3620
+ pauseStickUntilUserMessageRef.current = false;
3621
+ followingBottomRef.current = true;
3622
+ el.scrollTo({ top: el.scrollHeight, behavior });
3623
+ const clear = () => {
3624
+ isProgrammaticScrollRef.current = false;
3625
+ };
3626
+ if (behavior === "instant") {
3627
+ requestAnimationFrame(clear);
3628
+ } else {
3629
+ setTimeout(clear, 400);
3630
+ }
3631
+ },
3632
+ []
3633
+ );
3634
+ react.useImperativeHandle(
3635
+ ref,
3636
+ () => ({
3637
+ scrollToBottom: (behavior = "smooth") => {
3638
+ isNearBottomRef.current = true;
3639
+ pauseStickUntilUserMessageRef.current = false;
3640
+ followingBottomRef.current = true;
3641
+ setShowScrollBtn(false);
3642
+ scrollToBottom(behavior);
3643
+ }
3644
+ }),
3645
+ [scrollToBottom]
3646
+ );
3647
+ const handleScroll = react.useCallback(() => {
3648
+ const distance = getDistanceFromBottom();
3649
+ const nearBottom = distance <= SCROLL_THRESHOLD2;
3650
+ isNearBottomRef.current = nearBottom;
3651
+ setShowScrollBtn(!nearBottom);
3652
+ if (isProgrammaticScrollRef.current) return;
3653
+ if (!nearBottom) {
3654
+ followingBottomRef.current = false;
3655
+ pauseStickUntilUserMessageRef.current = true;
3656
+ }
3657
+ }, [getDistanceFromBottom]);
3658
+ react.useEffect(() => {
3659
+ const prevCount = prevCountRef.current;
3660
+ prevCountRef.current = messages.length;
3661
+ if (messages.length > prevCount) {
3662
+ const last = messages[messages.length - 1];
3663
+ if (last?.role === "user") {
3664
+ pauseStickUntilUserMessageRef.current = false;
3665
+ followingBottomRef.current = true;
3666
+ requestAnimationFrame(() => scrollToBottom());
3667
+ } else if (!pauseStickUntilUserMessageRef.current && followingBottomRef.current) {
3668
+ requestAnimationFrame(() => scrollToBottom("instant"));
3669
+ }
3670
+ }
3671
+ }, [messages.length, scrollToBottom]);
3672
+ react.useEffect(() => {
3673
+ const lastMsg = messages[messages.length - 1];
3674
+ if (!lastMsg?.isStreaming) return;
3675
+ if (pauseStickUntilUserMessageRef.current) return;
3676
+ if (!followingBottomRef.current) return;
3677
+ const el = scrollRef.current;
3678
+ if (!el) return;
3679
+ isProgrammaticScrollRef.current = true;
3680
+ el.scrollTop = el.scrollHeight;
3681
+ requestAnimationFrame(() => {
3682
+ isProgrammaticScrollRef.current = false;
3683
+ });
3684
+ });
3685
+ react.useEffect(() => {
3686
+ const inner = scrollInnerRef.current;
3687
+ if (!inner) return;
3688
+ const pinIfFollowing = () => {
3689
+ if (pauseStickUntilUserMessageRef.current) return;
3690
+ if (!followingBottomRef.current) return;
3691
+ const el = scrollRef.current;
3692
+ if (!el) return;
3693
+ isProgrammaticScrollRef.current = true;
3694
+ el.scrollTop = el.scrollHeight;
3695
+ requestAnimationFrame(() => {
3696
+ isProgrammaticScrollRef.current = false;
3697
+ });
3698
+ };
3699
+ const ro = new ResizeObserver(() => {
3700
+ pinIfFollowing();
3701
+ });
3702
+ ro.observe(inner);
3703
+ return () => ro.disconnect();
3704
+ }, []);
3705
+ react.useEffect(() => {
3706
+ if (messages.length > 0) {
3707
+ setTimeout(() => scrollToBottom("instant"), 50);
3708
+ }
3709
+ }, []);
3710
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-message-list", children: [
3711
+ /* @__PURE__ */ jsxRuntime.jsx(
3712
+ "div",
3713
+ {
3714
+ ref: scrollRef,
3715
+ onScroll: handleScroll,
3716
+ className: "payman-v2-message-scroll payman-v2-scrollbar",
3717
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3718
+ "div",
3719
+ {
3720
+ ref: scrollInnerRef,
3721
+ className: "payman-v2-message-scroll-inner",
3722
+ children: [
3723
+ messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: message.role === "user" ? /* @__PURE__ */ jsxRuntime.jsx(
3724
+ UserMessageV2,
3725
+ {
3726
+ message,
3727
+ onEdit: onEditUserMessage,
3728
+ onRetry: onRetryUserMessage,
3729
+ retryDisabled,
3730
+ actions: messageActions?.userMessageActions
3731
+ }
3732
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3733
+ AssistantMessageV2,
3734
+ {
3735
+ message,
3736
+ onImageClick,
3737
+ onExecutionTraceClick,
3738
+ actions: messageActions?.assistantMessageActions
3739
+ }
3740
+ ) }, message.id)),
3741
+ userAction && userAction.status !== "approved" && userAction.status !== "rejected" && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
3742
+ VerificationCardV2,
3743
+ {
3744
+ messageId: userAction.messageId,
3745
+ action: userAction.action,
3746
+ status: userAction.status,
3747
+ onApprove: onApproveAction ?? (async () => {
3748
+ }),
3749
+ onReject: onRejectAction ?? (async () => {
3750
+ }),
3751
+ onResend: onResendAction ?? (async () => {
3752
+ })
3753
+ }
3754
+ ) })
3755
+ ]
3756
+ }
3757
+ )
3758
+ }
3759
+ ),
3760
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: showScrollBtn && /* @__PURE__ */ jsxRuntime.jsx(
3761
+ framerMotion.motion.div,
3762
+ {
3763
+ initial: { opacity: 0, y: 6 },
3764
+ animate: { opacity: 1, y: 0 },
3765
+ exit: { opacity: 0, y: 6 },
3766
+ transition: { duration: 0.12 },
3767
+ className: "payman-v2-scroll-to-bottom",
3768
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3769
+ "button",
3770
+ {
3771
+ onClick: () => {
3772
+ scrollToBottom();
3773
+ },
3774
+ className: "payman-v2-scroll-to-bottom-btn",
3775
+ "aria-label": "Scroll to bottom",
3776
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { style: { width: 16, height: 16 } })
3777
+ }
3778
+ )
3779
+ }
3780
+ ) })
3781
+ ] });
3782
+ }
3783
+ );
3784
+ var ChatInputV2 = react.forwardRef(
3785
+ function ChatInputV22({
3786
+ onSend,
3787
+ onCancel,
3788
+ disabled = false,
3789
+ isStreaming = false,
3790
+ placeholder = "Reply...",
3791
+ enableVoice = false,
3792
+ voiceAvailable = false,
3793
+ isRecording = false,
3794
+ onVoicePress,
3795
+ transcribedText = "",
3796
+ showResetSession = false,
3797
+ onResetSession,
3798
+ showAttachmentButton = true,
3799
+ showUploadImageButton = true,
3800
+ showAttachFileButton = true,
3801
+ onUploadImageClick,
3802
+ onAttachFileClick,
3803
+ editingMessageId = null,
3804
+ onClearEditing,
3805
+ hideSendButton = false
3806
+ }, ref) {
3807
+ const [value, setValue] = react.useState("");
3808
+ const [isFocused, setIsFocused] = react.useState(false);
3809
+ const [showActions, setShowActions] = react.useState(false);
3810
+ const [showVoiceTooltip, setShowVoiceTooltip] = react.useState(false);
3811
+ const textareaRef = react.useRef(null);
3812
+ const actionsRef = react.useRef(null);
3813
+ const preRecordTextRef = react.useRef("");
3814
+ const voiceTooltipTimerRef = react.useRef(
3815
+ null
3816
+ );
3817
+ const voiceDraftSyncActiveRef = react.useRef(false);
3818
+ const isInputLocked = disabled || isRecording;
3819
+ const hasAttachmentOptions = showUploadImageButton || showAttachFileButton;
3820
+ const showAttachmentMenuButton = showAttachmentButton && hasAttachmentOptions;
3821
+ const showVoiceButton = enableVoice && onVoicePress != null;
3822
+ const isVoiceButtonDisabled = disabled || !voiceAvailable;
3823
+ react.useEffect(() => {
3824
+ if (textareaRef.current) {
3825
+ textareaRef.current.style.height = "auto";
3826
+ const scrollHeight = textareaRef.current.scrollHeight;
3827
+ textareaRef.current.style.height = `${Math.min(scrollHeight, 200)}px`;
3828
+ }
3829
+ }, [value]);
3830
+ react.useEffect(() => {
3831
+ if (disabled) {
3832
+ setIsFocused(false);
3833
+ setShowActions(false);
3834
+ textareaRef.current?.blur();
3835
+ return;
3836
+ }
3837
+ const frameId = requestAnimationFrame(() => textareaRef.current?.focus());
3838
+ return () => cancelAnimationFrame(frameId);
3839
+ }, [disabled]);
3840
+ react.useImperativeHandle(
3841
+ ref,
3842
+ () => ({
3843
+ setDraft: (message) => {
3844
+ setShowActions(false);
3845
+ setValue(message);
3846
+ requestAnimationFrame(() => {
3847
+ const textarea = textareaRef.current;
3848
+ if (!textarea || disabled) return;
3849
+ textarea.focus();
3850
+ const end = message.length;
3851
+ textarea.setSelectionRange(end, end);
3852
+ });
3853
+ }
3854
+ }),
3855
+ [disabled]
3856
+ );
3857
+ react.useEffect(() => {
3858
+ if (!showActions) return;
3859
+ const handleClickOutside = (e) => {
3860
+ if (actionsRef.current && !actionsRef.current.contains(e.target)) {
3861
+ setShowActions(false);
3862
+ }
3863
+ };
3864
+ document.addEventListener("mousedown", handleClickOutside);
3865
+ return () => document.removeEventListener("mousedown", handleClickOutside);
3866
+ }, [showActions]);
3867
+ react.useEffect(() => {
3868
+ if (!showAttachmentMenuButton) {
3869
+ setShowActions(false);
3870
+ }
3871
+ }, [showAttachmentMenuButton]);
3872
+ react.useEffect(() => {
3873
+ return () => {
3874
+ if (voiceTooltipTimerRef.current) {
3875
+ clearTimeout(voiceTooltipTimerRef.current);
3876
+ }
3877
+ };
3878
+ }, []);
3879
+ react.useEffect(() => {
3880
+ if (!voiceDraftSyncActiveRef.current) return;
3881
+ const base = preRecordTextRef.current;
3882
+ const separator = base && !base.endsWith(" ") && transcribedText ? " " : "";
3883
+ setValue(`${base}${separator}${transcribedText}`);
3884
+ }, [isRecording, transcribedText]);
3885
+ const handleSend = react.useCallback(() => {
3886
+ if (!value.trim() || disabled) return;
3887
+ voiceDraftSyncActiveRef.current = false;
3888
+ preRecordTextRef.current = "";
3889
+ onClearEditing?.();
3890
+ onSend(value.trim());
3891
+ setValue("");
3892
+ requestAnimationFrame(() => {
3893
+ if (textareaRef.current) {
3894
+ textareaRef.current.style.height = "auto";
3895
+ textareaRef.current.focus();
3896
+ }
3897
+ });
3898
+ }, [value, disabled, onClearEditing, onSend]);
3899
+ const handleKeyDown = (e) => {
3900
+ if (e.key === "Enter" && !e.shiftKey) {
3901
+ e.preventDefault();
3902
+ if (isStreaming || hideSendButton) return;
3903
+ handleSend();
3904
+ }
3905
+ };
3906
+ const handleUploadImageClick = () => {
3907
+ onUploadImageClick?.();
3908
+ setShowActions(false);
3909
+ };
3910
+ const handleAttachFileClick = () => {
3911
+ onAttachFileClick?.();
3912
+ setShowActions(false);
3913
+ };
3914
+ const hideVoiceTooltip = react.useCallback(() => {
3915
+ if (voiceTooltipTimerRef.current) {
3916
+ clearTimeout(voiceTooltipTimerRef.current);
3917
+ voiceTooltipTimerRef.current = null;
3918
+ }
3919
+ setShowVoiceTooltip(false);
3920
+ }, []);
3921
+ const startVoiceTooltipTimer = react.useCallback(() => {
3922
+ if (isVoiceButtonDisabled || isRecording) return;
3923
+ if (voiceTooltipTimerRef.current) {
3924
+ clearTimeout(voiceTooltipTimerRef.current);
3925
+ }
3926
+ voiceTooltipTimerRef.current = setTimeout(() => {
3927
+ setShowVoiceTooltip(true);
3928
+ voiceTooltipTimerRef.current = null;
3929
+ }, 2e3);
3930
+ }, [isRecording, isVoiceButtonDisabled]);
3931
+ const handleVoiceToggle = () => {
3932
+ hideVoiceTooltip();
3933
+ setShowActions(false);
3934
+ if (!onVoicePress || isVoiceButtonDisabled) return;
3935
+ if (!isRecording) {
3936
+ preRecordTextRef.current = value;
3937
+ voiceDraftSyncActiveRef.current = true;
3938
+ }
3939
+ onVoicePress();
3940
+ };
3941
+ const canSend = value.trim().length > 0 && !disabled;
3942
+ const sendDisabled = !canSend || isStreaming;
3943
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-input-container", children: [
3944
+ /* @__PURE__ */ jsxRuntime.jsxs(
3945
+ "div",
3946
+ {
3947
+ className: cn(
3948
+ "payman-v2-input-wrapper",
3949
+ (isFocused || isRecording) && "payman-v2-input-wrapper-focused"
3950
+ ),
3951
+ children: [
3952
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-input-body", children: [
3953
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: editingMessageId && /* @__PURE__ */ jsxRuntime.jsxs(
3954
+ framerMotion.motion.div,
3955
+ {
3956
+ initial: { opacity: 0, y: -4 },
3957
+ animate: { opacity: 1, y: 0 },
3958
+ exit: { opacity: 0, y: -4 },
3959
+ transition: { duration: 0.14, ease: "easeOut" },
3960
+ className: "payman-v2-input-editing-banner",
3961
+ children: [
3962
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-input-editing-banner-info", children: [
3963
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-input-editing-icon-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { style: { width: 12, height: 12 } }) }),
3964
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-input-editing-label", children: "Editing message" })
3965
+ ] }),
3966
+ onClearEditing && /* @__PURE__ */ jsxRuntime.jsx(
3967
+ "button",
3968
+ {
3969
+ type: "button",
3970
+ onClick: onClearEditing,
3971
+ className: "payman-v2-input-editing-close",
3972
+ "aria-label": "Stop editing message",
3973
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { style: { width: 14, height: 14 } })
3974
+ }
3975
+ )
3976
+ ]
3977
+ }
3978
+ ) }),
3979
+ /* @__PURE__ */ jsxRuntime.jsx(
3980
+ "textarea",
3981
+ {
3982
+ ref: textareaRef,
3983
+ value,
3984
+ onChange: (e) => {
3985
+ if (isRecording) return;
3986
+ const nextValue = e.target.value;
3987
+ voiceDraftSyncActiveRef.current = false;
3988
+ setValue(nextValue);
3989
+ if (editingMessageId && nextValue.length === 0) {
3990
+ onClearEditing?.();
3991
+ }
3992
+ },
3993
+ onKeyDown: handleKeyDown,
3994
+ onFocus: () => {
3995
+ if (!disabled) setIsFocused(true);
3996
+ },
3997
+ onBlur: () => setIsFocused(false),
3998
+ onMouseDown: (e) => {
3999
+ if (disabled) e.preventDefault();
4000
+ },
4001
+ "aria-disabled": disabled,
4002
+ readOnly: isInputLocked,
4003
+ tabIndex: disabled ? -1 : 0,
4004
+ placeholder: isRecording ? "Listening\u2026" : placeholder,
4005
+ className: "payman-v2-input-textarea",
4006
+ "data-disabled": disabled ? "true" : "false",
4007
+ rows: 1
4008
+ }
4009
+ )
4010
+ ] }),
4011
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-input-controls", children: [
4012
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-input-controls-left", children: [
4013
+ showResetSession && onResetSession && /* @__PURE__ */ jsxRuntime.jsxs(
4014
+ "button",
4015
+ {
4016
+ type: "button",
4017
+ onClick: onResetSession,
4018
+ disabled: isStreaming || isRecording,
4019
+ className: "payman-v2-input-new-session-btn",
4020
+ "aria-label": "New Session",
4021
+ title: "New Session",
4022
+ children: [
4023
+ /* @__PURE__ */ jsxRuntime.jsx(
4024
+ lucideReact.RotateCcw,
4025
+ {
4026
+ style: { width: 16, height: 16, strokeWidth: 2.25 }
4027
+ }
4028
+ ),
4029
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-input-new-session-tooltip", children: "New Session" })
4030
+ ]
4031
+ }
4032
+ ),
4033
+ showAttachmentMenuButton && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, ref: actionsRef, children: [
4034
+ /* @__PURE__ */ jsxRuntime.jsx(
4035
+ "button",
4036
+ {
4037
+ type: "button",
4038
+ onClick: () => setShowActions((current) => !current),
4039
+ disabled: disabled || isRecording,
4040
+ className: cn(
4041
+ "payman-v2-input-attach-btn",
4042
+ showActions && "payman-v2-input-attach-btn-active"
4043
+ ),
4044
+ "aria-label": "Attach",
4045
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4046
+ lucideReact.Plus,
4047
+ {
4048
+ style: { width: 20, height: 20, strokeWidth: 2 }
4049
+ }
4050
+ )
4051
+ }
4052
+ ),
4053
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: showActions && /* @__PURE__ */ jsxRuntime.jsxs(
4054
+ framerMotion.motion.div,
4055
+ {
4056
+ initial: { opacity: 0, y: 4, scale: 0.95 },
4057
+ animate: { opacity: 1, y: 0, scale: 1 },
4058
+ exit: { opacity: 0, y: 4, scale: 0.95 },
4059
+ transition: { duration: 0.12 },
4060
+ className: "payman-v2-input-attach-menu",
4061
+ children: [
4062
+ showUploadImageButton && /* @__PURE__ */ jsxRuntime.jsxs(
4063
+ "button",
4064
+ {
4065
+ type: "button",
4066
+ className: "payman-v2-input-attach-option",
4067
+ onClick: handleUploadImageClick,
4068
+ children: [
4069
+ /* @__PURE__ */ jsxRuntime.jsx(
4070
+ lucideReact.ImagePlus,
4071
+ {
4072
+ style: { width: 16, height: 16 },
4073
+ className: "payman-v2-input-attach-option-icon"
4074
+ }
4075
+ ),
4076
+ "Upload image"
4077
+ ]
4078
+ }
4079
+ ),
4080
+ showAttachFileButton && /* @__PURE__ */ jsxRuntime.jsxs(
4081
+ "button",
4082
+ {
4083
+ type: "button",
4084
+ className: "payman-v2-input-attach-option",
4085
+ onClick: handleAttachFileClick,
4086
+ children: [
4087
+ /* @__PURE__ */ jsxRuntime.jsx(
4088
+ lucideReact.Paperclip,
4089
+ {
4090
+ style: { width: 16, height: 16 },
4091
+ className: "payman-v2-input-attach-option-icon"
4092
+ }
4093
+ ),
4094
+ "Attach file"
4095
+ ]
4096
+ }
4097
+ )
4098
+ ]
4099
+ }
4100
+ ) })
4101
+ ] }),
4102
+ showVoiceButton && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
4103
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: showVoiceTooltip && /* @__PURE__ */ jsxRuntime.jsx(
4104
+ framerMotion.motion.div,
4105
+ {
4106
+ initial: { opacity: 0, y: 4, scale: 0.98 },
4107
+ animate: { opacity: 1, y: 0, scale: 1 },
4108
+ exit: { opacity: 0, y: 4, scale: 0.98 },
4109
+ transition: { duration: 0.14, ease: "easeOut" },
4110
+ className: "payman-v2-input-voice-tooltip",
4111
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-input-voice-tooltip-content", children: [
4112
+ "Chat with your voice",
4113
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-input-voice-tooltip-arrow" })
4114
+ ] })
4115
+ }
4116
+ ) }),
4117
+ /* @__PURE__ */ jsxRuntime.jsxs(
4118
+ "button",
4119
+ {
4120
+ type: "button",
4121
+ onClick: handleVoiceToggle,
4122
+ onMouseEnter: startVoiceTooltipTimer,
4123
+ onMouseLeave: hideVoiceTooltip,
4124
+ onFocus: startVoiceTooltipTimer,
4125
+ onBlur: hideVoiceTooltip,
4126
+ disabled: isVoiceButtonDisabled,
4127
+ className: cn(
4128
+ "payman-v2-input-mic-btn",
4129
+ isRecording && "payman-v2-input-mic-recording"
4130
+ ),
4131
+ "aria-label": isRecording ? "Stop recording" : "Voice input",
4132
+ children: [
4133
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { style: { width: 18, height: 18 } }),
4134
+ isRecording && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "payman-v2-input-mic-indicator" })
4135
+ ]
4136
+ }
4137
+ )
4138
+ ] })
4139
+ ] }),
4140
+ !hideSendButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-input-controls-right", children: /* @__PURE__ */ jsxRuntime.jsx(
4141
+ "button",
4142
+ {
4143
+ type: "button",
4144
+ onClick: handleSend,
4145
+ disabled: sendDisabled,
4146
+ className: cn(
4147
+ "payman-v2-input-send-btn",
4148
+ sendDisabled && "payman-v2-input-send-btn-disabled"
4149
+ ),
4150
+ "aria-label": "Send message",
4151
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4152
+ lucideReact.ArrowUp,
4153
+ {
4154
+ style: { width: 16, height: 16, strokeWidth: 2.5 },
4155
+ className: "payman-v2-input-send-icon"
4156
+ }
4157
+ )
4158
+ }
4159
+ ) })
4160
+ ] })
4161
+ ]
4162
+ }
4163
+ ),
4164
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-input-disclaimer", children: "AI can make mistakes. Please double-check responses." })
4165
+ ] });
4166
+ }
4167
+ );
4168
+ function ImageLightboxV2({ src, alt, onClose }) {
4169
+ const [isMounted, setIsMounted] = react.useState(false);
4170
+ const [isImageLoaded, setIsImageLoaded] = react.useState(false);
4171
+ react.useEffect(() => {
4172
+ setIsMounted(true);
4173
+ return () => setIsMounted(false);
4174
+ }, []);
4175
+ react.useEffect(() => {
4176
+ setIsImageLoaded(false);
4177
+ }, [src]);
4178
+ const handleKeyDown = react.useCallback(
4179
+ (e) => {
4180
+ if (e.key === "Escape") onClose();
4181
+ },
4182
+ [onClose]
4183
+ );
4184
+ react.useEffect(() => {
4185
+ if (!src || typeof document === "undefined") return;
4186
+ document.addEventListener("keydown", handleKeyDown);
4187
+ const previousOverflow = document.body.style.overflow;
4188
+ document.body.style.overflow = "hidden";
4189
+ return () => {
4190
+ document.removeEventListener("keydown", handleKeyDown);
4191
+ document.body.style.overflow = previousOverflow;
4192
+ };
4193
+ }, [src, handleKeyDown]);
4194
+ const handleDownload = () => {
4195
+ if (!src || typeof document === "undefined") return;
4196
+ const a = document.createElement("a");
4197
+ a.href = src;
4198
+ a.download = alt.trim() ? alt : "image";
4199
+ document.body.appendChild(a);
4200
+ a.click();
4201
+ a.remove();
4202
+ };
4203
+ if (!isMounted || typeof document === "undefined") {
4204
+ return null;
4205
+ }
4206
+ return reactDom.createPortal(
4207
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: src ? /* @__PURE__ */ jsxRuntime.jsxs(
4208
+ framerMotion.motion.div,
4209
+ {
4210
+ className: "payman-v2-lightbox",
4211
+ initial: { opacity: 0 },
4212
+ animate: { opacity: 1 },
4213
+ exit: { opacity: 0 },
4214
+ transition: { duration: 0.18 },
4215
+ onClick: onClose,
4216
+ role: "presentation",
4217
+ children: [
4218
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-lightbox-controls", children: [
4219
+ /* @__PURE__ */ jsxRuntime.jsx(
4220
+ "button",
4221
+ {
4222
+ type: "button",
4223
+ className: "payman-v2-lightbox-btn",
4224
+ "aria-label": "Download",
4225
+ onClick: (e) => {
4226
+ e.stopPropagation();
4227
+ handleDownload();
4228
+ },
4229
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { size: 20, strokeWidth: 2 })
4230
+ }
4231
+ ),
4232
+ /* @__PURE__ */ jsxRuntime.jsx(
4233
+ "button",
4234
+ {
4235
+ type: "button",
4236
+ className: "payman-v2-lightbox-btn",
4237
+ "aria-label": "Close",
4238
+ onClick: (e) => {
4239
+ e.stopPropagation();
4240
+ onClose();
4241
+ },
4242
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 20, strokeWidth: 2 })
4243
+ }
4244
+ )
4245
+ ] }),
4246
+ /* @__PURE__ */ jsxRuntime.jsxs(
4247
+ "div",
4248
+ {
4249
+ className: "payman-v2-lightbox-content",
4250
+ onClick: (e) => e.stopPropagation(),
4251
+ role: "dialog",
4252
+ "aria-modal": "true",
4253
+ "aria-label": alt || "Image preview",
4254
+ children: [
4255
+ !isImageLoaded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-v2-lightbox-loading", children: [
4256
+ /* @__PURE__ */ jsxRuntime.jsx(
4257
+ lucideReact.Loader2,
4258
+ {
4259
+ size: 24,
4260
+ strokeWidth: 2,
4261
+ "aria-hidden": true,
4262
+ style: {
4263
+ color: "rgba(255, 255, 255, 0.8)",
4264
+ animation: "payman-v2-spin 0.6s linear infinite"
4265
+ }
4266
+ }
4267
+ ),
4268
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payman-v2-lightbox-loading-text", children: "Loading image" })
4269
+ ] }) : null,
4270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payman-v2-lightbox-img-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(
4271
+ framerMotion.motion.div,
4272
+ {
4273
+ initial: { scale: 0.92, opacity: 0 },
4274
+ animate: {
4275
+ scale: isImageLoaded ? 1 : 0.92,
4276
+ opacity: isImageLoaded ? 1 : 0
4277
+ },
4278
+ exit: { scale: 0.92, opacity: 0 },
4279
+ transition: { duration: 0.2 },
4280
+ style: {
4281
+ display: "flex",
4282
+ height: "100%",
4283
+ width: "100%",
4284
+ alignItems: "center",
4285
+ justifyContent: "center"
4286
+ },
4287
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4288
+ "img",
4289
+ {
4290
+ className: "payman-v2-lightbox-img",
4291
+ src,
4292
+ alt,
4293
+ draggable: false,
4294
+ onLoad: () => setIsImageLoaded(true)
4295
+ }
4296
+ )
4297
+ }
4298
+ ) })
4299
+ ]
4300
+ }
4301
+ )
4302
+ ]
4303
+ },
4304
+ src
4305
+ ) : null }),
4306
+ document.body
4307
+ );
4308
+ }
4309
+ var DEFAULT_USER_ACTION_STATE = {
4310
+ request: null,
4311
+ result: null,
4312
+ clearOtpTrigger: 0
4313
+ };
4314
+ var NOOP_ASYNC = async () => {
4315
+ };
4316
+ function useSentryChatCallbacks(callbacks, config) {
4317
+ const sentryCtxRef = react.useRef({});
4318
+ const callbacksRef = react.useRef(callbacks);
4319
+ callbacksRef.current = callbacks;
4320
+ const initialSessionId = config.initialSessionId;
4321
+ const apiHeaders = config.api.headers;
4322
+ react.useEffect(() => {
4323
+ sentryCtxRef.current.workflowName = config.workflowName;
4324
+ sentryCtxRef.current.sessionOwnerId = config.sessionParams?.id;
4325
+ if (initialSessionId) {
4326
+ sentryCtxRef.current.sessionId = initialSessionId;
4327
+ }
4328
+ if (apiHeaders) {
4329
+ sentryCtxRef.current.customerId = apiHeaders["x-paygent-wf-mcp-customer-id"] ?? sentryCtxRef.current.customerId;
4330
+ sentryCtxRef.current.customerEmail = apiHeaders["x-paygent-wf-mcp-customer-email"] ?? sentryCtxRef.current.customerEmail;
4331
+ }
4332
+ }, [
4333
+ config.workflowName,
4334
+ config.sessionParams?.id,
4335
+ initialSessionId,
4336
+ apiHeaders
4337
+ ]);
4338
+ react.useEffect(() => {
4339
+ const endpoint = config.api.streamEndpoint || "/api/workflows/ask/stream";
4340
+ return subscribeToCfRay(endpoint, (cfRay) => {
4341
+ sentryCtxRef.current.cfRay = cfRay;
4342
+ });
4343
+ }, [config.api.streamEndpoint]);
4344
+ return react.useMemo(
4345
+ () => ({
4346
+ onMessageSent: (msg) => callbacksRef.current?.onMessageSent?.(msg),
4347
+ onStreamStart: () => callbacksRef.current?.onStreamStart?.(),
4348
+ onStreamComplete: (message) => {
4349
+ if (message.executionId) {
4350
+ sentryCtxRef.current.executionId = message.executionId;
4351
+ }
4352
+ if (message.sessionId) {
4353
+ sentryCtxRef.current.sessionId = message.sessionId;
4354
+ }
4355
+ const content = message.content ?? "";
4356
+ const looksLikeRawErr = content.length >= 10 && (content.includes("errorType=") || /failed:\s*\{/.test(content));
4357
+ const completedEmpty = !message.isStreaming && !message.isCancelled && content.length === 0 && (message.streamProgress === "completed" || message.streamProgress === "error");
4358
+ const hasConflict = !!getConflictErrorMessage(message.errorDetails);
4359
+ const hasFriendlyErr = isFriendlyWorkflowError(message.errorDetails);
4360
+ const shouldCapture = message.isError || hasConflict || hasFriendlyErr || looksLikeRawErr || completedEmpty;
4361
+ if (shouldCapture) {
4362
+ sentryCtxRef.current.route = typeof window !== "undefined" ? window.location.pathname : void 0;
4363
+ captureSentryError(
4364
+ `Workflow error: ${message.errorDetails || content || "Unknown error"}`,
4365
+ { ...sentryCtxRef.current }
4366
+ );
4367
+ }
4368
+ callbacksRef.current?.onStreamComplete?.(message);
4369
+ },
4370
+ onError: (error) => {
4371
+ sentryCtxRef.current.route = typeof window !== "undefined" ? window.location.pathname : void 0;
4372
+ captureSentryError(error, { ...sentryCtxRef.current });
4373
+ callbacksRef.current?.onError?.(error);
4374
+ },
4375
+ onSessionIdChange: (sessionId) => {
4376
+ sentryCtxRef.current.sessionId = sessionId;
4377
+ callbacksRef.current?.onSessionIdChange?.(sessionId);
4378
+ },
4379
+ onExecutionTraceClick: (data) => callbacksRef.current?.onExecutionTraceClick?.(data),
4380
+ onResetSession: () => callbacksRef.current?.onResetSession?.(),
4381
+ onUploadImageClick: () => callbacksRef.current?.onUploadImageClick?.(),
4382
+ onAttachFileClick: () => callbacksRef.current?.onAttachFileClick?.(),
4383
+ onUserActionRequired: (req) => callbacksRef.current?.onUserActionRequired?.(req),
4384
+ onUserActionEvent: (evType, msg) => callbacksRef.current?.onUserActionEvent?.(evType, msg)
4385
+ }),
4386
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4387
+ []
4388
+ );
4389
+ }
4390
+ var PaymanChatInner = react.forwardRef(function PaymanChatInner2({
4391
+ config,
4392
+ callbacks = {},
4393
+ className,
4394
+ style,
4395
+ children,
4396
+ onLoadMoreMessages,
4397
+ isLoadingMoreMessages = false,
4398
+ hasMoreMessages = false,
4399
+ chat
4400
+ }, ref) {
4401
+ const [inputValue, setInputValue] = react.useState("");
4402
+ const prevInputValueRef = react.useRef(inputValue);
4403
+ const [hasEverSentMessage, setHasEverSentMessage] = react.useState(false);
4404
+ const [lightboxSrc, setLightboxSrc] = react.useState(null);
4405
+ const [lightboxAlt, setLightboxAlt] = react.useState("");
4406
+ const [editingMessageId, setEditingMessageId] = react.useState(null);
4407
+ const [isResetSessionConfirmOpen, setIsResetSessionConfirmOpen] = react.useState(false);
4408
+ const chatInputV2Ref = react.useRef(null);
4409
+ const messageListV2Ref = react.useRef(null);
4410
+ const resetToEmptyStateRef = react.useRef(false);
4411
+ const isV2 = config.uiVersion !== 1;
4412
+ react.useEffect(() => {
4413
+ if (config.sentryDsn) {
4414
+ initSentryIfNeeded(config.sentryDsn);
4415
+ }
4416
+ }, [config.sentryDsn]);
4417
+ const {
4418
+ messages,
4419
+ sendMessage,
4420
+ isWaitingForResponse,
4421
+ resetSession,
4422
+ clearMessages,
4423
+ prependMessages,
4424
+ cancelStream,
4425
+ getSessionId,
4426
+ getMessages
4427
+ } = chat;
4428
+ react.useEffect(() => {
4429
+ if (resetToEmptyStateRef.current) {
4430
+ if (messages.length === 0) {
4431
+ setHasEverSentMessage(false);
4432
+ resetToEmptyStateRef.current = false;
4433
+ }
4434
+ return;
4435
+ }
4436
+ if (messages.length > 0 && !hasEverSentMessage) {
4437
+ setHasEverSentMessage(true);
4438
+ }
4439
+ }, [messages.length, hasEverSentMessage]);
4440
+ react.useEffect(() => {
4441
+ if (!editingMessageId) return;
4442
+ const editingMessageStillExists = messages.some(
4443
+ (message) => message.id === editingMessageId && message.role === "user"
4444
+ );
4445
+ if (!editingMessageStillExists) {
4446
+ setEditingMessageId(null);
4447
+ }
4448
+ }, [editingMessageId, messages]);
4449
+ const userActionState = chat.userActionState ?? DEFAULT_USER_ACTION_STATE;
4450
+ const approveUserAction = chat.approveUserAction ?? NOOP_ASYNC;
4451
+ const rejectUserAction = chat.rejectUserAction ?? NOOP_ASYNC;
4452
+ const resendOtp = chat.resendOtp ?? NOOP_ASYNC;
4453
+ const isUserActionSupported = typeof chat.approveUserAction === "function" && typeof chat.rejectUserAction === "function" && typeof chat.resendOtp === "function";
4454
+ const {
4455
+ transcribedText,
4456
+ isAvailable: voiceAvailable,
4457
+ isRecording,
4458
+ startRecording,
4459
+ stopRecording,
4460
+ clearTranscript
4461
+ } = paymanTypescriptAskSdk.useVoice(
4462
+ {
4463
+ lang: config.voiceLang || "en-US",
4464
+ interimResults: config.voiceInterimResults !== false,
4465
+ continuous: config.voiceContinuous !== false
4466
+ },
4467
+ {
4468
+ onResult: (text) => {
4469
+ if (!isV2) {
4470
+ setInputValue(text);
4471
+ }
4472
+ },
4473
+ onEnd: () => {
4474
+ },
4475
+ onError: (error) => {
2215
4476
  console.error("Voice error:", error);
2216
4477
  }
2217
4478
  }
@@ -2236,17 +4497,46 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2236
4497
  isWaitingForResponse
2237
4498
  ]
2238
4499
  );
2239
- const { onExecutionTraceClick, onResetSession } = callbacks;
4500
+ const {
4501
+ onExecutionTraceClick,
4502
+ onResetSession,
4503
+ onUploadImageClick,
4504
+ onAttachFileClick
4505
+ } = callbacks;
4506
+ const performResetSession = react.useCallback(() => {
4507
+ resetToEmptyStateRef.current = true;
4508
+ setEditingMessageId(null);
4509
+ setIsResetSessionConfirmOpen(false);
4510
+ setInputValue("");
4511
+ setLightboxSrc(null);
4512
+ setLightboxAlt("");
4513
+ chatInputV2Ref.current?.setDraft("");
4514
+ clearTranscript();
4515
+ if (isRecording) {
4516
+ stopRecording();
4517
+ }
4518
+ resetSession();
4519
+ onResetSession?.();
4520
+ }, [
4521
+ clearTranscript,
4522
+ isRecording,
4523
+ onResetSession,
4524
+ resetSession,
4525
+ stopRecording
4526
+ ]);
4527
+ const requestResetSession = react.useCallback(() => {
4528
+ setIsResetSessionConfirmOpen(true);
4529
+ }, []);
4530
+ const closeResetSessionConfirm = react.useCallback(() => {
4531
+ setIsResetSessionConfirmOpen(false);
4532
+ }, []);
2240
4533
  react.useImperativeHandle(ref, () => ({
2241
- resetSession: () => {
2242
- resetSession();
2243
- onResetSession?.();
2244
- },
4534
+ resetSession: performResetSession,
2245
4535
  clearMessages,
2246
4536
  cancelStream,
2247
4537
  getSessionId,
2248
4538
  getMessages
2249
- }), [resetSession, clearMessages, cancelStream, getSessionId, getMessages, onResetSession]);
4539
+ }), [performResetSession, clearMessages, cancelStream, getSessionId, getMessages]);
2250
4540
  const {
2251
4541
  placeholder = "Type your message...",
2252
4542
  emptyStateText = "What can I help with?",
@@ -2270,8 +4560,26 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2270
4560
  disabledComponent,
2271
4561
  showEmptyStateIcon = true,
2272
4562
  emptyStateComponent,
2273
- showResetSession = false
4563
+ showResetSession = false,
4564
+ showAttachmentButton = true,
4565
+ showUploadImageButton = true,
4566
+ showAttachFileButton = true,
4567
+ messageActions: messageActionsConfig
2274
4568
  } = config;
4569
+ const messageActions = react.useMemo(
4570
+ () => ({
4571
+ userMessageActions: {
4572
+ copy: messageActionsConfig?.userMessageActions?.copy ?? true,
4573
+ edit: messageActionsConfig?.userMessageActions?.edit ?? false,
4574
+ retry: messageActionsConfig?.userMessageActions?.retry ?? false
4575
+ },
4576
+ assistantMessageActions: {
4577
+ copy: messageActionsConfig?.assistantMessageActions?.copy ?? true,
4578
+ trace: messageActionsConfig?.assistantMessageActions?.trace ?? true
4579
+ }
4580
+ }),
4581
+ [messageActionsConfig]
4582
+ );
2275
4583
  const isSessionParamsConfigured = react.useMemo(() => {
2276
4584
  if (!sessionParams) return false;
2277
4585
  return !!(sessionParams.id?.trim() && sessionParams.name?.trim());
@@ -2292,7 +4600,7 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2292
4600
  stopRecording();
2293
4601
  }
2294
4602
  if (inputValue.trim() && !disableInput && isSessionParamsConfigured) {
2295
- sendMessage(inputValue.trim());
4603
+ void sendMessage(inputValue.trim());
2296
4604
  setInputValue("");
2297
4605
  }
2298
4606
  };
@@ -2305,6 +4613,7 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2305
4613
  stopRecording();
2306
4614
  };
2307
4615
  const isInputDisabled = isWaitingForResponse || !isSessionParamsConfigured || disableInput;
4616
+ const isV2InputDisabled = !isSessionParamsConfigured || disableInput;
2308
4617
  const isEmpty = messages.length === 0;
2309
4618
  if (isChatDisabled) {
2310
4619
  if (disabledComponent) {
@@ -2338,54 +4647,88 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2338
4647
  }
2339
4648
  ) });
2340
4649
  }
2341
- const inputElement = hasAskPermission && /* @__PURE__ */ jsxRuntime.jsx(
2342
- ChatInput,
2343
- {
2344
- value: inputValue,
2345
- onChange: setInputValue,
2346
- onSend: handleSend,
2347
- onPause: cancelStream,
2348
- disabled: isInputDisabled,
2349
- placeholder: isRecording ? "Listening..." : placeholder,
2350
- isWaitingForResponse,
2351
- hasSelectedSession: true,
2352
- isSessionParamsConfigured,
2353
- enableVoice: config.enableVoice === true,
2354
- onVoicePress: isRecording ? stopRecording : startRecording,
2355
- voiceAvailable: config.enableVoice === true && voiceAvailable,
2356
- isRecording,
2357
- transcribedText: inputValue,
2358
- onCancelRecording: handleCancelRecording,
2359
- onConfirmRecording: handleConfirmRecording,
2360
- inputStyle,
2361
- layout,
2362
- showResetSession,
2363
- onResetSession: () => {
2364
- resetSession();
2365
- onResetSession?.();
2366
- }
4650
+ const handleImageClick = (src, alt) => {
4651
+ setLightboxSrc(src);
4652
+ setLightboxAlt(alt);
4653
+ };
4654
+ const v2UserAction = react.useMemo(() => {
4655
+ if (!isUserActionSupported || !userActionState.request) return null;
4656
+ const req = userActionState.request;
4657
+ let status = "pending";
4658
+ if (userActionState.result === "approved") status = "approved";
4659
+ else if (userActionState.result === "rejected") status = "rejected";
4660
+ return {
4661
+ messageId: `ua-${req.userActionId || Date.now()}`,
4662
+ action: {
4663
+ type: req.userActionType || "generic",
4664
+ message: req.message || "Verify this action",
4665
+ amount: req.metadata?.amount,
4666
+ payeeName: req.metadata?.payeeName
4667
+ },
4668
+ status
4669
+ };
4670
+ }, [isUserActionSupported, userActionState.request, userActionState.result]);
4671
+ const hideV2SendDuringVerification = v2UserAction != null && v2UserAction.status !== "approved" && v2UserAction.status !== "rejected";
4672
+ const handleV2Send = (text) => {
4673
+ if (isRecording) stopRecording();
4674
+ if (text.trim() && !disableInput && isSessionParamsConfigured) {
4675
+ setEditingMessageId(null);
4676
+ void sendMessage(text.trim());
2367
4677
  }
2368
- );
2369
- return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
2370
- "div",
2371
- {
2372
- className: cn(
2373
- "bg-background overflow-hidden flex flex-col flex-[4]",
2374
- className
2375
- ),
2376
- style,
2377
- children: [
2378
- children,
2379
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: isEmpty && !hasEverSentMessage ? (
2380
- /* ---- Centered empty state with input ---- */
2381
- /* @__PURE__ */ jsxRuntime.jsx(
4678
+ };
4679
+ const handleVoicePress = react.useCallback(async () => {
4680
+ if (!voiceAvailable) return;
4681
+ if (isRecording) {
4682
+ stopRecording();
4683
+ return;
4684
+ }
4685
+ clearTranscript();
4686
+ await startRecording();
4687
+ }, [clearTranscript, isRecording, startRecording, stopRecording, voiceAvailable]);
4688
+ const handleEditMessageDraft = react.useCallback((messageId) => {
4689
+ const targetMessage = messages.find((message) => message.id === messageId);
4690
+ if (!targetMessage?.content.trim()) return;
4691
+ setEditingMessageId(messageId);
4692
+ chatInputV2Ref.current?.setDraft(targetMessage.content);
4693
+ requestAnimationFrame(() => {
4694
+ messageListV2Ref.current?.scrollToBottom("smooth");
4695
+ });
4696
+ }, [messages]);
4697
+ const handleRetryUserMessage = react.useCallback((messageId) => {
4698
+ if (isWaitingForResponse) return;
4699
+ const targetMessage = messages.find(
4700
+ (message) => message.id === messageId && message.role === "user"
4701
+ );
4702
+ if (!targetMessage?.content.trim()) return;
4703
+ void sendMessage(targetMessage.content.trim());
4704
+ const bump = () => messageListV2Ref.current?.scrollToBottom("instant");
4705
+ requestAnimationFrame(() => {
4706
+ bump();
4707
+ queueMicrotask(() => {
4708
+ window.setTimeout(bump, 120);
4709
+ });
4710
+ });
4711
+ }, [isWaitingForResponse, messages, sendMessage]);
4712
+ const handleClearEditing = react.useCallback(() => {
4713
+ setEditingMessageId(null);
4714
+ }, []);
4715
+ if (isV2) {
4716
+ return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
4717
+ "div",
4718
+ {
4719
+ className: cn("payman-v2-root", className),
4720
+ style,
4721
+ children: [
4722
+ children,
4723
+ isChatDisabled ? disabledComponent || /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", alignItems: "center", justifyContent: "center", padding: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", color: "var(--payman-v2-text-3)", fontSize: "0.875rem" }, children: "Chat is currently disabled" }) }) : /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: isEmpty && !hasEverSentMessage ? /* @__PURE__ */ jsxRuntime.jsx(
2382
4724
  framerMotion.motion.div,
2383
4725
  {
2384
4726
  initial: { opacity: 1 },
2385
4727
  exit: { opacity: 0 },
2386
4728
  transition: { duration: 0.3 },
2387
- className: "payman-empty-centered-layout",
2388
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-empty-centered-inner", children: [
4729
+ className: "payman-v2-chat-layout",
4730
+ style: { justifyContent: "center", alignItems: "center" },
4731
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", flex: 1, width: "100%" }, children: [
2389
4732
  /* @__PURE__ */ jsxRuntime.jsx(
2390
4733
  MessageList,
2391
4734
  {
@@ -2419,56 +4762,246 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2419
4762
  initial: { opacity: 0, y: 12 },
2420
4763
  animate: { opacity: 1, y: 0 },
2421
4764
  transition: { delay: 0.2, duration: 0.4, ease: [0.25, 0.46, 0.45, 0.94] },
2422
- className: "payman-empty-centered-input",
2423
- children: inputElement
4765
+ style: { width: "100%" },
4766
+ children: hasAskPermission && /* @__PURE__ */ jsxRuntime.jsx(
4767
+ ChatInputV2,
4768
+ {
4769
+ ref: chatInputV2Ref,
4770
+ onSend: handleV2Send,
4771
+ onCancel: cancelStream,
4772
+ disabled: isV2InputDisabled,
4773
+ isStreaming: isWaitingForResponse,
4774
+ placeholder: isRecording ? "Listening..." : placeholder,
4775
+ enableVoice: config.enableVoice === true,
4776
+ transcribedText: config.enableVoice === true ? transcribedText : "",
4777
+ voiceAvailable: config.enableVoice === true && voiceAvailable,
4778
+ isRecording,
4779
+ onVoicePress: config.enableVoice === true ? handleVoicePress : void 0,
4780
+ onCancelRecording: handleCancelRecording,
4781
+ onConfirmRecording: handleConfirmRecording,
4782
+ showResetSession,
4783
+ onResetSession: requestResetSession,
4784
+ showAttachmentButton,
4785
+ showUploadImageButton,
4786
+ showAttachFileButton,
4787
+ onUploadImageClick,
4788
+ onAttachFileClick,
4789
+ editingMessageId,
4790
+ onClearEditing: handleClearEditing,
4791
+ hideSendButton: hideV2SendDuringVerification
4792
+ }
4793
+ )
2424
4794
  }
2425
4795
  )
2426
4796
  ] })
2427
4797
  },
2428
- "empty-centered"
2429
- )
2430
- ) : (
2431
- /* ---- Normal chat layout ---- */
2432
- /* @__PURE__ */ jsxRuntime.jsxs(
4798
+ "v2-empty"
4799
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
2433
4800
  framerMotion.motion.div,
2434
4801
  {
2435
4802
  initial: hasEverSentMessage ? { opacity: 0 } : false,
2436
4803
  animate: { opacity: 1 },
2437
4804
  transition: { duration: 0.3 },
2438
- className: "flex flex-col flex-1 min-h-0",
4805
+ className: "payman-v2-chat-layout",
2439
4806
  children: [
2440
4807
  /* @__PURE__ */ jsxRuntime.jsx(
2441
- MessageList,
4808
+ MessageListV2,
2442
4809
  {
4810
+ ref: messageListV2Ref,
2443
4811
  messages,
2444
- isLoading: false,
2445
- emptyStateText,
2446
- showEmptyStateIcon,
2447
- emptyStateComponent,
2448
- layout,
2449
- showTimestamps,
2450
- stage: config.stage || "DEV",
2451
- animated,
2452
- showAgentName,
2453
- agentName,
2454
- showAvatars,
2455
- showUserAvatar,
2456
- showAssistantAvatar,
2457
- showExecutionSteps,
2458
- showStreamingDot,
2459
- streamingStepsText,
2460
- completedStepsText,
4812
+ isStreaming: isWaitingForResponse,
4813
+ onEditUserMessage: handleEditMessageDraft,
4814
+ onRetryUserMessage: handleRetryUserMessage,
4815
+ onImageClick: handleImageClick,
2461
4816
  onExecutionTraceClick,
2462
- onLoadMoreMessages,
2463
- isLoadingMoreMessages,
2464
- hasMoreMessages
4817
+ messageActions,
4818
+ retryDisabled: isWaitingForResponse,
4819
+ userAction: v2UserAction,
4820
+ onApproveAction: isUserActionSupported ? async (_msgId, otp) => {
4821
+ await approveUserAction(otp);
4822
+ } : void 0,
4823
+ onRejectAction: isUserActionSupported ? async () => {
4824
+ await rejectUserAction();
4825
+ } : void 0,
4826
+ onResendAction: isUserActionSupported ? async () => {
4827
+ await resendOtp();
4828
+ } : void 0
2465
4829
  }
2466
4830
  ),
2467
- inputElement
4831
+ hasAskPermission && /* @__PURE__ */ jsxRuntime.jsx(
4832
+ ChatInputV2,
4833
+ {
4834
+ ref: chatInputV2Ref,
4835
+ onSend: handleV2Send,
4836
+ onCancel: cancelStream,
4837
+ disabled: isV2InputDisabled,
4838
+ isStreaming: isWaitingForResponse,
4839
+ placeholder: isRecording ? "Listening..." : placeholder,
4840
+ enableVoice: config.enableVoice === true,
4841
+ transcribedText: config.enableVoice === true ? transcribedText : "",
4842
+ voiceAvailable: config.enableVoice === true && voiceAvailable,
4843
+ isRecording,
4844
+ onVoicePress: config.enableVoice === true ? handleVoicePress : void 0,
4845
+ onCancelRecording: handleCancelRecording,
4846
+ onConfirmRecording: handleConfirmRecording,
4847
+ showResetSession,
4848
+ onResetSession: requestResetSession,
4849
+ showAttachmentButton,
4850
+ showUploadImageButton,
4851
+ showAttachFileButton,
4852
+ onUploadImageClick,
4853
+ onAttachFileClick,
4854
+ editingMessageId,
4855
+ onClearEditing: handleClearEditing,
4856
+ hideSendButton: hideV2SendDuringVerification
4857
+ }
4858
+ )
2468
4859
  ]
2469
4860
  },
2470
- "chat-layout"
4861
+ "v2-chat"
4862
+ ) }),
4863
+ /* @__PURE__ */ jsxRuntime.jsx(
4864
+ ImageLightboxV2,
4865
+ {
4866
+ src: lightboxSrc,
4867
+ alt: lightboxAlt,
4868
+ onClose: () => setLightboxSrc(null)
4869
+ }
4870
+ ),
4871
+ /* @__PURE__ */ jsxRuntime.jsx(
4872
+ ResetSessionConfirmModal,
4873
+ {
4874
+ isOpen: isResetSessionConfirmOpen,
4875
+ onClose: closeResetSessionConfirm,
4876
+ onConfirm: performResetSession
4877
+ }
2471
4878
  )
4879
+ ]
4880
+ }
4881
+ ) });
4882
+ }
4883
+ const inputElement = hasAskPermission && /* @__PURE__ */ jsxRuntime.jsx(
4884
+ ChatInput,
4885
+ {
4886
+ value: inputValue,
4887
+ onChange: setInputValue,
4888
+ onSend: handleSend,
4889
+ onPause: cancelStream,
4890
+ disabled: isInputDisabled,
4891
+ placeholder: isRecording ? "Listening..." : placeholder,
4892
+ isWaitingForResponse,
4893
+ hasSelectedSession: true,
4894
+ isSessionParamsConfigured,
4895
+ enableVoice: config.enableVoice === true,
4896
+ onVoicePress: config.enableVoice === true ? handleVoicePress : void 0,
4897
+ voiceAvailable: config.enableVoice === true && voiceAvailable,
4898
+ isRecording,
4899
+ transcribedText: inputValue,
4900
+ onCancelRecording: handleCancelRecording,
4901
+ onConfirmRecording: handleConfirmRecording,
4902
+ inputStyle,
4903
+ layout,
4904
+ showResetSession,
4905
+ onResetSession: requestResetSession
4906
+ }
4907
+ );
4908
+ return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
4909
+ "div",
4910
+ {
4911
+ className: cn(
4912
+ "bg-background overflow-hidden flex flex-col flex-[4]",
4913
+ className
4914
+ ),
4915
+ style,
4916
+ children: [
4917
+ children,
4918
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: isEmpty && !hasEverSentMessage ? /* @__PURE__ */ jsxRuntime.jsx(
4919
+ framerMotion.motion.div,
4920
+ {
4921
+ initial: { opacity: 1 },
4922
+ exit: { opacity: 0 },
4923
+ transition: { duration: 0.3 },
4924
+ className: "payman-empty-centered-layout",
4925
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payman-empty-centered-inner", children: [
4926
+ /* @__PURE__ */ jsxRuntime.jsx(
4927
+ MessageList,
4928
+ {
4929
+ messages,
4930
+ isLoading: false,
4931
+ emptyStateText,
4932
+ showEmptyStateIcon,
4933
+ emptyStateComponent,
4934
+ layout,
4935
+ showTimestamps,
4936
+ stage: config.stage || "DEV",
4937
+ animated,
4938
+ showAgentName,
4939
+ agentName,
4940
+ showAvatars,
4941
+ showUserAvatar,
4942
+ showAssistantAvatar,
4943
+ showExecutionSteps,
4944
+ showStreamingDot,
4945
+ streamingStepsText,
4946
+ completedStepsText,
4947
+ onExecutionTraceClick,
4948
+ onLoadMoreMessages,
4949
+ isLoadingMoreMessages,
4950
+ hasMoreMessages
4951
+ }
4952
+ ),
4953
+ /* @__PURE__ */ jsxRuntime.jsx(
4954
+ framerMotion.motion.div,
4955
+ {
4956
+ initial: { opacity: 0, y: 12 },
4957
+ animate: { opacity: 1, y: 0 },
4958
+ transition: { delay: 0.2, duration: 0.4, ease: [0.25, 0.46, 0.45, 0.94] },
4959
+ className: "payman-empty-centered-input",
4960
+ children: inputElement
4961
+ }
4962
+ )
4963
+ ] })
4964
+ },
4965
+ "empty-centered"
4966
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
4967
+ framerMotion.motion.div,
4968
+ {
4969
+ initial: hasEverSentMessage ? { opacity: 0 } : false,
4970
+ animate: { opacity: 1 },
4971
+ transition: { duration: 0.3 },
4972
+ className: "flex flex-col flex-1 min-h-0",
4973
+ children: [
4974
+ /* @__PURE__ */ jsxRuntime.jsx(
4975
+ MessageList,
4976
+ {
4977
+ messages,
4978
+ isLoading: false,
4979
+ emptyStateText,
4980
+ showEmptyStateIcon,
4981
+ emptyStateComponent,
4982
+ layout,
4983
+ showTimestamps,
4984
+ stage: config.stage || "DEV",
4985
+ animated,
4986
+ showAgentName,
4987
+ agentName,
4988
+ showAvatars,
4989
+ showUserAvatar,
4990
+ showAssistantAvatar,
4991
+ showExecutionSteps,
4992
+ showStreamingDot,
4993
+ streamingStepsText,
4994
+ completedStepsText,
4995
+ onExecutionTraceClick,
4996
+ onLoadMoreMessages,
4997
+ isLoadingMoreMessages,
4998
+ hasMoreMessages
4999
+ }
5000
+ ),
5001
+ inputElement
5002
+ ]
5003
+ },
5004
+ "chat-layout"
2472
5005
  ) }),
2473
5006
  /* @__PURE__ */ jsxRuntime.jsx(
2474
5007
  UserActionModal,
@@ -2480,20 +5013,62 @@ var PaymanChat = react.forwardRef(function PaymanChat2({
2480
5013
  onResend: resendOtp,
2481
5014
  clearOtpTrigger: userActionState.clearOtpTrigger
2482
5015
  }
5016
+ ),
5017
+ /* @__PURE__ */ jsxRuntime.jsx(
5018
+ ResetSessionConfirmModal,
5019
+ {
5020
+ isOpen: isResetSessionConfirmOpen,
5021
+ onClose: closeResetSessionConfirm,
5022
+ onConfirm: performResetSession
5023
+ }
2483
5024
  )
2484
5025
  ]
2485
5026
  }
2486
5027
  ) });
2487
5028
  });
5029
+ var PaymanChatV1Shell = react.forwardRef(
5030
+ function PaymanChatV1Shell2(props, ref) {
5031
+ const mergedCallbacks = useSentryChatCallbacks(props.callbacks, props.config);
5032
+ const chat = paymanTypescriptAskSdk.useChat(props.config, mergedCallbacks);
5033
+ return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatInner, { ...props, chat, ref });
5034
+ }
5035
+ );
5036
+ var PaymanChatV2Shell = react.forwardRef(
5037
+ function PaymanChatV2Shell2(props, ref) {
5038
+ const mergedCallbacks = useSentryChatCallbacks(props.callbacks, props.config);
5039
+ const chat = paymanTypescriptAskSdk.useChatV2(props.config, mergedCallbacks);
5040
+ return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatInner, { ...props, chat, ref });
5041
+ }
5042
+ );
5043
+ var PaymanChat = react.forwardRef(
5044
+ function PaymanChat2(props, ref) {
5045
+ if (props.config.uiVersion !== 1) {
5046
+ return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatV2Shell, { ...props, ref });
5047
+ }
5048
+ return /* @__PURE__ */ jsxRuntime.jsx(PaymanChatV1Shell, { ...props, ref });
5049
+ }
5050
+ );
2488
5051
 
5052
+ Object.defineProperty(exports, "buildFormattedThinking", {
5053
+ enumerable: true,
5054
+ get: function () { return paymanTypescriptAskSdk.buildFormattedThinking; }
5055
+ });
2489
5056
  Object.defineProperty(exports, "cancelUserAction", {
2490
5057
  enumerable: true,
2491
5058
  get: function () { return paymanTypescriptAskSdk.cancelUserAction; }
2492
5059
  });
5060
+ Object.defineProperty(exports, "createInitialV2State", {
5061
+ enumerable: true,
5062
+ get: function () { return paymanTypescriptAskSdk.createInitialV2State; }
5063
+ });
2493
5064
  Object.defineProperty(exports, "generateId", {
2494
5065
  enumerable: true,
2495
5066
  get: function () { return paymanTypescriptAskSdk.generateId; }
2496
5067
  });
5068
+ Object.defineProperty(exports, "processStreamEventV2", {
5069
+ enumerable: true,
5070
+ get: function () { return paymanTypescriptAskSdk.processStreamEventV2; }
5071
+ });
2497
5072
  Object.defineProperty(exports, "resendUserAction", {
2498
5073
  enumerable: true,
2499
5074
  get: function () { return paymanTypescriptAskSdk.resendUserAction; }
@@ -2510,6 +5085,10 @@ Object.defineProperty(exports, "useChat", {
2510
5085
  enumerable: true,
2511
5086
  get: function () { return paymanTypescriptAskSdk.useChat; }
2512
5087
  });
5088
+ Object.defineProperty(exports, "useChatV2", {
5089
+ enumerable: true,
5090
+ get: function () { return paymanTypescriptAskSdk.useChatV2; }
5091
+ });
2513
5092
  Object.defineProperty(exports, "useVoice", {
2514
5093
  enumerable: true,
2515
5094
  get: function () { return paymanTypescriptAskSdk.useVoice; }