@saar-ai/web-widget 0.10.0 → 0.12.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.
Files changed (49) hide show
  1. package/dist/adopt-stylesheet.d.ts +11 -0
  2. package/dist/adopt-stylesheet.d.ts.map +1 -0
  3. package/dist/chunks/{host-widget-BtiYIMwb.js → host-widget-Cc0KjJwZ.js} +2366 -280
  4. package/dist/concierge-shell.css +2 -0
  5. package/dist/concierge-state.d.ts +234 -0
  6. package/dist/concierge-state.d.ts.map +1 -0
  7. package/dist/dock/dock-renderer.d.ts +3 -0
  8. package/dist/dock/dock-renderer.d.ts.map +1 -0
  9. package/dist/dock/dock-row.d.ts +3 -23
  10. package/dist/dock/dock-row.d.ts.map +1 -1
  11. package/dist/dock/dock-state.d.ts +34 -174
  12. package/dist/dock/dock-state.d.ts.map +1 -1
  13. package/dist/generated/concierge-shell-css.d.ts +2 -0
  14. package/dist/generated/concierge-shell-css.d.ts.map +1 -0
  15. package/dist/generated/widget-css.d.ts.map +1 -1
  16. package/dist/handoff-initials.d.ts +34 -0
  17. package/dist/handoff-initials.d.ts.map +1 -0
  18. package/dist/host-widget.d.ts +24 -1
  19. package/dist/host-widget.d.ts.map +1 -1
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +35 -138
  23. package/dist/mount.d.ts +4 -5
  24. package/dist/mount.d.ts.map +1 -1
  25. package/dist/next/index.js +1 -1
  26. package/dist/renderers.d.ts +3 -0
  27. package/dist/renderers.d.ts.map +1 -0
  28. package/dist/styles.d.ts +1 -0
  29. package/dist/styles.d.ts.map +1 -1
  30. package/dist/voice-widget.d.ts +93 -3
  31. package/dist/voice-widget.d.ts.map +1 -1
  32. package/dist/widget/concierge-launcher.d.ts +68 -0
  33. package/dist/widget/concierge-launcher.d.ts.map +1 -0
  34. package/dist/widget/concierge-shell.d.ts +299 -0
  35. package/dist/widget/concierge-shell.d.ts.map +1 -0
  36. package/dist/widget/position.d.ts +65 -0
  37. package/dist/widget/position.d.ts.map +1 -0
  38. package/dist/widget/shell-renderer.d.ts +3 -0
  39. package/dist/widget/shell-renderer.d.ts.map +1 -0
  40. package/dist/widget/transcript-geometry.d.ts +220 -0
  41. package/dist/widget/transcript-geometry.d.ts.map +1 -0
  42. package/dist/widget/widget-view.d.ts +138 -0
  43. package/dist/widget/widget-view.d.ts.map +1 -0
  44. package/dist/widget.css +1 -1
  45. package/package.json +1 -1
  46. package/src/styles/brand.css +51 -0
  47. package/src/styles/concierge-shell-entry.css +55 -0
  48. package/src/styles/concierge.css +9 -38
  49. package/src/styles/widget-entry.css +39 -1
