@convai/web-sdk 1.8.0-beta.7 → 1.8.0-beta.8
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 +19 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -1
- package/dist/embed/ConvaiChatElement.d.ts +77 -1
- package/dist/embed/ConvaiChatElement.d.ts.map +1 -1
- package/dist/embed/ConvaiChatElement.js +433 -54
- package/dist/embed/ConvaiChatElement.js.map +1 -1
- package/dist/embed/chat-embed-v1.js +135 -35
- package/dist/embed/chat-embed-v1.js.map +3 -3
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +7 -0
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +111 -17
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js +1 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js.map +1 -1
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +7 -0
- package/dist/react/index.js.map +1 -1
- package/dist/utils/inlineMarkdown.d.ts +22 -0
- package/dist/utils/inlineMarkdown.d.ts.map +1 -1
- package/dist/utils/inlineMarkdown.js +84 -7
- package/dist/utils/inlineMarkdown.js.map +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +137 -11
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/index.d.ts +2 -0
- package/dist/vanilla/index.d.ts.map +1 -1
- package/dist/vanilla/index.js +2 -0
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vanilla/styles.d.ts.map +1 -1
- package/dist/vanilla/styles.js +12 -0
- package/dist/vanilla/styles.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +32 -10
package/README.md
CHANGED
|
@@ -185,7 +185,10 @@ custom element:
|
|
|
185
185
|
|
|
186
186
|
The element renders directly in the host page with Shadow DOM style isolation,
|
|
187
187
|
automatically mints a fresh grant per connection, and emits `convai-ready`,
|
|
188
|
-
`convai-disconnect`,
|
|
188
|
+
`convai-disconnect`, `convai-error`, `convai-copy`, and `convai-session-reset`
|
|
189
|
+
DOM events. It accepts `full-window`, `display-name` and `image-url` alongside
|
|
190
|
+
the endpoint attributes, and is themed through `--convai-chat-*` custom
|
|
191
|
+
properties — see [the published chat guide](docs/convai_published_chat.md#the-convai-chat-element). The production bundle uses
|
|
189
192
|
`https://api.convai.com` and `https://realtime-api.convai.com` only as defaults
|
|
190
193
|
for a hand-written SaaS integration. Platform-generated snippets always emit
|
|
191
194
|
the deployment's public Character API and Core endpoints explicitly, so an
|
|
@@ -244,6 +247,7 @@ Full documentation is at **<a href="https://docs.convai.com/api-docs/plugins-and
|
|
|
244
247
|
| [Character Versioning](docs/convai_character_versioning.md) | Connect to a draft, latest, or tagged version; list, compare, release and promote versions |
|
|
245
248
|
| [Multi-Character Rooms](docs/convai_multi_character.md) | Rosters, `joinRoom`, interaction targets, live roster updates, per-member attribution |
|
|
246
249
|
| [Published Text Chat](docs/convai_published_chat.md) | Grant-based text-only sessions, `<convai-chat>`, lifecycle and API reference |
|
|
250
|
+
| [Link Previews](docs/convai_link_previews.md) | Rendering links the character sends: previews, custom chat UIs, the scheme allowlist |
|
|
247
251
|
| [Events Reference (local)](docs/convai_events.md) | Every event with its typed payload, including the v2 and multi-character events |
|
|
248
252
|
|
|
249
253
|
---
|
|
@@ -261,6 +265,20 @@ Full documentation is at **<a href="https://docs.convai.com/api-docs/plugins-and
|
|
|
261
265
|
| `@convai/web-sdk/lipsync-helpers` | Blendshape format utilities and queue helpers |
|
|
262
266
|
| `@convai/web-sdk/vanilla/websocket` | **Opt-in.** Registers the WebSocket transport. Import alongside `/vanilla` when using `transport: "websocket"`. |
|
|
263
267
|
|
|
268
|
+
### Module format
|
|
269
|
+
|
|
270
|
+
The package is ESM. Every entry point above also resolves through the `require`
|
|
271
|
+
and `default` conditions, so CommonJS tooling — Jest, ts-node, CJS bundlers —
|
|
272
|
+
can resolve and mock it:
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
const { ConvaiClient } = require('@convai/web-sdk/core')
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
There is no separate CommonJS build; `require()` loads the ESM files directly,
|
|
279
|
+
which Node supports from **22.12** onward. On older Node, `import` it or let
|
|
280
|
+
your bundler handle the ESM.
|
|
281
|
+
|
|
264
282
|
---
|
|
265
283
|
|
|
266
284
|
## WebSocket transport
|
package/dist/core/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export { parseCharacterReference, resolveCharacterReference, isCharacterVersionS
|
|
|
15
15
|
export { BlendshapeQueue } from './BlendshapeQueue.js';
|
|
16
16
|
export type { TurnStats, BlendshapeChunkMetadata } from './BlendshapeQueue.js';
|
|
17
17
|
export { EventEmitter } from './EventEmitter.js';
|
|
18
|
+
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
19
|
+
export type { InlineNode, MediaKind } from '../utils/inlineMarkdown.js';
|
|
18
20
|
export { ModelOutputExtensionRegistry, isJsonObject, isJsonValue, parseModelOutputMessage, } from './modelOutput.js';
|
|
19
21
|
export type { ExtensionRenderResult, ModelOutputExtensionRenderer, } from './modelOutput.js';
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGpE,cAAc,SAAS,CAAC;AAGxB,OAAO,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AY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,8BAA8B,EAC9B,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACvG,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EACL,4BAA4B,EAC5B,YAAY,EACZ,WAAW,EACX,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,eAAe,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -20,5 +20,11 @@ export { parseCharacterReference, resolveCharacterReference, isCharacterVersionS
|
|
|
20
20
|
export { BlendshapeQueue } from './BlendshapeQueue.js';
|
|
21
21
|
// Event Emitter (for advanced usage)
|
|
22
22
|
export { EventEmitter } from './EventEmitter.js';
|
|
23
|
+
// Inline markdown tokenizer. `bot-llm-text` arrives as a plain string, so a
|
|
24
|
+
// custom chat UI — anything not using ConvaiWidget — needs this to turn one
|
|
25
|
+
// line of it into links, images and bare URLs. Only the scheme allowlist in
|
|
26
|
+
// `isSafeHref` becomes a link, so a renderer built on these nodes cannot emit
|
|
27
|
+
// a javascript: href however the server framed it.
|
|
28
|
+
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
23
29
|
export { ModelOutputExtensionRegistry, isJsonObject, isJsonValue, parseModelOutputMessage, } from './modelOutput.js';
|
|
24
30
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpE,4CAA4C;AAC5C,cAAc,SAAS,CAAC;AAExB,mBAAmB;AACnB,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAKrD,gCAAgC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,8BAA8B,EAC9B,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAEnC,kDAAkD;AAClD,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,+BAA+B;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,qCAAqC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,4BAA4B,EAC5B,YAAY,EACZ,WAAW,EACX,uBAAuB,GACxB,MAAM,eAAe,CAAC","sourcesContent":["// Main client\nexport { ActionResultAckError, ConvaiClient } from './ConvaiClient';\n\n// Types (including IConvaiClient interface)\nexport * from './types';\n\n// Helper functions\nexport { getDisconnectReasonMessage } from './types';\n\n// Type alias for easier usage\nexport type { ConvaiClient as ConvaiClientType } from './ConvaiClient';\n\n// Managers (for advanced usage)\nexport { AudioManager } from './AudioManager';\nexport { VideoManager } from './VideoManager';\nexport { ScreenShareManager } from './ScreenShareManager';\nexport { MessageHandler } from './MessageHandler';\nexport { MemoryManager } from './MemoryManager';\nexport { CharacterRoster } from './CharacterRoster';\nexport { ConvaiRoomError } from './ConvaiRoomError';\nexport {\n MULTI_CHARACTER_MAX_CHARACTERS,\n isRosterConfig,\n} from './rosterRequest';\nexport {\n CharacterVersionManager,\n CharacterApiError,\n DEFAULT_CHARACTER_API_URL,\n} from './CharacterVersionManager';\n\n// Character reference helpers (version selectors)\nexport {\n parseCharacterReference,\n resolveCharacterReference,\n isCharacterVersionSelector,\n isCharacterUuid,\n} from './characterReference';\n\n// Blendshape queue for lipsync\nexport { BlendshapeQueue } from './BlendshapeQueue';\nexport type { TurnStats, BlendshapeChunkMetadata } from './BlendshapeQueue';\n\n// Event Emitter (for advanced usage)\nexport { EventEmitter } from './EventEmitter';\n\nexport {\n ModelOutputExtensionRegistry,\n isJsonObject,\n isJsonValue,\n parseModelOutputMessage,\n} from './modelOutput';\nexport type {\n ExtensionRenderResult,\n ModelOutputExtensionRenderer,\n} from './modelOutput';\n"]}
|
|
1
|
+
{"version":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,GACxB,MAAM,eAAe,CAAC","sourcesContent":["// Main client\nexport { ActionResultAckError, ConvaiClient } from './ConvaiClient';\n\n// Types (including IConvaiClient interface)\nexport * from './types';\n\n// Helper functions\nexport { getDisconnectReasonMessage } from './types';\n\n// Type alias for easier usage\nexport type { ConvaiClient as ConvaiClientType } from './ConvaiClient';\n\n// Managers (for advanced usage)\nexport { AudioManager } from './AudioManager';\nexport { VideoManager } from './VideoManager';\nexport { ScreenShareManager } from './ScreenShareManager';\nexport { MessageHandler } from './MessageHandler';\nexport { MemoryManager } from './MemoryManager';\nexport { CharacterRoster } from './CharacterRoster';\nexport { ConvaiRoomError } from './ConvaiRoomError';\nexport {\n MULTI_CHARACTER_MAX_CHARACTERS,\n isRosterConfig,\n} from './rosterRequest';\nexport {\n CharacterVersionManager,\n CharacterApiError,\n DEFAULT_CHARACTER_API_URL,\n} from './CharacterVersionManager';\n\n// Character reference helpers (version selectors)\nexport {\n parseCharacterReference,\n resolveCharacterReference,\n isCharacterVersionSelector,\n isCharacterUuid,\n} from './characterReference';\n\n// Blendshape queue for lipsync\nexport { BlendshapeQueue } from './BlendshapeQueue';\nexport type { TurnStats, BlendshapeChunkMetadata } from './BlendshapeQueue';\n\n// Event Emitter (for advanced usage)\nexport { EventEmitter } from './EventEmitter';\n\n// Inline markdown tokenizer. `bot-llm-text` arrives as a plain string, so a\n// custom chat UI — anything not using ConvaiWidget — needs this to turn one\n// line of it into links, images and bare URLs. Only the scheme allowlist in\n// `isSafeHref` becomes a link, so a renderer built on these nodes cannot emit\n// a javascript: href however the server framed it.\nexport { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown';\nexport type { InlineNode, MediaKind } from '../utils/inlineMarkdown';\n\nexport {\n ModelOutputExtensionRegistry,\n isJsonObject,\n isJsonValue,\n parseModelOutputMessage,\n} from './modelOutput';\nexport type {\n ExtensionRenderResult,\n ModelOutputExtensionRenderer,\n} from './modelOutput';\n"]}
|
|
@@ -7,6 +7,11 @@ export declare class ConvaiChatElement extends HTMLElement {
|
|
|
7
7
|
private messages;
|
|
8
8
|
private descriptor;
|
|
9
9
|
private failureReported;
|
|
10
|
+
/** A session that could still produce a reply: set when the client is wired
|
|
11
|
+
* up, cleared when it ends. Not a wait flag — see `isAwaitingReply()`. */
|
|
12
|
+
private sessionLive;
|
|
13
|
+
private sessionId;
|
|
14
|
+
private retryVisible;
|
|
10
15
|
connectedCallback(): void;
|
|
11
16
|
disconnectedCallback(): void;
|
|
12
17
|
private requireAttribute;
|
|
@@ -14,12 +19,83 @@ export declare class ConvaiChatElement extends HTMLElement {
|
|
|
14
19
|
private start;
|
|
15
20
|
private fail;
|
|
16
21
|
private cleanupClient;
|
|
22
|
+
/**
|
|
23
|
+
* A host that already knows who the character is can seed the header through
|
|
24
|
+
* `display-name` and `image-url`, so the identity paints before the
|
|
25
|
+
* publication descriptor resolves. The fetched descriptor always wins.
|
|
26
|
+
*/
|
|
27
|
+
private displayName;
|
|
28
|
+
/** `null` is a valid descriptor value, so a loaded descriptor without an
|
|
29
|
+
* image clears the seed rather than falling back to it. */
|
|
30
|
+
private imageUrl;
|
|
17
31
|
private renderDescriptor;
|
|
32
|
+
/**
|
|
33
|
+
* The character's own avatar, reused as the icon beside each of its replies.
|
|
34
|
+
* Without an image this is the character's initial on the accent disc, not a
|
|
35
|
+
* bare `<img>` — which the avatar rule would paint as an empty disc.
|
|
36
|
+
*/
|
|
37
|
+
private avatarElement;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the character owes a reply that has produced no text yet — the
|
|
40
|
+
* question the typing indicator asks.
|
|
41
|
+
*
|
|
42
|
+
* Derived from the message list on every render rather than tracked as
|
|
43
|
+
* state, because the list already records every event that starts or ends a
|
|
44
|
+
* wait: a send appends a `user-llm-text` row synchronously
|
|
45
|
+
* (`MessageHandler.addUserTextMessage`), a turn begins as an empty
|
|
46
|
+
* `bot-llm-text` row (`bot-llm-started`), the first token fills that row,
|
|
47
|
+
* and an abstain appends `llm-no-response`. Held as flags instead, each of
|
|
48
|
+
* those events needed its own handler and every one I missed was a bug:
|
|
49
|
+
* dots through an entire reply, no dots for a character-initiated greeting
|
|
50
|
+
* or a follow-up turn, dots forever after an abstain.
|
|
51
|
+
*
|
|
52
|
+
* The scan reads the unfiltered list: the rows that mark a turn's start and
|
|
53
|
+
* its abstain are exactly the ones the transcript hides. An empty bot row
|
|
54
|
+
* means the turn is open only while it is still streaming — `bot-llm-stopped`
|
|
55
|
+
* finalizes the row in place, so an empty finalized row is a turn that ended
|
|
56
|
+
* without text (an interrupt, or a stop before the first token).
|
|
57
|
+
*/
|
|
58
|
+
private isAwaitingReply;
|
|
59
|
+
/**
|
|
60
|
+
* Close the open turn in this element's own copy of the transcript.
|
|
61
|
+
*
|
|
62
|
+
* `sendInterruptMessage()` transmits the interrupt; it does not finalize the
|
|
63
|
+
* empty streaming row, which stays open until a `bot-llm-stopped` frame
|
|
64
|
+
* arrives — delayed, or never, if the acknowledgement is lost. The visitor
|
|
65
|
+
* asked the character to stop, so the wait ends with the click. A later
|
|
66
|
+
* `messagesChange` replaces this array wholesale, so nothing diverges.
|
|
67
|
+
*/
|
|
68
|
+
private finalizeOpenTurn;
|
|
69
|
+
private visibleMessages;
|
|
18
70
|
private renderMessages;
|
|
71
|
+
/** Opening state: who the visitor is talking to, not a bare instruction. */
|
|
72
|
+
private introElement;
|
|
73
|
+
private typingElement;
|
|
19
74
|
private setStatus;
|
|
20
75
|
private setError;
|
|
76
|
+
private setSessionId;
|
|
21
77
|
private updateControls;
|
|
22
|
-
private
|
|
78
|
+
private updateTranscriptControls;
|
|
79
|
+
/** Shows or hides Stop. The typing indicator no longer rides on this. */
|
|
80
|
+
private setResponding;
|
|
81
|
+
/** The session can no longer produce a reply: stop waiting, stop offering
|
|
82
|
+
* Stop, and redraw so the transcript agrees. */
|
|
83
|
+
private endSession;
|
|
84
|
+
/** Same `Author: text` shape the playground's Copy chat produces. */
|
|
85
|
+
private copyTranscript;
|
|
86
|
+
private writeToClipboard;
|
|
87
|
+
/**
|
|
88
|
+
* A published session is bound to the room it connected with: the character
|
|
89
|
+
* session id travels in the connect request, not in each `user_text_message`,
|
|
90
|
+
* so `ConvaiClient.resetSession()` would clear the transcript while the server
|
|
91
|
+
* kept the previous conversation. Reconnecting on a fresh launch grant is the
|
|
92
|
+
* only reset the published flow supports, and `start()` already tears the old
|
|
93
|
+
* client down before requesting one.
|
|
94
|
+
*/
|
|
95
|
+
private resetSession;
|
|
96
|
+
private retryElement;
|
|
97
|
+
/** Held as state, not a one-off append: a typing or message re-render would
|
|
98
|
+
* otherwise clear the only control left after a failed connection. */
|
|
23
99
|
private showRetry;
|
|
24
100
|
private dispatch;
|
|
25
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvaiChatElement.d.ts","sourceRoot":"","sources":["../../src/embed/ConvaiChatElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConvaiChatElement.d.ts","sourceRoot":"","sources":["../../src/embed/ConvaiChatElement.ts"],"names":[],"mappings":"AA6KA,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,eAAe,CAAS;IAChC;8EAC0E;IAC1E,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAAS;IAE7B,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAO5B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,WAAW;YAmEL,KAAK;YAwGL,IAAI;YAeJ,aAAa;IAQ3B;;;;OAIG;IACH,OAAO,CAA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