@carbon/ai-chat 1.16.0-rc.0 → 1.16.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.
@@ -266,6 +266,17 @@ let ChatCustomElement = ChatCustomElement_1 = class ChatCustomElement extends Fl
266
266
  this._pluginSlotNames = [ ...this._pluginSlotNames, detail.slotName ];
267
267
  }
268
268
  event.preventDefault();
269
+ if (detail.element) {
270
+ const element = detail.element;
271
+ element.setAttribute("slot", detail.slotName);
272
+ if (!detail.isInline) {
273
+ element.style.marginBlockStart = "1rem";
274
+ }
275
+ if (element.parentElement !== this) {
276
+ this.appendChild(element);
277
+ }
278
+ return;
279
+ }
269
280
  let host = this._pluginHosts.get(detail.slotName);
270
281
  if (!host) {
271
282
  host = document.createElement(detail.isInline ? "span" : "div");
@@ -276,8 +287,8 @@ let ChatCustomElement = ChatCustomElement_1 = class ChatCustomElement extends Fl
276
287
  this._pluginHosts.set(detail.slotName, host);
277
288
  this.appendChild(host);
278
289
  }
279
- if (host.innerHTML !== detail.html) {
280
- host.innerHTML = detail.html;
290
+ if (host.innerHTML !== (detail.html ?? "")) {
291
+ host.innerHTML = detail.html ?? "";
281
292
  }
282
293
  };