package/dist/mount.d.ts CHANGED
@@ -45,10 +45,9 @@ export interface MountedWidget {
45
45
  */
46
46
  export declare function mountConciergeWidget(host: HTMLElement, props: ConciergeWidgetProps): MountedWidget;
47
47
  /**
48
- * `adoptedStyleSheets` when the browser has it; a `<style>` element otherwise
49
- * — see `mountConciergeWidget`'s doc comment. Exported (not just used
50
- * internally) so `cdn/ui.ts` can adopt the same stylesheet into the shadow
51
- * root `core.ts` already created, without a second `attachShadow` call.
48
+ * The npm-facing stylesheet adopter: the dock's sheet unless told otherwise.
49
+ * The CDN entries call `adoptStylesheet` (`adopt-stylesheet.ts`) directly with
50
+ * their own sheet — see that file for why the default lives here and not there.
52
51
  */
53
- export declare function adoptWidgetStylesheet(shadow: ShadowRoot): void;
52
+ export declare function adoptWidgetStylesheet(shadow: ShadowRoot, css?: string): void;
54
53
  //# sourceMappingURL=mount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;OASG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,oBAAoB,GAC1B,aAAa,CAqCf;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAiB9D"}
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI9E,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;OASG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,oBAAoB,GAC1B,aAAa,CAuCf;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,GAAE,MAAmB,GAAG,IAAI,CAExF"}
@@ -1,4 +1,4 @@
1
- import { _ as detectPage, r as ConciergeWidget } from "../chunks/host-widget-BtiYIMwb.js";
1
+ import { i as ConciergeWidget, v as detectPage } from "../chunks/host-widget-Cc0KjJwZ.js";
2
2
  import { useCallback, useEffect, useMemo, useRef } from "react";
3
3
  import { usePathname, useRouter } from "next/navigation";
4
4
  //#region src/next/use-next-bridge.ts
@@ -0,0 +1,3 @@
1
+ import type { ConciergeRenderer } from './voice-widget.js';
2
+ export declare function rendererFor(generation: 'widget' | 'dock' | undefined): ConciergeRenderer;
3
+ //# sourceMappingURL=renderers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../src/renderers.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,wBAAgB,WAAW,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAExF"}
package/dist/styles.d.ts CHANGED
@@ -16,4 +16,5 @@
16
16
  * shadow-DOM mount.
17
17
  */
18
18
  export { WIDGET_CSS } from './generated/widget-css.js';
19
+ export { CONCIERGE_SHELL_CSS } from './generated/concierge-shell-css.js';
19
20
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,6 +1,6 @@
1
- import { type CSSProperties } from 'react';
1
+ import { type ComponentType, type CSSProperties, type ReactNode } from 'react';
2
2
  import { type WidgetMessages } from './messages.js';
3
- import { type DockProps, type WidgetAttribution } from './dock/dock.js';
3
+ import { type DockProps, type DockTurn, type DockVoiceProps, type WidgetAttribution } from './dock/dock.js';
4
4
  /**
5
5
  * Where a call is, from the caller's point of view.
6
6
  *
@@ -234,8 +234,88 @@ export interface VoiceWidgetProps {
234
234
  * is exactly what a harness with no session (Storybook, the marketing
235
235
  * preview) has.
236
236
  */
237
+ /**
238
+ * Which chrome draws the session — docs/CONCIERGE_GENERATIONS.md §3. The
239
+ * conversation (turns, composer, voice, cart, attachments) is computed once
240
+ * here and handed to the renderer as a `ConversationView`; the renderer
241
+ * decides only how it looks. Absent, `generation` picks one; absent too,
242
+ * the dock — the value every test and story in this package was written
243
+ * against. The CDN entries (`cdn/ui.ts`, `cdn/ui-widget.ts`) never come
244
+ * through this default: they pass one explicitly so that each chunk ships
245
+ * one renderer's code and not both (`VoiceWidgetWithRenderer`).
246
+ */
247
+ readonly renderer?: ConciergeRenderer;
248
+ /** §9.1 `ui.generation`, honoured only when `renderer` is absent. */
249
+ readonly generation?: 'widget' | 'dock';
237
250
  readonly dock?: Omit<DockProps, 'draft' | 'onDraftChange' | 'onSubmit' | 'transcript' | 'sheetExtra' | 'messages'>;
238
251
  }
