@oshara/voice-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -0
- package/dist/appearance-CNWT8x1G.cjs +2 -0
- package/dist/appearance-CNWT8x1G.cjs.map +1 -0
- package/dist/appearance-i6QBkpCk.js +650 -0
- package/dist/appearance-i6QBkpCk.js.map +1 -0
- package/dist/consent-CK9VXNPa.js +54 -0
- package/dist/consent-CK9VXNPa.js.map +1 -0
- package/dist/consent-D7QNSkQD.cjs +2 -0
- package/dist/consent-D7QNSkQD.cjs.map +1 -0
- package/dist/core/analytics.d.ts +30 -0
- package/dist/core/appearance.d.ts +113 -0
- package/dist/core/audioSettings.d.ts +69 -0
- package/dist/core/consent.d.ts +17 -0
- package/dist/core/createVoiceAgent.d.ts +79 -0
- package/dist/core/events.d.ts +103 -0
- package/dist/core/formController.d.ts +28 -0
- package/dist/core/forms.d.ts +235 -0
- package/dist/core/index.d.ts +29 -0
- package/dist/core/prevContext.d.ts +26 -0
- package/dist/core/transport.d.ts +30 -0
- package/dist/core/types.d.ts +49 -0
- package/dist/core/voice.d.ts +79 -0
- package/dist/createVoiceAgent-BM3HODS6.js +1058 -0
- package/dist/createVoiceAgent-BM3HODS6.js.map +1 -0
- package/dist/createVoiceAgent-CJWxWzz6.cjs +4 -0
- package/dist/createVoiceAgent-CJWxWzz6.cjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +60 -0
- package/dist/react.cjs +2 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.js +115 -0
- package/dist/react.js.map +1 -0
- package/dist/styles.css +1838 -0
- package/dist/ui/index.d.ts +21 -0
- package/dist/ui/ui.d.ts +165 -0
- package/dist/ui.cjs +284 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.js +1153 -0
- package/dist/ui.js.map +1 -0
- package/package.json +67 -0
- package/src/core/analytics.ts +111 -0
- package/src/core/appearance.ts +464 -0
- package/src/core/audioSettings.ts +180 -0
- package/src/core/consent.ts +78 -0
- package/src/core/createVoiceAgent.ts +280 -0
- package/src/core/events.ts +120 -0
- package/src/core/formController.ts +317 -0
- package/src/core/forms.ts +861 -0
- package/src/core/index.ts +121 -0
- package/src/core/prevContext.ts +153 -0
- package/src/core/transport.ts +118 -0
- package/src/core/types.ts +66 -0
- package/src/core/voice.ts +1179 -0
- package/src/react/index.ts +238 -0
- package/src/ui/index.ts +507 -0
- package/src/ui/styles.css +1838 -0
- package/src/ui/ui.ts +1672 -0
- package/src/vite-env.d.ts +10 -0
package/dist/ui.js
ADDED
|
@@ -0,0 +1,1153 @@
|
|
|
1
|
+
import { s as ke } from "./consent-CK9VXNPa.js";
|
|
2
|
+
import { D as k, t as Ce, d as Se } from "./appearance-i6QBkpCk.js";
|
|
3
|
+
const Le = ':host{all:initial;--va-primary: #6366f1;--va-primary-text: #ffffff;--va-accent: #22d3ee;--va-accent-text: #0b1020;--va-background: #ffffff;--va-surface: #f6f7fb;--va-text: #0f172a;--va-text-muted: #64748b;--va-user-bubble: #6366f1;--va-user-bubble-text: #ffffff;--va-agent-bubble: #f1f5f9;--va-agent-bubble-text: #0f172a;--va-fab-size: 64px;--va-panel-width: 380px;--va-panel-height: 620px;--va-border-radius: 24px;--va-edge-offset: 24px;--va-panel-offset: calc(var(--va-fab-size) + 20px);--va-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;font-family:var(--va-font);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,*:before,*:after{box-sizing:border-box}.fab{position:fixed;width:var(--va-fab-size);height:var(--va-fab-size);border-radius:999px;background:var(--va-primary);background-image:linear-gradient(135deg,var(--va-primary),var(--va-accent));color:var(--va-primary-text);border:none;cursor:pointer;box-shadow:0 12px 30px -8px color-mix(in srgb,var(--va-primary) 55%,transparent),0 4px 12px #00000029;display:inline-flex;align-items:center;justify-content:center;z-index:2147483646;transition:transform .18s ease,box-shadow .18s ease,padding .2s ease;overflow:hidden;padding:0;font-family:inherit;font-size:14px;font-weight:600;letter-spacing:.005em;line-height:1;white-space:nowrap}.fab:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;background:radial-gradient(circle at 30% 22%,rgba(255,255,255,.32),transparent 55%);pointer-events:none}.fab:hover{transform:translateY(-2px);box-shadow:0 18px 40px -10px color-mix(in srgb,var(--va-primary) 70%,transparent),0 6px 16px #0003}.fab:active{transform:translateY(0)}.fab .fab-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:calc(var(--va-fab-size) * .42);height:calc(var(--va-fab-size) * .42);flex-shrink:0}.fab .fab-icon svg{width:100%;height:100%}.fab .fab-text{position:relative;display:inline-flex;flex-direction:column;align-items:flex-start;justify-content:center;line-height:1;text-align:left}.fab .fab-label{display:block;font-size:14px;font-weight:600;letter-spacing:.005em;line-height:1.1}.fab .fab-sublabel{display:none;margin-top:3px;font-size:10.5px;font-weight:500;letter-spacing:.04em;line-height:1.1;opacity:.82}.fab.has-sublabel .fab-sublabel{display:block}.fab.has-label{width:auto;height:auto;min-height:calc(var(--va-fab-size) * .82);padding:8px 22px 8px 16px;gap:12px}.fab.has-sublabel{min-height:calc(var(--va-fab-size) * .95);padding:10px 22px 10px 16px}.fab.has-label .fab-icon{width:calc(var(--va-fab-size) * .58);height:calc(var(--va-fab-size) * .58);border-radius:50%;background:#ffffff29;box-shadow:inset 0 0 0 1px #ffffff38,inset 0 1px #ffffff47,0 4px 10px -4px #00000040;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);overflow:hidden}.fab.has-label .fab-icon svg{width:56%;height:56%}.fab.has-label .fab-logo{border-radius:50%}.fab .fab-logo,.fab img.fab-logo{position:relative;width:100%;height:100%;object-fit:cover;border-radius:50%}.panel{position:fixed;width:min(var(--va-panel-width),calc(100vw - 2 * var(--va-edge-offset)));height:var(--va-panel-height);max-height:calc(100vh - var(--va-panel-offset) - var(--va-edge-offset));max-height:calc(100dvh - var(--va-panel-offset) - var(--va-edge-offset));background:var(--va-background);color:var(--va-text);border-radius:var(--va-border-radius);box-shadow:0 30px 70px -16px #0f172a52,0 10px 24px -10px #0f172a2e;display:flex;flex-direction:column;overflow:hidden;z-index:2147483647;border:1px solid color-mix(in srgb,var(--va-text) 7%,transparent);animation:va-panel-in .24s cubic-bezier(.16,1,.3,1);transition:transform .24s ease,opacity .24s ease,height .3s ease}.panel[data-screen=call]:not(.with-transcript){height:auto}@keyframes va-panel-in{0%{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-position="bottom-right"]) .fab,:host(:not([data-position])) .fab{right:var(--va-edge-offset);bottom:var(--va-edge-offset)}:host([data-position="bottom-right"]) .panel,:host(:not([data-position])) .panel{right:var(--va-edge-offset);bottom:var(--va-panel-offset)}:host([data-position="bottom-left"]) .fab{left:var(--va-edge-offset);bottom:var(--va-edge-offset)}:host([data-position="bottom-left"]) .panel{left:var(--va-edge-offset);bottom:var(--va-panel-offset)}:host([data-position="top-right"]) .fab{right:var(--va-edge-offset);top:var(--va-edge-offset)}:host([data-position="top-right"]) .panel{right:var(--va-edge-offset);top:var(--va-panel-offset)}:host([data-position="top-left"]) .fab{left:var(--va-edge-offset);top:var(--va-edge-offset)}:host([data-position="top-left"]) .panel{left:var(--va-edge-offset);top:var(--va-panel-offset)}@media (max-width: 460px){:host(:not([data-inline])){--va-edge-offset: 12px;--va-panel-offset: calc(var(--va-fab-size) + 12px)}:host(:not([data-inline])) .panel{left:var(--va-edge-offset);right:var(--va-edge-offset);width:auto}}:host([data-inline]){display:block;width:100%;height:100%}:host([data-inline]) .fab{display:none}:host([data-inline]) .panel{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;max-height:none;border-radius:0;border:none;box-shadow:none;animation:none}.close{position:absolute;top:14px;right:14px;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--va-text) 6%,transparent);border:none;color:var(--va-text);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;z-index:5;transition:background .15s ease,transform .15s ease;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.close:hover{background:color-mix(in srgb,var(--va-text) 14%,transparent);transform:scale(1.06)}.close svg{width:16px;height:16px}:host([data-close-button-hide]) .close{display:none}.screen{flex:1;min-height:0;display:flex;flex-direction:column;animation:va-screen-in .3s cubic-bezier(.16,1,.3,1)}@keyframes va-screen-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.screen-welcome{background:radial-gradient(95% 70% at 50% -10%,color-mix(in srgb,var(--va-primary) 14%,transparent),transparent 65%),radial-gradient(75% 55% at 105% 115%,color-mix(in srgb,var(--va-accent) 14%,transparent),transparent 65%),var(--va-background);align-items:stretch;justify-content:space-between;padding:56px 28px 18px;text-align:center;position:relative}.welcome-inner{display:flex;flex-direction:column;align-items:center;gap:0;max-width:100%;margin:auto 0}.welcome-logo{position:relative;width:88px;height:88px;border-radius:50%;background:linear-gradient(135deg,var(--va-primary),var(--va-accent));display:flex;align-items:center;justify-content:center;color:var(--va-primary-text);box-shadow:0 18px 44px -16px color-mix(in srgb,var(--va-primary) 55%,transparent),inset 0 1px #ffffff4d;overflow:hidden}.welcome-logo:before{content:"";position:absolute;top:-10px;right:-10px;bottom:-10px;left:-10px;border-radius:50%;background:radial-gradient(circle at center,color-mix(in srgb,var(--va-primary) 22%,transparent),transparent 70%);z-index:-1;filter:blur(6px)}.welcome-logo:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;background:radial-gradient(circle at 30% 22%,rgba(255,255,255,.42),transparent 55%);pointer-events:none}.welcome-logo-img{width:100%;height:100%;object-fit:cover;border-radius:inherit;position:relative}.welcome-logo-fallback{position:relative;display:flex;align-items:center;justify-content:center;width:48%;height:48%;color:var(--va-primary-text)}.welcome-logo-fallback svg{width:100%;height:100%}.welcome-status{margin-top:18px;display:inline-flex;align-items:center;gap:7px;padding:5px 11px;border-radius:999px;background:color-mix(in srgb,var(--va-text) 5%,transparent);border:1px solid color-mix(in srgb,var(--va-text) 7%,transparent);font-size:11px;font-weight:600;letter-spacing:.04em;color:var(--va-text-muted);text-transform:uppercase}.welcome-status-dot{width:6px;height:6px;border-radius:50%;background:#22c55e;box-shadow:0 0 #22c55e80;animation:va-pulse-status 1.8s ease-out infinite}@keyframes va-pulse-status{0%{box-shadow:0 0 #22c55e73}70%{box-shadow:0 0 0 7px #22c55e00}to{box-shadow:0 0 #22c55e00}}.welcome-name{margin:14px 0 6px;font-size:22px;font-weight:600;letter-spacing:-.022em;color:var(--va-text);line-height:1.2}.welcome-desc{margin:0 0 18px;font-size:13.5px;line-height:1.55;color:var(--va-text-muted);max-width:260px;font-weight:400}.lang-picker{position:relative;margin:0 0 16px;width:100%;max-width:260px;display:flex;justify-content:center}.lang-trigger{display:inline-flex;align-items:center;gap:10px;padding:8px 10px 8px 14px;border-radius:999px;border:1px solid color-mix(in srgb,var(--va-text) 10%,transparent);background:color-mix(in srgb,var(--va-background) 92%,var(--va-text) 8%);color:var(--va-text);cursor:pointer;font-family:inherit;font-size:13px;font-weight:500;line-height:1;letter-spacing:-.005em;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease,transform .15s ease;box-shadow:0 1px 2px #0f172a0a;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.lang-trigger:hover{border-color:color-mix(in srgb,var(--va-primary) 35%,transparent);background:color-mix(in srgb,var(--va-primary) 7%,var(--va-background));transform:translateY(-1px);box-shadow:0 6px 16px -10px color-mix(in srgb,var(--va-primary) 40%,transparent)}.lang-trigger:focus-visible{outline:none;border-color:var(--va-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--va-primary) 22%,transparent)}.lang-trigger-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--va-primary);opacity:.9;flex-shrink:0}.lang-trigger-icon svg{width:100%;height:100%}.lang-trigger-text{display:inline-flex;flex-direction:column;align-items:flex-start;line-height:1;gap:3px;min-width:0}.lang-trigger-eyebrow{font-size:9px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--va-text-muted);opacity:.8}.lang-trigger-label{font-size:13px;font-weight:600;color:var(--va-text);letter-spacing:-.005em;white-space:nowrap}.lang-trigger-code{font-size:10.5px;font-weight:700;letter-spacing:.08em;padding:4px 8px;border-radius:999px;background:linear-gradient(135deg,var(--va-primary),var(--va-accent));color:var(--va-primary-text);line-height:1;box-shadow:inset 0 1px #ffffff40}.lang-trigger-chev{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;color:var(--va-text-muted);transition:transform .18s ease,color .18s ease}.lang-trigger-chev svg{width:100%;height:100%}.lang-picker[data-open=true] .lang-trigger-chev{transform:rotate(180deg);color:var(--va-primary)}.lang-picker[data-open=true] .lang-trigger{border-color:color-mix(in srgb,var(--va-primary) 45%,transparent);background:color-mix(in srgb,var(--va-primary) 6%,var(--va-background))}.lang-menu{position:absolute;left:50%;bottom:calc(100% + 8px);transform:translate(-50%);min-width:min(220px,calc(100vw - 2 * var(--va-edge-offset) - 24px));max-width:min(280px,calc(100vw - 2 * var(--va-edge-offset) - 24px));background:var(--va-background);border:1px solid color-mix(in srgb,var(--va-text) 10%,transparent);border-radius:16px;padding:6px;z-index:4;box-shadow:0 18px 40px -14px #0f172a52,0 6px 16px -8px #0f172a29;display:flex;flex-direction:column;gap:2px;animation:va-lang-menu-in .16s cubic-bezier(.16,1,.3,1)}.lang-menu[hidden]{display:none}@keyframes va-lang-menu-in{0%{opacity:0;transform:translate(-50%,6px)}to{opacity:1;transform:translate(-50%)}}.lang-option{display:flex;align-items:center;gap:10px;padding:9px 10px 9px 12px;border:none;background:transparent;border-radius:11px;cursor:pointer;font-family:inherit;text-align:left;color:var(--va-text);transition:background .12s ease,color .12s ease}.lang-option:hover{background:color-mix(in srgb,var(--va-text) 6%,transparent)}.lang-option-text{display:inline-flex;flex-direction:column;gap:2px;flex:1;min-width:0}.lang-option-native{font-size:13.5px;font-weight:600;line-height:1.15;letter-spacing:-.005em;color:var(--va-text)}.lang-option-label{font-size:11px;line-height:1.1;color:var(--va-text-muted);letter-spacing:.01em}.lang-option-code{font-size:10px;font-weight:700;letter-spacing:.1em;padding:3px 7px;border-radius:999px;background:color-mix(in srgb,var(--va-text) 8%,transparent);color:var(--va-text-muted);line-height:1}.lang-option-check{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--va-primary);opacity:0;transform:scale(.6);transition:opacity .14s ease,transform .14s ease}.lang-option-check svg{width:100%;height:100%}.lang-option.is-active{background:color-mix(in srgb,var(--va-primary) 10%,transparent)}.lang-option.is-active .lang-option-code{background:linear-gradient(135deg,var(--va-primary),var(--va-accent));color:var(--va-primary-text)}.lang-option.is-active .lang-option-check{opacity:1;transform:scale(1)}.start-btn{position:relative;display:inline-flex;align-items:center;gap:10px;padding:13px 26px;border:none;border-radius:999px;background:linear-gradient(135deg,var(--va-primary),var(--va-accent));color:var(--va-primary-text);font-family:inherit;font-size:14.5px;font-weight:600;letter-spacing:.005em;cursor:pointer;box-shadow:0 14px 30px -12px color-mix(in srgb,var(--va-primary) 60%,transparent),0 2px 8px #00000014,inset 0 1px #ffffff40;transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;overflow:hidden}.start-btn:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;background:linear-gradient(180deg,rgba(255,255,255,.18),transparent 45%);pointer-events:none}.start-btn:hover{transform:translateY(-1px);box-shadow:0 18px 36px -12px color-mix(in srgb,var(--va-primary) 70%,transparent),0 4px 12px #0000001f,inset 0 1px #ffffff4d;filter:brightness(1.04)}.start-btn:active{transform:translateY(0);filter:brightness(.96)}.start-btn:disabled{opacity:.6;cursor:not-allowed;transform:none}.start-btn-icon{display:inline-flex;position:relative}.start-btn-icon svg{width:17px;height:17px}.start-btn-label{position:relative}.consent{margin:12px auto 0;max-width:280px;font-size:11.5px;line-height:1.45;color:var(--va-text-muted);text-align:center;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px}.consent[hidden]{display:none}.consent-text{opacity:.85}.consent-link{color:var(--va-primary);font-weight:600;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--va-primary) 35%,transparent);text-underline-offset:2px;transition:text-decoration-color .15s ease,color .15s ease}.consent-link:hover{text-decoration-color:var(--va-primary)}.consent-link:focus-visible{outline:none;border-radius:4px;box-shadow:0 0 0 3px color-mix(in srgb,var(--va-primary) 22%,transparent)}.welcome-foot{display:block;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--va-text-muted);opacity:.55;text-decoration:none;font-weight:500;padding-top:14px;margin-top:14px;border-top:1px solid color-mix(in srgb,var(--va-text) 6%,transparent);transition:opacity .15s ease}.welcome-foot.is-link{cursor:pointer}.welcome-foot.is-link:hover{opacity:.9}.screen-call{position:relative;background:radial-gradient(120% 70% at 50% -10%,color-mix(in srgb,var(--va-primary) 13%,transparent),transparent 70%),radial-gradient(80% 50% at 100% 110%,color-mix(in srgb,var(--va-accent) 10%,transparent),transparent 70%),var(--va-background)}.call-header{padding:20px 56px 8px 22px;display:flex;align-items:center;gap:12px}.call-timer{margin-left:auto;display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;background:color-mix(in srgb,var(--va-text) 6%,transparent);border:1px solid color-mix(in srgb,var(--va-text) 10%,transparent);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums;color:var(--va-text-muted);letter-spacing:.02em;line-height:1;flex-shrink:0;transition:background .2s ease,color .2s ease,border-color .2s ease}.call-timer[hidden]{display:none}.call-timer.warning{background:color-mix(in srgb,#ef4444 14%,transparent);border-color:color-mix(in srgb,#ef4444 35%,transparent);color:#ef4444;animation:va-timer-pulse 1s ease-in-out infinite}@keyframes va-timer-pulse{0%,to{opacity:1}50%{opacity:.65}}.call-id{display:flex;align-items:center;gap:12px;min-width:0}.call-logo{position:relative;width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,var(--va-primary),var(--va-accent));display:flex;align-items:center;justify-content:center;color:var(--va-primary-text);overflow:hidden;flex-shrink:0;box-shadow:inset 0 1px #ffffff38}.call-logo-img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.call-logo-fallback{width:55%;height:55%;display:flex;align-items:center;justify-content:center}.call-logo-fallback svg{width:100%;height:100%}.call-id-text{min-width:0}.call-name{font-size:14.5px;font-weight:600;color:var(--va-text);letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.call-status{font-size:12px;color:var(--va-text-muted);display:inline-flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}.call-status:before{content:"";width:6px;height:6px;border-radius:50%;background:var(--va-accent);box-shadow:0 0 color-mix(in srgb,var(--va-accent) 60%,transparent);animation:va-pulse-dot 1.6s ease-out infinite;flex-shrink:0}@keyframes va-pulse-dot{0%{box-shadow:0 0 color-mix(in srgb,var(--va-accent) 50%,transparent)}70%{box-shadow:0 0 0 8px color-mix(in srgb,var(--va-accent) 0%,transparent)}to{box-shadow:0 0 color-mix(in srgb,var(--va-accent) 0%,transparent)}}.call-stage{flex-shrink:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:18px 16px 12px}.orb{position:relative;width:140px;height:140px;display:flex;align-items:center;justify-content:center}.orb-core{position:relative;width:76px;height:76px;border-radius:50%;background:radial-gradient(circle at 30% 28%,color-mix(in srgb,var(--va-primary) 25%,white) 0%,var(--va-primary) 55%,color-mix(in srgb,var(--va-primary) 70%,black) 100%);box-shadow:inset 0 -12px 22px #00000038,inset 0 5px 10px #ffffff47,0 12px 32px -8px color-mix(in srgb,var(--va-primary) 55%,transparent);transition:transform .3s ease}.orb-core:before{content:"";position:absolute;top:12%;right:28%;bottom:50%;left:16%;border-radius:50%;background:radial-gradient(ellipse at center,rgba(255,255,255,.5),transparent 70%);filter:blur(2px);pointer-events:none}.orb-ring{position:absolute;border-radius:50%;border:2px solid color-mix(in srgb,var(--va-primary) 35%,transparent);opacity:0;top:0;right:0;bottom:0;left:0}.orb-ring-1{animation:va-ring 2.6s ease-out infinite}.orb-ring-2{animation:va-ring 2.6s ease-out .65s infinite}.orb-ring-3{animation:va-ring 2.6s ease-out 1.3s infinite}@keyframes va-ring{0%{transform:scale(.55);opacity:0}20%{opacity:.7}to{transform:scale(1);opacity:0}}.orb:not(.listening):not(.speaking):not(.connecting) .orb-ring{animation-play-state:paused;opacity:0}.orb.connecting .orb-ring{border-color:color-mix(in srgb,var(--va-text-muted) 40%,transparent)}.orb.listening .orb-ring{border-color:color-mix(in srgb,var(--va-accent) 55%,transparent)}.orb.speaking .orb-core{animation:va-orb-pulse 1.1s ease-in-out infinite}.orb.speaking .orb-ring{border-color:color-mix(in srgb,var(--va-primary) 60%,transparent)}@keyframes va-orb-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.09)}}.orb.thinking .orb-ring{animation-play-state:running;border-color:color-mix(in srgb,var(--va-accent) 50%,transparent)}.orb.thinking .orb-core{animation:va-orb-think 2.4s ease-in-out infinite}.orb.thinking:after{content:"";position:absolute;top:6px;right:6px;bottom:6px;left:6px;border-radius:50%;border:2px solid transparent;border-top-color:color-mix(in srgb,var(--va-accent) 70%,transparent);border-right-color:color-mix(in srgb,var(--va-primary) 45%,transparent);animation:va-orb-spin 1.6s linear infinite;pointer-events:none}@keyframes va-orb-think{0%,to{transform:scale(.96);opacity:.85}50%{transform:scale(1.04);opacity:1}}@keyframes va-orb-spin{to{transform:rotate(360deg)}}.orb-label{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--va-text-muted);font-weight:600}.agent-status-line{margin-top:2px;max-width:86%;text-align:center;font-size:12px;line-height:1.35;color:var(--va-text-muted);opacity:.9;animation:va-status-fade .18s ease-out}.agent-status-line[hidden]{display:none}@keyframes va-status-fade{0%{opacity:0;transform:translateY(2px)}to{opacity:.9;transform:translateY(0)}}.transcript{flex:1;min-height:0;overflow-y:auto;padding:6px 18px 14px;display:flex;flex-direction:column;gap:8px;scroll-behavior:smooth;mask-image:linear-gradient(to bottom,transparent 0,black 14px,black calc(100% - 14px),transparent 100%);-webkit-mask-image:linear-gradient(to bottom,transparent 0,black 14px,black calc(100% - 14px),transparent 100%)}.transcript::-webkit-scrollbar{width:6px}.transcript::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--va-text) 14%,transparent);border-radius:999px}.transcript:empty:before{content:attr(data-placeholder);display:block;font-size:12px;color:var(--va-text-muted);text-align:center;padding-top:22px;opacity:.7}.transcript-msg{max-width:86%;padding:9px 13px;border-radius:16px;font-size:13.5px;line-height:1.45;white-space:normal;word-wrap:break-word;animation:va-msg-in .2s ease-out}.transcript-msg p{margin:0 0 .4em}.transcript-msg p:last-child{margin-bottom:0}.transcript-msg strong{font-weight:700}.transcript-msg em{font-style:italic}.transcript-msg code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.88em;background:#0000001a;padding:.1em .3em;border-radius:3px}.transcript-msg.user code{background:#fff3}.transcript-msg pre{margin:.4em 0;padding:.5em .7em;background:#00000014;border-radius:6px;overflow-x:auto;white-space:pre;font-size:.88em}.transcript-msg.user pre{background:#ffffff26}.transcript-msg pre code{background:none;padding:0}.transcript-msg ul,.transcript-msg ol{margin:.3em 0;padding-left:1.4em}.transcript-msg li{margin:.15em 0}.transcript-msg h1,.transcript-msg h2,.transcript-msg h3{margin:.3em 0 .2em;font-weight:700;line-height:1.2}.transcript-msg h1{font-size:1.1em}.transcript-msg h2{font-size:1.05em}.transcript-msg h3{font-size:1em}.transcript-msg a{color:inherit;text-decoration:underline;opacity:.85}@keyframes va-msg-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.transcript-msg.user{align-self:flex-end;background:var(--va-user-bubble);color:var(--va-user-bubble-text);border-bottom-right-radius:6px;box-shadow:0 2px 8px -4px color-mix(in srgb,var(--va-user-bubble) 60%,transparent)}.transcript-msg.agent{align-self:flex-start;background:var(--va-agent-bubble);color:var(--va-agent-bubble-text);border-bottom-left-radius:6px;box-shadow:0 2px 8px -6px #0f172a2e}.transcript-msg.system{align-self:center;background:transparent;color:var(--va-agent-bubble-text);opacity:.7;font-size:.85em;font-style:italic;box-shadow:none;text-align:center}.transcript-msg.interim{opacity:.78}.transcript-msg.interim:after{content:"▍";display:inline-block;margin-left:2px;font-style:normal;animation:va-caret 1s steps(2,end) infinite}@keyframes va-caret{0%,60%{opacity:1}61%,to{opacity:0}}.text-input-row{display:flex;align-items:flex-end;gap:8px;padding:8px 14px 4px;border-top:1px solid color-mix(in srgb,var(--va-text) 8%,transparent)}.text-input-row[hidden]{display:none}.text-input{flex:1;font-family:inherit;font-size:13px;line-height:1.45;padding:9px 12px;border-radius:18px;border:1px solid color-mix(in srgb,var(--va-text) 14%,transparent);background:color-mix(in srgb,var(--va-text) 5%,var(--va-background));color:var(--va-text);resize:none;overflow-y:hidden;max-height:96px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.text-input::placeholder{color:var(--va-text-muted);opacity:.7}.text-input:focus{border-color:var(--va-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--va-primary) 20%,transparent)}.text-send-btn{flex-shrink:0;width:36px;height:36px;border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;background:var(--va-primary);color:var(--va-primary-text);padding:0;transition:transform .15s ease,background .15s ease,opacity .15s ease}.text-send-btn svg{width:15px;height:15px}.text-send-btn:hover{transform:scale(1.08)}.text-send-btn:active{transform:scale(.96)}.text-send-btn:disabled{opacity:.4;cursor:not-allowed;transform:none}.call-controls{display:flex;justify-content:center;align-items:center;gap:22px;padding:16px 18px 24px}.ctl-btn{position:relative;width:56px;height:56px;border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--va-text);background:color-mix(in srgb,var(--va-text) 8%,transparent);transition:transform .15s ease,background .15s ease,box-shadow .15s ease,color .15s ease;padding:0}.ctl-btn svg{width:22px;height:22px}.ctl-btn:hover:not(:disabled){background:color-mix(in srgb,var(--va-text) 14%,transparent);transform:translateY(-1px)}.ctl-btn:active:not(:disabled){transform:translateY(0)}.ctl-btn:disabled{opacity:.38;cursor:not-allowed}.ctl-mute.is-active{background:var(--va-text);color:var(--va-background);box-shadow:0 8px 18px -8px color-mix(in srgb,var(--va-text) 70%,transparent)}.ctl-end{background:#ef4444;color:#fff;box-shadow:0 12px 26px -10px #ef4444a6}.ctl-end:hover:not(:disabled){background:#dc2626;box-shadow:0 16px 32px -10px #ef4444bf}.ctl-end:disabled{background:color-mix(in srgb,#ef4444 50%,transparent)}.screen-form{background:radial-gradient(110% 65% at 50% -10%,color-mix(in srgb,var(--va-primary) 12%,transparent),transparent 70%),var(--va-background);flex-direction:column}.form-header{position:relative;display:flex;align-items:center;gap:12px;padding:18px 96px 8px 14px}.form-header-text{flex:1 1 auto}.form-call-controls{position:absolute;top:14px;right:56px;display:flex;align-items:center;gap:6px;z-index:4}.form-call-controls[hidden]{display:none}.form-call-controls button{width:32px;height:32px;border-radius:50%;border:none;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0;color:var(--va-text);background:color-mix(in srgb,var(--va-text) 6%,transparent);transition:background .15s ease,transform .15s ease,box-shadow .15s ease,color .15s ease;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.form-call-controls button svg{width:15px;height:15px}.form-call-controls button:hover:not(:disabled){background:color-mix(in srgb,var(--va-text) 14%,transparent);transform:translateY(-1px)}.form-call-controls button:disabled{opacity:.5;cursor:not-allowed}.form-call-controls .form-mute.is-active{background:var(--va-text);color:var(--va-background)}.form-call-controls .form-end{background:#ef4444;color:#fff;box-shadow:0 6px 14px -6px #ef44448c}.form-call-controls .form-end:hover:not(:disabled){background:#dc2626;box-shadow:0 10px 18px -8px #ef4444b3}.form-transcript{max-height:130px;flex-shrink:0;overflow-y:auto;padding:6px 16px 8px;display:flex;flex-direction:column;gap:6px;border-bottom:1px solid color-mix(in srgb,var(--va-text) 8%,transparent);background:color-mix(in srgb,var(--va-text) 3%,var(--va-background));scroll-behavior:smooth;mask-image:linear-gradient(to bottom,transparent 0,black 10px,black calc(100% - 10px),transparent 100%);-webkit-mask-image:linear-gradient(to bottom,transparent 0,black 10px,black calc(100% - 10px),transparent 100%)}.form-transcript[hidden]{display:none}.form-transcript::-webkit-scrollbar{width:4px}.form-transcript::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--va-text) 14%,transparent);border-radius:999px}.form-back{width:32px;height:32px;border-radius:50%;border:none;background:color-mix(in srgb,var(--va-text) 6%,transparent);color:var(--va-text);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0;transition:background .15s ease,transform .15s ease}.form-back svg{width:16px;height:16px;transform:rotate(90deg)}.form-back:hover{background:color-mix(in srgb,var(--va-text) 12%,transparent);transform:translateY(-1px)}.form-header-text{display:flex;flex-direction:column;gap:2px;min-width:0}.form-eyebrow{font-size:10px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;color:var(--va-primary);opacity:.85}.form-title{font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--va-text)}.form-body{flex:1;min-height:0;overflow-y:auto;padding:6px 18px 18px;display:flex;flex-direction:column;gap:12px}.form-body::-webkit-scrollbar{width:6px}.form-body::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--va-text) 14%,transparent);border-radius:999px}.form-subtitle{margin:0 0 4px;font-size:12.5px;line-height:1.5;color:var(--va-text-muted)}.form-fields{display:flex;flex-direction:column;gap:12px}.form-field{display:flex;flex-direction:column;gap:6px}.form-label{font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--va-text);opacity:.85}.form-input{font-family:inherit;font-size:13px;line-height:1.4;padding:10px 12px;border-radius:12px;border:1px solid color-mix(in srgb,var(--va-text) 14%,transparent);background:var(--va-background);color:var(--va-text);width:100%;transition:border-color .15s ease,box-shadow .15s ease;outline:none}.form-input::placeholder{color:var(--va-text-muted);opacity:.7}.form-input:focus{border-color:var(--va-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--va-primary) 22%,transparent)}.form-input:disabled{opacity:.55;cursor:not-allowed}.form-textarea{resize:vertical;min-height:76px}.form-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding-right:32px;cursor:pointer}.form-error,.form-success{font-size:12.5px;line-height:1.45;padding:9px 12px;border-radius:10px;border:1px solid transparent}.form-error{background:color-mix(in srgb,#ef4444 10%,transparent);border-color:color-mix(in srgb,#ef4444 30%,transparent);color:#b91c1c}.form-success{background:color-mix(in srgb,#10b981 10%,transparent);border-color:color-mix(in srgb,#10b981 28%,transparent);color:#047857}.form-actions{display:flex;gap:10px;padding:12px 18px 18px;border-top:1px solid color-mix(in srgb,var(--va-text) 6%,transparent)}.form-cancel,.form-submit{flex:1;font-family:inherit;font-size:13.5px;font-weight:600;letter-spacing:.005em;padding:11px 16px;border-radius:999px;cursor:pointer;border:none;transition:transform .15s ease,background .15s ease,box-shadow .15s ease}.form-cancel{background:color-mix(in srgb,var(--va-text) 8%,transparent);color:var(--va-text)}.form-cancel:hover:not(:disabled){background:color-mix(in srgb,var(--va-text) 14%,transparent)}.form-submit{background:linear-gradient(135deg,var(--va-primary),var(--va-accent));color:var(--va-primary-text);box-shadow:0 10px 24px -12px color-mix(in srgb,var(--va-primary) 60%,transparent)}.form-submit:hover:not(:disabled){transform:translateY(-1px);filter:brightness(1.04)}.form-submit:disabled,.form-cancel:disabled{opacity:.55;cursor:not-allowed;transform:none}.form-submit.is-busy .form-submit-label:after{content:"…";margin-left:2px}.form-stepper{display:flex;align-items:center;justify-content:center;gap:8px;padding:4px 18px 0}.form-stepper[hidden]{display:none}.form-stepper-dot{width:22px;height:4px;border-radius:999px;background:color-mix(in srgb,var(--va-text) 14%,transparent);transition:background .2s ease,transform .2s ease}.form-stepper-dot.is-done{background:color-mix(in srgb,var(--va-primary) 60%,transparent)}.form-stepper-dot.is-active{background:linear-gradient(90deg,var(--va-primary),var(--va-accent));transform:scaleY(1.4)}.form-fields.is-grid{flex-direction:row;flex-wrap:wrap}.form-fields.is-grid>.form-field{flex:1 1 100%;min-width:0}.form-fields.is-grid>.form-field.is-half{flex:1 1 calc(50% - 6px)}.form-fields.is-compact{gap:8px}.form-fields.is-compact .form-field{gap:4px}.form-fields.is-compact .form-input{padding:8px 11px;font-size:12.5px}.form-fields.is-inline-labels .form-field{flex-direction:row;align-items:center;gap:10px}.form-fields.is-inline-labels .form-label{flex:0 0 38%;margin:0}.form-fields.is-inline-labels .form-input,.form-fields.is-inline-labels .form-choice-group{flex:1 1 auto}.form-help{font-size:11.5px;line-height:1.4;color:var(--va-text-muted)}.form-field-error{font-size:11.5px;line-height:1.4;color:#b91c1c}.form-field.is-invalid .form-input,.form-field.is-invalid .form-textarea,.form-field.is-invalid .form-select{border-color:#ef4444}.form-field.is-invalid .form-input:focus,.form-field.is-invalid .form-textarea:focus,.form-field.is-invalid .form-select:focus{box-shadow:0 0 0 3px color-mix(in srgb,#ef4444 22%,transparent)}.form-display{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border-radius:12px;background:color-mix(in srgb,var(--va-primary) 5%,transparent);border:1px solid color-mix(in srgb,var(--va-primary) 14%,transparent)}.form-display-title{font-size:13px;font-weight:600;color:var(--va-text)}.form-display-body{margin:0;font-size:12.5px;line-height:1.45;color:var(--va-text-muted)}.form-choice-group{display:flex;flex-direction:column;gap:6px}.form-choice{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--va-text);cursor:pointer;padding:6px 10px;border-radius:10px;border:1px solid color-mix(in srgb,var(--va-text) 10%,transparent);background:color-mix(in srgb,var(--va-background) 92%,var(--va-text) 8%);transition:border-color .15s ease,background .15s ease}.form-choice:hover{border-color:color-mix(in srgb,var(--va-primary) 35%,transparent);background:color-mix(in srgb,var(--va-primary) 6%,var(--va-background))}.form-choice input[type=radio],.form-choice input[type=checkbox]{accent-color:var(--va-primary);margin:0}.form-field.is-inline-bool{flex-direction:row;align-items:center;gap:10px}.form-field.is-inline-bool .form-label{order:2;flex:1 1 auto}.form-field.is-inline-bool .form-checkbox{order:1;accent-color:var(--va-primary);width:18px;height:18px;margin:0}.form-step-back{font-family:inherit;font-size:13.5px;font-weight:600;padding:11px 14px;border-radius:999px;border:none;cursor:pointer;background:color-mix(in srgb,var(--va-text) 8%,transparent);color:var(--va-text);transition:background .15s ease}.form-step-back:hover:not(:disabled){background:color-mix(in srgb,var(--va-text) 14%,transparent)}.form-step-back:disabled{opacity:.55;cursor:not-allowed}.form-step-back[hidden]{display:none}.ctl-settings.is-active{background:color-mix(in srgb,var(--va-primary) 22%,transparent);color:var(--va-primary)}.ctl-settings[hidden]{display:none}.audio-drawer{position:absolute;left:0;right:0;bottom:0;max-height:80%;background:var(--va-background);border-top:1px solid color-mix(in srgb,var(--va-text) 8%,transparent);box-shadow:0 -16px 32px -16px #0000002e;display:flex;flex-direction:column;border-top-left-radius:18px;border-top-right-radius:18px;z-index:6;transform:translateY(8px);opacity:0;transition:transform .18s ease,opacity .18s ease;pointer-events:none}.audio-drawer.is-open{transform:translateY(0);opacity:1;pointer-events:auto}.audio-drawer[hidden]{display:none}.audio-drawer-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 8px;border-bottom:1px solid color-mix(in srgb,var(--va-text) 6%,transparent)}.audio-drawer-title{font-weight:600;font-size:14px;color:var(--va-text)}.audio-drawer-close{width:28px;height:28px;border-radius:50%;border:none;background:transparent;color:var(--va-text-muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}.audio-drawer-close svg{width:16px;height:16px}.audio-drawer-close:hover{background:color-mix(in srgb,var(--va-text) 8%,transparent);color:var(--va-text)}.audio-drawer-body{padding:12px 16px 18px;overflow-y:auto;display:flex;flex-direction:column;gap:10px}.audio-row{display:flex;flex-direction:column;gap:6px}.audio-row-label{font-size:12px;font-weight:500;color:var(--va-text-muted);display:flex;justify-content:space-between;align-items:center}.audio-volume-value{font-variant-numeric:tabular-nums;color:var(--va-text);font-size:12px}.audio-row-meter .audio-meter{height:6px;border-radius:999px;background:color-mix(in srgb,var(--va-text) 10%,transparent);overflow:hidden}.audio-meter-bar{height:100%;width:0%;background:linear-gradient(90deg,var(--va-primary),var(--va-accent));transition:width .08s linear}.audio-row-select select,.audio-row-slider input[type=range]{width:100%;font-family:inherit}.audio-row-select select{padding:8px 10px;border-radius:10px;border:1px solid color-mix(in srgb,var(--va-text) 14%,transparent);background:var(--va-surface);color:var(--va-text);font-size:13px}.audio-row-select select:focus{outline:2px solid color-mix(in srgb,var(--va-primary) 35%,transparent);outline-offset:1px}.audio-row-slider input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:4px;background:color-mix(in srgb,var(--va-text) 12%,transparent);border-radius:999px}.audio-row-slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background:var(--va-primary);cursor:pointer;box-shadow:0 2px 6px #0000002e}.audio-row-slider input[type=range]::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:var(--va-primary);border:none;cursor:pointer}.audio-toggles{display:flex;flex-direction:column;gap:2px;margin-top:2px}.audio-toggle{display:flex;align-items:center;gap:12px;padding:8px 0;border-bottom:1px solid color-mix(in srgb,var(--va-text) 6%,transparent)}.audio-toggle:last-child{border-bottom:none}.audio-toggle-text{flex:1 1 auto;display:flex;flex-direction:column;gap:2px}.audio-toggle-label{font-size:13px;font-weight:500;color:var(--va-text)}.audio-toggle-hint{font-size:11.5px;color:var(--va-text-muted)}.audio-toggle input[type=checkbox]{-moz-appearance:none;appearance:none;-webkit-appearance:none;width:36px;height:20px;border-radius:999px;background:color-mix(in srgb,var(--va-text) 18%,transparent);position:relative;cursor:pointer;transition:background .15s ease;flex-shrink:0;margin:0}.audio-toggle input[type=checkbox]:after{content:"";position:absolute;width:16px;height:16px;border-radius:50%;background:#fff;top:2px;left:2px;transition:left .15s ease;box-shadow:0 1px 3px #00000040}.audio-toggle input[type=checkbox]:checked{background:var(--va-primary)}.audio-toggle input[type=checkbox]:checked:after{left:18px}.audio-toggle input[type=checkbox]:disabled{opacity:.5;cursor:not-allowed}.audio-diag{margin-top:4px;border-top:1px solid color-mix(in srgb,var(--va-text) 6%,transparent);padding-top:8px}.audio-diag summary{font-size:12px;font-weight:500;color:var(--va-text-muted);cursor:pointer;-webkit-user-select:none;user-select:none;padding:4px 0}.audio-diag summary::marker{color:var(--va-text-muted)}.audio-diag-list{display:grid;grid-template-columns:max-content 1fr;gap:4px 12px;margin:8px 0 0;font-size:11.5px}.audio-diag-list dt{color:var(--va-text-muted)}.audio-diag-list dd{color:var(--va-text);margin:0;font-variant-numeric:tabular-nums}', pe = `
|
|
4
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>
|
|
6
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
|
|
7
|
+
<line x1="12" y1="19" x2="12" y2="23"/>
|
|
8
|
+
<line x1="8" y1="23" x2="16" y2="23"/>
|
|
9
|
+
</svg>`, K = `
|
|
10
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
11
|
+
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
12
|
+
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
13
|
+
</svg>`, Te = `
|
|
14
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
15
|
+
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.37 1.9.72 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.35 1.85.59 2.81.72A2 2 0 0 1 22 16.92z"/>
|
|
16
|
+
</svg>`, O = `
|
|
17
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
18
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>
|
|
19
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
|
|
20
|
+
<line x1="12" y1="19" x2="12" y2="23"/>
|
|
21
|
+
<line x1="8" y1="23" x2="16" y2="23"/>
|
|
22
|
+
</svg>`, Ee = `
|
|
23
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
24
|
+
<line x1="1" y1="1" x2="23" y2="23"/>
|
|
25
|
+
<path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"/>
|
|
26
|
+
<path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"/>
|
|
27
|
+
<line x1="12" y1="19" x2="12" y2="23"/>
|
|
28
|
+
<line x1="8" y1="23" x2="16" y2="23"/>
|
|
29
|
+
</svg>`, W = `
|
|
30
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
31
|
+
<path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/>
|
|
32
|
+
<line x1="23" y1="1" x2="1" y2="23"/>
|
|
33
|
+
</svg>`, J = `
|
|
34
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
35
|
+
<path d="M12 2a4 4 0 0 0-4 4v2a4 4 0 0 0 8 0V6a4 4 0 0 0-4-4zm6 8a1 1 0 0 0-2 0 4 4 0 0 1-8 0 1 1 0 0 0-2 0 6 6 0 0 0 5 5.91V19H8a1 1 0 0 0 0 2h8a1 1 0 0 0 0-2h-3v-3.09A6 6 0 0 0 18 10z"/>
|
|
36
|
+
</svg>`, Ae = `
|
|
37
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
38
|
+
<circle cx="12" cy="12" r="9"/>
|
|
39
|
+
<path d="M3 12h18"/>
|
|
40
|
+
<path d="M12 3a13.5 13.5 0 0 1 0 18"/>
|
|
41
|
+
<path d="M12 3a13.5 13.5 0 0 0 0 18"/>
|
|
42
|
+
</svg>`, Q = `
|
|
43
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
44
|
+
<polyline points="6 9 12 15 18 9"/>
|
|
45
|
+
</svg>`, Be = `
|
|
46
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
|
|
47
|
+
<polyline points="20 6 9 17 4 12"/>
|
|
48
|
+
</svg>`, ze = `
|
|
49
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
50
|
+
<line x1="22" y1="2" x2="11" y2="13"/>
|
|
51
|
+
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
|
52
|
+
</svg>`, _e = `
|
|
53
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
54
|
+
<circle cx="12" cy="12" r="3"/>
|
|
55
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/>
|
|
56
|
+
</svg>`;
|
|
57
|
+
function Ie(e, a = {}) {
|
|
58
|
+
const o = document.createElement("div");
|
|
59
|
+
o.id = e, a.closeButtonHide && o.setAttribute("data-close-button-hide", ""), a.inline ? (o.setAttribute("data-inline", ""), o.style.position = "absolute", o.style.inset = "0", o.style.zIndex = "1") : (o.style.position = "fixed", o.style.inset = "auto", o.style.zIndex = "2147483647"), (a.parent ?? document.body).appendChild(o);
|
|
60
|
+
const t = o.attachShadow({ mode: "open" }), r = document.createElement("style");
|
|
61
|
+
r.textContent = Le, t.appendChild(r);
|
|
62
|
+
const s = document.createElement("button");
|
|
63
|
+
s.className = "fab", s.setAttribute("aria-label", "Open voice agent"), s.style.visibility = "hidden", s.innerHTML = `
|
|
64
|
+
<span class="fab-icon">${pe}</span>
|
|
65
|
+
<span class="fab-text">
|
|
66
|
+
<span class="fab-label"></span>
|
|
67
|
+
<span class="fab-sublabel"></span>
|
|
68
|
+
</span>
|
|
69
|
+
`, t.appendChild(s);
|
|
70
|
+
const c = document.createElement("div");
|
|
71
|
+
c.className = "panel", c.style.display = "none", c.innerHTML = `
|
|
72
|
+
<button class="close" aria-label="Close">${K}</button>
|
|
73
|
+
|
|
74
|
+
<section class="screen screen-welcome" data-screen="welcome">
|
|
75
|
+
<div class="welcome-inner">
|
|
76
|
+
<div class="welcome-logo">
|
|
77
|
+
<div class="welcome-logo-fallback">${J}</div>
|
|
78
|
+
<img class="welcome-logo-img" alt="" style="display:none" />
|
|
79
|
+
</div>
|
|
80
|
+
<div class="welcome-status"><span class="welcome-status-dot"></span><span class="welcome-status-text">Online</span></div>
|
|
81
|
+
<h1 class="welcome-name">Assistant</h1>
|
|
82
|
+
<p class="welcome-desc">Tap below to start a voice conversation.</p>
|
|
83
|
+
<div class="lang-picker" data-open="false">
|
|
84
|
+
<button class="lang-trigger" type="button" aria-haspopup="listbox" aria-expanded="false">
|
|
85
|
+
<span class="lang-trigger-icon">${Ae}</span>
|
|
86
|
+
<span class="lang-trigger-text">
|
|
87
|
+
<span class="lang-trigger-eyebrow">Language</span>
|
|
88
|
+
<span class="lang-trigger-label">English</span>
|
|
89
|
+
</span>
|
|
90
|
+
<span class="lang-trigger-code">EN</span>
|
|
91
|
+
<span class="lang-trigger-chev">${Q}</span>
|
|
92
|
+
</button>
|
|
93
|
+
<div class="lang-menu" role="listbox" hidden></div>
|
|
94
|
+
</div>
|
|
95
|
+
<button class="start-btn" aria-label="Start call">
|
|
96
|
+
<span class="start-btn-icon">${Te}</span>
|
|
97
|
+
<span class="start-btn-label">Start Call</span>
|
|
98
|
+
</button>
|
|
99
|
+
<div class="consent" hidden>
|
|
100
|
+
<span class="consent-text"></span>
|
|
101
|
+
<a class="consent-link" target="_blank" rel="noopener noreferrer"></a>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
<a class="welcome-foot" target="_blank" rel="noopener noreferrer"></a>
|
|
105
|
+
</section>
|
|
106
|
+
|
|
107
|
+
<section class="screen screen-form" data-screen="form" style="display:none">
|
|
108
|
+
<header class="form-header">
|
|
109
|
+
<button class="form-back" type="button" aria-label="Back">${Q}</button>
|
|
110
|
+
<div class="form-header-text">
|
|
111
|
+
<div class="form-eyebrow">Review before submit</div>
|
|
112
|
+
<div class="form-title">Form</div>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="form-call-controls" hidden>
|
|
115
|
+
<button class="form-mute" type="button" aria-label="Mute">${O}</button>
|
|
116
|
+
<button class="form-end" type="button" aria-label="End call">${W}</button>
|
|
117
|
+
</div>
|
|
118
|
+
</header>
|
|
119
|
+
<div class="form-transcript" hidden aria-live="polite"></div>
|
|
120
|
+
<div class="form-stepper" hidden></div>
|
|
121
|
+
<div class="form-body">
|
|
122
|
+
<p class="form-subtitle"></p>
|
|
123
|
+
<div class="form-fields"></div>
|
|
124
|
+
<div class="form-error" hidden></div>
|
|
125
|
+
<div class="form-success" hidden></div>
|
|
126
|
+
</div>
|
|
127
|
+
<footer class="form-actions">
|
|
128
|
+
<button class="form-step-back" type="button" hidden>Back</button>
|
|
129
|
+
<button class="form-cancel" type="button">Cancel</button>
|
|
130
|
+
<button class="form-submit" type="button">
|
|
131
|
+
<span class="form-submit-label">Confirm & send</span>
|
|
132
|
+
</button>
|
|
133
|
+
</footer>
|
|
134
|
+
</section>
|
|
135
|
+
|
|
136
|
+
<section class="screen screen-call" data-screen="call" style="display:none">
|
|
137
|
+
<header class="call-header">
|
|
138
|
+
<div class="call-id">
|
|
139
|
+
<div class="call-logo">
|
|
140
|
+
<div class="call-logo-fallback">${J}</div>
|
|
141
|
+
<img class="call-logo-img" alt="" style="display:none" />
|
|
142
|
+
</div>
|
|
143
|
+
<div class="call-id-text">
|
|
144
|
+
<div class="call-name">Assistant</div>
|
|
145
|
+
<div class="call-status">Connecting…</div>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="call-timer" hidden aria-live="polite">
|
|
149
|
+
<span class="call-timer-text">0:00</span>
|
|
150
|
+
</div>
|
|
151
|
+
</header>
|
|
152
|
+
|
|
153
|
+
<div class="call-stage">
|
|
154
|
+
<div class="orb">
|
|
155
|
+
<span class="orb-ring orb-ring-1"></span>
|
|
156
|
+
<span class="orb-ring orb-ring-2"></span>
|
|
157
|
+
<span class="orb-ring orb-ring-3"></span>
|
|
158
|
+
<span class="orb-core"></span>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="orb-label">Idle</div>
|
|
161
|
+
<div class="agent-status-line" aria-live="polite" hidden></div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div class="transcript" aria-live="polite" style="display: none;"></div>
|
|
165
|
+
|
|
166
|
+
<div class="text-input-row" hidden>
|
|
167
|
+
<textarea class="text-input" placeholder="Type a message…" rows="1" aria-label="Type a message"></textarea>
|
|
168
|
+
<button class="text-send-btn" type="button" aria-label="Send message">${ze}</button>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div class="call-controls">
|
|
172
|
+
<button class="ctl-btn ctl-mute" aria-label="Mute" disabled>
|
|
173
|
+
${O}
|
|
174
|
+
</button>
|
|
175
|
+
<button class="ctl-btn ctl-settings" aria-label="Audio settings" hidden>
|
|
176
|
+
${_e}
|
|
177
|
+
</button>
|
|
178
|
+
<button class="ctl-btn ctl-end" aria-label="End call" disabled>
|
|
179
|
+
${W}
|
|
180
|
+
</button>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<div class="audio-drawer" hidden aria-label="Audio settings">
|
|
184
|
+
<header class="audio-drawer-head">
|
|
185
|
+
<div class="audio-drawer-title">Audio settings</div>
|
|
186
|
+
<button class="audio-drawer-close" type="button" aria-label="Close audio settings">${K}</button>
|
|
187
|
+
</header>
|
|
188
|
+
<div class="audio-drawer-body">
|
|
189
|
+
<div class="audio-row audio-row-meter">
|
|
190
|
+
<span class="audio-row-label">Microphone level</span>
|
|
191
|
+
<div class="audio-meter"><div class="audio-meter-bar"></div></div>
|
|
192
|
+
</div>
|
|
193
|
+
<label class="audio-row audio-row-select">
|
|
194
|
+
<span class="audio-row-label">Microphone</span>
|
|
195
|
+
<select class="audio-mic-select"></select>
|
|
196
|
+
</label>
|
|
197
|
+
<label class="audio-row audio-row-select audio-row-speaker">
|
|
198
|
+
<span class="audio-row-label">Speaker</span>
|
|
199
|
+
<select class="audio-speaker-select"></select>
|
|
200
|
+
</label>
|
|
201
|
+
<label class="audio-row audio-row-slider">
|
|
202
|
+
<span class="audio-row-label">Speaker volume <span class="audio-volume-value">85%</span></span>
|
|
203
|
+
<input class="audio-volume" type="range" min="0" max="100" step="1" value="85" />
|
|
204
|
+
</label>
|
|
205
|
+
<label class="audio-row audio-row-select">
|
|
206
|
+
<span class="audio-row-label">Noise cancellation engine</span>
|
|
207
|
+
<select class="audio-nc-engine">
|
|
208
|
+
<option value="off">Off (browser only)</option>
|
|
209
|
+
<option value="krisp">Krisp (default)</option>
|
|
210
|
+
<option value="deepfilter">DeepFilterNet3</option>
|
|
211
|
+
</select>
|
|
212
|
+
</label>
|
|
213
|
+
<label class="audio-row audio-row-slider audio-row-df-strength" hidden>
|
|
214
|
+
<span class="audio-row-label">DeepFilter strength <span class="audio-df-strength-value">80</span></span>
|
|
215
|
+
<input class="audio-df-strength" type="range" min="0" max="100" step="1" value="80" />
|
|
216
|
+
</label>
|
|
217
|
+
<div class="audio-toggles">
|
|
218
|
+
<label class="audio-toggle">
|
|
219
|
+
<span class="audio-toggle-text">
|
|
220
|
+
<span class="audio-toggle-label">Echo cancellation</span>
|
|
221
|
+
<span class="audio-toggle-hint">Browser AEC</span>
|
|
222
|
+
</span>
|
|
223
|
+
<input class="audio-tog-aec" type="checkbox" />
|
|
224
|
+
</label>
|
|
225
|
+
<label class="audio-toggle">
|
|
226
|
+
<span class="audio-toggle-text">
|
|
227
|
+
<span class="audio-toggle-label">Noise suppression</span>
|
|
228
|
+
<span class="audio-toggle-hint">Browser noise filter</span>
|
|
229
|
+
</span>
|
|
230
|
+
<input class="audio-tog-ns" type="checkbox" />
|
|
231
|
+
</label>
|
|
232
|
+
<label class="audio-toggle">
|
|
233
|
+
<span class="audio-toggle-text">
|
|
234
|
+
<span class="audio-toggle-label">Auto gain</span>
|
|
235
|
+
<span class="audio-toggle-hint">Normalize my volume</span>
|
|
236
|
+
</span>
|
|
237
|
+
<input class="audio-tog-agc" type="checkbox" />
|
|
238
|
+
</label>
|
|
239
|
+
<label class="audio-toggle audio-toggle-vi">
|
|
240
|
+
<span class="audio-toggle-text">
|
|
241
|
+
<span class="audio-toggle-label">Voice isolation</span>
|
|
242
|
+
<span class="audio-toggle-hint">Edge/Chrome only</span>
|
|
243
|
+
</span>
|
|
244
|
+
<input class="audio-tog-vi" type="checkbox" />
|
|
245
|
+
</label>
|
|
246
|
+
<label class="audio-toggle">
|
|
247
|
+
<span class="audio-toggle-text">
|
|
248
|
+
<span class="audio-toggle-label">Headphones mode</span>
|
|
249
|
+
<span class="audio-toggle-hint">Disable mic ducking</span>
|
|
250
|
+
</span>
|
|
251
|
+
<input class="audio-tog-hp" type="checkbox" />
|
|
252
|
+
</label>
|
|
253
|
+
<label class="audio-toggle">
|
|
254
|
+
<span class="audio-toggle-text">
|
|
255
|
+
<span class="audio-toggle-label">Live Transcription</span>
|
|
256
|
+
<span class="audio-toggle-hint">Show conversation text</span>
|
|
257
|
+
</span>
|
|
258
|
+
<input class="audio-tog-transcription" type="checkbox" />
|
|
259
|
+
</label>
|
|
260
|
+
<label class="audio-toggle">
|
|
261
|
+
<span class="audio-toggle-text">
|
|
262
|
+
<span class="audio-toggle-label">Text Input</span>
|
|
263
|
+
<span class="audio-toggle-hint">Type messages to the agent</span>
|
|
264
|
+
</span>
|
|
265
|
+
<input class="audio-tog-text-input" type="checkbox" />
|
|
266
|
+
</label>
|
|
267
|
+
</div>
|
|
268
|
+
<details class="audio-diag">
|
|
269
|
+
<summary>Diagnostics</summary>
|
|
270
|
+
<dl class="audio-diag-list">
|
|
271
|
+
<dt>NC engine</dt><dd class="audio-diag-engine">—</dd>
|
|
272
|
+
<dt>Echo cancellation</dt><dd class="audio-diag-aec">—</dd>
|
|
273
|
+
<dt>Noise suppression</dt><dd class="audio-diag-ns">—</dd>
|
|
274
|
+
<dt>Auto gain</dt><dd class="audio-diag-agc">—</dd>
|
|
275
|
+
<dt>Voice isolation</dt><dd class="audio-diag-vi">—</dd>
|
|
276
|
+
<dt>Sample rate</dt><dd class="audio-diag-sr">—</dd>
|
|
277
|
+
<dt>Packet loss</dt><dd class="audio-diag-loss">—</dd>
|
|
278
|
+
<dt>Jitter</dt><dd class="audio-diag-jitter">—</dd>
|
|
279
|
+
<dt>RTT</dt><dd class="audio-diag-rtt">—</dd>
|
|
280
|
+
</dl>
|
|
281
|
+
</details>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
</section>
|
|
285
|
+
`, t.appendChild(c);
|
|
286
|
+
const n = (d) => c.querySelector(d);
|
|
287
|
+
return {
|
|
288
|
+
host: o,
|
|
289
|
+
shadow: t,
|
|
290
|
+
fab: s,
|
|
291
|
+
panel: c,
|
|
292
|
+
closeBtn: n(".close"),
|
|
293
|
+
welcomeScreen: n(".screen-welcome"),
|
|
294
|
+
welcomeLogo: n(".welcome-logo-img"),
|
|
295
|
+
welcomeLogoFallback: n(".welcome-logo-fallback"),
|
|
296
|
+
welcomeName: n(".welcome-name"),
|
|
297
|
+
welcomeDesc: n(".welcome-desc"),
|
|
298
|
+
langPicker: n(".lang-picker"),
|
|
299
|
+
langTrigger: n(".lang-trigger"),
|
|
300
|
+
langTriggerLabel: n(".lang-trigger-label"),
|
|
301
|
+
langTriggerCode: n(".lang-trigger-code"),
|
|
302
|
+
langMenu: n(".lang-menu"),
|
|
303
|
+
startBtn: n(".start-btn"),
|
|
304
|
+
startBtnLabel: n(".start-btn-label"),
|
|
305
|
+
consent: n(".consent"),
|
|
306
|
+
consentText: n(".consent-text"),
|
|
307
|
+
consentLink: n(".consent-link"),
|
|
308
|
+
poweredBy: n(".welcome-foot"),
|
|
309
|
+
callScreen: n(".screen-call"),
|
|
310
|
+
callLogo: n(".call-logo-img"),
|
|
311
|
+
callLogoFallback: n(".call-logo-fallback"),
|
|
312
|
+
callName: n(".call-name"),
|
|
313
|
+
callStatus: n(".call-status"),
|
|
314
|
+
callTimer: n(".call-timer"),
|
|
315
|
+
callTimerText: n(".call-timer-text"),
|
|
316
|
+
orb: n(".orb"),
|
|
317
|
+
orbLabel: n(".orb-label"),
|
|
318
|
+
agentStatusLine: n(".agent-status-line"),
|
|
319
|
+
transcript: n(".transcript"),
|
|
320
|
+
transcriptSegments: /* @__PURE__ */ new Map(),
|
|
321
|
+
transcriptInterimBubble: /* @__PURE__ */ new Map(),
|
|
322
|
+
textInputRow: n(".text-input-row"),
|
|
323
|
+
textInput: n(".text-input"),
|
|
324
|
+
textSendBtn: n(".text-send-btn"),
|
|
325
|
+
muteBtn: n(".ctl-mute"),
|
|
326
|
+
endBtn: n(".ctl-end"),
|
|
327
|
+
settingsBtn: n(".ctl-settings"),
|
|
328
|
+
audioDrawer: n(".audio-drawer"),
|
|
329
|
+
audioDrawerClose: n(".audio-drawer-close"),
|
|
330
|
+
audioMeterBar: n(".audio-meter-bar"),
|
|
331
|
+
audioMicSelect: n(".audio-mic-select"),
|
|
332
|
+
audioSpeakerSelect: n(".audio-speaker-select"),
|
|
333
|
+
audioSpeakerRow: n(".audio-row-speaker"),
|
|
334
|
+
audioVolume: n(".audio-volume"),
|
|
335
|
+
audioVolumeValue: n(".audio-volume-value"),
|
|
336
|
+
audioNcEngine: n(".audio-nc-engine"),
|
|
337
|
+
audioDfStrengthRow: n(".audio-row-df-strength"),
|
|
338
|
+
audioDfStrength: n(".audio-df-strength"),
|
|
339
|
+
audioDfStrengthValue: n(".audio-df-strength-value"),
|
|
340
|
+
audioTogAec: n(".audio-tog-aec"),
|
|
341
|
+
audioTogNs: n(".audio-tog-ns"),
|
|
342
|
+
audioTogAgc: n(".audio-tog-agc"),
|
|
343
|
+
audioTogVi: n(".audio-tog-vi"),
|
|
344
|
+
audioTogViRow: n(".audio-toggle-vi"),
|
|
345
|
+
audioTogHp: n(".audio-tog-hp"),
|
|
346
|
+
audioTogTranscription: n(".audio-tog-transcription"),
|
|
347
|
+
audioTogTextInput: n(".audio-tog-text-input"),
|
|
348
|
+
audioDiagEngine: n(".audio-diag-engine"),
|
|
349
|
+
audioDiagAec: n(".audio-diag-aec"),
|
|
350
|
+
audioDiagNs: n(".audio-diag-ns"),
|
|
351
|
+
audioDiagAgc: n(".audio-diag-agc"),
|
|
352
|
+
audioDiagVi: n(".audio-diag-vi"),
|
|
353
|
+
audioDiagSr: n(".audio-diag-sr"),
|
|
354
|
+
audioDiagLoss: n(".audio-diag-loss"),
|
|
355
|
+
audioDiagJitter: n(".audio-diag-jitter"),
|
|
356
|
+
audioDiagRtt: n(".audio-diag-rtt"),
|
|
357
|
+
formScreen: n(".screen-form"),
|
|
358
|
+
formTranscript: n(".form-transcript"),
|
|
359
|
+
formTranscriptSegments: /* @__PURE__ */ new Map(),
|
|
360
|
+
formTranscriptInterimBubble: /* @__PURE__ */ new Map(),
|
|
361
|
+
formTitle: n(".form-title"),
|
|
362
|
+
formEyebrow: n(".form-eyebrow"),
|
|
363
|
+
formSubtitle: n(".form-subtitle"),
|
|
364
|
+
formStepper: n(".form-stepper"),
|
|
365
|
+
formFields: n(".form-fields"),
|
|
366
|
+
formError: n(".form-error"),
|
|
367
|
+
formSuccess: n(".form-success"),
|
|
368
|
+
formSubmitBtn: n(".form-submit"),
|
|
369
|
+
formBackBtn: n(".form-back"),
|
|
370
|
+
formCancelBtn: n(".form-cancel"),
|
|
371
|
+
formStepBackBtn: n(".form-step-back"),
|
|
372
|
+
formCallControls: n(".form-call-controls"),
|
|
373
|
+
formMuteBtn: n(".form-mute"),
|
|
374
|
+
formEndBtn: n(".form-end"),
|
|
375
|
+
formInputs: /* @__PURE__ */ new Map(),
|
|
376
|
+
appearance: k,
|
|
377
|
+
selectedLanguage: k.default_language
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function y(e, a) {
|
|
381
|
+
return `${e}: ${a};`;
|
|
382
|
+
}
|
|
383
|
+
function X(e, a) {
|
|
384
|
+
e.appearance = a;
|
|
385
|
+
const o = a.theme, t = a.dimensions, r = le(o.primary_color), s = le(o.accent_color), c = [
|
|
386
|
+
y("--va-primary", o.primary_color),
|
|
387
|
+
y("--va-primary-text", r),
|
|
388
|
+
y("--va-accent", o.accent_color),
|
|
389
|
+
y("--va-accent-text", s),
|
|
390
|
+
y("--va-background", o.background_color),
|
|
391
|
+
y("--va-surface", Xe(o.background_color)),
|
|
392
|
+
y("--va-text", o.text_color),
|
|
393
|
+
y("--va-text-muted", Ze(o.text_color, o.background_color)),
|
|
394
|
+
y("--va-user-bubble", o.user_bubble_color),
|
|
395
|
+
y("--va-user-bubble-text", o.user_bubble_text_color),
|
|
396
|
+
y("--va-agent-bubble", o.agent_bubble_color),
|
|
397
|
+
y("--va-agent-bubble-text", o.agent_bubble_text_color),
|
|
398
|
+
y("--va-fab-size", `${t.fab_size}px`),
|
|
399
|
+
y("--va-panel-width", `${t.panel_width}px`),
|
|
400
|
+
y("--va-panel-height", `${t.panel_height}px`),
|
|
401
|
+
y("--va-border-radius", `${t.border_radius}px`),
|
|
402
|
+
y("--va-font", a.layout.font_family)
|
|
403
|
+
], n = e.host.hasAttribute("data-inline");
|
|
404
|
+
e.host.style.cssText = n ? `position: absolute; inset: 0; z-index: 1; ${c.join(" ")}` : `position: fixed; inset: auto; z-index: 2147483647; ${c.join(" ")}`, n || e.host.setAttribute("data-position", a.layout.position), e.transcript.setAttribute(
|
|
405
|
+
"data-placeholder",
|
|
406
|
+
a.labels.transcript_placeholder || k.labels.transcript_placeholder
|
|
407
|
+
);
|
|
408
|
+
const d = a.name || k.name, p = a.subtitle || k.subtitle;
|
|
409
|
+
e.welcomeName.textContent = d, e.welcomeDesc.textContent = p, e.callName.textContent = d, e.fab.setAttribute("aria-label", `Open ${d}`), e.startBtnLabel.textContent = a.start_button_text || k.start_button_text, e.startBtn.setAttribute(
|
|
410
|
+
"aria-label",
|
|
411
|
+
a.start_button_text || k.start_button_text
|
|
412
|
+
);
|
|
413
|
+
const v = a.powered_by_text ?? "";
|
|
414
|
+
e.poweredBy.textContent = v, e.poweredBy.style.display = v ? "" : "none";
|
|
415
|
+
const x = ge(a.powered_by_url);
|
|
416
|
+
x ? (e.poweredBy.href = x, e.poweredBy.classList.add("is-link")) : (e.poweredBy.removeAttribute("href"), e.poweredBy.classList.remove("is-link"));
|
|
417
|
+
const l = ue(a.logo_url), g = !!(l && l !== "https://example.com/logo.png");
|
|
418
|
+
g ? (e.welcomeLogo.src = l, e.welcomeLogo.alt = d, e.welcomeLogo.style.display = "", e.welcomeLogoFallback.style.display = "none", e.callLogo.src = l, e.callLogo.alt = d, e.callLogo.style.display = "", e.callLogoFallback.style.display = "none") : (e.welcomeLogo.removeAttribute("src"), e.welcomeLogo.style.display = "none", e.welcomeLogoFallback.style.display = "", e.callLogo.removeAttribute("src"), e.callLogo.style.display = "none", e.callLogoFallback.style.display = ""), Fe(e, a, g, d), $e(e, a), Me(e, a), e.fab.style.visibility = "";
|
|
419
|
+
}
|
|
420
|
+
function Me(e, a) {
|
|
421
|
+
const o = (a.terms_url || "").trim();
|
|
422
|
+
if (!o) {
|
|
423
|
+
e.consent.hidden = !0;
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
e.consent.hidden = !1;
|
|
427
|
+
const t = a.consent_text || k.consent_text, r = a.terms_label || k.terms_label;
|
|
428
|
+
e.consentText.textContent = `${t} `, e.consentLink.textContent = r, e.consentLink.href = ge(o), e.consentLink.setAttribute("aria-label", r);
|
|
429
|
+
}
|
|
430
|
+
function $e(e, a) {
|
|
431
|
+
const o = a.languages.length ? a.languages : k.languages, t = e.selectedLanguage, r = o.find((c) => c.code === t) ?? o.find((c) => c.code === a.default_language) ?? o[0];
|
|
432
|
+
if (e.selectedLanguage = r.code, o.length <= 1) {
|
|
433
|
+
e.langPicker.style.display = "none";
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
e.langPicker.style.display = "";
|
|
437
|
+
const s = e.langTrigger.querySelector(
|
|
438
|
+
".lang-trigger-eyebrow"
|
|
439
|
+
);
|
|
440
|
+
s && (s.textContent = a.labels.language_label || k.labels.language_label), e.langMenu.innerHTML = "";
|
|
441
|
+
for (const c of o) {
|
|
442
|
+
const n = document.createElement("button");
|
|
443
|
+
n.type = "button", n.className = "lang-option", n.setAttribute("role", "option"), n.dataset.code = c.code, n.innerHTML = `
|
|
444
|
+
<span class="lang-option-text">
|
|
445
|
+
<span class="lang-option-native">${A(c.native_label)}</span>
|
|
446
|
+
<span class="lang-option-label">${A(c.label)}</span>
|
|
447
|
+
</span>
|
|
448
|
+
<span class="lang-option-code">${A(c.code.toUpperCase())}</span>
|
|
449
|
+
<span class="lang-option-check">${Be}</span>
|
|
450
|
+
`, n.addEventListener("click", (d) => {
|
|
451
|
+
d.stopPropagation(), Z(e, o, c.code), _(e);
|
|
452
|
+
}), e.langMenu.appendChild(n);
|
|
453
|
+
}
|
|
454
|
+
Z(e, o, r.code), Ne(e);
|
|
455
|
+
}
|
|
456
|
+
function Ne(e) {
|
|
457
|
+
const a = e.langPicker;
|
|
458
|
+
a.dataset.wired !== "1" && (a.dataset.wired = "1", e.langTrigger.addEventListener("click", (o) => {
|
|
459
|
+
o.stopPropagation(), a.dataset.open === "true" ? _(e) : De(e);
|
|
460
|
+
}), e.shadow.addEventListener("click", (o) => {
|
|
461
|
+
if (a.dataset.open !== "true") return;
|
|
462
|
+
const t = o.target;
|
|
463
|
+
t && a.contains(t) || _(e);
|
|
464
|
+
}), e.shadow.addEventListener("keydown", (o) => {
|
|
465
|
+
o.key === "Escape" && a.dataset.open === "true" && (_(e), e.langTrigger.focus());
|
|
466
|
+
}));
|
|
467
|
+
}
|
|
468
|
+
function De(e) {
|
|
469
|
+
e.langPicker.dataset.open = "true", e.langMenu.hidden = !1, e.langTrigger.setAttribute("aria-expanded", "true");
|
|
470
|
+
}
|
|
471
|
+
function _(e) {
|
|
472
|
+
e.langPicker.dataset.open = "false", e.langMenu.hidden = !0, e.langTrigger.setAttribute("aria-expanded", "false");
|
|
473
|
+
}
|
|
474
|
+
function Z(e, a, o) {
|
|
475
|
+
const t = a.find((s) => s.code === o) ?? a[0];
|
|
476
|
+
e.selectedLanguage = t.code, e.langTriggerLabel.textContent = t.native_label || t.label, e.langTriggerCode.textContent = t.code.toUpperCase(), e.langTrigger.setAttribute(
|
|
477
|
+
"aria-label",
|
|
478
|
+
`${e.appearance.labels.language_label || "Language"}: ${t.label}`
|
|
479
|
+
), e.langMenu.querySelectorAll(".lang-option").forEach((s) => {
|
|
480
|
+
const c = s.dataset.code === t.code;
|
|
481
|
+
s.classList.toggle("is-active", c), s.setAttribute("aria-selected", c ? "true" : "false");
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function A(e) {
|
|
485
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
486
|
+
}
|
|
487
|
+
function ge(e) {
|
|
488
|
+
if (!e) return "";
|
|
489
|
+
try {
|
|
490
|
+
const a = new URL(e, location.href).protocol;
|
|
491
|
+
return ["https:", "http:", "mailto:"].includes(a) ? e : "";
|
|
492
|
+
} catch {
|
|
493
|
+
return "";
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
function ue(e) {
|
|
497
|
+
if (!e) return "";
|
|
498
|
+
try {
|
|
499
|
+
const a = new URL(e, location.href).protocol;
|
|
500
|
+
return ["https:", "http:"].includes(a) ? e : "";
|
|
501
|
+
} catch {
|
|
502
|
+
return "";
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function L(e) {
|
|
506
|
+
return A(e).replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/__(.+?)__/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/_(.+?)_/g, "<em>$1</em>").replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>');
|
|
507
|
+
}
|
|
508
|
+
function ee(e) {
|
|
509
|
+
const a = e.split(`
|
|
510
|
+
`), o = [];
|
|
511
|
+
let t = 0;
|
|
512
|
+
for (; t < a.length; ) {
|
|
513
|
+
const r = a[t], s = r.match(/^### (.+)/), c = r.match(/^## (.+)/), n = r.match(/^# (.+)/);
|
|
514
|
+
if (s) {
|
|
515
|
+
o.push(`<h3>${L(s[1])}</h3>`), t++;
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (c) {
|
|
519
|
+
o.push(`<h2>${L(c[1])}</h2>`), t++;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
if (n) {
|
|
523
|
+
o.push(`<h1>${L(n[1])}</h1>`), t++;
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
if (r.match(/^[-*] /)) {
|
|
527
|
+
const p = [];
|
|
528
|
+
for (; t < a.length && a[t].match(/^[-*] /); )
|
|
529
|
+
p.push(`<li>${L(a[t].slice(2))}</li>`), t++;
|
|
530
|
+
o.push(`<ul>${p.join("")}</ul>`);
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
if (r.match(/^\d+\. /)) {
|
|
534
|
+
const p = [];
|
|
535
|
+
for (; t < a.length && a[t].match(/^\d+\. /); )
|
|
536
|
+
p.push(`<li>${L(a[t].replace(/^\d+\. /, ""))}</li>`), t++;
|
|
537
|
+
o.push(`<ol>${p.join("")}</ol>`);
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
if (r.startsWith("```")) {
|
|
541
|
+
const p = [];
|
|
542
|
+
for (t++; t < a.length && !a[t].startsWith("```"); )
|
|
543
|
+
p.push(A(a[t])), t++;
|
|
544
|
+
t < a.length && t++, o.push(`<pre><code>${p.join(`
|
|
545
|
+
`)}</code></pre>`);
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
if (!r.trim()) {
|
|
549
|
+
t++;
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
const d = [];
|
|
553
|
+
for (; t < a.length && a[t].trim() && !a[t].match(/^(#{1,3} |[-*] |\d+\. |```)/); )
|
|
554
|
+
d.push(L(a[t])), t++;
|
|
555
|
+
d.length && o.push(`<p>${d.join("<br>")}</p>`);
|
|
556
|
+
}
|
|
557
|
+
return o.join("");
|
|
558
|
+
}
|
|
559
|
+
function Fe(e, a, o, t) {
|
|
560
|
+
const r = (a.fab_label || "").trim(), s = (a.fab_sublabel || "").trim(), c = e.fab.querySelector(".fab-icon"), n = e.fab.querySelector(".fab-text"), d = e.fab.querySelector(".fab-label"), p = e.fab.querySelector(".fab-sublabel");
|
|
561
|
+
!c || !n || !d || !p || (o ? c.innerHTML = `<img class="fab-logo" alt="${ce(t)}" src="${ce(ue(a.logo_url))}" />` : c.innerHTML = pe, r ? (d.textContent = r, e.fab.classList.add("has-label"), e.fab.setAttribute(
|
|
562
|
+
"aria-label",
|
|
563
|
+
s ? `${r}, ${s} — open ${t}` : `${r} — open ${t}`
|
|
564
|
+
)) : (d.textContent = "", e.fab.classList.remove("has-label"), e.fab.setAttribute("aria-label", `Open ${t}`)), r && s ? (p.textContent = s, e.fab.classList.add("has-sublabel")) : (p.textContent = "", e.fab.classList.remove("has-sublabel")), n.style.display = r ? "" : "none");
|
|
565
|
+
}
|
|
566
|
+
function E(e, a) {
|
|
567
|
+
e.panel.setAttribute("data-screen", a), e.welcomeScreen.style.display = a === "welcome" ? "flex" : "none", e.callScreen.style.display = a === "call" ? "flex" : "none", e.formScreen.style.display = a === "form" ? "flex" : "none";
|
|
568
|
+
}
|
|
569
|
+
function je(e, a) {
|
|
570
|
+
var h;
|
|
571
|
+
const { definition: o, values: t, cancelLabel: r } = a, s = Ce(o), c = Math.max(0, Math.min(a.stepIndex ?? 0, s - 1)), n = s > 1, d = c === s - 1, p = (h = o.steps) == null ? void 0 : h[c];
|
|
572
|
+
e.formTitle.textContent = (p == null ? void 0 : p.title) ?? o.title, e.formEyebrow.textContent = n ? `Step ${c + 1} of ${s}${o.title ? ` · ${o.title}` : ""}` : "Review before submit";
|
|
573
|
+
const v = (p == null ? void 0 : p.subtitle) ?? (c === 0 ? o.subtitle : "");
|
|
574
|
+
e.formSubtitle.textContent = v ?? "", e.formSubtitle.style.display = v ? "" : "none", Ve(e, s, c);
|
|
575
|
+
const x = e.formSubmitBtn.querySelector(".form-submit-label");
|
|
576
|
+
x && (x.textContent = d ? o.submit_label ?? "Confirm & send" : (p == null ? void 0 : p.next_label) ?? "Continue"), e.formCancelBtn.textContent = r ?? "Cancel";
|
|
577
|
+
const l = n && c > 0;
|
|
578
|
+
e.formStepBackBtn.hidden = !l, l && (e.formStepBackBtn.textContent = (p == null ? void 0 : p.back_label) ?? "Back");
|
|
579
|
+
const g = o.layout ?? {};
|
|
580
|
+
e.formFields.classList.toggle("is-grid", g.field_layout === "grid"), e.formFields.classList.toggle("is-compact", g.density === "compact"), e.formFields.classList.toggle("is-inline-labels", g.label_position === "inline"), I(e, ""), R(e, ""), e.formFields.innerHTML = "", e.formInputs.clear();
|
|
581
|
+
for (const u of Se(o, c))
|
|
582
|
+
e.formFields.appendChild(
|
|
583
|
+
He(
|
|
584
|
+
e,
|
|
585
|
+
u,
|
|
586
|
+
u.name ? t[u.name] ?? "" : "",
|
|
587
|
+
a.onFieldChange
|
|
588
|
+
)
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
function Ve(e, a, o) {
|
|
592
|
+
if (a <= 1) {
|
|
593
|
+
e.formStepper.hidden = !0, e.formStepper.innerHTML = "";
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
e.formStepper.hidden = !1, e.formStepper.innerHTML = "";
|
|
597
|
+
for (let t = 0; t < a; t++) {
|
|
598
|
+
const r = document.createElement("span");
|
|
599
|
+
r.className = "form-stepper-dot", t < o && r.classList.add("is-done"), t === o && r.classList.add("is-active"), e.formStepper.appendChild(r);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
function j(e) {
|
|
603
|
+
return e ? e.map(
|
|
604
|
+
(a) => typeof a == "string" ? { value: a, label: a } : { value: a.value, label: a.label ?? a.value }
|
|
605
|
+
) : [];
|
|
606
|
+
}
|
|
607
|
+
function He(e, a, o, t) {
|
|
608
|
+
let r = () => {
|
|
609
|
+
};
|
|
610
|
+
const s = () => {
|
|
611
|
+
r(), t && t();
|
|
612
|
+
};
|
|
613
|
+
if (a.type === "display") {
|
|
614
|
+
const l = document.createElement("div");
|
|
615
|
+
if (l.className = "form-display", a.label) {
|
|
616
|
+
const g = document.createElement("div");
|
|
617
|
+
g.className = "form-display-title", g.textContent = a.label, l.appendChild(g);
|
|
618
|
+
}
|
|
619
|
+
if (a.help_text) {
|
|
620
|
+
const g = document.createElement("p");
|
|
621
|
+
g.className = "form-display-body", g.textContent = a.help_text, l.appendChild(g);
|
|
622
|
+
}
|
|
623
|
+
return l;
|
|
624
|
+
}
|
|
625
|
+
const c = a.name, n = document.createElement("label");
|
|
626
|
+
n.className = "form-field", a.width === "half" && n.classList.add("is-half");
|
|
627
|
+
const d = document.createElement("span");
|
|
628
|
+
d.className = "form-label", d.textContent = a.required ? `${a.label} *` : a.label, n.appendChild(d);
|
|
629
|
+
let p;
|
|
630
|
+
if (a.type === "textarea") {
|
|
631
|
+
const l = document.createElement("textarea");
|
|
632
|
+
l.rows = a.rows ?? 4, l.placeholder = a.placeholder ?? "", l.value = o, l.name = c, l.className = "form-input form-textarea", a.required && (l.required = !0), l.addEventListener("input", s), n.appendChild(l), p = {
|
|
633
|
+
read: () => l.value.trim(),
|
|
634
|
+
setDisabled: (g) => {
|
|
635
|
+
l.disabled = g;
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
} else if (a.type === "select") {
|
|
639
|
+
const l = document.createElement("select");
|
|
640
|
+
l.className = "form-input form-select", l.name = c, a.required && (l.required = !0);
|
|
641
|
+
const g = j(a.options), h = new Set(g.map((m) => m.value)), u = !o || h.has(o) ? g : [...g, { value: o, label: o }];
|
|
642
|
+
for (const m of u) {
|
|
643
|
+
const b = document.createElement("option");
|
|
644
|
+
b.value = m.value, b.textContent = m.label, m.value === o && (b.selected = !0), l.appendChild(b);
|
|
645
|
+
}
|
|
646
|
+
l.addEventListener("change", s), n.appendChild(l), p = {
|
|
647
|
+
read: () => l.value.trim(),
|
|
648
|
+
setDisabled: (m) => {
|
|
649
|
+
l.disabled = m;
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
} else if (a.type === "radio") {
|
|
653
|
+
n.classList.add("is-choice-group");
|
|
654
|
+
const l = `${c}-${Math.random().toString(36).slice(2, 8)}`, g = document.createElement("div");
|
|
655
|
+
g.className = "form-choice-group";
|
|
656
|
+
const h = [];
|
|
657
|
+
for (const u of j(a.options)) {
|
|
658
|
+
const m = document.createElement("label");
|
|
659
|
+
m.className = "form-choice";
|
|
660
|
+
const b = document.createElement("input");
|
|
661
|
+
b.type = "radio", b.name = l, b.value = u.value, u.value === o && (b.checked = !0), a.required && (b.required = !0), b.addEventListener("change", s);
|
|
662
|
+
const C = document.createElement("span");
|
|
663
|
+
C.textContent = u.label, m.appendChild(b), m.appendChild(C), g.appendChild(m), h.push(b);
|
|
664
|
+
}
|
|
665
|
+
n.appendChild(g), p = {
|
|
666
|
+
read: () => {
|
|
667
|
+
var u;
|
|
668
|
+
return ((u = h.find((m) => m.checked)) == null ? void 0 : u.value.trim()) ?? "";
|
|
669
|
+
},
|
|
670
|
+
setDisabled: (u) => h.forEach((m) => {
|
|
671
|
+
m.disabled = u;
|
|
672
|
+
})
|
|
673
|
+
};
|
|
674
|
+
} else if (a.type === "checkbox")
|
|
675
|
+
if (n.classList.add("is-choice-group"), a.options && a.options.length) {
|
|
676
|
+
const l = new Set(
|
|
677
|
+
o.split(",").map((u) => u.trim()).filter(Boolean)
|
|
678
|
+
), g = document.createElement("div");
|
|
679
|
+
g.className = "form-choice-group";
|
|
680
|
+
const h = [];
|
|
681
|
+
for (const u of j(a.options)) {
|
|
682
|
+
const m = document.createElement("label");
|
|
683
|
+
m.className = "form-choice";
|
|
684
|
+
const b = document.createElement("input");
|
|
685
|
+
b.type = "checkbox", b.value = u.value, l.has(u.value) && (b.checked = !0), b.addEventListener("change", s);
|
|
686
|
+
const C = document.createElement("span");
|
|
687
|
+
C.textContent = u.label, m.appendChild(b), m.appendChild(C), g.appendChild(m), h.push(b);
|
|
688
|
+
}
|
|
689
|
+
n.appendChild(g), p = {
|
|
690
|
+
read: () => h.filter((u) => u.checked).map((u) => u.value).join(","),
|
|
691
|
+
setDisabled: (u) => h.forEach((m) => {
|
|
692
|
+
m.disabled = u;
|
|
693
|
+
})
|
|
694
|
+
};
|
|
695
|
+
} else {
|
|
696
|
+
const l = document.createElement("input");
|
|
697
|
+
l.type = "checkbox", l.name = c, l.className = "form-checkbox", (o === "true" || o === "1" || o === "on") && (l.checked = !0), a.required && (l.required = !0), l.addEventListener("change", s), n.appendChild(l), n.classList.add("is-inline-bool"), p = {
|
|
698
|
+
read: () => l.checked ? "true" : "",
|
|
699
|
+
setDisabled: (g) => {
|
|
700
|
+
l.disabled = g;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
const l = document.createElement("input");
|
|
706
|
+
l.type = a.type, l.placeholder = a.placeholder ?? "", l.value = o, l.name = c, l.className = "form-input", a.required && (l.required = !0), a.pattern && (l.pattern = a.pattern), a.type === "number" && (a.min !== void 0 && (l.min = String(a.min)), a.max !== void 0 && (l.max = String(a.max))), l.addEventListener("input", s), n.appendChild(l), p = {
|
|
707
|
+
read: () => l.value.trim(),
|
|
708
|
+
setDisabled: (g) => {
|
|
709
|
+
l.disabled = g;
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
if (a.help_text) {
|
|
714
|
+
const l = document.createElement("span");
|
|
715
|
+
l.className = "form-help", l.textContent = a.help_text, n.appendChild(l);
|
|
716
|
+
}
|
|
717
|
+
const v = document.createElement("span");
|
|
718
|
+
v.className = "form-field-error", v.hidden = !0, n.appendChild(v);
|
|
719
|
+
const x = (l) => {
|
|
720
|
+
v.textContent = l, v.hidden = !l, n.classList.toggle("is-invalid", !!l);
|
|
721
|
+
};
|
|
722
|
+
return r = () => x(""), e.formInputs.set(c, { ...p, setError: x }), n;
|
|
723
|
+
}
|
|
724
|
+
function Oe(e, a) {
|
|
725
|
+
const o = new Map(a.map((t) => [t.name, t.message]));
|
|
726
|
+
for (const [t, r] of e.formInputs.entries())
|
|
727
|
+
r.setError(o.get(t) ?? "");
|
|
728
|
+
}
|
|
729
|
+
function Re(e) {
|
|
730
|
+
for (const a of e.formInputs.values()) a.setError("");
|
|
731
|
+
}
|
|
732
|
+
function te(e) {
|
|
733
|
+
const a = {};
|
|
734
|
+
for (const [o, t] of e.formInputs.entries())
|
|
735
|
+
a[o] = t.read();
|
|
736
|
+
return a;
|
|
737
|
+
}
|
|
738
|
+
function V(e, a) {
|
|
739
|
+
e.formSubmitBtn.disabled = a, e.formCancelBtn.disabled = a, e.formBackBtn.disabled = a, e.formStepBackBtn.disabled = a;
|
|
740
|
+
for (const o of e.formInputs.values()) o.setDisabled(a);
|
|
741
|
+
e.formSubmitBtn.classList.toggle("is-busy", a);
|
|
742
|
+
}
|
|
743
|
+
function I(e, a) {
|
|
744
|
+
e.formError.textContent = a, e.formError.hidden = !a;
|
|
745
|
+
}
|
|
746
|
+
function R(e, a) {
|
|
747
|
+
e.formSuccess.textContent = a, e.formSuccess.hidden = !a;
|
|
748
|
+
}
|
|
749
|
+
function me(e, a) {
|
|
750
|
+
e.callStatus.textContent = a;
|
|
751
|
+
}
|
|
752
|
+
function qe(e, a) {
|
|
753
|
+
if (a === null) {
|
|
754
|
+
e.callTimer.hidden = !0, e.callTimer.classList.remove("warning"), e.callTimerText.textContent = "";
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
e.callTimer.hidden = !1;
|
|
758
|
+
const o = Math.max(0, Math.ceil(a / 1e3));
|
|
759
|
+
e.callTimerText.textContent = Ye(o), e.callTimer.classList.toggle("warning", o <= 30);
|
|
760
|
+
}
|
|
761
|
+
function Ye(e) {
|
|
762
|
+
const a = Math.floor(e / 60), o = e % 60;
|
|
763
|
+
return `${a}:${o.toString().padStart(2, "0")}`;
|
|
764
|
+
}
|
|
765
|
+
function Pe(e, a) {
|
|
766
|
+
e.orb.classList.remove("listening", "speaking", "connecting", "thinking"), a !== "idle" && e.orb.classList.add(a);
|
|
767
|
+
const o = e.appearance.labels;
|
|
768
|
+
e.orbLabel.textContent = a === "listening" ? o.listening : a === "speaking" ? o.speaking : a === "connecting" ? o.connecting : a === "thinking" ? o.thinking : o.idle, a !== "thinking" && be(e, null);
|
|
769
|
+
}
|
|
770
|
+
function be(e, a) {
|
|
771
|
+
const o = (a || "").trim();
|
|
772
|
+
if (!o) {
|
|
773
|
+
e.agentStatusLine.hidden = !0, e.agentStatusLine.textContent = "";
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
e.agentStatusLine.textContent = o, e.agentStatusLine.hidden = !1;
|
|
777
|
+
}
|
|
778
|
+
function Ue(e, a) {
|
|
779
|
+
const o = a ? "Unmute" : "Mute", t = a ? Ee : O;
|
|
780
|
+
for (const r of [e.muteBtn, e.formMuteBtn])
|
|
781
|
+
r.classList.toggle("is-active", a), r.setAttribute("aria-label", o), r.innerHTML = t;
|
|
782
|
+
}
|
|
783
|
+
function ae(e, a) {
|
|
784
|
+
e.formCallControls.hidden = !a;
|
|
785
|
+
}
|
|
786
|
+
function oe(e, a) {
|
|
787
|
+
e.audioDrawer.hidden = !a, e.audioDrawer.classList.toggle("is-open", a), e.settingsBtn.classList.toggle("is-active", a), e.settingsBtn.setAttribute("aria-expanded", a ? "true" : "false");
|
|
788
|
+
}
|
|
789
|
+
function ne(e, a) {
|
|
790
|
+
const o = Math.max(0, Math.min(1, a));
|
|
791
|
+
e.audioMeterBar.style.width = `${(o * 100).toFixed(1)}%`;
|
|
792
|
+
}
|
|
793
|
+
function re(e, a, o, t) {
|
|
794
|
+
const r = o || "";
|
|
795
|
+
e.innerHTML = "";
|
|
796
|
+
const s = document.createElement("option");
|
|
797
|
+
s.value = "", s.textContent = t, e.appendChild(s);
|
|
798
|
+
for (const c of a) {
|
|
799
|
+
const n = document.createElement("option");
|
|
800
|
+
n.value = c.deviceId, n.textContent = c.label || `Device ${c.deviceId.slice(0, 6)}`, e.appendChild(n);
|
|
801
|
+
}
|
|
802
|
+
Array.from(e.options).some((c) => c.value === r) ? e.value = r : e.value = "";
|
|
803
|
+
}
|
|
804
|
+
const S = /* @__PURE__ */ new WeakMap(), Ge = 2, Ke = 18;
|
|
805
|
+
function ie(e, a, o, t, r, s, c) {
|
|
806
|
+
const n = `${t}:${r}`;
|
|
807
|
+
let d = a.get(n), p = !d;
|
|
808
|
+
if (!d) {
|
|
809
|
+
const x = o.get(t);
|
|
810
|
+
x ? (d = x, a.set(n, d), p = !1) : (d = document.createElement("div"), d.className = `transcript-msg ${t} interim`, e.appendChild(d), a.set(n, d));
|
|
811
|
+
}
|
|
812
|
+
const v = S.get(d);
|
|
813
|
+
if (v !== void 0 && (window.clearInterval(v), S.delete(d)), p && c && s.length > 3) {
|
|
814
|
+
d.classList.add("interim"), d.classList.remove("final"), d.textContent = "";
|
|
815
|
+
let x = 0;
|
|
816
|
+
const l = () => {
|
|
817
|
+
if (x = Math.min(s.length, x + Ge), d.textContent = s.slice(0, x), e.scrollTop = e.scrollHeight, x >= s.length) {
|
|
818
|
+
const h = S.get(d);
|
|
819
|
+
h !== void 0 && window.clearInterval(h), S.delete(d), t === "agent" ? d.innerHTML = ee(s) : d.textContent = s, d.classList.remove("interim"), d.classList.add("final");
|
|
820
|
+
}
|
|
821
|
+
}, g = window.setInterval(l, Ke);
|
|
822
|
+
S.set(d, g), l(), o.delete(t);
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
t === "agent" ? d.innerHTML = ee(s) : d.textContent = s, d.classList.toggle("interim", !c), d.classList.toggle("final", c), e.scrollTop = e.scrollHeight, c ? o.delete(t) : o.set(t, d);
|
|
826
|
+
}
|
|
827
|
+
function We(e, a, o, t, r) {
|
|
828
|
+
const s = (t || "").trim();
|
|
829
|
+
s && (ie(
|
|
830
|
+
e.transcript,
|
|
831
|
+
e.transcriptSegments,
|
|
832
|
+
e.transcriptInterimBubble,
|
|
833
|
+
a,
|
|
834
|
+
o,
|
|
835
|
+
s,
|
|
836
|
+
r
|
|
837
|
+
), e.formTranscript.hidden || ie(
|
|
838
|
+
e.formTranscript,
|
|
839
|
+
e.formTranscriptSegments,
|
|
840
|
+
e.formTranscriptInterimBubble,
|
|
841
|
+
a,
|
|
842
|
+
o,
|
|
843
|
+
s,
|
|
844
|
+
r
|
|
845
|
+
));
|
|
846
|
+
}
|
|
847
|
+
function q(e, a, o) {
|
|
848
|
+
for (const t of a.values()) {
|
|
849
|
+
const r = S.get(t);
|
|
850
|
+
r !== void 0 && (window.clearInterval(r), S.delete(t));
|
|
851
|
+
}
|
|
852
|
+
e.innerHTML = "", a.clear(), o.clear();
|
|
853
|
+
}
|
|
854
|
+
function Je(e) {
|
|
855
|
+
q(e.transcript, e.transcriptSegments, e.transcriptInterimBubble), q(e.formTranscript, e.formTranscriptSegments, e.formTranscriptInterimBubble);
|
|
856
|
+
}
|
|
857
|
+
function Qe(e, a) {
|
|
858
|
+
const t = `Connecting you with ${(a || "").trim() || "the next agent"}...`;
|
|
859
|
+
for (const r of [e.transcript, e.formTranscript]) {
|
|
860
|
+
if (!r) continue;
|
|
861
|
+
const s = document.createElement("div");
|
|
862
|
+
s.className = "transcript-msg system agent-transition", s.textContent = t, r.appendChild(s), r.scrollTop = r.scrollHeight;
|
|
863
|
+
}
|
|
864
|
+
me(e, t);
|
|
865
|
+
}
|
|
866
|
+
function se(e, a) {
|
|
867
|
+
if (e.formTranscript.hidden = !a, a) {
|
|
868
|
+
q(e.formTranscript, e.formTranscriptSegments, e.formTranscriptInterimBubble);
|
|
869
|
+
for (const [o, t] of e.transcriptSegments) {
|
|
870
|
+
const r = t.cloneNode(!0);
|
|
871
|
+
e.formTranscript.appendChild(r), e.formTranscriptSegments.set(o, r);
|
|
872
|
+
}
|
|
873
|
+
for (const [o, t] of e.transcriptInterimBubble)
|
|
874
|
+
for (const [r, s] of e.transcriptSegments)
|
|
875
|
+
if (s === t) {
|
|
876
|
+
const c = e.formTranscriptSegments.get(r);
|
|
877
|
+
c && e.formTranscriptInterimBubble.set(o, c);
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
880
|
+
e.formTranscript.scrollTop = e.formTranscript.scrollHeight;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
function le(e) {
|
|
884
|
+
const a = M(e);
|
|
885
|
+
if (!a) return "#ffffff";
|
|
886
|
+
const [o, t, r] = a, s = (n) => {
|
|
887
|
+
const d = n / 255;
|
|
888
|
+
return d <= 0.03928 ? d / 12.92 : Math.pow((d + 0.055) / 1.055, 2.4);
|
|
889
|
+
};
|
|
890
|
+
return 0.2126 * s(o) + 0.7152 * s(t) + 0.0722 * s(r) > 0.5 ? "#111111" : "#ffffff";
|
|
891
|
+
}
|
|
892
|
+
function Xe(e) {
|
|
893
|
+
const a = M(e);
|
|
894
|
+
if (!a) return "#f6f7f9";
|
|
895
|
+
const [o, t, r] = a, c = (0.2126 * o + 0.7152 * t + 0.0722 * r) / 255 > 0.5 ? -10 : 18, n = (d) => Math.max(0, Math.min(255, d + c));
|
|
896
|
+
return `rgb(${n(o)}, ${n(t)}, ${n(r)})`;
|
|
897
|
+
}
|
|
898
|
+
function Ze(e, a) {
|
|
899
|
+
const o = M(e), t = M(a);
|
|
900
|
+
if (!o || !t) return "rgba(0,0,0,0.55)";
|
|
901
|
+
const r = (s) => Math.round(o[s] * 0.55 + t[s] * 0.45);
|
|
902
|
+
return `rgb(${r(0)}, ${r(1)}, ${r(2)})`;
|
|
903
|
+
}
|
|
904
|
+
function M(e) {
|
|
905
|
+
const a = e.trim(), o = a.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
|
|
906
|
+
if (o) {
|
|
907
|
+
let r = o[1];
|
|
908
|
+
return r.length === 3 && (r = r.split("").map((s) => s + s).join("")), [
|
|
909
|
+
parseInt(r.slice(0, 2), 16),
|
|
910
|
+
parseInt(r.slice(2, 4), 16),
|
|
911
|
+
parseInt(r.slice(4, 6), 16)
|
|
912
|
+
];
|
|
913
|
+
}
|
|
914
|
+
const t = a.match(/^rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
|
|
915
|
+
return t ? [Number(t[1]), Number(t[2]), Number(t[3])] : null;
|
|
916
|
+
}
|
|
917
|
+
function ce(e) {
|
|
918
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
919
|
+
}
|
|
920
|
+
function nt(e, a = {}) {
|
|
921
|
+
const o = a.target ?? document.body, t = Ie(a.rootId ?? "voice-agent-widget-root", {
|
|
922
|
+
inline: a.inline,
|
|
923
|
+
parent: o,
|
|
924
|
+
closeButtonHide: a.closeButtonHide
|
|
925
|
+
});
|
|
926
|
+
X(t, e.getAppearance()), E(t, "welcome");
|
|
927
|
+
const r = e.getAudioCapabilities(), s = [], c = [];
|
|
928
|
+
let n = !1, d = !1, p = !1, v = null, x = null, l = null;
|
|
929
|
+
const g = (i, f) => {
|
|
930
|
+
const w = window.setInterval(i, f);
|
|
931
|
+
return c.push(w), w;
|
|
932
|
+
}, h = (i) => {
|
|
933
|
+
n = i, t.panel.style.display = i ? "flex" : "none";
|
|
934
|
+
}, u = () => {
|
|
935
|
+
n || h(!0);
|
|
936
|
+
}, m = () => e.isActive() ? "call" : "welcome";
|
|
937
|
+
s.push(
|
|
938
|
+
e.on("appearance", (i) => X(t, i)),
|
|
939
|
+
e.on("state", ({ orb: i, statusLabel: f }) => {
|
|
940
|
+
Pe(t, i), be(t, i === "thinking" ? f : null);
|
|
941
|
+
}),
|
|
942
|
+
e.on("call:status", ({ status: i }) => me(t, i)),
|
|
943
|
+
e.on("call:timer", ({ remainingMs: i }) => qe(t, i)),
|
|
944
|
+
e.on("mute", ({ muted: i }) => Ue(t, i)),
|
|
945
|
+
e.on("controls", ({ canStart: i, canMute: f, canEnd: w }) => {
|
|
946
|
+
t.startBtn.disabled = !i, t.muteBtn.disabled = !f, t.endBtn.disabled = !w;
|
|
947
|
+
}),
|
|
948
|
+
e.on("connection", ({ phase: i }) => {
|
|
949
|
+
i === "connecting" ? d || E(t, "call") : (i === "disconnected" || i === "failed") && (d || E(t, "welcome"));
|
|
950
|
+
}),
|
|
951
|
+
e.on(
|
|
952
|
+
"transcript",
|
|
953
|
+
({ role: i, segmentId: f, text: w, isFinal: F }) => We(t, i, f, w, F)
|
|
954
|
+
),
|
|
955
|
+
e.on("transcript:clear", () => Je(t)),
|
|
956
|
+
e.on(
|
|
957
|
+
"agent:handoff",
|
|
958
|
+
({ agentName: i }) => Qe(t, i)
|
|
959
|
+
),
|
|
960
|
+
e.on(
|
|
961
|
+
"audio",
|
|
962
|
+
(i) => de(t, i, r)
|
|
963
|
+
)
|
|
964
|
+
);
|
|
965
|
+
const b = () => {
|
|
966
|
+
const i = e.getActiveForm();
|
|
967
|
+
i && je(t, {
|
|
968
|
+
definition: i.definition,
|
|
969
|
+
values: i.values,
|
|
970
|
+
stepIndex: i.stepIndex,
|
|
971
|
+
cancelLabel: e.isActive() ? "Back to call" : "Cancel",
|
|
972
|
+
onFieldChange: () => e.updateFormValues(te(t))
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
s.push(
|
|
976
|
+
e.on("form:show", ({ inCall: i, transcriptionEnabled: f }) => {
|
|
977
|
+
d = !0, u(), E(t, "form"), ae(t, i), se(t, i && f), b();
|
|
978
|
+
}),
|
|
979
|
+
e.on("form:update", () => b()),
|
|
980
|
+
e.on("form:validation", ({ errors: i }) => {
|
|
981
|
+
I(t, ""), Oe(t, i);
|
|
982
|
+
}),
|
|
983
|
+
e.on("form:submitting", () => {
|
|
984
|
+
I(t, ""), R(t, ""), Re(t), V(t, !0);
|
|
985
|
+
}),
|
|
986
|
+
e.on("form:submitted", ({ successMessage: i }) => {
|
|
987
|
+
R(t, i), V(t, !1);
|
|
988
|
+
}),
|
|
989
|
+
e.on("form:error", ({ message: i }) => {
|
|
990
|
+
I(t, i), V(t, !1);
|
|
991
|
+
}),
|
|
992
|
+
e.on("form:close", () => {
|
|
993
|
+
d = !1, ae(t, !1), se(t, !1), E(t, m());
|
|
994
|
+
})
|
|
995
|
+
);
|
|
996
|
+
const C = () => e.updateFormValues(te(t));
|
|
997
|
+
t.formBackBtn.addEventListener("click", () => e.closeForm()), t.formCancelBtn.addEventListener("click", () => e.closeForm()), t.formStepBackBtn.addEventListener("click", () => {
|
|
998
|
+
C(), e.stepForm("back");
|
|
999
|
+
}), t.formSubmitBtn.addEventListener("click", () => {
|
|
1000
|
+
C(), e.submitForm();
|
|
1001
|
+
});
|
|
1002
|
+
const xe = async () => {
|
|
1003
|
+
try {
|
|
1004
|
+
const { inputs: i, outputs: f } = await e.enumerateAudioDevices(), w = e.getAudioState();
|
|
1005
|
+
re(
|
|
1006
|
+
t.audioMicSelect,
|
|
1007
|
+
i,
|
|
1008
|
+
w.prefs.micDeviceId,
|
|
1009
|
+
"System default"
|
|
1010
|
+
), re(
|
|
1011
|
+
t.audioSpeakerSelect,
|
|
1012
|
+
f,
|
|
1013
|
+
w.prefs.speakerDeviceId,
|
|
1014
|
+
"System default"
|
|
1015
|
+
);
|
|
1016
|
+
} catch (i) {
|
|
1017
|
+
console.warn("[voice-agent] device enumeration failed:", i);
|
|
1018
|
+
}
|
|
1019
|
+
}, $ = () => {
|
|
1020
|
+
l !== null && (cancelAnimationFrame(l), l = null), x && (x.close().catch(() => {
|
|
1021
|
+
}), x = null), ne(t, 0);
|
|
1022
|
+
}, Y = async () => {
|
|
1023
|
+
if ($(), !!e.isActive())
|
|
1024
|
+
try {
|
|
1025
|
+
const i = e.getAudioState(), f = await navigator.mediaDevices.getUserMedia({
|
|
1026
|
+
audio: i.prefs.micDeviceId ? { deviceId: { exact: i.prefs.micDeviceId } } : !0,
|
|
1027
|
+
video: !1
|
|
1028
|
+
}), w = new (window.AudioContext || window.webkitAudioContext)();
|
|
1029
|
+
x = w;
|
|
1030
|
+
const F = w.createMediaStreamSource(f), B = w.createAnalyser();
|
|
1031
|
+
B.fftSize = 1024, F.connect(B);
|
|
1032
|
+
const T = new Float32Array(B.fftSize), U = () => {
|
|
1033
|
+
if (!x) return;
|
|
1034
|
+
B.getFloatTimeDomainData(T);
|
|
1035
|
+
let G = 0;
|
|
1036
|
+
for (let z = 0; z < T.length; z++) G += T[z] * T[z];
|
|
1037
|
+
const he = Math.sqrt(G / T.length), ye = 20 * Math.log10(Math.max(he, 1e-6)), we = Math.max(0, Math.min(1, (ye + 50) / 50));
|
|
1038
|
+
ne(t, we), l = requestAnimationFrame(U);
|
|
1039
|
+
};
|
|
1040
|
+
l = requestAnimationFrame(U);
|
|
1041
|
+
} catch (i) {
|
|
1042
|
+
console.warn("[voice-agent] mic-level meter unavailable:", i);
|
|
1043
|
+
}
|
|
1044
|
+
}, N = () => {
|
|
1045
|
+
v !== null && (window.clearInterval(v), v = null);
|
|
1046
|
+
}, fe = () => {
|
|
1047
|
+
N();
|
|
1048
|
+
const i = async () => {
|
|
1049
|
+
const f = await e.getAudioStats();
|
|
1050
|
+
if (!f) {
|
|
1051
|
+
t.audioDiagLoss.textContent = "—", t.audioDiagJitter.textContent = "—", t.audioDiagRtt.textContent = "—";
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
t.audioDiagLoss.textContent = String(f.packetsLost), t.audioDiagJitter.textContent = `${f.jitter.toFixed(1)} ms`, t.audioDiagRtt.textContent = f.roundTripTime ? `${f.roundTripTime.toFixed(0)} ms` : "—";
|
|
1055
|
+
};
|
|
1056
|
+
i(), v = g(() => void i(), 2e3);
|
|
1057
|
+
}, ve = async () => {
|
|
1058
|
+
p = !0, oe(t, !0), de(t, e.getAudioState(), r), await xe(), await Y(), fe();
|
|
1059
|
+
}, D = () => {
|
|
1060
|
+
p = !1, oe(t, !1), $(), N();
|
|
1061
|
+
};
|
|
1062
|
+
g(() => {
|
|
1063
|
+
p && !e.isActive() && D();
|
|
1064
|
+
}, 1e3), t.fab.addEventListener("click", () => {
|
|
1065
|
+
n || e.trackEvent("bubble_clicked"), h(!n);
|
|
1066
|
+
}), t.closeBtn.addEventListener("click", () => {
|
|
1067
|
+
e.isActive() && e.end(), e.closeForm(), h(!1);
|
|
1068
|
+
}), (a.openChat || a.inline) && u(), t.startBtn.addEventListener("click", () => {
|
|
1069
|
+
const i = t.appearance.terms_url;
|
|
1070
|
+
i && ke(e.agentSlug || "default", i), e.start();
|
|
1071
|
+
}), t.endBtn.addEventListener("click", () => void e.end()), t.muteBtn.addEventListener("click", () => void e.toggleMute()), t.formMuteBtn.addEventListener("click", () => void e.toggleMute()), t.formEndBtn.addEventListener("click", () => {
|
|
1072
|
+
e.closeForm(), e.end();
|
|
1073
|
+
}), t.settingsBtn.addEventListener("click", () => {
|
|
1074
|
+
e.isActive() && (p ? D() : ve());
|
|
1075
|
+
}), t.audioDrawerClose.addEventListener("click", D), t.audioMicSelect.addEventListener("change", () => {
|
|
1076
|
+
e.updateAudioSettings({ micDeviceId: t.audioMicSelect.value }), Y();
|
|
1077
|
+
}), t.audioSpeakerSelect.addEventListener("change", () => {
|
|
1078
|
+
e.updateAudioSettings({
|
|
1079
|
+
speakerDeviceId: t.audioSpeakerSelect.value
|
|
1080
|
+
});
|
|
1081
|
+
}), t.audioVolume.addEventListener("input", () => {
|
|
1082
|
+
const i = Number(t.audioVolume.value);
|
|
1083
|
+
t.audioVolumeValue.textContent = `${i}%`, e.updateAudioSettings({ outputVolume: i });
|
|
1084
|
+
}), t.audioNcEngine.addEventListener("change", () => {
|
|
1085
|
+
const i = t.audioNcEngine.value;
|
|
1086
|
+
e.updateAudioSettings({ noiseFilter: i }), t.audioDfStrengthRow.hidden = i !== "deepfilter";
|
|
1087
|
+
}), t.audioDfStrength.addEventListener("input", () => {
|
|
1088
|
+
const i = Number(t.audioDfStrength.value);
|
|
1089
|
+
t.audioDfStrengthValue.textContent = String(i), e.updateAudioSettings({ deepFilterStrength: i });
|
|
1090
|
+
}), t.audioTogAec.addEventListener(
|
|
1091
|
+
"change",
|
|
1092
|
+
() => void e.updateAudioSettings({ echoCancellation: t.audioTogAec.checked })
|
|
1093
|
+
), t.audioTogNs.addEventListener(
|
|
1094
|
+
"change",
|
|
1095
|
+
() => void e.updateAudioSettings({ noiseSuppression: t.audioTogNs.checked })
|
|
1096
|
+
), t.audioTogAgc.addEventListener(
|
|
1097
|
+
"change",
|
|
1098
|
+
() => void e.updateAudioSettings({ autoGainControl: t.audioTogAgc.checked })
|
|
1099
|
+
), t.audioTogVi.addEventListener(
|
|
1100
|
+
"change",
|
|
1101
|
+
() => void e.updateAudioSettings({ voiceIsolation: t.audioTogVi.checked })
|
|
1102
|
+
), t.audioTogHp.addEventListener(
|
|
1103
|
+
"change",
|
|
1104
|
+
() => void e.updateAudioSettings({ headphonesMode: t.audioTogHp.checked })
|
|
1105
|
+
), t.audioTogTranscription.addEventListener(
|
|
1106
|
+
"change",
|
|
1107
|
+
() => void e.updateAudioSettings({
|
|
1108
|
+
transcriptionEnabled: t.audioTogTranscription.checked
|
|
1109
|
+
})
|
|
1110
|
+
), t.audioTogTextInput.addEventListener(
|
|
1111
|
+
"change",
|
|
1112
|
+
() => void e.updateAudioSettings({
|
|
1113
|
+
textInputEnabled: t.audioTogTextInput.checked
|
|
1114
|
+
})
|
|
1115
|
+
), g(() => {
|
|
1116
|
+
const i = e.isActive();
|
|
1117
|
+
t.settingsBtn.hidden = !i || !t.appearance.show_audio_settings;
|
|
1118
|
+
const f = i && e.getAudioState().prefs.textInputEnabled;
|
|
1119
|
+
t.textInputRow.hidden = !f, t.textSendBtn.disabled = !f;
|
|
1120
|
+
}, 500), t.textInput.addEventListener("input", () => {
|
|
1121
|
+
t.textInput.style.height = "auto", t.textInput.style.height = `${t.textInput.scrollHeight}px`;
|
|
1122
|
+
});
|
|
1123
|
+
const P = () => {
|
|
1124
|
+
const i = t.textInput.value.trim();
|
|
1125
|
+
!i || !e.isActive() || (t.textInput.value = "", t.textInput.style.height = "auto", e.sendText(i));
|
|
1126
|
+
};
|
|
1127
|
+
return t.textSendBtn.addEventListener("click", P), t.textInput.addEventListener("keydown", (i) => {
|
|
1128
|
+
i.key === "Enter" && !i.shiftKey && (i.preventDefault(), P());
|
|
1129
|
+
}), { destroy: () => {
|
|
1130
|
+
for (const i of s.splice(0))
|
|
1131
|
+
try {
|
|
1132
|
+
i();
|
|
1133
|
+
} catch {
|
|
1134
|
+
}
|
|
1135
|
+
for (const i of c.splice(0)) window.clearInterval(i);
|
|
1136
|
+
$(), N(), t.host.remove();
|
|
1137
|
+
}, refs: t };
|
|
1138
|
+
}
|
|
1139
|
+
function de(e, a, o) {
|
|
1140
|
+
const { prefs: t, applied: r, noiseFilter: s } = a;
|
|
1141
|
+
e.audioNcEngine.value = t.noiseFilter, e.audioDfStrength.value = String(t.deepFilterStrength), e.audioDfStrengthValue.textContent = String(t.deepFilterStrength), e.audioDfStrengthRow.hidden = t.noiseFilter !== "deepfilter", e.audioTogAec.checked = t.echoCancellation, e.audioTogNs.checked = t.noiseSuppression, e.audioTogAgc.checked = t.autoGainControl, e.audioTogVi.checked = t.voiceIsolation, e.audioTogHp.checked = t.headphonesMode, e.audioTogTranscription.checked = t.transcriptionEnabled, e.audioTogTextInput.checked = t.textInputEnabled, e.transcript.style.display = t.transcriptionEnabled ? "flex" : "none", t.transcriptionEnabled ? e.panel.classList.add("with-transcript") : e.panel.classList.remove("with-transcript"), e.audioVolume.value = String(t.outputVolume), e.audioVolumeValue.textContent = `${t.outputVolume}%`, e.audioTogViRow.style.display = o.voiceIsolationSupported ? "" : "none", e.audioSpeakerRow.style.display = o.setSinkIdSupported ? "" : "none", e.audioDiagEngine.textContent = et(s), e.audioDiagAec.textContent = H(r.echoCancellation), e.audioDiagNs.textContent = H(r.noiseSuppression), e.audioDiagAgc.textContent = H(r.autoGainControl), e.audioDiagVi.textContent = r.voiceIsolation === void 0 ? "Unsupported" : r.voiceIsolation ? "On" : "Off", e.audioDiagSr.textContent = r.sampleRate !== void 0 ? `${r.sampleRate} Hz` : "—";
|
|
1142
|
+
}
|
|
1143
|
+
function H(e) {
|
|
1144
|
+
return e === void 0 ? "—" : e ? "On" : "Off";
|
|
1145
|
+
}
|
|
1146
|
+
function et(e) {
|
|
1147
|
+
const a = e.engine === "krisp" ? "Krisp" : e.engine === "deepfilter" ? "DeepFilterNet3" : "Off";
|
|
1148
|
+
return e.engine === "off" ? "Off" : e.status === "active" ? `${a} (active)` : e.status === "unsupported" ? `${a} (unsupported)` : e.status === "failed" ? `${a} (failed)` : a;
|
|
1149
|
+
}
|
|
1150
|
+
export {
|
|
1151
|
+
nt as mountVoiceUI
|
|
1152
|
+
};
|
|
1153
|
+
//# sourceMappingURL=ui.js.map
|