283
294
  this.handlePluginHostUpdate = event => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-custom-aichat-custom-element/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\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// Ensure the container custom element is registered whenever the\n// custom element module is imported by re-exporting its exports.\n// This prevents bundlers (and our own multi-entry Rollup build)\n// from pruning the side-effect-only import.\nexport { default as __cds-custom_aichat_container_register } from \"../cds-custom-aichat-container\";\nimport \"../cds-custom-aichat-container\";\n\nimport { html } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es-custom/globals/decorators/index.js\";\nimport { PublicConfig } from \"../../types/config/PublicConfig\";\nimport { FlattenedConfigElement } from \"../shared/FlattenedConfigElement\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventCustomFooterSlot,\n BusEventType,\n BusEventUserDefinedResponse,\n BusEventViewChange,\n BusEventViewPreChange,\n} from \"../../types/events/eventBusTypes\";\nimport type {\n WCMarkdown,\n WCRenderCustomMessageFooter,\n WCRenderUserDefinedResponse,\n} from \"../../types/component/ChatContainer\";\n\n/**\n * cds-custom-aichat-custom-element will is a pass through to cds-custom-aichat-container. It takes any user_defined and writeable element\n * slotted content and forwards it to cds-custom-aichat-container. It also will setup the custom element with a default viewChange\n * pattern (e.g. hiding and showing the custom element when the chat should be open/closed) if a onViewChange property is not\n * defined. Finally, it registers the custom element with cds-custom-aichat-container so a default \"floating\" element will not be created.\n *\n * The custom element should be sized using external CSS. When hidden, the 'cds-custom-aichat--hidden' class is added to set dimensions to 0x0.\n */\n@carbonElement(\"cds-custom-aichat-custom-element\")\nclass ChatCustomElement extends FlattenedConfigElement {\n /**\n * Shared stylesheet for hiding styles.\n */\n private static hideSheet = new CSSStyleSheet();\n static {\n // Hide styles that override any external sizing. `replaceSync` is absent\n // in non-browser environments (e.g. the jsdom-based test environment), so\n // skip styling there rather than throwing at module-evaluation time.\n ChatCustomElement.hideSheet.replaceSync?.(`\n :host {\n display: block;\n }\n :host(.cds-custom-aichat--hidden) {\n width: 0 !important;\n height: 0 !important;\n min-width: 0 !important;\n min-height: 0 !important;\n max-width: 0 !important;\n max-height: 0 !important;\n inline-size: 0 !important;\n block-size: 0 !important;\n min-inline-size: 0 !important;\n min-block-size: 0 !important;\n max-inline-size: 0 !important;\n max-block-size: 0 !important;\n overflow: hidden !important;\n display: block !important;\n }\n `);\n }\n\n /**\n * Adopt our stylesheet into every shadowRoot.\n */\n protected createRenderRoot(): ShadowRoot {\n // Lits default createRenderRoot actually returns a ShadowRoot\n const root = super.createRenderRoot() as ShadowRoot;\n\n // now TS knows root.adoptedStyleSheets exists\n root.adoptedStyleSheets = [\n ...root.adoptedStyleSheets,\n ChatCustomElement.hideSheet,\n ];\n return root;\n }\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 * Use it to capture the {@link ChatInstance} so you can call instance methods later.\n *\n * @example\n * ```ts\n * const onBeforeRender = (instance: ChatInstance) => {\n * this.instance = instance;\n * };\n * // <cds-custom-aichat-custom-element .onBeforeRender=${onBeforeRender}></cds-custom-aichat-custom-element>\n * ```\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 * Like `onBeforeRender`, it receives the {@link ChatInstance}; use it when you need the instance only after the\n * first render has completed.\n */\n @property({ attribute: false })\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * Called before a view change (chat opening/closing). The chat will hide the chat shell inside your custom element\n * to prevent invisible keyboard stops when the view change is complete.\n *\n * Use this callback to update your CSS class name values on this element before the view change happens if you want to add any open/close\n * animations to your custom element before the chat shell inner contents are hidden. It is async and so you can\n * tie it to native the AnimationEvent and only return when your animations have completed.\n *\n * A common pattern is to use this for when the chat is closing and to use onViewChange for when the chat opens.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewPreChange?: (event: BusEventViewPreChange) => Promise<void> | void;\n\n /**\n * Called when the chat view change is complete. If no callback is provided here, the default behavior will be to set\n * the chat shell to 0x0 size and set all inner contents aside from the launcher, if you are using it, to display: none.\n * The inner contents of the chat shell (aside from the launcher if you are using it) are always set to display: none\n * regardless of what is configured with this callback to prevent invisible tab stops and screen reader issues.\n *\n * Use this callback to update your className value when the chat has finished being opened or closed.\n *\n * You can provide a different callback here if you want custom animation behavior when the chat is opened or closed.\n * The animation behavior defined here will run in concert with the chat inside your custom container being hidden.\n *\n * If you want to run animations before the inner contents of the chat shell is shrunk and the inner contents are hidden,\n * make use of onViewPreChange.\n *\n * A common pattern is to use this for when the chat is opening and to use onViewPreChange for when the chat closes.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n\n /**\n * Optional callback to render user defined responses. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, and element lifecycle.\n */\n @property({ attribute: false })\n renderUserDefinedResponse?: WCRenderUserDefinedResponse;\n\n /**\n * Optional callback to render custom message footers. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, and element lifecycle.\n */\n @property({ attribute: false })\n renderCustomMessageFooter?: WCRenderCustomMessageFooter;\n\n // markdown is declared on the FlattenedConfigElement base; the attributes\n // interface narrows its type.\n\n @state()\n private _userDefinedSlotNames: string[] = [];\n\n @state()\n private _writeableElementSlots: string[] = [];\n\n @state()\n private _customFooterSlotNames: string[] = [];\n\n /**\n * Active slot names for markdown-plugin output hosted at this element.\n * Populated when this element accepts the host-mount event; drained when\n * the matching unmount event fires.\n */\n @state()\n private _pluginSlotNames: string[] = [];\n\n /**\n * Page-level host elements created for plugin-output slots, keyed by slot\n * name. Created in this element's outer light DOM so consumer-loaded\n * stylesheets (e.g. KaTeX) reach the rendered HTML normally.\n */\n private _pluginHosts: Map<string, HTMLElement> = new Map();\n\n @state()\n private _instance!: ChatInstance;\n\n private defaultViewChangeHandler = (event: BusEventViewChange) => {\n if (event.newViewState.mainWindow) {\n this.classList.remove(\"cds-custom-aichat--hidden\");\n } else {\n this.classList.add(\"cds-custom-aichat--hidden\");\n }\n };\n\n private userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n private customFooterHandler = (event: BusEventCustomFooterSlot) => {\n const { slotName } = event.data;\n if (!this._customFooterSlotNames.includes(slotName)) {\n this._customFooterSlotNames = [...this._customFooterSlotNames, slotName];\n }\n };\n\n private handlePluginHostMount = (event: Event) => {\n const detail = (\n event as CustomEvent<{\n slotName: string;\n html: string;\n isInline: boolean;\n }>\n ).detail;\n if (!detail?.slotName) {\n return;\n }\n if (!this._pluginSlotNames.includes(detail.slotName)) {\n this._pluginSlotNames = [...this._pluginSlotNames, detail.slotName];\n }\n // cds-custom-aichat-custom-element is always the outermost chat element in its\n // shadow chain; there is no further chat ancestor to defer to. Take\n // hosting unconditionally.\n event.preventDefault();\n let host = this._pluginHosts.get(detail.slotName);\n if (!host) {\n host = document.createElement(detail.isInline ? \"span\" : \"div\");\n host.setAttribute(\"slot\", detail.slotName);\n // Match `.cds-custom-aichat-markdown-stack > *:not(:first-child)` spacing;\n // shadow CSS doesn't reach this host (it lives in this element's\n // outer light DOM), so apply it inline. Inline output flows with\n // text and gets no extra spacing.\n if (!detail.isInline) {\n host.style.marginBlockStart = \"1rem\";\n }\n this._pluginHosts.set(detail.slotName, host);\n this.appendChild(host);\n }\n if (host.innerHTML !== detail.html) {\n host.innerHTML = detail.html;\n }\n };\n\n private handlePluginHostUpdate = (event: Event) => {\n const detail = (event as CustomEvent<{ slotName: string; html: string }>)\n .detail;\n if (!detail?.slotName) {\n return;\n }\n const host = this._pluginHosts.get(detail.slotName);\n if (host && host.innerHTML !== detail.html) {\n host.innerHTML = detail.html;\n }\n };\n\n private handlePluginHostUnmount = (event: Event) => {\n const detail = (event as CustomEvent<{ slotName: string }>).detail;\n if (!detail?.slotName) {\n return;\n }\n this._pluginSlotNames = this._pluginSlotNames.filter(\n (n) => n !== detail.slotName,\n );\n const host = this._pluginHosts.get(detail.slotName);\n if (host) {\n host.remove();\n this._pluginHosts.delete(detail.slotName);\n }\n };\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\n \"cds-custom-aichat-markdown-plugin-host-mount\",\n this.handlePluginHostMount,\n );\n this.addEventListener(\n \"cds-custom-aichat-markdown-plugin-host-update\",\n this.handlePluginHostUpdate,\n );\n this.addEventListener(\n \"cds-custom-aichat-markdown-plugin-host-unmount\",\n this.handlePluginHostUnmount,\n );\n }\n\n disconnectedCallback() {\n this.removeEventListener(\n \"cds-custom-aichat-markdown-plugin-host-mount\",\n this.handlePluginHostMount,\n );\n this.removeEventListener(\n \"cds-custom-aichat-markdown-plugin-host-update\",\n this.handlePluginHostUpdate,\n );\n this.removeEventListener(\n \"cds-custom-aichat-markdown-plugin-host-unmount\",\n this.handlePluginHostUnmount,\n );\n for (const host of this._pluginHosts.values()) {\n host.remove();\n }\n this._pluginHosts.clear();\n super.disconnectedCallback();\n }\n\n private onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n if (this.onViewPreChange) {\n this._instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: this.onViewPreChange,\n });\n }\n this._instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: this.onViewChange || this.defaultViewChangeHandler,\n });\n\n if (!this.renderUserDefinedResponse) {\n // Legacy path: custom-element tracks slot names for manual slotting.\n // When renderUserDefinedResponse is set, the inner cds-custom-aichat-container handles everything.\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 if (!this.renderCustomMessageFooter) {\n // Legacy path: custom-element tracks slot names for manual slotting.\n // When renderCustomMessageFooter is set, the inner cds-custom-aichat-container handles everything.\n this._instance.on({\n type: BusEventType.CUSTOM_FOOTER_SLOT,\n handler: this.customFooterHandler,\n });\n }\n this.addWriteableElementSlots();\n await this.onBeforeRender?.(instance);\n };\n\n private addWriteableElementSlots() {\n this._writeableElementSlots = Object.keys(this._instance.writeableElements);\n }\n\n render() {\n return html`\n <cds-custom-aichat-container\n .config=${this.resolvedConfig}\n .header=${this.resolvedConfig.header}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this}\n .renderUserDefinedResponse=${this.renderUserDefinedResponse}\n .renderCustomMessageFooter=${this.renderCustomMessageFooter}\n .markdown=${this.markdown as WCMarkdown | undefined}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n ${this.renderUserDefinedResponse\n ? null\n : this._userDefinedSlotNames.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n ${this.renderCustomMessageFooter\n ? null\n : this._customFooterSlotNames.map(\n (slot) =>\n html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n ${this._pluginSlotNames.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n </cds-custom-aichat-container>\n `;\n }\n}\n\n/**\n * Attributes interface for the cds-custom-aichat-custom-element 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 CdsAiChatCustomElementAttributes extends Omit<\n PublicConfig,\n \"markdown\"\n> {\n /**\n * Markdown rendering customization. Extends the framework-neutral\n * `PublicConfig.markdown` with web-component `customRenderers`.\n *\n * @experimental\n */\n markdown?: WCMarkdown;\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 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 * Called before a view change (the chat opening or closing) and awaited before the change proceeds. Use it to update\n * this element's CSS classes and run open/close animations to completion before the chat shell's inner contents are\n * hidden. A common pattern is to use this when the chat is closing and `onViewChange` when it opens.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded. After Carbon AI Chat is loaded, the\n * callback will not be updated.\n */\n onViewPreChange?: (event: BusEventViewPreChange) => Promise<void> | void;\n\n /**\n * An optional listener for \"view:change\" events. Such a listener is required when using a custom element in order\n * to control the visibility of the Carbon AI Chat main window. If no callback is provided here, a default one will be\n * used that injects styling into the app that will show and hide the Carbon AI Chat main window and also change the\n * size of the custom element so it doesn't take up space when the main window is closed.\n *\n * You can provide a different callback here if you want custom behavior such as an animation when the main window\n * is opened or closed.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded. After Carbon AI Chat is loaded, the event\n * handler will not be updated.\n */\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n\n /**\n * Optional callback to render user defined responses. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, streaming state, and element lifecycle.\n */\n renderUserDefinedResponse?: WCRenderUserDefinedResponse;\n\n /**\n * Optional callback to render custom message footers. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, and element lifecycle.\n */\n renderCustomMessageFooter?: WCRenderCustomMessageFooter;\n}\n\nexport { CdsAiChatCustomElementAttributes };\n\nexport default ChatCustomElement;\n"],"names":["ChatCustomElement","ChatCustomElement_1","FlattenedConfigElement","constructor","this","_userDefinedSlotNames","_writeableElementSlots","_customFooterSlotNames","_pluginSlotNames","_pluginHosts","Map","defaultViewChangeHandler","event","newViewState","mainWindow","classList","remove","add","userDefinedHandler","slot","data","includes","customFooterHandler","slotName","handlePluginHostMount","detail","preventDefault","host","get","document","createElement","isInline","setAttribute","style","marginBlockStart","set","appendChild","innerHTML","html","handlePluginHostUpdate","handlePluginHostUnmount","filter","n","delete","onBeforeRenderOverride","async","instance","_instance","onViewPreChange","on","type","BusEventType","VIEW_PRE_CHANGE","handler","VIEW_CHANGE","onViewChange","renderUserDefinedResponse","USER_DEFINED_RESPONSE","CHUNK_USER_DEFINED_RESPONSE","renderCustomMessageFooter","CUSTOM_FOOTER_SLOT","addWriteableElementSlots","onBeforeRender","createRenderRoot","root","super","adoptedStyleSheets","hideSheet","connectedCallback","addEventListener","disconnectedCallback","removeEventListener","values","clear","Object","keys","writeableElements","render","resolvedConfig","header","onAfterRender","markdown","map","CSSStyleSheet","replaceSync","__decorate","property","attribute","prototype","state","carbonElement","ChatCustomElement_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAMA,oBAAiBC,sBAAvB,MAAMD,0BAA0BE;EAAhC,WAAAC;;IAiIUC,KAAAC,wBAAkC;IAGlCD,KAAAE,yBAAmC;IAGnCF,KAAAG,yBAAmC;IAQnCH,KAAAI,mBAA6B;IAO7BJ,KAAAK,eAAyC,IAAIC;IAK7CN,KAAAO,2BAA4BC;MAClC,IAAIA,MAAMC,aAAaC,YAAY;QACjCV,KAAKW,UAAUC,OAAO;AACxB,aAAO;QACLZ,KAAKW,UAAUE,IAAI;AACrB;;IAGMb,KAAAc,qBACNN;MAEA,OAAMO,QAAWP,MAAMQ;MACvB,KAAKhB,KAAKC,sBAAsBgB,SAASF,OAAO;QAC9Cf,KAAKC,wBAAwB,KAAID,KAAKC,uBAAuBc;AAC/D;;IAGMf,KAAAkB,sBAAuBV;MAC7B,OAAMW,YAAeX,MAAMQ;MAC3B,KAAKhB,KAAKG,uBAAuBc,SAASE,WAAW;QACnDnB,KAAKG,yBAAyB,KAAIH,KAAKG,wBAAwBgB;AACjE;;IAGMnB,KAAAoB,wBAAyBZ;MAC/B,MAAMa,SACJb,MAKAa;MACF,KAAKA,QAAQF,UAAU;QACrB;AACF;MACA,KAAKnB,KAAKI,iBAAiBa,SAASI,OAAOF,WAA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C,sBAAsB6E,IACxB/D,QAASmB,IAAI,cAAcnB,aAAaA;UAE7Cf,KAAKuD,4BACH,OACAvD,KAAKG,uBAAuB2E,IACzB/D,QACCmB,IAAI,aAAanB,mBAAmBA;UAE1Cf,KAAKI,iBAAiB0E,IACrB/D,QAASmB,IAAI,cAAcnB,aAAaA;;;AAIjD;;;AA5VenB,kBAAAmE,YAAY,IAAIgB;;AAC/B;EAIElF,oBAAkBkE,UAAUiB,cAAc;AAqB3C,EAzBD;;AAyDAC,WAAA,EADCC,SAAS;EAAEC,WAAW;MAC2CvF,kBAAAwF,WAAA;;AASlEH,WAAA,EADCC,SAAS;EAAEC,WAAW;MAC0CvF,kBAAAwF,WAAA;;AAgBjEH,WAAA,EADCC,cACwEtF,kBAAAwF,WAAA;;AAsBzEH,WAAA,EADCC,cAC0EtF,kBAAAwF,WAAA;;AAO3EH,WAAA,EADCC,SAAS;EAAEC,WAAW;MACiCvF,kBAAAwF,WAAA;;AAOxDH,WAAA,EADCC,SAAS;EAAEC,WAAW;MACiCvF,kBAAAwF,WAAA;;AAMhDH,WAAA,EADPI,WAC4CzF,kBAAAwF,WAAA;;AAGrCH,WAAA,EADPI,WAC6CzF,kBAAAwF,WAAA;;AAGtCH,WAAA,EADPI,WAC6CzF,kBAAAwF,WAAA;;AAQtCH,WAAA,EADPI,WACuCzF,kBAAAwF,WAAA;;AAUhCH,WAAA,EADPI,WACgCzF,kBAAAwF,WAAA;;AAzJ7BxF,oBAAiBC,sBAAAoF,WAAA,EADtBK,cAAc,gCACT1F;;AAwaN,IAAA2F,4BAAe3F;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-custom-aichat-custom-element/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\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// Ensure the container custom element is registered whenever the\n// custom element module is imported by re-exporting its exports.\n// This prevents bundlers (and our own multi-entry Rollup build)\n// from pruning the side-effect-only import.\nexport { default as __cds-custom_aichat_container_register } from \"../cds-custom-aichat-container\";\nimport \"../cds-custom-aichat-container\";\n\nimport { html } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es-custom/globals/decorators/index.js\";\nimport { PublicConfig } from \"../../types/config/PublicConfig\";\nimport { FlattenedConfigElement } from \"../shared/FlattenedConfigElement\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventCustomFooterSlot,\n BusEventType,\n BusEventUserDefinedResponse,\n BusEventViewChange,\n BusEventViewPreChange,\n} from \"../../types/events/eventBusTypes\";\nimport type {\n WCMarkdown,\n WCRenderCustomMessageFooter,\n WCRenderUserDefinedResponse,\n} from \"../../types/component/ChatContainer\";\n\n/**\n * cds-custom-aichat-custom-element will is a pass through to cds-custom-aichat-container. It takes any user_defined and writeable element\n * slotted content and forwards it to cds-custom-aichat-container. It also will setup the custom element with a default viewChange\n * pattern (e.g. hiding and showing the custom element when the chat should be open/closed) if a onViewChange property is not\n * defined. Finally, it registers the custom element with cds-custom-aichat-container so a default \"floating\" element will not be created.\n *\n * The custom element should be sized using external CSS. When hidden, the 'cds-custom-aichat--hidden' class is added to set dimensions to 0x0.\n */\n@carbonElement(\"cds-custom-aichat-custom-element\")\nclass ChatCustomElement extends FlattenedConfigElement {\n /**\n * Shared stylesheet for hiding styles.\n */\n private static hideSheet = new CSSStyleSheet();\n static {\n // Hide styles that override any external sizing. `replaceSync` is absent\n // in non-browser environments (e.g. the jsdom-based test environment), so\n // skip styling there rather than throwing at module-evaluation time.\n ChatCustomElement.hideSheet.replaceSync?.(`\n :host {\n display: block;\n }\n :host(.cds-custom-aichat--hidden) {\n width: 0 !important;\n height: 0 !important;\n min-width: 0 !important;\n min-height: 0 !important;\n max-width: 0 !important;\n max-height: 0 !important;\n inline-size: 0 !important;\n block-size: 0 !important;\n min-inline-size: 0 !important;\n min-block-size: 0 !important;\n max-inline-size: 0 !important;\n max-block-size: 0 !important;\n overflow: hidden !important;\n display: block !important;\n }\n `);\n }\n\n /**\n * Adopt our stylesheet into every shadowRoot.\n */\n protected createRenderRoot(): ShadowRoot {\n // Lits default createRenderRoot actually returns a ShadowRoot\n const root = super.createRenderRoot() as ShadowRoot;\n\n // now TS knows root.adoptedStyleSheets exists\n root.adoptedStyleSheets = [\n ...root.adoptedStyleSheets,\n ChatCustomElement.hideSheet,\n ];\n return root;\n }\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 * Use it to capture the {@link ChatInstance} so you can call instance methods later.\n *\n * @example\n * ```ts\n * const onBeforeRender = (instance: ChatInstance) => {\n * this.instance = instance;\n * };\n * // <cds-custom-aichat-custom-element .onBeforeRender=${onBeforeRender}></cds-custom-aichat-custom-element>\n * ```\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 * Like `onBeforeRender`, it receives the {@link ChatInstance}; use it when you need the instance only after the\n * first render has completed.\n */\n @property({ attribute: false })\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * Called before a view change (chat opening/closing). The chat will hide the chat shell inside your custom element\n * to prevent invisible keyboard stops when the view change is complete.\n *\n * Use this callback to update your CSS class name values on this element before the view change happens if you want to add any open/close\n * animations to your custom element before the chat shell inner contents are hidden. It is async and so you can\n * tie it to native the AnimationEvent and only return when your animations have completed.\n *\n * A common pattern is to use this for when the chat is closing and to use onViewChange for when the chat opens.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewPreChange?: (event: BusEventViewPreChange) => Promise<void> | void;\n\n /**\n * Called when the chat view change is complete. If no callback is provided here, the default behavior will be to set\n * the chat shell to 0x0 size and set all inner contents aside from the launcher, if you are using it, to display: none.\n * The inner contents of the chat shell (aside from the launcher if you are using it) are always set to display: none\n * regardless of what is configured with this callback to prevent invisible tab stops and screen reader issues.\n *\n * Use this callback to update your className value when the chat has finished being opened or closed.\n *\n * You can provide a different callback here if you want custom animation behavior when the chat is opened or closed.\n * The animation behavior defined here will run in concert with the chat inside your custom container being hidden.\n *\n * If you want to run animations before the inner contents of the chat shell is shrunk and the inner contents are hidden,\n * make use of onViewPreChange.\n *\n * A common pattern is to use this for when the chat is opening and to use onViewPreChange for when the chat closes.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n\n /**\n * Optional callback to render user defined responses. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, and element lifecycle.\n */\n @property({ attribute: false })\n renderUserDefinedResponse?: WCRenderUserDefinedResponse;\n\n /**\n * Optional callback to render custom message footers. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, and element lifecycle.\n */\n @property({ attribute: false })\n renderCustomMessageFooter?: WCRenderCustomMessageFooter;\n\n // markdown is declared on the FlattenedConfigElement base; the attributes\n // interface narrows its type.\n\n @state()\n private _userDefinedSlotNames: string[] = [];\n\n @state()\n private _writeableElementSlots: string[] = [];\n\n @state()\n private _customFooterSlotNames: string[] = [];\n\n /**\n * Active slot names for markdown-plugin output hosted at this element.\n * Populated when this element accepts the host-mount event; drained when\n * the matching unmount event fires.\n */\n @state()\n private _pluginSlotNames: string[] = [];\n\n /**\n * Page-level host elements created for plugin-output slots, keyed by slot\n * name. Created in this element's outer light DOM so consumer-loaded\n * stylesheets (e.g. KaTeX) reach the rendered HTML normally.\n */\n private _pluginHosts: Map<string, HTMLElement> = new Map();\n\n @state()\n private _instance!: ChatInstance;\n\n private defaultViewChangeHandler = (event: BusEventViewChange) => {\n if (event.newViewState.mainWindow) {\n this.classList.remove(\"cds-custom-aichat--hidden\");\n } else {\n this.classList.add(\"cds-custom-aichat--hidden\");\n }\n };\n\n private userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n private customFooterHandler = (event: BusEventCustomFooterSlot) => {\n const { slotName } = event.data;\n if (!this._customFooterSlotNames.includes(slotName)) {\n this._customFooterSlotNames = [...this._customFooterSlotNames, slotName];\n }\n };\n\n private handlePluginHostMount = (event: Event) => {\n const detail = (\n event as CustomEvent<{\n slotName: string;\n html?: string;\n element?: HTMLElement;\n isInline: boolean;\n }>\n ).detail;\n if (!detail?.slotName) {\n return;\n }\n if (!this._pluginSlotNames.includes(detail.slotName)) {\n this._pluginSlotNames = [...this._pluginSlotNames, detail.slotName];\n }\n // cds-custom-aichat-custom-element is always the outermost chat element in its\n // shadow chain; there is no further chat ancestor to defer to. Take\n // hosting unconditionally.\n event.preventDefault();\n // Custom-renderer hosts (table/codeBlock) forward a live element — the\n // markdown element keeps ownership of its content; we only relocate the\n // node into our outer light DOM so the consumer's global CSS reaches it.\n // Plugin fallbacks forward an HTML string instead.\n if (detail.element) {\n const element = detail.element;\n element.setAttribute(\"slot\", detail.slotName);\n if (!detail.isInline) {\n element.style.marginBlockStart = \"1rem\";\n }\n if (element.parentElement !== this) {\n this.appendChild(element);\n }\n return;\n }\n let host = this._pluginHosts.get(detail.slotName);\n if (!host) {\n host = document.createElement(detail.isInline ? \"span\" : \"div\");\n host.setAttribute(\"slot\", detail.slotName);\n // Match `.cds-custom-aichat-markdown-stack > *:not(:first-child)` spacing;\n // shadow CSS doesn't reach this host (it lives in this element's\n // outer light DOM), so apply it inline. Inline output flows with\n // text and gets no extra spacing.\n if (!detail.isInline) {\n host.style.marginBlockStart = \"1rem\";\n }\n this._pluginHosts.set(detail.slotName, host);\n this.appendChild(host);\n }\n if (host.innerHTML !== (detail.html ?? \"\")) {\n host.innerHTML = detail.html ?? \"\";\n }\n };\n\n private handlePluginHostUpdate = (event: Event) => {\n const detail = (event as CustomEvent<{ slotName: string; html: string }>)\n .detail;\n if (!detail?.slotName) {\n return;\n }\n const host = this._pluginHosts.get(detail.slotName);\n if (host && host.innerHTML !== detail.html) {\n host.innerHTML = detail.html;\n }\n };\n\n private handlePluginHostUnmount = (event: Event) => {\n const detail = (event as CustomEvent<{ slotName: string }>).detail;\n if (!detail?.slotName) {\n return;\n }\n this._pluginSlotNames = this._pluginSlotNames.filter(\n (n) => n !== detail.slotName,\n );\n const host = this._pluginHosts.get(detail.slotName);\n if (host) {\n host.remove();\n this._pluginHosts.delete(detail.slotName);\n }\n };\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\n \"cds-custom-aichat-markdown-plugin-host-mount\",\n this.handlePluginHostMount,\n );\n this.addEventListener(\n \"cds-custom-aichat-markdown-plugin-host-update\",\n this.handlePluginHostUpdate,\n );\n this.addEventListener(\n \"cds-custom-aichat-markdown-plugin-host-unmount\",\n this.handlePluginHostUnmount,\n );\n }\n\n disconnectedCallback() {\n this.removeEventListener(\n \"cds-custom-aichat-markdown-plugin-host-mount\",\n this.handlePluginHostMount,\n );\n this.removeEventListener(\n \"cds-custom-aichat-markdown-plugin-host-update\",\n this.handlePluginHostUpdate,\n );\n this.removeEventListener(\n \"cds-custom-aichat-markdown-plugin-host-unmount\",\n this.handlePluginHostUnmount,\n );\n for (const host of this._pluginHosts.values()) {\n host.remove();\n }\n this._pluginHosts.clear();\n super.disconnectedCallback();\n }\n\n private onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n if (this.onViewPreChange) {\n this._instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: this.onViewPreChange,\n });\n }\n this._instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: this.onViewChange || this.defaultViewChangeHandler,\n });\n\n if (!this.renderUserDefinedResponse) {\n // Legacy path: custom-element tracks slot names for manual slotting.\n // When renderUserDefinedResponse is set, the inner cds-custom-aichat-container handles everything.\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 if (!this.renderCustomMessageFooter) {\n // Legacy path: custom-element tracks slot names for manual slotting.\n // When renderCustomMessageFooter is set, the inner cds-custom-aichat-container handles everything.\n this._instance.on({\n type: BusEventType.CUSTOM_FOOTER_SLOT,\n handler: this.customFooterHandler,\n });\n }\n this.addWriteableElementSlots();\n await this.onBeforeRender?.(instance);\n };\n\n private addWriteableElementSlots() {\n this._writeableElementSlots = Object.keys(this._instance.writeableElements);\n }\n\n render() {\n return html`\n <cds-custom-aichat-container\n .config=${this.resolvedConfig}\n .header=${this.resolvedConfig.header}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this}\n .renderUserDefinedResponse=${this.renderUserDefinedResponse}\n .renderCustomMessageFooter=${this.renderCustomMessageFooter}\n .markdown=${this.markdown as WCMarkdown | undefined}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n ${this.renderUserDefinedResponse\n ? null\n : this._userDefinedSlotNames.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n ${this.renderCustomMessageFooter\n ? null\n : this._customFooterSlotNames.map(\n (slot) =>\n html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n ${this._pluginSlotNames.map(\n (slot) => html`<slot name=${slot} slot=${slot}></slot>`,\n )}\n </cds-custom-aichat-container>\n `;\n }\n}\n\n/**\n * Attributes interface for the cds-custom-aichat-custom-element 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 CdsAiChatCustomElementAttributes extends Omit<\n PublicConfig,\n \"markdown\"\n> {\n /**\n * Markdown rendering customization. Extends the framework-neutral\n * `PublicConfig.markdown` with web-component `customRenderers`.\n *\n * @experimental\n */\n markdown?: WCMarkdown;\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 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 * Called before a view change (the chat opening or closing) and awaited before the change proceeds. Use it to update\n * this element's CSS classes and run open/close animations to completion before the chat shell's inner contents are\n * hidden. A common pattern is to use this when the chat is closing and `onViewChange` when it opens.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded. After Carbon AI Chat is loaded, the\n * callback will not be updated.\n */\n onViewPreChange?: (event: BusEventViewPreChange) => Promise<void> | void;\n\n /**\n * An optional listener for \"view:change\" events. Such a listener is required when using a custom element in order\n * to control the visibility of the Carbon AI Chat main window. If no callback is provided here, a default one will be\n * used that injects styling into the app that will show and hide the Carbon AI Chat main window and also change the\n * size of the custom element so it doesn't take up space when the main window is closed.\n *\n * You can provide a different callback here if you want custom behavior such as an animation when the main window\n * is opened or closed.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded. After Carbon AI Chat is loaded, the event\n * handler will not be updated.\n */\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n\n /**\n * Optional callback to render user defined responses. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, streaming state, and element lifecycle.\n */\n renderUserDefinedResponse?: WCRenderUserDefinedResponse;\n\n /**\n * Optional callback to render custom message footers. When provided, the inner cds-custom-aichat-container\n * manages all event listening, slot tracking, and element lifecycle.\n */\n renderCustomMessageFooter?: WCRenderCustomMessageFooter;\n}\n\nexport { CdsAiChatCustomElementAttributes };\n\nexport default ChatCustomElement;\n"],"names":["ChatCustomElement","ChatCustomElement_1","FlattenedConfigElement","constructor","this","_userDefinedSlotNames","_writeableElementSlots","_customFooterSlotNames","_pluginSlotNames","_pluginHosts","Map","defaultViewChangeHandler","event","newViewState","mainWindow","classList","remove","add","userDefinedHandler","slot","data","includes","customFooterHandler","slotName","handlePluginHostMount","detail","preventDefault","element","setAttribute","isInline","style","marginBlockStart","parentElement","appendChild","host","get","document","createElement","set","innerHTML","html","handlePluginHostUpdate","handlePluginHostUnmount","filter","n","delete","onBeforeRenderOverride","async","instance","_instance","onViewPreChange","on","type","BusEventType","VIEW_PRE_CHANGE","handler","VIEW_CHANGE","onViewChange","renderUserDefinedResponse","USER_DEFINED_RESPONSE","CHUNK_USER_DEFINED_RESPONSE","renderCustomMessageFooter","CUSTOM_FOOTER_SLOT","addWriteableElementSlots","onBeforeRender","createRenderRoot","root","super","adoptedStyleSheets","hideSheet","connectedCallback","addEventListener","disconnectedCallback","removeEventListener","values","clear","Object","keys","writeableElements","render","resolvedConfig","header","onAfterRender","markdown","map","CSSStyleSheet","replaceSync","__decorate","property","attribute","prototype","state","carbonElement","ChatCustomElement_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAMA,oBAAiBC,sBAAvB,MAAMD,0BAA0BE;EAAhC,WAAAC;;IAiIUC,KAAAC,wBAAkC;IAGlCD,KAAAE,yBAAmC;IAGnCF,KAAAG,yBAAmC;IAQnCH,KAAAI,mBAA6B;IAO7BJ,KAAAK,eAAyC,IAAIC;IAK7CN,KAAAO,2BAA4BC;MAClC,IAAIA,MAAMC,aAAaC,YAAY;QACjCV,KAAKW,UAAUC,OAAO;AACx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A,EADCC,cAC0ExF,kBAAA0F,WAAA;;AAO3EH,WAAA,EADCC,SAAS;EAAEC,WAAW;MACiCzF,kBAAA0F,WAAA;;AAOxDH,WAAA,EADCC,SAAS;EAAEC,WAAW;MACiCzF,kBAAA0F,WAAA;;AAMhDH,WAAA,EADPI,WAC4C3F,kBAAA0F,WAAA;;AAGrCH,WAAA,EADPI,WAC6C3F,kBAAA0F,WAAA;;AAGtCH,WAAA,EADPI,WAC6C3F,kBAAA0F,WAAA;;AAQtCH,WAAA,EADPI,WACuC3F,kBAAA0F,WAAA;;AAUhCH,WAAA,EADPI,WACgC3F,kBAAA0F,WAAA;;AAzJ7B1F,oBAAiBC,sBAAAsF,WAAA,EADtBK,cAAc,gCACT5F;;AAwbN,IAAA6F,4BAAe7F;;"}
