@carbon/ai-chat 1.13.0 → 1.14.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 (31) hide show
  1. package/dist/css/chat-explainability-popover.css +161 -0
  2. package/dist/es/aiChatEntry.js +14 -2
  3. package/dist/es/aiChatEntry.js.map +1 -1
  4. package/dist/es/chat.ChatAppEntry.js +113 -21
  5. package/dist/es/chat.ChatAppEntry.js.map +1 -1
  6. package/dist/es/chat.index.js +581 -0
  7. package/dist/es/chat.index.js.map +1 -0
  8. package/dist/es/chat.languageUtils.js +2 -0
  9. package/dist/es/chat.languageUtils.js.map +1 -1
  10. package/dist/es/web-components/cds-aichat-container/index.js +10 -500
  11. package/dist/es/web-components/cds-aichat-container/index.js.map +1 -1
  12. package/dist/es/web-components/cds-aichat-custom-element/index.js +19 -227
  13. package/dist/es/web-components/cds-aichat-custom-element/index.js.map +1 -1
  14. package/dist/es-custom/aiChatEntry.js +14 -2
  15. package/dist/es-custom/aiChatEntry.js.map +1 -1
  16. package/dist/es-custom/chat.ChatAppEntry.js +113 -21
  17. package/dist/es-custom/chat.ChatAppEntry.js.map +1 -1
  18. package/dist/es-custom/chat.index.js +581 -0
  19. package/dist/es-custom/chat.index.js.map +1 -0
  20. package/dist/es-custom/chat.languageUtils.js +2 -0
  21. package/dist/es-custom/chat.languageUtils.js.map +1 -1
  22. package/dist/es-custom/web-components/cds-aichat-container/index.js +10 -500
  23. package/dist/es-custom/web-components/cds-aichat-container/index.js.map +1 -1
  24. package/dist/es-custom/web-components/cds-aichat-custom-element/index.js +19 -227
  25. package/dist/es-custom/web-components/cds-aichat-custom-element/index.js.map +1 -1
  26. package/dist/scss/_chat-explainability-popover.scss +154 -0
  27. package/dist/types/aiChatEntry.d.ts +2 -2
  28. package/dist/types/{serverEntry-CU81SMOz.d.ts → serverEntry-mONw-M8N.d.ts} +206 -47
  29. package/dist/types/serverEntry.d.ts +1 -1
  30. package/package.json +5 -5
  31. package/telemetry.yml +3 -24
@@ -1,18 +1,20 @@
1
- import { __decorate } from "tslib";
1
+ import "tslib";
2
2
 
3
- import { css, LitElement, html } from "lit";
3
+ export { C as default } from "../../chat.index.js";
4
4
 
5
- import { property, state } from "lit/decorators.js";
5
+ import "lit";
6
6
 
7
- import React from "react";
7
+ import "lit/decorators.js";
8
8
 
9
- import { createRoot } from "react-dom/client";
9
+ import "@carbon/ai-chat-components/es/globals/decorators/index.js";
10
10
 
11
- import { C as ChatAppEntry } from "../../chat.ChatAppEntry.js";
11
+ import "../../chat.languageUtils.js";
12
12
 
13
- import { carbonElement } from "@carbon/ai-chat-components/es/globals/decorators/index.js";
13
+ import "react";
14
14
 
15
- import { B as BusEventType } from "../../chat.languageUtils.js";
15
+ import "react-dom/client";
16
+
17
+ import "../../chat.ChatAppEntry.js";
16
18
 
17
19
  import "lodash-es/isEqual.js";
18
20
 
@@ -223,496 +225,4 @@ import "@carbon/web-components/es/components/chat-button/chat-button.js";
223
225
  import "@carbon/ai-chat-components/es/components/chain-of-thought/defs.js";
224
226
 
225
227
  import "dayjs/locale/en.js";