252
+ /**
253
+ * The session as a renderer sees it — everything `VoiceWidget` derives from
254
+ * its props and its own state, and nothing a renderer would have to derive
255
+ * again. Both renderers read the SAME view (docs/CONCIERGE_GENERATIONS.md §2:
256
+ * one state, two presentations); a field that only one of them draws is still
257
+ * here, because "the widget has no row" is a rendering decision, not a
258
+ * different conversation.
259
+ *
260
+ * The shared pieces of chrome — the transcript log, the hidden attachment
261
+ * input, the basket and upload status — are built here as nodes rather than
262
+ * re-described per renderer, so a fix to how a turn is drawn lands in both.
263
+ */
264
+ export interface ConversationView {
265
+ readonly state: BotState;
266
+ readonly turns: readonly WidgetTurn[];
267
+ /** The last SPOKEN turn in the dock's terms — see the derivation in `VoiceWidget`. */
268
+ readonly lastTurn: DockTurn | undefined;
269
+ /** The most recent operator name on the thread, for a `human` header. */
270
+ readonly operatorName: string | undefined;
271
+ /** §5.1 — somebody on the other side is composing. */
272
+ readonly composing: boolean;
273
+ readonly channel: 'text' | 'voice';
274
+ readonly mode: WidgetMode;
275
+ readonly showMic: boolean;
276
+ readonly callPhase: ConciergeCallPhase;
277
+ readonly micOpen: boolean;
278
+ readonly onToggleMic: () => void;
279
+ readonly onEndCall: (() => void) | undefined;
280
+ /** The dock's voice bag, derived from `callPhase`/`state`; the shell maps it to its own. */
281
+ readonly voice: DockVoiceProps;
282
+ readonly statusLine: string | undefined;
283
+ readonly statusKind: 'session' | 'voice' | undefined;
284
+ readonly notice: string | undefined;
285
+ readonly escalated: boolean;
286
+ readonly humanTyping: boolean;
287
+ readonly draft: string;
288
+ /** Sets the draft AND fires `onTyping` for a keystroke that leaves something in the box. */
289
+ readonly onDraftChange: (value: string) => void;
290
+ readonly submit: () => void;
291
+ readonly sending: boolean;
292
+ readonly showBasket: boolean;
293
+ readonly cart: VoiceWidgetProps['cart'];
294
+ readonly attaching: {
295
+ readonly filename: string;
296
+ readonly failed: boolean;
297
+ } | null;
298
+ /** Opens the file picker; present only while a human is on the thread and the host accepts files. */
299
+ readonly onAttach: (() => void) | undefined;
300
+ /** The hidden `<input type="file">` and its label — `null` when `onAttach` is. */
301
+ readonly attachInput: ReactNode;
302
+ /** The `role="log"` transcript, openers included. */
303
+ readonly transcript: ReactNode;
304
+ /** The basket summary and the upload status, for the end of the transcript. */
305
+ readonly extras: ReactNode;
306
+ readonly messages: WidgetMessages;
307
+ readonly locale: string;
308
+ readonly navigate: WidgetNavigate | undefined;
309
+ readonly curationHref: ((curationId: string) => string) | undefined;
310
+ readonly productHref: ((handle: string) => string) | undefined;
311
+ readonly skinStyle: CSSProperties | undefined;
312
+ readonly avatar: WidgetAvatar | undefined;
313
+ readonly attribution: WidgetAttribution | undefined;
314
+ /** The host's chrome bag — the dock reads it whole; the shell reads `layout`, `copy` and `initialMinimised`. */
315
+ readonly dock: VoiceWidgetProps['dock'];
316
+ }
317
+ /** A chrome: draws a `ConversationView`. `DockRenderer` and `ShellRenderer` are the two. */
318
+ export type ConciergeRenderer = ComponentType<ConversationView>;
239
319
  /**
240
320
  * Does this line read as "I want to pay now"?
241
321
  *
@@ -322,5 +402,15 @@ export declare function basketIntentFromTurns(turns: readonly Pick<WidgetTurn, '
322
402
  * `dir`, resolved from that line's locale rather than inherited from the page —
323
403
  * inheriting is what renders Arabic punctuation on the wrong end of a sentence.
324
404
  */
325
- export declare function VoiceWidget({ state, turns, onToggleMic, onEndCall, callPhase, onSendText, micOpen, status, statusKind, notice, mode, escalated, humanTyping, onTyping, onAddToCart, onChooseOptions, chooseOptionsBusy, curationHref, productHref, onAttachFile, cart, messages, navigate, locale, skinStyle, avatar, attribution, dock, }: VoiceWidgetProps): import("react").JSX.Element;
405
+ /**
406
+ * The public component: picks a renderer when the caller did not. Kept apart
407
+ * from `VoiceWidgetWithRenderer` so that a CDN entry which imports only the
408
+ * latter never bundles the renderer it does not draw — `rendererFor` is the
409
+ * one place both are named.
410
+ */
411
+ export declare function VoiceWidget({ renderer, generation, ...props }: VoiceWidgetProps): import("react").JSX.Element;
412
+ /** `VoiceWidget` with the renderer decided — the component the CDN entries and `ConciergeHost` use. */
413
+ export declare function VoiceWidgetWithRenderer({ renderer, state, turns, onToggleMic, onEndCall, callPhase, onSendText, micOpen, status, statusKind, notice, mode, escalated, humanTyping, onTyping, onAddToCart, onChooseOptions, chooseOptionsBusy, curationHref, productHref, onAttachFile, cart, messages, navigate, locale, skinStyle, avatar, attribution, dock, }: VoiceWidgetProps & {
414
+ readonly renderer: ConciergeRenderer;
415
+ }): import("react").JSX.Element;
326
416
  //# sourceMappingURL=voice-widget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"voice-widget.d.ts","sourceRoot":"","sources":["../src/voice-widget.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAEL,KAAK,SAAS,EAGd,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAExF,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAqB,KAA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C,UAAU,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,GACrD,OAAO,CAIT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BAE/E;AAED,uGAAuG;AACvG,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,KAAK,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,SAAkB,EAClB,UAAU,EACV,OAAO,EACP,MAAM,EACN,UAAU,EACV,MAAM,EACN,IAAc,EACd,SAAiB,EACjB,WAAmB,EACnB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,iBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,QAAgC,EAChC,QAAQ,EACR,MAAa,EACb,SAAS,EACT,MAAM,EACN,WAAW,EACX,IAAI,GACL,EAAE,gBAAgB,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,+BAolB7D"}