@@ -34,7 +34,22 @@
34
34
 
35
35
  // Application layout variables (only used in this file)
36
36
  $max-height: get-var("max-height", 640px);
37
- $min-height: get-var("min-height", 150px);
37
+ // WCAG 2.1 reflow (320x256): keep the widget at least 150px tall, otherwise the
38
+ // lower of 256px-from-top or the space above the bottom offset. This default
39
+ // lives here (not on the container) so a host override of --cds-aichat-min-height
40
+ // can still win; see AppShellStyles.scss.
41
+ $min-height: get-var(
42
+ "min-height",
43
+ max(
44
+ 150px,
45
+ calc(
46
+ min(256px, 100vh) - var(
47
+ --cds-aichat-bottom-position,
48
+ #{layout.$spacing-09}
49
+ )
50
+ )
51
+ )
52
+ );
38
53
  $width: get-var("width", 380px);
39
54
  $height: get-var("height", calc(100vh - (2 * #{layout.$spacing-07})));
40
55
 
@@ -1,5 +1,5 @@
1
- import { P as PersistedState, C as ChatContainerProps, B as BusEventViewPreChange, a as ChatInstance, b as BusEventViewChange } from './serverEntry-Byd0DXxW.js';
2
- export { A as AdditionalDataToAgent, c as AgentAvailability, d as AudioItem, e as AutoScrollOptions, f as BaseGenericItem, g as BaseMessageInput, h as BusEvent, i as BusEventChatReady, j as BusEventChunkUserDefinedResponse, k as BusEventClosePanelButtonClicked, l as BusEventCustomFooterSlot, m as BusEventCustomPanelClose, n as BusEventCustomPanelOpen, o as BusEventCustomPanelPreClose, p as BusEventCustomPanelPreOpen, q as BusEventFeedback, r as BusEventHeaderMenuClick, s as BusEventHistoryBegin, t as BusEventHistoryEnd, u as BusEventHumanAgentAreAnyAgentsOnline, v as BusEventHumanAgentEndChat, w as BusEventHumanAgentPreEndChat, x as BusEventHumanAgentPreReceive, y as BusEventHumanAgentPreSend, z as BusEventHumanAgentPreStartChat, D as BusEventHumanAgentReceive, E as BusEventHumanAgentSend, F as BusEventMessageItemCustom, G as BusEventPreReceive, H as BusEventPreReset, I as BusEventPreSend, J as BusEventReceive, K as BusEventReset, L as BusEventSend, M as BusEventStateChange, N as BusEventType, O as BusEventUserDefinedResponse, Q as BusEventWorkspaceClose, R as BusEventWorkspaceOpen, S as BusEventWorkspacePreClose, T as BusEventWorkspacePreOpen, U as ButtonItem, V as ButtonItemKind, W as ButtonItemType, X as CancellationReason, Y as CarbonTheme, Z as CardItem, _ as CarouselItem, $ as CatastrophicErrorPanelState, a0 as CdsAiChatContainerAttributes, a1 as CdsAiChatCustomElementAttributes, a2 as ChainOfThoughtStep, a3 as ChangeFunction, a4 as ChatContainerPropsMarkdown, a5 as ChatInstanceInput, a6 as ChatInstanceMessaging, a7 as ChatInstanceServiceDeskActions, a8 as ChatShortcutConfig, a9 as Chunk, aa as CompleteItemChunk, ab as ConnectToHumanAgentItem, ac as ConnectToHumanAgentItemTransferInfo, ad as ConnectingErrorInfo, ae as ConversationalSearchItem, af as ConversationalSearchItemCitation, ag as CornersType, ah as CustomMarkdownRenderers, ai as CustomMenuOption, aj as CustomPanelConfigOptions, ak as CustomPanelInstance, al as CustomPanelOpenOptions, am as CustomPanels, an as CustomSendMessageOptions, ao as DateItem, ap as DeepPartial, aq as DefaultCustomPanelConfigOptions, ar as DisclaimerPublicConfig, as as DisconnectedErrorInfo, at as EndChatInfo, au as ErrorType, av as EventBusHandler, aw as EventHandlers, ax as EventInput, ay as EventInputData, az as ExternalFileReference, aA as FeedbackInteractionType, aB as FileFieldValue, aC as FileStatusValue, aD as FileUpload, aE as FileUploadCapabilities, aF as FinalResponseChunk, aG as GenericItem, aH as GenericItemCustomFooterSlotOptions, aI as GenericItemMessageFeedbackCategories, aJ as GenericItemMessageFeedbackOptions, aK as GenericItemMessageOptions, aL as GridItem, aM as HeaderConfig, aN as HeaderMenuClickType, aO as HistoryConfig, aP as HistoryItem, aQ as HomeScreenConfig, aR as HomeScreenStarterButton, aS as HomeScreenStarterButtons, aT as HomeScreenState, aU as HorizontalCellAlignment, aV as HumanAgentMessageType, aW as HumanAgentsOnlineStatus, aX as IFrameItem, aY as IFrameItemDisplayOption, aZ as ImageItem, a_ as IncreaseOrDecrease, a$ as InlineErrorItem, b0 as InlineFile, b1 as InputConfig, b2 as ItemStreamingMetadata, b3 as KeyboardShortcuts, b4 as LanguagePack, b5 as LauncherCallToActionConfig, b6 as LauncherConfig, b7 as LayoutConfig, b8 as LayoutCustomProperties, b9 as MarkdownCustomRenderers, ba as MarkdownItPlugin, bb as MarkdownRendererCodeBlockArgs, bc as MarkdownRendererCodeBlockData, bd as MarkdownRendererTableArgs, be as MarkdownRendererTableData, bf as MediaFileAccessibility, bg as MediaItem, bh as MediaItemDimensions, bi as MediaSubtitleTrack, bj as MediaTranscript, bk as Message, bl as MessageErrorState, bm as MessageHistoryFeedback, bn as MessageInput, bo as MessageInputType, bp as MessageItemPanelInfo, bq as MessageOutput, br as MessageRequest, bs as MessageRequestHistory, bt as MessageResponse, bu as MessageResponseHistory, bv as MessageResponseOptions, bw as MessageResponseTypes, bx as MessageSendSource, by as MessageState, bz as MinimizeButtonIconType, bA as ObjectMap, bB as OnErrorData, bC as OnErrorType, bD as OptionItem, bE as OptionItemPreference, bF as PageObjectId, bG as PanelType, bH as PartialItemChunk, bI as PartialItemChunkWithId, bJ as PartialOrCompleteItemChunk, bK as PartialResponse, bL as PauseItem, bM as PerCornerConfig, bN as PersistedHumanAgentState, bO as PreviewCardItem, bP as PublicChatHumanAgentState, bQ as PublicChatState, bR as PublicConfig, bS as PublicConfigMarkdown, bT as PublicConfigMessaging, bU as PublicCustomPanelsState, bV as PublicDefaultCustomPanelState, bW as PublicHistoryPanelState, bX as PublicInputState, bY as PublicWorkspaceCustomPanelState, bZ as ReasoningStep, b_ as ReasoningStepOpenState, b$ as ReasoningSteps, c0 as RenderCustomMessageFooter, c1 as RenderCustomMessageFooterState, c2 as RenderUserDefinedResponse, c3 as RenderUserDefinedState, c4 as RenderWriteableElementResponse, c5 as ResolvedCornerConfig, c6 as ResponseUserProfile, c7 as ScreenShareState, c8 as SearchResult, c9 as SendOptions, ca as ServiceDesk, cb as ServiceDeskCallback, cc as ServiceDeskCapabilities, cd as ServiceDeskErrorInfo, ce as ServiceDeskFactoryParameters, cf as ServiceDeskPublicConfig, cg as SingleOption, ch as StartChatOptions, ci as StreamChunk, cj as StructuredData, ck as StructuredField, cl as StructuredFieldType, cm as StructuredFieldValue, cn as SystemMessageItem, co as SystemMessageVariant, cp as TestId, cq as TextItem, cr as TokenTree, cs as TypeAndHandler, ct as UploadConfig, cu as UpsertMessageUpdater, cv as UserDefinedItem, cw as UserMessageErrorInfo, cx as UserType, cy as VerticalCellAlignment, cz as VideoItem, cA as ViewChangeReason, cB as ViewState, cC as ViewType, cD as WCCustomMarkdownRenderers, cE as WCMarkdown, cF as WCRenderCustomMessageFooter, cG as WCRenderUserDefinedResponse, cH as WidthOptions, cI as WithBodyAndFooter, cJ as WithWidthOptions, cK as WorkspaceCustomPanelConfigOptions, cL as WriteableElementName, cM as WriteableElements, cN as enLanguagePack, cO as loadAllLazyDeps } from './serverEntry-Byd0DXxW.js';
1
+ import { P as PersistedState, C as ChatContainerProps, B as BusEventViewPreChange, a as ChatInstance, b as BusEventViewChange } from './serverEntry-CNSUvqmn.js';
2
+ export { A as AdditionalDataToAgent, c as AgentAvailability, d as AudioItem, e as AutoScrollOptions, f as BaseGenericItem, g as BaseMessageInput, h as BusEvent, i as BusEventChatReady, j as BusEventChunkUserDefinedResponse, k as BusEventClosePanelButtonClicked, l as BusEventCustomFooterSlot, m as BusEventCustomPanelClose, n as BusEventCustomPanelOpen, o as BusEventCustomPanelPreClose, p as BusEventCustomPanelPreOpen, q as BusEventFeedback, r as BusEventHeaderMenuClick, s as BusEventHistoryBegin, t as BusEventHistoryEnd, u as BusEventHumanAgentAreAnyAgentsOnline, v as BusEventHumanAgentEndChat, w as BusEventHumanAgentPreEndChat, x as BusEventHumanAgentPreReceive, y as BusEventHumanAgentPreSend, z as BusEventHumanAgentPreStartChat, D as BusEventHumanAgentReceive, E as BusEventHumanAgentSend, F as BusEventMessageItemCustom, G as BusEventPreReceive, H as BusEventPreReset, I as BusEventPreSend, J as BusEventReceive, K as BusEventReset, L as BusEventSend, M as BusEventStateChange, N as BusEventType, O as BusEventUserDefinedResponse, Q as BusEventWorkspaceClose, R as BusEventWorkspaceOpen, S as BusEventWorkspacePreClose, T as BusEventWorkspacePreOpen, U as ButtonItem, V as ButtonItemKind, W as ButtonItemType, X as CancellationReason, Y as CarbonTheme, Z as CardItem, _ as CarouselItem, $ as CatastrophicErrorPanelState, a0 as CdsAiChatContainerAttributes, a1 as CdsAiChatCustomElementAttributes, a2 as ChainOfThoughtStep, a3 as ChangeFunction, a4 as ChatContainerPropsMarkdown, a5 as ChatInstanceInput, a6 as ChatInstanceMessaging, a7 as ChatInstanceServiceDeskActions, a8 as ChatShortcutConfig, a9 as Chunk, aa as CompleteItemChunk, ab as ConnectToHumanAgentItem, ac as ConnectToHumanAgentItemTransferInfo, ad as ConnectingErrorInfo, ae as ConversationalSearchItem, af as ConversationalSearchItemCitation, ag as CornersType, ah as CustomMarkdownRenderers, ai as CustomMenuOption, aj as CustomPanelConfigOptions, ak as CustomPanelInstance, al as CustomPanelOpenOptions, am as CustomPanels, an as CustomSendMessageOptions, ao as DateItem, ap as DeepPartial, aq as DefaultCustomPanelConfigOptions, ar as DisclaimerPublicConfig, as as DisconnectedErrorInfo, at as EndChatInfo, au as ErrorType, av as EventBusHandler, aw as EventHandlers, ax as EventInput, ay as EventInputData, az as ExternalFileReference, aA as FeedbackInteractionType, aB as FileFieldValue, aC as FileStatusValue, aD as FileUpload, aE as FileUploadCapabilities, aF as FinalResponseChunk, aG as GenericItem, aH as GenericItemCustomFooterSlotOptions, aI as GenericItemMessageFeedbackCategories, aJ as GenericItemMessageFeedbackOptions, aK as GenericItemMessageOptions, aL as GridItem, aM as HeaderConfig, aN as HeaderMenuClickType, aO as HistoryConfig, aP as HistoryItem, aQ as HomeScreenConfig, aR as HomeScreenStarterButton, aS as HomeScreenStarterButtons, aT as HomeScreenState, aU as HorizontalCellAlignment, aV as HumanAgentMessageType, aW as HumanAgentsOnlineStatus, aX as IFrameItem, aY as IFrameItemDisplayOption, aZ as ImageItem, a_ as IncreaseOrDecrease, a$ as InlineErrorItem, b0 as InlineFile, b1 as InputConfig, b2 as ItemStreamingMetadata, b3 as KeyboardShortcuts, b4 as LanguagePack, b5 as LauncherCallToActionConfig, b6 as LauncherConfig, b7 as LayoutConfig, b8 as LayoutCustomProperties, b9 as MarkdownCustomRenderers, ba as MarkdownItPlugin, bb as MarkdownRendererCodeBlockArgs, bc as MarkdownRendererCodeBlockData, bd as MarkdownRendererTableArgs, be as MarkdownRendererTableData, bf as MediaFileAccessibility, bg as MediaItem, bh as MediaItemDimensions, bi as MediaSubtitleTrack, bj as MediaTranscript, bk as Message, bl as MessageErrorState, bm as MessageHistoryFeedback, bn as MessageInput, bo as MessageInputType, bp as MessageItemPanelInfo, bq as MessageOutput, br as MessageRequest, bs as MessageRequestHistory, bt as MessageResponse, bu as MessageResponseHistory, bv as MessageResponseOptions, bw as MessageResponseTypes, bx as MessageSendSource, by as MessageState, bz as MinimizeButtonIconType, bA as ObjectMap, bB as OnErrorData, bC as OnErrorType, bD as OptionItem, bE as OptionItemPreference, bF as PageObjectId, bG as PanelType, bH as PartialItemChunk, bI as PartialItemChunkWithId, bJ as PartialOrCompleteItemChunk, bK as PartialResponse, bL as PauseItem, bM as PerCornerConfig, bN as PersistedHumanAgentState, bO as PreviewCardItem, bP as PublicChatHumanAgentState, bQ as PublicChatState, bR as PublicConfig, bS as PublicConfigMarkdown, bT as PublicConfigMessaging, bU as PublicCustomPanelsState, bV as PublicDefaultCustomPanelState, bW as PublicHistoryPanelState, bX as PublicInputState, bY as PublicWorkspaceCustomPanelState, bZ as ReasoningStep, b_ as ReasoningStepOpenState, b$ as ReasoningSteps, c0 as RenderCustomMessageFooter, c1 as RenderCustomMessageFooterState, c2 as RenderUserDefinedResponse, c3 as RenderUserDefinedState, c4 as RenderWriteableElementResponse, c5 as ResolvedCornerConfig, c6 as ResponseUserProfile, c7 as ScreenShareState, c8 as SearchResult, c9 as SendOptions, ca as ServiceDesk, cb as ServiceDeskCallback, cc as ServiceDeskCapabilities, cd as ServiceDeskErrorInfo, ce as ServiceDeskFactoryParameters, cf as ServiceDeskPublicConfig, cg as SingleOption, ch as StartChatOptions, ci as StreamChunk, cj as StructuredData, ck as StructuredField, cl as StructuredFieldType, cm as StructuredFieldValue, cn as SystemMessageItem, co as SystemMessageVariant, cp as TestId, cq as TextItem, cr as TokenTree, cs as TypeAndHandler, ct as UploadConfig, cu as UpsertMessageUpdater, cv as UserDefinedItem, cw as UserMessageErrorInfo, cx as UserType, cy as VerticalCellAlignment, cz as VideoItem, cA as ViewChangeReason, cB as ViewState, cC as ViewType, cD as WCCustomMarkdownRenderers, cE as WCMarkdown, cF as WCRenderCustomMessageFooter, cG as WCRenderUserDefinedResponse, cH as WidthOptions, cI as WithBodyAndFooter, cJ as WithWidthOptions, cK as WorkspaceCustomPanelConfigOptions, cL as WriteableElementName, cM as WriteableElements, cN as enLanguagePack, cO as loadAllLazyDeps } from './serverEntry-CNSUvqmn.js';
3
3
  import React, { HTMLAttributes } from 'react';
4
4
  export { ChainOfThoughtStepStatus } from '@carbon/ai-chat-components/es/components/chain-of-thought/defs.js';
5
5
  import '@carbon/web-components/es/components/button/defs.js';
@@ -5106,16 +5106,30 @@ interface LayoutConfig {
5106
5106
  */
5107
5107
  corners?: CornersType | PerCornerConfig;
5108
5108
  /**
5109
- * CSS variable overrides for the chat UI. This is a convienience method, you may also set these properties via CSS.
5109
+ * CSS custom property overrides for the chat UI. This is a convenience method; you may also set
5110
+ * these properties via CSS. Unlike page-level CSS, these overrides are injected inside the chat
5111
+ * and win even when a theme is forced with {@link PublicConfig.injectCarbonTheme}.
5110
5112
  *
5111
- * Keys correspond to values from `LayoutCustomProperties` (e.g. `LayoutCustomProperties.height`),
5112
- * which map to the underlying `--cds-aichat-…` custom properties.
5113
- * Values are raw CSS values such as `"420px"`, `"9999"`, etc.
5113
+ * Two token layers are supported, distinguished by the key:
5114
+ *
5115
+ * - **Chat shell tokens** a value from `LayoutCustomProperties` (e.g. `"width"` or
5116
+ * `"launcher-color-background"`) maps to the matching `--cds-aichat-…` custom property.
5117
+ * - **Carbon theme tokens** — any Carbon token name prefixed with `$` (e.g. `"$button-primary"`)
5118
+ * maps to the matching `--cds-…` custom property (`--cds-button-primary`). Use this to recolor
5119
+ * the Carbon components rendered inside the chat. `$`-prefixed values must be hexadecimal colors.
5120
+ *
5121
+ * Values are raw CSS values such as `"420px"`, `"9999"`, or `"#1a1a2e"`.
5114
5122
  *
5115
5123
  * Example:
5116
- * { height: "560px", width: "420px" }
5124
+ * ```ts
5125
+ * {
5126
+ * width: "420px",
5127
+ * "launcher-color-background": "#1a1a2e",
5128
+ * "$button-primary": "#1a1a2e",
5129
+ * }
5130
+ * ```
5117
5131
  */
5118
- customProperties?: Partial<Record<LayoutCustomProperties, string>>;
5132
+ customProperties?: Partial<Record<LayoutCustomProperties | `$${string}`, string>>;
5119
5133
  }
5120
5134
  /**
5121
5135
  * Config options for controlling messaging.
@@ -1,4 +1,4 @@
1
- export { A as AdditionalDataToAgent, c as AgentAvailability, d as AudioItem, e as AutoScrollOptions, f as BaseGenericItem, g as BaseMessageInput, h as BusEvent, i as BusEventChatReady, j as BusEventChunkUserDefinedResponse, k as BusEventClosePanelButtonClicked, m as BusEventCustomPanelClose, n as BusEventCustomPanelOpen, o as BusEventCustomPanelPreClose, p as BusEventCustomPanelPreOpen, q as BusEventFeedback, r as BusEventHeaderMenuClick, s as BusEventHistoryBegin, t as BusEventHistoryEnd, u as BusEventHumanAgentAreAnyAgentsOnline, v as BusEventHumanAgentEndChat, w as BusEventHumanAgentPreEndChat, x as BusEventHumanAgentPreReceive, y as BusEventHumanAgentPreSend, z as BusEventHumanAgentPreStartChat, D as BusEventHumanAgentReceive, E as BusEventHumanAgentSend, F as BusEventMessageItemCustom, G as BusEventPreReceive, H as BusEventPreReset, I as BusEventPreSend, J as BusEventReceive, K as BusEventReset, L as BusEventSend, M as BusEventStateChange, N as BusEventType, O as BusEventUserDefinedResponse, b as BusEventViewChange, B as BusEventViewPreChange, Q as BusEventWorkspaceClose, R as BusEventWorkspaceOpen, S as BusEventWorkspacePreClose, T as BusEventWorkspacePreOpen, U as ButtonItem, V as ButtonItemKind, W as ButtonItemType, X as CancellationReason, Y as CarbonTheme, Z as CardItem, _ as CarouselItem, $ as CatastrophicErrorPanelState, a0 as CdsAiChatContainerAttributes, a1 as CdsAiChatCustomElementAttributes, a2 as ChainOfThoughtStep, a3 as ChangeFunction, a4 as ChatContainerPropsMarkdown, a as ChatInstance, a5 as ChatInstanceInput, a6 as ChatInstanceMessaging, a7 as ChatInstanceServiceDeskActions, a8 as ChatShortcutConfig, a9 as Chunk, aa as CompleteItemChunk, ab as ConnectToHumanAgentItem, ac as ConnectToHumanAgentItemTransferInfo, ad as ConnectingErrorInfo, ae as ConversationalSearchItem, af as ConversationalSearchItemCitation, ag as CornersType, ah as CustomMarkdownRenderers, ai as CustomMenuOption, aj as CustomPanelConfigOptions, ak as CustomPanelInstance, al as CustomPanelOpenOptions, am as CustomPanels, an as CustomSendMessageOptions, ao as DateItem, ap as DeepPartial, aq as DefaultCustomPanelConfigOptions, ar as DisclaimerPublicConfig, as as DisconnectedErrorInfo, at as EndChatInfo, au as ErrorType, av as EventBusHandler, aw as EventHandlers, ax as EventInput, ay as EventInputData, az as ExternalFileReference, aA as FeedbackInteractionType, aB as FileFieldValue, aC as FileStatusValue, aD as FileUpload, aE as FileUploadCapabilities, aF as FinalResponseChunk, aG as GenericItem, aI as GenericItemMessageFeedbackCategories, aJ as GenericItemMessageFeedbackOptions, aK as GenericItemMessageOptions, aL as GridItem, aM as HeaderConfig, aN as HeaderMenuClickType, aO as HistoryConfig, aP as HistoryItem, aQ as HomeScreenConfig, aR as HomeScreenStarterButton, aS as HomeScreenStarterButtons, aT as HomeScreenState, aU as HorizontalCellAlignment, aV as HumanAgentMessageType, aW as HumanAgentsOnlineStatus, aX as IFrameItem, aY as IFrameItemDisplayOption, aZ as ImageItem, a_ as IncreaseOrDecrease, a$ as InlineErrorItem, b0 as InlineFile, b1 as InputConfig, b2 as ItemStreamingMetadata, b3 as KeyboardShortcuts, b4 as LanguagePack, b5 as LauncherCallToActionConfig, b6 as LauncherConfig, b7 as LayoutConfig, b8 as LayoutCustomProperties, b9 as MarkdownCustomRenderers, ba as MarkdownItPlugin, bb as MarkdownRendererCodeBlockArgs, bc as MarkdownRendererCodeBlockData, bd as MarkdownRendererTableArgs, be as MarkdownRendererTableData, bf as MediaFileAccessibility, bg as MediaItem, bh as MediaItemDimensions, bi as MediaSubtitleTrack, bj as MediaTranscript, bk as Message, bl as MessageErrorState, bm as MessageHistoryFeedback, bn as MessageInput, bo as MessageInputType, bp as MessageItemPanelInfo, bq as MessageOutput, br as MessageRequest, bs as MessageRequestHistory, bt as MessageResponse, bu as MessageResponseHistory, bv as MessageResponseOptions, bw as MessageResponseTypes, bx as MessageSendSource, by as MessageState, bz as MinimizeButtonIconType, bA as ObjectMap, bB as OnErrorData, bC as OnErrorType, bD as OptionItem, bE as OptionItemPreference, bF as PageObjectId, bG as PanelType, bH as PartialItemChunk, bI as PartialItemChunkWithId, bJ as PartialOrCompleteItemChunk, bK as PartialResponse, bL as PauseItem, bN as PersistedHumanAgentState, P as PersistedState, bO as PreviewCardItem, bP as PublicChatHumanAgentState, bQ as PublicChatState, bR as PublicConfig, bS as PublicConfigMarkdown, bT as PublicConfigMessaging, bU as PublicCustomPanelsState, bV as PublicDefaultCustomPanelState, bW as PublicHistoryPanelState, bX as PublicInputState, bY as PublicWorkspaceCustomPanelState, bZ as ReasoningStep, b_ as ReasoningStepOpenState, b$ as ReasoningSteps, c0 as RenderCustomMessageFooter, c1 as RenderCustomMessageFooterState, c2 as RenderUserDefinedResponse, c3 as RenderUserDefinedState, c4 as RenderWriteableElementResponse, c6 as ResponseUserProfile, c7 as ScreenShareState, c8 as SearchResult, c9 as SendOptions, ca as ServiceDesk, cb as ServiceDeskCallback, cc as ServiceDeskCapabilities, cd as ServiceDeskErrorInfo, ce as ServiceDeskFactoryParameters, cf as ServiceDeskPublicConfig, cg as SingleOption, ch as StartChatOptions, ci as StreamChunk, cj as StructuredData, ck as StructuredField, cl as StructuredFieldType, cm as StructuredFieldValue, cn as SystemMessageItem, co as SystemMessageVariant, cp as TestId, cq as TextItem, cr as TokenTree, cs as TypeAndHandler, ct as UploadConfig, cu as UpsertMessageUpdater, cv as UserDefinedItem, cw as UserMessageErrorInfo, cx as UserType, cy as VerticalCellAlignment, cz as VideoItem, cA as ViewChangeReason, cB as ViewState, cC as ViewType, cD as WCCustomMarkdownRenderers, cE as WCMarkdown, cF as WCRenderCustomMessageFooter, cG as WCRenderUserDefinedResponse, cH as WidthOptions, cI as WithBodyAndFooter, cJ as WithWidthOptions, cK as WorkspaceCustomPanelConfigOptions, cL as WriteableElementName, cM as WriteableElements, cN as enLanguagePack, cO as loadAllLazyDeps } from './serverEntry-Byd0DXxW.js';
1
+ export { A as AdditionalDataToAgent, c as AgentAvailability, d as AudioItem, e as AutoScrollOptions, f as BaseGenericItem, g as BaseMessageInput, h as BusEvent, i as BusEventChatReady, j as BusEventChunkUserDefinedResponse, k as BusEventClosePanelButtonClicked, m as BusEventCustomPanelClose, n as BusEventCustomPanelOpen, o as BusEventCustomPanelPreClose, p as BusEventCustomPanelPreOpen, q as BusEventFeedback, r as BusEventHeaderMenuClick, s as BusEventHistoryBegin, t as BusEventHistoryEnd, u as BusEventHumanAgentAreAnyAgentsOnline, v as BusEventHumanAgentEndChat, w as BusEventHumanAgentPreEndChat, x as BusEventHumanAgentPreReceive, y as BusEventHumanAgentPreSend, z as BusEventHumanAgentPreStartChat, D as BusEventHumanAgentReceive, E as BusEventHumanAgentSend, F as BusEventMessageItemCustom, G as BusEventPreReceive, H as BusEventPreReset, I as BusEventPreSend, J as BusEventReceive, K as BusEventReset, L as BusEventSend, M as BusEventStateChange, N as BusEventType, O as BusEventUserDefinedResponse, b as BusEventViewChange, B as BusEventViewPreChange, Q as BusEventWorkspaceClose, R as BusEventWorkspaceOpen, S as BusEventWorkspacePreClose, T as BusEventWorkspacePreOpen, U as ButtonItem, V as ButtonItemKind, W as ButtonItemType, X as CancellationReason, Y as CarbonTheme, Z as CardItem, _ as CarouselItem, $ as CatastrophicErrorPanelState, a0 as CdsAiChatContainerAttributes, a1 as CdsAiChatCustomElementAttributes, a2 as ChainOfThoughtStep, a3 as ChangeFunction, a4 as ChatContainerPropsMarkdown, a as ChatInstance, a5 as ChatInstanceInput, a6 as ChatInstanceMessaging, a7 as ChatInstanceServiceDeskActions, a8 as ChatShortcutConfig, a9 as Chunk, aa as CompleteItemChunk, ab as ConnectToHumanAgentItem, ac as ConnectToHumanAgentItemTransferInfo, ad as ConnectingErrorInfo, ae as ConversationalSearchItem, af as ConversationalSearchItemCitation, ag as CornersType, ah as CustomMarkdownRenderers, ai as CustomMenuOption, aj as CustomPanelConfigOptions, ak as CustomPanelInstance, al as CustomPanelOpenOptions, am as CustomPanels, an as CustomSendMessageOptions, ao as DateItem, ap as DeepPartial, aq as DefaultCustomPanelConfigOptions, ar as DisclaimerPublicConfig, as as DisconnectedErrorInfo, at as EndChatInfo, au as ErrorType, av as EventBusHandler, aw as EventHandlers, ax as EventInput, ay as EventInputData, az as ExternalFileReference, aA as FeedbackInteractionType, aB as FileFieldValue, aC as FileStatusValue, aD as FileUpload, aE as FileUploadCapabilities, aF as FinalResponseChunk, aG as GenericItem, aI as GenericItemMessageFeedbackCategories, aJ as GenericItemMessageFeedbackOptions, aK as GenericItemMessageOptions, aL as GridItem, aM as HeaderConfig, aN as HeaderMenuClickType, aO as HistoryConfig, aP as HistoryItem, aQ as HomeScreenConfig, aR as HomeScreenStarterButton, aS as HomeScreenStarterButtons, aT as HomeScreenState, aU as HorizontalCellAlignment, aV as HumanAgentMessageType, aW as HumanAgentsOnlineStatus, aX as IFrameItem, aY as IFrameItemDisplayOption, aZ as ImageItem, a_ as IncreaseOrDecrease, a$ as InlineErrorItem, b0 as InlineFile, b1 as InputConfig, b2 as ItemStreamingMetadata, b3 as KeyboardShortcuts, b4 as LanguagePack, b5 as LauncherCallToActionConfig, b6 as LauncherConfig, b7 as LayoutConfig, b8 as LayoutCustomProperties, b9 as MarkdownCustomRenderers, ba as MarkdownItPlugin, bb as MarkdownRendererCodeBlockArgs, bc as MarkdownRendererCodeBlockData, bd as MarkdownRendererTableArgs, be as MarkdownRendererTableData, bf as MediaFileAccessibility, bg as MediaItem, bh as MediaItemDimensions, bi as MediaSubtitleTrack, bj as MediaTranscript, bk as Message, bl as MessageErrorState, bm as MessageHistoryFeedback, bn as MessageInput, bo as MessageInputType, bp as MessageItemPanelInfo, bq as MessageOutput, br as MessageRequest, bs as MessageRequestHistory, bt as MessageResponse, bu as MessageResponseHistory, bv as MessageResponseOptions, bw as MessageResponseTypes, bx as MessageSendSource, by as MessageState, bz as MinimizeButtonIconType, bA as ObjectMap, bB as OnErrorData, bC as OnErrorType, bD as OptionItem, bE as OptionItemPreference, bF as PageObjectId, bG as PanelType, bH as PartialItemChunk, bI as PartialItemChunkWithId, bJ as PartialOrCompleteItemChunk, bK as PartialResponse, bL as PauseItem, bN as PersistedHumanAgentState, P as PersistedState, bO as PreviewCardItem, bP as PublicChatHumanAgentState, bQ as PublicChatState, bR as PublicConfig, bS as PublicConfigMarkdown, bT as PublicConfigMessaging, bU as PublicCustomPanelsState, bV as PublicDefaultCustomPanelState, bW as PublicHistoryPanelState, bX as PublicInputState, bY as PublicWorkspaceCustomPanelState, bZ as ReasoningStep, b_ as ReasoningStepOpenState, b$ as ReasoningSteps, c0 as RenderCustomMessageFooter, c1 as RenderCustomMessageFooterState, c2 as RenderUserDefinedResponse, c3 as RenderUserDefinedState, c4 as RenderWriteableElementResponse, c6 as ResponseUserProfile, c7 as ScreenShareState, c8 as SearchResult, c9 as SendOptions, ca as ServiceDesk, cb as ServiceDeskCallback, cc as ServiceDeskCapabilities, cd as ServiceDeskErrorInfo, ce as ServiceDeskFactoryParameters, cf as ServiceDeskPublicConfig, cg as SingleOption, ch as StartChatOptions, ci as StreamChunk, cj as StructuredData, ck as StructuredField, cl as StructuredFieldType, cm as StructuredFieldValue, cn as SystemMessageItem, co as SystemMessageVariant, cp as TestId, cq as TextItem, cr as TokenTree, cs as TypeAndHandler, ct as UploadConfig, cu as UpsertMessageUpdater, cv as UserDefinedItem, cw as UserMessageErrorInfo, cx as UserType, cy as VerticalCellAlignment, cz as VideoItem, cA as ViewChangeReason, cB as ViewState, cC as ViewType, cD as WCCustomMarkdownRenderers, cE as WCMarkdown, cF as WCRenderCustomMessageFooter, cG as WCRenderUserDefinedResponse, cH as WidthOptions, cI as WithBodyAndFooter, cJ as WithWidthOptions, cK as WorkspaceCustomPanelConfigOptions, cL as WriteableElementName, cM as WriteableElements, cN as enLanguagePack, cO as loadAllLazyDeps } from './serverEntry-CNSUvqmn.js';
2
2
  export { ChainOfThoughtStepStatus } from '@carbon/ai-chat-components/es/components/chain-of-thought/defs.js';
3
3
  import '@carbon/web-components/es/components/button/defs.js';
4
4
  import '@carbon/ai-chat-components/es/react/chat-button.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon/ai-chat",
3
- "version": "1.16.0-rc.0",
3
+ "version": "1.16.0",
4
4
  "description": "Be sure to review the [chat documentation](https://chat.carbondesignsystem.com/tag/latest/docs/documents/Overview.html).",
5
5
  "author": "IBM Corp",
6
6
  "license": "Apache-2.0",
@@ -80,7 +80,7 @@
80
80
  "@carbon/icons": "^11.53.0",
81
81
  "@carbon/styles": "^1.105.0",
82
82
  "@carbon/themes": "^11.58.0",
83
- "@carbon/typedoc-theme": "^0.5.0-rc.0",
83
+ "@carbon/typedoc-theme": "^0.5.0",
84
84
  "@carbon/web-components": "^2.54.0",
85
85
  "@open-wc/testing": "4.0.0",
86
86
  "@rollup/plugin-babel": "^7.0.0",
@@ -132,7 +132,7 @@
132
132
  "react-dom": ">=17.0.0 <20.0.0"
133
133
  },
134
134
  "dependencies": {
135
- "@carbon/ai-chat-components": "^1.6.0-rc.0",
135
+ "@carbon/ai-chat-components": "^1.6.0",
136
136
  "@carbon/icons": "^11.53.0",
137
137
  "@ibm/telemetry-js": "^1.10.2",
138
138
  "@lit/react": "^1.0.6",
@@ -164,5 +164,5 @@
164
164
  "url": "https://github.com/carbon-design-system/carbon-ai-chat/issues"
165
165
  },
166
166
  "homepage": "https://github.com/carbon-design-system/carbon-ai-chat#readme",
167
- "gitHead": "180d9f7b7b8d6b33f418aa1caec1bfc0cc8b7a5a"
167
+ "gitHead": "bb14f6cb611d762c655753103d6be938fdda79c5"
168
168
  }