@trillet-ai/web-sdk 1.7.1 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/widget/config.ts","../../src/widget/styles.ts","../../src/widget/recaptcha.ts","../../src/widget/TrilletWidgetElement.ts","../../src/widget/register.ts","../../src/widget/react.tsx","../../src/widget/index.ts"],"sourcesContent":["// Widget configuration: the attribute/prop surface (ElevenLabs-modeled) and the\n// parsing helpers that turn HTML attributes into a typed config object. This file\n// is framework-free and shared by the custom element and the React wrapper.\n\n// OUT OF SCOPE (TRI-399): default branding is BLANK / unbranded (spec §6.4).\n// Trillet's own brand values are recorded here for a FUTURE partner \"show Trillet\n// branding\" toggle only — they MUST NOT render by default:\n// logo https://www.trillet.ai/trillet-icon.png · color #1060ff · name \"Trillet\"\n\n// Internal, resolved variant. Kept as the historical two-value vocabulary; the\n// convai `tiny|compact|full` inputs are mapped down onto it (see resolveVariant).\nexport type WidgetVariant = 'compact' | 'expanded';\n// Accepted variant *inputs* — both our original vocabulary and convai's.\nexport type WidgetVariantInput = WidgetVariant | 'tiny' | 'full';\n// `both` = one widget offering BOTH modalities (convai multimodal); the end user\n// switches voice <-> text mid-session. `voice`/`text` stay single-modality.\nexport type WidgetMode = 'voice' | 'text' | 'both';\nexport type WidgetPlacement =\n | 'top-left'\n | 'top'\n | 'top-right'\n | 'bottom-left'\n | 'bottom'\n | 'bottom-right';\n\n// convai-compatible orb gradient defaults.\nexport const DEFAULT_ORB_COLOR_1 = '#2792dc';\nexport const DEFAULT_ORB_COLOR_2 = '#9ce6e6';\n\nexport interface WidgetBrand {\n logo?: string;\n primaryColor?: string;\n name?: string;\n}\n\n/**\n * Resolved, typed widget configuration. The custom element builds this from HTML\n * attributes; the React wrapper builds it from props.\n */\nexport interface WidgetConfig {\n // Required\n agentId: string;\n\n // Attribute-derived credentials only (overall priority:\n // signedUrlEndpoint/getRoomDetails > roomDetails > workspaceId). The function and\n // object forms can't come from HTML attributes, so getRoomDetails/roomDetails live\n // as properties on the element instance, not in this config.\n signedUrlEndpoint?: string;\n workspaceId?: string;\n\n // Header identity overrides. Each takes precedence over the corresponding\n // backend-provided `display.*` value (which arrives on `connected`). Being static\n // config, they let the header title render immediately (pre-call).\n agentName?: string;\n callFlowName?: string;\n workspaceName?: string;\n\n // Appearance\n avatar?: string;\n /** Legacy single accent/orb color; alias of orbColor1. */\n orbColor?: string;\n /** Gradient orb color 1 (convai `avatar-orb-color-1`). */\n orbColor1?: string;\n /** Gradient orb color 2 (convai `avatar-orb-color-2`). */\n orbColor2?: string;\n variant: WidgetVariant;\n placement: WidgetPlacement;\n dismissible: boolean;\n\n // Copy / text overrides\n actionText?: string;\n startCallText: string;\n endCallText: string;\n messageText: string;\n switchToTextText: string;\n switchToVoiceText: string;\n listeningText: string;\n speakingText: string;\n expandText: string;\n collapseText: string;\n recaptchaText: string;\n\n // Behavior\n mode: WidgetMode;\n variables?: Record<string, unknown>;\n maxCallDuration?: number; // seconds\n /**\n * Optional Google reCAPTCHA v2 site key. When set, the widget renders a checkbox the\n * visitor solves once per session before the first conversation starts.\n *\n * BYO and client-only: the solved token is never sent to Trillet and never verified,\n * so this is UI friction, not bot protection. See ./recaptcha.ts. For a real gate,\n * use the core SDK's `onBeforeCall` hook and verify on your own backend.\n */\n recaptchaSiteKey?: string;\n /** convai `disable-banner` — accepted no-op (we're blank by default). */\n disableBanner: boolean;\n\n // Customer branding (default BLANK)\n brand: WidgetBrand;\n}\n\nexport const DEFAULT_COPY = {\n startCallText: 'Start a call',\n endCallText: 'End call',\n messageText: 'Message',\n switchToTextText: 'Switch to text mode',\n switchToVoiceText: 'Switch to voice mode',\n listeningText: 'Listening…',\n speakingText: 'Speaking…',\n expandText: 'Expand',\n collapseText: 'Collapse',\n recaptchaText: 'Verify you are human to start',\n} as const;\n\n/** The full list of observed HTML attributes (kebab-case). */\nexport const OBSERVED_ATTRIBUTES = [\n 'agent-id',\n 'signed-url-endpoint',\n 'workspace-id',\n 'agent-name',\n 'call-flow-name',\n 'workspace-name',\n 'avatar',\n 'avatar-image-url', // convai alias -> avatar\n 'orb-color',\n 'avatar-orb-color-1',\n 'avatar-orb-color-2',\n 'variant',\n 'placement',\n 'dismissible',\n 'action-text',\n 'start-call-text',\n 'end-call-text',\n 'message-text',\n 'switch-to-text-text',\n 'switch-to-voice-text',\n 'listening-text',\n 'speaking-text',\n 'expand-text',\n 'collapse-text',\n 'recaptcha-text',\n 'mode',\n 'variables',\n 'dynamic-variables', // convai alias -> variables\n 'max-call-duration',\n 'recaptcha-site-key',\n 'disable-banner', // convai no-op\n 'brand-logo',\n 'brand-color',\n 'brand-name',\n] as const;\n\nconst PLACEMENTS: readonly WidgetPlacement[] = [\n 'top-left',\n 'top',\n 'top-right',\n 'bottom-left',\n 'bottom',\n 'bottom-right',\n];\n\nfunction parseBoolAttr(value: string | null): boolean {\n // Presence-style boolean: dismissible | dismissible=\"\" | dismissible=\"true\" => true;\n // dismissible=\"false\" => false; absent => false.\n if (value === null) return false;\n return value !== 'false';\n}\n\nfunction parseJsonAttr(value: string | null): Record<string, unknown> | undefined {\n if (!value) return undefined;\n try {\n const parsed = JSON.parse(value);\n return parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : undefined;\n } catch {\n console.warn('[trillet-widget] Failed to parse JSON attribute:', value);\n return undefined;\n }\n}\n\nfunction parseNumberAttr(value: string | null): number | undefined {\n if (!value) return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Map any accepted variant vocabulary (convai `tiny|compact|full` + ours) onto the\n * internal two-value variant. `tiny`->compact (launcher-focused), `full`->expanded. */\nexport function resolveVariant(raw: string | null): WidgetVariant {\n switch (raw) {\n case 'expanded':\n case 'full':\n return 'expanded';\n case 'tiny':\n case 'compact':\n return 'compact';\n default:\n return 'compact';\n }\n}\n\n/**\n * Build a {@link WidgetConfig} from a custom element's attributes. Pure function of\n * the element's attribute map — no side effects.\n */\nexport function configFromElement(el: HTMLElement): WidgetConfig {\n const get = (name: string): string | null => el.getAttribute(name);\n\n const variant = resolveVariant(get('variant'));\n\n const modeRaw = get('mode');\n const mode: WidgetMode = modeRaw === 'text' ? 'text' : modeRaw === 'both' ? 'both' : 'voice';\n\n const placementRaw = get('placement');\n const placement: WidgetPlacement = PLACEMENTS.includes(placementRaw as WidgetPlacement)\n ? (placementRaw as WidgetPlacement)\n : 'bottom-right';\n\n // Start/end labels are mode-aware: a text session is a chat, not a \"call\". These are\n // still overridable via the start-call-text / end-call-text attributes.\n const isText = mode === 'text';\n const startDefault = isText ? 'Start chat' : DEFAULT_COPY.startCallText;\n const endDefault = isText ? 'End chat' : DEFAULT_COPY.endCallText;\n\n const brand: WidgetBrand = {};\n const brandLogo = get('brand-logo');\n const brandColor = get('brand-color');\n const brandName = get('brand-name');\n if (brandLogo) brand.logo = brandLogo;\n if (brandColor) brand.primaryColor = brandColor;\n if (brandName) brand.name = brandName;\n\n const orbColor = get('orb-color') || undefined;\n const orbColor1 = get('avatar-orb-color-1') || orbColor || undefined;\n const orbColor2 = get('avatar-orb-color-2') || undefined;\n\n return {\n agentId: get('agent-id') || '',\n signedUrlEndpoint: get('signed-url-endpoint') || undefined,\n workspaceId: get('workspace-id') || undefined,\n // Header identity overrides — empty string/absent => treated as \"not set\".\n agentName: get('agent-name') || undefined,\n callFlowName: get('call-flow-name') || undefined,\n workspaceName: get('workspace-name') || undefined,\n // convai `avatar-image-url` is an alias of our `avatar`.\n avatar: get('avatar') || get('avatar-image-url') || undefined,\n orbColor,\n orbColor1,\n orbColor2,\n variant,\n placement,\n dismissible: parseBoolAttr(get('dismissible')),\n actionText: get('action-text') || undefined,\n startCallText: get('start-call-text') || startDefault,\n endCallText: get('end-call-text') || endDefault,\n messageText: get('message-text') || DEFAULT_COPY.messageText,\n switchToTextText: get('switch-to-text-text') || DEFAULT_COPY.switchToTextText,\n switchToVoiceText: get('switch-to-voice-text') || DEFAULT_COPY.switchToVoiceText,\n listeningText: get('listening-text') || DEFAULT_COPY.listeningText,\n speakingText: get('speaking-text') || DEFAULT_COPY.speakingText,\n expandText: get('expand-text') || DEFAULT_COPY.expandText,\n collapseText: get('collapse-text') || DEFAULT_COPY.collapseText,\n recaptchaText: get('recaptcha-text') || DEFAULT_COPY.recaptchaText,\n mode,\n // convai `dynamic-variables` is an alias of our `variables`.\n variables: parseJsonAttr(get('variables') || get('dynamic-variables')),\n maxCallDuration: parseNumberAttr(get('max-call-duration')),\n recaptchaSiteKey: get('recaptcha-site-key') || undefined,\n disableBanner: parseBoolAttr(get('disable-banner')),\n brand,\n };\n}\n","// Shadow-DOM stylesheet for the widget. Kept as a single string injected into the\n// shadow root so styles are fully isolated from (and cannot bleed into) the host\n// page. All visual tokens are driven by CSS custom properties so attributes like\n// `orb-color` / `brand-color` can override them at runtime.\n\nexport const WIDGET_STYLES = /* css */ `\n:host {\n /* Positioning: default bottom-right. The host can override by setting\n position-related CSS on the trillet-widget element directly, or via the\n placement attribute (see :host([placement=...]) rules below). */\n position: fixed;\n right: 24px;\n bottom: 24px;\n z-index: 2147483000;\n\n /* Theming tokens (overridden at runtime via setProperty). */\n --trillet-accent: #2792dc;\n --trillet-orb-1: #2792dc;\n --trillet-orb-2: #9ce6e6;\n --trillet-surface: #ffffff;\n --trillet-on-surface: #0b0b0f;\n --trillet-muted: #6b7280;\n --trillet-border: rgba(0, 0, 0, 0.08);\n --trillet-shadow: 0 12px 48px rgba(0, 0, 0, 0.20);\n\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n font-size: 14px;\n line-height: 1.4;\n color: var(--trillet-on-surface);\n}\n\n:host([hidden]) { display: none; }\n\n/* ---- placement attribute (fixed positioning on the host element) ----\n Kept in the shadow stylesheet (low specificity) so raw CSS on the\n trillet-widget element still overrides it. */\n:host([placement=\"bottom-right\"]) { top: auto; bottom: 24px; left: auto; right: 24px; }\n:host([placement=\"bottom-left\"]) { top: auto; bottom: 24px; right: auto; left: 24px; }\n:host([placement=\"bottom\"]) { top: auto; bottom: 24px; left: 50%; right: auto; transform: translateX(-50%); }\n:host([placement=\"top-right\"]) { bottom: auto; top: 24px; left: auto; right: 24px; }\n:host([placement=\"top-left\"]) { bottom: auto; top: 24px; right: auto; left: 24px; }\n:host([placement=\"top\"]) { bottom: auto; top: 24px; left: 50%; right: auto; transform: translateX(-50%); }\n\n* { box-sizing: border-box; }\n\n.tw-root {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 12px;\n}\n/* Left/center placements align the launcher + card accordingly. */\n:host([placement=\"bottom-left\"]) .tw-root,\n:host([placement=\"top-left\"]) .tw-root { align-items: flex-start; }\n:host([placement=\"bottom\"]) .tw-root,\n:host([placement=\"top\"]) .tw-root { align-items: center; }\n\n/* ---- Floating launcher ---- */\n.tw-launcher {\n display: inline-flex;\n align-items: center;\n gap: 10px;\n padding: 12px 18px;\n border: none;\n border-radius: 999px;\n background: var(--trillet-accent);\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n box-shadow: var(--trillet-shadow);\n transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;\n}\n.tw-launcher:hover { transform: translateY(-1px); box-shadow: 0 16px 52px rgba(0, 0, 0, 0.26); }\n.tw-launcher:active { transform: translateY(0); }\n.tw-launcher .tw-launcher-orb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background:\n conic-gradient(from 0deg, var(--trillet-orb-1), var(--trillet-orb-2), var(--trillet-orb-1));\n box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.6);\n animation: tw-orb-rotate 8s linear infinite;\n}\n.tw-launcher .tw-launcher-orb-avatar {\n background: none;\n background-size: cover;\n background-position: center;\n animation: none;\n}\n\n/* ---- Panel ---- */\n.tw-panel {\n width: 320px;\n max-width: calc(100vw - 32px);\n background: var(--trillet-surface);\n border: 1px solid var(--trillet-border);\n border-radius: 16px;\n box-shadow: var(--trillet-shadow);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n.tw-panel.tw-expanded { width: 380px; }\n\n.tw-header {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 14px 16px;\n border-bottom: 1px solid var(--trillet-border);\n}\n/* Brand slot: customer logo + optional small brand label, stacked. Subordinate to\n the identity title. */\n.tw-brand {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex-shrink: 0;\n}\n.tw-brand-logo {\n width: 28px;\n height: 28px;\n border-radius: 8px;\n object-fit: cover;\n}\n/* Small customer brand label (brand.name). Visually subordinate to the identity\n title — lighter weight, muted color, smaller. Never used as the header title. */\n.tw-brand-name {\n font-weight: 500;\n font-size: 12px;\n color: var(--trillet-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 120px;\n}\n/* Header title identifying who the user is talking to (agent / call flow /\n workspace name). The primary header identity; truncates long names cleanly. */\n.tw-header-title {\n flex: 1;\n min-width: 0;\n font-weight: 600;\n font-size: 14px;\n color: var(--trillet-on-surface);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.tw-icon-btn {\n border: none;\n background: transparent;\n color: var(--trillet-muted);\n cursor: pointer;\n width: 28px;\n height: 28px;\n border-radius: 8px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n line-height: 1;\n}\n.tw-icon-btn:hover { background: rgba(0, 0, 0, 0.05); }\n\n.tw-body {\n padding: 20px 16px;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 14px;\n}\n\n/* ---- Animated 2-color gradient orb / avatar ---- */\n.tw-orb-wrap {\n position: relative;\n width: 96px;\n height: 96px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n/* Soft aura behind the orb (breathes gently; stronger while speaking). */\n.tw-orb-wrap::before {\n content: '';\n position: absolute;\n width: 78px;\n height: 78px;\n border-radius: 50%;\n background: radial-gradient(circle, var(--trillet-orb-2), transparent 70%);\n opacity: 0.5;\n filter: blur(10px);\n animation: tw-aura 3.2s ease-in-out infinite;\n}\n.tw-orb {\n position: relative;\n width: 72px;\n height: 72px;\n border-radius: 50%;\n background:\n radial-gradient(circle at 30% 28%, var(--trillet-orb-2), transparent 58%),\n conic-gradient(from 0deg, var(--trillet-orb-1), var(--trillet-orb-2), var(--trillet-orb-1));\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);\n animation: tw-orb-rotate 9s linear infinite;\n}\n/* Glossy highlight so the orb reads as a 3D sphere, not a flat disc. */\n.tw-orb::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: 50%;\n background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.55), transparent 46%);\n}\n/* When an avatar image is provided, show it instead of the gradient. */\n.tw-orb.tw-orb-avatar {\n background: none;\n background-size: cover;\n background-position: center;\n animation: none;\n}\n.tw-orb.tw-orb-avatar::after { display: none; }\n\n@keyframes tw-orb-rotate { to { transform: rotate(360deg); } }\n@keyframes tw-aura {\n 0%, 100% { transform: scale(1); opacity: 0.4; }\n 50% { transform: scale(1.16); opacity: 0.66; }\n}\n\n/* Connecting: a pulsing ring around the orb. */\n.tw-orb-wrap.tw-connecting::after {\n content: '';\n position: absolute;\n width: 72px;\n height: 72px;\n border-radius: 50%;\n border: 2px solid var(--trillet-orb-1);\n animation: tw-pulse 1.4s ease-out infinite;\n}\n@keyframes tw-pulse {\n 0% { transform: scale(0.85); opacity: 0.7; }\n 100% { transform: scale(1.3); opacity: 0; }\n}\n\n/* Listening (live, not speaking): a slow calm breathe. */\n.tw-orb-wrap.tw-listening .tw-orb {\n animation: tw-orb-rotate 9s linear infinite, tw-breathe 3.6s ease-in-out infinite;\n}\n@keyframes tw-breathe {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(1.03); }\n}\n\n/* Speaking: faster rotation + stronger bob, and a livelier aura. */\n.tw-orb-wrap.tw-speaking .tw-orb {\n animation: tw-orb-rotate 4.5s linear infinite, tw-bob 0.7s ease-in-out infinite alternate;\n}\n.tw-orb-wrap.tw-speaking::before { animation: tw-aura 1.2s ease-in-out infinite; }\n@keyframes tw-bob {\n from { transform: scale(1); }\n to { transform: scale(1.08); }\n}\n\n.tw-status {\n font-size: 13px;\n color: var(--trillet-muted);\n min-height: 18px;\n text-align: center;\n}\n.tw-timer {\n font-size: 12px;\n color: var(--trillet-muted);\n font-variant-numeric: tabular-nums;\n}\n\n/* ---- BYO reCAPTCHA gate ---- */\n/* The checkbox is a light-DOM node projected in via <slot name=\"recaptcha\"> — it can't\n render directly in the shadow root (reCAPTCHA v2 hangs there). ::slotted targets that\n projected node. The checkbox iframe is a fixed 304x78; scale it down on narrow panels\n so it doesn't overflow. */\n.tw-recaptcha-slot {\n display: flex;\n justify-content: center;\n width: 100%;\n}\n::slotted(.tw-recaptcha-mount) {\n display: flex;\n justify-content: center;\n}\n@media (max-width: 340px) {\n ::slotted(.tw-recaptcha-mount) {\n transform: scale(0.85);\n transform-origin: center top;\n }\n}\n\n/* ---- Controls ---- */\n.tw-controls {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n justify-content: center;\n}\n.tw-controls.tw-controls-stack {\n flex-direction: column;\n gap: 8px;\n}\n.tw-controls-stack .tw-primary-btn { width: 100%; }\n.tw-primary-btn {\n border: none;\n border-radius: 999px;\n padding: 11px 20px;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n background: var(--trillet-accent);\n color: #fff;\n transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;\n}\n.tw-primary-btn:hover { opacity: 0.92; }\n.tw-primary-btn.tw-danger { background: #e5484d; }\n.tw-primary-btn.tw-secondary {\n background: transparent;\n color: var(--trillet-accent);\n border: 1px solid var(--trillet-border);\n}\n.tw-primary-btn.tw-secondary:hover { background: rgba(0, 0, 0, 0.03); opacity: 1; }\n.tw-primary-btn:disabled { opacity: 0.6; cursor: default; }\n/* Subtle modality switch affordance (mode=\"both\"). */\n.tw-switch-btn {\n border: none;\n background: none;\n color: var(--trillet-muted);\n font-size: 12px;\n font-weight: 500;\n cursor: pointer;\n padding: 2px 6px;\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.tw-switch-btn:hover { color: var(--trillet-accent); }\n.tw-mic-btn {\n border: 1px solid var(--trillet-border);\n background: var(--trillet-surface);\n color: var(--trillet-on-surface);\n border-radius: 50%;\n width: 42px;\n height: 42px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n}\n.tw-mic-btn.tw-muted { color: #e5484d; border-color: #e5484d; }\n\n/* ---- Text mode ---- */\n.tw-text-input-row {\n display: flex;\n gap: 8px;\n width: 100%;\n}\n.tw-text-input {\n flex: 1;\n border: 1px solid var(--trillet-border);\n border-radius: 10px;\n padding: 9px 12px;\n font-size: 14px;\n font-family: inherit;\n color: var(--trillet-on-surface);\n background: var(--trillet-surface);\n outline: none;\n}\n.tw-text-input:focus { border-color: var(--trillet-accent); }\n.tw-send-btn {\n border: none;\n border-radius: 10px;\n padding: 0 14px;\n background: var(--trillet-accent);\n color: #fff;\n font-weight: 600;\n cursor: pointer;\n}\n\n/* ---- Transcript ---- */\n.tw-transcript {\n width: 100%;\n max-height: 200px;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding-top: 4px;\n border-top: 1px solid var(--trillet-border);\n margin-top: 4px;\n}\n\n/* ---- Chat window (text mode) ----\n A fixed-height, internally scrolling thread so the panel does NOT grow as\n messages arrive. Height is a sensible fixed value, capped to the viewport on\n short screens. Rendered (empty) as soon as the chat opens. */\n.tw-chat {\n height: min(380px, 60vh);\n max-height: none;\n overflow-y: auto;\n padding: 10px;\n border: 1px solid var(--trillet-border);\n border-top: 1px solid var(--trillet-border);\n border-radius: 12px;\n margin-top: 0;\n background: rgba(0, 0, 0, 0.015);\n scroll-behavior: smooth;\n}\n/* Faint empty state so the open (message-less) chat doesn't read as broken. */\n.tw-chat-empty {\n margin: auto;\n color: var(--trillet-muted);\n opacity: 0.45;\n font-size: 20px;\n letter-spacing: 2px;\n}\n.tw-msg {\n padding: 8px 12px;\n border-radius: 12px;\n max-width: 85%;\n font-size: 13px;\n white-space: pre-wrap;\n word-break: break-word;\n}\n.tw-msg.tw-user {\n align-self: flex-end;\n background: var(--trillet-accent);\n color: #fff;\n border-bottom-right-radius: 4px;\n}\n.tw-msg.tw-assistant {\n align-self: flex-start;\n background: rgba(0, 0, 0, 0.05);\n color: var(--trillet-on-surface);\n border-bottom-left-radius: 4px;\n}\n\n.tw-hidden { display: none !important; }\n`;\n","// Optional BYO reCAPTCHA v2 checkbox for <trillet-widget> (TRI-400).\n//\n// THIS IS NOT A SECURITY CONTROL. The solved token is never sent to Trillet and is\n// never verified — no `siteverify`, no `createAssessment`, by design. A reCAPTCHA\n// token that nobody validates proves nothing, so this provides exactly zero bot\n// protection by construction. It is UI friction: it deters a casual script pointed at\n// a customer's embedded widget, and nothing more.\n//\n// What actually protects the customer's wallet is server-side: the per-workspace\n// domain allowlist and the rate limits on /web-call/public. If you are reaching for\n// this to stop abuse, you want `onBeforeCall` instead — that hook lets you run your\n// own challenge and verify it on your own backend before the call starts.\n\nconst RECAPTCHA_SCRIPT_SRC = 'https://www.google.com/recaptcha/api.js?render=explicit';\n\ninterface GrecaptchaRenderParams {\n sitekey: string;\n callback: (token: string) => void;\n 'expired-callback': () => void;\n 'error-callback': () => void;\n}\n\ninterface Grecaptcha {\n render: (container: HTMLElement, params: GrecaptchaRenderParams) => number;\n ready: (cb: () => void) => void;\n}\n\nfunction getGrecaptcha(): Grecaptcha | undefined {\n return (window as unknown as { grecaptcha?: Grecaptcha }).grecaptcha;\n}\n\n// One script tag per page, shared by every widget instance on it.\nlet scriptPromise: Promise<void> | null = null;\n\nfunction injectScript(): Promise<void> {\n if (scriptPromise) return scriptPromise;\n\n scriptPromise = new Promise<void>((resolve, reject) => {\n const existing = document.querySelector<HTMLScriptElement>(\n `script[src=\"${RECAPTCHA_SCRIPT_SRC}\"]`\n );\n if (existing) {\n resolve();\n return;\n }\n\n const script = document.createElement('script');\n script.src = RECAPTCHA_SCRIPT_SRC;\n script.async = true;\n script.defer = true;\n script.onload = (): void => resolve();\n script.onerror = (): void => {\n // Let a later attempt retry rather than caching the failure forever.\n scriptPromise = null;\n reject(new Error('Failed to load Google reCAPTCHA'));\n };\n document.head.appendChild(script);\n });\n\n return scriptPromise;\n}\n\n/** Load api.js and wait until `grecaptcha.render` is actually callable. */\nexport async function loadRecaptcha(): Promise<Grecaptcha> {\n await injectScript();\n\n const grecaptcha = getGrecaptcha();\n if (!grecaptcha) throw new Error('reCAPTCHA loaded but grecaptcha is undefined');\n\n // onload fires before the library finishes initializing; `ready` is the documented\n // way to wait for `render` to exist.\n await new Promise<void>((resolve) => grecaptcha.ready(resolve));\n return grecaptcha;\n}\n\nexport interface RenderCheckboxOptions {\n container: HTMLElement;\n siteKey: string;\n /** Fired once the visitor solves the challenge. The token is deliberately ignored. */\n onSolved: () => void;\n /** Fired when a solved challenge times out, or the challenge itself errors. */\n onExpired: () => void;\n}\n\n/**\n * Render the v2 checkbox into `container` and resolve with its widget id.\n *\n * `container` lives inside the widget's shadow root. The checkbox iframe renders in\n * place; the challenge dialog (when Google decides to show one) is appended to\n * document.body, outside the shadow tree, which is why it is not affected by the\n * widget's encapsulated styles.\n */\nexport async function renderRecaptchaCheckbox(options: RenderCheckboxOptions): Promise<number> {\n const grecaptcha = await loadRecaptcha();\n\n return grecaptcha.render(options.container, {\n sitekey: options.siteKey,\n // The token is received and dropped on the floor — see the header note.\n callback: () => options.onSolved(),\n 'expired-callback': () => options.onExpired(),\n 'error-callback': () => options.onExpired(),\n });\n}\n","// <trillet-widget> custom element — the self-mounting, shadow-DOM drop-in widget.\n//\n// This is a THIN UI layer over the existing secure core. All call lifecycle is\n// delegated to an internal `TrilletAgent` instance; no call logic is reimplemented\n// here. The element parses config from HTML attributes, renders an isolated UI into\n// a shadow root, and maps `TrilletAgent` events -> UI state + DOM CustomEvents.\n\nimport { TrilletAgent } from '../index.js';\nimport type { TrilletRoomDetails } from '../createCall.js';\nimport type { Transcript } from '../TranscriptManager.js';\nimport {\n WidgetConfig,\n configFromElement,\n OBSERVED_ATTRIBUTES,\n DEFAULT_ORB_COLOR_1,\n DEFAULT_ORB_COLOR_2,\n} from './config.js';\nimport { WIDGET_STYLES } from './styles.js';\nimport { renderRecaptchaCheckbox } from './recaptcha.js';\n\ntype WidgetState = 'idle' | 'connecting' | 'live' | 'ended';\n// The modality actually running in the live session. In `mode=\"both\"` this is chosen\n// by the user (entry point / switch control); in single-modality modes it mirrors the\n// configured mode. `null` = no modality picked yet (pre-call `both` panel).\ntype ActiveMode = 'voice' | 'text';\n\nexport class TrilletWidgetElement extends HTMLElement {\n static get observedAttributes(): readonly string[] {\n return OBSERVED_ATTRIBUTES;\n }\n\n private root: ShadowRoot;\n private config!: WidgetConfig;\n private agent: TrilletAgent | null = null;\n private state: WidgetState = 'idle';\n private open = false; // panel open vs. launcher only\n private micEnabled = true;\n private speaking = false;\n private transcripts: Transcript[] = [];\n // Human-facing identity of who the user is talking to, delivered on the\n // `connected` event. Drives the header title. Null until a session connects.\n private display: TrilletRoomDetails['display'] | null = null;\n\n // Chosen modality for the current/next session. Only meaningful for mode=\"both\";\n // in voice/text modes resolvedMode() ignores it.\n private activeMode: ActiveMode | null = null;\n // True while tearing down one modality and reconnecting in the other, so lifecycle\n // events (call-start/conversationStarted) aren't re-emitted for an internal switch.\n private switching = false;\n\n // JS-only credential path (cannot be set via HTML attribute). Set by the React\n // wrapper or imperative consumers via properties.\n public getRoomDetails?: () => Promise<TrilletRoomDetails> | TrilletRoomDetails;\n public roomDetails?: TrilletRoomDetails;\n\n // maxCallDuration countdown (UX only — see startConversation()).\n private durationTimer: ReturnType<typeof setInterval> | null = null;\n private remainingSeconds: number | null = null;\n private elapsedSeconds = 0;\n\n // BYO reCAPTCHA gate (opt-in via recaptcha-site-key). A ONE-TIME gate per session:\n // once solved, it stays solved for the life of this element, so the visitor can\n // start, end and restart conversations without being re-challenged. Never reset on\n // call end — re-challenging per call is friction that buys nothing, since the token\n // is never verified. See ./recaptcha.ts.\n //\n // The checkbox is rendered into a LIGHT-DOM node projected into the panel via a\n // <slot>, not directly in the shadow root. reCAPTCHA v2's anchor iframe hangs on its\n // loading spinner inside a shadow root — its init handshake can't complete across the\n // shadow boundary (verified). Slotting keeps the checkbox in the light DOM (where it\n // works) while displaying it inside the panel. See ensureRecaptchaSlot().\n private recaptchaSolved = false;\n private recaptchaSlot: HTMLDivElement | null = null;\n private recaptchaWidgetId: number | null = null;\n\n private styleEl: HTMLStyleElement;\n private container: HTMLDivElement;\n\n constructor() {\n super();\n this.root = this.attachShadow({ mode: 'open' });\n this.styleEl = document.createElement('style');\n this.styleEl.textContent = WIDGET_STYLES;\n this.container = document.createElement('div');\n this.container.className = 'tw-root';\n this.root.appendChild(this.styleEl);\n this.root.appendChild(this.container);\n }\n\n connectedCallback(): void {\n this.config = configFromElement(this);\n this.syncActiveMode();\n this.applyTheme();\n this.render();\n }\n\n disconnectedCallback(): void {\n this.clearDurationTimer();\n this.teardownAgent();\n this.removeRecaptchaSlot();\n }\n\n attributeChangedCallback(): void {\n if (!this.isConnected) return;\n // Re-derive config on any attribute change (reactivity), preserving JS-only props.\n this.config = configFromElement(this);\n this.syncActiveMode();\n this.applyTheme();\n this.render();\n }\n\n // ---- Public element API ----------------------------------------------------\n\n /**\n * Imperatively start a conversation. Primary headless API (convai-aligned).\n * @param modality - optional; only used in `mode=\"both\"` to pick voice vs text.\n */\n public async startConversation(modality?: ActiveMode): Promise<void> {\n if (this.state === 'connecting' || this.state === 'live') return;\n this.open = true;\n\n // An unsolved reCAPTCHA gate blocks the imperative API too, not just the button —\n // otherwise the gate is one `document.querySelector(...).startConversation()` away\n // from irrelevant. Open the panel so the visitor can see what is being asked.\n if (this.needsRecaptcha()) {\n this.render();\n return;\n }\n\n await this.beginCall(modality);\n }\n\n /** Imperatively end the active conversation. Primary headless API. */\n public endConversation(): void {\n this.agent?.endCall();\n }\n\n /** @deprecated Use {@link startConversation}. Kept as a thin alias for back-compat. */\n public startCall(): Promise<void> {\n return this.startConversation();\n }\n\n /** @deprecated Use {@link endConversation}. Kept as a thin alias for back-compat. */\n public endCall(): void {\n this.endConversation();\n }\n\n // ---- Modality helpers ------------------------------------------------------\n\n /** The concrete modality to run for the current session (`both` -> activeMode). */\n private resolvedMode(): ActiveMode {\n if (this.config.mode === 'both') return this.activeMode ?? 'voice';\n return this.config.mode as ActiveMode; // 'voice' | 'text'\n }\n\n /** Keep activeMode consistent with the configured mode. */\n private syncActiveMode(): void {\n if (this.config.mode === 'voice' || this.config.mode === 'text') {\n this.activeMode = this.config.mode;\n }\n // mode=\"both\": leave activeMode as-is (null pre-call, chosen at entry / switch).\n }\n\n /** Tear down the current agent cleanly: detach listeners, end the call, drop the ref. */\n private teardownAgent(): void {\n if (!this.agent) return;\n try {\n this.agent.removeAllListeners();\n } catch {\n /* noop */\n }\n try {\n this.agent.endCall();\n } catch {\n /* noop */\n }\n this.agent = null;\n }\n\n /**\n * Switch modality mid-session (mode=\"both\"). Because the core binds `mode` at\n * construction, this ends the current `TrilletAgent` and constructs a fresh one in\n * the other modality, rejoining via the same credential path. Transcripts and the\n * duration timer are preserved across the switch; no lifecycle events fire (it's one\n * conversation from the consumer's perspective).\n */\n private async switchModality(): Promise<void> {\n if (this.config.mode !== 'both' || this.state !== 'live') return;\n const target: ActiveMode = this.resolvedMode() === 'voice' ? 'text' : 'voice';\n\n this.switching = true;\n this.clearDurationTimer();\n this.speaking = false;\n // Detach + end the current agent so its 'disconnected' never reaches endLocalCall.\n this.teardownAgent();\n // transcripts are intentionally kept (this.transcripts) so the thread carries over.\n await this.beginCall(target);\n }\n\n // ---- Credential resolution + call lifecycle --------------------------------\n\n private async beginCall(modality?: ActiveMode): Promise<void> {\n if (modality) this.activeMode = modality;\n const mode = this.resolvedMode();\n // Fresh start: clear any stale identity so the header title doesn't carry over\n // from a previous session. A modality switch (this.switching) keeps it.\n if (!this.switching) this.display = null;\n this.setState('connecting');\n\n try {\n // Construct inside the try: the TrilletAgent constructor throws synchronously\n // on a non-secure context or missing agentId, and that must surface through\n // handleError (not escape as an unhandled rejection that strands 'connecting').\n const agent = new TrilletAgent({\n agentId: this.config.agentId,\n workspaceId: this.config.workspaceId,\n mode,\n variables: this.config.variables,\n });\n this.agent = agent;\n this.wireAgentEvents(agent);\n\n // Credential path resolution (priority order, spec §5).\n if (this.config.signedUrlEndpoint || this.getRoomDetails) {\n // Secure DEFAULT — minted at call-start, not at mount, to avoid token expiry.\n let details: TrilletRoomDetails;\n if (this.getRoomDetails) {\n details = await this.getRoomDetails();\n } else {\n const res = await fetch(this.config.signedUrlEndpoint as string, {\n method: 'GET',\n headers: { Accept: 'application/json' },\n });\n if (!res.ok) {\n throw new Error(`signed-url-endpoint returned ${res.status}`);\n }\n details = (await res.json()) as TrilletRoomDetails;\n }\n await agent.joinRoom(details);\n } else if (this.roomDetails) {\n // Secure static — token may expire between mount and click.\n await agent.joinRoom(this.roomDetails);\n } else if (this.config.workspaceId) {\n // Public fallback (legacy).\n await agent.startPublicCall();\n } else {\n throw new Error(\n 'No credential path configured: set signed-url-endpoint, roomDetails/getRoomDetails, or workspace-id'\n );\n }\n } catch (error) {\n // Agent already emits 'error' for its own failures; the catch here covers\n // credential-resolution failures too. wireAgentEvents handles UI + DOM event.\n this.handleError(error);\n }\n }\n\n private wireAgentEvents(agent: TrilletAgent): void {\n agent.on('connected', (details?: { display?: TrilletRoomDetails['display'] }) => {\n // Capture who the user is talking to so the header title can render it.\n this.display = details?.display ?? null;\n const wasSwitching = this.switching;\n this.setState('live'); // reads this.switching to suppress start events on a switch\n this.startDurationTimer(!wasSwitching); // keep the running timer across a switch\n this.switching = false;\n });\n\n agent.on('disconnected', () => {\n this.endLocalCall();\n });\n\n agent.on('error', (error: unknown) => {\n this.handleError(error);\n });\n\n agent.on('assistantStartedSpeaking', () => {\n this.speaking = true;\n this.render();\n });\n\n agent.on('assistantStoppedSpeaking', () => {\n this.speaking = false;\n this.render();\n });\n\n agent.on('transcriptUpdate', (transcripts: Transcript[]) => {\n this.transcripts = transcripts;\n this.dispatch('transcript', transcripts);\n this.render();\n });\n }\n\n private endLocalCall(): void {\n if (this.state === 'ended' || this.state === 'idle') return;\n this.clearDurationTimer();\n this.dispatch('call-end', this.elapsedSeconds);\n this.dispatch('conversationEnded', this.elapsedSeconds);\n this.setState('ended');\n this.agent = null;\n // In `both` mode, drop the chosen modality so the pre-call dual entry returns.\n if (this.config.mode === 'both') this.activeMode = null;\n }\n\n private handleError(error: unknown): void {\n const err = error instanceof Error ? error : new Error(String(error));\n this.clearDurationTimer();\n this.switching = false;\n this.dispatch('error', err);\n this.agent = null;\n if (this.config.mode === 'both') this.activeMode = null;\n this.setState('idle');\n }\n\n // ---- maxCallDuration (UX-ONLY countdown) -----------------------------------\n // NOTE: This is a client-side timer for UX feedback only. Real call-duration\n // enforcement happens server-side (backend web-call route); this timer is\n // trivially bypassable and must not be relied on as a hard cap.\n private startDurationTimer(reset = true): void {\n this.clearDurationTimer();\n if (reset) {\n this.elapsedSeconds = 0;\n this.remainingSeconds =\n typeof this.config.maxCallDuration === 'number' ? this.config.maxCallDuration : null;\n }\n this.durationTimer = setInterval(() => {\n this.elapsedSeconds += 1;\n if (this.remainingSeconds !== null) {\n this.remainingSeconds -= 1;\n if (this.remainingSeconds <= 0) {\n this.agent?.endCall();\n return;\n }\n }\n this.renderStatus();\n }, 1000);\n }\n\n private clearDurationTimer(): void {\n if (this.durationTimer) {\n clearInterval(this.durationTimer);\n this.durationTimer = null;\n }\n }\n\n // ---- State + DOM events ----------------------------------------------------\n\n private setState(state: WidgetState): void {\n const prev = this.state;\n this.state = state;\n if (state === 'live' && prev !== 'live' && !this.switching) {\n this.dispatch('call-start', undefined);\n this.dispatch('conversationStarted', undefined);\n }\n this.render();\n }\n\n private dispatch(type: string, detail: unknown): void {\n this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }));\n }\n\n // ---- Theming ----------------------------------------------------------------\n\n private applyTheme(): void {\n const orb1 = this.config.orbColor1 || DEFAULT_ORB_COLOR_1;\n const orb2 = this.config.orbColor2 || DEFAULT_ORB_COLOR_2;\n this.style.setProperty('--trillet-orb-1', orb1);\n this.style.setProperty('--trillet-orb-2', orb2);\n\n // Accent (buttons/launcher): customer brand color first, else orb color 1.\n const accent = this.config.brand.primaryColor || this.config.orbColor1;\n if (accent) {\n this.style.setProperty('--trillet-accent', accent);\n } else {\n this.style.removeProperty('--trillet-accent');\n }\n }\n\n // ---- Rendering --------------------------------------------------------------\n\n private formatTime(total: number): string {\n const m = Math.floor(total / 60);\n const s = total % 60;\n return `${m}:${s.toString().padStart(2, '0')}`;\n }\n\n private statusText(): string {\n switch (this.state) {\n case 'connecting':\n return 'Connecting…';\n case 'live':\n return this.speaking ? this.config.speakingText : this.config.listeningText;\n case 'ended':\n return 'Call ended';\n default:\n return this.config.actionText || '';\n }\n }\n\n private renderStatus(): void {\n const statusEl = this.root.querySelector('.tw-status');\n if (statusEl) statusEl.textContent = this.statusText();\n const timerEl = this.root.querySelector('.tw-timer');\n if (timerEl) timerEl.textContent = this.timerText();\n }\n\n private timerText(): string {\n if (this.state !== 'live') return '';\n if (this.remainingSeconds !== null) {\n return this.formatTime(Math.max(0, this.remainingSeconds));\n }\n return this.formatTime(this.elapsedSeconds);\n }\n\n private render(): void {\n this.container.replaceChildren();\n\n if (!this.open) {\n this.container.appendChild(this.renderLauncher());\n return;\n }\n this.container.appendChild(this.renderPanel());\n }\n\n private renderLauncher(): HTMLElement {\n const btn = document.createElement('button');\n btn.className = 'tw-launcher';\n btn.type = 'button';\n\n const orb = document.createElement('span');\n orb.className = 'tw-launcher-orb';\n if (this.config.avatar) {\n orb.classList.add('tw-launcher-orb-avatar');\n orb.style.backgroundImage = `url(\"${this.config.avatar}\")`;\n }\n btn.appendChild(orb);\n\n const label = document.createElement('span');\n label.textContent = this.config.actionText || this.config.startCallText;\n btn.appendChild(label);\n\n btn.addEventListener('click', () => {\n this.open = true;\n this.render();\n });\n return btn;\n }\n\n private renderPanel(): HTMLElement {\n const panel = document.createElement('div');\n panel.className = `tw-panel${this.config.variant === 'expanded' ? ' tw-expanded' : ''}`;\n\n panel.appendChild(this.renderHeader());\n panel.appendChild(this.renderBody());\n\n // Voice sessions show ONLY the orb + status + timer + controls (like competitors):\n // no transcript / chat thread in any variant, including a mode=\"both\" session\n // running its voice modality. The chat thread lives exclusively in text mode\n // (rendered inside renderTextBody). So nothing extra is appended here.\n return panel;\n }\n\n /**\n * The header title identifying who the user is talking to. Each identity value is\n * code-overridable per value: a static `agent-name`/`call-flow-name`/`workspace-name`\n * config value takes precedence over the corresponding backend `display.*` value\n * (which only arrives on `connected`), falling back to it when unset. Resolution:\n * effectiveAgent = config.agentName ?? display.agent_name\n * effectiveCallFlow = config.callFlowName ?? display.call_flow_name\n * effectiveWorkspace = config.workspaceName ?? display.workspace_name\n * title = effectiveAgent || effectiveCallFlow || effectiveWorkspace || ''\n * Because the overrides are static config, the title can render pre-call. Note:\n * `brand.name` is intentionally NOT part of this chain — it renders in the brand\n * slot only.\n */\n private headerTitle(): string {\n // configFromElement already maps empty-string attributes to undefined, so `??`\n // correctly falls through to the display fallback when an override is unset.\n const effectiveAgent = this.config.agentName ?? this.display?.agent_name;\n const effectiveCallFlow = this.config.callFlowName ?? this.display?.call_flow_name;\n const effectiveWorkspace = this.config.workspaceName ?? this.display?.workspace_name;\n return effectiveAgent || effectiveCallFlow || effectiveWorkspace || '';\n }\n\n private renderHeader(): HTMLElement {\n const header = document.createElement('div');\n header.className = 'tw-header';\n\n // Brand slot: customer logo + optional small brand label. This is where\n // `brand.name` renders — subordinate to and visually distinct from the identity\n // title below. `brand.name` is NEVER used as the header title.\n if (this.config.brand.logo || this.config.brand.name) {\n const brand = document.createElement('div');\n brand.className = 'tw-brand';\n if (this.config.brand.logo) {\n const logo = document.createElement('img');\n logo.className = 'tw-brand-logo';\n logo.src = this.config.brand.logo;\n logo.alt = this.config.brand.name || '';\n brand.appendChild(logo);\n }\n if (this.config.brand.name) {\n const brandLabel = document.createElement('span');\n brandLabel.className = 'tw-brand-name';\n brandLabel.textContent = this.config.brand.name;\n brandLabel.title = this.config.brand.name;\n brand.appendChild(brandLabel);\n }\n header.appendChild(brand);\n }\n\n // Identity title: who the user is talking to (agent / call flow / workspace),\n // per-value overridable in code with the backend `display.*` as fallback.\n const name = document.createElement('div');\n name.className = 'tw-header-title';\n const title = this.headerTitle();\n name.textContent = title;\n if (title) name.title = title; // native tooltip for truncated long names\n header.appendChild(name);\n\n if (this.config.variant === 'compact') {\n const expandBtn = document.createElement('button');\n expandBtn.className = 'tw-icon-btn';\n expandBtn.type = 'button';\n expandBtn.title = this.config.expandText;\n expandBtn.textContent = '⤢';\n expandBtn.addEventListener('click', () => {\n this.config = { ...this.config, variant: 'expanded' };\n this.render();\n });\n header.appendChild(expandBtn);\n } else {\n const collapseBtn = document.createElement('button');\n collapseBtn.className = 'tw-icon-btn';\n collapseBtn.type = 'button';\n collapseBtn.title = this.config.collapseText;\n collapseBtn.textContent = '⤡';\n collapseBtn.addEventListener('click', () => {\n this.config = { ...this.config, variant: 'compact' };\n this.render();\n });\n header.appendChild(collapseBtn);\n }\n\n if (this.config.dismissible) {\n const closeBtn = document.createElement('button');\n closeBtn.className = 'tw-icon-btn';\n closeBtn.type = 'button';\n closeBtn.title = 'Close';\n closeBtn.textContent = '✕';\n closeBtn.addEventListener('click', () => {\n if (this.state === 'live' || this.state === 'connecting') {\n this.endConversation();\n }\n this.open = false;\n this.render();\n });\n header.appendChild(closeBtn);\n }\n\n return header;\n }\n\n /** True when a `both` widget is idle/ended with no modality chosen yet. */\n private isBothPreCall(): boolean {\n return (\n this.config.mode === 'both' &&\n this.activeMode === null &&\n (this.state === 'idle' || this.state === 'ended')\n );\n }\n\n // ---- BYO reCAPTCHA gate ----------------------------------------------------\n\n /** True when a site key is configured and this session has not solved it yet. */\n private needsRecaptcha(): boolean {\n return Boolean(this.config.recaptchaSiteKey) && !this.recaptchaSolved;\n }\n\n /**\n * The pre-call gate shown in the panel: orb, prompt, the reCAPTCHA checkbox, and a\n * disabled start button. The button enables once the checkbox is solved.\n *\n * The checkbox itself is projected in via a <slot>: reCAPTCHA v2 hangs inside a\n * shadow root (its anchor iframe never finishes initializing), so the actual widget\n * is rendered into a LIGHT-DOM node — a child of the host element — that is assigned\n * to this slot. It therefore *displays* here inside the panel while its DOM home\n * stays in the light tree, where reCAPTCHA works. Verified via examples/recaptcha-\n * isolate.local.html (case C).\n */\n private renderRecaptchaGate(body: HTMLElement): void {\n body.appendChild(this.buildOrb());\n\n const status = document.createElement('div');\n status.className = 'tw-status';\n status.textContent = this.config.recaptchaText;\n body.appendChild(status);\n\n // The checkbox renders into the slotted light-DOM node (see ensureRecaptchaSlot).\n const slot = document.createElement('slot');\n slot.setAttribute('name', 'recaptcha');\n slot.className = 'tw-recaptcha-slot';\n body.appendChild(slot);\n\n const controls = document.createElement('div');\n controls.className = 'tw-controls';\n const startBtn = document.createElement('button');\n startBtn.className = 'tw-primary-btn';\n startBtn.type = 'button';\n startBtn.textContent = this.config.startCallText;\n startBtn.disabled = true;\n controls.appendChild(startBtn);\n body.appendChild(controls);\n\n this.ensureRecaptchaSlot();\n }\n\n /**\n * Create the light-DOM node that hosts the reCAPTCHA checkbox and render the checkbox\n * into it. The node is a child of the host element with `slot=\"recaptcha\"`, so it is\n * projected into the gate's <slot>. Idempotent: every widget re-render recreates the\n * <slot> element, but this node (and its iframe) persists in the light DOM untouched,\n * so the checkbox is rendered exactly once and re-projects automatically.\n */\n private ensureRecaptchaSlot(): void {\n const siteKey = this.config.recaptchaSiteKey;\n if (!siteKey || this.recaptchaSolved || this.recaptchaSlot) return;\n\n const slotted = document.createElement('div');\n slotted.setAttribute('slot', 'recaptcha');\n slotted.className = 'tw-recaptcha-mount';\n // Light DOM: a child of the host element, NOT of the shadow-root container that\n // render() rebuilds. That's what keeps the iframe alive across re-renders.\n this.appendChild(slotted);\n this.recaptchaSlot = slotted;\n\n this.recaptchaWidgetId = -1; // claim the slot before awaiting (guards double-render)\n void renderRecaptchaCheckbox({\n container: slotted,\n siteKey,\n onSolved: () => {\n this.recaptchaSolved = true;\n this.removeRecaptchaSlot();\n this.render(); // panel now shows the enabled start button\n },\n // A solved checkbox expires after ~2 minutes. Google resets its own widget UI in\n // place, and the slot is still showing, so the visitor can just re-tick it.\n onExpired: () => {\n this.recaptchaSolved = false;\n },\n })\n .then((id) => {\n this.recaptchaWidgetId = id;\n })\n .catch((error) => {\n // Google unreachable (blocked, offline, CSP). Failing closed would strand the\n // visitor behind a checkbox that can never appear, on a gate that provides no\n // security anyway — so let the call through and say why.\n console.warn('[trillet-widget] reCAPTCHA failed to load; starting without it', error);\n this.recaptchaSolved = true;\n this.removeRecaptchaSlot();\n this.render();\n });\n }\n\n /** Remove the slotted light-DOM checkbox node. Safe to call when none exists. */\n private removeRecaptchaSlot(): void {\n this.recaptchaSlot?.remove();\n this.recaptchaSlot = null;\n if (!this.recaptchaSolved) this.recaptchaWidgetId = null;\n }\n\n private renderBody(): HTMLElement {\n const body = document.createElement('div');\n body.className = 'tw-body';\n\n // Gate everything pre-call behind the checkbox when one is configured.\n if (this.needsRecaptcha() && (this.state === 'idle' || this.state === 'ended')) {\n this.renderRecaptchaGate(body);\n return body;\n }\n\n // mode=\"both\", pre-call: present BOTH entry points (call + message), convai-style.\n if (this.isBothPreCall()) {\n this.renderBothEntry(body);\n return body;\n }\n\n // Voice and text are mutually exclusive experiences — a session is either a voice\n // call or a text chat, never both simultaneously. Each mode renders only its own\n // controls; mode=\"both\" adds a switch affordance to move between them.\n if (this.resolvedMode() === 'text') {\n this.renderTextBody(body);\n } else {\n this.renderVoiceBody(body);\n }\n return body;\n }\n\n /** Build the animated gradient orb (or avatar image) reflecting the current state. */\n private buildOrb(): HTMLElement {\n const orbWrap = document.createElement('div');\n orbWrap.className = 'tw-orb-wrap';\n if (this.state === 'connecting') orbWrap.classList.add('tw-connecting');\n if (this.state === 'live') orbWrap.classList.add('tw-listening');\n if (this.state === 'live' && this.speaking) orbWrap.classList.add('tw-speaking');\n\n const orb = document.createElement('div');\n orb.className = 'tw-orb';\n if (this.config.avatar) {\n orb.classList.add('tw-orb-avatar');\n orb.style.backgroundImage = `url(\"${this.config.avatar}\")`;\n }\n orbWrap.appendChild(orb);\n return orbWrap;\n }\n\n /** Pre-call panel for mode=\"both\": orb + \"Start a call\" (voice) and \"Message\" (text). */\n private renderBothEntry(body: HTMLElement): void {\n body.appendChild(this.buildOrb());\n\n const controls = document.createElement('div');\n controls.className = 'tw-controls tw-controls-stack';\n\n const callBtn = document.createElement('button');\n callBtn.className = 'tw-primary-btn';\n callBtn.type = 'button';\n callBtn.textContent = this.config.startCallText;\n callBtn.addEventListener('click', () => {\n void this.beginCall('voice');\n });\n controls.appendChild(callBtn);\n\n const msgBtn = document.createElement('button');\n msgBtn.className = 'tw-primary-btn tw-secondary';\n msgBtn.type = 'button';\n msgBtn.textContent = this.config.messageText;\n msgBtn.addEventListener('click', () => {\n void this.beginCall('text');\n });\n controls.appendChild(msgBtn);\n\n body.appendChild(controls);\n }\n\n /** Voice UI: orb + spoken status + timer + mic/end controls. Never a text input. */\n private renderVoiceBody(body: HTMLElement): void {\n body.appendChild(this.buildOrb());\n\n const status = document.createElement('div');\n status.className = 'tw-status';\n status.textContent = this.statusText();\n body.appendChild(status);\n\n const timer = document.createElement('div');\n timer.className = 'tw-timer';\n timer.textContent = this.timerText();\n body.appendChild(timer);\n\n body.appendChild(this.renderControls());\n\n const switchBtn = this.renderSwitchButton();\n if (switchBtn) body.appendChild(switchBtn);\n }\n\n /** Text/chat UI: conversation thread + message input. Never an orb or \"listening\" state. */\n private renderTextBody(body: HTMLElement): void {\n if (this.state === 'idle' || this.state === 'ended') {\n if (this.state === 'ended') {\n const status = document.createElement('div');\n status.className = 'tw-status';\n status.textContent = 'Chat ended';\n body.appendChild(status);\n }\n body.appendChild(this.renderControls()); // Start button\n return;\n }\n\n // connecting | live — the conversation thread is the primary surface here.\n if (this.state === 'connecting') {\n const status = document.createElement('div');\n status.className = 'tw-status';\n status.textContent = 'Connecting…';\n body.appendChild(status);\n }\n\n body.appendChild(this.renderTranscript());\n\n if (this.state === 'live') {\n body.appendChild(this.renderTextInput());\n }\n\n const endBtn = document.createElement('button');\n endBtn.className = 'tw-primary-btn tw-danger';\n endBtn.type = 'button';\n endBtn.textContent = this.config.endCallText;\n endBtn.disabled = this.state === 'connecting';\n endBtn.addEventListener('click', () => this.endConversation());\n body.appendChild(endBtn);\n\n const switchBtn = this.renderSwitchButton();\n if (switchBtn) body.appendChild(switchBtn);\n }\n\n /** In mode=\"both\" during a live session, a control to switch to the other modality. */\n private renderSwitchButton(): HTMLButtonElement | null {\n if (this.config.mode !== 'both' || this.state !== 'live') return null;\n const toText = this.resolvedMode() === 'voice';\n const btn = document.createElement('button');\n btn.className = 'tw-switch-btn';\n btn.type = 'button';\n btn.textContent = toText ? this.config.switchToTextText : this.config.switchToVoiceText;\n btn.addEventListener('click', () => {\n void this.switchModality();\n });\n return btn;\n }\n\n private renderControls(): HTMLElement {\n const controls = document.createElement('div');\n controls.className = 'tw-controls';\n\n if (this.state === 'idle' || this.state === 'ended') {\n const startBtn = document.createElement('button');\n startBtn.className = 'tw-primary-btn';\n startBtn.type = 'button';\n startBtn.textContent = this.config.startCallText;\n startBtn.addEventListener('click', () => {\n void this.beginCall();\n });\n controls.appendChild(startBtn);\n return controls;\n }\n\n // connecting | live\n if (this.resolvedMode() === 'voice' && this.state === 'live') {\n const micBtn = document.createElement('button');\n micBtn.className = `tw-mic-btn${this.micEnabled ? '' : ' tw-muted'}`;\n micBtn.type = 'button';\n micBtn.title = this.micEnabled ? 'Mute microphone' : 'Unmute microphone';\n micBtn.textContent = this.micEnabled ? '🎙' : '🔇';\n micBtn.addEventListener('click', () => {\n this.micEnabled = !this.micEnabled;\n this.agent?.toggleMicrophone(this.micEnabled);\n this.render();\n });\n controls.appendChild(micBtn);\n }\n\n const endBtn = document.createElement('button');\n endBtn.className = 'tw-primary-btn tw-danger';\n endBtn.type = 'button';\n endBtn.textContent = this.config.endCallText;\n endBtn.disabled = this.state === 'connecting';\n endBtn.addEventListener('click', () => this.endConversation());\n controls.appendChild(endBtn);\n\n return controls;\n }\n\n private renderTextInput(): HTMLElement {\n const row = document.createElement('div');\n row.className = 'tw-text-input-row';\n\n const input = document.createElement('input');\n input.className = 'tw-text-input';\n input.type = 'text';\n input.placeholder = 'Type a message…';\n\n const send = (): void => {\n const text = input.value.trim();\n if (!text) return;\n void this.agent?.sendTextMessage(text);\n input.value = '';\n };\n\n input.addEventListener('keydown', (e) => {\n if (e.key === 'Enter') send();\n });\n\n const sendBtn = document.createElement('button');\n sendBtn.className = 'tw-send-btn';\n sendBtn.type = 'button';\n sendBtn.textContent = 'Send';\n sendBtn.addEventListener('click', send);\n\n row.appendChild(input);\n row.appendChild(sendBtn);\n return row;\n }\n\n /**\n * The chat thread for text mode. This is a fixed-height, internally scrolling\n * window (like a normal website chatbot): the container is rendered at its full\n * height as soon as the chat opens — empty until messages arrive — and messages\n * accumulate + scroll inside it, so the panel's overall height stays stable.\n * Auto-scrolls to the newest message after each render.\n */\n private renderTranscript(): HTMLElement {\n const wrap = document.createElement('div');\n wrap.className = 'tw-transcript tw-chat';\n\n if (this.transcripts.length === 0) {\n const empty = document.createElement('div');\n empty.className = 'tw-chat-empty';\n empty.textContent = this.state === 'connecting' ? '' : '…';\n wrap.appendChild(empty);\n } else {\n for (const t of this.transcripts) {\n const msg = document.createElement('div');\n msg.className = `tw-msg ${t.role === 'user' ? 'tw-user' : 'tw-assistant'}`;\n msg.textContent = t.text;\n wrap.appendChild(msg);\n }\n }\n\n // Auto-scroll to the newest message. render() reattaches this element to the\n // shadow root synchronously, so by the time this rAF fires it's laid out.\n requestAnimationFrame(() => {\n wrap.scrollTop = wrap.scrollHeight;\n });\n return wrap;\n }\n}\n","// Custom-element registration. Idempotent and SSR-safe: does nothing when there is\n// no `customElements` registry (e.g. Node SSR), and never double-registers.\n\nimport { TrilletWidgetElement } from './TrilletWidgetElement.js';\n\nexport const TRILLET_WIDGET_TAG = 'trillet-widget';\n\nexport function registerTrilletWidget(tag: string = TRILLET_WIDGET_TAG): void {\n if (typeof customElements === 'undefined') return;\n if (customElements.get(tag)) return;\n customElements.define(tag, TrilletWidgetElement);\n}\n","// React wrapper (SECONDARY entry) — a thin <TrilletWidget> over the framework-free\n// <trillet-widget> custom element. React stays a peerDependency and is NOT bundled\n// into the npm ESM build. This component only sets attributes/properties on the\n// underlying element and forwards its DOM CustomEvents to React callbacks.\n\nimport * as React from 'react';\nimport { registerTrilletWidget, TRILLET_WIDGET_TAG } from './register.js';\nimport type { TrilletWidgetElement } from './TrilletWidgetElement.js';\nimport type {\n WidgetBrand,\n WidgetMode,\n WidgetVariantInput,\n WidgetPlacement,\n} from './config.js';\nimport type { TrilletRoomDetails } from '../createCall.js';\nimport type { Transcript } from '../TranscriptManager.js';\n\nexport interface TrilletWidgetProps {\n // Required\n agentId: string;\n\n // Credential paths\n signedUrlEndpoint?: string;\n /** JS-only: invoked at call-start to mint room details (cannot be an HTML attribute). */\n getRoomDetails?: () => Promise<TrilletRoomDetails> | TrilletRoomDetails;\n /** JS-only: static pre-minted room details. */\n roomDetails?: TrilletRoomDetails;\n workspaceId?: string;\n\n // Header identity overrides. Each overrides the corresponding backend-provided\n // `display.*` name (which remains the fallback). Being static config, setting any\n // of them renders the header title immediately (pre-call).\n agentName?: string;\n callFlowName?: string;\n workspaceName?: string;\n\n // Appearance\n avatar?: string;\n /** convai alias of `avatar`. */\n avatarImageUrl?: string;\n /** Legacy single accent/orb color; alias of orbColor1. */\n orbColor?: string;\n /** Gradient orb color 1 (convai `avatar-orb-color-1`). */\n orbColor1?: string;\n /** Gradient orb color 2 (convai `avatar-orb-color-2`). */\n orbColor2?: string;\n /** Accepts both our `compact|expanded` and convai's `tiny|compact|full`. */\n variant?: WidgetVariantInput;\n placement?: WidgetPlacement;\n dismissible?: boolean;\n\n // Copy / text overrides\n actionText?: string;\n startCallText?: string;\n endCallText?: string;\n /** Label for the text/chat entry point in mode=\"both\" (default \"Message\"). */\n messageText?: string;\n switchToTextText?: string;\n switchToVoiceText?: string;\n listeningText?: string;\n speakingText?: string;\n expandText?: string;\n collapseText?: string;\n /** Copy shown above the reCAPTCHA checkbox, when `recaptchaSiteKey` is set. */\n recaptchaText?: string;\n\n // Behavior\n /** \"voice\" | \"text\" | \"both\" (multimodal, user-switchable). */\n mode?: WidgetMode;\n variables?: Record<string, unknown>;\n /** convai alias of `variables`. */\n dynamicVariables?: Record<string, unknown>;\n maxCallDuration?: number;\n /**\n * Google reCAPTCHA v2 site key. Renders a checkbox the visitor solves once per\n * session before the first conversation. BYO and client-only — the token is never\n * sent to Trillet nor verified, so it is UI friction, not bot protection.\n */\n recaptchaSiteKey?: string;\n /** convai `disable-banner` — accepted no-op (blank by default). */\n disableBanner?: boolean;\n\n // Customer branding (default blank)\n brand?: WidgetBrand;\n\n // Callbacks — primary (convai-aligned) + back-compat aliases.\n /** Primary. Fires alongside onCallStart. */\n onConversationStart?: () => void;\n /** Primary. Fires alongside onCallEnd. */\n onConversationEnd?: (durationSeconds: number) => void;\n /** @deprecated Use onConversationStart. Still fired for back-compat. */\n onCallStart?: () => void;\n /** @deprecated Use onConversationEnd. Still fired for back-compat. */\n onCallEnd?: (durationSeconds: number) => void;\n onError?: (error: Error) => void;\n onTranscript?: (transcripts: Transcript[]) => void;\n\n // Escape hatch for positioning / sizing via inline style or className.\n className?: string;\n style?: React.CSSProperties;\n}\n\n/** Maps a camelCase prop name to its kebab-case HTML attribute. */\nfunction setAttr(el: HTMLElement, name: string, value: string | number | boolean | undefined): void {\n if (value === undefined || value === false || value === null) {\n el.removeAttribute(name);\n return;\n }\n if (value === true) {\n el.setAttribute(name, '');\n return;\n }\n el.setAttribute(name, String(value));\n}\n\nexport const TrilletWidget: React.FC<TrilletWidgetProps> = (props) => {\n const ref = React.useRef<TrilletWidgetElement | null>(null);\n\n // Register the element once on the client.\n React.useEffect(() => {\n registerTrilletWidget();\n }, []);\n\n // Reflect attribute-style props onto the element.\n React.useEffect(() => {\n const el = ref.current;\n if (!el) return;\n setAttr(el, 'agent-id', props.agentId);\n setAttr(el, 'signed-url-endpoint', props.signedUrlEndpoint);\n setAttr(el, 'workspace-id', props.workspaceId);\n setAttr(el, 'agent-name', props.agentName);\n setAttr(el, 'call-flow-name', props.callFlowName);\n setAttr(el, 'workspace-name', props.workspaceName);\n setAttr(el, 'avatar', props.avatar ?? props.avatarImageUrl);\n setAttr(el, 'orb-color', props.orbColor);\n setAttr(el, 'avatar-orb-color-1', props.orbColor1);\n setAttr(el, 'avatar-orb-color-2', props.orbColor2);\n setAttr(el, 'variant', props.variant);\n setAttr(el, 'placement', props.placement);\n setAttr(el, 'dismissible', props.dismissible);\n setAttr(el, 'action-text', props.actionText);\n setAttr(el, 'start-call-text', props.startCallText);\n setAttr(el, 'end-call-text', props.endCallText);\n setAttr(el, 'message-text', props.messageText);\n setAttr(el, 'switch-to-text-text', props.switchToTextText);\n setAttr(el, 'switch-to-voice-text', props.switchToVoiceText);\n setAttr(el, 'listening-text', props.listeningText);\n setAttr(el, 'speaking-text', props.speakingText);\n setAttr(el, 'expand-text', props.expandText);\n setAttr(el, 'collapse-text', props.collapseText);\n setAttr(el, 'mode', props.mode);\n const vars = props.variables ?? props.dynamicVariables;\n setAttr(el, 'variables', vars ? JSON.stringify(vars) : undefined);\n setAttr(el, 'max-call-duration', props.maxCallDuration);\n setAttr(el, 'recaptcha-site-key', props.recaptchaSiteKey);\n setAttr(el, 'recaptcha-text', props.recaptchaText);\n setAttr(el, 'disable-banner', props.disableBanner);\n setAttr(el, 'brand-logo', props.brand?.logo);\n setAttr(el, 'brand-color', props.brand?.primaryColor);\n setAttr(el, 'brand-name', props.brand?.name);\n });\n\n // Reflect JS-only credential props (functions/objects can't be attributes).\n React.useEffect(() => {\n const el = ref.current;\n if (!el) return;\n el.getRoomDetails = props.getRoomDetails;\n el.roomDetails = props.roomDetails;\n }, [props.getRoomDetails, props.roomDetails]);\n\n // Wire DOM CustomEvents -> React callbacks.\n React.useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n // Primary (convai-aligned) lifecycle events.\n const onConvStart = (): void => props.onConversationStart?.();\n const onConvEnd = (e: Event): void =>\n props.onConversationEnd?.((e as CustomEvent<number>).detail);\n // Back-compat aliases (both fire from the element; wire both so either prop works).\n const onStart = (): void => props.onCallStart?.();\n const onEnd = (e: Event): void => props.onCallEnd?.((e as CustomEvent<number>).detail);\n const onErr = (e: Event): void => props.onError?.((e as CustomEvent<Error>).detail);\n const onTr = (e: Event): void => props.onTranscript?.((e as CustomEvent<Transcript[]>).detail);\n\n el.addEventListener('conversationStarted', onConvStart);\n el.addEventListener('conversationEnded', onConvEnd);\n el.addEventListener('call-start', onStart);\n el.addEventListener('call-end', onEnd);\n el.addEventListener('error', onErr);\n el.addEventListener('transcript', onTr);\n return () => {\n el.removeEventListener('conversationStarted', onConvStart);\n el.removeEventListener('conversationEnded', onConvEnd);\n el.removeEventListener('call-start', onStart);\n el.removeEventListener('call-end', onEnd);\n el.removeEventListener('error', onErr);\n el.removeEventListener('transcript', onTr);\n };\n }, [\n props.onConversationStart,\n props.onConversationEnd,\n props.onCallStart,\n props.onCallEnd,\n props.onError,\n props.onTranscript,\n ]);\n\n return React.createElement(TRILLET_WIDGET_TAG, {\n ref: ref as unknown as React.Ref<HTMLElement>,\n class: props.className,\n style: props.style,\n });\n};\n","// `@trillet-ai/web-sdk/widget` entry (ESM, secondary). Exports the React wrapper,\n// the custom element class, the registration helper, and the widget config types.\n// Importing this module registers the <trillet-widget> custom element as a side\n// effect (idempotent + SSR-safe), so consumers can use either the React component\n// or the bare custom element.\n\nimport { registerTrilletWidget } from './register.js';\n\n// Side-effect: define <trillet-widget> on import (no-op when no customElements).\nregisterTrilletWidget();\n\nexport { TrilletWidget } from './react.js';\nexport type { TrilletWidgetProps } from './react.js';\nexport { TrilletWidgetElement } from './TrilletWidgetElement.js';\nexport { registerTrilletWidget, TRILLET_WIDGET_TAG } from './register.js';\nexport type {\n WidgetConfig,\n WidgetBrand,\n WidgetVariant,\n WidgetVariantInput,\n WidgetMode,\n WidgetPlacement,\n} from './config.js';\n"],"mappings":";;;;;;AA0BO,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;AA2E5B,IAAM,eAAe;AAAA,EAC1B,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AACjB;AAGO,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,aAAyC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,cAAc,OAA+B;AAGpD,MAAI,UAAU,KAAM,QAAO;AAC3B,SAAO,UAAU;AACnB;AAEA,SAAS,cAAc,OAA2D;AAChF,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,KAAK;AAC/B,WAAO,UAAU,OAAO,WAAW,WAAY,SAAqC;AAAA,EACtF,SAAQ;AACN,YAAQ,KAAK,oDAAoD,KAAK;AACtE,WAAO;AAAA,EACT;AACF;AAEA,SAAS,gB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