@webority/chat-elements 0.0.0-stage → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +9 -0
- package/dist/chat-elements.js +1 -0
- package/dist/chat.css +1 -0
- package/dist/chat.global.js +44 -0
- package/dist/types/WuiChat.d.ts +263 -0
- package/dist/types/agent.d.ts +7 -0
- package/dist/types/composer.d.ts +7 -0
- package/dist/types/dom.d.ts +31 -0
- package/dist/types/footer.d.ts +4 -0
- package/dist/types/global.d.ts +1 -0
- package/dist/types/header.d.ts +4 -0
- package/dist/types/history.d.ts +7 -0
- package/dist/types/http.d.ts +12 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/loaders/index.d.ts +5 -0
- package/dist/types/loaders/orb.d.ts +4 -0
- package/dist/types/loaders/phrases.d.ts +4 -0
- package/dist/types/loaders/skeleton.d.ts +4 -0
- package/dist/types/loaders/steps.d.ts +4 -0
- package/dist/types/loaders/typing.d.ts +9 -0
- package/dist/types/nudge.d.ts +8 -0
- package/dist/types/past-chats.d.ts +18 -0
- package/dist/types/recaptcha.d.ts +2 -0
- package/dist/types/renderers/action-part.d.ts +17 -0
- package/dist/types/renderers/audio-type.d.ts +1 -0
- package/dist/types/renderers/cell-format.d.ts +6 -0
- package/dist/types/renderers/chart-engine.d.ts +1 -0
- package/dist/types/renderers/chart-engine.global.d.ts +1 -0
- package/dist/types/renderers/chart-part.d.ts +11 -0
- package/dist/types/renderers/figure-runs.d.ts +4 -0
- package/dist/types/renderers/figures-part.d.ts +1 -0
- package/dist/types/renderers/file-part.d.ts +4 -0
- package/dist/types/renderers/handoff-part.d.ts +6 -0
- package/dist/types/renderers/image-part.d.ts +1 -0
- package/dist/types/renderers/index.d.ts +32 -0
- package/dist/types/renderers/input-request-part.d.ts +12 -0
- package/dist/types/renderers/notice-part.d.ts +4 -0
- package/dist/types/renderers/part-base.d.ts +20 -0
- package/dist/types/renderers/quick-replies-part.d.ts +1 -0
- package/dist/types/renderers/record-card-part.d.ts +1 -0
- package/dist/types/renderers/sources-part.d.ts +1 -0
- package/dist/types/renderers/table-part.d.ts +1 -0
- package/dist/types/renderers/text-part.d.ts +2 -0
- package/dist/types/renderers/ticket-part.d.ts +1 -0
- package/dist/types/renderers/voice-clip-part.d.ts +6 -0
- package/dist/types/share-actions.d.ts +23 -0
- package/dist/types/shell-docked.d.ts +11 -0
- package/dist/types/shell-embed.d.ts +10 -0
- package/dist/types/shell-launcher.d.ts +10 -0
- package/dist/types/shell-page.d.ts +10 -0
- package/dist/types/starters.d.ts +6 -0
- package/dist/types/thread.d.ts +6 -0
- package/dist/types/voice/composer-voice.d.ts +12 -0
- package/dist/types/voice/controller.d.ts +24 -0
- package/dist/types/voice/icons.d.ts +1 -0
- package/dist/types/voice/read-aloud-button.d.ts +5 -0
- package/dist/types/web/autoopen.d.ts +3 -0
- package/dist/types/web/avoid.d.ts +3 -0
- package/dist/types/web/behaviour.d.ts +6 -0
- package/dist/types/web/explain.d.ts +27 -0
- package/dist/types/web/focus.d.ts +2 -0
- package/dist/types/web/haptics.d.ts +1 -0
- package/dist/types/web/index.d.ts +17 -0
- package/dist/types/web/moment.d.ts +15 -0
- package/dist/types/web/motion.d.ts +5 -0
- package/dist/types/web/print.d.ts +19 -0
- package/dist/types/web/scrolllock.d.ts +1 -0
- package/dist/types/web/share.d.ts +10 -0
- package/dist/types/web/sound.d.ts +6 -0
- package/dist/types/web/speech-azure.d.ts +29 -0
- package/dist/types/web/speech-sdk-absent.d.ts +1 -0
- package/dist/types/web/speech.d.ts +9 -0
- package/dist/types/web/switch.d.ts +13 -0
- package/dist/types/web/viewport.d.ts +3 -0
- package/dist/web-DeRQru_E.js +1 -0
- package/dist/web.js +1 -0
- package/package.json +67 -3
- package/README.md +0 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function handleTypingKey(event: any, voice: any): void;
|
|
2
|
+
export declare function createComposerVoice({ voice, getLabels, textarea, onTextChanged }: {
|
|
3
|
+
getLabels: any;
|
|
4
|
+
onTextChanged: any;
|
|
5
|
+
textarea: any;
|
|
6
|
+
voice: any;
|
|
7
|
+
}): {
|
|
8
|
+
buttons: any[];
|
|
9
|
+
note: any;
|
|
10
|
+
paint: (view: any) => void;
|
|
11
|
+
destroy: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const VOICE_NOTE_MS = 8000;
|
|
2
|
+
export declare const SPEAK_MAX_CHARS = 6000;
|
|
3
|
+
export declare function speakableText(parts: any): string;
|
|
4
|
+
export declare function noteText(note: any, labels: any): any;
|
|
5
|
+
/**
|
|
6
|
+
* The one object that knows which voice activity runs. Dictation and read-aloud share one slot,
|
|
7
|
+
* so starting one stops the other.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createVoiceController(options: any): {
|
|
10
|
+
canDictate: () => boolean;
|
|
11
|
+
canSpeak: () => boolean;
|
|
12
|
+
getStatus: () => {
|
|
13
|
+
mode: string;
|
|
14
|
+
messageId: any;
|
|
15
|
+
startedAtMs: any;
|
|
16
|
+
note: any;
|
|
17
|
+
};
|
|
18
|
+
subscribe: (listener: any) => () => void;
|
|
19
|
+
toggleDictation: (io: any) => Promise<void>;
|
|
20
|
+
toggleSpeak: (id: any, parts: any) => Promise<void>;
|
|
21
|
+
stop: () => void;
|
|
22
|
+
dismissNote: () => void;
|
|
23
|
+
destroy: () => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function voiceIcon(name: any, size?: number): SVGSVGElement;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binds a Why? trigger to an explain controller from chat-core: the thinking pill, the popover, focus into the popover and back, Escape.
|
|
3
|
+
* @param {{ trigger: HTMLElement, title?: string, request: (signal: import("@webority/chat-core").ChatAbortSignal) => Promise<unknown>, isEmpty?: (answer: unknown) => boolean, renderAnswer: (answer: unknown, context: object) => Node | null, renderFooter?: (context: object) => Node | null, labels?: Record<string, unknown>, showNotCounted?: boolean, returnFocusTo?: () => HTMLElement | null, session?: object, timings?: object, onStateChange?: (state: object) => void }} options
|
|
4
|
+
* @returns {{ open(): void, close(closeOptions?: { restoreFocus?: boolean }): void, toggle(): void, isOpen(): boolean, destroy(): void }}
|
|
5
|
+
*/
|
|
6
|
+
export declare function createExplainPopover(options: {
|
|
7
|
+
trigger: HTMLElement;
|
|
8
|
+
title?: string;
|
|
9
|
+
request: (signal: import("@webority/chat-core").ChatAbortSignal) => Promise<unknown>;
|
|
10
|
+
isEmpty?: (answer: unknown) => boolean;
|
|
11
|
+
renderAnswer: (answer: unknown, context: object) => Node | null;
|
|
12
|
+
renderFooter?: (context: object) => Node | null;
|
|
13
|
+
labels?: Record<string, unknown>;
|
|
14
|
+
showNotCounted?: boolean;
|
|
15
|
+
returnFocusTo?: () => HTMLElement | null;
|
|
16
|
+
session?: object;
|
|
17
|
+
timings?: object;
|
|
18
|
+
onStateChange?: (state: object) => void;
|
|
19
|
+
}): {
|
|
20
|
+
open(): void;
|
|
21
|
+
close(closeOptions?: {
|
|
22
|
+
restoreFocus?: boolean;
|
|
23
|
+
}): void;
|
|
24
|
+
toggle(): void;
|
|
25
|
+
isOpen(): boolean;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function vibrate(ms: any, muted: any): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { ChatSpeechError } from "@webority/chat-core";
|
|
2
|
+
export { watchAutoOpen } from "./autoopen.js";
|
|
3
|
+
export { createAvoidance } from "./avoid.js";
|
|
4
|
+
export { createBehaviourCollector } from "./behaviour.js";
|
|
5
|
+
export { createExplainPopover } from "./explain.js";
|
|
6
|
+
export { returnFocus, trapTab } from "./focus.js";
|
|
7
|
+
export { vibrate } from "./haptics.js";
|
|
8
|
+
export { fullMoment, relativeMoment } from "./moment.js";
|
|
9
|
+
export { watchReducedMotion } from "./motion.js";
|
|
10
|
+
export { endPrint, printConversation, printReply } from "./print.js";
|
|
11
|
+
export { lockPageScroll } from "./scrolllock.js";
|
|
12
|
+
export { canShareText, shareText } from "./share.js";
|
|
13
|
+
export { createSound } from "./sound.js";
|
|
14
|
+
export { createWebSpeech } from "./speech.js";
|
|
15
|
+
export { createAzureSpeech, microphoneError } from "./speech-azure.js";
|
|
16
|
+
export { switchPanel } from "./switch.js";
|
|
17
|
+
export { fitToViewport } from "./viewport.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A moment as relative text ("5 minutes ago"), or a short date from 48 hours on; "" for invalid input.
|
|
3
|
+
* @param {string} iso
|
|
4
|
+
* @param {number} [now]
|
|
5
|
+
* @param {string} [locale]
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export declare function relativeMoment(iso: string, now?: number, locale?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* A moment as a medium date and short time in the viewer's zone; "" for invalid input.
|
|
11
|
+
* @param {string} iso
|
|
12
|
+
* @param {string} [locale]
|
|
13
|
+
* @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
export declare function fullMoment(iso: string, locale?: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Removes the marks a print left on the page. */
|
|
2
|
+
export declare function endPrint(): void;
|
|
3
|
+
/**
|
|
4
|
+
* @param {HTMLElement} root the wui-chat root
|
|
5
|
+
* @param {{ title: string, printedOn: string }} options
|
|
6
|
+
*/
|
|
7
|
+
export declare function printConversation(root: HTMLElement, options: {
|
|
8
|
+
title: string;
|
|
9
|
+
printedOn: string;
|
|
10
|
+
}): void;
|
|
11
|
+
/**
|
|
12
|
+
* @param {HTMLElement} root the wui-chat root
|
|
13
|
+
* @param {HTMLElement} messageElement the reply to print
|
|
14
|
+
* @param {{ title: string, printedOn: string }} options
|
|
15
|
+
*/
|
|
16
|
+
export declare function printReply(root: HTMLElement, messageElement: HTMLElement, options: {
|
|
17
|
+
title: string;
|
|
18
|
+
printedOn: string;
|
|
19
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lockPageScroll(log: any): () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @returns {boolean} true when the platform share sheet exists. */
|
|
2
|
+
export declare function canShareText(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* @param {{ title: string, text: string }} content
|
|
5
|
+
* @returns {Promise<"shared" | "cancelled" | "failed">}
|
|
6
|
+
*/
|
|
7
|
+
export declare function shareText({ title, text }: {
|
|
8
|
+
title: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}): Promise<"shared" | "cancelled" | "failed">;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChatSpeechError } from "@webority/chat-core";
|
|
2
|
+
export { ChatSpeechError };
|
|
3
|
+
export declare const DICTATION_NO_SPEECH_MS = 10000;
|
|
4
|
+
export declare const DICTATION_SILENCE_MS = 2000;
|
|
5
|
+
export declare const DICTATION_MAX_MS = 300000;
|
|
6
|
+
export declare const TOKEN_REFRESH_MARGIN_MS = 60000;
|
|
7
|
+
export declare function microphoneError(error: any): ChatSpeechError;
|
|
8
|
+
/**
|
|
9
|
+
* @param {{
|
|
10
|
+
* getToken: () => Promise<{ token: string, region: string, expiresDateTimeUtc: string }>,
|
|
11
|
+
* loadSdk?: () => Promise<any>,
|
|
12
|
+
* getLanguage?: () => string,
|
|
13
|
+
* }} options
|
|
14
|
+
*/
|
|
15
|
+
export declare function createAzureSpeech(options: {
|
|
16
|
+
getToken: () => Promise<{
|
|
17
|
+
token: string;
|
|
18
|
+
region: string;
|
|
19
|
+
expiresDateTimeUtc: string;
|
|
20
|
+
}>;
|
|
21
|
+
loadSdk?: () => Promise<any>;
|
|
22
|
+
getLanguage?: () => string;
|
|
23
|
+
}): {
|
|
24
|
+
dictation: boolean;
|
|
25
|
+
readAloud: boolean;
|
|
26
|
+
streamsText: boolean;
|
|
27
|
+
startDictation: (opts?: {}) => Promise<any>;
|
|
28
|
+
speak: (text: any, opts?: {}) => Promise<void>;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SpeechConfig: undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The speech adapter over the Speech SDK for JavaScript. Its token comes from client.getSpeechToken().
|
|
3
|
+
* @param {import("@webority/chat-core").ChatClient} client
|
|
4
|
+
* @param {{ language?: string }} [options]
|
|
5
|
+
* @returns {import("@webority/chat-core").ChatSpeechAdapter}
|
|
6
|
+
*/
|
|
7
|
+
export declare function createWebSpeech(client: import("@webority/chat-core").ChatClient, options?: {
|
|
8
|
+
language?: string;
|
|
9
|
+
}): import("@webority/chat-core").ChatSpeechAdapter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SWITCH_GROUP_MS = 280;
|
|
2
|
+
export declare const SWITCH_ROOT_MS = 200;
|
|
3
|
+
/**
|
|
4
|
+
* Runs update() inside a view transition, or directly when startViewTransition is missing or motion is reduced.
|
|
5
|
+
* @param {() => void | Promise<void>} update
|
|
6
|
+
* @param {{ routeReady?: () => boolean, pageReady?: () => boolean, reduced?: boolean }} [options]
|
|
7
|
+
* @returns {Promise<void>}
|
|
8
|
+
*/
|
|
9
|
+
export declare function switchPanel(update: () => void | Promise<void>, options?: {
|
|
10
|
+
routeReady?: () => boolean;
|
|
11
|
+
pageReady?: () => boolean;
|
|
12
|
+
reduced?: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ChatSpeechError as e,ChatSpeechError as t,createExplain as n,mergeLabels as r}from"@webority/chat-core";import{glyphSvg as i}from"@webority/ui-elements/helpers";var a=`AppButton`,o={primary:`btn-primary`,secondary:`btn-soft-primary`,ghost:`btn-ghost-primary`,outline:`btn-outline-primary`,neutral:`btn-soft-neutral`,danger:`btn-danger`};function s(e,t,n){let r=document.createElement(e);if(t&&(r.className=t),n)for(let[e,t]of Object.entries(n))t!=null&&r.setAttribute(e,t);return r}function c(e,t=16){let n=i(e,{size:t});return n?document.importNode(new DOMParser().parseFromString(n,`image/svg+xml`).documentElement,!0):s(`span`,`d-inline-flex`)}function l(e=`primary`,t=`md`){if(!Object.hasOwn(o,e))throw Error(`Unknown button variant "${e}". Use one of ${Object.keys(o).join(`, `)}.`);return`btn ${o[e]}${t===`sm`?` btn-sm`:``}`}function u(e,t,n,r){let i=s(`button`,`${l(e,`sm`)} wui-chat-action-btn`,{type:`button`});return i.dataset.wui=a,n&&i.append(c(n,14)),i.append(document.createTextNode(t)),i.addEventListener(`click`,r),i}function d(e,t,n){let r=s(`button`,`wui-chat-icon-btn`,{type:`button`,"aria-label":e,title:e});return r.append(c(t,20)),r.addEventListener(`click`,n),r}function f(e,t){let n=e.getAttribute(t);if(n!=null&&n!==``)try{return JSON.parse(n)}catch{throw Error(`<wui-chat ${t}> must be valid JSON.`)}}function p(e){let t=null;return n=>{let r=e.dataset.state;(!n||r!==`open`&&r!==`opening`)&&(n||r!==`closed`&&r!==`closing`)&&(clearTimeout(t),n?(e.dataset.state=`opening`,t=setTimeout(()=>{e.dataset.state=`open`},620)):(e.dataset.state=`closing`,t=setTimeout(()=>{e.dataset.state=`closed`},300)))}}function m(e,t){t.position!==void 0&&(e.classList.toggle(`wui-chat--end`,t.position===`end`),e.classList.toggle(`wui-chat--start`,t.position===`start`)),t.reduced!==void 0&&e.classList.toggle(`wui-chat--reduced`,!!t.reduced),t.offsetX!==void 0&&e.style.setProperty(`--wui-chat-offset-x`,`${t.offsetX}px`),t.offsetY!==void 0&&e.style.setProperty(`--wui-chat-offset-y`,`${t.offsetY}px`),t.width!==void 0&&e.style.setProperty(`--wui-chat-width`,t.width),t.maxHeight!==void 0&&e.style.setProperty(`--wui-chat-panel-max-height`,`${t.maxHeight}px`),t.bottomGap!==void 0&&e.style.setProperty(`--wui-chat-bottom-gap`,`${t.bottomGap}px`)}var h=[`Text`,`Sources`,`QuickReplies`,`InputRequest`,`Action`,`Notice`,`Table`,`Chart`,`Figures`,`RecordCard`,`Image`,`File`,`Ticket`,`Handoff`,`VoiceClip`],g={launcher:`wui-chat--launcher`,docked:`wui-chat--docked`,"full-page":`wui-chat--full-page`,embedded:`wui-chat--embedded`};function _(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function v({id:e,layout:t,position:n,role:r,launcher:i,onToggle:a}){let o=s(`div`,`wui-chat ${g[t]} wui-chat--${n}`),l=s(`section`,`wui-chat-panel`,{id:e,role:r}),u=i?p(o):null;o.dataset.state=i?`closed`:`open`;let d=null,f=null,h=null,v=null,y=null,b=null,x=null,S=`round`,C=!1,w=`bubble`,T=null,E=null,D=!1,O=!1;function k(){let e=d.dataset.launcher,t=[`wui-chat-launcher-wrap`];e===`entering`&&T&&t.push(`wui-chat-launcher--entrance-${T}`),e===`idle`&&E&&E!==`none`&&(E!==`ring`||S===`pill`)&&t.push(`wui-chat-launcher--idle-${E}`),d.className=t.join(` `)}function A(){let e=[...f.classList].filter(e=>e.endsWith(`--opening`)||e.endsWith(`--closing`)),t=[`wui-chat-launcher`,`wui-chat-launcher--${S}`];S===`pill`&&C&&t.push(`wui-chat-launcher--compact`),t.push(`wui-chat-launcher--reveal-${w}`,...e),f.className=t.join(` `)}function j(){y&&b&&(y.textContent=x||b.launcher)}if(i){d=s(`div`,`wui-chat-launcher-wrap`),d.dataset.launcher=`idle`,f=s(`button`,`wui-chat-launcher`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":e}),h=s(`span`,`wui-chat-launcher-icon`,{"aria-hidden":`true`}),h.append(c(`chat`,24));let t=s(`span`,`wui-chat-launcher-close`,{"aria-hidden":`true`});t.append(c(`x`,24)),v=s(`span`,`wui-chat-launcher-label`),f.append(h,t,v),f.addEventListener(`click`,()=>a()),f.addEventListener(`animationend`,e=>{e.target===f&&f.classList.remove(`wui-chat-launcher--opening`,`wui-chat-launcher--closing`)}),y=s(`span`,`wui-chat-launcher-bubble`,{"aria-hidden":`true`}),d.append(f,y),d.addEventListener(`animationend`,e=>{e.target===d&&d.dataset.launcher===`entering`&&(d.dataset.launcher=`idle`,k())}),A(),k(),o.append(d,l)}else o.append(l);function M(e){if(u){if(e&&!O&&f){let e=f.getBoundingClientRect(),t=l.getBoundingClientRect();l.style.transformOrigin=`${e.left+e.width/2-t.left}px ${e.top+e.height/2-t.top}px`}e!==O&&f&&(f.classList.remove(`wui-chat-launcher--opening`,`wui-chat-launcher--closing`),f.classList.add(e?`wui-chat-launcher--opening`:`wui-chat-launcher--closing`)),O=e,u(e),f&&(f.setAttribute(`aria-expanded`,String(e)),b&&f.setAttribute(`aria-label`,e?b.launcherClose:b.launcher))}}function N(e){b=e,f&&(f.setAttribute(`aria-label`,O?e.launcherClose:e.launcher),v.textContent=e.launcher,j())}function P(e){if(m(o,e),e.theme!==void 0&&(e.theme===`light`||e.theme===`dark`?o.dataset.theme=e.theme:delete o.dataset.theme),!f)return;e.launcherStyle!==void 0&&(S=e.launcherStyle===`Pill`?`pill`:`round`),e.compact!==void 0&&(C=e.compact),e.labelReveal!==void 0&&(w=e.labelReveal===`Expand`?`expand`:`bubble`),e.entrance!==void 0&&(T=e.entrance===`None`?null:_(e.entrance)),e.idle!==void 0&&(E=e.idle===`None`?`none`:_(e.idle)),e.phone!==void 0&&(D=e.phone),e.hoverLabel!==void 0&&(x=e.hoverLabel||null),e.icon!==void 0&&e.icon!==h.dataset.icon&&(h.dataset.icon=e.icon,h.replaceChildren(c(e.icon,24)));let t=e.launcherState??d.dataset.launcher;D&&t===`entering`&&(t=`idle`),t===`entering`&&!T&&(t=`idle`),d.dataset.launcher=t,A(),k(),j()}return{root:o,panel:l,setOpen:M,setLabels:N,setAppearance:P,nudgeHost:d,launcherButton:f,role:r}}var y=1e4,b=2e3,x=3e5,S=/* @__PURE__ */ new Set([`NotAllowedError`,`SecurityError`,`PermissionDeniedError`]),C=/* @__PURE__ */ new Set([`NotFoundError`,`OverconstrainedError`,`NotReadableError`]);function w(e){return S.has(e?.name)?new t(`Blocked`,e.message):C.has(e?.name)?new t(`NoMicrophone`,e.message):T(e)}function T(e){return e instanceof t?e:new t(`Failed`,e?.message??String(e))}var E=null;function D(){return globalThis.SpeechSDK?globalThis.SpeechSDK:(E===null&&(E=import(`microsoft-cognitiveservices-speech-sdk`).then(e=>e.SpeechConfig?e:e.default).catch(e=>{throw E=null,e})),E)}function O(){return globalThis.document?.documentElement?.lang||globalThis.navigator?.language||`en-US`}function k(e){let n=e.getToken,r=e.loadSdk??D,i=e.getLanguage??O,a=typeof navigator<`u`&&typeof navigator.mediaDevices?.getUserMedia==`function`,o=typeof window<`u`&&window.isSecureContext===!0,s=a&&o,c=typeof window<`u`,l=null,u=null,d=null;function f(){return l!==null&&Date.parse(l.expiresDateTimeUtc)-Date.now()>6e4?Promise.resolve(l):(u===null&&(u=Promise.resolve().then(()=>n()).then(e=>(l=e,u=null,e),e=>{throw u=null,T(e)})),u)}function p(){return d===null&&(d=Promise.resolve().then(()=>r()).then(e=>{if(!e?.SpeechConfig)throw new t(`Unavailable`,`Speech is not available in this browser.`);return e}).catch(e=>{throw d=null,T(e)})),d}function m(e={}){let{signal:n,onText:r,onEnd:a}=e;if(n?.aborted)return a?.(),Promise.resolve();let o,c,l=new Promise((e,t)=>{o=e,c=t}),u=!1,d=!1,m=null,h=!1,g=``,_=[],v=null,S=null,C=null,E=()=>{clearTimeout(v),clearTimeout(S),clearTimeout(C)},D=e=>{if(!u){u=!0,E(),n?.removeEventListener(`abort`,O);try{m?.close()}finally{try{a?.()}finally{e?c(e):o()}}}};async function O(){if(!(u||d)){if(d=!0,E(),m!==null)try{await new Promise(e=>m.stopContinuousRecognitionAsync(e,e))}catch{}D(null)}}let k=()=>[..._,g].filter(e=>e!==``).join(` `).trim(),A=(e,t)=>{h||(h=!0,clearTimeout(v)),clearTimeout(S),S=setTimeout(O,b),r?.(k(),t)};async function j(){if(n?.addEventListener(`abort`,O),!s){D(new t(`Unavailable`,`Dictation is not available in this browser.`));return}let r;try{r=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){D(w(e));return}for(let e of r.getTracks())e.stop();if(!u)try{let n=await p(),r=await f();if(u)return;let a=n.SpeechConfig.fromAuthorizationToken(r.token,r.region);if(a.speechRecognitionLanguage=e.language||i(),a.setProperty(n.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,String(y)),m=new n.SpeechRecognizer(a,n.AudioConfig.fromDefaultMicrophoneInput()),m.recognizing=(e,t)=>{if(u)return;let n=t.result?.text;n&&(g=n,A(n,!1))},m.recognized=(e,r)=>{if(u)return;let{reason:i,text:a}=r.result;i===n.ResultReason.RecognizedSpeech&&a?(_.push(a),g=``,A(a,!0)):i===n.ResultReason.NoMatch&&n.NoMatchDetails.fromResult(r.result).reason===n.NoMatchReason.InitialSilenceTimeout&&D(new t(`NoSpeech`,`No speech was heard.`))},m.canceled=(e,r)=>{u||(r.reason===n.CancellationReason.Error?D(new t(`Failed`,r.errorDetails)):D(null))},m.sessionStopped=()=>D(null),await new Promise((e,t)=>m.startContinuousRecognitionAsync(e,t)),u)return;e.onStarted?.(),v=setTimeout(()=>{h||D(new t(`NoSpeech`,`No speech was heard.`))},y),C=setTimeout(O,x)}catch(e){D(T(e))}}return j(),l}async function h(e,n={}){let{signal:r}=n;if(!r?.aborted)try{let a=await p(),o=await f();if(r?.aborted)return;let s=a.SpeechConfig.fromAuthorizationToken(o.token,o.region);s.speechSynthesisLanguage=n.language||i();let c=new a.SpeakerAudioDestination,l=new a.SpeechSynthesizer(s,a.AudioConfig.fromSpeakerOutput(c));await new Promise((n,i)=>{let o=!1,s=()=>{r?.removeEventListener(`abort`,f),l.close(),c.close()},u=()=>{o||(o=!0,s(),n())},d=e=>{o||(o=!0,s(),i(T(e)))};function f(){c.pause(),u()}r?.addEventListener(`abort`,f),c.onAudioEnd=u;try{l.speakTextAsync(e,e=>{e.reason!==a.ResultReason.SynthesizingAudioCompleted&&d(new t(`Failed`,`The reply could not be synthesised.`))},e=>d(e))}catch(e){d(e)}})}catch(e){throw T(e)}}return{dictation:s,readAloud:c,streamsText:!0,startDictation:m,speak:h}}var A=6e4,j=60*A,M=48*j;function N(e){if(typeof e!=`string`||e===``)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function P(e,t=Date.now(),n=void 0){let r=N(e);if(r===null)return``;let i=t-r,a=Math.abs(i),o=i>=0,s=new Intl.RelativeTimeFormat(n,{numeric:`auto`});if(a<A)return s.format(0,`second`);if(a<j){let e=Math.floor(a/A);return s.format(o?-e:e,`minute`)}if(a<M){let e=Math.floor(a/j);return s.format(o?-e:e,`hour`)}return new Intl.DateTimeFormat(n,{day:`numeric`,month:`short`,year:`numeric`}).format(new Date(r))}function F(e,t=void 0){let n=N(e);return n===null?``:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(n))}var I=`data-wui-printing`,L=`data-wui-print-hide`,R=`data-wui-print-path`,z=`data-wui-print-target`,B=/* @__PURE__ */ new Set([`script`,`style`,`link`,`template`]),V=null;function H(){if(V!==null){for(let e of V.marked)e.removeAttribute(L),e.removeAttribute(R),e.removeAttribute(z);V.heading.remove(),document.documentElement.removeAttribute(I),window.removeEventListener(`afterprint`,V.onAfterPrint),V=null}}function U(e,t,n,r,i){H();let a=e.querySelector(`.wui-chat-panel`);if(a===null)throw Error(`print needs the wui-chat root`);let o=[];for(let e=a;e!==document.documentElement;e=e.parentElement){e.setAttribute(R,``),o.push(e);for(let t of e.parentElement.children)t===e||B.has(t.localName)||(t.setAttribute(L,``),o.push(t))}for(let e of n)e.setAttribute(L,``),o.push(e);r!==null&&(r.setAttribute(z,``),o.push(r));let s=document.createElement(`div`);s.className=`wui-chat-print-heading`;let c=document.createElement(`h1`);c.textContent=i.title;let l=document.createElement(`p`);l.textContent=i.printedOn,s.append(c,l),a.prepend(s),document.documentElement.setAttribute(I,t);let u=()=>H();window.addEventListener(`afterprint`,u,{once:!0}),V={marked:o,heading:s,onAfterPrint:u};try{window.print()}catch(e){throw H(),e}}function W(e,t){U(e,`conversation`,[],null,t)}function G(e,t,n){if(!e.contains(t))throw Error(`printReply needs a message inside the wui-chat root`);U(e,`reply`,Array.from(e.querySelectorAll(`li.wui-chat-message`)).filter(e=>e!==t),t,n)}function K(){return typeof navigator<`u`&&typeof navigator.share==`function`}async function ee({title:e,text:t}){if(!K())return`failed`;try{return await navigator.share({title:e,text:t}),`shared`}catch(e){return e?.name===`AbortError`?`cancelled`:`failed`}}var te=`wchat:auto-opened`,ne=`wchat:dismissed`,re=`button, a[href], input, select, textarea`,ie=`input, textarea`;function q(e){return!e.closest(`.wui-chat`)}function ae(e){return e instanceof Element&&e.matches(ie)&&q(e)}function oe(){return[...document.querySelectorAll(ie)].some(e=>q(e)&&e.value!==e.defaultValue)}function J(e){return e.length!==0&&[...document.querySelectorAll(e.join(`,`))].some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0})}function se(e){return e?[...document.querySelectorAll(re)].some(t=>{if(!q(t))return!1;let n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.left<e.right&&n.right>e.left&&n.top<e.bottom&&n.bottom>e.top}):!1}function ce(e,t,n){if(e.oncePerSession&&sessionStorage.getItem(te)||e.rememberDismissal&&sessionStorage.getItem(ne)||window.innerWidth<e.skipBelowWidthPx)return!0;let r=window.location.pathname;if(e.skipPathPrefixes.some(e=>r.startsWith(e)))return!0;let i=t.avoid.autoOpenOptOutSelector;return i&&document.querySelector(i)||e.skipWhenFormTouched&&oe()||n.isOpen()?!0:e.skipWhenCoversControl&&se(n.panelRect())}function le(e){return ae(document.activeElement)||J(e.avoid.menuSelectors)||J(e.avoid.autoOpenBusySelectors)}function ue(e,t,n){let r=0;function i(){r=0,ce(e,t,n)||(le(t)?r=setTimeout(i,e.busyRetrySeconds*1e3):(sessionStorage.setItem(te,`1`),n.open()))}return r=setTimeout(i,e.delaySeconds*1e3),{cancel(){clearTimeout(r),r=0}}}var de=.4,fe=20;function Y(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function pe(e){let t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;let[n,r,i]=t.slice(0,3).map(Number);return{r:n,g:r,b:i,alpha:t.length>3?Number(t[3])/(e.includes(`%`)?100:1):1}}function me({r:e,g:t,b:n}){return .2126*Y(e)+.7152*Y(t)+.0722*Y(n)}function he(e,t){let n=e.getBoundingClientRect(),r=document.elementsFromPoint?.(n.left+n.width/2,n.top+n.height/2)??[],i=t.length?t.join(`,`):null;for(let t of r){if(e.contains(t))continue;if(i&&t.closest(i))return!0;let n=pe(getComputedStyle(t).backgroundColor);if(n&&n.alpha>0)return me(n)<de}return!1}function ge(e){return e.length===0?[]:[...document.querySelectorAll(e.join(`,`))]}function _e(e){let t=0;for(let n of e){let e=n.getBoundingClientRect();e.height!==0&&(t=Math.max(t,window.innerHeight-e.top))}return t>0?t+fe:0}function ve(e){if(e.length===0)return!1;for(let t of document.querySelectorAll(e.join(`,`))){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return!0}return!1}function ye(e,t,n){let r=n.ownerDocument.documentElement,i=0,a=!1,o=null;function s(){i=0;let s=t.liftAboveFooter?ge(e.liftSelectors):[];if(o)for(let e of s)o.observe(e);n.style.setProperty(`--wui-chat-lift`,`${_e(s)}px`);let c=n.getBoundingClientRect(),l=c.height===0?0:Math.round(window.innerHeight-c.top);r.style.setProperty(`--wui-chat-launcher-block`,`${l}px`);let u=t.stepAsideForMenus&&ve(e.menuSelectors);u&&!a?(n.dataset.launcher=`hidden`,n.inert=!0,a=!0):!u&&a&&(n.dataset.launcher=`idle`,n.inert=!1,a=!1);let d=t.switchOnDark&&he(n,e.darkSelectors);d&&n.dataset.onDark===void 0&&(n.dataset.onDark=``),!d&&n.dataset.onDark!==void 0&&delete n.dataset.onDark}function c(){i||=requestAnimationFrame(s)}typeof ResizeObserver==`function`&&(o=new ResizeObserver(c));let l=new MutationObserver(c);return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`,`open`,`data-menu-open`]}),document.addEventListener(`scroll`,c,{capture:!0,passive:!0}),window.addEventListener(`resize`,c),window.addEventListener(`load`,c),n.addEventListener(`animationend`,c),c(),{destroy(){i&&cancelAnimationFrame(i),i=0,o?.disconnect(),l.disconnect(),document.removeEventListener(`scroll`,c,{capture:!0}),window.removeEventListener(`resize`,c),window.removeEventListener(`load`,c),n.removeEventListener(`animationend`,c),a&&=(n.inert=!1,!1),delete n.dataset.onDark,n.style.removeProperty(`--wui-chat-lift`),r.style.removeProperty(`--wui-chat-launcher-block`)}}}var X=`wchat:session-start`,be=`wchat:pages`,xe=`wchat:services`;function Se(e){let t=sessionStorage.getItem(e);return t?JSON.parse(t):[]}function Ce(e,t){sessionStorage.setItem(e,JSON.stringify(t))}function we(e,t){let n=t.find(t=>e.startsWith(t));return n===void 0?null:e.slice(n.length).replace(/^\/+|\/+$/g,``)||null}function Te(e){sessionStorage.getItem(X)||sessionStorage.setItem(X,String(Date.now()));let t=0;function n(){let e=document.documentElement.scrollHeight;if(e<=0)return;let n=(window.scrollY+window.innerHeight)/e*100;n>t&&(t=n)}return window.addEventListener(`scroll`,n,{passive:!0}),function(){n();let r=window.location.pathname,i=Se(be);i.includes(r)||(i.push(r),Ce(be,i));let a=we(r,e),o=Se(xe);return a!==null&&(o=o.filter(e=>e!==a),o.push(a),o=o.slice(-10),Ce(xe,o)),{timeOnSiteSeconds:Math.floor((Date.now()-Number(sessionStorage.getItem(X)))/1e3),scrollPercent:Math.min(100,Math.floor(t)),pagesViewed:i.length,viewedServices:o}}}var Z=8,Ee=`(min-width: 992px)`,De=`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`,Oe=[`aria-haspopup`,`aria-expanded`,`aria-controls`,`aria-disabled`,`data-offline`,`title`],ke=0;function Ae(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function je(e){let{trigger:t,request:i,isEmpty:a,renderAnswer:o,renderFooter:c,session:l,timings:f,onStateChange:p,returnFocusTo:m}=e??{};if(!(t instanceof HTMLElement))throw TypeError(`createExplainPopover needs a "trigger" element.`);if(typeof i!=`function`)throw TypeError(`createExplainPopover needs a "request" function.`);if(typeof o!=`function`)throw TypeError(`createExplainPopover needs a "renderAnswer" function.`);ke+=1;let h=e.title??``,g=e.showNotCounted??!0,_=`wui-chat-explain-${ke}`,v=()=>r(e.labels??{}),y=()=>({labels:v(),close:W}),b=n({request:i,isEmpty:a,...f}),x=Object.fromEntries(Oe.map(e=>[e,t.getAttribute(e)])),S=t.hidden,C;t.setAttribute(`aria-haspopup`,`dialog`),t.setAttribute(`aria-expanded`,`false`),t.setAttribute(`aria-controls`,_);let w=null,T=null,E=null,D,O=null,k=[],A=[],j=()=>l?.getState().features.Explain===!1;function M(){b.getSnapshot().offline?(C===void 0&&(C=t.getAttribute(`title`)),t.setAttribute(`title`,v().explainOffline),t.setAttribute(`aria-disabled`,`true`),t.setAttribute(`data-offline`,``)):(C!==void 0&&Ae(t,`title`,C),C=void 0,t.removeAttribute(`aria-disabled`),t.removeAttribute(`data-offline`)),l&&(t.hidden=j())}function N(e){if(T.replaceChildren(),e.pillVisible){let t=s(`span`,`wui-chat-explain-pill`),n=s(`span`,`wui-chat-orb`,{"aria-hidden":`true`}),r=s(`span`);r.textContent=e.state===`slow`?v().explainSlow:v().thinking,t.append(n,r);let i=s(`div`,`wui-chat-explain-thinking`,{role:`status`});i.append(t),T.append(i)}else if(e.state===`answered`){e.answer!==D&&(E=o(e.answer,y())??null,D=e.answer);let t=s(`div`,`wui-chat-explain-answer`);E&&t.append(E),T.append(t)}else if(e.state===`empty`){let e=s(`p`,`wui-chat-explain-text`);e.textContent=v().explainEmpty,T.append(e)}else if(e.state===`capacity`){let t=s(`div`,`wui-chat-explain-alert wui-chat-explain-alert--warning`,{role:`status`}),n=s(`p`);n.textContent=e.resetsAtUtc?v().explainCapacity(F(e.resetsAtUtc)):v().explainCapacityNoDate,t.append(n),T.append(t)}else if(e.state===`error`){let e=s(`div`,`wui-chat-explain-alert wui-chat-explain-alert--error`,{role:`alert`}),t=s(`p`);t.textContent=v().explainError,e.append(t,u(`ghost`,v().retry,`rotate-ccw`,()=>b.ask())),T.append(e)}}function P(){let e=w.querySelector(`.wui-chat-explain-foot`);e.replaceChildren();let t=c?.(y());if(t&&e.append(t),g){let t=s(`p`,`wui-chat-explain-note`);t.textContent=v().explainNotCounted,e.append(t)}}function I(){if(!w)return;let e=b.getSnapshot();w.dataset.state=e.state,N(e),P(),p?.(e)}function L(){if(!w)return;if(!t.isConnected){W({restoreFocus:!1});return}let e=document.documentElement.getAttribute(`data-wui-chat-docked`);if((e===`end`||e===`start`)&&globalThis.matchMedia?.(Ee)?.matches===!0){w.dataset.beside=e,w.style.left=``,w.style.top=``,w.style.maxHeight=``;return}delete w.dataset.beside,w.style.position=`fixed`;let n=t.getBoundingClientRect(),r=w.offsetWidth,i=w.offsetHeight,a=globalThis.innerHeight-n.bottom-Z,o=a<i&&n.top>a,s=o?n.top-Z:a,c=o?Math.max(Z,n.top-i-Z):n.bottom+Z,l=Math.max(Z,Math.min(n.left,globalThis.innerWidth-r-Z));w.style.top=`${c}px`,w.style.left=`${l}px`,w.style.maxHeight=s<i?`${Math.max(0,s)}px`:``}function R(e){e.key===`Escape`&&(document.documentElement.hasAttribute(`data-wui-chat-docked`)||(e.stopPropagation(),W()))}function z(e){let n=e.target;w.contains(n)||t.contains(n)||n instanceof Element&&n.closest(`.wui-chat-panel`)||W({restoreFocus:!1})}function B(e){e.target instanceof Node&&w.contains(e.target)||L()}function V(){b.getSnapshot().offline||G()}function H(){for(let[e,t,n,r]of k)e.removeEventListener(t,n,r);k=[];for(let e of A)e.disconnect();A=[]}function U(){if(w||j()||b.getSnapshot().offline)return;w=s(`div`,`wui-chat-explain`,{role:`dialog`,"aria-label":h,popover:`manual`,id:_});let e=s(`header`,`wui-chat-explain-head`),n=s(`strong`,`wui-chat-explain-title`);n.textContent=h,O=d(v().close,`x`,()=>W()),O.classList.add(`wui-chat-explain-close`),e.append(n,O),T=s(`div`,`wui-chat-explain-body`,{"aria-live":`polite`}),w.append(e,T,s(`div`,`wui-chat-explain-foot`)),w.dataset.state=b.getSnapshot().state,document.body.append(w);try{w.showPopover?.()}catch{}t.setAttribute(`aria-expanded`,`true`),b.ask(),L(),(w.querySelector(De)??O).focus({preventScroll:!0}),k=[[document,`keydown`,R,!0],[document,`pointerdown`,z,!0],[window,`resize`,L,!1],[document,`scroll`,B,!0]];for(let[e,t,n,r]of k)e.addEventListener(t,n,r);if(typeof ResizeObserver==`function`){let e=new ResizeObserver(()=>L());e.observe(w),A.push(e)}let r=new MutationObserver(()=>L());r.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-wui-chat-docked`]}),A.push(r)}function W(e={restoreFocus:!0}){w&&(b.reset(),H(),w.remove(),w=null,T=null,E=null,D=void 0,O=null,t.setAttribute(`aria-expanded`,`false`),M(),e?.restoreFocus!==!1&&(m?.()??t).focus({preventScroll:!0}))}function G(){w?W():U()}let K=b.subscribe(()=>{M(),b.getSnapshot().offline&&w?W():I()}),ee=l?.subscribe(()=>{M(),j()&&w&&W({restoreFocus:!1})});return t.addEventListener(`click`,V),M(),{open:U,close:W,toggle:G,isOpen:()=>w!==null,destroy(){W({restoreFocus:!1}),K(),ee?.(),b.dispose(),t.removeEventListener(`click`,V);for(let e of Oe)Ae(t,e,x[e]);t.hidden=S}}}var Me=`a[href],button:not([disabled]),input:not([disabled]):not([type='hidden']),select:not([disabled]),textarea:not([disabled]),[tabindex]`;function Ne(e,t){if(t.key!==`Tab`)return;let n=[...e.querySelectorAll(Me)].filter(e=>e.tabIndex>=0&&!e.hidden);if(n.length===0){t.preventDefault();return}let r=n[0],i=n[n.length-1],a=e.ownerDocument.activeElement,o=e.contains(a);t.shiftKey?o&&a!==r||(t.preventDefault(),i.focus()):o&&a!==i||(t.preventDefault(),r.focus())}function Pe(e){e?.isConnected&&e.focus()}function Fe(e,t){t||typeof navigator>`u`||typeof navigator.vibrate!=`function`||navigator.vibrate(e)}var Ie=`(prefers-reduced-motion: reduce)`;function Le(e,t){let n=typeof window.matchMedia==`function`?window.matchMedia(Ie):null,r=/* @__PURE__ */ new Set,i=()=>e.motion===`Reduced`||t?.motion===!1||n?.matches===!0,a=i();function o(){let e=i();if(e!==a){a=e;for(let e of r)e(a)}}return n?.addEventListener(`change`,o),{get reduced(){return a},subscribe(e){return r.add(e),()=>{r.delete(e)}},destroy(){n?.removeEventListener(`change`,o),r.clear()}}}var Re=`wui-chat-lock`,ze=`wui-chat-scroll-lock`;function Be(e){let t=e.ownerDocument,n=[t.documentElement,t.body],r=e.style.overscrollBehavior;for(let e of n)e.classList.add(Re);e.setAttribute(`data-lenis-prevent`,``),e.style.overscrollBehavior=`contain`,window.dispatchEvent(new CustomEvent(ze,{detail:{locked:!0}}));let i=!0;return function(){if(i){i=!1;for(let e of n)e.classList.remove(Re);e.removeAttribute(`data-lenis-prevent`),e.style.overscrollBehavior=r,window.dispatchEvent(new CustomEvent(ze,{detail:{locked:!1}}))}}}var Ve={open:{from:420,to:920,seconds:.16,peak:.16},reply:{from:680,to:540,seconds:.11,peak:.06},sent:{from:540,to:760,seconds:.09,peak:.05}},He=[`pointerdown`,`keydown`,`touchstart`],Ue=`wchat:muted`,We=1e-4;function Ge(e,t){let n=t.get(Ue)===`1`,r=null;function i(){for(let e of He)document.removeEventListener(e,a)}function a(){let e=globalThis.AudioContext||globalThis.webkitAudioContext;!r&&e&&(r=new e),r?.state===`suspended`&&r.resume(),i()}for(let e of He)document.addEventListener(e,a);return{play(t){let i=Ve[t];if(!i||n||!r||!e[t]||!(e.volume>0))return;let a=r.currentTime,o=r.createOscillator(),s=r.createGain();o.type=`sine`,o.frequency.setValueAtTime(i.from,a),o.frequency.linearRampToValueAtTime(i.to,a+i.seconds),s.gain.setValueAtTime(i.peak*e.volume,a),s.gain.exponentialRampToValueAtTime(We,a+i.seconds),o.connect(s),s.connect(r.destination),o.start(a),o.stop(a+i.seconds)},setMuted(e){n=!!e,t.set(Ue,n?`1`:`0`)},isMuted(){return n},destroy(){i(),r?.close(),r=null}}}function Ke(e,t={}){return k({getToken:()=>e.getSpeechToken(),getLanguage:t.language?()=>t.language:void 0})}var qe=2e3,Je=500,Ye=32,Q=16,Xe=`data-wui-chat-switching`;function Ze(e){return new Promise(t=>setTimeout(t,e))}function $(e,t){return typeof e!=`function`||e()?Promise.resolve():new Promise(n=>{let r=0,i=()=>{e()||r>=t?n():(r+=Q,setTimeout(i,Q))};setTimeout(i,Q)})}async function Qe(e,t={}){let n=t.reduced??globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;if(typeof document.startViewTransition!=`function`||n){await e();return}let r=document.documentElement;r.setAttribute(Xe,``);try{let n=()=>!t.target||document.querySelector(`.wui-chat--${t.target}`)!==null,r=()=>(typeof t.pageReady!=`function`||t.pageReady())&&n(),i=document.startViewTransition(async()=>{await e(),await $(t.routeReady,qe),await $(r,Je),await Ze(Ye)});try{await i.updateCallbackDone}finally{await i.finished.catch(()=>{})}}finally{r.removeAttribute(Xe)}}var $e=100,et=12,tt=220,nt=640;function rt(e,t){let n=t.phone.mode===`Sheet`,r=window.visualViewport,i=0;function a(){e.style.removeProperty(`bottom`),e.style.removeProperty(`max-height`)}function o(){if(i=0,window.innerWidth>t.phone.maxWidthPx){a();return}if(!r)return;let o=Math.max(0,window.innerHeight-r.height-r.offsetTop),s=r.height-et;n&&(s=Math.min(nt,Math.max(tt,s))),e.style.bottom=`${o}px`,e.style.maxHeight=`${s}px`}function s(){clearTimeout(i),i=setTimeout(o,$e)}return r?.addEventListener(`resize`,s),r?.addEventListener(`scroll`,s),window.addEventListener(`resize`,s),window.addEventListener(`orientationchange`,s),o(),{destroy(){clearTimeout(i),r?.removeEventListener(`resize`,s),r?.removeEventListener(`scroll`,s),window.removeEventListener(`resize`,s),window.removeEventListener(`orientationchange`,s),a()}}}export{c as A,k as C,v as D,l as E,u as M,s as O,t as S,h as T,H as _,Ge as a,F as b,Fe as c,je as d,Te as f,ee as g,K as h,Ke as i,f as j,d as k,Pe as l,ue as m,rt as n,Be as o,ye as p,Qe as r,Le as s,e as t,Ne as u,W as v,w,P as x,G as y};
|
package/dist/web.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as ChatSpeechError,h as canShareText,p as createAvoidance,C as createAzureSpeech,f as createBehaviourCollector,d as createExplainPopover,a as createSound,i as createWebSpeech,_ as endPrint,n as fitToViewport,b as fullMoment,o as lockPageScroll,w as microphoneError,v as printConversation,y as printReply,x as relativeMoment,l as returnFocus,g as shareText,r as switchPanel,u as trapTab,c as vibrate,m as watchAutoOpen,s as watchReducedMotion}from"./web-DeRQru_E.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/chat-elements",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.133.0",
|
|
4
|
+
"description": "The Webority Chat web elements: the <wui-chat> custom element and one custom element per message part kind, the chat styles on @webority/theme tokens, and the global bundle that Razor pages load.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"!dist/**/__tests__",
|
|
14
|
+
"!dist/**/*.test.*",
|
|
15
|
+
"!dist/**/*.map"
|
|
16
|
+
],
|
|
17
|
+
"main": "./dist/chat-elements.js",
|
|
18
|
+
"module": "./dist/chat-elements.js",
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/types/index.d.ts",
|
|
23
|
+
"default": "./dist/chat-elements.js"
|
|
24
|
+
},
|
|
25
|
+
"./web": {
|
|
26
|
+
"types": "./dist/types/web/index.d.ts",
|
|
27
|
+
"default": "./dist/web.js"
|
|
28
|
+
},
|
|
29
|
+
"./global": "./dist/chat.global.js",
|
|
30
|
+
"./css": "./dist/chat.css",
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": [
|
|
34
|
+
"./dist/*",
|
|
35
|
+
"./src/index.js",
|
|
36
|
+
"./src/global.js",
|
|
37
|
+
"./src/renderers/*.js"
|
|
38
|
+
],
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@webority/chat-core": "0.133.0",
|
|
41
|
+
"@webority/markdown-core": "^0.130.0",
|
|
42
|
+
"@webority/theme": "^0.130.0",
|
|
43
|
+
"@webority/ui-elements": "^0.130.0",
|
|
44
|
+
"microsoft-cognitiveservices-speech-sdk": "^1.53.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"microsoft-cognitiveservices-speech-sdk": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@webority/chat-core": "0.133.0",
|
|
53
|
+
"@webority/theme": "0.130.2",
|
|
54
|
+
"@webority/ui-elements": "0.130.2",
|
|
55
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
56
|
+
"bootstrap": "5.3.3",
|
|
57
|
+
"jsdom": "30.1.1",
|
|
58
|
+
"microsoft-cognitiveservices-speech-sdk": "1.53.0",
|
|
59
|
+
"postcss": "^8.5.31",
|
|
60
|
+
"sass-embedded": "^1.97.0",
|
|
61
|
+
"typescript": "^7.0.2",
|
|
62
|
+
"vite": "^8.0.12",
|
|
63
|
+
"vitest": "5.0.1"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "vite build && vite build -c vite.global.config.js && sass scss/_chat.scss dist/chat.css --load-path=node_modules --style=compressed --no-source-map --quiet-deps && tsc -p tsconfig.json && node ../../scripts/sync-rcl-assets.mjs",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"test:watch": "vitest"
|
|
69
|
+
}
|
|
6
70
|
}
|
package/README.md
DELETED