@aiden-voice/widget 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/controller.d.ts +4 -0
- package/dist/i18n/messages.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/widget.iife.js +7 -7
- package/dist/widget.js +285 -263
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -195,7 +195,7 @@ The widget's own text (buttons, labels, status and error messages, and what scre
|
|
|
195
195
|
- **The widget marks its own language** (`lang` and `dir` on its root, naming the variant it ships: `pt-BR`, `es-419`, `zh-Hans`), so screen readers pronounce it correctly even on a page in another language.
|
|
196
196
|
- **Upgrading from a version before 0.8.0:** a page whose `<html lang>` is one of these languages now gets the widget in that language, where it was English before. Pass `language: 'en'` to keep it in English; replies and your own text keep your page's language for screen readers either way.
|
|
197
197
|
|
|
198
|
-
**Changing the wording.** `messages` replaces any built-in string in the active language. Write overrides in that language, or set `language` to the language of your overrides. `chatWith`
|
|
198
|
+
**Changing the wording.** `messages` replaces any built-in string in the active language. Write overrides in that language, or set `language` to the language of your overrides. `chatWith` and `messageSent` take `{name}`, the agent's name. Unknown keys, and values that aren't non-blank strings (invisible characters such as a zero-width space count as blank), are ignored with a console warning. Overrides are marked with the widget's language: an override in another language (an English brand phrase in a French widget) is read with the widget's voice.
|
|
199
199
|
|
|
200
200
|
```js
|
|
201
201
|
window.whooAidenWidget.init({
|
|
@@ -216,6 +216,7 @@ window.whooAidenWidget.init({
|
|
|
216
216
|
| `message` | Message | message box label |
|
|
217
217
|
| `messagePlaceholder` | Type a message… | message box placeholder (a hint; `message` stays its label) |
|
|
218
218
|
| `send` | Send | composer button |
|
|
219
|
+
| `messageSent` | Message sent. {name} is preparing a response. | screen-reader announcement when a message is sent; `{name}` is the agent's name |
|
|
219
220
|
| `lookingItUp` | Looking that up for you… | slow-reply notice |
|
|
220
221
|
| `goodResponse` | Good response | thumbs-up name |
|
|
221
222
|
| `badResponse` | Bad response | thumbs-down name |
|
|
@@ -231,7 +232,7 @@ window.whooAidenWidget.init({
|
|
|
231
232
|
| `cancel` | Cancel | feedback form button |
|
|
232
233
|
| `feedbackThanks` | Thanks for the feedback | feedback status |
|
|
233
234
|
| `feedbackFailed` | Couldn't send feedback | feedback status |
|
|
234
|
-
| `conversationCleared` |
|
|
235
|
+
| `conversationCleared` | New conversation started. Previous messages were cleared. | screen-reader announcement after New conversation |
|
|
235
236
|
| `genericError` | Something went wrong, please try again. | error alert |
|
|
236
237
|
| `sessionExpired` | This chat session has expired. Reload the page to continue. | error alert |
|
|
237
238
|
| `opensInNewTab` | (opens in new tab) | screen readers only, after each link in a reply: every link in a reply opens in a new tab |
|
package/dist/controller.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { SupportedLanguage } from './i18n';
|
|
|
3
3
|
import { WidgetMessages } from './i18n/messages';
|
|
4
4
|
import { GreetingStyle, NoticePlacement, WidgetConfig } from './types';
|
|
5
5
|
export declare const SLOW_RESPONSE_DELAY_MS = 8000;
|
|
6
|
+
export declare const ANNOUNCEMENT_DELAY_MS = 250;
|
|
6
7
|
export declare const BRANDING_LOOKUP_WAIT_MS = 3000;
|
|
7
8
|
export declare const TOKEN_RENEWAL_MARGIN_MS = 60000;
|
|
8
9
|
export declare const RENEWAL_TIMEOUT_MS = 15000;
|
|
@@ -51,6 +52,7 @@ export declare class WidgetController {
|
|
|
51
52
|
private readonly storageIdentifier;
|
|
52
53
|
private activeRequestController;
|
|
53
54
|
private slowResponseTimer;
|
|
55
|
+
private announcementTimer;
|
|
54
56
|
private readonly prefersReducedMotion;
|
|
55
57
|
readonly launcher: NormalizedTheme['launcher'];
|
|
56
58
|
readonly launcherIconUrl: string | undefined;
|
|
@@ -70,6 +72,8 @@ export declare class WidgetController {
|
|
|
70
72
|
constructor(config: WidgetConfig);
|
|
71
73
|
getState(): WidgetState;
|
|
72
74
|
subscribe(listener: Listener): () => void;
|
|
75
|
+
get resolvedAgentName(): string;
|
|
76
|
+
private announce;
|
|
73
77
|
private clearSlowResponse;
|
|
74
78
|
private setState;
|
|
75
79
|
init(): Promise<void>;
|
package/dist/i18n/messages.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const WIDGET_VERSION = "0.10.
|
|
1
|
+
export declare const WIDGET_VERSION = "0.10.1";
|
package/dist/widget.iife.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var whooAidenWidget=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={openChat:`Open chat`,closeChat:`Close chat`,chatWith:`Chat with {name}`,newConversation:`New conversation`,conversation:`Conversation`,you:`You`,message:`Message`,messagePlaceholder:`Type a message…`,send:`Send`,lookingItUp:`Looking that up for you…`,goodResponse:`Good response`,badResponse:`Bad response`,additionalFeedback:`Additional feedback`,feedbackPlaceholder:`What was wrong? (optional)`,feedbackCategory:`Feedback category`,selectReason:`Select a reason (optional)`,categoryFactual:`Factual error`,categoryIncomplete:`Incomplete`,categoryTone:`Off tone`,categoryOther:`Other`,submit:`Submit`,cancel:`Cancel`,feedbackThanks:`Thanks for the feedback`,feedbackFailed:`Couldn't send feedback`,conversationCleared:`Conversation cleared`,genericError:`Something went wrong, please try again.`,sessionExpired:`This chat session has expired. Reload the page to continue.`,opensInNewTab:`(opens in new tab)`,agreeToNotice:`I agree`},n=Object.keys(t);function r(e,t){if(e!=null&&e!==``){if(typeof e==`string`)try{let t=new URL(e);if(t.protocol===`https:`||t.protocol===`data:`&&t.pathname.toLowerCase().startsWith(`image/`))return e}catch{}console.warn(`whoo-aiden-widget: ignoring \`${t}\` -- only https: and data:image/ URLs are allowed.`)}}var i=[`primary`,`onPrimary`,`primaryText`,`ink`,`link`,`text`,`panel`,`border`,`headerHover`,`assistantBubble`,`muted`,`typingDots`,`errorBackground`,`errorText`,`inputBorder`,`focusRing`],a={primary:`#4f46e5`,onPrimary:`#ffffff`,primaryText:`#4f46e5`,ink:`#111111`,link:`#0000ee`,text:`#111111`,panel:`#ffffff`,border:`#e5e5e5`,headerHover:`#f3f4f6`,assistantBubble:`#f0f0f0`,muted:`#4b5563`,typingDots:`#6b7280`,errorBackground:`#fee2e2`,errorText:`#991b1b`,inputBorder:`#6b7280`,focusRing:`#111827`},o={primary:`--whoo-widget-color`,onPrimary:`--whoo-widget-text-on-color`,primaryText:`--whoo-widget-color-text`,ink:`--whoo-widget-ink`,link:`--whoo-widget-link-color`,text:`--whoo-widget-text`,panel:`--whoo-widget-panel`,border:`--whoo-widget-border`,headerHover:`--whoo-widget-header-hover`,assistantBubble:`--whoo-widget-assistant-bubble`,muted:`--whoo-widget-muted`,typingDots:`--whoo-widget-typing-dots`,errorBackground:`--whoo-widget-error-bg`,errorText:`--whoo-widget-error-text`,inputBorder:`--whoo-widget-input-border`,focusRing:`--whoo-widget-focus-ring`},s=2147483e3,c=2147483647;function l(e){return e===void 0?s:Number.isInteger(e)&&Math.abs(e)<=c?e:(console.warn(`whoo-aiden-widget: ignoring zIndex ${String(e)} (expected an integer between -${c} and ${c}); using ${s}.`),s)}var u=`Aiden`;function d(e){return typeof e==`string`?e.trim():``}function f(e){return/^[\p{White_Space}\p{Cf}\p{M}]*$/u.test(e)}function p(e){if((typeof e.publishableKey==`string`&&e.publishableKey.length>0)==(typeof e.sessionToken==`string`&&e.sessionToken.length>0))throw Error("whoo-aiden-widget: init() requires exactly one of `publishableKey` or `sessionToken`, not both or neither.")}function m(e){console.warn(`whoo-aiden-widget: ${e}`)}function h(e){let{getSessionToken:t}=e;if(t!==void 0){if(typeof t!=`function`)m("ignoring `getSessionToken` -- expected a function that returns a session token.");else if(!e.sessionToken)m("ignoring `getSessionToken` -- it is only used with `sessionToken`; with `publishableKey` the widget renews its session by itself.");else return t}}var g=20;function _(e){let t=new WeakSet,n=new Set;return r=>{if(typeof r==`object`&&r||typeof r==`function`){if(t.has(r))return;t.add(r)}else{if(n.has(r))return;n.size>=g&&n.delete(n.values().next().value),n.add(r)}m(e)}}var v=_("ignoring `theme` -- expected an object."),y=_("ignoring `layout` -- expected an object."),b=_("ignoring `messages` -- expected an object.");function x(e){if(e==null)return{};if(!S(e))return b(e),{};let t={};for(let r of Object.keys(e)){if(!n.includes(r)){m(`ignoring unknown option \`messages.${r}\`.`);continue}let i=e[r];typeof i!=`string`||f(i)?m(`ignoring \`messages.${r}\` -- expected a non-blank string.`):(r===`chatWith`&&!i.includes(`{name}`)&&m("`messages.chatWith` has no {name}, so the agent name is not shown in the title. For a fixed title, use the `title` option."),t[r]=i)}for(let t in e)Object.hasOwn(e,t)||m(`ignoring inherited option \`messages.${t}\` -- only the object's own keys are used.`);return t}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var C=e=>e==null||e===``;function w(e,t,n){let r=e[t];return r==null?null:S(r)?r:(m(`ignoring \`${n}\` -- expected an object.`),null)}function T(e,t,n){for(let r of Object.keys(e))t.includes(r)||m(`ignoring unknown option \`${n}.${r}\`.`)}function E(e,t,n){if(!C(e)){if(typeof e==`string`&&t.includes(e))return e;m(`ignoring \`${n}\` -- expected one of ${t.join(`, `)}.`)}}var D=[`bubble`,`centered`],O=[`top`,`footer`];function k(e){return E(e,D,`greetingStyle`)??`bubble`}function A(e){return E(e,O,`noticePlacement`)??`top`}var ee=200,te=/url\(|[@;{}\\]/i;function ne(e){if(!C(e)){if(typeof e==`string`){let t=e.trim();if(t&&t.length<=ee&&!te.test(t))return t}m(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${ee} characters, without url(), @, ;, {, } or \\.`)}}var re=[`chat`,`message`,`sparkle`],ie=[`chevron-down`,`close`],ae=new WeakMap;function oe(e){let t={colors:{},fontFamily:void 0,launcher:{}};if(e==null)return t;if(!S(e))return v(e),t;let n=ae.get(e);if(n)return n;T(e,[`colors`,`fonts`,`launcher`],`theme`);let a=w(e,`colors`,`theme.colors`);if(a){T(a,i,`theme.colors`);for(let e of i){let n=a[e];C(n)||(typeof n==`string`?t.colors[e]=n:m(`ignoring \`theme.colors.${e}\` -- expected a CSS color string.`))}}let o=w(e,`fonts`,`theme.fonts`);o&&(T(o,[`family`],`theme.fonts`),t.fontFamily=ne(o.family));let s=w(e,`launcher`,`theme.launcher`);if(s){T(s,[`icon`,`iconUrl`,`openIcon`,`openIconUrl`],`theme.launcher`);let e=E(s.icon,re,`theme.launcher.icon`),n=r(s.iconUrl,`theme.launcher.iconUrl`),i=E(s.openIcon,ie,`theme.launcher.openIcon`),a=r(s.openIconUrl,`theme.launcher.openIconUrl`);e&&(t.launcher.icon=e),n&&(t.launcher.iconUrl=n),i&&(t.launcher.openIcon=i),a&&(t.launcher.openIconUrl=a)}return ae.set(e,t),t}var j={offsetX:20,offsetY:20,launcherSize:56,panelWidth:360,panelHeight:480};function M(e,t,n){return e==null?n:typeof e==`number`&&Number.isFinite(e)&&e>=0?e:(m(`ignoring \`${t}\` -- expected a non-negative number of pixels; using ${n}.`),n)}function se(e,t,n,r){let i=Math.min(r,Math.max(n,e));return i!==e&&m(`\`${t}\` ${e} is out of range (${r===1/0?`at least ${n}`:`${n}-${r}`}); using ${i}.`),i}var ce=new WeakMap;function le(e){let t={...j};if(e==null)return t;if(!S(e))return y(e),t;let n=ce.get(e);if(n)return n;T(e,[`offset`,`launcherSize`,`panel`,`cornerRadius`],`layout`);let r=w(e,`offset`,`layout.offset`);r&&(T(r,[`x`,`y`],`layout.offset`),t.offsetX=M(r.x,`layout.offset.x`,j.offsetX),t.offsetY=M(r.y,`layout.offset.y`,j.offsetY)),t.launcherSize=se(M(e.launcherSize,`layout.launcherSize`,j.launcherSize),`layout.launcherSize`,24,120);let i=w(e,`panel`,`layout.panel`);i&&(T(i,[`width`,`height`],`layout.panel`),t.panelWidth=se(M(i.width,`layout.panel.width`,j.panelWidth),`layout.panel.width`,280,1/0),t.panelHeight=se(M(i.height,`layout.panel.height`,j.panelHeight),`layout.panel.height`,320,1/0));let a=e.cornerRadius;return typeof a==`number`&&Number.isFinite(a)&&a>=0?t.cornerRadius=se(a,`layout.cornerRadius`,0,32):C(a)||m("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."),ce.set(e,t),t}var N,ue,P,de,fe,pe,me,he,ge,_e,ve={},ye=[],be=/^m(i|n|o|s|text|space)$/,xe=Array.isArray,Se=ye.slice,F=Object.assign;function Ce(e){e&&e.parentNode&&e.remove()}function we(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i||++ue,__i:-1,__u:0};return!i&&N.vnode&&N.vnode(a),a}function I(e){return e.children}function Te(e,t){this.props=e,this.context=t,this.__g=0}function L(e,t){if(t==null)return e.__?L(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:L(e)}function Ee(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Ee(e)}function De(e){(8&e.__g||!(e.__g|=8)||!P.push(e)||fe++)&&de==N.debounceRendering||((de=N.debounceRendering)||queueMicrotask)(Oe)}function Oe(){var e,t,n,r,i,a,o,s,c;try{for(t=1;P.length;)P.length>t&&P.sort(pe),e=P.shift(),t=P.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=F({constructor:void 0},i)).__v=i.__v+1,N.vnode&&N.vnode(r),Ie(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||L(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,Re(o,r,s),i.__=i.__e=null,r.__e!=a&&Ee(r)))}finally{P.length=fe=0}}function ke(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r.__k||ye,v=t.length;for(c=Ae(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=~p.__i&&_[p.__i]||ve,p.__i=d,g=Ie(e,p,f,i,a,o,s,c,l,u),m=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&Be(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||m,p)),h||=m,4&p.__u?(c=je(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Ae(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,v=!1,y=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=y[a]=we(null,o):xe(o)?o=y[a]=we(I,{children:o}):o.constructor===void 0&&o.__b?o=y[a]=we(o.type,o.props,o.key,o.ref,o.__v):y[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=Me(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,v=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):y[a]=null;if(v){for(u=[],d=[],a=0;a<i;a++)if((o=y[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:y[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=L(s)),Ve(s,s));return r}function je(e,t,n,r){var i,a,o;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=je(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=L(e))&&!t.parentNode&&(t=null),o=t;o&&o.nodeType==8;)o=o.nextSibling;for(e.__e!=o&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function Me(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Ne(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function Pe(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Ne(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||={})[t]=n,n&&r||(o=_e[t]||(_e[t]=Fe(t)),(e.__a||={})[t]=ge,a=t!=(t=t.replace(he,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Fe(e){return function(t){if(this.__e){var n=this.__e[e];if(t[me]==null)t[me]=ge++;else if(t[me]<this.__a[e])return;return n(N.event?N.event(t):t)}}}function Ie(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A=t.type;if(t.constructor!==void 0)return null;if(128&n.__u&&(c=32&n.__u,u=n.__c.__z)){if(t.__u|=c,d=a=[],u.nodeType==8)for(f=1,p=u.nextSibling;p;p=p.nextSibling){if(p.nodeType==8){if(p.data.startsWith(`$s`))f++;else if(p.data.startsWith(`/$s`)&&!--f)break}a.push(p)}else a.push(u);s=a[0]}(u=N.__b)&&u(t);n:if(typeof A==`function`){m=o.length;try{if(y=t.props,b=(u=A.prototype)&&u.render,x=(u=A.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(b?t.__c=h=new A(y,S):(t.__c=h=new Te(y,S),h.constructor=A,h.render=He),x&&x.sub(h),h.state||(h.state={}),h.__n=r,h.__g|=8,h.__h=[],h.__k=[]),b&&(h.__s||(h.__s=h.state),A.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=F({},h.__s)),F(h.__s,A.getDerivedStateFromProps(y,h.__s)))),g=h.props,_=h.state,h.__v=t,n.__c){if(b&&!A.getDerivedStateFromProps&&y!==g&&h.componentWillReceiveProps&&h.componentWillReceiveProps(y,S),t.__v==n.__v&&!(8&h.__g)||!(4&h.__g)&&h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,S)){t.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ye.push.apply(h.__h,h.__k),h.__k=[],h.__h.length&&o.push(h),s=L(n);break n}h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,S),b&&h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,_,v)})}else b&&!A.getDerivedStateFromProps&&h.componentWillMount&&h.componentWillMount(),b&&h.componentDidMount&&h.__h.push(h.componentDidMount);if(h.context=S,h.props=y,h.__P=e,h.__g&=-5,C=N.__r,w=0,b)h.state=h.__s,h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),ye.push.apply(h.__h,h.__k),h.__k=[];else do h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),h.state=h.__s;while(8&h.__g&&++w<25);h.state=h.__s,h.getChildContext&&(r=F({},r,h.getChildContext())),b&&n.__c&&h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(g,_)),T=u&&u.type===I&&u.key==null?u.props.children:u,y.__P&&(u=s,i=(e=y.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Ve(e,e)}),n.__k=null),s=n.__k?L(n,0):null),s=ke(e,xe(T)?T:[T],t,n,r,i,a,o,s,c,l),y.__P&&(t.__e=null,s=u),t.__u&=-161,128&n.__u&&(h.__z=null),d&&d.some(Ce),h.__h.length&&o.push(h),1&h.__g&&(h.__g&=-4)}catch(e){if(o.length=m,t.__v=null,c||a){if(e.then){if(E=0,t.__u|=c?160:128,a){for(~(O=a.indexOf(s||void 0))||(O=a.length);(k=a[O-1])&&k.nodeType==8;)O--;for(;O<a.length;O++)if(k=a[O]){if(a[O]=null,k.nodeType==8){if(k.data.startsWith(`$s`))E++||(D=k);else if(E&&k.data.startsWith(`/$s`)&&!--E){s=k;break}}else if(!E)break}}if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;D=s}t.__c.__z||(t.__c.__z=D),t.__e=s}else a&&a.some(Ce)}else t.__e=n.__e;t.__k||=n.__k||[],e.then||Le(t),N.__e(e,t,n)}}else s=t.__e=ze(n.__e,t,n,r,i,a,o,c,l,e);return(u=N.diffed)&&u(t),128&t.__u?void 0:s}function Le(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Le))}function Re(e,t,n){for(var r=0;r<n.length;)Be(n[r++],n[r++],n[r++]);N.__c&&N.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){N.__e(e,t.__v)}})}function ze(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=n.props||ve,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a){for(u=0;u<a.length;u++)if((m=a[u])&&(x?m.localName==x:m.nodeType==3)){e=m,a[u]=null;break}}if(!e){if(_=l.ownerDocument||document,!x)return _.createTextNode(b);e=_.createElementNS(i,x,b.is&&b),s&&=(N.__m&&N.__m(t,a),!1),a=null}if(x){if(l=x==`template`?e.content:e,a=x==`textarea`&&b.defaultValue!=null?null:a&&Se.call(l.childNodes),!s&&a)for(y={},u=0;u<e.attributes.length;u++)y[(m=e.attributes[u]).name]=m.value;for(u in y)m=y[u],u==`dangerouslySetInnerHTML`?f=m:u==`children`||u in b||u==`value`&&`defaultValue`in b||u==`checked`&&`defaultChecked`in b||Pe(e,u,null,m,i);for(u in v=1&n.__u,b)m=b[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||!(y[u]!==m||v&&m!=null)||Pe(e,u,m,y[u],i);d?(s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(f&&(e.textContent=``),(x==`foreignObject`||i==`http://www.w3.org/1998/Math/MathML`&&be.test(x))&&(i=`http://www.w3.org/1999/xhtml`),ke(l,xe(p)?p:[p],t,n,r,i,a,o,a?a[0]:n.__k&&L(n,0),s,c),a&&a.some(Ce)),s&&x!=`textarea`||(u=`value`,x==`progress`&&h==null?e.removeAttribute(u):h==null||h===e[u]&&(x!=`progress`||h)||Pe(e,u,h,y[u],i),u=`checked`,g!=null&&g!=e[u]&&Pe(e,u,g,y[u],i))}else y===b||s&&e.data==b||(e.data=b);return e}function Be(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:(r&&=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){N.__e(e,n)}}function Ve(e,t,n){var r,i;if(N.unmount&&N.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Be(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){N.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ve(r[i],t,typeof e.type!=`function`||n&&!e.props.__P);(r=e.__e)&&(n||Ce(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function He(e,t,n){return this.constructor(e,n)}function Ue(e,t){var n,r,i,a;N.__&&N.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=we(I,{children:[e]}),i=[],a=[],Ie(t,t.__k,r||ve,ve,t.namespaceURI,r?null:t.firstChild?Se.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a),Re(i,t.__k,a),t.__k.props.children=null}N={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw fe=0,e}},ue=0,Te.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=F({},this.state)),typeof e==`function`&&(e=e(F({},n),this.props)),e&&(F(n,e),this.__v&&(t&&this.__k.push(t),De(this)))},Te.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),De(this))},Te.prototype.render=I,P=[],fe=0,pe=function(e,t){return e.__v.__b-t.__v.__b},me=Symbol(),he=/(PointerCapture)$|Capture$/i,ge=0,_e={};var R,z,We,Ge,Ke=Object.is,qe=0,Je=[],Ye=[],B=N,Xe=B.__b,Ze=B.__r,Qe=B.diffed,$e=B.__c,et=B.unmount,tt=B.__;function nt(e,t){B.__h&&B.__h(z,e,qe||t),qe=0;var n=z.__H||(z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function rt(e){return qe=1,it(pt,e)}function it(e,t,n){var r=nt(R++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Ke(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=z,!z.__f)){z.__f=!0;var i=z.shouldComponentUpdate;z.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,Ke(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function at(e,t){var n=nt(R++,3);!B.__s&&ft(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,z.__H.__h.push(n))}function V(e,t){var n=nt(R++,4);!B.__s&&ft(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,z.__h.push(n))}function H(e){return qe=5,ot(function(){return{current:e}},[])}function ot(e,t){var n=nt(R++,7);return ft(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function st(){var e;do{for(;e=Ye.shift();)try{U(e)}catch(t){B.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Je.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(U),t.__h.some(dt),t.__h=[]}catch(n){t.__h=[],B.__e(n,e.__v)}}}while(Ye.length)}B.__b=function(e){z=null,Xe&&Xe(e)},B.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),tt&&tt(e,t)},B.__r=function(e){Ze&&Ze(e),R=0;var t=(z=e.__c).__H;t&&(We==z?z.__h=[]:(t.__h.some(U),t.__h.some(dt),R=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),We=z},B.diffed=function(e){Qe&&Qe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&ut(Je.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),We=z=null},B.__c=function(e,t){t.some(function(e){try{e.__h.some(U),e.__h=e.__h.filter(function(e){return!e.__||dt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],B.__e(n,e.__v)}}),$e&&$e(e,t)},B.unmount=function(e){et&&et(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,ut(Ye.push(r))}else U(r)}catch(e){t=e}}),r.__H=void 0,t&&B.__e(t,r.__v))};var ct=typeof requestAnimationFrame==`function`;function lt(e){var t,n=function(){clearTimeout(r),ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ct&&(t=requestAnimationFrame(n))}function ut(e){e!=1&&Ge==B.requestAnimationFrame||((Ge=B.requestAnimationFrame)||lt)(st)}function U(e){var t=z,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),z=t}function dt(e){var t=z;e.__c=e.__(),z=t}function ft(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Ke(t,e[n])})}function pt(e,t){return typeof t==`function`?t(e):t}var mt=0;Array.isArray;function W(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--mt,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),N.vnode&&N.vnode(l),l}function G({name:e,size:t,children:n}){return W(`svg`,{"data-icon":e,"aria-hidden":`true`,focusable:`false`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,children:n})}function ht({size:e=26}){return W(G,{name:`chat`,size:e,children:[W(`path`,{d:`M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z`}),W(`path`,{d:`M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01`,"stroke-width":`2.5`})]})}function gt({size:e=26}){return W(G,{name:`message`,size:e,children:W(`path`,{d:`M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z`})})}function _t({size:e=26}){return W(G,{name:`sparkle`,size:e,children:[W(`path`,{d:`M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z`}),W(`path`,{d:`M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z`})]})}function vt({size:e=26}){return W(G,{name:`chevron-down`,size:e,children:W(`path`,{d:`M6 9l6 6 6-6`})})}function yt({size:e=18}){return W(G,{name:`close`,size:e,children:W(`path`,{d:`M6 6l12 12M18 6L6 18`})})}var bt=`M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7`;function xt({size:e=16}){return W(G,{name:`thumb-up`,size:e,children:W(`path`,{d:bt})})}function St({size:e=16}){return W(G,{name:`thumb-down`,size:e,children:W(`path`,{d:bt,transform:`matrix(1 0 0 -1 0 24)`})})}var Ct={chat:ht,message:gt,sparkle:_t},wt={"chevron-down":vt,close:yt};function Tt({isOpen:e,onClick:n,iconUrl:r,icon:i=`chat`,openIconUrl:a,openIcon:o=`chevron-down`,buttonRef:s,text:c=t}){let[l,u]=rt(`loading`),[d,f]=rt(`loading`),p=r!==void 0&&l!==`failed`,m=a!==void 0&&d!==`failed`,h=p&&!e&&l===`loaded`,g=m&&e&&d===`loaded`,_=Ct[i]??ht,v=wt[o]??vt;return W(`button`,{type:`button`,class:`whoo-widget-launcher`,onClick:n,"aria-label":e?c.closeChat:c.openChat,ref:s,children:[e?g?null:W(v,{}):h?null:W(_,{}),p?W(`img`,{class:`whoo-widget-launcher-icon-image`,src:r,alt:``,referrerpolicy:`no-referrer`,hidden:!h,onLoad:()=>u(`loaded`),onError:()=>u(`failed`)}):null,m?W(`img`,{class:`whoo-widget-launcher-icon-image`,src:a,alt:``,referrerpolicy:`no-referrer`,hidden:!g,onLoad:()=>f(`loaded`),onError:()=>f(`failed`)}):null]})}var Et={en:t,fr:{openChat:`Ouvrir le chat`,closeChat:`Fermer le chat`,chatWith:`Discuter avec {name}`,newConversation:`Nouvelle conversation`,conversation:`Conversation`,you:`Vous`,message:`Message`,messagePlaceholder:`Écrivez un message…`,send:`Envoyer`,lookingItUp:`Je recherche l’information pour vous…`,goodResponse:`Réponse utile`,badResponse:`Réponse peu utile`,additionalFeedback:`Commentaire supplémentaire`,feedbackPlaceholder:`Qu’est-ce qui n’allait pas ? (facultatif)`,feedbackCategory:`Catégorie du commentaire`,selectReason:`Choisissez un motif (facultatif)`,categoryFactual:`Erreur factuelle`,categoryIncomplete:`Réponse incomplète`,categoryTone:`Ton inapproprié`,categoryOther:`Autre`,submit:`Envoyer le commentaire`,cancel:`Annuler`,feedbackThanks:`Merci pour votre commentaire`,feedbackFailed:`Impossible d’envoyer votre commentaire`,conversationCleared:`Conversation effacée`,genericError:`Une erreur s’est produite. Veuillez réessayer.`,sessionExpired:`Cette session de chat a expiré. Rechargez la page pour continuer.`,opensInNewTab:`(s’ouvre dans un nouvel onglet)`,agreeToNotice:`J’accepte`},es:{openChat:`Abrir chat`,closeChat:`Cerrar chat`,chatWith:`Chat con {name}`,newConversation:`Nueva conversación`,conversation:`Conversación`,you:`Usted`,message:`Mensaje`,messagePlaceholder:`Escriba un mensaje…`,send:`Enviar`,lookingItUp:`Estoy buscando esa información…`,goodResponse:`Buena respuesta`,badResponse:`Mala respuesta`,additionalFeedback:`Comentarios adicionales`,feedbackPlaceholder:`¿Qué estuvo mal? (opcional)`,feedbackCategory:`Tipo de problema`,selectReason:`Seleccione un motivo (opcional)`,categoryFactual:`Información incorrecta`,categoryIncomplete:`Respuesta incompleta`,categoryTone:`Tono inadecuado`,categoryOther:`Otro`,submit:`Enviar comentarios`,cancel:`Cancelar`,feedbackThanks:`Gracias por sus comentarios`,feedbackFailed:`No se pudieron enviar sus comentarios`,conversationCleared:`Se inició una nueva conversación`,genericError:`Algo salió mal. Inténtelo de nuevo.`,sessionExpired:`Esta sesión de chat expiró. Vuelva a cargar la página para continuar.`,opensInNewTab:`(se abre en una pestaña nueva)`,agreeToNotice:`Acepto`},pt:{openChat:`Abrir chat`,closeChat:`Fechar chat`,chatWith:`Conversa com {name}`,newConversation:`Nova conversa`,conversation:`Conversa`,you:`Você`,message:`Mensagem`,messagePlaceholder:`Digite uma mensagem…`,send:`Enviar`,lookingItUp:`Estou buscando essa informação…`,goodResponse:`Boa resposta`,badResponse:`Resposta ruim`,additionalFeedback:`Comentários adicionais`,feedbackPlaceholder:`O que estava errado? (opcional)`,feedbackCategory:`Categoria do feedback`,selectReason:`Selecione um motivo (opcional)`,categoryFactual:`Informação incorreta`,categoryIncomplete:`Resposta incompleta`,categoryTone:`Tom inadequado`,categoryOther:`Outro`,submit:`Enviar feedback`,cancel:`Cancelar`,feedbackThanks:`Agradecemos seu feedback`,feedbackFailed:`Não foi possível enviar o feedback`,conversationCleared:`Nova conversa iniciada`,genericError:`Algo deu errado. Tente novamente.`,sessionExpired:`Esta sessão de chat expirou. Recarregue a página para continuar.`,opensInNewTab:`(abre em uma nova aba)`,agreeToNotice:`Concordo`},de:{openChat:`Chat öffnen`,closeChat:`Chat schließen`,chatWith:`Chat mit {name}`,newConversation:`Neue Unterhaltung`,conversation:`Unterhaltung`,you:`Sie`,message:`Nachricht`,messagePlaceholder:`Nachricht eingeben…`,send:`Senden`,lookingItUp:`Ich suche die Informationen für Sie heraus…`,goodResponse:`Gute Antwort`,badResponse:`Schlechte Antwort`,additionalFeedback:`Zusätzliches Feedback`,feedbackPlaceholder:`Was war falsch? (optional)`,feedbackCategory:`Feedback-Kategorie`,selectReason:`Grund auswählen (optional)`,categoryFactual:`Faktenfehler`,categoryIncomplete:`Unvollständig`,categoryTone:`Unpassender Ton`,categoryOther:`Sonstiges`,submit:`Absenden`,cancel:`Abbrechen`,feedbackThanks:`Danke für Ihr Feedback`,feedbackFailed:`Feedback konnte nicht gesendet werden`,conversationCleared:`Neue Unterhaltung gestartet`,genericError:`Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.`,sessionExpired:`Diese Chat-Sitzung ist abgelaufen. Laden Sie die Seite neu, um fortzufahren.`,opensInNewTab:`(öffnet sich in neuem Tab)`,agreeToNotice:`Ich stimme zu`},it:{openChat:`Apri la chat`,closeChat:`Chiudi la chat`,chatWith:`Chat con {name}`,newConversation:`Nuova conversazione`,conversation:`Conversazione`,you:`Tu`,message:`Messaggio`,messagePlaceholder:`Scrivi un messaggio…`,send:`Invia`,lookingItUp:`Sto cercando le informazioni richieste…`,goodResponse:`Risposta utile`,badResponse:`Risposta non utile`,additionalFeedback:`Commenti aggiuntivi`,feedbackPlaceholder:`Che cosa non andava? (facoltativo)`,feedbackCategory:`Categoria del feedback`,selectReason:`Seleziona un motivo (facoltativo)`,categoryFactual:`Informazione errata`,categoryIncomplete:`Risposta incompleta`,categoryTone:`Tono non adeguato`,categoryOther:`Altro`,submit:`Invia feedback`,cancel:`Annulla`,feedbackThanks:`Grazie per il feedback`,feedbackFailed:`Impossibile inviare il feedback`,conversationCleared:`Nuova conversazione avviata`,genericError:`Si è verificato un errore. Riprovi.`,sessionExpired:`Questa sessione di chat è scaduta. Ricarichi la pagina per continuare.`,opensInNewTab:`(si apre in una nuova scheda)`,agreeToNotice:`Accetto`},ja:{openChat:`チャットを開く`,closeChat:`チャットを閉じる`,chatWith:`{name}とチャット`,newConversation:`新しい会話`,conversation:`会話`,you:`あなた`,message:`メッセージ`,messagePlaceholder:`メッセージを入力…`,send:`送信`,lookingItUp:`確認しています…`,goodResponse:`良い回答`,badResponse:`良くない回答`,additionalFeedback:`追加のフィードバック`,feedbackPlaceholder:`何が問題でしたか?(任意)`,feedbackCategory:`フィードバックの種類`,selectReason:`理由を選択(任意)`,categoryFactual:`事実の誤り`,categoryIncomplete:`回答が不十分`,categoryTone:`不適切な口調`,categoryOther:`その他`,submit:`フィードバックを送信`,cancel:`キャンセル`,feedbackThanks:`フィードバックありがとうございます`,feedbackFailed:`フィードバックを送信できませんでした`,conversationCleared:`会話を消去しました`,genericError:`エラーが発生しました。もう一度お試しください。`,sessionExpired:`このチャットセッションの有効期限が切れました。続けるにはページを再読み込みしてください。`,opensInNewTab:`(新しいタブで開きます)`,agreeToNotice:`同意する`},zh:{openChat:`打开聊天`,closeChat:`关闭聊天`,chatWith:`与{name}聊天`,newConversation:`新对话`,conversation:`对话`,you:`您`,message:`消息`,messagePlaceholder:`输入消息…`,send:`发送`,lookingItUp:`正在为您查找……`,goodResponse:`回答很好`,badResponse:`回答不好`,additionalFeedback:`补充反馈`,feedbackPlaceholder:`哪里有问题?(可选)`,feedbackCategory:`反馈类别`,selectReason:`选择原因(可选)`,categoryFactual:`事实错误`,categoryIncomplete:`回答不完整`,categoryTone:`语气不当`,categoryOther:`其他`,submit:`提交`,cancel:`取消`,feedbackThanks:`感谢您的反馈`,feedbackFailed:`反馈提交失败`,conversationCleared:`对话已清除`,genericError:`出了点问题,请重试。`,sessionExpired:`此聊天会话已过期。请刷新页面后继续。`,opensInNewTab:`(将在新标签页中打开)`,agreeToNotice:`我同意`},ru:{openChat:`Открыть чат`,closeChat:`Закрыть чат`,chatWith:`Чат с ассистентом {name}`,newConversation:`Новый диалог`,conversation:`Диалог`,you:`Вы`,message:`Сообщение`,messagePlaceholder:`Введите сообщение…`,send:`Отправить`,lookingItUp:`Ищу информацию…`,goodResponse:`Хороший ответ`,badResponse:`Плохой ответ`,additionalFeedback:`Дополнительный комментарий`,feedbackPlaceholder:`Что было не так? (необязательно)`,feedbackCategory:`Категория отзыва`,selectReason:`Выберите причину (необязательно)`,categoryFactual:`Фактическая ошибка`,categoryIncomplete:`Неполный ответ`,categoryTone:`Неподходящий тон`,categoryOther:`Другое`,submit:`Отправить отзыв`,cancel:`Отмена`,feedbackThanks:`Спасибо за отзыв`,feedbackFailed:`Не удалось отправить отзыв`,conversationCleared:`Диалог очищен`,genericError:`Что-то пошло не так. Попробуйте ещё раз.`,sessionExpired:`Срок действия сеанса чата истёк. Перезагрузите страницу, чтобы продолжить.`,opensInNewTab:`(откроется в новой вкладке)`,agreeToNotice:`Принимаю`},hi:{openChat:`चैट खोलें`,closeChat:`चैट बंद करें`,chatWith:`{name} से चैट करें`,newConversation:`नई बातचीत`,conversation:`बातचीत`,you:`आप`,message:`संदेश`,messagePlaceholder:`संदेश लिखें…`,send:`भेजें`,lookingItUp:`आपके लिए जानकारी खोजी जा रही है…`,goodResponse:`अच्छा जवाब`,badResponse:`ख़राब जवाब`,additionalFeedback:`अतिरिक्त फ़ीडबैक`,feedbackPlaceholder:`क्या ग़लत था? (वैकल्पिक)`,feedbackCategory:`फ़ीडबैक की श्रेणी`,selectReason:`कारण चुनें (वैकल्पिक)`,categoryFactual:`तथ्यात्मक त्रुटि`,categoryIncomplete:`अधूरा जवाब`,categoryTone:`अनुचित लहजा`,categoryOther:`अन्य`,submit:`सबमिट करें`,cancel:`रद्द करें`,feedbackThanks:`आपके फ़ीडबैक के लिए धन्यवाद`,feedbackFailed:`फ़ीडबैक नहीं भेजा जा सका`,conversationCleared:`बातचीत मिटा दी गई`,genericError:`कुछ ग़लत हो गया। कृपया फिर से कोशिश करें।`,sessionExpired:`यह चैट सत्र समाप्त हो गया है। जारी रखने के लिए पेज को फिर से लोड करें।`,opensInNewTab:`(नए टैब में खुलता है)`,agreeToNotice:`मैं सहमत हूँ`},ar:{openChat:`فتح الدردشة`,closeChat:`إغلاق الدردشة`,chatWith:`الدردشة مع {name}`,newConversation:`محادثة جديدة`,conversation:`المحادثة`,you:`أنت`,message:`الرسالة`,messagePlaceholder:`كتابة رسالة…`,send:`إرسال`,lookingItUp:`جارٍ البحث عن المعلومات…`,goodResponse:`إجابة جيدة`,badResponse:`إجابة سيئة`,additionalFeedback:`ملاحظات إضافية`,feedbackPlaceholder:`ما المشكلة؟ (اختياري)`,feedbackCategory:`فئة الملاحظات`,selectReason:`اختر سببًا (اختياري)`,categoryFactual:`معلومات غير صحيحة`,categoryIncomplete:`إجابة غير مكتملة`,categoryTone:`أسلوب غير مناسب`,categoryOther:`أخرى`,submit:`إرسال الملاحظات`,cancel:`إلغاء`,feedbackThanks:`شكرًا على ملاحظاتك`,feedbackFailed:`تعذّر إرسال الملاحظات`,conversationCleared:`تم مسح المحادثة`,genericError:`حدث خطأ ما. يُرجى المحاولة مرة أخرى.`,sessionExpired:`انتهت صلاحية جلسة الدردشة هذه. يُرجى إعادة تحميل الصفحة للمتابعة.`,opensInNewTab:`(يُفتح في علامة تبويب جديدة)`,agreeToNotice:`أوافق`}},Dt=Object.freeze(Object.keys(Et)),Ot={pt:`pt-BR`,es:`es-419`,zh:`zh-Hans`},kt=new Set([`ar`]),At=/^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i,jt=/^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;function Mt(e){return Et[e]}function Nt(e){let t=e.trim();if(!At.test(t)||jt.test(t))return null;let n=t.split(/[-_]/)[0].toLowerCase();return Object.hasOwn(Et,n)?n:null}function Pt(e,t){let n=null;return e!=null&&e!==``&&(n=typeof e==`string`?Nt(e):null,n||console.warn(`whoo-aiden-widget: ignoring \`language\` ${Ft(e)} -- expected one of ${Dt.join(`, `)} (or a regional tag like pt-BR). Using the page's language instead.`)),n??=typeof t==`string`?Nt(t):null,n??=`en`,{language:n,tag:Ot[n]??n,dir:kt.has(n)?`rtl`:`ltr`}}function Ft(e){return typeof e==`string`?JSON.stringify(e):`(a ${typeof e})`}function It(e){if(typeof e!=`string`)return null;let t=e.trim().replace(/_/g,`-`);return At.test(t)?t:null}function Lt(e,t,n){if(e!=null&&e!==``){let t=It(e);if(t)return t;console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Ft(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`)}return It(t)??It(n)??``}function Rt(e){let t=e.indexOf(`{name}`);return t===-1?{before:e,after:``,hasName:!1}:{before:e.slice(0,t),after:e.slice(t+6),hasName:!0}}var zt=`(max-width: 400px), (max-height: 420px)`,Bt=`data-fit-visible`,Vt=40;function Ht(e){let t=typeof window<`u`?window.visualViewport:null;if(!t)return()=>{};let n=()=>{e.removeAttribute(Bt),e.style.removeProperty(`--whoo-widget-visible-top`),e.style.removeProperty(`--whoo-widget-visible-height`)},r=()=>{let r=document.documentElement.clientHeight,i=Math.abs(t.scale-1)>.01,a=r-t.height;if(i||r===0||a<Vt){n();return}e.setAttribute(Bt,``),e.style.setProperty(`--whoo-widget-visible-top`,`${Math.max(0,t.offsetTop)}px`),e.style.setProperty(`--whoo-widget-visible-height`,`${t.height}px`);let o=e.getRootNode().activeElement;o&&e.contains(o)&&typeof o.scrollIntoView==`function`&&o.scrollIntoView({block:`nearest`})};return r(),t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r),n()}}function Ut(e,t){return typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}}var Wt=0,Gt=``;function Kt(){Wt++===0&&(Gt=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`)}function qt(){--Wt===0&&(document.documentElement.style.overflow=Gt)}function Jt(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let e=window.matchMedia(zt),t=!1,n=()=>{e.matches&&!t?(t=!0,Kt()):!e.matches&&t&&(t=!1,qt())};n();let r=Ut(e,n);return()=>{r(),t&&(t=!1,qt())}}function Yt(e){if(typeof window>`u`||typeof window.matchMedia!=`function`||typeof e.showModal!=`function`)return()=>{};let t=window.matchMedia(zt),n=!1,r=()=>{if(t.matches===n||!e.isConnected)return;n=t.matches;let r=e.getRootNode().activeElement;e.close(),n?e.showModal():e.show(),r&&e.contains(r)&&r.focus({preventScroll:!0})};return r(),Ut(t,r)}function Xt(e){return e.isComposing||e.keyCode===229}function Zt({value:e,onChange:n,onSend:r,disabled:i,inputRef:a,text:o=t,contentLanguage:s}){return W(`div`,{class:`whoo-widget-composer`,children:[W(`label`,{class:`whoo-widget-sr-only`,for:`whoo-widget-composer-input`,children:o.message}),W(`input`,{id:`whoo-widget-composer-input`,class:`whoo-widget-composer-input`,lang:s,autoFocus:!0,placeholder:o.messagePlaceholder,value:e,readOnly:i,"aria-disabled":i,ref:a,onInput:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!Xt(e)&&r()}}),W(`button`,{type:`button`,class:`whoo-widget-composer-send`,"aria-disabled":i,onClick:()=>{i||r()},children:o.send})]})}function Qt({message:e}){return W(`div`,{class:`whoo-widget-error-banner`,role:`alert`,children:e})}var $t=/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y,en=/\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y,tn=/(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y,nn=/\*([^*\s](?:[^*]*[^*\s])?)\*/y,rn=/[ \t]*[*+-][ \t]+/y,an=/https?:\/\/\S+/y,on=/[.,;:!?)\]}>]+$/;function sn(e){let t=[],n=0,r=0,i=n=>{n>r&&t.push({type:`text`,value:e.slice(r,n),start:r,end:n})};for(;n<e.length;){if((n===0||e[n-1]===`
|
|
2
|
-
`)&&(
|
|
1
|
+
var whooAidenWidget=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={openChat:`Open chat`,closeChat:`Close chat`,chatWith:`Chat with {name}`,newConversation:`New conversation`,conversation:`Conversation`,you:`You`,message:`Message`,messagePlaceholder:`Type a message…`,send:`Send`,messageSent:`Message sent. {name} is preparing a response.`,lookingItUp:`Looking that up for you…`,goodResponse:`Good response`,badResponse:`Bad response`,additionalFeedback:`Additional feedback`,feedbackPlaceholder:`What was wrong? (optional)`,feedbackCategory:`Feedback category`,selectReason:`Select a reason (optional)`,categoryFactual:`Factual error`,categoryIncomplete:`Incomplete`,categoryTone:`Off tone`,categoryOther:`Other`,submit:`Submit`,cancel:`Cancel`,feedbackThanks:`Thanks for the feedback`,feedbackFailed:`Couldn't send feedback`,conversationCleared:`New conversation started. Previous messages were cleared.`,genericError:`Something went wrong, please try again.`,sessionExpired:`This chat session has expired. Reload the page to continue.`,opensInNewTab:`(opens in new tab)`,agreeToNotice:`I agree`},n=Object.keys(t);function r(e,t){if(e!=null&&e!==``){if(typeof e==`string`)try{let t=new URL(e);if(t.protocol===`https:`||t.protocol===`data:`&&t.pathname.toLowerCase().startsWith(`image/`))return e}catch{}console.warn(`whoo-aiden-widget: ignoring \`${t}\` -- only https: and data:image/ URLs are allowed.`)}}var i=[`primary`,`onPrimary`,`primaryText`,`ink`,`link`,`text`,`panel`,`border`,`headerHover`,`assistantBubble`,`muted`,`typingDots`,`errorBackground`,`errorText`,`inputBorder`,`focusRing`],a={primary:`#4f46e5`,onPrimary:`#ffffff`,primaryText:`#4f46e5`,ink:`#111111`,link:`#0000ee`,text:`#111111`,panel:`#ffffff`,border:`#e5e5e5`,headerHover:`#f3f4f6`,assistantBubble:`#f0f0f0`,muted:`#4b5563`,typingDots:`#6b7280`,errorBackground:`#fee2e2`,errorText:`#991b1b`,inputBorder:`#6b7280`,focusRing:`#111827`},o={primary:`--whoo-widget-color`,onPrimary:`--whoo-widget-text-on-color`,primaryText:`--whoo-widget-color-text`,ink:`--whoo-widget-ink`,link:`--whoo-widget-link-color`,text:`--whoo-widget-text`,panel:`--whoo-widget-panel`,border:`--whoo-widget-border`,headerHover:`--whoo-widget-header-hover`,assistantBubble:`--whoo-widget-assistant-bubble`,muted:`--whoo-widget-muted`,typingDots:`--whoo-widget-typing-dots`,errorBackground:`--whoo-widget-error-bg`,errorText:`--whoo-widget-error-text`,inputBorder:`--whoo-widget-input-border`,focusRing:`--whoo-widget-focus-ring`},s=2147483e3,c=2147483647;function l(e){return e===void 0?s:Number.isInteger(e)&&Math.abs(e)<=c?e:(console.warn(`whoo-aiden-widget: ignoring zIndex ${String(e)} (expected an integer between -${c} and ${c}); using ${s}.`),s)}var u=`Aiden`;function d(e){return typeof e==`string`?e.trim():``}function f(e){return/^[\p{White_Space}\p{Cf}\p{M}]*$/u.test(e)}function p(e){if((typeof e.publishableKey==`string`&&e.publishableKey.length>0)==(typeof e.sessionToken==`string`&&e.sessionToken.length>0))throw Error("whoo-aiden-widget: init() requires exactly one of `publishableKey` or `sessionToken`, not both or neither.")}function m(e){console.warn(`whoo-aiden-widget: ${e}`)}function h(e){let{getSessionToken:t}=e;if(t!==void 0){if(typeof t!=`function`)m("ignoring `getSessionToken` -- expected a function that returns a session token.");else if(!e.sessionToken)m("ignoring `getSessionToken` -- it is only used with `sessionToken`; with `publishableKey` the widget renews its session by itself.");else return t}}var g=20;function _(e){let t=new WeakSet,n=new Set;return r=>{if(typeof r==`object`&&r||typeof r==`function`){if(t.has(r))return;t.add(r)}else{if(n.has(r))return;n.size>=g&&n.delete(n.values().next().value),n.add(r)}m(e)}}var v=_("ignoring `theme` -- expected an object."),y=_("ignoring `layout` -- expected an object."),b=_("ignoring `messages` -- expected an object.");function x(e){if(e==null)return{};if(!S(e))return b(e),{};let t={};for(let r of Object.keys(e)){if(!n.includes(r)){m(`ignoring unknown option \`messages.${r}\`.`);continue}let i=e[r];typeof i!=`string`||f(i)?m(`ignoring \`messages.${r}\` -- expected a non-blank string.`):(r===`chatWith`&&!i.includes(`{name}`)&&m("`messages.chatWith` has no {name}, so the agent name is not shown in the title. For a fixed title, use the `title` option."),t[r]=i)}for(let t in e)Object.hasOwn(e,t)||m(`ignoring inherited option \`messages.${t}\` -- only the object's own keys are used.`);return t}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var C=e=>e==null||e===``;function w(e,t,n){let r=e[t];return r==null?null:S(r)?r:(m(`ignoring \`${n}\` -- expected an object.`),null)}function T(e,t,n){for(let r of Object.keys(e))t.includes(r)||m(`ignoring unknown option \`${n}.${r}\`.`)}function E(e,t,n){if(!C(e)){if(typeof e==`string`&&t.includes(e))return e;m(`ignoring \`${n}\` -- expected one of ${t.join(`, `)}.`)}}var D=[`bubble`,`centered`],O=[`top`,`footer`];function k(e){return E(e,D,`greetingStyle`)??`bubble`}function A(e){return E(e,O,`noticePlacement`)??`top`}var ee=200,te=/url\(|[@;{}\\]/i;function ne(e){if(!C(e)){if(typeof e==`string`){let t=e.trim();if(t&&t.length<=ee&&!te.test(t))return t}m(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${ee} characters, without url(), @, ;, {, } or \\.`)}}var re=[`chat`,`message`,`sparkle`],ie=[`chevron-down`,`close`],ae=new WeakMap;function oe(e){let t={colors:{},fontFamily:void 0,launcher:{}};if(e==null)return t;if(!S(e))return v(e),t;let n=ae.get(e);if(n)return n;T(e,[`colors`,`fonts`,`launcher`],`theme`);let a=w(e,`colors`,`theme.colors`);if(a){T(a,i,`theme.colors`);for(let e of i){let n=a[e];C(n)||(typeof n==`string`?t.colors[e]=n:m(`ignoring \`theme.colors.${e}\` -- expected a CSS color string.`))}}let o=w(e,`fonts`,`theme.fonts`);o&&(T(o,[`family`],`theme.fonts`),t.fontFamily=ne(o.family));let s=w(e,`launcher`,`theme.launcher`);if(s){T(s,[`icon`,`iconUrl`,`openIcon`,`openIconUrl`],`theme.launcher`);let e=E(s.icon,re,`theme.launcher.icon`),n=r(s.iconUrl,`theme.launcher.iconUrl`),i=E(s.openIcon,ie,`theme.launcher.openIcon`),a=r(s.openIconUrl,`theme.launcher.openIconUrl`);e&&(t.launcher.icon=e),n&&(t.launcher.iconUrl=n),i&&(t.launcher.openIcon=i),a&&(t.launcher.openIconUrl=a)}return ae.set(e,t),t}var j={offsetX:20,offsetY:20,launcherSize:56,panelWidth:360,panelHeight:480};function M(e,t,n){return e==null?n:typeof e==`number`&&Number.isFinite(e)&&e>=0?e:(m(`ignoring \`${t}\` -- expected a non-negative number of pixels; using ${n}.`),n)}function se(e,t,n,r){let i=Math.min(r,Math.max(n,e));return i!==e&&m(`\`${t}\` ${e} is out of range (${r===1/0?`at least ${n}`:`${n}-${r}`}); using ${i}.`),i}var ce=new WeakMap;function le(e){let t={...j};if(e==null)return t;if(!S(e))return y(e),t;let n=ce.get(e);if(n)return n;T(e,[`offset`,`launcherSize`,`panel`,`cornerRadius`],`layout`);let r=w(e,`offset`,`layout.offset`);r&&(T(r,[`x`,`y`],`layout.offset`),t.offsetX=M(r.x,`layout.offset.x`,j.offsetX),t.offsetY=M(r.y,`layout.offset.y`,j.offsetY)),t.launcherSize=se(M(e.launcherSize,`layout.launcherSize`,j.launcherSize),`layout.launcherSize`,24,120);let i=w(e,`panel`,`layout.panel`);i&&(T(i,[`width`,`height`],`layout.panel`),t.panelWidth=se(M(i.width,`layout.panel.width`,j.panelWidth),`layout.panel.width`,280,1/0),t.panelHeight=se(M(i.height,`layout.panel.height`,j.panelHeight),`layout.panel.height`,320,1/0));let a=e.cornerRadius;return typeof a==`number`&&Number.isFinite(a)&&a>=0?t.cornerRadius=se(a,`layout.cornerRadius`,0,32):C(a)||m("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."),ce.set(e,t),t}var N,ue,P,de,fe,pe,me,he,ge,_e,ve={},ye=[],be=/^m(i|n|o|s|text|space)$/,xe=Array.isArray,Se=ye.slice,F=Object.assign;function Ce(e){e&&e.parentNode&&e.remove()}function we(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i||++ue,__i:-1,__u:0};return!i&&N.vnode&&N.vnode(a),a}function I(e){return e.children}function Te(e,t){this.props=e,this.context=t,this.__g=0}function L(e,t){if(t==null)return e.__?L(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:L(e)}function Ee(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Ee(e)}function De(e){(8&e.__g||!(e.__g|=8)||!P.push(e)||fe++)&&de==N.debounceRendering||((de=N.debounceRendering)||queueMicrotask)(Oe)}function Oe(){var e,t,n,r,i,a,o,s,c;try{for(t=1;P.length;)P.length>t&&P.sort(pe),e=P.shift(),t=P.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=F({constructor:void 0},i)).__v=i.__v+1,N.vnode&&N.vnode(r),Ie(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||L(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,Re(o,r,s),i.__=i.__e=null,r.__e!=a&&Ee(r)))}finally{P.length=fe=0}}function ke(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r.__k||ye,v=t.length;for(c=Ae(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=~p.__i&&_[p.__i]||ve,p.__i=d,g=Ie(e,p,f,i,a,o,s,c,l,u),m=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&Be(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||m,p)),h||=m,4&p.__u?(c=je(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Ae(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,v=!1,y=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=y[a]=we(null,o):xe(o)?o=y[a]=we(I,{children:o}):o.constructor===void 0&&o.__b?o=y[a]=we(o.type,o.props,o.key,o.ref,o.__v):y[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=Me(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,v=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):y[a]=null;if(v){for(u=[],d=[],a=0;a<i;a++)if((o=y[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:y[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=L(s)),Ve(s,s));return r}function je(e,t,n,r){var i,a,o;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=je(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=L(e))&&!t.parentNode&&(t=null),o=t;o&&o.nodeType==8;)o=o.nextSibling;for(e.__e!=o&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function Me(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Ne(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function Pe(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Ne(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||={})[t]=n,n&&r||(o=_e[t]||(_e[t]=Fe(t)),(e.__a||={})[t]=ge,a=t!=(t=t.replace(he,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Fe(e){return function(t){if(this.__e){var n=this.__e[e];if(t[me]==null)t[me]=ge++;else if(t[me]<this.__a[e])return;return n(N.event?N.event(t):t)}}}function Ie(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A=t.type;if(t.constructor!==void 0)return null;if(128&n.__u&&(c=32&n.__u,u=n.__c.__z)){if(t.__u|=c,d=a=[],u.nodeType==8)for(f=1,p=u.nextSibling;p;p=p.nextSibling){if(p.nodeType==8){if(p.data.startsWith(`$s`))f++;else if(p.data.startsWith(`/$s`)&&!--f)break}a.push(p)}else a.push(u);s=a[0]}(u=N.__b)&&u(t);n:if(typeof A==`function`){m=o.length;try{if(y=t.props,b=(u=A.prototype)&&u.render,x=(u=A.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(b?t.__c=h=new A(y,S):(t.__c=h=new Te(y,S),h.constructor=A,h.render=He),x&&x.sub(h),h.state||(h.state={}),h.__n=r,h.__g|=8,h.__h=[],h.__k=[]),b&&(h.__s||(h.__s=h.state),A.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=F({},h.__s)),F(h.__s,A.getDerivedStateFromProps(y,h.__s)))),g=h.props,_=h.state,h.__v=t,n.__c){if(b&&!A.getDerivedStateFromProps&&y!==g&&h.componentWillReceiveProps&&h.componentWillReceiveProps(y,S),t.__v==n.__v&&!(8&h.__g)||!(4&h.__g)&&h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,S)){t.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ye.push.apply(h.__h,h.__k),h.__k=[],h.__h.length&&o.push(h),s=L(n);break n}h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,S),b&&h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,_,v)})}else b&&!A.getDerivedStateFromProps&&h.componentWillMount&&h.componentWillMount(),b&&h.componentDidMount&&h.__h.push(h.componentDidMount);if(h.context=S,h.props=y,h.__P=e,h.__g&=-5,C=N.__r,w=0,b)h.state=h.__s,h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),ye.push.apply(h.__h,h.__k),h.__k=[];else do h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),h.state=h.__s;while(8&h.__g&&++w<25);h.state=h.__s,h.getChildContext&&(r=F({},r,h.getChildContext())),b&&n.__c&&h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(g,_)),T=u&&u.type===I&&u.key==null?u.props.children:u,y.__P&&(u=s,i=(e=y.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Ve(e,e)}),n.__k=null),s=n.__k?L(n,0):null),s=ke(e,xe(T)?T:[T],t,n,r,i,a,o,s,c,l),y.__P&&(t.__e=null,s=u),t.__u&=-161,128&n.__u&&(h.__z=null),d&&d.some(Ce),h.__h.length&&o.push(h),1&h.__g&&(h.__g&=-4)}catch(e){if(o.length=m,t.__v=null,c||a){if(e.then){if(E=0,t.__u|=c?160:128,a){for(~(O=a.indexOf(s||void 0))||(O=a.length);(k=a[O-1])&&k.nodeType==8;)O--;for(;O<a.length;O++)if(k=a[O]){if(a[O]=null,k.nodeType==8){if(k.data.startsWith(`$s`))E++||(D=k);else if(E&&k.data.startsWith(`/$s`)&&!--E){s=k;break}}else if(!E)break}}if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;D=s}t.__c.__z||(t.__c.__z=D),t.__e=s}else a&&a.some(Ce)}else t.__e=n.__e;t.__k||=n.__k||[],e.then||Le(t),N.__e(e,t,n)}}else s=t.__e=ze(n.__e,t,n,r,i,a,o,c,l,e);return(u=N.diffed)&&u(t),128&t.__u?void 0:s}function Le(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Le))}function Re(e,t,n){for(var r=0;r<n.length;)Be(n[r++],n[r++],n[r++]);N.__c&&N.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){N.__e(e,t.__v)}})}function ze(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=n.props||ve,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a){for(u=0;u<a.length;u++)if((m=a[u])&&(x?m.localName==x:m.nodeType==3)){e=m,a[u]=null;break}}if(!e){if(_=l.ownerDocument||document,!x)return _.createTextNode(b);e=_.createElementNS(i,x,b.is&&b),s&&=(N.__m&&N.__m(t,a),!1),a=null}if(x){if(l=x==`template`?e.content:e,a=x==`textarea`&&b.defaultValue!=null?null:a&&Se.call(l.childNodes),!s&&a)for(y={},u=0;u<e.attributes.length;u++)y[(m=e.attributes[u]).name]=m.value;for(u in y)m=y[u],u==`dangerouslySetInnerHTML`?f=m:u==`children`||u in b||u==`value`&&`defaultValue`in b||u==`checked`&&`defaultChecked`in b||Pe(e,u,null,m,i);for(u in v=1&n.__u,b)m=b[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||!(y[u]!==m||v&&m!=null)||Pe(e,u,m,y[u],i);d?(s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(f&&(e.textContent=``),(x==`foreignObject`||i==`http://www.w3.org/1998/Math/MathML`&&be.test(x))&&(i=`http://www.w3.org/1999/xhtml`),ke(l,xe(p)?p:[p],t,n,r,i,a,o,a?a[0]:n.__k&&L(n,0),s,c),a&&a.some(Ce)),s&&x!=`textarea`||(u=`value`,x==`progress`&&h==null?e.removeAttribute(u):h==null||h===e[u]&&(x!=`progress`||h)||Pe(e,u,h,y[u],i),u=`checked`,g!=null&&g!=e[u]&&Pe(e,u,g,y[u],i))}else y===b||s&&e.data==b||(e.data=b);return e}function Be(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:(r&&=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){N.__e(e,n)}}function Ve(e,t,n){var r,i;if(N.unmount&&N.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Be(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){N.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ve(r[i],t,typeof e.type!=`function`||n&&!e.props.__P);(r=e.__e)&&(n||Ce(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function He(e,t,n){return this.constructor(e,n)}function Ue(e,t){var n,r,i,a;N.__&&N.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=we(I,{children:[e]}),i=[],a=[],Ie(t,t.__k,r||ve,ve,t.namespaceURI,r?null:t.firstChild?Se.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a),Re(i,t.__k,a),t.__k.props.children=null}N={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw fe=0,e}},ue=0,Te.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=F({},this.state)),typeof e==`function`&&(e=e(F({},n),this.props)),e&&(F(n,e),this.__v&&(t&&this.__k.push(t),De(this)))},Te.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),De(this))},Te.prototype.render=I,P=[],fe=0,pe=function(e,t){return e.__v.__b-t.__v.__b},me=Symbol(),he=/(PointerCapture)$|Capture$/i,ge=0,_e={};var R,z,We,Ge,Ke=Object.is,qe=0,Je=[],Ye=[],B=N,Xe=B.__b,Ze=B.__r,Qe=B.diffed,$e=B.__c,et=B.unmount,tt=B.__;function nt(e,t){B.__h&&B.__h(z,e,qe||t),qe=0;var n=z.__H||(z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function rt(e){return qe=1,it(pt,e)}function it(e,t,n){var r=nt(R++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Ke(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=z,!z.__f)){z.__f=!0;var i=z.shouldComponentUpdate;z.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,Ke(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function at(e,t){var n=nt(R++,3);!B.__s&&ft(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,z.__H.__h.push(n))}function V(e,t){var n=nt(R++,4);!B.__s&&ft(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,z.__h.push(n))}function H(e){return qe=5,ot(function(){return{current:e}},[])}function ot(e,t){var n=nt(R++,7);return ft(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function st(){var e;do{for(;e=Ye.shift();)try{U(e)}catch(t){B.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Je.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(U),t.__h.some(dt),t.__h=[]}catch(n){t.__h=[],B.__e(n,e.__v)}}}while(Ye.length)}B.__b=function(e){z=null,Xe&&Xe(e)},B.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),tt&&tt(e,t)},B.__r=function(e){Ze&&Ze(e),R=0;var t=(z=e.__c).__H;t&&(We==z?z.__h=[]:(t.__h.some(U),t.__h.some(dt),R=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),We=z},B.diffed=function(e){Qe&&Qe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&ut(Je.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),We=z=null},B.__c=function(e,t){t.some(function(e){try{e.__h.some(U),e.__h=e.__h.filter(function(e){return!e.__||dt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],B.__e(n,e.__v)}}),$e&&$e(e,t)},B.unmount=function(e){et&&et(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,ut(Ye.push(r))}else U(r)}catch(e){t=e}}),r.__H=void 0,t&&B.__e(t,r.__v))};var ct=typeof requestAnimationFrame==`function`;function lt(e){var t,n=function(){clearTimeout(r),ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ct&&(t=requestAnimationFrame(n))}function ut(e){e!=1&&Ge==B.requestAnimationFrame||((Ge=B.requestAnimationFrame)||lt)(st)}function U(e){var t=z,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),z=t}function dt(e){var t=z;e.__c=e.__(),z=t}function ft(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Ke(t,e[n])})}function pt(e,t){return typeof t==`function`?t(e):t}var mt=0;Array.isArray;function W(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--mt,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),N.vnode&&N.vnode(l),l}function G({name:e,size:t,children:n}){return W(`svg`,{"data-icon":e,"aria-hidden":`true`,focusable:`false`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,children:n})}function ht({size:e=26}){return W(G,{name:`chat`,size:e,children:[W(`path`,{d:`M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z`}),W(`path`,{d:`M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01`,"stroke-width":`2.5`})]})}function gt({size:e=26}){return W(G,{name:`message`,size:e,children:W(`path`,{d:`M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z`})})}function _t({size:e=26}){return W(G,{name:`sparkle`,size:e,children:[W(`path`,{d:`M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z`}),W(`path`,{d:`M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z`})]})}function vt({size:e=26}){return W(G,{name:`chevron-down`,size:e,children:W(`path`,{d:`M6 9l6 6 6-6`})})}function yt({size:e=18}){return W(G,{name:`close`,size:e,children:W(`path`,{d:`M6 6l12 12M18 6L6 18`})})}var bt=`M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7`;function xt({size:e=16}){return W(G,{name:`thumb-up`,size:e,children:W(`path`,{d:bt})})}function St({size:e=16}){return W(G,{name:`thumb-down`,size:e,children:W(`path`,{d:bt,transform:`matrix(1 0 0 -1 0 24)`})})}var Ct={chat:ht,message:gt,sparkle:_t},wt={"chevron-down":vt,close:yt};function Tt({isOpen:e,onClick:n,iconUrl:r,icon:i=`chat`,openIconUrl:a,openIcon:o=`chevron-down`,buttonRef:s,text:c=t}){let[l,u]=rt(`loading`),[d,f]=rt(`loading`),p=r!==void 0&&l!==`failed`,m=a!==void 0&&d!==`failed`,h=p&&!e&&l===`loaded`,g=m&&e&&d===`loaded`,_=Ct[i]??ht,v=wt[o]??vt;return W(`button`,{type:`button`,class:`whoo-widget-launcher`,onClick:n,"aria-label":e?c.closeChat:c.openChat,ref:s,children:[e?g?null:W(v,{}):h?null:W(_,{}),p?W(`img`,{class:`whoo-widget-launcher-icon-image`,src:r,alt:``,referrerpolicy:`no-referrer`,hidden:!h,onLoad:()=>u(`loaded`),onError:()=>u(`failed`)}):null,m?W(`img`,{class:`whoo-widget-launcher-icon-image`,src:a,alt:``,referrerpolicy:`no-referrer`,hidden:!g,onLoad:()=>f(`loaded`),onError:()=>f(`failed`)}):null]})}var Et={en:t,fr:{openChat:`Ouvrir le chat`,closeChat:`Fermer le chat`,chatWith:`Discuter avec {name}`,newConversation:`Nouvelle conversation`,conversation:`Conversation`,you:`Vous`,message:`Message`,messagePlaceholder:`Écrivez un message…`,send:`Envoyer`,messageSent:`Message envoyé. {name} prépare une réponse.`,lookingItUp:`Je recherche l’information pour vous…`,goodResponse:`Réponse utile`,badResponse:`Réponse peu utile`,additionalFeedback:`Commentaire supplémentaire`,feedbackPlaceholder:`Qu’est-ce qui n’allait pas ? (facultatif)`,feedbackCategory:`Catégorie du commentaire`,selectReason:`Choisissez un motif (facultatif)`,categoryFactual:`Erreur factuelle`,categoryIncomplete:`Réponse incomplète`,categoryTone:`Ton inapproprié`,categoryOther:`Autre`,submit:`Envoyer le commentaire`,cancel:`Annuler`,feedbackThanks:`Merci pour votre commentaire`,feedbackFailed:`Impossible d’envoyer votre commentaire`,conversationCleared:`Nouvelle conversation démarrée. Les messages précédents ont été effacés.`,genericError:`Une erreur s’est produite. Veuillez réessayer.`,sessionExpired:`Cette session de chat a expiré. Rechargez la page pour continuer.`,opensInNewTab:`(s’ouvre dans un nouvel onglet)`,agreeToNotice:`J’accepte`},es:{openChat:`Abrir chat`,closeChat:`Cerrar chat`,chatWith:`Chat con {name}`,newConversation:`Nueva conversación`,conversation:`Conversación`,you:`Usted`,message:`Mensaje`,messagePlaceholder:`Escriba un mensaje…`,send:`Enviar`,messageSent:`Mensaje enviado. {name} está preparando una respuesta.`,lookingItUp:`Estoy buscando esa información…`,goodResponse:`Buena respuesta`,badResponse:`Mala respuesta`,additionalFeedback:`Comentarios adicionales`,feedbackPlaceholder:`¿Qué estuvo mal? (opcional)`,feedbackCategory:`Tipo de problema`,selectReason:`Seleccione un motivo (opcional)`,categoryFactual:`Información incorrecta`,categoryIncomplete:`Respuesta incompleta`,categoryTone:`Tono inadecuado`,categoryOther:`Otro`,submit:`Enviar comentarios`,cancel:`Cancelar`,feedbackThanks:`Gracias por sus comentarios`,feedbackFailed:`No se pudieron enviar sus comentarios`,conversationCleared:`Se inició una nueva conversación. Se borraron los mensajes anteriores.`,genericError:`Algo salió mal. Inténtelo de nuevo.`,sessionExpired:`Esta sesión de chat expiró. Vuelva a cargar la página para continuar.`,opensInNewTab:`(se abre en una pestaña nueva)`,agreeToNotice:`Acepto`},pt:{openChat:`Abrir chat`,closeChat:`Fechar chat`,chatWith:`Conversa com {name}`,newConversation:`Nova conversa`,conversation:`Conversa`,you:`Você`,message:`Mensagem`,messagePlaceholder:`Digite uma mensagem…`,send:`Enviar`,messageSent:`Mensagem enviada. {name} está preparando uma resposta.`,lookingItUp:`Estou buscando essa informação…`,goodResponse:`Boa resposta`,badResponse:`Resposta ruim`,additionalFeedback:`Comentários adicionais`,feedbackPlaceholder:`O que estava errado? (opcional)`,feedbackCategory:`Categoria do feedback`,selectReason:`Selecione um motivo (opcional)`,categoryFactual:`Informação incorreta`,categoryIncomplete:`Resposta incompleta`,categoryTone:`Tom inadequado`,categoryOther:`Outro`,submit:`Enviar feedback`,cancel:`Cancelar`,feedbackThanks:`Agradecemos seu feedback`,feedbackFailed:`Não foi possível enviar o feedback`,conversationCleared:`Nova conversa iniciada. As mensagens anteriores foram apagadas.`,genericError:`Algo deu errado. Tente novamente.`,sessionExpired:`Esta sessão de chat expirou. Recarregue a página para continuar.`,opensInNewTab:`(abre em uma nova aba)`,agreeToNotice:`Concordo`},de:{openChat:`Chat öffnen`,closeChat:`Chat schließen`,chatWith:`Chat mit {name}`,newConversation:`Neue Unterhaltung`,conversation:`Unterhaltung`,you:`Sie`,message:`Nachricht`,messagePlaceholder:`Nachricht eingeben…`,send:`Senden`,messageSent:`Nachricht gesendet. {name} bereitet eine Antwort vor.`,lookingItUp:`Ich suche die Informationen für Sie heraus…`,goodResponse:`Gute Antwort`,badResponse:`Schlechte Antwort`,additionalFeedback:`Zusätzliches Feedback`,feedbackPlaceholder:`Was war falsch? (optional)`,feedbackCategory:`Feedback-Kategorie`,selectReason:`Grund auswählen (optional)`,categoryFactual:`Faktenfehler`,categoryIncomplete:`Unvollständig`,categoryTone:`Unpassender Ton`,categoryOther:`Sonstiges`,submit:`Absenden`,cancel:`Abbrechen`,feedbackThanks:`Danke für Ihr Feedback`,feedbackFailed:`Feedback konnte nicht gesendet werden`,conversationCleared:`Neue Unterhaltung gestartet. Die bisherigen Nachrichten wurden gelöscht.`,genericError:`Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.`,sessionExpired:`Diese Chat-Sitzung ist abgelaufen. Laden Sie die Seite neu, um fortzufahren.`,opensInNewTab:`(öffnet sich in neuem Tab)`,agreeToNotice:`Ich stimme zu`},it:{openChat:`Apri la chat`,closeChat:`Chiudi la chat`,chatWith:`Chat con {name}`,newConversation:`Nuova conversazione`,conversation:`Conversazione`,you:`Tu`,message:`Messaggio`,messagePlaceholder:`Scrivi un messaggio…`,send:`Invia`,messageSent:`Messaggio inviato. {name} sta preparando una risposta.`,lookingItUp:`Sto cercando le informazioni richieste…`,goodResponse:`Risposta utile`,badResponse:`Risposta non utile`,additionalFeedback:`Commenti aggiuntivi`,feedbackPlaceholder:`Che cosa non andava? (facoltativo)`,feedbackCategory:`Categoria del feedback`,selectReason:`Seleziona un motivo (facoltativo)`,categoryFactual:`Informazione errata`,categoryIncomplete:`Risposta incompleta`,categoryTone:`Tono non adeguato`,categoryOther:`Altro`,submit:`Invia feedback`,cancel:`Annulla`,feedbackThanks:`Grazie per il feedback`,feedbackFailed:`Impossibile inviare il feedback`,conversationCleared:`Nuova conversazione avviata. I messaggi precedenti sono stati cancellati.`,genericError:`Si è verificato un errore. Riprovi.`,sessionExpired:`Questa sessione di chat è scaduta. Ricarichi la pagina per continuare.`,opensInNewTab:`(si apre in una nuova scheda)`,agreeToNotice:`Accetto`},ja:{openChat:`チャットを開く`,closeChat:`チャットを閉じる`,chatWith:`{name}とチャット`,newConversation:`新しい会話`,conversation:`会話`,you:`あなた`,message:`メッセージ`,messagePlaceholder:`メッセージを入力…`,send:`送信`,messageSent:`メッセージを送信しました。{name}が回答を準備しています。`,lookingItUp:`確認しています…`,goodResponse:`良い回答`,badResponse:`良くない回答`,additionalFeedback:`追加のフィードバック`,feedbackPlaceholder:`何が問題でしたか?(任意)`,feedbackCategory:`フィードバックの種類`,selectReason:`理由を選択(任意)`,categoryFactual:`事実の誤り`,categoryIncomplete:`回答が不十分`,categoryTone:`不適切な口調`,categoryOther:`その他`,submit:`フィードバックを送信`,cancel:`キャンセル`,feedbackThanks:`フィードバックありがとうございます`,feedbackFailed:`フィードバックを送信できませんでした`,conversationCleared:`新しい会話を開始しました。以前のメッセージは消去されました。`,genericError:`エラーが発生しました。もう一度お試しください。`,sessionExpired:`このチャットセッションの有効期限が切れました。続けるにはページを再読み込みしてください。`,opensInNewTab:`(新しいタブで開きます)`,agreeToNotice:`同意する`},zh:{openChat:`打开聊天`,closeChat:`关闭聊天`,chatWith:`与{name}聊天`,newConversation:`新对话`,conversation:`对话`,you:`您`,message:`消息`,messagePlaceholder:`输入消息…`,send:`发送`,messageSent:`消息已发送。{name}正在准备回复。`,lookingItUp:`正在为您查找……`,goodResponse:`回答很好`,badResponse:`回答不好`,additionalFeedback:`补充反馈`,feedbackPlaceholder:`哪里有问题?(可选)`,feedbackCategory:`反馈类别`,selectReason:`选择原因(可选)`,categoryFactual:`事实错误`,categoryIncomplete:`回答不完整`,categoryTone:`语气不当`,categoryOther:`其他`,submit:`提交`,cancel:`取消`,feedbackThanks:`感谢您的反馈`,feedbackFailed:`反馈提交失败`,conversationCleared:`已开始新对话。之前的消息已清除。`,genericError:`出了点问题,请重试。`,sessionExpired:`此聊天会话已过期。请刷新页面后继续。`,opensInNewTab:`(将在新标签页中打开)`,agreeToNotice:`我同意`},ru:{openChat:`Открыть чат`,closeChat:`Закрыть чат`,chatWith:`Чат с ассистентом {name}`,newConversation:`Новый диалог`,conversation:`Диалог`,you:`Вы`,message:`Сообщение`,messagePlaceholder:`Введите сообщение…`,send:`Отправить`,messageSent:`Сообщение отправлено. {name} готовит ответ.`,lookingItUp:`Ищу информацию…`,goodResponse:`Хороший ответ`,badResponse:`Плохой ответ`,additionalFeedback:`Дополнительный комментарий`,feedbackPlaceholder:`Что было не так? (необязательно)`,feedbackCategory:`Категория отзыва`,selectReason:`Выберите причину (необязательно)`,categoryFactual:`Фактическая ошибка`,categoryIncomplete:`Неполный ответ`,categoryTone:`Неподходящий тон`,categoryOther:`Другое`,submit:`Отправить отзыв`,cancel:`Отмена`,feedbackThanks:`Спасибо за отзыв`,feedbackFailed:`Не удалось отправить отзыв`,conversationCleared:`Начат новый диалог. Предыдущие сообщения удалены.`,genericError:`Что-то пошло не так. Попробуйте ещё раз.`,sessionExpired:`Срок действия сеанса чата истёк. Перезагрузите страницу, чтобы продолжить.`,opensInNewTab:`(откроется в новой вкладке)`,agreeToNotice:`Принимаю`},hi:{openChat:`चैट खोलें`,closeChat:`चैट बंद करें`,chatWith:`{name} से चैट करें`,newConversation:`नई बातचीत`,conversation:`बातचीत`,you:`आप`,message:`संदेश`,messagePlaceholder:`संदेश लिखें…`,send:`भेजें`,messageSent:`संदेश भेज दिया गया। {name} द्वारा जवाब तैयार किया जा रहा है।`,lookingItUp:`आपके लिए जानकारी खोजी जा रही है…`,goodResponse:`अच्छा जवाब`,badResponse:`ख़राब जवाब`,additionalFeedback:`अतिरिक्त फ़ीडबैक`,feedbackPlaceholder:`क्या ग़लत था? (वैकल्पिक)`,feedbackCategory:`फ़ीडबैक की श्रेणी`,selectReason:`कारण चुनें (वैकल्पिक)`,categoryFactual:`तथ्यात्मक त्रुटि`,categoryIncomplete:`अधूरा जवाब`,categoryTone:`अनुचित लहजा`,categoryOther:`अन्य`,submit:`सबमिट करें`,cancel:`रद्द करें`,feedbackThanks:`आपके फ़ीडबैक के लिए धन्यवाद`,feedbackFailed:`फ़ीडबैक नहीं भेजा जा सका`,conversationCleared:`नई बातचीत शुरू हुई। पिछले संदेश मिटा दिए गए।`,genericError:`कुछ ग़लत हो गया। कृपया फिर से कोशिश करें।`,sessionExpired:`यह चैट सत्र समाप्त हो गया है। जारी रखने के लिए पेज को फिर से लोड करें।`,opensInNewTab:`(नए टैब में खुलता है)`,agreeToNotice:`मैं सहमत हूँ`},ar:{openChat:`فتح الدردشة`,closeChat:`إغلاق الدردشة`,chatWith:`الدردشة مع {name}`,newConversation:`محادثة جديدة`,conversation:`المحادثة`,you:`أنت`,message:`الرسالة`,messagePlaceholder:`كتابة رسالة…`,send:`إرسال`,messageSent:`تم إرسال الرسالة. جارٍ إعداد الرد من قِبل {name}.`,lookingItUp:`جارٍ البحث عن المعلومات…`,goodResponse:`إجابة جيدة`,badResponse:`إجابة سيئة`,additionalFeedback:`ملاحظات إضافية`,feedbackPlaceholder:`ما المشكلة؟ (اختياري)`,feedbackCategory:`فئة الملاحظات`,selectReason:`اختر سببًا (اختياري)`,categoryFactual:`معلومات غير صحيحة`,categoryIncomplete:`إجابة غير مكتملة`,categoryTone:`أسلوب غير مناسب`,categoryOther:`أخرى`,submit:`إرسال الملاحظات`,cancel:`إلغاء`,feedbackThanks:`شكرًا على ملاحظاتك`,feedbackFailed:`تعذّر إرسال الملاحظات`,conversationCleared:`بدأت محادثة جديدة. تم مسح الرسائل السابقة.`,genericError:`حدث خطأ ما. يُرجى المحاولة مرة أخرى.`,sessionExpired:`انتهت صلاحية جلسة الدردشة هذه. يُرجى إعادة تحميل الصفحة للمتابعة.`,opensInNewTab:`(يُفتح في علامة تبويب جديدة)`,agreeToNotice:`أوافق`}},Dt=Object.freeze(Object.keys(Et)),Ot={pt:`pt-BR`,es:`es-419`,zh:`zh-Hans`},kt=new Set([`ar`]),At=/^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i,jt=/^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;function Mt(e){return Et[e]}function Nt(e){let t=e.trim();if(!At.test(t)||jt.test(t))return null;let n=t.split(/[-_]/)[0].toLowerCase();return Object.hasOwn(Et,n)?n:null}function Pt(e,t){let n=null;return e!=null&&e!==``&&(n=typeof e==`string`?Nt(e):null,n||console.warn(`whoo-aiden-widget: ignoring \`language\` ${Ft(e)} -- expected one of ${Dt.join(`, `)} (or a regional tag like pt-BR). Using the page's language instead.`)),n??=typeof t==`string`?Nt(t):null,n??=`en`,{language:n,tag:Ot[n]??n,dir:kt.has(n)?`rtl`:`ltr`}}function Ft(e){return typeof e==`string`?JSON.stringify(e):`(a ${typeof e})`}function It(e){if(typeof e!=`string`)return null;let t=e.trim().replace(/_/g,`-`);return At.test(t)?t:null}function Lt(e,t,n){if(e!=null&&e!==``){let t=It(e);if(t)return t;console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Ft(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`)}return It(t)??It(n)??``}function Rt(e){let t=e.indexOf(`{name}`);return t===-1?{before:e,after:``,hasName:!1}:{before:e.slice(0,t),after:e.slice(t+6),hasName:!0}}function zt(e,t){return e.split(`{name}`).join(t.name)}var Bt=`(max-width: 400px), (max-height: 420px)`,Vt=`data-fit-visible`,Ht=40;function Ut(e){let t=typeof window<`u`?window.visualViewport:null;if(!t)return()=>{};let n=()=>{e.removeAttribute(Vt),e.style.removeProperty(`--whoo-widget-visible-top`),e.style.removeProperty(`--whoo-widget-visible-height`)},r=()=>{let r=document.documentElement.clientHeight,i=Math.abs(t.scale-1)>.01,a=r-t.height;if(i||r===0||a<Ht){n();return}e.setAttribute(Vt,``),e.style.setProperty(`--whoo-widget-visible-top`,`${Math.max(0,t.offsetTop)}px`),e.style.setProperty(`--whoo-widget-visible-height`,`${t.height}px`);let o=e.getRootNode().activeElement;o&&e.contains(o)&&typeof o.scrollIntoView==`function`&&o.scrollIntoView({block:`nearest`})};return r(),t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r),n()}}function Wt(e,t){return typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}}var Gt=0,Kt=``;function qt(){Gt++===0&&(Kt=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`)}function Jt(){--Gt===0&&(document.documentElement.style.overflow=Kt)}function Yt(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let e=window.matchMedia(Bt),t=!1,n=()=>{e.matches&&!t?(t=!0,qt()):!e.matches&&t&&(t=!1,Jt())};n();let r=Wt(e,n);return()=>{r(),t&&(t=!1,Jt())}}function Xt(e){if(typeof window>`u`||typeof window.matchMedia!=`function`||typeof e.showModal!=`function`)return()=>{};let t=window.matchMedia(Bt),n=!1,r=()=>{if(t.matches===n||!e.isConnected)return;n=t.matches;let r=e.getRootNode().activeElement;e.close(),n?e.showModal():e.show(),r&&e.contains(r)&&r.focus({preventScroll:!0})};return r(),Wt(t,r)}function Zt(e){return e.isComposing||e.keyCode===229}function Qt({value:e,onChange:n,onSend:r,disabled:i,inputRef:a,text:o=t,contentLanguage:s}){return W(`div`,{class:`whoo-widget-composer`,children:[W(`label`,{class:`whoo-widget-sr-only`,for:`whoo-widget-composer-input`,children:o.message}),W(`input`,{id:`whoo-widget-composer-input`,class:`whoo-widget-composer-input`,lang:s,autoFocus:!0,placeholder:o.messagePlaceholder,value:e,readOnly:i,"aria-disabled":i,ref:a,onInput:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!Zt(e)&&r()}}),W(`button`,{type:`button`,class:`whoo-widget-composer-send`,"aria-disabled":i,onClick:()=>{i||r()},children:o.send})]})}function $t({message:e}){return W(`div`,{class:`whoo-widget-error-banner`,role:`alert`,children:e})}var en=/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y,tn=/\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y,nn=/(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y,rn=/\*([^*\s](?:[^*]*[^*\s])?)\*/y,an=/[ \t]*[*+-][ \t]+/y,on=/https?:\/\/\S+/y,sn=/[.,;:!?)\]}>]+$/;function cn(e){let t=[],n=0,r=0,i=n=>{n>r&&t.push({type:`text`,value:e.slice(r,n),start:r,end:n})};for(;n<e.length;){if((n===0||e[n-1]===`
|
|
2
|
+
`)&&(an.lastIndex=n,an.exec(e))){i(n),t.push({type:`text`,value:`• `,start:n,end:an.lastIndex}),n=an.lastIndex,r=n;continue}if(e[n]===`!`&&n+1<e.length&&e[n+1]===`[`){let t=/!\[([^\]]*)\]\(([^)]*)\)/y;t.lastIndex=n;let r=t.exec(e);if(r){n+=r[0].length;continue}}if(e[n-1]!==`!`){en.lastIndex=n;let a=en.exec(e);if(a){i(n),t.push({type:`link`,text:a[1],url:a[2],start:n,end:en.lastIndex}),n=en.lastIndex,r=n;continue}}tn.lastIndex=n;let a=tn.exec(e);if(a){i(n),t.push({type:`bold`,value:a[1],start:n,end:tn.lastIndex}),n=tn.lastIndex,r=n;continue}nn.lastIndex=n;let o=nn.exec(e);if(o){i(n),t.push({type:`italic`,value:o[1],start:n,end:nn.lastIndex}),n=nn.lastIndex,r=n;continue}rn.lastIndex=n;let s=rn.exec(e);if(s){i(n),t.push({type:`italic`,value:s[1],start:n,end:rn.lastIndex}),n=rn.lastIndex,r=n;continue}on.lastIndex=n;let c=on.exec(e);if(c){let e=c[0].match(sn),a=e?c[0].slice(0,c[0].length-e[0].length):c[0];if(a.length>0){i(n),t.push({type:`link`,text:a,url:a,start:n,end:n+a.length}),n+=a.length,r=n;continue}}n+=1}return i(e.length),t}var ln=/^[ \t]*[*+-][ \t]+(.*)$/,un=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;function dn(e){let t=e.match(/\p{L}/u)?.[0];if(t)return un.test(t)?`rtl`:`ltr`}function fn(e){let t=[],n=[],r=[],i=()=>{n.length>0&&t.push({type:`text`,text:n.join(`
|
|
3
3
|
`)}),n=[]},a=()=>{r.length>0&&t.push({type:`list`,items:r}),r=[]};for(let t of e.split(`
|
|
4
|
-
`)){let e=t.match(
|
|
5
|
-
`),r=dn(n);return r?r.map((e,n)=>e.type===`list`?W(`ul`,{class:`whoo-widget-list`,dir:un(e.items.find(e=>un(e))??``),children:e.items.map((e,n)=>W(`li`,{dir:un(e),children:K(e,t)},n))},n):W(`span`,{children:K(e.text,t)},n)):K(n,t)}function pn(e){return[{value:``,label:e.selectReason},{value:`factual`,label:e.categoryFactual},{value:`incomplete`,label:e.categoryIncomplete},{value:`tone`,label:e.categoryTone},{value:`other`,label:e.categoryOther}]}function mn({state:e,containerRef:n,onThumbsUp:r,onThumbsDown:i,onDraftChange:a,onSubmitDetailed:o,onCancel:s,text:c=t,contentLanguage:l}){let u=e.correction??``,d=e.category??``,f=H(e.status),p=H(null),m=H(null);if(V(()=>{let t=f.current;if(f.current=e.status,t===e.status)return;if(e.status===`expanded`){p.current?.focus();return}if(t===`expanded`&&e.status===`idle`){m.current?.focus();return}let r=n?.current;if(!r)return;let i=r.getRootNode(),a=r.ownerDocument,o=i.activeElement;(o===null?a.activeElement===null||a.activeElement===a.body:o===a.body)&&r.focus()},[e.status,n]),e.status===`expanded`)return W(`div`,{class:`whoo-widget-feedback-form`,children:[W(`label`,{children:[W(`span`,{class:`whoo-widget-sr-only`,children:c.additionalFeedback}),W(`textarea`,{ref:p,class:`whoo-widget-feedback-textarea`,lang:l,value:u,onInput:e=>a(e.target.value,d),placeholder:c.feedbackPlaceholder})]}),W(`select`,{class:`whoo-widget-feedback-select`,"aria-label":c.feedbackCategory,value:d,onChange:e=>a(u,e.target.value),children:pn(c).map(e=>W(`option`,{value:e.value,children:e.label},e.value))}),W(`div`,{class:`whoo-widget-feedback-form-buttons`,children:[W(`button`,{type:`button`,class:`whoo-widget-feedback-submit`,onClick:()=>o(u,d),children:c.submit}),W(`button`,{type:`button`,class:`whoo-widget-feedback-cancel`,onClick:s,children:c.cancel})]})]});let h=e.status===`submitting`,g=e.status===`submitted`;return W(`div`,{class:`whoo-widget-feedback`,children:[g?null:W(`div`,{class:`whoo-widget-feedback-buttons`,children:[W(`button`,{type:`button`,"aria-label":c.goodResponse,"aria-disabled":h,onClick:()=>{h||r()},children:W(xt,{})}),W(`button`,{ref:m,type:`button`,"aria-label":c.badResponse,"aria-disabled":h,onClick:()=>{h||i()},children:W(St,{})})]}),W(`div`,{role:`status`,class:g?`whoo-widget-feedback-submitted`:e.status===`error`?`whoo-widget-feedback-error`:void 0,children:g?c.feedbackThanks:e.status===`error`?c.feedbackFailed:null})]})}function hn({isSlowResponse:e,text:t}){return W(`div`,{class:`whoo-widget-pending`,role:`status`,children:[W(`span`,{class:`whoo-widget-typing`,"aria-hidden":`true`,children:[W(`span`,{}),W(`span`,{}),W(`span`,{})]}),e?W(`span`,{class:`whoo-widget-pending-text`,children:t.lookingItUp}):null]})}function gn({url:e,alt:t,lang:n}){let[r,i]=rt(!1);return r?null:W(`img`,{class:`whoo-widget-empty-state-image`,src:e,alt:t,lang:n,referrerpolicy:`no-referrer`,onError:()=>i(!0)})}var _n=`whoo-widget-notice`;function vn({notice:e,placement:t=`top`,text:n,contentLanguage:r,languageTag:i}){return t===`footer`?W(`div`,{id:_n,class:`whoo-widget-notice-footer`,role:`note`,tabIndex:0,children:W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:fn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})}):W(`div`,{id:_n,class:`whoo-widget-notice`,role:`note`,children:W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:fn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})})}function yn({message:e,speaker:t,feedbackState:n,showFeedback:r,pending:i,isSlowResponse:a,onThumbsUp:o,onThumbsDown:s,onDraftChange:c,onSubmitDetailed:l,onCancelFeedback:u,text:d,contentLanguage:f,languageTag:p}){let m=H(null),h=e.id;return W(`div`,{ref:m,tabIndex:-1,class:`whoo-widget-message whoo-widget-message--${e.role}`,children:[W(`span`,{class:`whoo-widget-sr-only`,children:[e.role===`assistant`?W(`span`,{lang:f,children:t}):t,`:`,` `]}),i?W(hn,{isSlowResponse:a,text:d}):W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:f,children:fn(e.content,{linkCue:d.opensInNewTab,linkCueLang:p})}),r&&e.role===`assistant`&&h?W(mn,{state:n,containerRef:m,onThumbsUp:()=>o(h),onThumbsDown:()=>s(h),onDraftChange:(e,t)=>c(h,e,t),onSubmitDetailed:(e,t)=>l(h,e,t),onCancel:()=>u(h),text:d,contentLanguage:f}):null]})}function bn({messages:e,messageFeedback:n,announcement:r,emptyStateImage:i,centerEmptyState:a=!1,centeredGreeting:o,notice:s,agentName:c=u,showFeedback:l=!1,isStreaming:d=!1,isSlowResponse:f=!1,onThumbsUp:p,onThumbsDown:m,onDraftChange:h=()=>{},onSubmitDetailed:g,onCancelFeedback:_,text:v=t,contentLanguage:y,languageTag:b,announcementIsContent:x=!1}){let S=H(null),C=!!s&&!e.some(e=>e.role===`user`);at(()=>{let e=S.current;e&&(e.scrollTop=C?0:e.scrollHeight)},[e,f,C]);let w=i?W(gn,{...i,lang:y}):null,T=a&&e.length===0&&(i||o);return W(I,{children:[W(`section`,{class:`whoo-widget-message-list${T?` whoo-widget-message-list--centered`:``}`,ref:S,"aria-label":v.conversation,tabIndex:0,children:[a?null:w,s?W(vn,{notice:s,text:v,contentLanguage:y,languageTag:b}):null,T?W(`div`,{class:`whoo-widget-empty-state`,children:[w,o?W(`div`,{class:`whoo-widget-empty-state-greeting whoo-widget-message-text`,dir:`auto`,lang:y,children:fn(o,{linkCue:v.opensInNewTab,linkCueLang:b})}):null]}):null,e.map((t,r)=>W(yn,{message:t,speaker:t.role===`user`?v.you:c,showFeedback:l,feedbackState:t.id?n[t.id]??{status:`idle`}:{status:`idle`},pending:d&&r===e.length-1&&t.role===`assistant`&&t.content===``,isSlowResponse:f,onThumbsUp:p,onThumbsDown:m,onDraftChange:h,onSubmitDetailed:g,onCancelFeedback:_,text:v,contentLanguage:y,languageTag:b},t.id??r))]}),W(`div`,{class:`whoo-widget-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,lang:x?y:b,children:r??``})]})}var xn=`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`;function Sn(e){return Array.from(e.querySelectorAll(xn)).filter(e=>{let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}function Cn({state:e,controller:t,greeting:n}){let r=H(null),i=H(null),a=H(null),o=H(!1);V(()=>{(a.current??i.current)?.focus()},[]),V(()=>{e.noticeAgreed&&o.current&&(o.current=!1,i.current?.focus())},[e.noticeAgreed]),V(()=>{let e=r.current,n=e?Ht(e):()=>{},i=e?Yt(e):()=>{},a=()=>{e&&!e.open&&t.close()};e?.addEventListener(`close`,a);let o=Jt();return()=>{n(),i(),e?.removeEventListener(`close`,a),o()}},[]);let s=e=>{if(e.key===`Escape`&&!Xt(e)){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=r.current;if(!n)return;let i=Sn(n);if(i.length===0)return;let a=n.getRootNode().activeElement;e.preventDefault();let o=i.length-1,s,c=a?i.indexOf(a):-1;if(c!==-1)s=(c+(e.shiftKey?-1:1)+i.length)%i.length;else if(a&&a!==n&&n.contains(a)){let t=i.findIndex(e=>a.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING);s=e.shiftKey?t<=0?o:t-1:t===-1?0:t}else s=e.shiftKey?o:0;i[s].focus()},c=()=>{let n=e.draft.trim();n&&!e.isStreaming&&(t.setDraft(``),t.sendMessage(n))},l=d(t.config.name)||e.agentName||`Aiden`,u=d(t.config.title),{before:f,after:p,hasName:m}=Rt(t.text.chatWith),h=t.greetingStyle===`centered`,g=e.messages.length===0&&n&&!h?[{role:`assistant`,content:n,id:null}]:e.messages,_=e.messages.length===0&&h?n:void 0,v=t.notice!==``&&t.noticePlacement===`footer`,y=t.emptyStateImageUrl,b=e.messages.length===0&&y?{url:y,alt:t.emptyStateImageAlt}:void 0;return W(`dialog`,{open:!0,class:`whoo-widget-panel`,"aria-modal":`true`,"aria-labelledby":`whoo-widget-title`,"aria-describedby":t.notice&&e.noticeAgreed&&e.messages.length===0?_n:void 0,ref:r,onKeyDown:s,onCancel:e=>{e.preventDefault(),t.close()},children:[W(`div`,{class:`whoo-widget-header`,children:[W(`div`,{class:`whoo-widget-header-titles`,children:[u?W(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,lang:t.contentLanguage,dir:`auto`,children:u}):W(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,children:[f,m?W(`bdi`,{lang:t.contentLanguage,children:l}):null,p]}),t.subtitle?W(`p`,{class:`whoo-widget-header-subtitle`,lang:t.contentLanguage,dir:`auto`,children:t.subtitle}):null]}),W(`div`,{class:`whoo-widget-header-actions`,children:[e.messages.length>0&&W(`button`,{type:`button`,class:`whoo-widget-header-reset`,onClick:()=>{t.resetConversation(),i.current?.focus()},children:t.text.newConversation}),W(`button`,{type:`button`,class:`whoo-widget-header-close`,"aria-label":t.text.closeChat,onClick:()=>t.close(),children:W(yt,{})})]})]}),W(bn,{messages:g,messageFeedback:e.messageFeedback,announcement:e.announcement,emptyStateImage:b,centerEmptyState:h,centeredGreeting:_,notice:v?void 0:t.notice,agentName:l,showFeedback:t.showFeedback,isStreaming:e.isStreaming,isSlowResponse:e.isSlowResponse,onThumbsUp:e=>t.submitFeedback(e,`up`),onThumbsDown:e=>t.expandFeedback(e),onDraftChange:(e,n,r)=>t.setFeedbackDraft(e,n,r),onSubmitDetailed:(e,n,r)=>t.submitFeedback(e,`down`,n||void 0,r||void 0),onCancelFeedback:e=>t.cancelFeedback(e),text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag,announcementIsContent:e.announcementIsContent}),e.runtimeError&&W(Qt,{message:e.runtimeError}),e.noticeAgreed?W(Zt,{value:e.draft,onChange:e=>t.setDraft(e),onSend:c,disabled:e.isStreaming,inputRef:i,text:t.text,contentLanguage:t.contentLanguage}):W(`div`,{class:`whoo-widget-agreement`,children:W(`button`,{type:`button`,class:`whoo-widget-agreement-button`,ref:a,"aria-describedby":_n,autoFocus:!0,onClick:()=>{o.current=!0,t.agreeToNotice()},children:t.text.agreeToNotice})}),v?W(vn,{notice:t.notice,placement:`footer`,text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag}):null]})}function wn({controller:e}){let[t,n]=rt(e.getState()),r=H(null),i=H(t.isOpen);return at(()=>(n(e.getState()),e.subscribe(n)),[e]),V(()=>{i.current&&!t.isOpen&&r.current?.focus(),i.current=t.isOpen},[t.isOpen]),t.initError||t.isInitializing?null:W(I,{children:[W(Tt,{isOpen:t.isOpen,onClick:()=>t.isOpen?e.close():e.open(),iconUrl:e.launcher.iconUrl,icon:e.launcher.icon,openIconUrl:e.launcher.openIconUrl,openIcon:e.launcher.openIcon,buttonRef:r,text:e.text}),t.isOpen&&W(Cn,{state:t,controller:e,greeting:e.config.greeting})]})}var Tn=class extends Error{status;constructor(e,t){super(e),this.name=`WidgetApiError`,this.status=t}};function En(e){if(typeof e!=`string`)return null;let t=e.trim();return t===``?null:t}async function Dn(e,t){let n=await fetch(`${e}/api/v1/widget/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({publishable_key:t})});if(!n.ok)throw new Tn(`Failed to create widget session (${n.status})`,n.status);let r=await n.json();return{token:r.token,...On(r)}}function On(e){return{primaryColor:En(e.primary_color),name:En(e.name),accentColor:En(e.accent_color),inkColor:En(e.ink_color)}}async function kn(e,t){let n=await fetch(`${e}/api/v1/widget/branding`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new Tn(`Failed to load widget branding (${n.status})`,n.status);return On(await n.json())}async function An(e,t,n){let r=await fetch(`${e}/api/v1/widget/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({message_id:n.messageId,rating:n.rating,correction:n.correction??null,category:n.category??null})});if(!r.ok)throw new Tn(`Feedback submission failed (${r.status})`,r.status)}async function*jn(e,t,n,r,i){let a=await fetch(`${e}/api/v1/widget/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({conversation_id:n,message:r}),signal:i});if(!a.ok||!a.body)throw new Tn(`Chat request failed (${a.status})`,a.status);let o=a.body.getReader(),s=new TextDecoder,c=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;c+=s.decode(t,{stream:!0});let n=c.indexOf(`
|
|
4
|
+
`)){let e=t.match(ln);e?(i(),r.push(e[1])):(a(),n.push(t))}return i(),a(),t.some(e=>e.type===`list`)?t.flatMap((e,n)=>{if(e.type===`list`)return[e];let{text:r}=e;return t[n-1]?.type===`list`&&(r=r.replace(/^(?:[ \t]*\n)+/,``)),t[n+1]?.type===`list`&&(r=r.replace(/(?:\n[ \t]*)+$/,``)),r.trim()===``?[]:[{type:`text`,text:r}]}):null}function K(e,t={}){return cn(e).map((e,n)=>{switch(e.type){case`bold`:return W(`strong`,{children:K(e.value,t)},n);case`italic`:return W(`em`,{children:K(e.value,t)},n);case`link`:return W(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[e.text,W(`span`,{class:`whoo-widget-sr-only`,lang:t.linkCueLang,children:[` `,t.linkCue??`(opens in new tab)`]})]},n);default:return e.value}})}function pn(e,t={}){let n=e.replace(/\r\n?/g,`
|
|
5
|
+
`),r=fn(n);return r?r.map((e,n)=>e.type===`list`?W(`ul`,{class:`whoo-widget-list`,dir:dn(e.items.find(e=>dn(e))??``),children:e.items.map((e,n)=>W(`li`,{dir:dn(e),children:K(e,t)},n))},n):W(`span`,{children:K(e.text,t)},n)):K(n,t)}function mn(e){return[{value:``,label:e.selectReason},{value:`factual`,label:e.categoryFactual},{value:`incomplete`,label:e.categoryIncomplete},{value:`tone`,label:e.categoryTone},{value:`other`,label:e.categoryOther}]}function hn({state:e,containerRef:n,onThumbsUp:r,onThumbsDown:i,onDraftChange:a,onSubmitDetailed:o,onCancel:s,text:c=t,contentLanguage:l}){let u=e.correction??``,d=e.category??``,f=H(e.status),p=H(null),m=H(null);if(V(()=>{let t=f.current;if(f.current=e.status,t===e.status)return;if(e.status===`expanded`){p.current?.focus();return}if(t===`expanded`&&e.status===`idle`){m.current?.focus();return}let r=n?.current;if(!r)return;let i=r.getRootNode(),a=r.ownerDocument,o=i.activeElement;(o===null?a.activeElement===null||a.activeElement===a.body:o===a.body)&&r.focus()},[e.status,n]),e.status===`expanded`)return W(`div`,{class:`whoo-widget-feedback-form`,children:[W(`label`,{children:[W(`span`,{class:`whoo-widget-sr-only`,children:c.additionalFeedback}),W(`textarea`,{ref:p,class:`whoo-widget-feedback-textarea`,lang:l,value:u,onInput:e=>a(e.target.value,d),placeholder:c.feedbackPlaceholder})]}),W(`select`,{class:`whoo-widget-feedback-select`,"aria-label":c.feedbackCategory,value:d,onChange:e=>a(u,e.target.value),children:mn(c).map(e=>W(`option`,{value:e.value,children:e.label},e.value))}),W(`div`,{class:`whoo-widget-feedback-form-buttons`,children:[W(`button`,{type:`button`,class:`whoo-widget-feedback-submit`,onClick:()=>o(u,d),children:c.submit}),W(`button`,{type:`button`,class:`whoo-widget-feedback-cancel`,onClick:s,children:c.cancel})]})]});let h=e.status===`submitting`,g=e.status===`submitted`;return W(`div`,{class:`whoo-widget-feedback`,children:[g?null:W(`div`,{class:`whoo-widget-feedback-buttons`,children:[W(`button`,{type:`button`,"aria-label":c.goodResponse,"aria-disabled":h,onClick:()=>{h||r()},children:W(xt,{})}),W(`button`,{ref:m,type:`button`,"aria-label":c.badResponse,"aria-disabled":h,onClick:()=>{h||i()},children:W(St,{})})]}),W(`div`,{role:`status`,class:g?`whoo-widget-feedback-submitted`:e.status===`error`?`whoo-widget-feedback-error`:void 0,children:g?c.feedbackThanks:e.status===`error`?c.feedbackFailed:null})]})}function gn({isSlowResponse:e,text:t}){return W(`div`,{class:`whoo-widget-pending`,children:[W(`span`,{class:`whoo-widget-typing`,"aria-hidden":`true`,children:[W(`span`,{}),W(`span`,{}),W(`span`,{})]}),e?W(`span`,{class:`whoo-widget-pending-text`,children:t.lookingItUp}):null]})}function _n({url:e,alt:t,lang:n}){let[r,i]=rt(!1);return r?null:W(`img`,{class:`whoo-widget-empty-state-image`,src:e,alt:t,lang:n,referrerpolicy:`no-referrer`,onError:()=>i(!0)})}var vn=`whoo-widget-notice`;function yn({notice:e,placement:t=`top`,text:n,contentLanguage:r,languageTag:i}){return t===`footer`?W(`div`,{id:vn,class:`whoo-widget-notice-footer`,role:`note`,tabIndex:0,children:W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:pn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})}):W(`div`,{id:vn,class:`whoo-widget-notice`,role:`note`,children:W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:pn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})})}function bn({message:e,speaker:t,feedbackState:n,showFeedback:r,pending:i,isSlowResponse:a,onThumbsUp:o,onThumbsDown:s,onDraftChange:c,onSubmitDetailed:l,onCancelFeedback:u,text:d,contentLanguage:f,languageTag:p}){let m=H(null),h=e.id;return W(`div`,{ref:m,tabIndex:-1,class:`whoo-widget-message whoo-widget-message--${e.role}`,children:[W(`span`,{class:`whoo-widget-sr-only`,children:[e.role===`assistant`?W(`span`,{lang:f,children:t}):t,`:`,` `]}),i?W(gn,{isSlowResponse:a,text:d}):W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:f,children:pn(e.content,{linkCue:d.opensInNewTab,linkCueLang:p})}),r&&e.role===`assistant`&&h?W(hn,{state:n,containerRef:m,onThumbsUp:()=>o(h),onThumbsDown:()=>s(h),onDraftChange:(e,t)=>c(h,e,t),onSubmitDetailed:(e,t)=>l(h,e,t),onCancel:()=>u(h),text:d,contentLanguage:f}):null]})}function xn({messages:e,messageFeedback:n,announcement:r,emptyStateImage:i,centerEmptyState:a=!1,centeredGreeting:o,notice:s,agentName:c=u,showFeedback:l=!1,isStreaming:d=!1,isSlowResponse:f=!1,onThumbsUp:p,onThumbsDown:m,onDraftChange:h=()=>{},onSubmitDetailed:g,onCancelFeedback:_,text:v=t,contentLanguage:y,languageTag:b,announcementIsContent:x=!1}){let S=H(null),C=!!s&&!e.some(e=>e.role===`user`);at(()=>{let e=S.current;e&&(e.scrollTop=C?0:e.scrollHeight)},[e,f,C]);let w=i?W(_n,{...i,lang:y}):null,T=a&&e.length===0&&(i||o);return W(I,{children:[W(`section`,{class:`whoo-widget-message-list${T?` whoo-widget-message-list--centered`:``}`,ref:S,"aria-label":v.conversation,tabIndex:0,children:[a?null:w,s?W(yn,{notice:s,text:v,contentLanguage:y,languageTag:b}):null,T?W(`div`,{class:`whoo-widget-empty-state`,children:[w,o?W(`div`,{class:`whoo-widget-empty-state-greeting whoo-widget-message-text`,dir:`auto`,lang:y,children:pn(o,{linkCue:v.opensInNewTab,linkCueLang:b})}):null]}):null,e.map((t,r)=>W(bn,{message:t,speaker:t.role===`user`?v.you:c,showFeedback:l,feedbackState:t.id?n[t.id]??{status:`idle`}:{status:`idle`},pending:d&&r===e.length-1&&t.role===`assistant`&&t.content===``,isSlowResponse:f,onThumbsUp:p,onThumbsDown:m,onDraftChange:h,onSubmitDetailed:g,onCancelFeedback:_,text:v,contentLanguage:y,languageTag:b},t.id??r))]}),W(`div`,{class:`whoo-widget-sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,lang:x?y:b,children:r??``})]})}var Sn=`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`;function Cn(e){return Array.from(e.querySelectorAll(Sn)).filter(e=>{let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}function wn({state:e,controller:t,greeting:n}){let r=H(null),i=H(null),a=H(null),o=H(!1);V(()=>{(a.current??i.current)?.focus()},[]),V(()=>{e.noticeAgreed&&o.current&&(o.current=!1,i.current?.focus())},[e.noticeAgreed]),V(()=>{let e=r.current,n=e?Ut(e):()=>{},i=e?Xt(e):()=>{},a=()=>{e&&!e.open&&t.close()};e?.addEventListener(`close`,a);let o=Yt();return()=>{n(),i(),e?.removeEventListener(`close`,a),o()}},[]);let s=e=>{if(e.key===`Escape`&&!Zt(e)){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=r.current;if(!n)return;let i=Cn(n);if(i.length===0)return;let a=n.getRootNode().activeElement;e.preventDefault();let o=i.length-1,s,c=a?i.indexOf(a):-1;if(c!==-1)s=(c+(e.shiftKey?-1:1)+i.length)%i.length;else if(a&&a!==n&&n.contains(a)){let t=i.findIndex(e=>a.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING);s=e.shiftKey?t<=0?o:t-1:t===-1?0:t}else s=e.shiftKey?o:0;i[s].focus()},c=()=>{let n=e.draft.trim();n&&!e.isStreaming&&(t.setDraft(``),t.sendMessage(n))},l=t.resolvedAgentName,u=d(t.config.title),{before:f,after:p,hasName:m}=Rt(t.text.chatWith),h=t.greetingStyle===`centered`,g=e.messages.length===0&&n&&!h?[{role:`assistant`,content:n,id:null}]:e.messages,_=e.messages.length===0&&h?n:void 0,v=t.notice!==``&&t.noticePlacement===`footer`,y=t.emptyStateImageUrl,b=e.messages.length===0&&y?{url:y,alt:t.emptyStateImageAlt}:void 0;return W(`dialog`,{open:!0,class:`whoo-widget-panel`,"aria-modal":`true`,"aria-labelledby":`whoo-widget-title`,"aria-describedby":t.notice&&e.noticeAgreed&&e.messages.length===0?vn:void 0,ref:r,onKeyDown:s,onCancel:e=>{e.preventDefault(),t.close()},children:[W(`div`,{class:`whoo-widget-header`,children:[W(`div`,{class:`whoo-widget-header-titles`,children:[u?W(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,lang:t.contentLanguage,dir:`auto`,children:u}):W(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,children:[f,m?W(`bdi`,{lang:t.contentLanguage,children:l}):null,p]}),t.subtitle?W(`p`,{class:`whoo-widget-header-subtitle`,lang:t.contentLanguage,dir:`auto`,children:t.subtitle}):null]}),W(`div`,{class:`whoo-widget-header-actions`,children:[e.messages.length>0&&W(`button`,{type:`button`,class:`whoo-widget-header-reset`,onClick:()=>{t.resetConversation(),i.current?.focus()},children:t.text.newConversation}),W(`button`,{type:`button`,class:`whoo-widget-header-close`,"aria-label":t.text.closeChat,onClick:()=>t.close(),children:W(yt,{})})]})]}),W(xn,{messages:g,messageFeedback:e.messageFeedback,announcement:e.announcement,emptyStateImage:b,centerEmptyState:h,centeredGreeting:_,notice:v?void 0:t.notice,agentName:l,showFeedback:t.showFeedback,isStreaming:e.isStreaming,isSlowResponse:e.isSlowResponse,onThumbsUp:e=>t.submitFeedback(e,`up`),onThumbsDown:e=>t.expandFeedback(e),onDraftChange:(e,n,r)=>t.setFeedbackDraft(e,n,r),onSubmitDetailed:(e,n,r)=>t.submitFeedback(e,`down`,n||void 0,r||void 0),onCancelFeedback:e=>t.cancelFeedback(e),text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag,announcementIsContent:e.announcementIsContent}),e.runtimeError&&W($t,{message:e.runtimeError}),e.noticeAgreed?W(Qt,{value:e.draft,onChange:e=>t.setDraft(e),onSend:c,disabled:e.isStreaming,inputRef:i,text:t.text,contentLanguage:t.contentLanguage}):W(`div`,{class:`whoo-widget-agreement`,children:W(`button`,{type:`button`,class:`whoo-widget-agreement-button`,ref:a,"aria-describedby":vn,autoFocus:!0,onClick:()=>{o.current=!0,t.agreeToNotice()},children:t.text.agreeToNotice})}),v?W(yn,{notice:t.notice,placement:`footer`,text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag}):null]})}function Tn({controller:e}){let[t,n]=rt(e.getState()),r=H(null),i=H(t.isOpen);return at(()=>(n(e.getState()),e.subscribe(n)),[e]),V(()=>{i.current&&!t.isOpen&&r.current?.focus(),i.current=t.isOpen},[t.isOpen]),t.initError||t.isInitializing?null:W(I,{children:[W(Tt,{isOpen:t.isOpen,onClick:()=>t.isOpen?e.close():e.open(),iconUrl:e.launcher.iconUrl,icon:e.launcher.icon,openIconUrl:e.launcher.openIconUrl,openIcon:e.launcher.openIcon,buttonRef:r,text:e.text}),t.isOpen&&W(wn,{state:t,controller:e,greeting:e.config.greeting})]})}var En=class extends Error{status;constructor(e,t){super(e),this.name=`WidgetApiError`,this.status=t}};function Dn(e){if(typeof e!=`string`)return null;let t=e.trim();return t===``?null:t}async function On(e,t){let n=await fetch(`${e}/api/v1/widget/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({publishable_key:t})});if(!n.ok)throw new En(`Failed to create widget session (${n.status})`,n.status);let r=await n.json();return{token:r.token,...kn(r)}}function kn(e){return{primaryColor:Dn(e.primary_color),name:Dn(e.name),accentColor:Dn(e.accent_color),inkColor:Dn(e.ink_color)}}async function An(e,t){let n=await fetch(`${e}/api/v1/widget/branding`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new En(`Failed to load widget branding (${n.status})`,n.status);return kn(await n.json())}async function jn(e,t,n){let r=await fetch(`${e}/api/v1/widget/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({message_id:n.messageId,rating:n.rating,correction:n.correction??null,category:n.category??null})});if(!r.ok)throw new En(`Feedback submission failed (${r.status})`,r.status)}async function*Mn(e,t,n,r,i){let a=await fetch(`${e}/api/v1/widget/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({conversation_id:n,message:r}),signal:i});if(!a.ok||!a.body)throw new En(`Chat request failed (${a.status})`,a.status);let o=a.body.getReader(),s=new TextDecoder,c=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;c+=s.decode(t,{stream:!0});let n=c.indexOf(`
|
|
6
6
|
|
|
7
7
|
`);for(;n!==-1;){let e=c.slice(0,n);c=c.slice(n+2);let t=e.split(`
|
|
8
|
-
`).find(e=>e.startsWith(`data: `));if(i?.aborted)return;t&&(yield
|
|
8
|
+
`).find(e=>e.startsWith(`data: `));if(i?.aborted)return;t&&(yield Nn(JSON.parse(t.slice(6)))),n=c.indexOf(`
|
|
9
9
|
|
|
10
|
-
`)}}}function
|
|
11
|
-
`)).map(e=>{switch(e.type){case`bold`:case`italic`:return Nn(e.value);case`link`:return e.text;default:return e.value}}).join(``)}var Pn=40,Fn=120;function In(e){let t=[];for(let n of sn(e))if(n.type===`text`){let e=n.value.split(/(\s+)/),r=n.start;for(let n of e)r+=n.length,n.trim().length>0&&t.push(r)}else t.push(n.end);return t}function Ln(e){let t=null;return e?.addEventListener(`abort`,()=>{t?.()},{once:!0}),function(e){return new Promise(n=>{let r=setTimeout(()=>{t=null,n()},e);t=()=>{clearTimeout(r),t=null,n()}})}}async function Rn(e,t,n){let r=n?.wordIntervalMs??Pn,i=n?.tokenIntervalMs??Fn,a=n?.signal,o=sn(e),s=new Set(o.filter(e=>e.type!==`text`).map(e=>e.end)),c=Ln(a),l=``;for(let n of In(e))if(a?.aborted||(l=e.slice(0,n),t(l),await c(s.has(n)?i:r),a?.aborted))return;l!==e&&t(e)}function zn(e){let t=e.split(`.`);if(t.length!==3||t.some(e=>e===``))return null;let n=t[1];try{let e=n.replace(/-/g,`+`).replace(/_/g,`/`),t=JSON.parse(atob(e.padEnd(Math.ceil(e.length/4)*4,`=`))),r=e=>typeof e==`number`&&Number.isFinite(e)?e:null,{exp:i,iat:a}=t??{};return{exp:r(i),iat:r(a)}}catch{return null}}function Bn(e){let t=zn(e)?.exp;return typeof t==`number`?t*1e3:null}function Vn(e,t=Date.now()){let n=Bn(e);return n!==null&&n<=t}function Hn(e,t=Date.now()){let n=zn(e);return n?.exp==null?null:n.iat!=null&&n.exp>n.iat?t+(n.exp-n.iat)*1e3:n.exp*1e3}function Un(e){return`whoo-aiden-widget:conversation:${e}`}function Wn(e){try{return window.sessionStorage.getItem(Un(e))}catch{return null}}function Gn(e,t){try{window.sessionStorage.setItem(Un(e),t)}catch{}}function Kn(e){return`whoo-aiden-widget:notice-agreed:${e}`}function qn(e,t){try{return window.sessionStorage.getItem(Kn(e))===t}catch{return!1}}function Jn(e,t){try{window.sessionStorage.setItem(Kn(e),t)}catch{}}function Yn(e){try{window.sessionStorage.removeItem(Un(e))}catch{}}var Xn=/^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;function Zn(e){if(Xn.test(e.trim()))return null;let t=document.createElement(`div`);if(t.style.color=e,t.style.color===``)return null;let n=document.createElement(`div`);n.attachShadow({mode:`open`}).appendChild(t),document.body.appendChild(n);let r=getComputedStyle(t).color;n.remove();let i=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);if(!i)return null;let a=i[4]===void 0?1:Number(i[4]);return{rgb:[Number(i[1]),Number(i[2]),Number(i[3])].map(e=>Math.round(e*a+255*(1-a))),translucent:a<1}}function q(e){return Zn(e)?.rgb??null}function J([e,t,n]){let r=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function Qn(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function $n(e){let t=q(e);if(!t)return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`),`#ffffff`;let n=J(t);return Qn(n,J([0,0,0]))>=Qn(n,J([255,255,255]))?`#000000`:`#ffffff`}function er(e,t){let n=q(e),r=q(t);return!n||!r?NaN:Qn(J(n),J(r))}var tr=a.primary,nr=a.panel,rr=a.assistantBubble,ir=a.headerHover,ar=4.5;function Y([e,t,n]){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function or(e,t=nr){let n=q(e),r=q(t);if(!n||!r)return tr;let i=J(r),a=e=>Qn(J(e),i)>=ar;if(a(n))return Y(n);for(let e=.99;e>0;e-=.01){let t=n.map(t=>Math.round(t*e));if(a(t))return Y(t)}return`#000000`}var sr=a.ink,cr=a.link;function X(e){if(typeof e!=`string`||!e)return null;let t=Zn(e);return t?Y(t.rgb):null}function lr(e){if(typeof e!=`string`||!e)return null;let t=Zn(e);return t?t.translucent?e.trim():Y(t.rgb):null}var ur=[{role:`onPrimary`,against:[`primary`],required:4.5},{role:`primaryText`,against:[`panel`,`headerHover`],required:4.5},{role:`ink`,against:[`assistantBubble`,`panel`],required:4.5},{role:`link`,against:[`assistantBubble`,`panel`],required:4.5},{role:`muted`,against:[`assistantBubble`,`panel`],required:4.5},{role:`text`,against:[`panel`,`assistantBubble`],required:4.5},{role:`errorText`,against:[`errorBackground`],required:4.5},{role:`typingDots`,against:[`assistantBubble`],required:3},{role:`inputBorder`,against:[`panel`],required:3},{role:`focusRing`,against:[`panel`],required:3}];function dr({color:e,inkColor:t,accentColor:n,overrides:r}){let o=typeof r==`object`&&r&&!Array.isArray(r)?r:{},s=e=>lr(o[e]),c=X(e),l=s(`primary`),u=l??c??tr,d=s(`primaryText`),f=d??or(u,ir),p=s(`onPrimary`)??$n(u),m=X(t),h=s(`ink`)??(m?or(m,rr):sr),g=X(n),_=s(`link`)??(g?or(g,rr):cr),v=e=>s(e)??a[e],y={primary:u,onPrimary:p,primaryText:f,ink:h,link:_,text:v(`text`),panel:v(`panel`),border:v(`border`),headerHover:v(`headerHover`),assistantBubble:v(`assistantBubble`),muted:v(`muted`),typingDots:v(`typingDots`),errorBackground:v(`errorBackground`),errorText:v(`errorText`),inputBorder:v(`inputBorder`),focusRing:v(`focusRing`)},b=Object.fromEntries(i.map(e=>[e,s(e)!==null])),x=[];for(let{role:e,against:t,required:n}of ur)for(let r of t){if(!b[e]&&!b[r])continue;let t=er(y[e],y[r]);Number.isFinite(t)&&t<n&&x.push({role:e,against:r,value:y[e],ratio:t,required:n,overridden:b[e]})}return{primary:u,textOnPrimary:p,primaryAsText:f,ink:h,link:_,adjusted:{primary:l===null&&d===null&&c!==null&&f!==u,ink:!b.ink&&m!==null&&h!==m,link:!b.link&&g!==null&&_!==g},roles:y,overridden:b,contrastWarnings:x}}function Z(e){return typeof e==`string`?`"${e}"`:`a ${typeof e} value`}function fr(e,t,n=tr){let r=t;X(t)===null&&(console.warn(`[whoo-aiden-widget] Could not use ${Z(t)} as the theme color; falling back to ${Z(n)}.`),r=n);let i=dr({color:r});e.style.setProperty(`--whoo-widget-color`,i.primary),e.style.setProperty(`--whoo-widget-text-on-color`,i.textOnPrimary),e.style.setProperty(`--whoo-widget-color-text`,i.primaryAsText)}function pr(e,{inkColor:t,accentColor:n}){let r=dr({inkColor:t,accentColor:n});e.style.setProperty(`--whoo-widget-ink`,r.ink),e.style.setProperty(`--whoo-widget-link-color`,r.link)}function mr(e,t){let n=dr({overrides:t});for(let t of i){let r=n.overridden.primary&&(t===`onPrimary`||t===`primaryText`);(n.overridden[t]||r)&&e.style.setProperty(o[t],n.roles[t])}}function hr(e,t){e&&X(e)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(e)} as the ${t}; using the default.`)}function gr(e,t,n){for(let e of i){let n=t[e];n&&X(n)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(n)} as theme.colors.${e}; using the calculated color.`)}let r=t.primary;typeof r==`string`&&Zn(r)?.translucent&&console.warn(`[whoo-aiden-widget] theme.colors.primary ${Z(r)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`),_r({color:e.color,inkColor:e.inkColor,accentColor:e.accentColor,overrides:t},n)}function _r(e,t){for(let n of dr(e).contrastWarnings){let{role:e,against:r,value:i,ratio:a,required:o,overridden:s}=n,c=`${e}|${r}|${i}`;t.has(c)||(t.add(c),console.warn(s?`[whoo-aiden-widget] theme.colors.${e} (${i}) has ${a.toFixed(2)}:1 contrast against the ${r} color; ${o}:1 is recommended. Using it as given.`:`[whoo-aiden-widget] the ${e} color (${i}) has ${a.toFixed(2)}:1 contrast against your theme.colors.${r}; ${o}:1 is recommended. Override theme.colors.${e} too.`))}}function vr(e,t,n=new Set){fr(e,t.color??tr),hr(t.inkColor,`ink color`),hr(t.accentColor,`accent color`),pr(e,{inkColor:t.inkColor,accentColor:t.accentColor});let r=oe(t.theme);gr(t,r.colors,n),mr(e,r.colors),r.fontFamily&&e.style.setProperty(`--whoo-widget-font`,r.fontFamily)}var yr=8e3,br=3e3,xr=15e3,Sr=class extends Error{name=`SessionUnavailableError`};function Cr(e,t){return t?new Promise((n,r)=>{let i=()=>r(new DOMException(`Aborted`,`AbortError`));if(t.aborted)return i();t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})}):e}function wr(e,t){return e===`refused`?new Q(t):new Sr}function Tr(e){let t=e?.status;return t===401||t===403||t===404}var Q=class extends Error{name=`SessionExpiredError`;constructor(e){super(e instanceof Error?e.message:`The session has expired.`)}};function Er(e){return e?.status===401}function Dr(e,t){return new Promise(n=>{let r=setTimeout(n,t);e.then(()=>{clearTimeout(r),n()})})}var Or=class{config;state;listeners=new Set;sessionToken=null;sessionTokenExpiresAt=null;tokenRenewal=null;renewalGeneration=0;sendEpoch=0;getSessionToken;conversationId=null;storageIdentifier;activeRequestController=null;slowResponseTimer=null;prefersReducedMotion;launcher;launcherIconUrl;emptyStateImageUrl;emptyStateImageAlt;notice;requireNoticeAgreement;noticePlacement;subtitle;greetingStyle;showFeedback;text;language;languageTag;contentLanguage;dir;constructor(e){this.config=e;let t=oe(e.theme).launcher,n=t.iconUrl??r(e.launcherIconUrl,`launcherIconUrl`);this.launcher={...t,...n?{iconUrl:n}:{}},this.launcherIconUrl=n,this.emptyStateImageUrl=r(e.emptyStateImageUrl,`emptyStateImageUrl`),this.emptyStateImageAlt=typeof e.emptyStateImageAlt==`string`?e.emptyStateImageAlt.trim():``,this.notice=typeof e.notice==`string`&&!f(e.notice)?e.notice.trim():``,this.requireNoticeAgreement=e.requireNoticeAgreement===!0&&this.notice!==``,e.requireNoticeAgreement===!0&&!this.notice&&console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."),this.noticePlacement=A(e.noticePlacement),this.subtitle=typeof e.subtitle==`string`&&!f(e.subtitle)?e.subtitle.trim():``,this.greetingStyle=k(e.greetingStyle),this.showFeedback=e.showFeedback===!0,this.storageIdentifier=e.publishableKey??`session-token-mode`,this.getSessionToken=h(e);let{language:i,tag:a,dir:o}=Pt(e.language,typeof document>`u`?void 0:document.documentElement.lang);this.language=i,this.languageTag=a,this.dir=o,this.contentLanguage=Lt(e.contentLanguage,typeof document>`u`?void 0:document.documentElement.lang,e.language),this.text={...Mt(i),...x(e.messages)},this.prefersReducedMotion=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.state={isOpen:!1,messages:[],isStreaming:!1,initError:null,isInitializing:!1,runtimeError:null,messageFeedback:{},primaryColor:null,agentName:null,accentColor:null,inkColor:null,announcement:null,announcementIsContent:!1,isSlowResponse:!1,noticeAgreed:!this.requireNoticeAgreement||qn(this.storageIdentifier,this.notice),draft:``}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}clearSlowResponse(){this.slowResponseTimer!==null&&(clearTimeout(this.slowResponseTimer),this.slowResponseTimer=null),this.state.isSlowResponse&&this.setState({isSlowResponse:!1})}setState(e){this.state={...this.state,...e};for(let e of this.listeners)e(this.state)}async init(){this.setState({isInitializing:!0});try{await this.start()}finally{this.setState({isInitializing:!1})}}async start(){let e=this.config.apiBaseUrl??`https://api.aidenvoice.com`;try{if(this.config.sessionToken){if(Vn(this.config.sessionToken)){if(!(`token`in await this.renewToken()))throw Error(`The sessionToken has expired.`)}else this.sessionToken=this.config.sessionToken,this.sessionTokenExpiresAt=Bn(this.config.sessionToken)}else if(this.config.publishableKey){let{token:t,primaryColor:n,name:r,accentColor:i,inkColor:a}=await Dn(e,this.config.publishableKey);this.sessionToken=t,this.sessionTokenExpiresAt=Hn(t),this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}else throw Error(`WidgetConfig must include exactly one of publishableKey or sessionToken`)}catch(e){console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)});return}this.conversationId=Wn(this.storageIdentifier),this.config.sessionToken&&await Dr(this.loadBranding(e),br)}async loadBranding(e){try{let t=this.config;if(X(t.color)&&X(t.inkColor)&&X(t.accentColor)&&d(t.name))return;let{primaryColor:n,name:r,accentColor:i,inkColor:a}=await this.withSession(t=>kn(e,t));this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}catch(e){let t=e?.status;(e instanceof Q||t===401||t===403)&&(this.state.isInitializing?(console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)})):(console.error(`[whoo-aiden-widget] the session was refused after start-up:`,e),this.setState({runtimeError:this.text.sessionExpired})))}}open(){this.setState({isOpen:!0})}resetConversation(){this.sendEpoch+=1,this.activeRequestController?.abort(`reset`),this.activeRequestController=null,this.clearSlowResponse(),this.conversationId=null,Yn(this.storageIdentifier),this.setState({messages:[],messageFeedback:{},runtimeError:null,isStreaming:!1,announcement:this.text.conversationCleared,announcementIsContent:!1})}agreeToNotice(){this.state.noticeAgreed||(Jn(this.storageIdentifier,this.notice),this.setState({noticeAgreed:!0}))}setDraft(e){this.setState({draft:e})}close(){this.activeRequestController?.abort(`close`),this.activeRequestController=null,this.clearSlowResponse(),this.setState({isOpen:!1})}async sendMessage(e){if(!this.sessionToken||!this.state.noticeAgreed)return;let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.sendEpoch+=1;let n=this.sendEpoch,r=()=>n===this.sendEpoch,i={role:`user`,content:e,id:null},a={role:`assistant`,content:``,id:null};this.setState({messages:[...this.state.messages,i,a],isStreaming:!0,runtimeError:null,announcement:null});let o=a,s=e=>{let t=o;o={...o,...e},this.setState({messages:this.state.messages.map(e=>e===t?o:e)})},c=e=>s({content:e}),l=new AbortController;this.activeRequestController=l;let{signal:u}=l,d=!1;this.slowResponseTimer=setTimeout(()=>{this.slowResponseTimer=null,this.setState({isSlowResponse:!0})},yr);let f=!1,p=()=>{this.state.draft===``&&(f=!0,this.setState({draft:e}))},m=(e=this.text.genericError)=>{r()&&(this.setState({runtimeError:e}),p())},h=``;try{let{stream:n,first:i}=await this.withSession(async n=>{d=!0;let r=jn(t,n,this.conversationId,e,u);return{stream:r,first:await r.next()}},u);for(let e=i;!e.done&&!u.aborted&&r();e=await n.next()){let t=e.value;if(t.type===`conversation_id`)this.conversationId=t.conversationId,Gn(this.storageIdentifier,t.conversationId);else if(t.type===`delta`)this.clearSlowResponse(),t.verbatim&&!this.prefersReducedMotion?(await Rn(t.delta,e=>c(e),{signal:u}),h=t.delta):t.verbatim?(h=t.delta,c(h)):(h+=t.delta,c(h));else if(t.type===`done`)t.conversationId&&(this.conversationId=t.conversationId,Gn(this.storageIdentifier,t.conversationId)),t.messageId&&s({id:t.messageId}),r()&&this.setState({announcement:Nn(h),announcementIsContent:!0});else if(t.type===`error`){console.error(`[whoo-aiden-widget] chat error:`,t.error),h.trim()!==``&&r()&&this.setState({announcement:Nn(h),announcementIsContent:!0}),m(),l.abort();break}}}catch(e){u.aborted?u.reason===`close`&&r()&&!d&&p():e instanceof Q?(console.error(`[whoo-aiden-widget] chat request failed: the session has expired.`,e),m(this.text.sessionExpired)):e instanceof Sr?(console.error(`[whoo-aiden-widget] chat request failed: no session could be had.`),m()):(console.error(`[whoo-aiden-widget] chat request failed:`,e),m())}finally{let e=o.id===null&&o.content.trim()===``,t=this.state.messages.filter(t=>!(e&&t===o)&&!(e&&f&&t===i)),n=t.length!==this.state.messages.length;r()?(this.activeRequestController=null,this.clearSlowResponse(),this.setState({isStreaming:!1,...n?{messages:t}:{}})):n&&this.setState({messages:t})}}expandFeedback(e){let{correction:t,category:n}=this.state.messageFeedback[e]??{};this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`expanded`,correction:t,category:n}}})}setFeedbackDraft(e,t,n){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{...this.state.messageFeedback[e],correction:t,category:n}}})}cancelFeedback(e){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`idle`}}})}async submitFeedback(e,t,n,r){if(!this.sessionToken)return;let i=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitting`,rating:t}}});try{await this.withSession(a=>An(i,a,{messageId:e,rating:t,correction:n,category:r})),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitted`,rating:t}}})}catch(i){console.error(`[whoo-aiden-widget] feedback submission failed:`,i),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`error`,rating:t,correction:n,category:r}}})}}async currentToken(e){let t=this.sessionToken,n=this.sessionTokenExpiresAt;return t&&(n===null||n-Date.now()>6e4)?{token:t}:Cr(this.renewToken(),e)}renewToken(){return this.tokenRenewal??=this.fetchNewToken().finally(()=>{this.tokenRenewal=null}),this.tokenRenewal}async fetchNewToken(){let e=++this.renewalGeneration,t,n=new Promise(e=>{t=setTimeout(()=>{console.error(`[whoo-aiden-widget] could not renew the session: it took too long.`),e({failure:`unavailable`})},xr)});try{return await Promise.race([this.obtainToken(e),n])}finally{clearTimeout(t)}}async obtainToken(e){let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`,n;try{if(this.config.publishableKey)n=(await Dn(t,this.config.publishableKey)).token;else if(this.getSessionToken)n=await this.getSessionToken();else return{failure:`refused`}}catch(e){return console.error(`[whoo-aiden-widget] could not renew the session:`,e),{failure:this.config.publishableKey&&Tr(e)?`refused`:`unavailable`}}let r=typeof n==`string`?Hn(n):null;return typeof n!=`string`||n===``||r!==null&&r<=Date.now()?(console.error(`[whoo-aiden-widget] could not renew the session: no usable token was returned.`),{failure:`refused`}):(e===this.renewalGeneration&&(this.sessionToken=n,this.sessionTokenExpiresAt=r),{token:n})}async withSession(e,t){let n=await this.currentToken(t);if(!(`token`in n))throw wr(n.failure);let{token:r}=n;try{return await e(r)}catch(n){if(!Er(n))throw n;let i=this.sessionToken&&this.sessionToken!==r?{token:this.sessionToken}:await Cr(this.renewToken(),t);if(!(`token`in i))throw wr(i.failure,n);try{return await e(i.token)}catch(e){throw Er(e)?new Q(e):e}}}},$=20,kr=12,Ar=300,jr=352;function Mr(){try{return typeof CSS<`u`&&CSS.supports?.(`height`,`100dvh`)?`dvh`:`vh`}catch{return`vh`}}function Nr(e,t){let{offsetX:n,offsetY:r,launcherSize:i,panelWidth:a,panelHeight:o,cornerRadius:s}=le(t.layout),c=e=>typeof t.layout?.offset?.[e]==`number`;if(typeof window<`u`&&window.innerWidth>0&&window.innerHeight>0){let e=Math.max($,window.innerWidth-Ar),t=Math.max($,window.innerHeight-i-jr);c(`x`)&&(n>e||n>window.innerWidth-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.x\` ${n} leaves no room for the launcher and panel in this viewport; it is held back.`),c(`y`)&&(r>t||r>window.innerHeight-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.y\` ${r} leaves no room for the launcher and panel in this viewport; it is held back.`)}let l=`100${Mr()}`,u=`min(${n}px, max(${$}px, calc(100vw - ${Ar}px)), calc(100vw - ${i}px))`,d=`min(${r}px, max(${$}px, calc(${l} - ${i+jr}px)), calc(${l} - ${i}px))`,f=`calc(${d} + ${i}px + ${kr}px)`,p=t.position===`bottom-left`,m=(t,n)=>e.style.setProperty(t,n);m(`--whoo-widget-inset-left`,p?u:`auto`),m(`--whoo-widget-inset-right`,p?`auto`:u),m(`--whoo-widget-inset-bottom`,d),m(`--whoo-widget-launcher-size`,`${i}px`),m(`--whoo-widget-panel-bottom`,f),m(`--whoo-widget-panel-width`,`${a}px`),m(`--whoo-widget-panel-height`,`${o}px`),m(`--whoo-widget-panel-max-width`,`calc(100vw - ${u} - ${$}px)`),m(`--whoo-widget-panel-max-height`,`calc(${l} - ${f} - ${$}px)`),s===void 0?e.style.removeProperty(`--whoo-widget-corner-radius`):m(`--whoo-widget-corner-radius`,`${s}px`)}var Pr=`:host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#e5e5e5);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start:auto;display:flex;position:sticky;bottom:0}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:var(--whoo-widget-typing-dots,#6b7280);border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-composer-send[aria-disabled=true],.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:var(--whoo-widget-muted,#4b5563);background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:var(--whoo-widget-text,#111);background:#0000000f}.whoo-widget-feedback-buttons button[aria-disabled=true]{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;unicode-bidi:plaintext;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#991b1b);font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#fff)}@media (forced-colors:active){.whoo-widget-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}`;function Fr(e){let t=document.createElement(`div`);t.id=`whoo-aiden-widget-host`,t.style.position=`relative`,t.style.zIndex=String(l(e.zIndex));let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=Pr,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=new Set;vr(i,e,a),Nr(i,e);let o=new Or(e);i.setAttribute(`lang`,o.languageTag),i.setAttribute(`dir`,o.dir);let s=X(e.color)!==null,c=null,u=``,d=oe(e.theme).colors,f=Object.keys(d).length>0,p={color:e.color,inkColor:e.inkColor,accentColor:e.accentColor};return o.subscribe(t=>{let n=!1;!s&&t.primaryColor&&t.primaryColor!==c&&(c=t.primaryColor,fr(i,t.primaryColor,e.color),X(t.primaryColor)&&(p={...p,color:t.primaryColor}),n=!0);let r=`${t.inkColor}|${t.accentColor}`;if((t.inkColor||t.accentColor)&&r!==u){u=r;let a=X(e.inkColor)?e.inkColor:t.inkColor,o=X(e.accentColor)?e.accentColor:t.accentColor;pr(i,{inkColor:a,accentColor:o}),p={...p,inkColor:a,accentColor:o},n=!0}n&&(mr(i,d),f&&_r({...p,overrides:d},a))}),o.init(),Ue(W(wn,{controller:o}),i),document.body.appendChild(t),{unmount(){Ue(null,i),t.remove()}}}function Ir(e){return p(e),Fr(e)}return e.init=Ir,e})({});
|
|
10
|
+
`)}}}function Nn(e){return typeof e.error==`string`?{type:`error`,error:e.error,conversationId:e.conversation_id}:e.done===!0?{type:`done`,conversationId:e.conversation_id,messageId:e.message_id??null}:typeof e.delta==`string`?e.verbatim===!0?{type:`delta`,delta:e.delta,verbatim:!0}:{type:`delta`,delta:e.delta}:{type:`conversation_id`,conversationId:e.conversation_id}}function Pn(e){return cn(e.replace(/\r\n?/g,`
|
|
11
|
+
`)).map(e=>{switch(e.type){case`bold`:case`italic`:return Pn(e.value);case`link`:return e.text;default:return e.value}}).join(``)}var Fn=40,In=120;function Ln(e){let t=[];for(let n of cn(e))if(n.type===`text`){let e=n.value.split(/(\s+)/),r=n.start;for(let n of e)r+=n.length,n.trim().length>0&&t.push(r)}else t.push(n.end);return t}function Rn(e){let t=null;return e?.addEventListener(`abort`,()=>{t?.()},{once:!0}),function(e){return new Promise(n=>{let r=setTimeout(()=>{t=null,n()},e);t=()=>{clearTimeout(r),t=null,n()}})}}async function zn(e,t,n){let r=n?.wordIntervalMs??Fn,i=n?.tokenIntervalMs??In,a=n?.signal,o=cn(e),s=new Set(o.filter(e=>e.type!==`text`).map(e=>e.end)),c=Rn(a),l=``;for(let n of Ln(e))if(a?.aborted||(l=e.slice(0,n),t(l),await c(s.has(n)?i:r),a?.aborted))return;l!==e&&t(e)}function Bn(e){let t=e.split(`.`);if(t.length!==3||t.some(e=>e===``))return null;let n=t[1];try{let e=n.replace(/-/g,`+`).replace(/_/g,`/`),t=JSON.parse(atob(e.padEnd(Math.ceil(e.length/4)*4,`=`))),r=e=>typeof e==`number`&&Number.isFinite(e)?e:null,{exp:i,iat:a}=t??{};return{exp:r(i),iat:r(a)}}catch{return null}}function Vn(e){let t=Bn(e)?.exp;return typeof t==`number`?t*1e3:null}function Hn(e,t=Date.now()){let n=Vn(e);return n!==null&&n<=t}function Un(e,t=Date.now()){let n=Bn(e);return n?.exp==null?null:n.iat!=null&&n.exp>n.iat?t+(n.exp-n.iat)*1e3:n.exp*1e3}function Wn(e){return`whoo-aiden-widget:conversation:${e}`}function Gn(e){try{return window.sessionStorage.getItem(Wn(e))}catch{return null}}function Kn(e,t){try{window.sessionStorage.setItem(Wn(e),t)}catch{}}function qn(e){return`whoo-aiden-widget:notice-agreed:${e}`}function Jn(e,t){try{return window.sessionStorage.getItem(qn(e))===t}catch{return!1}}function Yn(e,t){try{window.sessionStorage.setItem(qn(e),t)}catch{}}function Xn(e){try{window.sessionStorage.removeItem(Wn(e))}catch{}}var Zn=/^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;function Qn(e){if(Zn.test(e.trim()))return null;let t=document.createElement(`div`);if(t.style.color=e,t.style.color===``)return null;let n=document.createElement(`div`);n.attachShadow({mode:`open`}).appendChild(t),document.body.appendChild(n);let r=getComputedStyle(t).color;n.remove();let i=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);if(!i)return null;let a=i[4]===void 0?1:Number(i[4]);return{rgb:[Number(i[1]),Number(i[2]),Number(i[3])].map(e=>Math.round(e*a+255*(1-a))),translucent:a<1}}function q(e){return Qn(e)?.rgb??null}function J([e,t,n]){let r=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function $n(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function er(e){let t=q(e);if(!t)return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`),`#ffffff`;let n=J(t);return $n(n,J([0,0,0]))>=$n(n,J([255,255,255]))?`#000000`:`#ffffff`}function tr(e,t){let n=q(e),r=q(t);return!n||!r?NaN:$n(J(n),J(r))}var Y=a.primary,nr=a.panel,rr=a.assistantBubble,ir=a.headerHover,ar=4.5;function or([e,t,n]){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function sr(e,t=nr){let n=q(e),r=q(t);if(!n||!r)return Y;let i=J(r),a=e=>$n(J(e),i)>=ar;if(a(n))return or(n);for(let e=.99;e>0;e-=.01){let t=n.map(t=>Math.round(t*e));if(a(t))return or(t)}return`#000000`}var cr=a.ink,lr=a.link;function X(e){if(typeof e!=`string`||!e)return null;let t=Qn(e);return t?or(t.rgb):null}function ur(e){if(typeof e!=`string`||!e)return null;let t=Qn(e);return t?t.translucent?e.trim():or(t.rgb):null}var dr=[{role:`onPrimary`,against:[`primary`],required:4.5},{role:`primaryText`,against:[`panel`,`headerHover`],required:4.5},{role:`ink`,against:[`assistantBubble`,`panel`],required:4.5},{role:`link`,against:[`assistantBubble`,`panel`],required:4.5},{role:`muted`,against:[`assistantBubble`,`panel`],required:4.5},{role:`text`,against:[`panel`,`assistantBubble`],required:4.5},{role:`errorText`,against:[`errorBackground`],required:4.5},{role:`typingDots`,against:[`assistantBubble`],required:3},{role:`inputBorder`,against:[`panel`],required:3},{role:`focusRing`,against:[`panel`],required:3}];function fr({color:e,inkColor:t,accentColor:n,overrides:r}){let o=typeof r==`object`&&r&&!Array.isArray(r)?r:{},s=e=>ur(o[e]),c=X(e),l=s(`primary`),u=l??c??Y,d=s(`primaryText`),f=d??sr(u,ir),p=s(`onPrimary`)??er(u),m=X(t),h=s(`ink`)??(m?sr(m,rr):cr),g=X(n),_=s(`link`)??(g?sr(g,rr):lr),v=e=>s(e)??a[e],y={primary:u,onPrimary:p,primaryText:f,ink:h,link:_,text:v(`text`),panel:v(`panel`),border:v(`border`),headerHover:v(`headerHover`),assistantBubble:v(`assistantBubble`),muted:v(`muted`),typingDots:v(`typingDots`),errorBackground:v(`errorBackground`),errorText:v(`errorText`),inputBorder:v(`inputBorder`),focusRing:v(`focusRing`)},b=Object.fromEntries(i.map(e=>[e,s(e)!==null])),x=[];for(let{role:e,against:t,required:n}of dr)for(let r of t){if(!b[e]&&!b[r])continue;let t=tr(y[e],y[r]);Number.isFinite(t)&&t<n&&x.push({role:e,against:r,value:y[e],ratio:t,required:n,overridden:b[e]})}return{primary:u,textOnPrimary:p,primaryAsText:f,ink:h,link:_,adjusted:{primary:l===null&&d===null&&c!==null&&f!==u,ink:!b.ink&&m!==null&&h!==m,link:!b.link&&g!==null&&_!==g},roles:y,overridden:b,contrastWarnings:x}}function Z(e){return typeof e==`string`?`"${e}"`:`a ${typeof e} value`}function pr(e,t,n=Y){let r=t;X(t)===null&&(console.warn(`[whoo-aiden-widget] Could not use ${Z(t)} as the theme color; falling back to ${Z(n)}.`),r=n);let i=fr({color:r});e.style.setProperty(`--whoo-widget-color`,i.primary),e.style.setProperty(`--whoo-widget-text-on-color`,i.textOnPrimary),e.style.setProperty(`--whoo-widget-color-text`,i.primaryAsText)}function mr(e,{inkColor:t,accentColor:n}){let r=fr({inkColor:t,accentColor:n});e.style.setProperty(`--whoo-widget-ink`,r.ink),e.style.setProperty(`--whoo-widget-link-color`,r.link)}function hr(e,t){let n=fr({overrides:t});for(let t of i){let r=n.overridden.primary&&(t===`onPrimary`||t===`primaryText`);(n.overridden[t]||r)&&e.style.setProperty(o[t],n.roles[t])}}function gr(e,t){e&&X(e)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(e)} as the ${t}; using the default.`)}function _r(e,t,n){for(let e of i){let n=t[e];n&&X(n)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(n)} as theme.colors.${e}; using the calculated color.`)}let r=t.primary;typeof r==`string`&&Qn(r)?.translucent&&console.warn(`[whoo-aiden-widget] theme.colors.primary ${Z(r)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`),vr({color:e.color,inkColor:e.inkColor,accentColor:e.accentColor,overrides:t},n)}function vr(e,t){for(let n of fr(e).contrastWarnings){let{role:e,against:r,value:i,ratio:a,required:o,overridden:s}=n,c=`${e}|${r}|${i}`;t.has(c)||(t.add(c),console.warn(s?`[whoo-aiden-widget] theme.colors.${e} (${i}) has ${a.toFixed(2)}:1 contrast against the ${r} color; ${o}:1 is recommended. Using it as given.`:`[whoo-aiden-widget] the ${e} color (${i}) has ${a.toFixed(2)}:1 contrast against your theme.colors.${r}; ${o}:1 is recommended. Override theme.colors.${e} too.`))}}function yr(e,t,n=new Set){pr(e,t.color??Y),gr(t.inkColor,`ink color`),gr(t.accentColor,`accent color`),mr(e,{inkColor:t.inkColor,accentColor:t.accentColor});let r=oe(t.theme);_r(t,r.colors,n),hr(e,r.colors),r.fontFamily&&e.style.setProperty(`--whoo-widget-font`,r.fontFamily)}var br=8e3,xr=3e3,Sr=15e3,Cr=class extends Error{name=`SessionUnavailableError`};function wr(e,t){return t?new Promise((n,r)=>{let i=()=>r(new DOMException(`Aborted`,`AbortError`));if(t.aborted)return i();t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})}):e}function Tr(e,t){return e===`refused`?new Q(t):new Cr}function Er(e){let t=e?.status;return t===401||t===403||t===404}var Q=class extends Error{name=`SessionExpiredError`;constructor(e){super(e instanceof Error?e.message:`The session has expired.`)}};function Dr(e){return e?.status===401}function Or(e,t){return new Promise(n=>{let r=setTimeout(n,t);e.then(()=>{clearTimeout(r),n()})})}var kr=class{config;state;listeners=new Set;sessionToken=null;sessionTokenExpiresAt=null;tokenRenewal=null;renewalGeneration=0;sendEpoch=0;getSessionToken;conversationId=null;storageIdentifier;activeRequestController=null;slowResponseTimer=null;announcementTimer=null;prefersReducedMotion;launcher;launcherIconUrl;emptyStateImageUrl;emptyStateImageAlt;notice;requireNoticeAgreement;noticePlacement;subtitle;greetingStyle;showFeedback;text;language;languageTag;contentLanguage;dir;constructor(e){this.config=e;let t=oe(e.theme).launcher,n=t.iconUrl??r(e.launcherIconUrl,`launcherIconUrl`);this.launcher={...t,...n?{iconUrl:n}:{}},this.launcherIconUrl=n,this.emptyStateImageUrl=r(e.emptyStateImageUrl,`emptyStateImageUrl`),this.emptyStateImageAlt=typeof e.emptyStateImageAlt==`string`?e.emptyStateImageAlt.trim():``,this.notice=typeof e.notice==`string`&&!f(e.notice)?e.notice.trim():``,this.requireNoticeAgreement=e.requireNoticeAgreement===!0&&this.notice!==``,e.requireNoticeAgreement===!0&&!this.notice&&console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."),this.noticePlacement=A(e.noticePlacement),this.subtitle=typeof e.subtitle==`string`&&!f(e.subtitle)?e.subtitle.trim():``,this.greetingStyle=k(e.greetingStyle),this.showFeedback=e.showFeedback===!0,this.storageIdentifier=e.publishableKey??`session-token-mode`,this.getSessionToken=h(e);let{language:i,tag:a,dir:o}=Pt(e.language,typeof document>`u`?void 0:document.documentElement.lang);this.language=i,this.languageTag=a,this.dir=o,this.contentLanguage=Lt(e.contentLanguage,typeof document>`u`?void 0:document.documentElement.lang,e.language),this.text={...Mt(i),...x(e.messages)},this.prefersReducedMotion=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.state={isOpen:!1,messages:[],isStreaming:!1,initError:null,isInitializing:!1,runtimeError:null,messageFeedback:{},primaryColor:null,agentName:null,accentColor:null,inkColor:null,announcement:null,announcementIsContent:!1,isSlowResponse:!1,noticeAgreed:!this.requireNoticeAgreement||Jn(this.storageIdentifier,this.notice),draft:``}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get resolvedAgentName(){return d(this.config.name)||this.state.agentName||`Aiden`}announce(e,t=!1,n=!1){this.announcementTimer!==null&&(clearTimeout(this.announcementTimer),this.announcementTimer=null),n&&e!==null&&this.state.announcement!==e?this.setState({announcement:e,announcementIsContent:t}):(this.state.announcement!==null&&this.setState({announcement:null}),e!==null&&(this.announcementTimer=setTimeout(()=>{this.announcementTimer=null,this.setState({announcement:e,announcementIsContent:t})},250)))}clearSlowResponse(){this.slowResponseTimer!==null&&(clearTimeout(this.slowResponseTimer),this.slowResponseTimer=null),this.state.isSlowResponse&&this.setState({isSlowResponse:!1})}setState(e){this.state={...this.state,...e};for(let e of this.listeners)e(this.state)}async init(){this.setState({isInitializing:!0});try{await this.start()}finally{this.setState({isInitializing:!1})}}async start(){let e=this.config.apiBaseUrl??`https://api.aidenvoice.com`;try{if(this.config.sessionToken){if(Hn(this.config.sessionToken)){if(!(`token`in await this.renewToken()))throw Error(`The sessionToken has expired.`)}else this.sessionToken=this.config.sessionToken,this.sessionTokenExpiresAt=Vn(this.config.sessionToken)}else if(this.config.publishableKey){let{token:t,primaryColor:n,name:r,accentColor:i,inkColor:a}=await On(e,this.config.publishableKey);this.sessionToken=t,this.sessionTokenExpiresAt=Un(t),this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}else throw Error(`WidgetConfig must include exactly one of publishableKey or sessionToken`)}catch(e){console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)});return}this.conversationId=Gn(this.storageIdentifier),this.config.sessionToken&&await Or(this.loadBranding(e),xr)}async loadBranding(e){try{let t=this.config;if(X(t.color)&&X(t.inkColor)&&X(t.accentColor)&&d(t.name))return;let{primaryColor:n,name:r,accentColor:i,inkColor:a}=await this.withSession(t=>An(e,t));this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}catch(e){let t=e?.status;(e instanceof Q||t===401||t===403)&&(this.state.isInitializing?(console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)})):(console.error(`[whoo-aiden-widget] the session was refused after start-up:`,e),this.setState({runtimeError:this.text.sessionExpired})))}}open(){this.setState({isOpen:!0})}resetConversation(){this.sendEpoch+=1,this.activeRequestController?.abort(`reset`),this.activeRequestController=null,this.clearSlowResponse(),this.conversationId=null,Xn(this.storageIdentifier),this.setState({messages:[],messageFeedback:{},runtimeError:null,isStreaming:!1}),this.announce(this.text.conversationCleared)}agreeToNotice(){this.state.noticeAgreed||(Yn(this.storageIdentifier,this.notice),this.setState({noticeAgreed:!0}))}setDraft(e){this.setState({draft:e})}close(){this.activeRequestController?.abort(`close`),this.activeRequestController=null,this.clearSlowResponse(),this.announce(null),this.setState({isOpen:!1})}async sendMessage(e){if(!this.sessionToken||!this.state.noticeAgreed)return;let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.sendEpoch+=1;let n=this.sendEpoch,r=()=>n===this.sendEpoch,i={role:`user`,content:e,id:null},a={role:`assistant`,content:``,id:null};this.setState({messages:[...this.state.messages,i,a],isStreaming:!0,runtimeError:null}),this.announce(zt(this.text.messageSent,{name:this.resolvedAgentName}),!1,!0);let o=a,s=e=>{let t=o;o={...o,...e},this.setState({messages:this.state.messages.map(e=>e===t?o:e)})},c=e=>s({content:e}),l=new AbortController;this.activeRequestController=l;let{signal:u}=l,d=!1;this.slowResponseTimer=setTimeout(()=>{this.slowResponseTimer=null,this.setState({isSlowResponse:!0}),r()&&this.announce(this.text.lookingItUp)},br);let f=!1,p=()=>{this.state.draft===``&&(f=!0,this.setState({draft:e}))},m=!1,h=e=>{m=!0,this.announce(Pn(e),!0)},g=(e=this.text.genericError)=>{r()&&(m||(m=!0,this.announce(null)),this.setState({runtimeError:e}),p())},_=``;try{let{stream:n,first:i}=await this.withSession(async n=>{d=!0;let r=Mn(t,n,this.conversationId,e,u);return{stream:r,first:await r.next()}},u);for(let e=i;!e.done&&!u.aborted&&r();e=await n.next()){let t=e.value;if(t.type===`conversation_id`)this.conversationId=t.conversationId,Kn(this.storageIdentifier,t.conversationId);else if(t.type===`delta`)this.clearSlowResponse(),t.verbatim&&!this.prefersReducedMotion?(await zn(t.delta,e=>c(e),{signal:u}),_=t.delta):t.verbatim?(_=t.delta,c(_)):(_+=t.delta,c(_));else if(t.type===`done`)t.conversationId&&(this.conversationId=t.conversationId,Kn(this.storageIdentifier,t.conversationId)),t.messageId&&s({id:t.messageId}),r()&&h(_);else if(t.type===`error`){console.error(`[whoo-aiden-widget] chat error:`,t.error),_.trim()!==``&&r()&&h(_),g(),l.abort();break}}}catch(e){u.aborted?u.reason===`close`&&r()&&!d&&p():e instanceof Q?(console.error(`[whoo-aiden-widget] chat request failed: the session has expired.`,e),g(this.text.sessionExpired)):e instanceof Cr?(console.error(`[whoo-aiden-widget] chat request failed: no session could be had.`),g()):(console.error(`[whoo-aiden-widget] chat request failed:`,e),g())}finally{let e=o.id===null&&o.content.trim()===``,t=this.state.messages.filter(t=>!(e&&t===o)&&!(e&&f&&t===i)),n=t.length!==this.state.messages.length;r()?(this.activeRequestController=null,this.clearSlowResponse(),m||(!u.aborted&&_.trim()!==``?h(_):this.announce(null)),this.setState({isStreaming:!1,...n?{messages:t}:{}})):n&&this.setState({messages:t})}}expandFeedback(e){let{correction:t,category:n}=this.state.messageFeedback[e]??{};this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`expanded`,correction:t,category:n}}})}setFeedbackDraft(e,t,n){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{...this.state.messageFeedback[e],correction:t,category:n}}})}cancelFeedback(e){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`idle`}}})}async submitFeedback(e,t,n,r){if(!this.sessionToken)return;let i=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitting`,rating:t}}});try{await this.withSession(a=>jn(i,a,{messageId:e,rating:t,correction:n,category:r})),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitted`,rating:t}}})}catch(i){console.error(`[whoo-aiden-widget] feedback submission failed:`,i),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`error`,rating:t,correction:n,category:r}}})}}async currentToken(e){let t=this.sessionToken,n=this.sessionTokenExpiresAt;return t&&(n===null||n-Date.now()>6e4)?{token:t}:wr(this.renewToken(),e)}renewToken(){return this.tokenRenewal??=this.fetchNewToken().finally(()=>{this.tokenRenewal=null}),this.tokenRenewal}async fetchNewToken(){let e=++this.renewalGeneration,t,n=new Promise(e=>{t=setTimeout(()=>{console.error(`[whoo-aiden-widget] could not renew the session: it took too long.`),e({failure:`unavailable`})},Sr)});try{return await Promise.race([this.obtainToken(e),n])}finally{clearTimeout(t)}}async obtainToken(e){let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`,n;try{if(this.config.publishableKey)n=(await On(t,this.config.publishableKey)).token;else if(this.getSessionToken)n=await this.getSessionToken();else return{failure:`refused`}}catch(e){return console.error(`[whoo-aiden-widget] could not renew the session:`,e),{failure:this.config.publishableKey&&Er(e)?`refused`:`unavailable`}}let r=typeof n==`string`?Un(n):null;return typeof n!=`string`||n===``||r!==null&&r<=Date.now()?(console.error(`[whoo-aiden-widget] could not renew the session: no usable token was returned.`),{failure:`refused`}):(e===this.renewalGeneration&&(this.sessionToken=n,this.sessionTokenExpiresAt=r),{token:n})}async withSession(e,t){let n=await this.currentToken(t);if(!(`token`in n))throw Tr(n.failure);let{token:r}=n;try{return await e(r)}catch(n){if(!Dr(n))throw n;let i=this.sessionToken&&this.sessionToken!==r?{token:this.sessionToken}:await wr(this.renewToken(),t);if(!(`token`in i))throw Tr(i.failure,n);try{return await e(i.token)}catch(e){throw Dr(e)?new Q(e):e}}}},$=20,Ar=12,jr=300,Mr=352;function Nr(){try{return typeof CSS<`u`&&CSS.supports?.(`height`,`100dvh`)?`dvh`:`vh`}catch{return`vh`}}function Pr(e,t){let{offsetX:n,offsetY:r,launcherSize:i,panelWidth:a,panelHeight:o,cornerRadius:s}=le(t.layout),c=e=>typeof t.layout?.offset?.[e]==`number`;if(typeof window<`u`&&window.innerWidth>0&&window.innerHeight>0){let e=Math.max($,window.innerWidth-jr),t=Math.max($,window.innerHeight-i-Mr);c(`x`)&&(n>e||n>window.innerWidth-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.x\` ${n} leaves no room for the launcher and panel in this viewport; it is held back.`),c(`y`)&&(r>t||r>window.innerHeight-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.y\` ${r} leaves no room for the launcher and panel in this viewport; it is held back.`)}let l=`100${Nr()}`,u=`min(${n}px, max(${$}px, calc(100vw - ${jr}px)), calc(100vw - ${i}px))`,d=`min(${r}px, max(${$}px, calc(${l} - ${i+Mr}px)), calc(${l} - ${i}px))`,f=`calc(${d} + ${i}px + ${Ar}px)`,p=t.position===`bottom-left`,m=(t,n)=>e.style.setProperty(t,n);m(`--whoo-widget-inset-left`,p?u:`auto`),m(`--whoo-widget-inset-right`,p?`auto`:u),m(`--whoo-widget-inset-bottom`,d),m(`--whoo-widget-launcher-size`,`${i}px`),m(`--whoo-widget-panel-bottom`,f),m(`--whoo-widget-panel-width`,`${a}px`),m(`--whoo-widget-panel-height`,`${o}px`),m(`--whoo-widget-panel-max-width`,`calc(100vw - ${u} - ${$}px)`),m(`--whoo-widget-panel-max-height`,`calc(${l} - ${f} - ${$}px)`),s===void 0?e.style.removeProperty(`--whoo-widget-corner-radius`):m(`--whoo-widget-corner-radius`,`${s}px`)}var Fr=`:host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#e5e5e5);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start:auto;display:flex;position:sticky;bottom:0}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:var(--whoo-widget-typing-dots,#6b7280);border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-composer-send[aria-disabled=true],.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:var(--whoo-widget-muted,#4b5563);background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:var(--whoo-widget-text,#111);background:#0000000f}.whoo-widget-feedback-buttons button[aria-disabled=true]{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;unicode-bidi:plaintext;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#991b1b);font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#fff)}@media (forced-colors:active){.whoo-widget-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}`;function Ir(e){let t=document.createElement(`div`);t.id=`whoo-aiden-widget-host`,t.style.position=`relative`,t.style.zIndex=String(l(e.zIndex));let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=Fr,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=new Set;yr(i,e,a),Pr(i,e);let o=new kr(e);i.setAttribute(`lang`,o.languageTag),i.setAttribute(`dir`,o.dir);let s=X(e.color)!==null,c=null,u=``,d=oe(e.theme).colors,f=Object.keys(d).length>0,p={color:e.color,inkColor:e.inkColor,accentColor:e.accentColor};return o.subscribe(t=>{let n=!1;!s&&t.primaryColor&&t.primaryColor!==c&&(c=t.primaryColor,pr(i,t.primaryColor,e.color),X(t.primaryColor)&&(p={...p,color:t.primaryColor}),n=!0);let r=`${t.inkColor}|${t.accentColor}`;if((t.inkColor||t.accentColor)&&r!==u){u=r;let a=X(e.inkColor)?e.inkColor:t.inkColor,o=X(e.accentColor)?e.accentColor:t.accentColor;mr(i,{inkColor:a,accentColor:o}),p={...p,inkColor:a,accentColor:o},n=!0}n&&(hr(i,d),f&&vr({...p,overrides:d},a))}),o.init(),Ue(W(Tn,{controller:o}),i),document.body.appendChild(t),{unmount(){Ue(null,i),t.remove()}}}function Lr(e){return p(e),Ir(e)}return e.init=Lr,e})({});
|