@@ -0,0 +1,68 @@
1
+ import type { WidgetLauncherSpec } from './widget-view.js';
2
+ import { type WidgetAvatar } from '../avatar.js';
3
+ import { alignOf, type ConciergePosition } from './position.js';
4
+ /**
5
+ * The collapsed concierge: a pill the visitor can read, press, and move.
6
+ *
7
+ * ## Why a pill and not a round button
8
+ *
9
+ * A bare orb says "there is a bot here" and nothing else. This product's
10
+ * concierge answers in SPEECH, which is the thing a visitor has to be told —
11
+ * nobody presses an unlabelled circle expecting to talk to it. So the launcher
12
+ * carries the tenant's own words (`label`), beside the face rather than instead
13
+ * of it: the mascot is what the concierge IS, and swapping it for a microphone
14
+ * glyph would trade a personality for an icon that says less.
15
+ *
16
+ * ## Why it is draggable
17
+ *
18
+ * The widget sits on somebody else's page, over content the tenant chose and we
19
+ * have never seen. A fixed corner covers a cookie bar on one site and a "buy"
20
+ * button on another, and no default can be right everywhere. The tenant picks
21
+ * where it starts; the visitor gets the last word.
22
+ *
23
+ * Dragging is the obvious gesture and the inaccessible one, so the grip is a
24
+ * real focusable control and arrow keys move between the same six anchors —
25
+ * see `positionForArrow`. Anyone who cannot drag can still move the thing off
26
+ * the content it is covering.
27
+ *
28
+ * ## What it does NOT do
29
+ *
30
+ * It does not remember anything. Where the widget sits between visits is the
31
+ * host app's business — it owns the storage, the tenant default it falls back
32
+ * to, and the consent posture around keeping anything at all.
33
+ */
34
+ export interface ConciergeLauncherProps {
35
+ /** Visible text. Absent ⇒ the face alone, and `srLabel` names it. */
36
+ readonly label?: string;
37
+ /** Accessible name of the launcher itself. Always required. */
38
+ readonly srLabel: string;
39
+ /** Accessible name of the drag grip, e.g. "Move the assistant". */
40
+ readonly moveLabel: string;
41
+ readonly position: ConciergePosition;
42
+ /** Absent ⇒ the launcher is fixed where the tenant put it, with no grip. */
43
+ readonly onPositionChange?: (position: ConciergePosition) => void;
44
+ readonly onOpen: () => void;
45
+ readonly hidden: boolean;
46
+ readonly id?: string;
47
+ readonly testId?: string;
48
+ /** Which face renders inside the pill. Defaults to `'orb'` — see `avatar.ts`. */
49
+ readonly avatar?: WidgetAvatar;
50
+ /**
51
+ * What the launcher has to say while the panel is closed —
52
+ * docs/CONCIERGE_GENERATIONS.md §4. The dock says these things in its row;
53
+ * the widget has no row, so they land here. Absent is the quiet launcher
54
+ * every caller had before phase 4.
55
+ */
56
+ readonly spec?: WidgetLauncherSpec;
57
+ /**
58
+ * `spec.initials` — the operator's, from the shared `handoffInitials`. An
59
+ * empty string is a real answer (a tenant who never turned
60
+ * `handoff.showOperatorName` on): the face falls back to the neutral mark
61
+ * rather than drawing an empty disc.
62
+ */
63
+ readonly initials?: string;
64
+ }
65
+ export declare function ConciergeLauncher({ label, srLabel, moveLabel, position, onPositionChange, onOpen, hidden, id, testId, avatar, spec, initials, }: ConciergeLauncherProps): import("react").JSX.Element;
66
+ /** Re-exported so a host can type its own stored value. */
67
+ export { alignOf };
68
+ //# sourceMappingURL=concierge-launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concierge-launcher.d.ts","sourceRoot":"","sources":["../../src/widget/concierge-launcher.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,OAAO,EAIP,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAWD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,EAAE,EACF,MAAM,EACN,MAA8B,EAC9B,IAAY,EACZ,QAAa,GACd,EAAE,sBAAsB,+BA6RxB;AAED,2DAA2D;AAC3D,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,299 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ import type { CallerInterruptReason } from '@saar-ai/widget-protocol/telemetry';
3
+ import type { WidgetLauncherSpec } from './widget-view.js';
4
+ import type { BotState } from '../bot-state.js';
5
+ import { type WidgetAvatar } from '../avatar.js';
6
+ import { type ConciergePosition } from './position.js';
7
+ /**
8
+ * The concierge widget's chrome: trigger, backdrop, panel, face, composer.
9
+ *
10
+ * ## Why it is a package and not a component in one app
11
+ *
12
+ * This widget renders in two places — the scripted preview on the marketing
13
+ * site and the real assistant in the product — and the preview's entire claim
14
+ * is that a visitor is looking at what they would get. Two implementations can
15
+ * only agree by hand, and would stop agreeing the first time either was
16
+ * touched. So the chrome is defined once, here, and each app supplies what is
17
+ * genuinely its own: the marketing preview replays a script, the product holds
18
+ * a live session with a microphone, product cards and a cart.
19
+ *
20
+ * What is deliberately NOT here: the transcript. `children` is the whole
21
+ * conversation area, because that is where the two legitimately differ — the
22
+ * preview renders bubbles, the product renders bubbles plus cards, attachments,
23
+ * markdown and a cart summary. A shell that tried to own that would end up with
24
+ * a prop for every feature either app ever grows.
25
+ *
26
+ * ## No i18n, no router, no data
27
+ *
28
+ * Every string arrives in {@link ConciergeShellProps.labels}. The package has
29
+ * no locale of its own, and an app that translates with `next-intl` should not
30
+ * have to reach a translator into a design-system component to render a button.
31
+ *
32
+ * ## It is a modal dialog, and behaves like one
33
+ *
34
+ * `Escape` closes, `Tab` is trapped inside the panel, and focus returns to the
35
+ * trigger on close — focus leaking to the page behind an open dialog leaves a
36
+ * keyboard or screen-reader user navigating content they cannot see.
37
+ *
38
+ * Focus lands on the COMPOSER, not the close button. It is what a visitor
39
+ * opened the panel to use, and a focused close button swallows the space bar:
40
+ * press space to start typing before clicking into the field and the panel
41
+ * shuts instead — a keyboard user's first keystroke dismissing the thing they
42
+ * just opened.
43
+ *
44
+ * ## The animation carries nothing
45
+ *
46
+ * Every flourish below is decorative and stops wholesale under
47
+ * `prefers-reduced-motion`. That is only safe because the state is also
48
+ * announced in text — see {@link ConciergeShellProps.announcement}, which is
49
+ * the live region and not an afterthought.
50
+ */
51
+ export interface ConciergeShellLabels {
52
+ /** Accessible name of the collapsed trigger. */
53
+ readonly open: string;
54
+ /**
55
+ * Visible text ON the collapsed launcher — the tenant's own words for their
56
+ * concierge, from the widget config, in the config's own locale.
57
+ *
58
+ * Absent leaves the face alone with `open` as its accessible name, which is
59
+ * what a host with nothing to say should render rather than a placeholder.
60
+ */
61
+ readonly launcher?: string;
62
+ /** Accessible name of the drag grip, e.g. "Move the assistant". */
63
+ readonly move?: string;
64
+ readonly close: string;
65
+ /** Accessible name of the dialog itself. */
66
+ readonly dialog: string;
67
+ readonly composerPlaceholder: string;
68
+ readonly send: string;
69
+ }
70
+ /**
71
+ * Where a call is, from the caller's point of view.
72
+ *
73
+ * The panel no longer draws a full status BAR for these — removed on
74
+ * request; the widget reads better without one. What it draws instead, on
75
+ * explicit later request, is a small one-word PILL under the orb (see
76
+ * `ConciergeShellVoice.labels`'s `connecting`/`listening`/`thinking`/
77
+ * `speaking` and the orb overlay below) — a partial reversal, not a
78
+ * contradiction: the pill shows only the call's current state word, never
79
+ * an error or a refusal reason, which still reaches the caller through the
80
+ * host's own status line exactly as before. The phase still decides which
81
+ * control the composer row offers too.
82
+ */
83
+ import type { ConciergeCallPhase } from '../voice-widget.js';
84
+ export type { ConciergeCallPhase };
85
+ /**
86
+ * The voice leg, as the panel needs to see it.
87
+ *
88
+ * Replaces the old `mic` prop, which could only express "there is a button".
89
+ * A voice-first widget has to express where the call IS: a caller who presses
90
+ * the microphone and sees nothing for four seconds concludes the product is
91
+ * broken, and that is exactly what the transport spends on a good day.
92
+ */
93
+ export interface ConciergeShellVoice {
94
+ readonly phase: ConciergeCallPhase;
95
+ /** Start a call. Only reachable while `phase` is `idle`. */
96
+ readonly onStart: () => void;
97
+ /** Leave the call — a different intention from muting it. */
98
+ readonly onEnd?: () => void;
99
+ /** Ask the browser for the microphone again, after it was refused. */
100
+ readonly onRetryMic?: () => void;
101
+ /**
102
+ * §4's `speaking` row — cut the agent off mid-reply. The dock puts this in
103
+ * its row; the widget puts it beside the microphone. Absent means the host
104
+ * cannot interrupt, and no control is drawn.
105
+ *
106
+ * The reason is `@saar-ai/widget-protocol/telemetry`'s vocabulary, narrowed
107
+ * exactly as `DockVoiceProps.onInterrupt` narrows it and for the same
108
+ * reason: this control is a TAP, and `'keyboard'` — "switched to text
109
+ * mid-reply" — fires from wherever a typed turn is submitted, never from
110
+ * here. The widget has no duck gesture, so `'tap'` is the only reason this
111
+ * chrome ever emits; the parameter stays because the two renderers report
112
+ * into one telemetry stream and a second spelling would split it.
113
+ */
114
+ readonly onInterrupt?: (reason: Exclude<CallerInterruptReason, 'keyboard'>) => void;
115
+ /**
116
+ * §4's `fix_browser` control. The browser refused the microphone and only
117
+ * the HOST knows how to help — a Shopify storefront and a bare page have
118
+ * different answers — so this is the host's callback, drawn only when it
119
+ * exists.
120
+ */
121
+ readonly onFixPermission?: () => void;
122
+ readonly muted?: boolean;
123
+ readonly onToggleMute?: () => void;
124
+ /** True while the agent is talking, so the bar can offer the interrupt. */
125
+ readonly agentSpeaking?: boolean;
126
+ /** 0..1, drives the level meter. */
127
+ readonly level?: number;
128
+ /**
129
+ * Present and DISABLED rather than hidden, for a surface that has no voice
130
+ * leg but wants to show the product has one — the marketing preview. A host
131
+ * with nothing to offer omits `voice` entirely.
132
+ */
133
+ readonly disabled?: boolean;
134
+ readonly labels: {
135
+ /** Accessible name of the start button, and its tooltip when disabled. */
136
+ readonly start: string;
137
+ readonly end?: string;
138
+ readonly mute?: string;
139
+ readonly unmute?: string;
140
+ /** One line for the call bar: "Connecting…", "You can talk now", a reason. */
141
+ readonly status?: string;
142
+ /** Shown while the agent speaks: "go ahead and interrupt". */
143
+ readonly interrupt?: string;
144
+ /** The `fix_browser` control's own label. */
145
+ readonly fixBrowser?: string;
146
+ /** The retry button, offered only when the microphone was refused. */
147
+ readonly retry?: string;
148
+ /**
149
+ * WHY the control cannot be used, replacing `start` as the accessible
150
+ * name for as long as it cannot — see `micLabel` below.
151
+ *
152
+ * `start` names the action the button would perform, and a button that
153
+ * performs nothing must not announce one: a caller who hears "Start
154
+ * talking" on a control that refuses every press has been told the
155
+ * product is broken. Read only while the control is unusable
156
+ * (`disabled`, or `phase === 'blocked'`), so a host can supply it
157
+ * unconditionally; absent falls back to the old behaviour, which is what
158
+ * a host with no reason worth naming should get.
159
+ */
160
+ readonly unavailable?: string;
161
+ /**
162
+ * The four words the voice-state pill under the orb shows (see that
163
+ * pill's own doc comment) — one per state a live call can be in.
164
+ * Defaults to the package's brand-neutral English fallback
165
+ * (`defaultWidgetMessages`, `messages.ts`) so an existing caller that
166
+ * has not been updated to pass these still renders sensibly; a host
167
+ * with its own translation catalogue supplies its own.
168
+ */
169
+ readonly connecting?: string;
170
+ readonly listening?: string;
171
+ readonly thinking?: string;
172
+ readonly speaking?: string;
173
+ };
174
+ }
175
+ /**
176
+ * The small wordmark link rendered directly under the open panel — which
177
+ * adopter's framework fork produced this bundle, not a per-tenant value. See
178
+ * {@link ConciergeShellProps.attribution}'s own doc comment for the full
179
+ * "why not just resolve `@wesence/branding` here" reasoning. Exported (rather
180
+ * than declared inline on each prop that carries it) so `voice-widget.tsx`,
181
+ * `host-widget.tsx`, and `cdn/core.ts`'s `UiModule` reference one definition
182
+ * instead of four independent copies of the same two-field shape.
183
+ */
184
+ import type { WidgetAttribution } from '../dock/dock.js';
185
+ export type { WidgetAttribution };
186
+ export interface ConciergeShellProps {
187
+ readonly open: boolean;
188
+ readonly onOpenChange: (open: boolean) => void;
189
+ /** What the face renders. */
190
+ readonly state: BotState;
191
+ /** One-shot flourish when the visitor's own message lands. */
192
+ readonly messageArrived?: boolean;
193
+ /**
194
+ * What the launcher says while the panel is closed —
195
+ * docs/CONCIERGE_GENERATIONS.md §4, forwarded verbatim to
196
+ * `ConciergeLauncher`. `ShellRenderer` derives it; a hand-made caller (the
197
+ * marketing preview, the console's frames) leaves it out and gets the quiet
198
+ * launcher it always had.
199
+ */
200
+ readonly launcher?: WidgetLauncherSpec;
201
+ /** `launcher.initials` — the operator's, already computed by the caller. */
202
+ readonly launcherInitials?: string;
203
+ /** `typing` — somebody on the other side is composing; drawn at the foot of the transcript. */
204
+ readonly typing?: boolean;
205
+ /**
206
+ * §4's `human` row: the person holding the conversation, named under the
207
+ * orb. The dock says this in its row; the widget says it in the panel's
208
+ * header, which is the only place in this chrome that is always visible
209
+ * while the panel is open.
210
+ */
211
+ readonly operatorName?: string;
212
+ /** Which face — the 'orb' blob or the 'knot' rope line. Defaults to `'orb'`; see `avatar.ts`. */
213
+ readonly avatar?: WidgetAvatar;
214
+ readonly labels: ConciergeShellLabels;
215
+ /**
216
+ * The conversation. Rendered inside the panel's own scroll container, so a
217
+ * caller supplies list items and nothing about scrolling or padding.
218
+ */
219
+ readonly children: ReactNode;
220
+ /** Between the face and the transcript — the preview's "scripted" badge. */
221
+ readonly badge?: ReactNode;
222
+ readonly draft: string;
223
+ readonly onDraftChange: (value: string) => void;
224
+ /** The composer was submitted with a non-empty draft. */
225
+ readonly onSubmit: () => void;
226
+ readonly composerDisabled?: boolean;
227
+ /** Omitted ⇒ no voice control renders at all. */
228
+ readonly voice?: ConciergeShellVoice;
229
+ /**
230
+ * Rendered inside the composer, before the text field.
231
+ *
232
+ * Exists for the product's attachment control, which the marketing preview
233
+ * has nothing to put there. A slot rather than an `onAttach` prop because
234
+ * the widget that owns the file input also owns its label, its accepted
235
+ * types and what "uploading" looks like — none of which belongs in a design
236
+ * system component.
237
+ */
238
+ readonly composerLeading?: ReactNode;
239
+ /**
240
+ * What a screen reader is told, replacing everything the animation conveys.
241
+ * Changing it announces it, so it should be the state or the newest reply —
242
+ * never a value that changes on every frame.
243
+ */
244
+ readonly announcement?: string;
245
+ /** `[data-skin]` on the root, for the brand-token overrides. */
246
+ readonly skin?: string;
247
+ /** Inline brand-token overrides, for a skin computed at runtime. */
248
+ readonly skinStyle?: CSSProperties;
249
+ /**
250
+ * Namespaces this instance's element ids. Two widgets on one page would
251
+ * otherwise share a trigger id and hand focus to each other's.
252
+ */
253
+ readonly idPrefix?: string;
254
+ /** Scrolls the transcript to the newest turn when it changes. */
255
+ readonly scrollKey?: unknown;
256
+ /**
257
+ * Which edge the widget hangs from. Defaults to bottom-centre.
258
+ *
259
+ * The TENANT's default arrives here from the widget config; a visitor may
260
+ * move it, which is what `onPositionChange` reports. Remembering their choice
261
+ * is the host app's business — see `ConciergeLauncher`.
262
+ */
263
+ readonly position?: ConciergePosition;
264
+ /** Absent ⇒ the launcher cannot be moved and renders no grip. */
265
+ readonly onPositionChange?: (position: ConciergePosition) => void;
266
+ /**
267
+ * `data-testid`s for the controls the shell owns.
268
+ *
269
+ * The product's suite drives this widget through its own ids and predates
270
+ * the shell; naming them here keeps those tests asserting behaviour rather
271
+ * than being rewritten into assertions about a design system's markup.
272
+ */
273
+ readonly testIds?: {
274
+ readonly trigger?: string;
275
+ readonly panel?: string;
276
+ readonly input?: string;
277
+ readonly send?: string;
278
+ readonly mic?: string;
279
+ readonly endCall?: string;
280
+ };
281
+ /**
282
+ * The small wordmark link rendered directly under the open panel — which
283
+ * adopter's framework fork produced this bundle, not a per-tenant value.
284
+ *
285
+ * A NAME and DATA prop, same rule this file states above for `labels`: this
286
+ * package owns no identity of its own and never imports `@wesence/branding`
287
+ * (this package publishes to public npm with an absolute "resolves no
288
+ * `@wesence/*` module at all" guard, `scripts/check-npm-bundle-provenance.mjs`) —
289
+ * the caller resolves `branding.name`/`branding.domain` and passes them
290
+ * down. `cdn/core.ts` does this unconditionally for the real merchant-facing
291
+ * embed (that file is CDN-only, out of the guard's scope, so importing
292
+ * `@wesence/branding` there is safe); any other caller wanting the badge
293
+ * (the marketing preview, a future light-DOM npm consumer) does the same.
294
+ * Absent ⇒ no attribution renders at all, rather than a placeholder.
295
+ */
296
+ readonly attribution?: WidgetAttribution;
297
+ }
298
+ export declare function ConciergeShell({ open, onOpenChange, state, messageArrived, launcher, launcherInitials, typing, operatorName, avatar, labels, children, badge, draft, onDraftChange, onSubmit, composerDisabled, voice, announcement, skin, skinStyle, idPrefix, scrollKey, composerLeading, testIds, position, onPositionChange, attribution, }: ConciergeShellProps): import("react").JSX.Element;
299
+ //# sourceMappingURL=concierge-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concierge-shell.d.ts","sourceRoot":"","sources":["../../src/widget/concierge-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAGhF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AA4BxE,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ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AAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAC1C;AAKD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,cAAsB,EACtB,QAAQ,EACR,gBAAgB,EAChB,MAAc,EACd,YAAY,EACZ,MAA8B,EAC9B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,gBAAwB,EACxB,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,QAAsB,EACtB,SAAS,EACT,eAAe,EACf,OAAO,EACP,QAAqC,EACrC,gBAAgB,EAChB,WAAW,GACZ,EAAE,mBAAmB,+BA8hCrB"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Where the concierge sits on the host page, and how a visitor moves it.
3
+ *
4
+ * Six anchors, not four. The two centres exist because the launcher is a PILL
5
+ * with a label on it now, not a round button: a wide control tucked into a
6
+ * corner reads as an ad, and the middle of an edge is where a host page's own
7
+ * content is least likely to be. The corners remain because they are where a
8
+ * tenant with a fixed footer or a cookie bar needs it.
9
+ *
10
+ * The tenant picks the default in the widget config; a visitor may drag it
11
+ * somewhere else, and where they put it is theirs — see `nearestPosition`.
12
+ */
13
+ export declare const CONCIERGE_POSITIONS: readonly ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'];
14
+ export type ConciergePosition = (typeof CONCIERGE_POSITIONS)[number];
15
+ export declare const DEFAULT_CONCIERGE_POSITION: ConciergePosition;
16
+ /** `top` | `bottom` — which edge the widget hangs from. */
17
+ export type ConciergeEdge = 'top' | 'bottom';
18
+ /** `left` | `center` | `right` — where along that edge. */
19
+ export type ConciergeAlign = 'left' | 'center' | 'right';
20
+ export declare function edgeOf(position: ConciergePosition): ConciergeEdge;
21
+ export declare function alignOf(position: ConciergePosition): ConciergeAlign;
22
+ /**
23
+ * The anchor a dropped widget should snap to.
24
+ *
25
+ * Thirds horizontally, halves vertically, measured on the widget's own CENTRE
26
+ * rather than the pointer: a visitor drags the grip, which sits at one end of
27
+ * the pill, and snapping on the pointer would send a pill they dropped dead
28
+ * centre off to whichever side they happened to be holding.
29
+ *
30
+ * Pure arithmetic on numbers the caller measures, so it is testable without a
31
+ * DOM and cannot disagree with itself across browsers.
32
+ * @param centre the widget's centre point, in viewport pixels
33
+ * @param viewport the viewport's size, in pixels
34
+ */
35
+ export declare function nearestPosition(centre: {
36
+ x: number;
37
+ y: number;
38
+ }, viewport: {
39
+ width: number;
40
+ height: number;
41
+ }): ConciergePosition;
42
+ /**
43
+ * The anchor an arrow key moves to.
44
+ *
45
+ * The keyboard equivalent of dragging, and not a nicety: a pointer-only way to
46
+ * move the widget is unusable for anyone who cannot drag, and the widget can
47
+ * cover a host page's own controls. Left/right walk the three columns and stop
48
+ * at the ends rather than wrapping — a control that jumps from one edge of the
49
+ * screen to the other because a key was held is disorienting. Up/down flip the
50
+ * edge.
51
+ * @param position where it is now
52
+ * @param key the arrow key pressed
53
+ */
54
+ export declare function positionForArrow(position: ConciergePosition, key: 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown'): ConciergePosition;
55
+ /** Tailwind classes pinning a fixed element to one anchor. */
56
+ export declare function positionClasses(position: ConciergePosition): string;
57
+ /**
58
+ * How the open PANEL lines up under (or over) the launcher.
59
+ *
60
+ * The panel is much wider than the pill, so it cannot simply share the
61
+ * launcher's anchor: pinned left it would still be pinned left, but pinned
62
+ * centre it has to centre on the viewport rather than on the pill.
63
+ */
64
+ export declare function panelClasses(position: ConciergePosition): string;
65
+ //# sourceMappingURL=position.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/widget/position.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,YAC9B,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,cAAc,CACN,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,0BAA0B,EAAE,iBAAmC,CAAC;AAE7E,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC7C,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,aAAa,CAEjE;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,cAAc,CAInE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1C,iBAAiB,CAMnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GACxD,iBAAiB,CAUnB;AAED,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQnE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQhE"}