226
-
227
- let ChatContainerInternal = class ChatContainerInternal extends LitElement {
228
- firstUpdated() {
229
- if (this.config) {
230
- this.renderReactApp();
231
- }
232
- }
233
- updated(changedProperties) {
234
- if (this.config && (changedProperties.has("config") || changedProperties.has("strings") || changedProperties.has("serviceDeskFactory") || changedProperties.has("serviceDesk") || changedProperties.has("onBeforeRender") || changedProperties.has("onAfterRender") || changedProperties.has("element"))) {
235
- this.renderReactApp();
236
- }
237
- }
238
- async renderReactApp() {
239
- const container = this.ensureReactRoot();
240
- this.root.render(React.createElement(ChatAppEntry, {
241
- config: this.config,
242
- strings: this.strings,
243
- serviceDeskFactory: this.serviceDeskFactory,
244
- serviceDesk: this.serviceDesk,
245
- onBeforeRender: this.onBeforeRender,
246
- onAfterRender: this.onAfterRender,
247
- container,
248
- element: this.element
249
- }));
250
- }
251
- ensureReactRoot() {
252
- if (!this.reactContainer) {
253
- const container = document.createElement("div");
254
- container.classList.add("cds-aichat--react-app");
255
- this.shadowRoot.appendChild(container);
256
- this.reactContainer = container;
257
- }
258
- if (!this.root) {
259
- this.root = createRoot(this.reactContainer);
260
- }
261
- return this.reactContainer;
262
- }
263
- disconnectedCallback() {
264
- this.root?.unmount();
265
- super.disconnectedCallback();
266
- }
267
- };
268
-
269
- ChatContainerInternal.styles = css`
270
- :host {
271
- display: block;
272
- width: 100%;
273
- height: 100%;
274
- box-sizing: border-box;
275
- z-index: var(--cds-aichat-z-index, auto);
276
- }
277
- `;
278
-
279
- __decorate([ property({
280
- type: Object
281
- }) ], ChatContainerInternal.prototype, "config", void 0);
282
-
283
- __decorate([ property({
284
- type: Object
285
- }) ], ChatContainerInternal.prototype, "strings", void 0);
286
-
287
- __decorate([ property({
288
- attribute: false
289
- }) ], ChatContainerInternal.prototype, "serviceDeskFactory", void 0);
290
-
291
- __decorate([ property({
292
- type: Object
293
- }) ], ChatContainerInternal.prototype, "serviceDesk", void 0);
294
-
295
- __decorate([ property({
296
- type: HTMLElement
297
- }) ], ChatContainerInternal.prototype, "element", void 0);
298
-
299
- __decorate([ property() ], ChatContainerInternal.prototype, "onBeforeRender", void 0);
300
-
301
- __decorate([ property() ], ChatContainerInternal.prototype, "onAfterRender", void 0);
302
-
303
- ChatContainerInternal = __decorate([ carbonElement("cds-aichat-internal") ], ChatContainerInternal);
304
-
305
- let ChatContainer = class ChatContainer extends LitElement {
306
- constructor() {
307
- super(...arguments);
308
- this._userDefinedSlotNames = [];
309
- this._customFooterSlotNames = [];
310
- this._writeableElementSlots = [];
311
- this._userDefinedStateBySlot = {};
312
- this._callbackElements = new Map;
313
- this.userDefinedHandler = event => {
314
- const {slot} = event.data;
315
- if (!this._userDefinedSlotNames.includes(slot)) {
316
- this._userDefinedSlotNames = [ ...this._userDefinedSlotNames, slot ];
317
- }
318
- };
319
- this.customFooterHandler = event => {
320
- const {slotName} = event.data;
321
- if (!this._customFooterSlotNames.includes(slotName)) {
322
- this._customFooterSlotNames = [ ...this._customFooterSlotNames, slotName ];
323
- }
324
- };
325
- this.enhancedUserDefinedHandler = event => {
326
- const {slot} = event.data;
327
- if (!this._userDefinedSlotNames.includes(slot)) {
328
- this._userDefinedSlotNames = [ ...this._userDefinedSlotNames, slot ];
329
- }
330
- this._userDefinedStateBySlot = {
331
- ...this._userDefinedStateBySlot,
332
- [slot]: {
333
- fullMessage: event.data.fullMessage,
334
- messageItem: event.data.message
335
- }
336
- };
337
- };
338
- this.enhancedUserDefinedChunkHandler = event => {
339
- const {slot, chunk} = event.data;
340
- if (!this._userDefinedSlotNames.includes(slot)) {
341
- this._userDefinedSlotNames = [ ...this._userDefinedSlotNames, slot ];
342
- }
343
- if ("complete_item" in chunk) {
344
- this._userDefinedStateBySlot = {
345
- ...this._userDefinedStateBySlot,
346
- [slot]: {
347
- messageItem: chunk.complete_item
348
- }
349
- };
350
- } else if ("partial_item" in chunk) {
351
- const existing = this._userDefinedStateBySlot[slot];
352
- this._userDefinedStateBySlot = {
353
- ...this._userDefinedStateBySlot,
354
- [slot]: {
355
- ...existing,
356
- partialItems: [ ...existing?.partialItems ?? [], chunk.partial_item ]
357
- }
358
- };
359
- }
360
- };
361
- this.restartHandler = () => {
362
- this._userDefinedStateBySlot = {};
363
- this._userDefinedSlotNames = [];
364
- for (const el of this._callbackElements.values()) {
365
- el.remove();
366
- }
367
- this._callbackElements.clear();
368
- };
369
- this.onBeforeRenderOverride = async instance => {
370
- this._instance = instance;
371
- if (this.renderUserDefinedResponse) {
372
- this._instance.on({
373
- type: BusEventType.USER_DEFINED_RESPONSE,
374
- handler: this.enhancedUserDefinedHandler
375
- });
376
- this._instance.on({
377
- type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,
378
- handler: this.enhancedUserDefinedChunkHandler
379
- });
380
- this._instance.on({
381
- type: BusEventType.RESTART_CONVERSATION,
382
- handler: this.restartHandler
383
- });
384
- } else {
385
- this._instance.on({
386
- type: BusEventType.USER_DEFINED_RESPONSE,
387
- handler: this.userDefinedHandler
388
- });
389
- this._instance.on({
390
- type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,
391
- handler: this.userDefinedHandler
392
- });
393
- }
394
- this._instance.on({
395
- type: BusEventType.CUSTOM_FOOTER_SLOT,
396
- handler: this.customFooterHandler
397
- });
398
- this.addWriteableElementSlots();
399
- this.attachWriteableElements();
400
- await (this.onBeforeRender?.(instance));
401
- };
402
- }
403
- syncCallbackRenderedElements() {
404
- for (const [slot, slotState] of Object.entries(this._userDefinedStateBySlot)) {
405
- const newContent = this.renderUserDefinedResponse?.(slotState, this._instance) ?? null;
406
- if (!newContent) {
407
- const existing = this._callbackElements.get(slot);
408
- if (existing) {
409
- existing.remove();
410
- this._callbackElements.delete(slot);
411
- }
412
- continue;
413
- }
414
- let wrapper = this._callbackElements.get(slot);
415
- if (!wrapper) {
416
- wrapper = document.createElement("div");
417
- wrapper.setAttribute("slot", slot);
418
- this._callbackElements.set(slot, wrapper);
419
- this.appendChild(wrapper);
420
- }
421
- wrapper.replaceChildren(newContent);
422
- }
423
- for (const [slot, el] of this._callbackElements.entries()) {
424
- if (!(slot in this._userDefinedStateBySlot)) {
425
- el.remove();
426
- this._callbackElements.delete(slot);
427
- }
428
- }
429
- }
430
- get resolvedConfig() {
431
- const baseConfig = this.config ?? {};
432
- const resolvedConfig = {
433
- ...baseConfig
434
- };
435
- if (this.onError !== undefined) {
436
- resolvedConfig.onError = this.onError;
437
- }
438
- if (this.openChatByDefault !== undefined) {
439
- resolvedConfig.openChatByDefault = this.openChatByDefault;
440
- }
441
- if (this.disclaimer !== undefined) {
442
- resolvedConfig.disclaimer = this.disclaimer;
443
- }
444
- if (this.disableCustomElementMobileEnhancements !== undefined) {
445
- resolvedConfig.disableCustomElementMobileEnhancements = this.disableCustomElementMobileEnhancements;
446
- }
447
- if (this.debug !== undefined) {
448
- resolvedConfig.debug = this.debug;
449
- }
450
- if (this.exposeServiceManagerForTesting !== undefined) {
451
- resolvedConfig.exposeServiceManagerForTesting = this.exposeServiceManagerForTesting;
452
- }
453
- if (this.injectCarbonTheme !== undefined) {
454
- resolvedConfig.injectCarbonTheme = this.injectCarbonTheme;
455
- }
456
- if (this.serviceDeskFactory !== undefined) {
457
- resolvedConfig.serviceDeskFactory = this.serviceDeskFactory;
458
- }
459
- if (this.serviceDesk !== undefined) {
460
- resolvedConfig.serviceDesk = this.serviceDesk;
461
- }
462
- if (this.shouldTakeFocusIfOpensAutomatically !== undefined) {
463
- resolvedConfig.shouldTakeFocusIfOpensAutomatically = this.shouldTakeFocusIfOpensAutomatically;
464
- }
465
- if (this.namespace !== undefined) {
466
- resolvedConfig.namespace = this.namespace;
467
- }
468
- if (this.shouldSanitizeHTML !== undefined) {
469
- resolvedConfig.shouldSanitizeHTML = this.shouldSanitizeHTML;
470
- }
471
- if (this.header !== undefined) {
472
- resolvedConfig.header = this.header;
473
- }
474
- if (this.input !== undefined) {
475
- resolvedConfig.input = this.input;
476
- }
477
- if (this.upload !== undefined) {
478
- resolvedConfig.upload = this.upload;
479
- }
480
- if (this.layout !== undefined) {
481
- resolvedConfig.layout = this.layout;
482
- }
483
- if (this.messaging !== undefined) {
484
- resolvedConfig.messaging = this.messaging;
485
- }
486
- if (this.isReadonly !== undefined) {
487
- resolvedConfig.isReadonly = this.isReadonly;
488
- }
489
- if (this.assistantName !== undefined) {
490
- resolvedConfig.assistantName = this.assistantName;
491
- }
492
- if (this.assistantAvatarUrl !== undefined) {
493
- resolvedConfig.assistantAvatarUrl = this.assistantAvatarUrl;
494
- }
495
- if (this.locale !== undefined) {
496
- resolvedConfig.locale = this.locale;
497
- }
498
- if (this.homescreen !== undefined) {
499
- resolvedConfig.homescreen = this.homescreen;
500
- }
501
- if (this.launcher !== undefined) {
502
- resolvedConfig.launcher = this.launcher;
503
- }
504
- if (this.strings !== undefined) {
505
- resolvedConfig.strings = this.strings;
506
- }
507
- if (this.aiDisabled === true) {
508
- resolvedConfig.aiEnabled = false;
509
- } else if (this.aiEnabled !== undefined) {
510
- resolvedConfig.aiEnabled = this.aiEnabled;
511
- }
512
- return resolvedConfig;
513
- }
514
- addWriteableElementSlots() {
515
- const writeableElementSlots = [];
516
- Object.keys(this._instance.writeableElements).forEach(writeableElementKey => {
517
- writeableElementSlots.push(writeableElementKey);
518
- });
519
- this._writeableElementSlots = writeableElementSlots;
520
- }
521
- attachWriteableElements() {
522
- const writeableElements = this._instance?.writeableElements;
523
- if (!writeableElements) {
524
- return;
525
- }
526
- Object.entries(writeableElements).forEach(([slot, element]) => {
527
- if (!element) {
528
- return;
529
- }
530
- element.setAttribute("slot", slot);
531
- if (!element.isConnected) {
532
- this.appendChild(element);
533
- }
534
- });
535
- }
536
- render() {
537
- if (this.renderUserDefinedResponse) {
538
- this.syncCallbackRenderedElements();
539
- }
540
- return html`<cds-aichat-internal
541
- .config=${this.resolvedConfig}
542
- .onAfterRender=${this.onAfterRender}
543
- .onBeforeRender=${this.onBeforeRenderOverride}
544
- .element=${this.element}
545
- >
546
- ${this._writeableElementSlots.map(slot => html`<slot name=${slot} slot=${slot}></slot>`)}
547
- ${this._userDefinedSlotNames.map(slot => html`<slot name=${slot} slot=${slot}></slot>`)}
548
- ${this._customFooterSlotNames.map(slot => html`<div slot=${slot}><slot name=${slot}></slot></div>`)}
549
- </cds-aichat-internal>`;
550
- }
551
- };
552
-
553
- __decorate([ property({
554
- attribute: false,
555
- type: Object
556
- }) ], ChatContainer.prototype, "config", void 0);
557
-
558
- __decorate([ property({
559
- attribute: false
560
- }) ], ChatContainer.prototype, "onError", void 0);
561
-
562
- __decorate([ property({
563
- type: Boolean,
564
- attribute: "open-chat-by-default"
565
- }) ], ChatContainer.prototype, "openChatByDefault", void 0);
566
-
567
- __decorate([ property({
568
- type: Object
569
- }) ], ChatContainer.prototype, "disclaimer", void 0);
570
-
571
- __decorate([ property({
572
- type: Boolean,
573
- attribute: "disable-custom-element-mobile-enhancements"
574
- }) ], ChatContainer.prototype, "disableCustomElementMobileEnhancements", void 0);
575
-
576
- __decorate([ property({
577
- type: Boolean
578
- }) ], ChatContainer.prototype, "debug", void 0);
579
-
580
- __decorate([ property({
581
- type: Boolean,
582
- attribute: "expose-service-manager-for-testing"
583
- }) ], ChatContainer.prototype, "exposeServiceManagerForTesting", void 0);
584
-
585
- __decorate([ property({
586
- type: String,
587
- attribute: "inject-carbon-theme"
588
- }) ], ChatContainer.prototype, "injectCarbonTheme", void 0);
589
-
590
- __decorate([ property({
591
- attribute: "ai-enabled",
592
- converter: {
593
- fromAttribute: value => {
594
- if (value === null) {
595
- return undefined;
596
- }
597
- const v = String(value).trim().toLowerCase();
598
- const falsey = v === "false" || v === "0" || v === "off" || v === "no";
599
- return !falsey;
600
- }
601
- }
602
- }) ], ChatContainer.prototype, "aiEnabled", void 0);
603
-
604
- __decorate([ property({
605
- type: Boolean,
606
- attribute: "ai-disabled"
607
- }) ], ChatContainer.prototype, "aiDisabled", void 0);
608
-
609
- __decorate([ property({
610
- type: Boolean,
611
- attribute: "should-take-focus-if-opens-automatically"
612
- }) ], ChatContainer.prototype, "shouldTakeFocusIfOpensAutomatically", void 0);
613
-
614
- __decorate([ property({
615
- type: String
616
- }) ], ChatContainer.prototype, "namespace", void 0);
617
-
618
- __decorate([ property({
619
- type: Boolean,
620
- attribute: "should-sanitize-html"
621
- }) ], ChatContainer.prototype, "shouldSanitizeHTML", void 0);
622
-
623
- __decorate([ property({
624
- type: Object
625
- }) ], ChatContainer.prototype, "header", void 0);
626
-
627
- __decorate([ property({
628
- type: Object
629
- }) ], ChatContainer.prototype, "history", void 0);
630
-
631
- __decorate([ property({
632
- type: Object
633
- }) ], ChatContainer.prototype, "input", void 0);
634
-
635
- __decorate([ property({
636
- attribute: false,
637
- type: Object
638
- }) ], ChatContainer.prototype, "upload", void 0);
639
-
640
- __decorate([ property({
641
- type: Object
642
- }) ], ChatContainer.prototype, "layout", void 0);
643
-
644
- __decorate([ property({
645
- type: Object
646
- }) ], ChatContainer.prototype, "messaging", void 0);
647
-
648
- __decorate([ property({
649
- type: Boolean,
650
- attribute: "is-readonly"
651
- }) ], ChatContainer.prototype, "isReadonly", void 0);
652
-
653
- __decorate([ property({
654
- type: String,
655
- attribute: "assistant-name"
656
- }) ], ChatContainer.prototype, "assistantName", void 0);
657
-
658
- __decorate([ property({
659
- type: String
660
- }) ], ChatContainer.prototype, "assistantAvatarUrl", void 0);
661
-
662
- __decorate([ property({
663
- type: String
664
- }) ], ChatContainer.prototype, "locale", void 0);
665
-
666
- __decorate([ property({
667
- type: Object
668
- }) ], ChatContainer.prototype, "homescreen", void 0);
669
-
670
- __decorate([ property({
671
- type: Object
672
- }) ], ChatContainer.prototype, "launcher", void 0);
673
-
674
- __decorate([ property({
675
- type: Object
676
- }) ], ChatContainer.prototype, "strings", void 0);
677
-
678
- __decorate([ property({
679
- attribute: false
680
- }) ], ChatContainer.prototype, "serviceDeskFactory", void 0);
681
-
682
- __decorate([ property({
683
- type: Object,
684
- attribute: "service-desk"
685
- }) ], ChatContainer.prototype, "serviceDesk", void 0);
686
-
687
- __decorate([ property({
688
- type: HTMLElement
689
- }) ], ChatContainer.prototype, "element", void 0);
690
-
691
- __decorate([ property({
692
- attribute: false
693
- }) ], ChatContainer.prototype, "onBeforeRender", void 0);
694
-
695
- __decorate([ property({
696
- attribute: false
697
- }) ], ChatContainer.prototype, "onAfterRender", void 0);
698
-
699
- __decorate([ property({
700
- attribute: false
701
- }) ], ChatContainer.prototype, "renderUserDefinedResponse", void 0);
702
-
703
- __decorate([ state() ], ChatContainer.prototype, "_userDefinedSlotNames", void 0);
704
-
705
- __decorate([ state() ], ChatContainer.prototype, "_customFooterSlotNames", void 0);
706
-
707
- __decorate([ state() ], ChatContainer.prototype, "_writeableElementSlots", void 0);
708
-
709
- __decorate([ state() ], ChatContainer.prototype, "_instance", void 0);
710
-
711
- __decorate([ state() ], ChatContainer.prototype, "_userDefinedStateBySlot", void 0);
712
-
713
- ChatContainer = __decorate([ carbonElement("cds-aichat-container") ], ChatContainer);
714
-
715
- var ChatContainer_default = ChatContainer;
716
-
717
- export { ChatContainer_default as default };
718
228
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-aichat-container/cds-aichat-internal.tsx","../../../../../../src/web-components/cds-aichat-container/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This component is mostly a pass-through. Its takes any properties passed into the ChatContainer\n * custom element and then renders the React Carbon AI Chat application while passing in properties.\n */\n\nimport { css, LitElement, PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport React from \"react\";\nimport { createRoot, Root } from \"react-dom/client\";\n\nimport ChatAppEntry from \"../../chat/ChatAppEntry\";\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport { PublicConfig } from \"../../types/config/PublicConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { LanguagePack } from \"../../types/config/PublicConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\n\n@carbonElement(\"cds-aichat-internal\")\nclass ChatContainerInternal extends LitElement {\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n z-index: var(--cds-aichat-z-index, auto);\n }\n `;\n\n /**\n * The config to use to load Carbon AI Chat. Note that the \"onLoad\" property is overridden by this component. If you\n * need to perform any actions after Carbon AI Chat been loaded, use the \"onBeforeRender\" or \"onAfterRender\" props.\n */\n @property({ type: Object })\n config: PublicConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /** A factory for the {@link ServiceDesk} integration. */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /** Public configuration for the service desk integration. */\n @property({ type: Object })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * The optional HTML element to mount the chat to.\n */\n @property({ type: HTMLElement })\n element?: HTMLElement;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property()\n onBeforeRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property()\n onAfterRender: (instance: ChatInstance) => Promise<void> | void;\n\n firstUpdated() {\n if (this.config) {\n this.renderReactApp();\n }\n }\n\n updated(changedProperties: PropertyValues) {\n // Re-render React app when config or other properties change\n if (\n this.config &&\n (changedProperties.has(\"config\") ||\n changedProperties.has(\"strings\") ||\n changedProperties.has(\"serviceDeskFactory\") ||\n changedProperties.has(\"serviceDesk\") ||\n changedProperties.has(\"onBeforeRender\") ||\n changedProperties.has(\"onAfterRender\") ||\n changedProperties.has(\"element\"))\n ) {\n this.renderReactApp();\n }\n }\n\n /**\n * Track if a previous React 18+ root was already created so we don't create a memory leak on re-renders.\n */\n root: Root;\n\n /**\n * Cache the container we hand to React so we can reuse it between renders.\n */\n reactContainer?: HTMLDivElement;\n\n async renderReactApp() {\n const container = this.ensureReactRoot();\n\n this.root.render(\n <ChatAppEntry\n config={this.config}\n strings={this.strings}\n serviceDeskFactory={this.serviceDeskFactory}\n serviceDesk={this.serviceDesk}\n onBeforeRender={this.onBeforeRender}\n onAfterRender={this.onAfterRender}\n container={container}\n element={this.element}\n />,\n );\n }\n\n private ensureReactRoot(): HTMLDivElement {\n if (!this.reactContainer) {\n const container = document.createElement(\"div\");\n container.classList.add(\"cds-aichat--react-app\");\n this.shadowRoot.appendChild(container);\n this.reactContainer = container;\n }\n\n // Make sure we only create one root and reuse it for prop updates.\n if (!this.root) {\n this.root = createRoot(this.reactContainer);\n }\n\n return this.reactContainer;\n }\n\n disconnectedCallback(): void {\n this.root?.unmount();\n super.disconnectedCallback();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cds-aichat-internal\": ChatContainerInternal;\n }\n}\n\nexport default ChatContainerInternal;\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This is the exposed web component for a basic floating chat.\n */\n\nimport \"./cds-aichat-internal\";\n\nimport { html, LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport {\n PublicConfig,\n OnErrorData,\n DisclaimerPublicConfig,\n CarbonTheme,\n HeaderConfig,\n HistoryConfig,\n LayoutConfig,\n PublicConfigMessaging,\n InputConfig,\n UploadConfig,\n} from \"../../types/config/PublicConfig\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { LanguagePack } from \"../../types/config/PublicConfig\";\nimport { HomeScreenConfig } from \"../../types/config/HomeScreenConfig\";\nimport { LauncherConfig } from \"../../types/config/LauncherConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventCustomFooterSlot,\n BusEventType,\n BusEventUserDefinedResponse,\n} from \"../../types/events/eventBusTypes\";\nimport type {\n RenderUserDefinedState,\n WCRenderUserDefinedResponse,\n} from \"../../types/component/ChatContainer\";\n\n/**\n * The cds-aichat-container managing creating slotted elements for user_defined responses, custom message footers, and writable elements.\n * It then passes that slotted content into cds-aichat-internal. That component will boot up the full chat application\n * and pass the slotted elements into their slots.\n */\n@carbonElement(\"cds-aichat-container\")\nclass ChatContainer extends LitElement {\n @property({ attribute: false, type: Object })\n config?: PublicConfig;\n\n // Flattened PublicConfig properties\n @property({ attribute: false })\n onError?: (data: OnErrorData) => void;\n\n @property({ type: Boolean, attribute: \"open-chat-by-default\" })\n openChatByDefault?: boolean;\n\n @property({ type: Object })\n disclaimer?: DisclaimerPublicConfig;\n\n @property({\n type: Boolean,\n attribute: \"disable-custom-element-mobile-enhancements\",\n })\n disableCustomElementMobileEnhancements?: boolean;\n\n @property({ type: Boolean })\n debug?: boolean;\n\n @property({ type: Boolean, attribute: \"expose-service-manager-for-testing\" })\n exposeServiceManagerForTesting?: boolean;\n\n @property({ type: String, attribute: \"inject-carbon-theme\" })\n injectCarbonTheme?: CarbonTheme;\n\n @property({\n attribute: \"ai-enabled\",\n // Custom converter so HTML authors can write ai-enabled=\"false\" | \"0\" | \"off\" | \"no\"\n // and absence keeps it undefined (so defaults apply further down the stack).\n converter: {\n fromAttribute: (value: string | null) => {\n if (value === null) {\n return undefined; // attribute absent -> leave undefined to use defaults\n }\n const v = String(value).trim().toLowerCase();\n const falsey = v === \"false\" || v === \"0\" || v === \"off\" || v === \"no\";\n // Any presence that's not an explicit falsey string is treated as true\n return !falsey;\n },\n },\n })\n aiEnabled?: boolean;\n\n // Optional explicit opt-out attribute. If present, it wins over ai-enabled.\n @property({ type: Boolean, attribute: \"ai-disabled\" })\n aiDisabled?: boolean;\n\n @property({\n type: Boolean,\n attribute: \"should-take-focus-if-opens-automatically\",\n })\n shouldTakeFocusIfOpensAutomatically?: boolean;\n\n @property({ type: String })\n namespace?: string;\n\n @property({ type: Boolean, attribute: \"should-sanitize-html\" })\n shouldSanitizeHTML?: boolean;\n\n @property({ type: Object })\n header?: HeaderConfig;\n\n @property({ type: Object })\n history?: HistoryConfig;\n\n @property({ type: Object })\n input?: InputConfig;\n\n @property({ attribute: false, type: Object })\n upload?: UploadConfig;\n\n @property({ type: Object })\n layout?: LayoutConfig;\n\n @property({ type: Object })\n messaging?: PublicConfigMessaging;\n\n @property({ type: Boolean, attribute: \"is-readonly\" })\n isReadonly?: boolean;\n\n @property({ type: String, attribute: \"assistant-name\" })\n assistantName?: string;\n\n @property({ type: String })\n assistantAvatarUrl?: string;\n\n @property({ type: String })\n locale?: string;\n\n @property({ type: Object })\n homescreen?: HomeScreenConfig;\n\n @property({ type: Object })\n launcher?: LauncherConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /**\n * A factory to create a {@link ServiceDesk} integration instance.\n */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /**\n * Public configuration for the service desk integration.\n */\n @property({ type: Object, attribute: \"service-desk\" })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * The element to render to instead of the default float element.\n *\n * @internal\n */\n @property({ type: HTMLElement })\n element?: HTMLElement;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property({ attribute: false })\n onBeforeRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n @property({ attribute: false })\n onAfterRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * Optional callback to render user defined responses. When provided, the library manages all event listening,\n * slot tracking, streaming state, and element lifecycle. The callback receives the accumulated state and should\n * return an HTMLElement or null.\n *\n * When this property is not set, the existing event + manual slot approach continues to work.\n */\n @property({ attribute: false })\n renderUserDefinedResponse?: WCRenderUserDefinedResponse;\n\n /**\n * The existing array of slot names for all user_defined components.\n */\n @state()\n _userDefinedSlotNames: string[] = [];\n\n /**\n * The existing array of slot names for all custom footers.\n */\n @state()\n _customFooterSlotNames: string[] = [];\n\n /**\n * The existing array of slot names for all writeable elements.\n */\n @state()\n _writeableElementSlots: string[] = [];\n\n /**\n * The chat instance.\n */\n @state()\n _instance: ChatInstance;\n\n /**\n * Accumulated state per slot for user_defined responses when renderUserDefinedResponse is provided.\n */\n @state()\n _userDefinedStateBySlot: Record<string, RenderUserDefinedState> = {};\n\n /**\n * Tracks the wrapper elements created by the callback rendering path.\n */\n private _callbackElements = new Map<string, HTMLElement>();\n\n /**\n * Adds the slot attribute to the element for the user_defined response type and then injects it into the component by\n * updating this._userDefinedSlotNames;\n */\n userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n // This element already has `slot` as an attribute.\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n /**\n * Adds the slot attribute to the element for the custom_footer_slot type and then injects it into the component by\n * updating this._customFooterSlotNames;\n */\n customFooterHandler = (event: BusEventCustomFooterSlot) => {\n // This element already has `slotName` as an attribute.\n const { slotName } = event.data;\n if (!this._customFooterSlotNames.includes(slotName)) {\n this._customFooterSlotNames = [...this._customFooterSlotNames, slotName];\n }\n };\n\n /**\n * Enhanced handler for USER_DEFINED_RESPONSE when renderUserDefinedResponse callback is provided.\n * Tracks both slot names and full message state per slot.\n */\n private enhancedUserDefinedHandler = (event: BusEventUserDefinedResponse) => {\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n this._userDefinedStateBySlot = {\n ...this._userDefinedStateBySlot,\n [slot]: {\n fullMessage: event.data.fullMessage,\n messageItem: event.data.message,\n },\n };\n };\n\n /**\n * Enhanced handler for CHUNK_USER_DEFINED_RESPONSE when renderUserDefinedResponse callback is provided.\n * Handles both complete_item and partial_item chunks, accumulating state per slot.\n */\n private enhancedUserDefinedChunkHandler = (\n event: BusEventChunkUserDefinedResponse,\n ) => {\n const { slot, chunk } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n\n if (\"complete_item\" in chunk) {\n this._userDefinedStateBySlot = {\n ...this._userDefinedStateBySlot,\n [slot]: { messageItem: chunk.complete_item },\n };\n } else if (\"partial_item\" in chunk) {\n const existing = this._userDefinedStateBySlot[slot];\n this._userDefinedStateBySlot = {\n ...this._userDefinedStateBySlot,\n [slot]: {\n ...existing,\n partialItems: [...(existing?.partialItems ?? []), chunk.partial_item],\n },\n };\n }\n };\n\n /**\n * Handles RESTART_CONVERSATION when renderUserDefinedResponse callback is provided.\n * Clears all accumulated state and removes callback-rendered elements from the DOM.\n */\n private restartHandler = () => {\n this._userDefinedStateBySlot = {};\n this._userDefinedSlotNames = [];\n for (const el of this._callbackElements.values()) {\n el.remove();\n }\n this._callbackElements.clear();\n };\n\n /**\n * Synchronizes callback-rendered elements in the light DOM based on current state.\n * Called from render() when renderUserDefinedResponse is provided.\n */\n private syncCallbackRenderedElements() {\n for (const [slot, slotState] of Object.entries(\n this._userDefinedStateBySlot,\n )) {\n const newContent =\n this.renderUserDefinedResponse?.(slotState, this._instance) ?? null;\n\n if (!newContent) {\n const existing = this._callbackElements.get(slot);\n if (existing) {\n existing.remove();\n this._callbackElements.delete(slot);\n }\n continue;\n }\n\n let wrapper = this._callbackElements.get(slot);\n if (!wrapper) {\n wrapper = document.createElement(\"div\");\n wrapper.setAttribute(\"slot\", slot);\n this._callbackElements.set(slot, wrapper);\n this.appendChild(wrapper);\n }\n\n wrapper.replaceChildren(newContent);\n }\n\n // Clean up wrappers for slots that no longer exist in state\n for (const [slot, el] of this._callbackElements.entries()) {\n if (!(slot in this._userDefinedStateBySlot)) {\n el.remove();\n this._callbackElements.delete(slot);\n }\n }\n }\n\n private get resolvedConfig(): PublicConfig {\n const baseConfig = this.config ?? {};\n const resolvedConfig: PublicConfig = { ...baseConfig };\n\n if (this.onError !== undefined) {\n resolvedConfig.onError = this.onError;\n }\n if (this.openChatByDefault !== undefined) {\n resolvedConfig.openChatByDefault = this.openChatByDefault;\n }\n if (this.disclaimer !== undefined) {\n resolvedConfig.disclaimer = this.disclaimer;\n }\n if (this.disableCustomElementMobileEnhancements !== undefined) {\n resolvedConfig.disableCustomElementMobileEnhancements =\n this.disableCustomElementMobileEnhancements;\n }\n if (this.debug !== undefined) {\n resolvedConfig.debug = this.debug;\n }\n if (this.exposeServiceManagerForTesting !== undefined) {\n resolvedConfig.exposeServiceManagerForTesting =\n this.exposeServiceManagerForTesting;\n }\n if (this.injectCarbonTheme !== undefined) {\n resolvedConfig.injectCarbonTheme = this.injectCarbonTheme;\n }\n if (this.serviceDeskFactory !== undefined) {\n resolvedConfig.serviceDeskFactory = this.serviceDeskFactory;\n }\n if (this.serviceDesk !== undefined) {\n resolvedConfig.serviceDesk = this.serviceDesk;\n }\n if (this.shouldTakeFocusIfOpensAutomatically !== undefined) {\n resolvedConfig.shouldTakeFocusIfOpensAutomatically =\n this.shouldTakeFocusIfOpensAutomatically;\n }\n if (this.namespace !== undefined) {\n resolvedConfig.namespace = this.namespace;\n }\n if (this.shouldSanitizeHTML !== undefined) {\n resolvedConfig.shouldSanitizeHTML = this.shouldSanitizeHTML;\n }\n if (this.header !== undefined) {\n resolvedConfig.header = this.header;\n }\n if (this.input !== undefined) {\n resolvedConfig.input = this.input;\n }\n if (this.upload !== undefined) {\n resolvedConfig.upload = this.upload;\n }\n if (this.layout !== undefined) {\n resolvedConfig.layout = this.layout;\n }\n if (this.messaging !== undefined) {\n resolvedConfig.messaging = this.messaging;\n }\n if (this.isReadonly !== undefined) {\n resolvedConfig.isReadonly = this.isReadonly;\n }\n if (this.assistantName !== undefined) {\n resolvedConfig.assistantName = this.assistantName;\n }\n if (this.assistantAvatarUrl !== undefined) {\n resolvedConfig.assistantAvatarUrl = this.assistantAvatarUrl;\n }\n if (this.locale !== undefined) {\n resolvedConfig.locale = this.locale;\n }\n if (this.homescreen !== undefined) {\n resolvedConfig.homescreen = this.homescreen;\n }\n if (this.launcher !== undefined) {\n resolvedConfig.launcher = this.launcher;\n }\n if (this.strings !== undefined) {\n resolvedConfig.strings = this.strings;\n }\n\n if (this.aiDisabled === true) {\n resolvedConfig.aiEnabled = false;\n } else if (this.aiEnabled !== undefined) {\n resolvedConfig.aiEnabled = this.aiEnabled;\n }\n\n return resolvedConfig;\n }\n\n onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n\n if (this.renderUserDefinedResponse) {\n // Enhanced path: library manages full state for callback rendering\n this._instance.on({\n type: BusEventType.USER_DEFINED_RESPONSE,\n handler: this.enhancedUserDefinedHandler,\n });\n this._instance.on({\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,\n handler: this.enhancedUserDefinedChunkHandler,\n });\n this._instance.on({\n type: BusEventType.RESTART_CONVERSATION,\n handler: this.restartHandler,\n });\n } else {\n // Legacy path: container only tracks slot names\n this._instance.on({\n type: BusEventType.USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this._instance.on({\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n }\n\n this._instance.on({\n type: BusEventType.CUSTOM_FOOTER_SLOT,\n handler: this.customFooterHandler,\n });\n this.addWriteableElementSlots();\n this.attachWriteableElements();\n await this.onBeforeRender?.(instance);\n };\n\n addWriteableElementSlots() {\n const writeableElementSlots: string[] = [];\n Object.keys(this._instance.writeableElements).forEach(\n (writeableElementKey) => {\n writeableElementSlots.push(writeableElementKey);\n },\n );\n this._writeableElementSlots = writeableElementSlots;\n }\n\n private attachWriteableElements() {\n const writeableElements = this._instance?.writeableElements;\n if (!writeableElements) {\n return;\n }\n\n Object.entries(writeableElements).forEach(([slot, element]) => {\n if (!element) {\n return;\n }\n\n element.setAttribute(\"slot\", slot);\n\n if (!element.isConnected) {\n this.appendChild(element);\n }\n });\n }\n\n /**\n * Renders the template while passing in class functionality\n */\n render() {\n if (this.renderUserDefinedResponse) {\n this.syncCallbackRenderedElements();\n }\n\n return html`<cds-aichat-internal\n .config=${this.resolvedConfig}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this.element}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n ${this._userDefinedSlotNames.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n ${this._customFooterSlotNames.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n </cds-aichat-internal>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cds-aichat-container\": ChatContainer;\n }\n}\n\n/**\n * Attributes interface for the cds-aichat-container web component.\n * This interface extends {@link PublicConfig} with additional component-specific props,\n * flattening all config properties as top-level properties for better TypeScript IntelliSense.\n *\n * @category Web component\n */\ninterface CdsAiChatContainerAttributes extends PublicConfig {\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * Optional callback to render user defined responses. When provided, the library manages all event listening,\n * slot tracking, streaming state, and element lifecycle.\n */\n renderUserDefinedResponse?: WCRenderUserDefinedResponse;\n}\n\nexport { CdsAiChatContainerAttributes };\nexport default ChatContainer;\n"],"names":["ChatContainerInternal","LitElement","firstUpdated","this","config","renderReactApp","updated","changedProperties","has","container","ensureReactRoot","root","render","React","ChatAppEntry","strings","serviceDeskFactory","serviceDesk","onBeforeRender","onAfterRender","element","reactContainer","document","createElement","classList","add","shadowRoot","appendChild","createRoot","disconnectedCallback","unmount","super","styles","css","__decorate","property","type","Object","prototype","attribute","HTMLElement","carbonElement","ChatContainer","constructor","_userDefinedSlotNames","_customFooterSlotNames","_writeableElementSlots","_userDefinedStateBySlot","_callbackElements","Map","userDefinedHandler","event","slot","data","includes","customFooterHandler","slotName","enhancedUserDefinedHandler","fullMessage","messageItem","message","enhancedUserDefinedChunkHandler","chunk","complete_item","existing","partialItems","partial_item","restartHandler","el","values","remove","clear","onBeforeRenderOverride","async","instance","_instance","renderUserDefinedResponse","on","BusEventType","USER_DEFINED_RESPONSE","handler","CHUNK_USER_DEFINED_RESPONSE","RESTART_CONVERSATION","CUSTOM_FOOTER_SLOT","addWriteableElementSlots","attachWriteableElements","syncCallbackRenderedElements","slotState","entries","newContent","get","delete","wrapper","setAttribute","set","replaceChildren","resolvedConfig","baseConfig","onError","undefined","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","shouldTakeFocusIfOpensAutomatically","namespace","shouldSanitizeHTML","header","input","upload","layout","messaging","isReadonly","assistantName","assistantAvatarUrl","locale","homescreen","launcher","aiDisabled","aiEnabled","writeableElementSlots","keys","writeableElements","forEach","writeableElementKey","push","isConnected","html","map","Boolean","String","converter","fromAttribute","value","v","trim","toLowerCase","falsey","state","ChatContainer_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAMA,wBAAN,MAAMA,8BAA8BC;EAoDlC,YAAAC;IACE,IAAIC,KAAKC,QAAQ;MACfD,KAAKE;AACP;AACF;EAEA,OAAAC,CAAQC;IAEN,IACEJ,KAAKC,WACJG,kBAAkBC,IAAI,aACrBD,kBAAkBC,IAAI,cACtBD,kBAAkBC,IAAI,yBACtBD,kBAAkBC,IAAI,kBACtBD,kBAAkBC,IAAI,qBACtBD,kBAAkBC,IAAI,oBACtBD,kBAAkBC,IAAI,aACxB;MACAL,KAAKE;AACP;AACF;EAYA,oBAAMA;IACJ,MAAMI,YAAYN,KAAKO;IAEvBP,KAAKQ,KAAKC,OACRC,oBAACC,cAAY;MACXV,QAAQD,KAAKC;MACbW,SAASZ,K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