@mintlify/assistant-web
Advanced tools
+93
| Copyright (c) 2022 Mintlify, Inc. | ||
| Elastic License 2.0 | ||
| ## Acceptance | ||
| By using the software, you agree to all of the terms and conditions below. | ||
| ## Copyright License | ||
| The licensor grants you a non-exclusive, royalty-free, worldwide, | ||
| non-sublicensable, non-transferable license to use, copy, distribute, make | ||
| available, and prepare derivative works of the software, in each case subject to | ||
| the limitations and conditions below. | ||
| ## Limitations | ||
| You may not provide the software to third parties as a hosted or managed | ||
| service, where the service provides users with access to any substantial set of | ||
| the features or functionality of the software. | ||
| You may not move, change, disable, or circumvent the license key functionality | ||
| in the software, and you may not remove or obscure any functionality in the | ||
| software that is protected by the license key. | ||
| You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
| of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
| to applicable law. | ||
| ## Patents | ||
| The licensor grants you a license, under any patent claims the licensor can | ||
| license, or becomes able to license, to make, have made, use, sell, offer for | ||
| sale, import and have imported the software, in each case subject to the | ||
| limitations and conditions in this license. This license does not cover any | ||
| patent claims that you cause to be infringed by modifications or additions to | ||
| the software. If you or your company make any written claim that the software | ||
| infringes or contributes to infringement of any patent, your patent license for | ||
| the software granted under these terms ends immediately. If your company makes | ||
| such a claim, your patent license ends immediately for work on behalf of your | ||
| company. | ||
| ## Notices | ||
| You must ensure that anyone who gets a copy of any part of the software from you | ||
| also gets a copy of these terms. | ||
| If you modify the software, you must include in any modified copies of the | ||
| software prominent notices stating that you have modified the software. | ||
| ## No Other Rights | ||
| These terms do not imply any licenses other than those expressly granted in | ||
| these terms. | ||
| ## Termination | ||
| If you use the software in violation of these terms, such use is not licensed, | ||
| and your licenses will automatically terminate. If the licensor provides you | ||
| with a notice of your violation, and you cease all violation of this license no | ||
| later than 30 days after you receive that notice, your licenses will be | ||
| reinstated retroactively. However, if you violate these terms after such | ||
| reinstatement, any additional violation of these terms will cause your licenses | ||
| to terminate automatically and permanently. | ||
| ## No Liability | ||
| _As far as the law allows, the software comes as is, without any warranty or | ||
| condition, and the licensor will not be liable to you for any damages arising | ||
| out of these terms or the use or nature of the software, under any kind of | ||
| legal claim._ | ||
| ## Definitions | ||
| The **licensor** is the entity offering these terms, and the **software** is the | ||
| software the licensor makes available under these terms, including any portion | ||
| of it. | ||
| **you** refers to the individual or entity agreeing to these terms. | ||
| **your company** is any legal entity, sole proprietorship, or other kind of | ||
| organization that you work for, plus all organizations that have control over, | ||
| are under the control of, or are under common control with that | ||
| organization. **control** means ownership of substantially all the assets of an | ||
| entity, or the power to direct its management and policies by vote, contract, or | ||
| otherwise. Control can be direct or indirect. | ||
| **your licenses** are all the licenses granted to you for the software under | ||
| these terms. | ||
| **use** means anything you do with the software requiring one of your licenses. | ||
| **trademark** means trademarks, service marks, and similar rights. |
+4
-3
| { | ||
| "name": "@mintlify/assistant-web", | ||
| "version": "0.0.7", | ||
| "version": "0.0.8", | ||
| "description": "Browser SDK and direct-mount boundary for Mintlify Assistant", | ||
@@ -50,3 +50,3 @@ "type": "module", | ||
| "dependencies": { | ||
| "@mintlify/assistant-core": "workspace:*", | ||
| "@mintlify/assistant-core": "0.0.6", | ||
| "cnfast": "^0.0.8", | ||
@@ -75,3 +75,4 @@ "react": "19.2.3", | ||
| "vitest": "2.1.9" | ||
| } | ||
| }, | ||
| "gitHead": "4bd77aa7ddc5f1659152773dfe66105002a528a7" | ||
| } |
| import type { ResourceScope } from './resource-scope.js'; | ||
| import type { AskAssistantOptions, AssistantClient, AssistantMountSnapshot } from './types.js'; | ||
| export type AssistantRendererHandle = Readonly<{ | ||
| update: (snapshot: AssistantMountSnapshot) => void; | ||
| focus: () => void; | ||
| destroy: () => void; | ||
| }>; | ||
| export type AssistantRenderer = Readonly<{ | ||
| mount: (options: { | ||
| client: AssistantClient; | ||
| root: ShadowRoot; | ||
| scope: ResourceScope; | ||
| snapshot: AssistantMountSnapshot; | ||
| styleNonce?: string; | ||
| actions: { | ||
| open: () => void; | ||
| close: () => void; | ||
| ask: (content: string, options?: AskAssistantOptions) => Promise<void>; | ||
| }; | ||
| }) => AssistantRendererHandle; | ||
| }>; | ||
| export declare const maintainedAssistantRenderer: AssistantRenderer; | ||
| //# sourceMappingURL=assistant-renderer.d.ts.map |
| {"version":3,"file":"assistant-renderer.d.ts","sourceRoot":"","sources":["../src/assistant-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAG/F,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,MAAM,EAAE,CAAC,QAAQ,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACnD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,KAAK,EAAE,CAAC,OAAO,EAAE;QACf,MAAM,EAAE,eAAe,CAAC;QACxB,IAAI,EAAE,UAAU,CAAC;QACjB,KAAK,EAAE,aAAa,CAAC;QACrB,QAAQ,EAAE,sBAAsB,CAAC;QACjC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,KAAK,EAAE,MAAM,IAAI,CAAC;YAClB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;SACxE,CAAC;KACH,KAAK,uBAAuB,CAAC;CAC/B,CAAC,CAAC;AAEH,eAAO,MAAM,2BAA2B,EAAE,iBAUzC,CAAC"} |
| import { mountAssistantWidget } from './ui/mount-assistant-widget.js'; | ||
| export const maintainedAssistantRenderer = { | ||
| mount({ actions, client, root, snapshot, styleNonce }) { | ||
| return mountAssistantWidget({ | ||
| actions, | ||
| client, | ||
| root, | ||
| snapshot, | ||
| styleNonce, | ||
| }); | ||
| }, | ||
| }; | ||
| //# sourceMappingURL=assistant-renderer.js.map |
| {"version":3,"file":"assistant-renderer.js","sourceRoot":"","sources":["../src/assistant-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAuBtE,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE;QACnD,OAAO,oBAAoB,CAAC;YAC1B,OAAO;YACP,MAAM;YACN,IAAI;YACJ,QAAQ;YACR,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF,CAAC"} |
| import type { AssistantTheme, AssistantTokens } from './types.js'; | ||
| export declare const ASSISTANT_BASE_STYLES = "\n:host {\n all: initial !important;\n --mintlify-assistant-z-index: 2147483000;\n color-scheme: light;\n display: block !important;\n font-family:\n var(--mintlify-assistant-font-family, ui-sans-serif), system-ui, sans-serif !important;\n font-size: 16px !important;\n font-style: normal !important;\n font-weight: 400 !important;\n line-height: 1.5 !important;\n position: fixed !important;\n inset: auto 0 0 auto !important;\n isolation: isolate !important;\n text-align: start !important;\n z-index: var(--mintlify-assistant-z-index) !important;\n}\n\n:host([data-theme='dark']) {\n color-scheme: dark;\n}\n\n@media (prefers-color-scheme: dark) {\n :host([data-theme='system']) {\n color-scheme: dark;\n }\n}\n\n:where(*, *::before, *::after) {\n box-sizing: border-box;\n}\n\n:where(button, input, textarea, select) {\n color: inherit;\n font: inherit;\n}\n\n:where(a) {\n color: inherit;\n}\n"; | ||
| export declare function applyAssistantTheme(host: HTMLElement, theme: AssistantTheme): void; | ||
| export declare function applyAssistantTokens(host: HTMLElement, tokens: AssistantTokens): void; | ||
| //# sourceMappingURL=assistant-styles.d.ts.map |
| {"version":3,"file":"assistant-styles.d.ts","sourceRoot":"","sources":["../src/assistant-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlE,eAAO,MAAM,qBAAqB,k6BAyCjC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAElF;AAiBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAQrF"} |
| const TOKEN_PROPERTIES = { | ||
| accentColor: '--mintlify-assistant-accent-color', | ||
| backgroundColor: '--mintlify-assistant-background-color', | ||
| foregroundColor: '--mintlify-assistant-foreground-color', | ||
| borderColor: '--mintlify-assistant-border-color', | ||
| borderRadius: '--mintlify-assistant-border-radius', | ||
| fontFamily: '--mintlify-assistant-font-family', | ||
| }; | ||
| export const ASSISTANT_BASE_STYLES = ` | ||
| :host { | ||
| all: initial !important; | ||
| --mintlify-assistant-z-index: 2147483000; | ||
| color-scheme: light; | ||
| display: block !important; | ||
| font-family: | ||
| var(--mintlify-assistant-font-family, ui-sans-serif), system-ui, sans-serif !important; | ||
| font-size: 16px !important; | ||
| font-style: normal !important; | ||
| font-weight: 400 !important; | ||
| line-height: 1.5 !important; | ||
| position: fixed !important; | ||
| inset: auto 0 0 auto !important; | ||
| isolation: isolate !important; | ||
| text-align: start !important; | ||
| z-index: var(--mintlify-assistant-z-index) !important; | ||
| } | ||
| :host([data-theme='dark']) { | ||
| color-scheme: dark; | ||
| } | ||
| @media (prefers-color-scheme: dark) { | ||
| :host([data-theme='system']) { | ||
| color-scheme: dark; | ||
| } | ||
| } | ||
| :where(*, *::before, *::after) { | ||
| box-sizing: border-box; | ||
| } | ||
| :where(button, input, textarea, select) { | ||
| color: inherit; | ||
| font: inherit; | ||
| } | ||
| :where(a) { | ||
| color: inherit; | ||
| } | ||
| `; | ||
| export function applyAssistantTheme(host, theme) { | ||
| host.dataset.theme = theme; | ||
| } | ||
| function applyToken(host, property, value) { | ||
| // Undefined fields are omitted patches; null explicitly restores the base token. | ||
| if (value === undefined) | ||
| return; | ||
| if (value === null) { | ||
| host.style.removeProperty(property); | ||
| return; | ||
| } | ||
| host.style.setProperty(property, String(value)); | ||
| } | ||
| export function applyAssistantTokens(host, tokens) { | ||
| applyToken(host, TOKEN_PROPERTIES.accentColor, tokens.accentColor); | ||
| applyToken(host, TOKEN_PROPERTIES.backgroundColor, tokens.backgroundColor); | ||
| applyToken(host, TOKEN_PROPERTIES.foregroundColor, tokens.foregroundColor); | ||
| applyToken(host, TOKEN_PROPERTIES.borderColor, tokens.borderColor); | ||
| applyToken(host, TOKEN_PROPERTIES.borderRadius, tokens.borderRadius); | ||
| applyToken(host, TOKEN_PROPERTIES.fontFamily, tokens.fontFamily); | ||
| applyToken(host, '--mintlify-assistant-z-index', tokens.zIndex); | ||
| } | ||
| //# sourceMappingURL=assistant-styles.js.map |
| {"version":3,"file":"assistant-styles.js","sourceRoot":"","sources":["../src/assistant-styles.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG;IACvB,WAAW,EAAE,mCAAmC;IAChD,eAAe,EAAE,uCAAuC;IACxD,eAAe,EAAE,uCAAuC;IACxD,WAAW,EAAE,mCAAmC;IAChD,YAAY,EAAE,oCAAoC;IAClD,UAAU,EAAE,kCAAkC;CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCpC,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,IAAiB,EAAE,KAAqB;IAC1E,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC7B,CAAC;AAED,SAAS,UAAU,CACjB,IAAiB,EACjB,QAAgB,EAChB,KAAyC;IAEzC,iFAAiF;IACjF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAiB,EAAE,MAAuB;IAC7E,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3E,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3E,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IACrE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACjE,UAAU,CAAC,IAAI,EAAE,8BAA8B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC"} |
| import type { AssistantTheme, AssistantTokens } from './types.js'; | ||
| export declare function applyAssistantTheme(host: HTMLElement, theme: AssistantTheme): void; | ||
| export declare function applyAssistantTokens(host: HTMLElement, tokens: AssistantTokens): void; | ||
| //# sourceMappingURL=assistant-theme.d.ts.map |
| {"version":3,"file":"assistant-theme.d.ts","sourceRoot":"","sources":["../src/assistant-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAElF;AAiBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAQrF"} |
| const TOKEN_PROPERTIES = { | ||
| accentColor: '--mintlify-assistant-accent-color', | ||
| backgroundColor: '--mintlify-assistant-background-color', | ||
| foregroundColor: '--mintlify-assistant-foreground-color', | ||
| borderColor: '--mintlify-assistant-border-color', | ||
| borderRadius: '--mintlify-assistant-border-radius', | ||
| fontFamily: '--mintlify-assistant-font-family', | ||
| }; | ||
| export function applyAssistantTheme(host, theme) { | ||
| host.dataset.theme = theme; | ||
| } | ||
| function applyToken(host, property, value) { | ||
| // Undefined fields are omitted patches; null explicitly restores the base token. | ||
| if (value === undefined) | ||
| return; | ||
| if (value === null) { | ||
| host.style.removeProperty(property); | ||
| return; | ||
| } | ||
| host.style.setProperty(property, String(value)); | ||
| } | ||
| export function applyAssistantTokens(host, tokens) { | ||
| applyToken(host, TOKEN_PROPERTIES.accentColor, tokens.accentColor); | ||
| applyToken(host, TOKEN_PROPERTIES.backgroundColor, tokens.backgroundColor); | ||
| applyToken(host, TOKEN_PROPERTIES.foregroundColor, tokens.foregroundColor); | ||
| applyToken(host, TOKEN_PROPERTIES.borderColor, tokens.borderColor); | ||
| applyToken(host, TOKEN_PROPERTIES.borderRadius, tokens.borderRadius); | ||
| applyToken(host, TOKEN_PROPERTIES.fontFamily, tokens.fontFamily); | ||
| applyToken(host, '--mintlify-assistant-z-index', tokens.zIndex); | ||
| } | ||
| //# sourceMappingURL=assistant-theme.js.map |
| {"version":3,"file":"assistant-theme.js","sourceRoot":"","sources":["../src/assistant-theme.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG;IACvB,WAAW,EAAE,mCAAmC;IAChD,eAAe,EAAE,uCAAuC;IACxD,eAAe,EAAE,uCAAuC;IACxD,WAAW,EAAE,mCAAmC;IAChD,YAAY,EAAE,oCAAoC;IAClD,UAAU,EAAE,kCAAkC;CAC/C,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,IAAiB,EAAE,KAAqB;IAC1E,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC7B,CAAC;AAED,SAAS,UAAU,CACjB,IAAiB,EACjB,QAAgB,EAChB,KAAyC;IAEzC,iFAAiF;IACjF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAiB,EAAE,MAAuB;IAC7E,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3E,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3E,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IACrE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACjE,UAAU,CAAC,IAAI,EAAE,8BAA8B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC"} |
| import type { AssistantTransport } from '@mintlify/assistant-core'; | ||
| import type { AssistantBrowserSessionProvider } from './types.js'; | ||
| export type CreateAssistantBrowserTransportSettings = Readonly<{ | ||
| widgetId: string; | ||
| sessionProvider?: AssistantBrowserSessionProvider; | ||
| scriptNonce?: string; | ||
| }>; | ||
| export declare function createAssistantBrowserTransport(settings: CreateAssistantBrowserTransportSettings): AssistantTransport; | ||
| //# sourceMappingURL=browser-transport.d.ts.map |
| {"version":3,"file":"browser-transport.d.ts","sourceRoot":"","sources":["../../src/browser/browser-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAIlE,MAAM,MAAM,uCAAuC,GAAG,QAAQ,CAAC;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,+BAA+B,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,uCAAuC,GAChD,kBAAkB,CAMpB"} |
| import { ASSISTANT_WIDGET_API_URL } from './constants.js'; | ||
| import { validateAssistantWidgetId } from './validation.js'; | ||
| import { createAssistantWidgetTransport } from './widget-transport.js'; | ||
| export function createAssistantBrowserTransport(settings) { | ||
| return createAssistantWidgetTransport({ | ||
| apiUrl: ASSISTANT_WIDGET_API_URL, | ||
| fetch: window.fetch.bind(window), | ||
| settings: Object.assign(Object.assign({}, settings), { widgetId: validateAssistantWidgetId(settings.widgetId) }), | ||
| }).transport; | ||
| } | ||
| //# sourceMappingURL=browser-transport.js.map |
| {"version":3,"file":"browser-transport.js","sourceRoot":"","sources":["../../src/browser/browser-transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAQvE,MAAM,UAAU,+BAA+B,CAC7C,QAAiD;IAEjD,OAAO,8BAA8B,CAAC;QACpC,MAAM,EAAE,wBAAwB;QAChC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,QAAQ,kCAAO,QAAQ,KAAE,QAAQ,EAAE,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAE;KAClF,CAAC,CAAC,SAAS,CAAC;AACf,CAAC"} |
| import type { AssistantBrowserCaptchaConfig } from './types.js'; | ||
| type CaptchaPayload = Readonly<{ | ||
| trustToken: string; | ||
| captchaToken?: string; | ||
| }>; | ||
| type TurnstileApi = Readonly<{ | ||
| render: (container: string | HTMLElement, params: Record<string, unknown>) => string; | ||
| reset: (widgetId: string) => void; | ||
| getResponse: (widgetId: string) => string | undefined; | ||
| remove: (widgetId: string) => void; | ||
| }>; | ||
| type HCaptchaApi = Readonly<{ | ||
| render: (container: string | HTMLElement, params: Record<string, unknown>) => string; | ||
| reset: (widgetId: string) => void; | ||
| execute: (widgetId: string, options?: { | ||
| async: boolean; | ||
| }) => Promise<{ | ||
| response: string; | ||
| }>; | ||
| remove: (widgetId: string) => void; | ||
| }>; | ||
| declare global { | ||
| interface Window { | ||
| turnstile?: TurnstileApi; | ||
| hcaptcha?: HCaptchaApi; | ||
| } | ||
| } | ||
| export type AssistantCaptcha = Readonly<{ | ||
| prepare: (config: AssistantBrowserCaptchaConfig) => Promise<CaptchaPayload>; | ||
| reset: () => void; | ||
| destroy: () => void; | ||
| }>; | ||
| export declare function createAssistantCaptcha(options: { | ||
| window: Window; | ||
| document: Document; | ||
| nonce?: string; | ||
| }): AssistantCaptcha; | ||
| export {}; | ||
| //# sourceMappingURL=captcha.d.ts.map |
| {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../src/browser/captcha.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAIhE,KAAK,cAAc,GAAG,QAAQ,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,YAA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CACrB,CAAC,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,gBAAgB,CAyGnB"} |
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| import { AssistantTransportError } from '@mintlify/assistant-core'; | ||
| const SCRIPT_LOAD_TIMEOUT_MS = 15000; | ||
| const SCRIPT_URLS = { | ||
| turnstile: 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit', | ||
| hcaptcha: 'https://js.hcaptcha.com/1/api.js?render=explicit', | ||
| }; | ||
| const SOLVE_TIMEOUT_MS = { | ||
| turnstile: 15000, | ||
| hcaptcha: 60000, | ||
| }; | ||
| const scriptCache = new Map(); | ||
| function getScriptError(provider) { | ||
| const host = provider === 'turnstile' ? 'https://challenges.cloudflare.com' : 'https://js.hcaptcha.com'; | ||
| return new AssistantTransportError({ | ||
| message: `Mintlify Assistant could not load ${provider} verification. Allow ${host} in script-src and frame-src.`, | ||
| unavailableType: 'captcha_required', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| function hasCaptchaApi(ownerWindow, provider) { | ||
| return provider === 'turnstile' | ||
| ? ownerWindow.turnstile !== undefined | ||
| : ownerWindow.hcaptcha !== undefined; | ||
| } | ||
| function loadCaptchaScript(ownerWindow, ownerDocument, provider, nonce) { | ||
| if (hasCaptchaApi(ownerWindow, provider)) | ||
| return Promise.resolve(); | ||
| const source = SCRIPT_URLS[provider]; | ||
| const cached = scriptCache.get(source); | ||
| if (cached) | ||
| return cached; | ||
| const promise = new Promise((resolve, reject) => { | ||
| const timeout = ownerWindow.setTimeout(() => reject(getScriptError(provider)), SCRIPT_LOAD_TIMEOUT_MS); | ||
| const finish = () => { | ||
| ownerWindow.clearTimeout(timeout); | ||
| if (hasCaptchaApi(ownerWindow, provider)) | ||
| resolve(); | ||
| else | ||
| reject(getScriptError(provider)); | ||
| }; | ||
| const script = ownerDocument.createElement('script'); | ||
| script.src = source; | ||
| script.async = true; | ||
| if (nonce) | ||
| script.nonce = nonce; | ||
| script.addEventListener('load', finish, { once: true }); | ||
| script.addEventListener('error', () => { | ||
| ownerWindow.clearTimeout(timeout); | ||
| reject(getScriptError(provider)); | ||
| }, { once: true }); | ||
| ownerDocument.head.append(script); | ||
| }); | ||
| void promise.catch(() => scriptCache.delete(source)); | ||
| scriptCache.set(source, promise); | ||
| return promise; | ||
| } | ||
| function pollForResponse(ownerWindow, getResponse, timeout) { | ||
| return new Promise((resolve) => { | ||
| const deadline = Date.now() + timeout; | ||
| const check = () => { | ||
| const response = getResponse(); | ||
| if (response || Date.now() >= deadline) { | ||
| resolve(response); | ||
| return; | ||
| } | ||
| ownerWindow.setTimeout(check, 200); | ||
| }; | ||
| check(); | ||
| }); | ||
| } | ||
| export function createAssistantCaptcha(options) { | ||
| let activeProvider; | ||
| let activeSiteKey; | ||
| let container; | ||
| let widgetId; | ||
| let solvedToken; | ||
| const removeWidget = () => { | ||
| var _a, _b; | ||
| if (widgetId && activeProvider) { | ||
| try { | ||
| if (activeProvider === 'turnstile') | ||
| (_a = options.window.turnstile) === null || _a === void 0 ? void 0 : _a.remove(widgetId); | ||
| else | ||
| (_b = options.window.hcaptcha) === null || _b === void 0 ? void 0 : _b.remove(widgetId); | ||
| } | ||
| catch (_c) { | ||
| // Provider cleanup failures cannot prevent local teardown. | ||
| } | ||
| } | ||
| widgetId = undefined; | ||
| activeProvider = undefined; | ||
| activeSiteKey = undefined; | ||
| solvedToken = undefined; | ||
| }; | ||
| const reset = () => { | ||
| var _a, _b; | ||
| if (widgetId && activeProvider) { | ||
| try { | ||
| if (activeProvider === 'turnstile') | ||
| (_a = options.window.turnstile) === null || _a === void 0 ? void 0 : _a.reset(widgetId); | ||
| else | ||
| (_b = options.window.hcaptcha) === null || _b === void 0 ? void 0 : _b.reset(widgetId); | ||
| } | ||
| catch (_c) { | ||
| // A fresh render on the next request remains available as a fallback. | ||
| removeWidget(); | ||
| } | ||
| } | ||
| solvedToken = undefined; | ||
| }; | ||
| const ensureWidget = (provider, siteKey) => __awaiter(this, void 0, void 0, function* () { | ||
| var _a, _b; | ||
| if (widgetId && activeProvider === provider && activeSiteKey === siteKey) | ||
| return widgetId; | ||
| removeWidget(); | ||
| yield loadCaptchaScript(options.window, options.document, provider, options.nonce); | ||
| container !== null && container !== void 0 ? container : (container = options.document.createElement('div')); | ||
| container.dataset.mintlifyAssistantCaptcha = ''; | ||
| container.style.cssText = | ||
| 'position:absolute;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;'; | ||
| if (!container.isConnected) | ||
| options.document.body.append(container); | ||
| container.replaceChildren(); | ||
| const params = { sitekey: siteKey, size: 'invisible' }; | ||
| if (provider === 'turnstile') | ||
| params.execution = 'render'; | ||
| const renderedId = provider === 'turnstile' | ||
| ? (_a = options.window.turnstile) === null || _a === void 0 ? void 0 : _a.render(container, params) | ||
| : (_b = options.window.hcaptcha) === null || _b === void 0 ? void 0 : _b.render(container, params); | ||
| if (!renderedId) | ||
| throw getScriptError(provider); | ||
| widgetId = renderedId; | ||
| activeProvider = provider; | ||
| activeSiteKey = siteKey; | ||
| return renderedId; | ||
| }); | ||
| const solve = (provider, renderedId) => __awaiter(this, void 0, void 0, function* () { | ||
| var _a; | ||
| let token; | ||
| if (provider === 'turnstile') { | ||
| token = yield pollForResponse(options.window, () => { var _a; return (_a = options.window.turnstile) === null || _a === void 0 ? void 0 : _a.getResponse(renderedId); }, SOLVE_TIMEOUT_MS.turnstile); | ||
| } | ||
| else { | ||
| try { | ||
| const result = yield ((_a = options.window.hcaptcha) === null || _a === void 0 ? void 0 : _a.execute(renderedId, { async: true })); | ||
| token = result === null || result === void 0 ? void 0 : result.response; | ||
| } | ||
| catch (_b) { | ||
| token = undefined; | ||
| } | ||
| } | ||
| if (!token) { | ||
| throw new AssistantTransportError({ | ||
| message: `Mintlify Assistant could not complete ${provider} verification. Check script-src, frame-src, and network access for the captcha provider.`, | ||
| unavailableType: 'captcha_required', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| solvedToken = token; | ||
| return token; | ||
| }); | ||
| return { | ||
| prepare(config) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| if (!config.provider || !config.siteKey) | ||
| return { trustToken: config.trustToken }; | ||
| // Provider response tokens are single-use. Reset a previously solved widget before preparing | ||
| // the next request instead of relying on the token's expiry window. | ||
| if (solvedToken) | ||
| reset(); | ||
| const renderedId = yield ensureWidget(config.provider, config.siteKey); | ||
| return { | ||
| trustToken: config.trustToken, | ||
| captchaToken: yield solve(config.provider, renderedId), | ||
| }; | ||
| }); | ||
| }, | ||
| reset, | ||
| destroy() { | ||
| removeWidget(); | ||
| container === null || container === void 0 ? void 0 : container.remove(); | ||
| container = undefined; | ||
| }, | ||
| }; | ||
| } | ||
| //# sourceMappingURL=captcha.js.map |
| {"version":3,"file":"captcha.js","sourceRoot":"","sources":["../../src/browser/captcha.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAgCnE,MAAM,sBAAsB,GAAG,KAAM,CAAC;AACtC,MAAM,WAAW,GAAoC;IACnD,SAAS,EAAE,uEAAuE;IAClF,QAAQ,EAAE,kDAAkD;CAC7D,CAAC;AACF,MAAM,gBAAgB,GAAoC;IACxD,SAAS,EAAE,KAAM;IACjB,QAAQ,EAAE,KAAM;CACjB,CAAC;AACF,MA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C;gBAClF,6FAA6F;gBAC7F,oEAAoE;gBACpE,IAAI,WAAW;oBAAE,KAAK,EAAE,CAAC;gBACzB,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBACvE,OAAO;oBACL,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,YAAY,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;iBACvD,CAAC;YACJ,CAAC;SAAA;QACD,KAAK;QACL,OAAO;YACL,YAAY,EAAE,CAAC;YACf,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,EAAE,CAAC;YACpB,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"} |
| import type { AssistantStorageAdapter } from '@mintlify/assistant-core'; | ||
| export declare function createAssistantContinuationStorage(storage: Storage, widgetId: string, getContinuationScope: () => string): AssistantStorageAdapter; | ||
| export declare function createAssistantBrowserContinuationStorage(ownerWindow: Window, widgetId: string, getContinuationScope: () => string): AssistantStorageAdapter; | ||
| //# sourceMappingURL=continuation-storage.d.ts.map |
| {"version":3,"file":"continuation-storage.d.ts","sourceRoot":"","sources":["../../src/browser/continuation-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAoB/F,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,MAAM,GACjC,uBAAuB,CAczB;AAED,wBAAgB,yCAAyC,CACvD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,MAAM,GACjC,uBAAuB,CAuBzB"} |
| function isRecord(value) { | ||
| return typeof value === 'object' && value !== null; | ||
| } | ||
| function parseContinuation(value) { | ||
| if (!value) | ||
| return undefined; | ||
| try { | ||
| const parsed = JSON.parse(value); | ||
| if (!isRecord(parsed)) | ||
| return undefined; | ||
| const threadId = typeof parsed.threadId === 'string' ? parsed.threadId : undefined; | ||
| const threadKey = typeof parsed.threadKey === 'string' ? parsed.threadKey : undefined; | ||
| if (!threadId && !threadKey) | ||
| return undefined; | ||
| return { threadId, threadKey }; | ||
| } | ||
| catch (_a) { | ||
| return undefined; | ||
| } | ||
| } | ||
| export function createAssistantContinuationStorage(storage, widgetId, getContinuationScope) { | ||
| const getKey = () => `mintlify-assistant:${widgetId}:${encodeURIComponent(getContinuationScope())}:continuation`; | ||
| return { | ||
| loadContinuation() { | ||
| return parseContinuation(storage.getItem(getKey())); | ||
| }, | ||
| saveContinuation(continuation) { | ||
| storage.setItem(getKey(), JSON.stringify(continuation)); | ||
| }, | ||
| clearContinuation() { | ||
| storage.removeItem(getKey()); | ||
| }, | ||
| }; | ||
| } | ||
| export function createAssistantBrowserContinuationStorage(ownerWindow, widgetId, getContinuationScope) { | ||
| try { | ||
| const storage = ownerWindow.sessionStorage; | ||
| const legacyKey = `mintlify-assistant:${widgetId}:continuation`; | ||
| storage.getItem(legacyKey); | ||
| storage.removeItem(legacyKey); | ||
| return createAssistantContinuationStorage(storage, widgetId, getContinuationScope); | ||
| } | ||
| catch (_a) { | ||
| let continuation; | ||
| let continuationScope = getContinuationScope(); | ||
| return { | ||
| loadContinuation() { | ||
| return continuationScope === getContinuationScope() ? continuation : undefined; | ||
| }, | ||
| saveContinuation(nextContinuation) { | ||
| continuationScope = getContinuationScope(); | ||
| continuation = Object.assign({}, nextContinuation); | ||
| }, | ||
| clearContinuation() { | ||
| if (continuationScope === getContinuationScope()) | ||
| continuation = undefined; | ||
| }, | ||
| }; | ||
| } | ||
| } | ||
| //# sourceMappingURL=continuation-storage.js.map |
| {"version":3,"file":"continuation-storage.js","sourceRoot":"","sources":["../../src/browser/continuation-storage.ts"],"names":[],"mappings":"AAEA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAA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AC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yCAAyC,CACvD,WAAmB,EACnB,QAAgB,EAChB,oBAAkC;IAElC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,WAAW,CAAC,cAAc,CAAC;QAC3C,MAAM,SAAS,GAAG,sBAAsB,QAAQ,eAAe,CAAC;QAChE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC3B,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC9B,OAAO,kCAAkC,CAAC,OAAO,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACrF,CAAC;IAAC,WAAM,CAAC;QACP,IAAI,YAA+C,CAAC;QACpD,IAAI,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;QAC/C,OAAO;YACL,gBAAgB;gBACd,OAAO,iBAAiB,KAAK,oBAAoB,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC;YACD,gBAAgB,CAAC,gBAAgB;gBAC/B,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;gBAC3C,YAAY,qBAAQ,gBAAgB,CAAE,CAAC;YACzC,CAAC;YACD,iBAAiB;gBACf,IAAI,iBAAiB,KAAK,oBAAoB,EAAE;oBAAE,YAAY,GAAG,SAAS,CAAC;YAC7E,CAAC;SACF,CAAC;IACJ,CAAC;AACH,CAAC"} |
| export {}; | ||
| //# sourceMappingURL=loader-entry.d.ts.map |
| {"version":3,"file":"loader-entry.d.ts","sourceRoot":"","sources":["../../src/browser/loader-entry.ts"],"names":[],"mappings":""} |
| import { installAssistantLoader } from './loader.js'; | ||
| installAssistantLoader({ | ||
| window, | ||
| loadRuntime: () => import('./runtime.js'), | ||
| }); | ||
| //# sourceMappingURL=loader-entry.js.map |
| {"version":3,"file":"loader-entry.js","sourceRoot":"","sources":["../../src/browser/loader-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,sBAAsB,CAAC;IACrB,MAAM;IACN,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;CAC1C,CAAC,CAAC"} |
| import { type AssistantBrowserApi, type AssistantBrowserRuntimeModule } from './types.js'; | ||
| export type InstallAssistantLoaderOptions = Readonly<{ | ||
| window: Window; | ||
| loadRuntime: () => Promise<AssistantBrowserRuntimeModule>; | ||
| }>; | ||
| export declare function installAssistantLoader(options: InstallAssistantLoaderOptions): AssistantBrowserApi; | ||
| //# sourceMappingURL=loader.d.ts.map |
| {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/browser/loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EAMxB,KAAK,6BAA6B,EAGnC,MAAM,YAAY,CAAC;AA6CpB,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC3D,CAAC,CAAC;AA0hBH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,6BAA6B,GACrC,mBAAmB,CAiBrB"} |
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| import { ASSISTANT_CUSTOM_TRIGGER_ENTRY_POINT } from './constants.js'; | ||
| import { AssistantBrowserError, } from './types.js'; | ||
| import { validateAssistantWidgetId } from './validation.js'; | ||
| const RUNTIME_LOAD_MESSAGE = 'Mintlify Assistant could not load its browser runtime. Allow https://cdn.mintlify.com in script-src and try again.'; | ||
| function createReadyPromise() { | ||
| let resolvePromise = () => { }; | ||
| let rejectPromise = (_error) => { }; | ||
| const promise = new Promise((resolve, reject) => { | ||
| resolvePromise = resolve; | ||
| rejectPromise = reject; | ||
| }); | ||
| return { promise, resolve: resolvePromise, reject: rejectPromise }; | ||
| } | ||
| function validateSettings(settings) { | ||
| if (!settings || typeof settings.widgetId !== 'string') { | ||
| throw new AssistantBrowserError({ | ||
| code: 'INVALID_CONFIGURATION', | ||
| message: 'MintlifyAssistantSettings.widgetId must be a non-empty public Widget ID before loading https://cdn.mintlify.com/assistant/v1.js.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| if (settings.identityToken !== undefined && settings.identityToken.trim().length === 0) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'INVALID_CONFIGURATION', | ||
| message: 'MintlifyAssistantSettings.identityToken must be non-empty when provided.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| return Object.assign(Object.assign({}, settings), { widgetId: validateAssistantWidgetId(settings.widgetId) }); | ||
| } | ||
| function normalizeLoadError(error) { | ||
| if (error instanceof AssistantBrowserError) | ||
| return error; | ||
| return new AssistantBrowserError({ | ||
| code: 'RUNTIME_LOAD_FAILED', | ||
| message: RUNTIME_LOAD_MESSAGE, | ||
| retryable: true, | ||
| cause: error, | ||
| }); | ||
| } | ||
| function isAssistantBrowserApi(api) { | ||
| return 'init' in api && typeof api.init === 'function'; | ||
| } | ||
| function isRecord(value) { | ||
| return typeof value === 'object' && value !== null; | ||
| } | ||
| function isPreloadMethod(value) { | ||
| return (value === 'ready' || | ||
| value === 'open' || | ||
| value === 'close' || | ||
| value === 'focus' || | ||
| value === 'ask' || | ||
| value === 'update' || | ||
| value === 'newThread' || | ||
| value === 'destroy'); | ||
| } | ||
| function hasValidPreloadArgs(method, args) { | ||
| if (method === 'ready' || | ||
| method === 'close' || | ||
| method === 'focus' || | ||
| method === 'newThread' || | ||
| method === 'destroy') { | ||
| return args.length === 0; | ||
| } | ||
| if (method === 'open') { | ||
| return args.length <= 1 && (args[0] === undefined || isRecord(args[0])); | ||
| } | ||
| if (method === 'ask') { | ||
| return (args.length >= 1 && | ||
| args.length <= 2 && | ||
| typeof args[0] === 'string' && | ||
| (args[1] === undefined || isRecord(args[1]))); | ||
| } | ||
| return args.length === 1 && isRecord(args[0]); | ||
| } | ||
| function getPreloadCommand(value) { | ||
| if (!isRecord(value) || | ||
| !isPreloadMethod(value.method) || | ||
| !Array.isArray(value.args) || | ||
| !hasValidPreloadArgs(value.method, value.args) || | ||
| typeof value.resolve !== 'function' || | ||
| typeof value.reject !== 'function') { | ||
| return undefined; | ||
| } | ||
| const resolve = value.resolve; | ||
| const reject = value.reject; | ||
| return { | ||
| method: value.method, | ||
| args: value.args, | ||
| resolve(result) { | ||
| Reflect.apply(resolve, undefined, [result]); | ||
| }, | ||
| reject(error) { | ||
| Reflect.apply(reject, undefined, [error]); | ||
| }, | ||
| }; | ||
| } | ||
| function rejectMalformedPreloadCommand(value, settings) { | ||
| var _a; | ||
| const error = new AssistantBrowserError({ | ||
| code: 'INVALID_CONFIGURATION', | ||
| message: 'Mintlify Assistant ignored a malformed preload queue command.', | ||
| retryable: false, | ||
| }); | ||
| if (isRecord(value) && typeof value.reject === 'function') { | ||
| try { | ||
| value.reject(error); | ||
| } | ||
| catch (_b) { | ||
| // A malformed queue cannot interrupt initialization. | ||
| } | ||
| } | ||
| try { | ||
| (_a = settings === null || settings === void 0 ? void 0 : settings.onError) === null || _a === void 0 ? void 0 : _a.call(settings, error); | ||
| } | ||
| catch (_c) { | ||
| // Customer error observers must not interrupt initialization. | ||
| } | ||
| } | ||
| function getOpenOptions(value) { | ||
| if (!isRecord(value)) | ||
| return undefined; | ||
| return { | ||
| entryPoint: typeof value.entryPoint === 'string' ? value.entryPoint : undefined, | ||
| focus: typeof value.focus === 'boolean' ? value.focus : undefined, | ||
| }; | ||
| } | ||
| function normalizeEntryPoint(entryPoint) { | ||
| var _a; | ||
| const normalized = (_a = entryPoint === null || entryPoint === void 0 ? void 0 : entryPoint.trim()) !== null && _a !== void 0 ? _a : ASSISTANT_CUSTOM_TRIGGER_ENTRY_POINT; | ||
| if (normalized.length === 0 || normalized.length > 100) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'INVALID_CONFIGURATION', | ||
| message: 'Assistant entryPoint must contain between 1 and 100 characters.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| return normalized; | ||
| } | ||
| function getContextItem(value) { | ||
| if (!isRecord(value) || (value.type !== 'code' && value.type !== 'textSelection')) { | ||
| return undefined; | ||
| } | ||
| if (typeof value.value !== 'string') | ||
| return undefined; | ||
| return { | ||
| type: value.type, | ||
| value: value.value, | ||
| path: typeof value.path === 'string' ? value.path : undefined, | ||
| elementId: typeof value.elementId === 'string' ? value.elementId : undefined, | ||
| }; | ||
| } | ||
| function getContext(value) { | ||
| if (value === null) | ||
| return null; | ||
| if (!isRecord(value)) | ||
| return undefined; | ||
| const items = Array.isArray(value.items) | ||
| ? value.items.flatMap((item) => { | ||
| const parsed = getContextItem(item); | ||
| return parsed ? [parsed] : []; | ||
| }) | ||
| : undefined; | ||
| return { | ||
| items, | ||
| currentPath: typeof value.currentPath === 'string' ? value.currentPath : undefined, | ||
| version: typeof value.version === 'string' ? value.version : undefined, | ||
| language: typeof value.language === 'string' ? value.language : undefined, | ||
| product: typeof value.product === 'string' ? value.product : undefined, | ||
| }; | ||
| } | ||
| function getAskOptions(value) { | ||
| if (!isRecord(value)) | ||
| return undefined; | ||
| return { | ||
| entryPoint: typeof value.entryPoint === 'string' ? value.entryPoint : undefined, | ||
| context: getContext(value.context), | ||
| open: typeof value.open === 'boolean' ? value.open : undefined, | ||
| focus: typeof value.focus === 'boolean' ? value.focus : undefined, | ||
| }; | ||
| } | ||
| function getUpdateOptions(value) { | ||
| if (!isRecord(value)) | ||
| return {}; | ||
| return { | ||
| context: getContext(value.context), | ||
| identityToken: typeof value.identityToken === 'string' || value.identityToken === null | ||
| ? value.identityToken | ||
| : undefined, | ||
| theme: value.theme === 'light' || value.theme === 'dark' || value.theme === 'system' | ||
| ? value.theme | ||
| : undefined, | ||
| launcherVisible: typeof value.launcherVisible === 'boolean' ? value.launcherVisible : undefined, | ||
| }; | ||
| } | ||
| function replayPreloadCommand(api, command) { | ||
| let result; | ||
| if (command.method === 'ready') { | ||
| result = api.ready; | ||
| } | ||
| else if (command.method === 'open') { | ||
| result = api.open(getOpenOptions(command.args[0])); | ||
| } | ||
| else if (command.method === 'close') { | ||
| result = api.close(); | ||
| } | ||
| else if (command.method === 'focus') { | ||
| result = api.focus(); | ||
| } | ||
| else if (command.method === 'ask') { | ||
| result = api.ask(typeof command.args[0] === 'string' ? command.args[0] : '', getAskOptions(command.args[1])); | ||
| } | ||
| else if (command.method === 'update') { | ||
| result = api.update(getUpdateOptions(command.args[0])); | ||
| } | ||
| else if (command.method === 'newThread') { | ||
| result = api.newThread(); | ||
| } | ||
| else { | ||
| result = api.destroy(); | ||
| } | ||
| void result.then(command.resolve, command.reject); | ||
| } | ||
| class MintlifyAssistantLoader { | ||
| constructor(options) { | ||
| this.queue = []; | ||
| this.readyPromise = createReadyPromise(); | ||
| this.state = 'idle'; | ||
| this.targetWindow = options.window; | ||
| this.loadRuntime = options.loadRuntime; | ||
| } | ||
| get ready() { | ||
| return this.readyPromise.promise; | ||
| } | ||
| init(settings) { | ||
| var _a; | ||
| const requestedSettings = settings !== null && settings !== void 0 ? settings : this.targetWindow.MintlifyAssistantSettings; | ||
| if ((this.state === 'loading' || this.state === 'ready') && requestedSettings === undefined) { | ||
| return this.ready; | ||
| } | ||
| let validatedSettings; | ||
| try { | ||
| validatedSettings = validateSettings(requestedSettings); | ||
| } | ||
| catch (error) { | ||
| const normalized = normalizeLoadError(error); | ||
| this.notifyError(normalized, requestedSettings); | ||
| if (this.state === 'idle') { | ||
| this.state = 'failed'; | ||
| this.failure = normalized; | ||
| this.readyPromise.reject(normalized); | ||
| return this.ready; | ||
| } | ||
| return Promise.reject(normalized); | ||
| } | ||
| if (this.state === 'loading' || this.state === 'ready') { | ||
| if (((_a = this.settings) === null || _a === void 0 ? void 0 : _a.widgetId) === validatedSettings.widgetId) | ||
| return this.ready; | ||
| const error = new AssistantBrowserError({ | ||
| code: 'ALREADY_INITIALIZED', | ||
| message: 'Mintlify Assistant is already initialized with another Widget ID. Call destroy() before initializing a different widget.', | ||
| retryable: false, | ||
| }); | ||
| this.notifyError(error, validatedSettings); | ||
| return Promise.reject(error); | ||
| } | ||
| if (this.state === 'failed' || this.state === 'destroyed') { | ||
| this.readyPromise = createReadyPromise(); | ||
| } | ||
| this.state = 'loading'; | ||
| this.failure = undefined; | ||
| this.settings = validatedSettings; | ||
| void this.startRuntime(validatedSettings); | ||
| return this.ready; | ||
| } | ||
| open(options) { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'open', options, resolve, reject }); | ||
| }); | ||
| } | ||
| close() { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'close', resolve, reject }); | ||
| }); | ||
| } | ||
| focus() { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'focus', resolve, reject }); | ||
| }); | ||
| } | ||
| ask(content, options) { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'ask', content, options, resolve, reject }); | ||
| }); | ||
| } | ||
| update(options) { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'update', options, resolve, reject }); | ||
| }); | ||
| } | ||
| newThread() { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'new-thread', resolve, reject }); | ||
| }); | ||
| } | ||
| destroy() { | ||
| return new Promise((resolve, reject) => { | ||
| this.enqueue({ type: 'destroy', resolve, reject }); | ||
| }); | ||
| } | ||
| isCurrentLoad(settings) { | ||
| return this.state === 'loading' && this.settings === settings; | ||
| } | ||
| startRuntime(settings) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| try { | ||
| const module = yield this.loadRuntime(); | ||
| if (!this.isCurrentLoad(settings)) | ||
| return; | ||
| const runtime = yield module.startAssistantBrowserRuntime(settings); | ||
| if (!this.isCurrentLoad(settings)) { | ||
| runtime.destroy(); | ||
| return; | ||
| } | ||
| this.runtime = runtime; | ||
| this.state = 'ready'; | ||
| this.failure = undefined; | ||
| this.readyPromise.resolve(); | ||
| this.emit(Object.assign({ type: 'initialized' }, module.versions)); | ||
| this.drainQueue(runtime); | ||
| } | ||
| catch (error) { | ||
| if (!this.isCurrentLoad(settings)) | ||
| return; | ||
| const normalized = normalizeLoadError(error); | ||
| this.state = 'failed'; | ||
| this.failure = normalized; | ||
| this.readyPromise.reject(normalized); | ||
| this.rejectQueue(normalized); | ||
| this.notifyError(normalized, settings); | ||
| } | ||
| }); | ||
| } | ||
| enqueue(command) { | ||
| var _a; | ||
| if (this.state === 'destroyed') { | ||
| command.reject(new AssistantBrowserError({ | ||
| code: 'DESTROYED', | ||
| message: 'Mintlify Assistant has been destroyed. Call init() before using it again.', | ||
| retryable: false, | ||
| })); | ||
| return; | ||
| } | ||
| if (this.state === 'failed') { | ||
| command.reject((_a = this.failure) !== null && _a !== void 0 ? _a : new AssistantBrowserError({ | ||
| code: 'RUNTIME_LOAD_FAILED', | ||
| message: `${RUNTIME_LOAD_MESSAGE} Call init() to retry.`, | ||
| retryable: true, | ||
| })); | ||
| return; | ||
| } | ||
| const runtime = this.runtime; | ||
| if (this.state === 'ready' && runtime) { | ||
| this.dispatch(runtime, command); | ||
| return; | ||
| } | ||
| this.queue.push(command); | ||
| } | ||
| drainQueue(runtime) { | ||
| while (this.queue.length > 0 && this.runtime === runtime && this.state === 'ready') { | ||
| const command = this.queue.shift(); | ||
| if (!command) | ||
| return; | ||
| this.dispatch(runtime, command); | ||
| } | ||
| } | ||
| dispatch(runtime, command) { | ||
| var _a, _b; | ||
| try { | ||
| if (command.type === 'open') { | ||
| const entryPoint = normalizeEntryPoint((_a = command.options) === null || _a === void 0 ? void 0 : _a.entryPoint); | ||
| runtime.open(Object.assign(Object.assign({}, command.options), { entryPoint })); | ||
| this.emit({ | ||
| type: 'opened', | ||
| surface: 'custom-trigger', | ||
| entryPoint, | ||
| }); | ||
| command.resolve(); | ||
| return; | ||
| } | ||
| if (command.type === 'close') { | ||
| runtime.close(); | ||
| this.emit({ type: 'closed' }); | ||
| command.resolve(); | ||
| return; | ||
| } | ||
| if (command.type === 'focus') { | ||
| runtime.focus(); | ||
| this.emit({ type: 'focused' }); | ||
| command.resolve(); | ||
| return; | ||
| } | ||
| if (command.type === 'ask') { | ||
| const entryPoint = normalizeEntryPoint((_b = command.options) === null || _b === void 0 ? void 0 : _b.entryPoint); | ||
| void runtime.ask(command.content, Object.assign(Object.assign({}, command.options), { entryPoint })).then((snapshot) => { | ||
| this.emit({ | ||
| type: 'asked', | ||
| surface: 'custom-trigger', | ||
| entryPoint, | ||
| }); | ||
| command.resolve(snapshot); | ||
| }, (error) => { | ||
| this.notifyErrorIfSupported(error); | ||
| command.reject(error); | ||
| }); | ||
| return; | ||
| } | ||
| if (command.type === 'update') { | ||
| runtime.update(command.options); | ||
| this.emit({ type: 'updated' }); | ||
| command.resolve(); | ||
| return; | ||
| } | ||
| if (command.type === 'new-thread') { | ||
| const snapshot = runtime.newThread(); | ||
| this.emit({ type: 'new-thread' }); | ||
| command.resolve(snapshot); | ||
| return; | ||
| } | ||
| let destroyError; | ||
| try { | ||
| runtime.destroy(); | ||
| } | ||
| catch (error) { | ||
| destroyError = error; | ||
| } | ||
| this.runtime = undefined; | ||
| this.state = 'destroyed'; | ||
| this.emit({ type: 'destroyed' }); | ||
| this.rejectQueue(new AssistantBrowserError({ | ||
| code: 'DESTROYED', | ||
| message: 'Mintlify Assistant was destroyed before this call could run.', | ||
| retryable: false, | ||
| })); | ||
| if (destroyError) { | ||
| this.notifyErrorIfSupported(destroyError); | ||
| this.settings = undefined; | ||
| command.reject(destroyError); | ||
| } | ||
| else { | ||
| this.settings = undefined; | ||
| command.resolve(); | ||
| } | ||
| } | ||
| catch (error) { | ||
| this.notifyErrorIfSupported(error); | ||
| command.reject(error); | ||
| } | ||
| } | ||
| rejectQueue(error) { | ||
| const queued = this.queue; | ||
| this.queue = []; | ||
| for (const command of queued) | ||
| command.reject(error); | ||
| } | ||
| emit(event) { | ||
| var _a, _b; | ||
| try { | ||
| (_b = (_a = this.settings) === null || _a === void 0 ? void 0 : _a.onEvent) === null || _b === void 0 ? void 0 : _b.call(_a, event); | ||
| } | ||
| catch (_c) { | ||
| // Customer telemetry must not change Assistant lifecycle behavior. | ||
| } | ||
| } | ||
| notifyErrorIfSupported(error) { | ||
| if (error instanceof AssistantBrowserError) | ||
| this.notifyError(error, this.settings); | ||
| } | ||
| notifyError(error, settings) { | ||
| var _a; | ||
| try { | ||
| (_a = settings === null || settings === void 0 ? void 0 : settings.onError) === null || _a === void 0 ? void 0 : _a.call(settings, error); | ||
| } | ||
| catch (_b) { | ||
| // Customer error observers must not mask the original failure. | ||
| } | ||
| } | ||
| } | ||
| export function installAssistantLoader(options) { | ||
| const existing = options.window.MintlifyAssistant; | ||
| if (existing && isAssistantBrowserApi(existing)) { | ||
| void existing.init(options.window.MintlifyAssistantSettings).catch(() => { }); | ||
| return existing; | ||
| } | ||
| const preloadQueue = (existing === null || existing === void 0 ? void 0 : existing.q) ? [...existing.q] : []; | ||
| const api = new MintlifyAssistantLoader(options); | ||
| options.window.MintlifyAssistant = api; | ||
| void api.init().catch(() => { }); | ||
| for (const value of preloadQueue) { | ||
| const command = getPreloadCommand(value); | ||
| if (command) | ||
| replayPreloadCommand(api, command); | ||
| else | ||
| rejectMalformedPreloadCommand(value, options.window.MintlifyAssistantSettings); | ||
| } | ||
| return api; | ||
| } | ||
| //# sourceMappingURL=loader.js.map |
| {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/browser/loader.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AACtE,O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AO,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,OAAO;YAAE,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;;YAC3C,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"} |
| import { type AssistantBrowserRuntime, type AssistantBrowserSettings } from './types.js'; | ||
| export declare const versions: { | ||
| loaderVersion: string; | ||
| coreVersion: string; | ||
| }; | ||
| export declare function startAssistantBrowserRuntime(settings: AssistantBrowserSettings): Promise<AssistantBrowserRuntime>; | ||
| //# sourceMappingURL=runtime.d.ts.map |
| {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/browser/runtime.ts"],"names":[],"mappings":"AAcA,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAsCF,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,wBAAwB,GACjC,OAAO,CAAC,uBAAuB,CAAC,CAyFlC"} |
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| import { ASSISTANT_CORE_API_VERSION, AssistantError, createAssistantCore, } from '@mintlify/assistant-core'; | ||
| import { mountAssistant } from '../mount/mount-assistant.js'; | ||
| import { ASSISTANT_CUSTOM_TRIGGER_ENTRY_POINT, ASSISTANT_FLOATING_ENTRY_POINT, ASSISTANT_LOADER_VERSION, ASSISTANT_WIDGET_API_URL, } from './constants.js'; | ||
| import { createAssistantBrowserContinuationStorage } from './continuation-storage.js'; | ||
| import { AssistantBrowserError, } from './types.js'; | ||
| import { createAssistantWidgetTransport } from './widget-transport.js'; | ||
| export const versions = { | ||
| loaderVersion: ASSISTANT_LOADER_VERSION, | ||
| coreVersion: ASSISTANT_CORE_API_VERSION, | ||
| }; | ||
| function normalizeEntryPoint(entryPoint, fallback) { | ||
| var _a; | ||
| const normalized = (_a = entryPoint === null || entryPoint === void 0 ? void 0 : entryPoint.trim()) !== null && _a !== void 0 ? _a : fallback; | ||
| if (normalized.length === 0 || normalized.length > 100) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'INVALID_CONFIGURATION', | ||
| message: 'Assistant entryPoint must contain between 1 and 100 characters.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| return normalized; | ||
| } | ||
| function toBrowserError(error) { | ||
| if (error instanceof AssistantBrowserError) | ||
| return error; | ||
| if (error instanceof AssistantError) { | ||
| return new AssistantBrowserError({ | ||
| code: error.code === 'destroyed' | ||
| ? 'DESTROYED' | ||
| : error.code === 'invalid_input' || error.code === 'invalid_state' | ||
| ? 'INVALID_CONFIGURATION' | ||
| : 'SESSION_FAILED', | ||
| message: error.message, | ||
| retryable: error.retryable, | ||
| status: error.status, | ||
| cause: error, | ||
| }); | ||
| } | ||
| return new AssistantBrowserError({ | ||
| code: 'SESSION_FAILED', | ||
| message: 'Mintlify Assistant could not complete the request.', | ||
| retryable: true, | ||
| cause: error, | ||
| }); | ||
| } | ||
| export function startAssistantBrowserRuntime(settings) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const transportController = createAssistantWidgetTransport({ | ||
| apiUrl: ASSISTANT_WIDGET_API_URL, | ||
| fetch: window.fetch.bind(window), | ||
| settings, | ||
| }); | ||
| yield transportController.prepare(); | ||
| const storage = createAssistantBrowserContinuationStorage(window, settings.widgetId, transportController.getContinuationScope); | ||
| const core = createAssistantCore({ | ||
| transport: transportController.transport, | ||
| storage, | ||
| metadata: { | ||
| surface: 'floating-widget', | ||
| entryPoint: ASSISTANT_FLOATING_ENTRY_POINT, | ||
| loaderVersion: ASSISTANT_LOADER_VERSION, | ||
| }, | ||
| context: settings.context, | ||
| }); | ||
| const mount = mountAssistant({ | ||
| client: core, | ||
| surface: 'floating-widget', | ||
| entryPoint: ASSISTANT_FLOATING_ENTRY_POINT, | ||
| context: settings.context, | ||
| theme: settings.theme, | ||
| launcherVisible: settings.launcherVisible, | ||
| styleNonce: settings.styleNonce, | ||
| }); | ||
| return { | ||
| open(options) { | ||
| mount.open({ | ||
| entryPoint: normalizeEntryPoint(options === null || options === void 0 ? void 0 : options.entryPoint, ASSISTANT_CUSTOM_TRIGGER_ENTRY_POINT), | ||
| focus: options === null || options === void 0 ? void 0 : options.focus, | ||
| }); | ||
| }, | ||
| close() { | ||
| mount.close(); | ||
| }, | ||
| focus() { | ||
| mount.focus(); | ||
| }, | ||
| ask(content, options) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| try { | ||
| return yield mount.ask(content, Object.assign(Object.assign({}, options), { entryPoint: normalizeEntryPoint(options === null || options === void 0 ? void 0 : options.entryPoint, ASSISTANT_CUSTOM_TRIGGER_ENTRY_POINT), surface: 'custom-trigger' })); | ||
| } | ||
| catch (error) { | ||
| throw toBrowserError(error); | ||
| } | ||
| }); | ||
| }, | ||
| update(options) { | ||
| var _a; | ||
| if ('identityToken' in options) { | ||
| if (typeof options.identityToken === 'string' && | ||
| options.identityToken.trim().length === 0) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'INVALID_CONFIGURATION', | ||
| message: 'identityToken must be non-empty when provided.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| storage.clearContinuation(); | ||
| transportController.updateIdentityToken((_a = options.identityToken) !== null && _a !== void 0 ? _a : undefined); | ||
| core.newThread(); | ||
| } | ||
| mount.update(Object.assign(Object.assign(Object.assign({}, ('context' in options ? { context: options.context } : {})), ('theme' in options ? { theme: options.theme } : {})), ('launcherVisible' in options ? { launcherVisible: options.launcherVisible } : {}))); | ||
| }, | ||
| newThread() { | ||
| return core.newThread(); | ||
| }, | ||
| destroy() { | ||
| mount.destroy(); | ||
| }, | ||
| }; | ||
| }); | ||
| } | ||
| //# sourceMappingURL=runtime.js.map |
| {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/browser/runtime.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,oCAAoC,EACpC,8BAA8B,EAC9B,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yCAAyC,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EACL,qBAAqB,GAKtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,aAAa,EAAE,wBAAwB;IACvC,WAAW,EAAE,0BAA0B;CACxC,CAAC;AAEF,SAAS,mBAAmB,CAAC,UAA8B,EAAE,QAAgB;;IAC3E,MAAM,UAAU,GAAG,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,EAAE,mCAAI,QAAQ,CAAC;IAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACvD,MAAM,IAAI,qBAAqB,CAAC;YAC9B,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,iEAAiE;YAC1E,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;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AE,CAAC,MAAM,KAAK,CAAC,EACzC,CAAC;wBACD,MAAM,IAAI,qBAAqB,CAAC;4BAC9B,IAAI,EAAE,uBAAuB;4BAC7B,OAAO,EAAE,gDAAgD;4BACzD,SAAS,EAAE,KAAK;yBACjB,CAAC,CAAC;oBACL,CAAC;oBACD,OAAO,CAAC,iBAAiB,EAAE,CAAC;oBAC5B,mBAAmB,CAAC,mBAAmB,CAAC,MAAA,OAAO,CAAC,aAAa,mCAAI,SAAS,CAAC,CAAC;oBAC5E,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,CAAC;gBACD,KAAK,CAAC,MAAM,+CACP,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAC1D,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACpD,CAAC,iBAAiB,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACrF,CAAC;YACL,CAAC;YACD,SAAS;gBACP,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;YAC1B,CAAC;YACD,OAAO;gBACL,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;SACF,CAAC;IACJ,CAAC;CAAA"} |
| import { type AssistantTransport } from '@mintlify/assistant-core'; | ||
| import { type AssistantBrowserSettings } from './types.js'; | ||
| export type AssistantWidgetTransportController = Readonly<{ | ||
| transport: AssistantTransport; | ||
| prepare: () => Promise<void>; | ||
| getContinuationScope: () => string; | ||
| updateIdentityToken: (identityToken?: string) => void; | ||
| }>; | ||
| type CreateAssistantWidgetTransportOptions = Readonly<{ | ||
| apiUrl: string; | ||
| fetch: typeof fetch; | ||
| settings: AssistantBrowserSettings; | ||
| now?: () => number; | ||
| }>; | ||
| export declare function createAssistantWidgetTransport(options: CreateAssistantWidgetTransportOptions): AssistantWidgetTransportController; | ||
| export {}; | ||
| //# sourceMappingURL=widget-transport.d.ts.map |
| {"version":3,"file":"widget-transport.d.ts","sourceRoot":"","sources":["../../src/browser/widget-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAyB,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAQlF,MAAM,MAAM,kCAAkC,GAAG,QAAQ,CAAC;IACxD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,oBAAoB,EAAE,MAAM,MAAM,CAAC;IACnC,mBAAmB,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD,CAAC,CAAC;AAEH,KAAK,qCAAqC,GAAG,QAAQ,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,CAAC,CAAC;AAqQH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC,GAC7C,kCAAkC,CA4NpC"} |
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } | ||
| var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { | ||
| if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
| var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
| return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
| function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } | ||
| function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } | ||
| function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
| function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
| function fulfill(value) { resume("next", value); } | ||
| function reject(value) { resume("throw", value); } | ||
| function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
| }; | ||
| var __asyncValues = (this && this.__asyncValues) || function (o) { | ||
| if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
| var m = o[Symbol.asyncIterator], i; | ||
| return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
| function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
| function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
| }; | ||
| var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { | ||
| var i, p; | ||
| return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; | ||
| function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } | ||
| }; | ||
| import { AssistantTransportError, } from '@mintlify/assistant-core'; | ||
| import { createAssistantCaptcha } from './captcha.js'; | ||
| import { AssistantBrowserError } from './types.js'; | ||
| const SESSION_REFRESH_WINDOW_MS = 30000; | ||
| const ANONYMOUS_CONTINUATION_SCOPE = 'anonymous'; | ||
| const IDENTITY_HASH_PATTERN = /^[A-Za-z0-9_-]{43}$/; | ||
| function isRecord(value) { | ||
| return typeof value === 'object' && value !== null; | ||
| } | ||
| function getErrorCode(value) { | ||
| if (!isRecord(value)) | ||
| return undefined; | ||
| return typeof value.error === 'string' ? value.error : undefined; | ||
| } | ||
| function getSessionContinuationScope(token) { | ||
| const encodedPayload = token.split('.')[1]; | ||
| if (!encodedPayload) | ||
| return ANONYMOUS_CONTINUATION_SCOPE; | ||
| try { | ||
| const base64 = encodedPayload.replaceAll('-', '+').replaceAll('_', '/'); | ||
| const paddingLength = (4 - (base64.length % 4)) % 4; | ||
| const parsed = JSON.parse(atob(`${base64}${'='.repeat(paddingLength)}`)); | ||
| if (!isRecord(parsed)) | ||
| return ANONYMOUS_CONTINUATION_SCOPE; | ||
| if (typeof parsed.identityHash === 'string' && | ||
| IDENTITY_HASH_PATTERN.test(parsed.identityHash)) { | ||
| return `identified:${parsed.identityHash}`; | ||
| } | ||
| return parsed.preview === true ? 'preview' : ANONYMOUS_CONTINUATION_SCOPE; | ||
| } | ||
| catch (_a) { | ||
| return ANONYMOUS_CONTINUATION_SCOPE; | ||
| } | ||
| } | ||
| function getResponseJson(response) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| try { | ||
| return yield response.json(); | ||
| } | ||
| catch (_a) { | ||
| return undefined; | ||
| } | ||
| }); | ||
| } | ||
| function parseSession(value) { | ||
| if (!isRecord(value) || | ||
| typeof value.token !== 'string' || | ||
| value.tokenType !== 'Bearer' || | ||
| typeof value.expiresAt !== 'string') { | ||
| return undefined; | ||
| } | ||
| const expiresAt = Date.parse(value.expiresAt); | ||
| if (!Number.isFinite(expiresAt) || !isRecord(value.config) || !isRecord(value.config.captcha)) { | ||
| return undefined; | ||
| } | ||
| const captcha = value.config.captcha; | ||
| if ((captcha.provider !== 'turnstile' && | ||
| captcha.provider !== 'hcaptcha' && | ||
| captcha.provider !== null) || | ||
| (typeof captcha.siteKey !== 'string' && captcha.siteKey !== null) || | ||
| typeof captcha.trustToken !== 'string') { | ||
| return undefined; | ||
| } | ||
| return { | ||
| token: value.token, | ||
| expiresAt, | ||
| captcha: { | ||
| provider: captcha.provider, | ||
| siteKey: captcha.siteKey, | ||
| trustToken: captcha.trustToken, | ||
| }, | ||
| }; | ||
| } | ||
| function createSessionError(response, code) { | ||
| const guidance = ' Verify the Widget ID and allowed origin, and allow https://api.mintlify.com in connect-src.'; | ||
| if (code === 'assistant_widget_disabled') { | ||
| return new AssistantBrowserError({ | ||
| code: 'WIDGET_DISABLED', | ||
| message: `This Assistant widget is disabled.${guidance}`, | ||
| retryable: true, | ||
| status: response.status, | ||
| }); | ||
| } | ||
| if (code === 'assistant_widget_unavailable') { | ||
| return new AssistantBrowserError({ | ||
| code: 'WIDGET_UNAVAILABLE', | ||
| message: `This Assistant widget is unavailable for the current origin.${guidance}`, | ||
| retryable: false, | ||
| status: response.status, | ||
| }); | ||
| } | ||
| return new AssistantBrowserError({ | ||
| code: 'SESSION_FAILED', | ||
| message: `Mintlify Assistant could not create a short-lived browser session.${guidance}`, | ||
| retryable: response.status >= 500, | ||
| status: response.status, | ||
| }); | ||
| } | ||
| function toServerPart(part) { | ||
| if (part.type === 'text') | ||
| return { type: 'text', text: part.text }; | ||
| if (part.type === 'source') { | ||
| return { type: 'source-url', sourceId: part.url, url: part.url, title: part.title }; | ||
| } | ||
| if (part.type === 'tool') { | ||
| return { | ||
| type: `tool-${part.toolName}`, | ||
| toolCallId: part.toolCallId, | ||
| state: part.state === 'output-error' ? 'output-available' : part.state, | ||
| input: part.input, | ||
| output: part.output, | ||
| errorText: part.errorText, | ||
| }; | ||
| } | ||
| return { type: 'data-custom', data: part.data }; | ||
| } | ||
| function toServerMessage(message) { | ||
| return { | ||
| id: message.id, | ||
| role: message.role, | ||
| parts: message.parts.map(toServerPart), | ||
| }; | ||
| } | ||
| function getMessageBody(request, captcha) { | ||
| // The server currently accepts only items/currentPath; retain newer flat context in core state. | ||
| return { | ||
| messages: request.messages.map(toServerMessage), | ||
| surface: request.surface, | ||
| entryPoint: request.entryPoint, | ||
| loaderVersion: request.loaderVersion, | ||
| coreVersion: request.coreVersion, | ||
| context: request.context, | ||
| currentPath: request.currentPath, | ||
| threadId: request.threadId, | ||
| threadKey: request.threadKey, | ||
| regenerate: request.regenerate, | ||
| _: captcha.trustToken, | ||
| captchaToken: captcha.captchaToken, | ||
| }; | ||
| } | ||
| function getFeedbackBody(request) { | ||
| return { | ||
| messageId: request.messageId, | ||
| feedback: request.feedback, | ||
| surface: request.surface, | ||
| entryPoint: request.entryPoint, | ||
| loaderVersion: request.loaderVersion, | ||
| coreVersion: request.coreVersion, | ||
| threadId: request.threadId, | ||
| threadKey: request.threadKey, | ||
| }; | ||
| } | ||
| function readSseData(response) { | ||
| return __asyncGenerator(this, arguments, function* readSseData_1() { | ||
| if (!response.body) { | ||
| throw new AssistantTransportError({ | ||
| message: 'Mintlify Assistant received an empty response stream.', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| const reader = response.body.getReader(); | ||
| const decoder = new TextDecoder(); | ||
| let buffer = ''; | ||
| let isDone = false; | ||
| while (!isDone) { | ||
| const { done, value } = yield __await(reader.read()); | ||
| isDone = done; | ||
| buffer += decoder.decode(value, { stream: !done }).replaceAll('\r\n', '\n'); | ||
| let boundary = buffer.indexOf('\n\n'); | ||
| while (boundary >= 0) { | ||
| const block = buffer.slice(0, boundary); | ||
| buffer = buffer.slice(boundary + 2); | ||
| const data = block | ||
| .split('\n') | ||
| .filter((line) => line.startsWith('data:')) | ||
| .map((line) => line.slice(5).trimStart()) | ||
| .join('\n'); | ||
| if (data.length > 0) | ||
| yield yield __await(data); | ||
| boundary = buffer.indexOf('\n\n'); | ||
| } | ||
| } | ||
| if (buffer.startsWith('data:')) | ||
| yield yield __await(buffer.slice(5).trimStart()); | ||
| }); | ||
| } | ||
| function parseStreamChunk(data) { | ||
| if (data === '[DONE]') | ||
| return undefined; | ||
| try { | ||
| return JSON.parse(data); | ||
| } | ||
| catch (_a) { | ||
| return undefined; | ||
| } | ||
| } | ||
| function readAssistantEvents(response) { | ||
| return __asyncGenerator(this, arguments, function* readAssistantEvents_1() { | ||
| var _a, e_1, _b, _c; | ||
| var _d; | ||
| const contentType = (_d = response.headers.get('content-type')) !== null && _d !== void 0 ? _d : ''; | ||
| if (contentType.includes('text/plain')) { | ||
| const text = yield __await(response.text()); | ||
| const separator = text.indexOf(':'); | ||
| const encoded = separator >= 0 ? text.slice(separator + 1).trim() : text; | ||
| const parsed = parseStreamChunk(encoded); | ||
| if (typeof parsed === 'string') | ||
| yield yield __await({ type: 'text-delta', delta: parsed }); | ||
| return yield __await(void 0); | ||
| } | ||
| try { | ||
| for (var _e = true, _f = __asyncValues(readSseData(response)), _g; _g = yield __await(_f.next()), _a = _g.done, !_a; _e = true) { | ||
| _c = _g.value; | ||
| _e = false; | ||
| const data = _c; | ||
| const chunk = parseStreamChunk(data); | ||
| if (!isRecord(chunk) || typeof chunk.type !== 'string') | ||
| continue; | ||
| if (chunk.type === 'text-delta' && typeof chunk.delta === 'string') { | ||
| yield yield __await({ type: 'text-delta', delta: chunk.delta }); | ||
| } | ||
| else if (chunk.type.startsWith('data-') && 'data' in chunk) { | ||
| yield yield __await({ type: 'data', data: chunk.data }); | ||
| } | ||
| else if (chunk.type === 'error') { | ||
| throw new AssistantTransportError({ | ||
| message: typeof chunk.errorText === 'string' | ||
| ? chunk.errorText | ||
| : 'Mintlify Assistant could not finish streaming this response.', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
| finally { | ||
| try { | ||
| if (!_e && !_a && (_b = _f.return)) yield __await(_b.call(_f)); | ||
| } | ||
| finally { if (e_1) throw e_1.error; } | ||
| } | ||
| }); | ||
| } | ||
| function createRequestSignal(signal) { | ||
| const controller = new AbortController(); | ||
| if (signal.aborted) | ||
| controller.abort(); | ||
| const unsubscribe = signal.subscribe(() => controller.abort()); | ||
| return { signal: controller.signal, unsubscribe }; | ||
| } | ||
| function toTransportError(error) { | ||
| if (error instanceof AssistantTransportError) | ||
| return error; | ||
| if (error instanceof AssistantBrowserError) { | ||
| return new AssistantTransportError({ | ||
| message: error.message, | ||
| status: error.status, | ||
| retryable: error.retryable, | ||
| }); | ||
| } | ||
| return new AssistantTransportError({ | ||
| message: 'Mintlify Assistant could not connect to the API. Allow https://api.mintlify.com in connect-src and check the network connection.', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| export function createAssistantWidgetTransport(options) { | ||
| var _a; | ||
| const now = (_a = options.now) !== null && _a !== void 0 ? _a : Date.now; | ||
| let identityToken = options.settings.identityToken; | ||
| let session; | ||
| let sessionGeneration = 0; | ||
| let pendingSession; | ||
| let continuationScope = ANONYMOUS_CONTINUATION_SCOPE; | ||
| let destroyed = false; | ||
| const captcha = createAssistantCaptcha({ | ||
| window, | ||
| document, | ||
| nonce: options.settings.scriptNonce, | ||
| }); | ||
| const exchangeSession = () => __awaiter(this, void 0, void 0, function* () { | ||
| if (options.settings.sessionProvider) { | ||
| try { | ||
| const provided = parseSession(yield options.settings.sessionProvider()); | ||
| if (provided) | ||
| return provided; | ||
| throw new Error('Invalid Assistant browser session response.'); | ||
| } | ||
| catch (_a) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'SESSION_FAILED', | ||
| message: 'Mintlify Assistant could not obtain a short-lived preview session.', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| } | ||
| let response; | ||
| try { | ||
| response = yield options.fetch(`${options.apiUrl}/session`, { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify({ widgetId: options.settings.widgetId, identityToken }), | ||
| }); | ||
| } | ||
| catch (_b) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'SESSION_FAILED', | ||
| message: 'Mintlify Assistant could not reach the session API. Allow https://api.mintlify.com in connect-src and check the network connection.', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| const body = yield getResponseJson(response); | ||
| if (!response.ok) | ||
| throw createSessionError(response, getErrorCode(body)); | ||
| const parsed = parseSession(body); | ||
| if (!parsed) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'SESSION_FAILED', | ||
| message: 'Mintlify Assistant received an invalid short-lived session response.', | ||
| retryable: true, | ||
| status: response.status, | ||
| }); | ||
| } | ||
| return parsed; | ||
| }); | ||
| const invalidateSession = () => { | ||
| sessionGeneration += 1; | ||
| session = undefined; | ||
| }; | ||
| const getSession = () => __awaiter(this, void 0, void 0, function* () { | ||
| if (destroyed) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'DESTROYED', | ||
| message: 'Mintlify Assistant has been destroyed.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| if (session && session.expiresAt - SESSION_REFRESH_WINDOW_MS > now()) | ||
| return session; | ||
| const generation = sessionGeneration; | ||
| if ((pendingSession === null || pendingSession === void 0 ? void 0 : pendingSession.generation) === generation) | ||
| return pendingSession.promise; | ||
| const promise = exchangeSession().then((nextSession) => { | ||
| if (destroyed) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'DESTROYED', | ||
| message: 'Mintlify Assistant has been destroyed.', | ||
| retryable: false, | ||
| }); | ||
| } | ||
| if (generation !== sessionGeneration) { | ||
| throw new AssistantBrowserError({ | ||
| code: 'SESSION_FAILED', | ||
| message: 'Mintlify Assistant discarded a session created for an outdated identity.', | ||
| retryable: true, | ||
| }); | ||
| } | ||
| session = nextSession; | ||
| continuationScope = getSessionContinuationScope(nextSession.token); | ||
| return nextSession; | ||
| }); | ||
| pendingSession = { generation, promise }; | ||
| const clearPendingSession = () => { | ||
| if ((pendingSession === null || pendingSession === void 0 ? void 0 : pendingSession.promise) === promise) | ||
| pendingSession = undefined; | ||
| }; | ||
| void promise.then(clearPendingSession, clearPendingSession); | ||
| return promise; | ||
| }); | ||
| const post = (path, body, signal) => __awaiter(this, void 0, void 0, function* () { | ||
| let currentSession = yield getSession(); | ||
| for (let attempt = 0; attempt < 2; attempt += 1) { | ||
| const response = yield options.fetch(`${options.apiUrl}${path}`, { | ||
| method: 'POST', | ||
| headers: { | ||
| Authorization: `Bearer ${currentSession.token}`, | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(body), | ||
| signal, | ||
| }); | ||
| if (response.status !== 401 || attempt > 0) | ||
| return response; | ||
| invalidateSession(); | ||
| currentSession = yield getSession(); | ||
| } | ||
| throw new AssistantTransportError({ retryable: true }); | ||
| }); | ||
| const postMessage = (request, signal) => __awaiter(this, void 0, void 0, function* () { | ||
| for (let attempt = 0; attempt < 2; attempt += 1) { | ||
| const currentSession = yield getSession(); | ||
| const captchaPayload = yield captcha.prepare(currentSession.captcha); | ||
| const response = yield options.fetch(`${options.apiUrl}/message`, { | ||
| method: 'POST', | ||
| headers: { | ||
| Authorization: `Bearer ${currentSession.token}`, | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(getMessageBody(request, captchaPayload)), | ||
| signal, | ||
| }); | ||
| if (response.ok || attempt > 0) | ||
| return response; | ||
| const code = getErrorCode(yield getResponseJson(response.clone())); | ||
| if (response.status === 401 || response.status === 419) { | ||
| invalidateSession(); | ||
| captcha.reset(); | ||
| continue; | ||
| } | ||
| if ((response.status === 400 || response.status === 450) && | ||
| (code === 'captcha_required' || | ||
| code === 'captcha_token_missing' || | ||
| code === 'captcha_failed' || | ||
| code === 'captcha_required_fallthrough')) { | ||
| captcha.reset(); | ||
| continue; | ||
| } | ||
| return response; | ||
| } | ||
| throw new AssistantTransportError({ retryable: true }); | ||
| }); | ||
| const transport = { | ||
| send(request, cancellationSignal) { | ||
| return __asyncGenerator(this, arguments, function* send_1() { | ||
| var _a, _b, _c; | ||
| const requestSignal = createRequestSignal(cancellationSignal); | ||
| try { | ||
| const response = yield __await(postMessage(request, requestSignal.signal)); | ||
| if (!response.ok) | ||
| throw new AssistantTransportError({ status: response.status }); | ||
| const continuation = { | ||
| threadId: (_a = response.headers.get('x-thread-id')) !== null && _a !== void 0 ? _a : undefined, | ||
| threadKey: (_b = response.headers.get('x-thread-key')) !== null && _b !== void 0 ? _b : undefined, | ||
| messageId: (_c = response.headers.get('x-message-id')) !== null && _c !== void 0 ? _c : undefined, | ||
| }; | ||
| yield yield __await(Object.assign({ type: 'start' }, continuation)); | ||
| yield __await(yield* __asyncDelegator(__asyncValues(readAssistantEvents(response)))); | ||
| yield yield __await(Object.assign({ type: 'finish' }, continuation)); | ||
| } | ||
| catch (error) { | ||
| if (cancellationSignal.aborted) | ||
| return yield __await(void 0); | ||
| throw toTransportError(error); | ||
| } | ||
| finally { | ||
| requestSignal.unsubscribe(); | ||
| } | ||
| }); | ||
| }, | ||
| submitFeedback(request) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| try { | ||
| const response = yield post('/feedback', getFeedbackBody(request)); | ||
| if (!response.ok) { | ||
| throw new AssistantTransportError({ | ||
| message: `Mintlify Assistant feedback request failed with status ${response.status}.`, | ||
| status: response.status, | ||
| }); | ||
| } | ||
| } | ||
| catch (error) { | ||
| throw toTransportError(error); | ||
| } | ||
| }); | ||
| }, | ||
| destroy() { | ||
| destroyed = true; | ||
| invalidateSession(); | ||
| identityToken = undefined; | ||
| captcha.destroy(); | ||
| }, | ||
| }; | ||
| return { | ||
| transport, | ||
| prepare() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| yield getSession(); | ||
| }); | ||
| }, | ||
| getContinuationScope() { | ||
| return continuationScope; | ||
| }, | ||
| updateIdentityToken(nextIdentityToken) { | ||
| identityToken = nextIdentityToken; | ||
| invalidateSession(); | ||
| }, | ||
| }; | ||
| } | ||
| //# sourceMappingURL=widget-transport.js.map |
| {"version":3,"file":"widget-transport.js","sourceRoot":"","sources":["../../src/browser/widget-transport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,uBAAuB,GAQxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,sBAAsB,EAAyB,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAiC,MAAM,YAAY,CAAC;AAsBlF,MAAM,yBAAyB,GAAG,KAAM,CAAC;AACzC,MAAM,4BAA4B,GAAG,WAAW,CAAC;AACjD,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,OAAO,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC;AAED,SAAS,2BAA2B,CAAC,KAAa;IAChD,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,cAAc;QAAE,OAAO,4BAA4B,CAAC;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACxE,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,MAAM,GAAY,IAAI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AC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;SAAA;QACD,OAAO;YACL,SAAS,GAAG,IAAI,CAAC;YACjB,iBAAiB,EAAE,CAAC;YACpB,aAAa,GAAG,SAAS,CAAC;YAC1B,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;IAEF,OAAO;QACL,SAAS;QACH,OAAO;;gBACX,MAAM,UAAU,EAAE,CAAC;YACrB,CAAC;SAAA;QACD,oBAAoB;YAClB,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACD,mBAAmB,CAAC,iBAAiB;YACnC,aAAa,GAAG,iBAAiB,CAAC;YAClC,iBAAiB,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"} |
| import { type AssistantRenderer } from './assistant-renderer.js'; | ||
| import { type AssistantMount, type MountAssistantOptions } from './types.js'; | ||
| export declare function createAssistantMount(options: MountAssistantOptions, renderer: AssistantRenderer): AssistantMount; | ||
| export declare function mountAssistant(options: MountAssistantOptions): AssistantMount; | ||
| export declare function getMountedAssistant(ownerDocument?: Document): AssistantMount | undefined; | ||
| //# sourceMappingURL=mount-assistant.d.ts.map |
| {"version":3,"file":"mount-assistant.d.ts","sourceRoot":"","sources":["../src/mount-assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG9F,OAAO,EAIL,KAAK,cAAc,EAInB,KAAK,qBAAqB,EAG3B,MAAM,YAAY,CAAC;AA6CpB,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,iBAAiB,GAC1B,cAAc,CA6NhB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAE7E;AAED,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,CAIxF"} |
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| import { maintainedAssistantRenderer } from './assistant-renderer.js'; | ||
| import { applyAssistantTheme, applyAssistantTokens } from './assistant-theme.js'; | ||
| import { ResourceScope } from './resource-scope.js'; | ||
| import { AssistantAlreadyMountedError, AssistantDestroyedError, } from './types.js'; | ||
| const mountedAssistants = new WeakMap(); | ||
| function getDocument(options) { | ||
| if (options.container) | ||
| return options.container.ownerDocument; | ||
| if (options.document) | ||
| return options.document; | ||
| if (typeof document !== 'undefined') | ||
| return document; | ||
| throw new Error('Mounting Assistant requires a browser Document.'); | ||
| } | ||
| function getContainer(options, ownerDocument) { | ||
| if (options.container) | ||
| return options.container; | ||
| return ownerDocument.body; | ||
| } | ||
| function mergeContext(current, next) { | ||
| if (!current) | ||
| return next; | ||
| if (!next) | ||
| return current; | ||
| return Object.assign(Object.assign({}, current), next); | ||
| } | ||
| function toDuplicateUpdate(options) { | ||
| return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ entryPoint: options.entryPoint }, ('context' in options ? { context: options.context } : {})), ('navigation' in options ? { navigation: options.navigation } : {})), ('theme' in options ? { theme: options.theme } : {})), ('tokens' in options ? { tokens: options.tokens } : {})), ('open' in options ? { open: options.open } : {})); | ||
| } | ||
| export function createAssistantMount(options, renderer) { | ||
| var _a, _b; | ||
| const ownerDocument = getDocument(options); | ||
| const existing = mountedAssistants.get(ownerDocument); | ||
| if (existing) { | ||
| if (existing.client !== options.client) | ||
| throw new AssistantAlreadyMountedError(); | ||
| existing.mount.update(toDuplicateUpdate(options)); | ||
| return existing.mount; | ||
| } | ||
| const container = getContainer(options, ownerDocument); | ||
| const host = ownerDocument.createElement('mintlify-assistant'); | ||
| host.dataset.mintlifyAssistantHost = ''; | ||
| host.setAttribute('role', 'region'); | ||
| host.setAttribute('aria-label', 'Mintlify Assistant'); | ||
| const root = host.attachShadow({ mode: 'closed' }); | ||
| let isDestroyed = false; | ||
| let isOpen = (_a = options.open) !== null && _a !== void 0 ? _a : false; | ||
| let entryPoint = options.entryPoint; | ||
| let theme = (_b = options.theme) !== null && _b !== void 0 ? _b : 'system'; | ||
| let context = options.context; | ||
| let navigation = options.navigation; | ||
| let navigationCleanup; | ||
| const rendererHandle = {}; | ||
| const scope = new ResourceScope(); | ||
| const getSnapshot = () => ({ | ||
| isDestroyed, | ||
| isOpen, | ||
| entryPoint, | ||
| surface: options.surface, | ||
| theme, | ||
| }); | ||
| applyAssistantTheme(host, theme); | ||
| if (options.tokens) | ||
| applyAssistantTokens(host, options.tokens); | ||
| const assertActive = () => { | ||
| if (isDestroyed) | ||
| throw new AssistantDestroyedError(); | ||
| }; | ||
| const renderState = () => { | ||
| var _a; | ||
| host.dataset.state = isOpen ? 'open' : 'closed'; | ||
| (_a = rendererHandle.current) === null || _a === void 0 ? void 0 : _a.update(getSnapshot()); | ||
| }; | ||
| const setNavigation = (next) => { | ||
| var _a; | ||
| navigationCleanup === null || navigationCleanup === void 0 ? void 0 : navigationCleanup(); | ||
| navigationCleanup = undefined; | ||
| navigation = next; | ||
| if (!navigation) | ||
| return; | ||
| context = mergeContext(context, navigation.getContext()); | ||
| options.client.setContext(context); | ||
| const cleanup = (_a = navigation.subscribe) === null || _a === void 0 ? void 0 : _a.call(navigation, () => { | ||
| context = mergeContext(context, navigation === null || navigation === void 0 ? void 0 : navigation.getContext()); | ||
| options.client.setContext(context); | ||
| }); | ||
| if (cleanup) | ||
| navigationCleanup = cleanup; | ||
| }; | ||
| const focus = () => { | ||
| var _a; | ||
| assertActive(); | ||
| (_a = rendererHandle.current) === null || _a === void 0 ? void 0 : _a.focus(); | ||
| }; | ||
| const open = (openOptions = {}) => { | ||
| var _a; | ||
| assertActive(); | ||
| if (openOptions.entryPoint) | ||
| entryPoint = openOptions.entryPoint; | ||
| isOpen = true; | ||
| renderState(); | ||
| if ((_a = openOptions.focus) !== null && _a !== void 0 ? _a : true) | ||
| focus(); | ||
| }; | ||
| const close = () => { | ||
| var _a; | ||
| assertActive(); | ||
| isOpen = false; | ||
| renderState(); | ||
| if (options.surface === 'floating-widget') | ||
| (_a = rendererHandle.current) === null || _a === void 0 ? void 0 : _a.focus(); | ||
| }; | ||
| const refreshContext = (next) => { | ||
| assertActive(); | ||
| if (next === null) { | ||
| context = undefined; | ||
| options.client.setContext(undefined); | ||
| return; | ||
| } | ||
| const navigationContext = next !== null && next !== void 0 ? next : navigation === null || navigation === void 0 ? void 0 : navigation.getContext(); | ||
| context = mergeContext(context, navigationContext); | ||
| options.client.setContext(context); | ||
| }; | ||
| const update = (next) => { | ||
| var _a; | ||
| assertActive(); | ||
| if (next.entryPoint) | ||
| entryPoint = next.entryPoint; | ||
| if (next.theme) { | ||
| theme = next.theme; | ||
| applyAssistantTheme(host, theme); | ||
| } | ||
| if (next.tokens) | ||
| applyAssistantTokens(host, next.tokens); | ||
| if (next.context === null) { | ||
| context = undefined; | ||
| options.client.setContext(undefined); | ||
| } | ||
| else if (next.context) { | ||
| context = mergeContext(context, next.context); | ||
| options.client.setContext(context); | ||
| } | ||
| if ('navigation' in next && next.navigation !== navigation) | ||
| setNavigation(next.navigation); | ||
| if (next.open !== undefined) { | ||
| if (next.open) | ||
| open({ focus: false }); | ||
| else | ||
| close(); | ||
| return; | ||
| } | ||
| (_a = rendererHandle.current) === null || _a === void 0 ? void 0 : _a.update(getSnapshot()); | ||
| }; | ||
| const ask = (content_1, ...args_1) => __awaiter(this, [content_1, ...args_1], void 0, function* (content, askOptions = {}) { | ||
| var _a, _b, _c, _d, _e; | ||
| assertActive(); | ||
| const actionEntryPoint = (_a = askOptions.entryPoint) !== null && _a !== void 0 ? _a : entryPoint; | ||
| if ((_b = askOptions.open) !== null && _b !== void 0 ? _b : true) { | ||
| open({ entryPoint: actionEntryPoint, focus: (_c = askOptions.focus) !== null && _c !== void 0 ? _c : true }); | ||
| } | ||
| else if (askOptions.entryPoint) { | ||
| entryPoint = askOptions.entryPoint; | ||
| (_d = rendererHandle.current) === null || _d === void 0 ? void 0 : _d.update(getSnapshot()); | ||
| } | ||
| if (askOptions.context === null) { | ||
| context = undefined; | ||
| options.client.setContext(undefined); | ||
| } | ||
| const requestContext = askOptions.context === null | ||
| ? undefined | ||
| : mergeContext(context, (_e = askOptions.context) !== null && _e !== void 0 ? _e : navigation === null || navigation === void 0 ? void 0 : navigation.getContext()); | ||
| if (requestContext !== context) { | ||
| context = requestContext; | ||
| options.client.setContext(context); | ||
| } | ||
| return options.client.send({ | ||
| content, | ||
| context: requestContext, | ||
| entryPoint: actionEntryPoint, | ||
| }); | ||
| }); | ||
| const destroy = () => { | ||
| if (isDestroyed) | ||
| return; | ||
| isDestroyed = true; | ||
| const errors = []; | ||
| const attempt = (cleanup) => { | ||
| try { | ||
| cleanup(); | ||
| } | ||
| catch (error) { | ||
| // Teardown stages may aggregate their own failures; expose those leaf errors to callers. | ||
| if (error instanceof AggregateError && error.errors.length > 0) { | ||
| errors.push(...error.errors); | ||
| } | ||
| else { | ||
| errors.push(error); | ||
| } | ||
| } | ||
| }; | ||
| if (navigationCleanup) | ||
| attempt(navigationCleanup); | ||
| navigationCleanup = undefined; | ||
| attempt(() => options.client.abort()); | ||
| attempt(() => scope.destroy()); | ||
| if (rendererHandle.current) | ||
| attempt(rendererHandle.current.destroy); | ||
| attempt(() => host.remove()); | ||
| attempt(() => options.client.destroy()); | ||
| const mounted = mountedAssistants.get(ownerDocument); | ||
| if ((mounted === null || mounted === void 0 ? void 0 : mounted.mount) === mount) | ||
| mountedAssistants.delete(ownerDocument); | ||
| if (errors.length > 0) { | ||
| throw new AggregateError(errors, 'One or more Assistant destroy operations failed.'); | ||
| } | ||
| }; | ||
| const mount = { | ||
| update, | ||
| open, | ||
| close, | ||
| focus, | ||
| ask, | ||
| refreshContext, | ||
| getSnapshot, | ||
| destroy, | ||
| }; | ||
| scope.listen(host, 'keydown', (event) => { | ||
| if ('key' in event && event.key === 'Escape') { | ||
| close(); | ||
| } | ||
| }); | ||
| scope.add(() => { | ||
| navigationCleanup === null || navigationCleanup === void 0 ? void 0 : navigationCleanup(); | ||
| navigationCleanup = undefined; | ||
| }); | ||
| rendererHandle.current = renderer.mount({ | ||
| client: options.client, | ||
| root, | ||
| scope, | ||
| snapshot: getSnapshot(), | ||
| styleNonce: options.styleNonce, | ||
| actions: { | ||
| open, | ||
| close, | ||
| ask(content, askOptions) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| yield ask(content, askOptions); | ||
| }); | ||
| }, | ||
| }, | ||
| }); | ||
| renderState(); | ||
| setNavigation(navigation); | ||
| if (!navigation) | ||
| options.client.setContext(context); | ||
| container.append(host); | ||
| mountedAssistants.set(ownerDocument, { client: options.client, mount }); | ||
| return mount; | ||
| } | ||
| export function mountAssistant(options) { | ||
| return createAssistantMount(options, maintainedAssistantRenderer); | ||
| } | ||
| export function getMountedAssistant(ownerDocument) { | ||
| var _a; | ||
| const targetDocument = ownerDocument !== null && ownerDocument !== void 0 ? ownerDocument : (typeof document !== 'undefined' ? document : undefined); | ||
| if (!targetDocument) | ||
| return undefined; | ||
| return (_a = mountedAssistants.get(targetDocument)) === null || _a === void 0 ? void 0 : _a.mount; | ||
| } | ||
| //# sourceMappingURL=mount-assistant.js.map |
| {"version":3,"file":"mount-assistant.js","sourceRoot":"","sources":["../src/mount-assistant.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,2BAA2B,EAA0B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAA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W,EAAE,CAAC;IACd,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1B,IAAI,CAAC,UAAU;QAAE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,iBAAiB,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAExE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,OAAO,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,aAAwB;;IAC1D,MAAM,cAAc,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACjG,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;IACtC,OAAO,MAAA,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,0CAAE,KAAK,CAAC;AACtD,CAAC"} |
| export declare class ResourceScope { | ||
| private cleanups; | ||
| private isDestroyed; | ||
| add(cleanup: () => void): () => void; | ||
| listen(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void; | ||
| timeout(callback: () => void, delay: number): void; | ||
| observe(observer: MutationObserver, target: Node, options: MutationObserverInit): void; | ||
| abort(controller: AbortController): void; | ||
| destroy(): void; | ||
| } | ||
| //# sourceMappingURL=resource-scope.d.ts.map |
| {"version":3,"file":"resource-scope.d.ts","sourceRoot":"","sources":["../src/resource-scope.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,WAAW,CAAS;IAE5B,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAUpC,MAAM,CACJ,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,GAC1C,IAAI;IAKP,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKlD,OAAO,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAKtF,KAAK,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI;IAIxC,OAAO,IAAI,IAAI;CAkBhB"} |
| export class ResourceScope { | ||
| constructor() { | ||
| this.cleanups = new Set(); | ||
| this.isDestroyed = false; | ||
| } | ||
| add(cleanup) { | ||
| if (this.isDestroyed) { | ||
| cleanup(); | ||
| return () => { }; | ||
| } | ||
| this.cleanups.add(cleanup); | ||
| return () => this.cleanups.delete(cleanup); | ||
| } | ||
| listen(target, type, listener, options) { | ||
| target.addEventListener(type, listener, options); | ||
| this.add(() => target.removeEventListener(type, listener, options)); | ||
| } | ||
| timeout(callback, delay) { | ||
| const timeoutId = globalThis.setTimeout(callback, delay); | ||
| this.add(() => globalThis.clearTimeout(timeoutId)); | ||
| } | ||
| observe(observer, target, options) { | ||
| observer.observe(target, options); | ||
| this.add(() => observer.disconnect()); | ||
| } | ||
| abort(controller) { | ||
| this.add(() => controller.abort()); | ||
| } | ||
| destroy() { | ||
| if (this.isDestroyed) | ||
| return; | ||
| this.isDestroyed = true; | ||
| const cleanups = Array.from(this.cleanups).reverse(); | ||
| this.cleanups.clear(); | ||
| const errors = []; | ||
| for (const cleanup of cleanups) { | ||
| try { | ||
| cleanup(); | ||
| } | ||
| catch (error) { | ||
| errors.push(error); | ||
| } | ||
| } | ||
| if (errors.length > 0) { | ||
| throw new AggregateError(errors, 'One or more Assistant resource cleanups failed.'); | ||
| } | ||
| } | ||
| } | ||
| //# sourceMappingURL=resource-scope.js.map |
| {"version":3,"file":"resource-scope.js","sourceRoot":"","sources":["../src/resource-scope.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAa;IAA1B;QACU,aAAQ,GAAG,IAAI,GAAG,EAAc,CAAC;QACjC,gBAAW,GAAG,KAAK,CAAC;IAsD9B,CAAC;IApDC,GAAG,CAAC,OAAmB;QACrB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;YACV,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CACJ,MAAmB,EACnB,IAAY,EACZ,QAA4C,EAC5C,OAA2C;QAE3C,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,CAAC,QAAoB,EAAE,KAAa;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,CAAC,QAA0B,EAAE,MAAY,EAAE,OAA6B;QAC7E,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,UAA2B;QAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAE7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;QACrD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,MAAM,GAAc,EAAE,CAAC;QAC7B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACH,OAAO,EAAE,CAAC;YACZ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,cAAc,CAAC,MAAM,EAAE,iDAAiD,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;CACF"} |
| import type { FormEventHandler, KeyboardEventHandler, RefObject } from 'react'; | ||
| type AssistantComposerProps = Readonly<{ | ||
| composerRef: RefObject<HTMLTextAreaElement | null>; | ||
| formRef: RefObject<HTMLFormElement | null>; | ||
| input: string; | ||
| isBusy: boolean; | ||
| onAbort: () => void; | ||
| onInputChange: (value: string) => void; | ||
| onKeyDown: KeyboardEventHandler<HTMLTextAreaElement>; | ||
| onSubmit: FormEventHandler<HTMLFormElement>; | ||
| }>; | ||
| export declare function AssistantComposer({ composerRef, formRef, input, isBusy, onAbort, onInputChange, onKeyDown, onSubmit, }: AssistantComposerProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-composer.d.ts.map |
| {"version":3,"file":"assistant-composer.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-composer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/E,KAAK,sBAAsB,GAAG,QAAQ,CAAC;IACrC,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACnD,OAAO,EAAE,SAAS,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;IACrD,QAAQ,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;CAC7C,CAAC,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,GACT,EAAE,sBAAsB,2CA8CxB"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| export function AssistantComposer({ composerRef, formRef, input, isBusy, onAbort, onInputChange, onKeyDown, onSubmit, }) { | ||
| return (_jsxs("div", { className: "flex-none border-t border-assistant-border p-3", children: [_jsxs("form", { className: "flex items-end gap-2 rounded-[14px] border border-assistant-border bg-assistant-subtle p-2 focus-within:border-assistant-accent focus-within:ring-[3px] focus-within:ring-assistant-accent/15", onSubmit: onSubmit, ref: formRef, children: [_jsx("label", { className: "sr-only", htmlFor: "mintlify-assistant-composer", children: "Ask Mintlify Assistant" }), _jsx("textarea", { className: "min-h-9.5 max-h-[120px] flex-1 resize-none bg-transparent p-2 leading-[1.45] text-assistant-foreground outline-none placeholder:text-assistant-muted disabled:cursor-not-allowed", disabled: isBusy, id: "mintlify-assistant-composer", onChange: (event) => onInputChange(event.currentTarget.value), onKeyDown: onKeyDown, placeholder: "Ask a question\u2026", ref: composerRef, rows: 1, value: input }), isBusy ? (_jsx("button", { "aria-label": "Stop response", className: "flex h-9.5 min-w-14.5 cursor-pointer items-center justify-center rounded-[10px] bg-assistant-accent px-3 text-[13px] font-semibold text-assistant-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent", onClick: onAbort, type: "button", children: "Stop" })) : (_jsx("button", { className: "flex h-9.5 min-w-14.5 cursor-pointer items-center justify-center rounded-[10px] bg-assistant-accent px-3 text-[13px] font-semibold text-assistant-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent disabled:cursor-default disabled:opacity-50", disabled: input.trim().length === 0, type: "submit", children: "Send" }))] }), _jsx("p", { className: "mx-0 mt-2 mb-0 text-center text-[11px] text-assistant-muted", children: "AI responses may contain mistakes." })] })); | ||
| } | ||
| //# sourceMappingURL=assistant-composer.js.map |
| {"version":3,"file":"assistant-composer.js","sourceRoot":"","sources":["../../src/ui/assistant-composer.tsx"],"names":[],"mappings":";AAaA,MAAM,UAAU,iBAAiB,CAAC,EAChC,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,GACe;IACvB,OAAO,CACL,eAAK,SAAS,EAAC,gDAAgD,aAC7D,gBACE,SAAS,EAAC,+LAA+L,EACzM,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,OAAO,aAEZ,gBAAO,SAAS,EAAC,SAAS,EAAC,OAAO,EAAC,6BAA6B,uCAExD,EACR,mBACE,SAAS,EAAC,kLAAkL,EAC5L,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAC,6BAA6B,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,EAC7D,SAAS,EAAE,SAAS,EACpB,WAAW,EAAC,sBAAiB,EAC7B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,GACZ,EACD,MAAM,CAAC,CAAC,CAAC,CACR,+BACa,eAAe,EAC1B,SAAS,EAAC,uQAAuQ,EACjR,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,qBAGN,CACV,CAAC,CAAC,CAAC,CACF,iBACE,SAAS,EAAC,mTAAmT,EAC7T,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EACnC,IAAI,EAAC,QAAQ,qBAGN,CACV,IACI,EACP,YAAG,SAAS,EAAC,6DAA6D,mDAEtE,IACA,CACP,CAAC;AACJ,CAAC"} |
| import type { AssistantMessage as AssistantMessageValue } from '@mintlify/assistant-core'; | ||
| import type { RefObject } from 'react'; | ||
| type AssistantConversationProps = Readonly<{ | ||
| errorMessage?: string; | ||
| messages: readonly AssistantMessageValue[]; | ||
| messagesRef: RefObject<HTMLDivElement | null>; | ||
| onRetry: () => void; | ||
| retryable: boolean; | ||
| showThinking: boolean; | ||
| }>; | ||
| export declare function AssistantConversation({ errorMessage, messages, messagesRef, onRetry, retryable, showThinking, }: AssistantConversationProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-conversation.d.ts.map |
| {"version":3,"file":"assistant-conversation.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-conversation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,KAAK,0BAA0B,GAAG,QAAQ,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C,WAAW,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,EACpC,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,YAAY,GACb,EAAE,0BAA0B,2CAoB5B"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| import { AssistantEmptyState } from './assistant-empty-state.js'; | ||
| import { AssistantErrorMessage } from './assistant-error-message.js'; | ||
| import { AssistantMessage } from './assistant-message.js'; | ||
| import { AssistantThinkingIndicator } from './assistant-thinking-indicator.js'; | ||
| export function AssistantConversation({ errorMessage, messages, messagesRef, onRetry, retryable, showThinking, }) { | ||
| return (_jsxs("div", { "aria-label": "Conversation", "aria-live": "polite", className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4 scroll-smooth motion-reduce:scroll-auto", ref: messagesRef, role: "log", children: [messages.length === 0 ? (_jsx(AssistantEmptyState, {})) : (messages.map((message) => _jsx(AssistantMessage, { message: message }, message.id))), showThinking ? _jsx(AssistantThinkingIndicator, {}) : null, errorMessage ? (_jsx(AssistantErrorMessage, { message: errorMessage, onRetry: onRetry, retryable: retryable })) : null] })); | ||
| } | ||
| //# sourceMappingURL=assistant-conversation.js.map |
| {"version":3,"file":"assistant-conversation.js","sourceRoot":"","sources":["../../src/ui/assistant-conversation.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAW/E,MAAM,UAAU,qBAAqB,CAAC,EACpC,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,YAAY,GACe;IAC3B,OAAO,CACL,6BACa,cAAc,eACf,QAAQ,EAClB,SAAS,EAAC,wFAAwF,EAClG,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,KAAK,aAET,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACvB,KAAC,mBAAmB,KAAG,CACxB,CAAC,CAAC,CAAC,CACF,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAC,gBAAgB,IAAkB,OAAO,EAAE,OAAO,IAA5B,OAAO,CAAC,EAAE,CAAsB,CAAC,CACnF,EACA,YAAY,CAAC,CAAC,CAAC,KAAC,0BAA0B,KAAG,CAAC,CAAC,CAAC,IAAI,EACpD,YAAY,CAAC,CAAC,CAAC,CACd,KAAC,qBAAqB,IAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAI,CACzF,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"} |
| export declare function AssistantEmptyState(): import("react/jsx-runtime").JSX.Element; | ||
| //# sourceMappingURL=assistant-empty-state.d.ts.map |
| {"version":3,"file":"assistant-empty-state.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-empty-state.tsx"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,4CAclC"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| import { SparkleIcon } from './icons.js'; | ||
| export function AssistantEmptyState() { | ||
| return (_jsxs("div", { className: "flex min-h-[220px] flex-1 flex-col items-center justify-center text-center text-assistant-muted", children: [_jsx("div", { className: "mb-3 text-assistant-accent", children: _jsx(SparkleIcon, { size: 30 }) }), _jsx("p", { className: "m-0 text-lg font-semibold tracking-[-0.02em] text-assistant-foreground", children: "How can I help?" }), _jsx("p", { className: "mt-1.5 mb-0 max-w-[260px] text-sm leading-6", children: "Ask a question about the documentation and I'll help you find an answer." })] })); | ||
| } | ||
| //# sourceMappingURL=assistant-empty-state.js.map |
| {"version":3,"file":"assistant-empty-state.js","sourceRoot":"","sources":["../../src/ui/assistant-empty-state.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,UAAU,mBAAmB;IACjC,OAAO,CACL,eAAK,SAAS,EAAC,iGAAiG,aAC9G,cAAK,SAAS,EAAC,4BAA4B,YACzC,KAAC,WAAW,IAAC,IAAI,EAAE,EAAE,GAAI,GACrB,EACN,YAAG,SAAS,EAAC,wEAAwE,gCAEjF,EACJ,YAAG,SAAS,EAAC,6CAA6C,yFAEtD,IACA,CACP,CAAC;AACJ,CAAC"} |
| type AssistantErrorMessageProps = Readonly<{ | ||
| message: string; | ||
| onRetry: () => void; | ||
| retryable: boolean; | ||
| }>; | ||
| export declare function AssistantErrorMessage({ message, onRetry, retryable }: AssistantErrorMessageProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-error-message.d.ts.map |
| {"version":3,"file":"assistant-error-message.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-error-message.tsx"],"names":[],"mappings":"AAAA,KAAK,0BAA0B,GAAG,QAAQ,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,0BAA0B,2CAkBhG"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| export function AssistantErrorMessage({ message, onRetry, retryable }) { | ||
| return (_jsxs("div", { className: "rounded-xl border border-assistant-error-border bg-assistant-error-background px-3 py-2.5 text-[13px] leading-[1.45] text-assistant-foreground", role: "alert", children: [message, retryable ? (_jsx("button", { className: "ml-1 cursor-pointer bg-transparent p-0 font-semibold text-assistant-foreground underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent", onClick: onRetry, type: "button", children: "Try again" })) : null] })); | ||
| } | ||
| //# sourceMappingURL=assistant-error-message.js.map |
| {"version":3,"file":"assistant-error-message.js","sourceRoot":"","sources":["../../src/ui/assistant-error-message.tsx"],"names":[],"mappings":";AAMA,MAAM,UAAU,qBAAqB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAA8B;IAC/F,OAAO,CACL,eACE,SAAS,EAAC,gJAAgJ,EAC1J,IAAI,EAAC,OAAO,aAEX,OAAO,EACP,SAAS,CAAC,CAAC,CAAC,CACX,iBACE,SAAS,EAAC,+MAA+M,EACzN,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,0BAGN,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"} |
| import type { RefObject } from 'react'; | ||
| type AssistantLauncherProps = Readonly<{ | ||
| launcherRef: RefObject<HTMLButtonElement | null>; | ||
| onOpen: () => void; | ||
| }>; | ||
| export declare function AssistantLauncher({ launcherRef, onOpen }: AssistantLauncherProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-launcher.d.ts.map |
| {"version":3,"file":"assistant-launcher.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-launcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,KAAK,sBAAsB,GAAG,QAAQ,CAAC;IACrC,WAAW,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,sBAAsB,2CAahF"} |
| import { jsx as _jsx } from "react/jsx-runtime"; | ||
| import { SparkleIcon } from './icons.js'; | ||
| export function AssistantLauncher({ launcherRef, onOpen }) { | ||
| return (_jsx("button", { "aria-label": "Open Mintlify Assistant", className: "pointer-events-auto flex size-13 cursor-pointer items-center justify-center rounded-full bg-assistant-accent text-assistant-accent-foreground shadow-assistant-launcher transition-[transform,box-shadow] duration-150 hover:-translate-y-px hover:shadow-assistant-launcher-hover focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent motion-reduce:transition-none", "data-mintlify-assistant-launcher": "", onClick: onOpen, ref: launcherRef, type: "button", children: _jsx(SparkleIcon, {}) })); | ||
| } | ||
| //# sourceMappingURL=assistant-launcher.js.map |
| {"version":3,"file":"assistant-launcher.js","sourceRoot":"","sources":["../../src/ui/assistant-launcher.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAOzC,MAAM,UAAU,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,EAA0B;IAC/E,OAAO,CACL,+BACa,yBAAyB,EACpC,SAAS,EAAC,oZAAoZ,sCAC7X,EAAE,EACnC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,QAAQ,YAEb,KAAC,WAAW,KAAG,GACR,CACV,CAAC;AACJ,CAAC"} |
| import type { AssistantMessage as AssistantMessageValue } from '@mintlify/assistant-core'; | ||
| type AssistantMessageProps = Readonly<{ | ||
| message: AssistantMessageValue; | ||
| }>; | ||
| export declare function AssistantMessage({ message }: AssistantMessageProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-message.d.ts.map |
| {"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,KAAK,qBAAqB,GAAG,QAAQ,CAAC;IACpC,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,qBAAqB,2CAqBlE"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| export function AssistantMessage({ message }) { | ||
| const label = message.role === 'user' ? 'You' : 'Mintlify Assistant'; | ||
| const messageClassName = message.role === 'user' | ||
| ? 'flex max-w-[88%] flex-col items-end self-end gap-1.5' | ||
| : 'flex max-w-[88%] flex-col self-start gap-1.5'; | ||
| const contentClassName = message.role === 'user' | ||
| ? 'rounded-[14px] border border-transparent bg-assistant-accent px-3 py-2.5 text-sm leading-[1.55] text-assistant-accent-foreground whitespace-pre-wrap [overflow-wrap:anywhere]' | ||
| : 'rounded-[14px] border border-assistant-border bg-assistant-subtle px-3 py-2.5 text-sm leading-[1.55] whitespace-pre-wrap [overflow-wrap:anywhere]'; | ||
| return (_jsxs("article", { "aria-label": 'Message from ' + label, className: messageClassName, children: [_jsx("span", { className: "px-1 text-[11px] font-semibold tracking-[0.04em] text-assistant-muted uppercase", children: label }), message.content.length > 0 ? (_jsx("div", { className: contentClassName, children: message.content })) : null] })); | ||
| } | ||
| //# sourceMappingURL=assistant-message.js.map |
| {"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../src/ui/assistant-message.tsx"],"names":[],"mappings":";AAMA,MAAM,UAAU,gBAAgB,CAAC,EAAE,OAAO,EAAyB;IACjE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACrE,MAAM,gBAAgB,GACpB,OAAO,CAAC,IAAI,KAAK,MAAM;QACrB,CAAC,CAAC,sDAAsD;QACxD,CAAC,CAAC,8CAA8C,CAAC;IACrD,MAAM,gBAAgB,GACpB,OAAO,CAAC,IAAI,KAAK,MAAM;QACrB,CAAC,CAAC,+KAA+K;QACjL,CAAC,CAAC,mJAAmJ,CAAC;IAE1J,OAAO,CACL,iCAAqB,eAAe,GAAG,KAAK,EAAE,SAAS,EAAE,gBAAgB,aACvE,eAAM,SAAS,EAAC,iFAAiF,YAC9F,KAAK,GACD,EACN,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC5B,cAAK,SAAS,EAAE,gBAAgB,YAAG,OAAO,CAAC,OAAO,GAAO,CAC1D,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAC;AACJ,CAAC"} |
| type AssistantPanelHeaderProps = Readonly<{ | ||
| onClose: () => void; | ||
| onNewThread: () => void; | ||
| }>; | ||
| export declare function AssistantPanelHeader({ onClose, onNewThread }: AssistantPanelHeaderProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-panel-header.d.ts.map |
| {"version":3,"file":"assistant-panel-header.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-panel-header.tsx"],"names":[],"mappings":"AAEA,KAAK,yBAAyB,GAAG,QAAQ,CAAC;IACxC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,yBAAyB,2CA6BvF"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| import { CloseIcon, NewThreadIcon, SparkleIcon } from './icons.js'; | ||
| export function AssistantPanelHeader({ onClose, onNewThread }) { | ||
| return (_jsxs("header", { className: "flex min-h-14 flex-none items-center justify-between border-b border-assistant-border py-0 pr-3 pl-4", children: [_jsxs("div", { className: "flex items-center gap-2 text-sm font-semibold tracking-[-0.01em]", children: [_jsx("span", { className: "flex text-assistant-accent", children: _jsx(SparkleIcon, { size: 18 }) }), _jsx("span", { children: "Assistant" })] }), _jsxs("div", { className: "flex items-center gap-0.5", children: [_jsx("button", { "aria-label": "Start new conversation", className: "flex size-8.5 cursor-pointer items-center justify-center rounded-lg bg-transparent text-assistant-muted hover:bg-assistant-subtle hover:text-assistant-foreground focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent", onClick: onNewThread, type: "button", children: _jsx(NewThreadIcon, {}) }), _jsx("button", { "aria-label": "Close Mintlify Assistant", className: "flex size-8.5 cursor-pointer items-center justify-center rounded-lg bg-transparent text-assistant-muted hover:bg-assistant-subtle hover:text-assistant-foreground focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent", onClick: onClose, type: "button", children: _jsx(CloseIcon, {}) })] })] })); | ||
| } | ||
| //# sourceMappingURL=assistant-panel-header.js.map |
| {"version":3,"file":"assistant-panel-header.js","sourceRoot":"","sources":["../../src/ui/assistant-panel-header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAOnE,MAAM,UAAU,oBAAoB,CAAC,EAAE,OAAO,EAAE,WAAW,EAA6B;IACtF,OAAO,CACL,kBAAQ,SAAS,EAAC,sGAAsG,aACtH,eAAK,SAAS,EAAC,kEAAkE,aAC/E,eAAM,SAAS,EAAC,4BAA4B,YAC1C,KAAC,WAAW,IAAC,IAAI,EAAE,EAAE,GAAI,GACpB,EACP,uCAAsB,IAClB,EACN,eAAK,SAAS,EAAC,2BAA2B,aACxC,+BACa,wBAAwB,EACnC,SAAS,EAAC,qQAAqQ,EAC/Q,OAAO,EAAE,WAAW,EACpB,IAAI,EAAC,QAAQ,YAEb,KAAC,aAAa,KAAG,GACV,EACT,+BACa,0BAA0B,EACrC,SAAS,EAAC,qQAAqQ,EAC/Q,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,YAEb,KAAC,SAAS,KAAG,GACN,IACL,IACC,CACV,CAAC;AACJ,CAAC"} |
| export declare function AssistantThinkingIndicator(): import("react/jsx-runtime").JSX.Element; | ||
| //# sourceMappingURL=assistant-thinking-indicator.d.ts.map |
| {"version":3,"file":"assistant-thinking-indicator.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-thinking-indicator.tsx"],"names":[],"mappings":"AAAA,wBAAgB,0BAA0B,4CAWzC"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| export function AssistantThinkingIndicator() { | ||
| return (_jsxs("div", { "aria-label": "Mintlify Assistant is responding", className: "flex items-center gap-2 text-[13px] text-assistant-muted", role: "status", children: [_jsx("span", { className: "size-1.5 animate-assistant-pulse rounded-full bg-current motion-reduce:animate-none" }), _jsx("span", { children: "Thinking" })] })); | ||
| } | ||
| //# sourceMappingURL=assistant-thinking-indicator.js.map |
| {"version":3,"file":"assistant-thinking-indicator.js","sourceRoot":"","sources":["../../src/ui/assistant-thinking-indicator.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,0BAA0B;IACxC,OAAO,CACL,6BACa,kCAAkC,EAC7C,SAAS,EAAC,0DAA0D,EACpE,IAAI,EAAC,QAAQ,aAEb,eAAM,SAAS,EAAC,qFAAqF,GAAG,EACxG,sCAAqB,IACjB,CACP,CAAC;AACJ,CAAC"} |
| /*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */ | ||
| @layer properties; | ||
| @layer theme, base, components, utilities; | ||
| @layer theme { | ||
| :root, :host { | ||
| --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", | ||
| "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | ||
| --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", | ||
| "Courier New", monospace; | ||
| --spacing: 0.25rem; | ||
| --text-sm: 0.875rem; | ||
| --text-sm--line-height: calc(1.25 / 0.875); | ||
| --text-lg: 1.125rem; | ||
| --text-lg--line-height: calc(1.75 / 1.125); | ||
| --font-weight-semibold: 600; | ||
| --radius-lg: 0.5rem; | ||
| --radius-xl: 0.75rem; | ||
| --default-transition-duration: 150ms; | ||
| --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | ||
| --default-font-family: var(--font-sans); | ||
| --default-mono-font-family: var(--font-mono); | ||
| } | ||
| } | ||
| @layer base { | ||
| *, ::after, ::before, ::backdrop, ::file-selector-button { | ||
| box-sizing: border-box; | ||
| margin: 0; | ||
| padding: 0; | ||
| border: 0 solid; | ||
| } | ||
| html, :host { | ||
| line-height: 1.5; | ||
| -webkit-text-size-adjust: 100%; | ||
| tab-size: 4; | ||
| font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); | ||
| font-feature-settings: var(--default-font-feature-settings, normal); | ||
| font-variation-settings: var(--default-font-variation-settings, normal); | ||
| -webkit-tap-highlight-color: transparent; | ||
| } | ||
| hr { | ||
| height: 0; | ||
| color: inherit; | ||
| border-top-width: 1px; | ||
| } | ||
| abbr:where([title]) { | ||
| -webkit-text-decoration: underline dotted; | ||
| text-decoration: underline dotted; | ||
| } | ||
| h1, h2, h3, h4, h5, h6 { | ||
| font-size: inherit; | ||
| font-weight: inherit; | ||
| } | ||
| a { | ||
| color: inherit; | ||
| -webkit-text-decoration: inherit; | ||
| text-decoration: inherit; | ||
| } | ||
| b, strong { | ||
| font-weight: bolder; | ||
| } | ||
| code, kbd, samp, pre { | ||
| font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); | ||
| font-feature-settings: var(--default-mono-font-feature-settings, normal); | ||
| font-variation-settings: var(--default-mono-font-variation-settings, normal); | ||
| font-size: 1em; | ||
| } | ||
| small { | ||
| font-size: 80%; | ||
| } | ||
| sub, sup { | ||
| font-size: 75%; | ||
| line-height: 0; | ||
| position: relative; | ||
| vertical-align: baseline; | ||
| } | ||
| sub { | ||
| bottom: -0.25em; | ||
| } | ||
| sup { | ||
| top: -0.5em; | ||
| } | ||
| table { | ||
| text-indent: 0; | ||
| border-color: inherit; | ||
| border-collapse: collapse; | ||
| } | ||
| :-moz-focusring { | ||
| outline: auto; | ||
| } | ||
| progress { | ||
| vertical-align: baseline; | ||
| } | ||
| summary { | ||
| display: list-item; | ||
| } | ||
| ol, ul, menu { | ||
| list-style: none; | ||
| } | ||
| img, svg, video, canvas, audio, iframe, embed, object { | ||
| display: block; | ||
| vertical-align: middle; | ||
| } | ||
| img, video { | ||
| max-width: 100%; | ||
| height: auto; | ||
| } | ||
| button, input, select, optgroup, textarea, ::file-selector-button { | ||
| font: inherit; | ||
| font-feature-settings: inherit; | ||
| font-variation-settings: inherit; | ||
| letter-spacing: inherit; | ||
| color: inherit; | ||
| border-radius: 0; | ||
| background-color: transparent; | ||
| opacity: 1; | ||
| } | ||
| :where(select:is([multiple], [size])) optgroup { | ||
| font-weight: bolder; | ||
| } | ||
| :where(select:is([multiple], [size])) optgroup option { | ||
| padding-inline-start: 20px; | ||
| } | ||
| ::file-selector-button { | ||
| margin-inline-end: 4px; | ||
| } | ||
| ::placeholder { | ||
| opacity: 1; | ||
| } | ||
| @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) { | ||
| ::placeholder { | ||
| color: currentcolor; | ||
| @supports (color: color-mix(in lab, red, red)) { | ||
| color: color-mix(in oklab, currentcolor 50%, transparent); | ||
| } | ||
| } | ||
| } | ||
| textarea { | ||
| resize: vertical; | ||
| } | ||
| ::-webkit-search-decoration { | ||
| -webkit-appearance: none; | ||
| } | ||
| ::-webkit-date-and-time-value { | ||
| min-height: 1lh; | ||
| text-align: inherit; | ||
| } | ||
| ::-webkit-datetime-edit { | ||
| display: inline-flex; | ||
| } | ||
| ::-webkit-datetime-edit-fields-wrapper { | ||
| padding: 0; | ||
| } | ||
| ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field { | ||
| padding-block: 0; | ||
| } | ||
| ::-webkit-calendar-picker-indicator { | ||
| line-height: 1; | ||
| } | ||
| :-moz-ui-invalid { | ||
| box-shadow: none; | ||
| } | ||
| button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button { | ||
| appearance: button; | ||
| } | ||
| ::-webkit-inner-spin-button, ::-webkit-outer-spin-button { | ||
| height: auto; | ||
| } | ||
| [hidden]:where(:not([hidden="until-found"])) { | ||
| display: none !important; | ||
| } | ||
| } | ||
| @layer utilities { | ||
| .pointer-events-auto { | ||
| pointer-events: auto; | ||
| } | ||
| .pointer-events-none { | ||
| pointer-events: none; | ||
| } | ||
| .sr-only { | ||
| position: absolute; | ||
| width: 1px; | ||
| height: 1px; | ||
| padding: 0; | ||
| margin: -1px; | ||
| overflow: hidden; | ||
| clip-path: inset(50%); | ||
| white-space: nowrap; | ||
| border-width: 0; | ||
| } | ||
| .container { | ||
| width: 100%; | ||
| @media (width >= 40rem) { | ||
| max-width: 40rem; | ||
| } | ||
| @media (width >= 48rem) { | ||
| max-width: 48rem; | ||
| } | ||
| @media (width >= 64rem) { | ||
| max-width: 64rem; | ||
| } | ||
| @media (width >= 80rem) { | ||
| max-width: 80rem; | ||
| } | ||
| @media (width >= 96rem) { | ||
| max-width: 96rem; | ||
| } | ||
| } | ||
| .m-0 { | ||
| margin: 0; | ||
| } | ||
| .m-6 { | ||
| margin: calc(var(--spacing) * 6); | ||
| } | ||
| .mx-0 { | ||
| margin-inline: 0; | ||
| } | ||
| .mt-1\.5 { | ||
| margin-top: calc(var(--spacing) * 1.5); | ||
| } | ||
| .mt-2 { | ||
| margin-top: calc(var(--spacing) * 2); | ||
| } | ||
| .mb-0 { | ||
| margin-bottom: 0; | ||
| } | ||
| .mb-3 { | ||
| margin-bottom: calc(var(--spacing) * 3); | ||
| } | ||
| .ml-1 { | ||
| margin-left: var(--spacing); | ||
| } | ||
| .flex { | ||
| display: flex; | ||
| } | ||
| .size-1\.5 { | ||
| width: calc(var(--spacing) * 1.5); | ||
| height: calc(var(--spacing) * 1.5); | ||
| } | ||
| .size-8\.5 { | ||
| width: calc(var(--spacing) * 8.5); | ||
| height: calc(var(--spacing) * 8.5); | ||
| } | ||
| .size-13 { | ||
| width: calc(var(--spacing) * 13); | ||
| height: calc(var(--spacing) * 13); | ||
| } | ||
| .h-9\.5 { | ||
| height: calc(var(--spacing) * 9.5); | ||
| } | ||
| .h-\[min\(620px\,calc\(100vh-116px\)\)\] { | ||
| height: min(620px, calc(100vh - 116px)); | ||
| } | ||
| .max-h-\[120px\] { | ||
| max-height: 120px; | ||
| } | ||
| .min-h-9\.5 { | ||
| min-height: calc(var(--spacing) * 9.5); | ||
| } | ||
| .min-h-14 { | ||
| min-height: calc(var(--spacing) * 14); | ||
| } | ||
| .min-h-\[220px\] { | ||
| min-height: 220px; | ||
| } | ||
| .w-\[min\(400px\,calc\(100vw-32px\)\)\] { | ||
| width: min(400px, calc(100vw - 32px)); | ||
| } | ||
| .max-w-\[88\%\] { | ||
| max-width: 88%; | ||
| } | ||
| .max-w-\[260px\] { | ||
| max-width: 260px; | ||
| } | ||
| .min-w-14\.5 { | ||
| min-width: calc(var(--spacing) * 14.5); | ||
| } | ||
| .flex-1 { | ||
| flex: 1; | ||
| } | ||
| .flex-none { | ||
| flex: none; | ||
| } | ||
| .animate-assistant-pulse { | ||
| animation: assistant-pulse 1s ease-in-out infinite; | ||
| } | ||
| .cursor-pointer { | ||
| cursor: pointer; | ||
| } | ||
| .resize-none { | ||
| resize: none; | ||
| } | ||
| .flex-col { | ||
| flex-direction: column; | ||
| } | ||
| .items-center { | ||
| align-items: center; | ||
| } | ||
| .items-end { | ||
| align-items: flex-end; | ||
| } | ||
| .justify-between { | ||
| justify-content: space-between; | ||
| } | ||
| .justify-center { | ||
| justify-content: center; | ||
| } | ||
| .gap-0\.5 { | ||
| gap: calc(var(--spacing) * 0.5); | ||
| } | ||
| .gap-1\.5 { | ||
| gap: calc(var(--spacing) * 1.5); | ||
| } | ||
| .gap-2 { | ||
| gap: calc(var(--spacing) * 2); | ||
| } | ||
| .gap-3 { | ||
| gap: calc(var(--spacing) * 3); | ||
| } | ||
| .gap-4 { | ||
| gap: calc(var(--spacing) * 4); | ||
| } | ||
| .self-end { | ||
| align-self: flex-end; | ||
| } | ||
| .self-start { | ||
| align-self: flex-start; | ||
| } | ||
| .overflow-hidden { | ||
| overflow: hidden; | ||
| } | ||
| .overflow-y-auto { | ||
| overflow-y: auto; | ||
| } | ||
| .scroll-smooth { | ||
| scroll-behavior: smooth; | ||
| } | ||
| .rounded-\[10px\] { | ||
| border-radius: 10px; | ||
| } | ||
| .rounded-\[14px\] { | ||
| border-radius: 14px; | ||
| } | ||
| .rounded-assistant { | ||
| border-radius: var(--assistant-radius); | ||
| } | ||
| .rounded-full { | ||
| border-radius: calc(infinity * 1px); | ||
| } | ||
| .rounded-lg { | ||
| border-radius: var(--radius-lg); | ||
| } | ||
| .rounded-xl { | ||
| border-radius: var(--radius-xl); | ||
| } | ||
| .border { | ||
| border-style: var(--tw-border-style); | ||
| border-width: 1px; | ||
| } | ||
| .border-t { | ||
| border-top-style: var(--tw-border-style); | ||
| border-top-width: 1px; | ||
| } | ||
| .border-b { | ||
| border-bottom-style: var(--tw-border-style); | ||
| border-bottom-width: 1px; | ||
| } | ||
| .border-assistant-border { | ||
| border-color: var(--assistant-border); | ||
| } | ||
| .border-assistant-error-border { | ||
| border-color: var(--assistant-error-border); | ||
| } | ||
| .border-transparent { | ||
| border-color: transparent; | ||
| } | ||
| .bg-assistant-accent { | ||
| background-color: var(--assistant-accent); | ||
| } | ||
| .bg-assistant-background { | ||
| background-color: var(--assistant-background); | ||
| } | ||
| .bg-assistant-error-background { | ||
| background-color: var(--assistant-error-background); | ||
| } | ||
| .bg-assistant-subtle { | ||
| background-color: var(--assistant-subtle); | ||
| } | ||
| .bg-current { | ||
| background-color: currentcolor; | ||
| } | ||
| .bg-transparent { | ||
| background-color: transparent; | ||
| } | ||
| .p-0 { | ||
| padding: 0; | ||
| } | ||
| .p-2 { | ||
| padding: calc(var(--spacing) * 2); | ||
| } | ||
| .p-3 { | ||
| padding: calc(var(--spacing) * 3); | ||
| } | ||
| .p-4 { | ||
| padding: calc(var(--spacing) * 4); | ||
| } | ||
| .px-1 { | ||
| padding-inline: var(--spacing); | ||
| } | ||
| .px-3 { | ||
| padding-inline: calc(var(--spacing) * 3); | ||
| } | ||
| .py-0 { | ||
| padding-block: 0; | ||
| } | ||
| .py-2\.5 { | ||
| padding-block: calc(var(--spacing) * 2.5); | ||
| } | ||
| .pr-3 { | ||
| padding-right: calc(var(--spacing) * 3); | ||
| } | ||
| .pl-4 { | ||
| padding-left: calc(var(--spacing) * 4); | ||
| } | ||
| .text-center { | ||
| text-align: center; | ||
| } | ||
| .text-lg { | ||
| font-size: var(--text-lg); | ||
| line-height: var(--tw-leading, var(--text-lg--line-height)); | ||
| } | ||
| .text-sm { | ||
| font-size: var(--text-sm); | ||
| line-height: var(--tw-leading, var(--text-sm--line-height)); | ||
| } | ||
| .text-\[11px\] { | ||
| font-size: 11px; | ||
| } | ||
| .text-\[13px\] { | ||
| font-size: 13px; | ||
| } | ||
| .leading-6 { | ||
| --tw-leading: calc(var(--spacing) * 6); | ||
| line-height: calc(var(--spacing) * 6); | ||
| } | ||
| .leading-\[1\.45\] { | ||
| --tw-leading: 1.45; | ||
| line-height: 1.45; | ||
| } | ||
| .leading-\[1\.55\] { | ||
| --tw-leading: 1.55; | ||
| line-height: 1.55; | ||
| } | ||
| .font-semibold { | ||
| --tw-font-weight: var(--font-weight-semibold); | ||
| font-weight: var(--font-weight-semibold); | ||
| } | ||
| .tracking-\[-0\.01em\] { | ||
| --tw-tracking: -0.01em; | ||
| letter-spacing: -0.01em; | ||
| } | ||
| .tracking-\[-0\.02em\] { | ||
| --tw-tracking: -0.02em; | ||
| letter-spacing: -0.02em; | ||
| } | ||
| .tracking-\[0\.04em\] { | ||
| --tw-tracking: 0.04em; | ||
| letter-spacing: 0.04em; | ||
| } | ||
| .\[overflow-wrap\:anywhere\] { | ||
| overflow-wrap: anywhere; | ||
| } | ||
| .whitespace-pre-wrap { | ||
| white-space: pre-wrap; | ||
| } | ||
| .text-assistant-accent { | ||
| color: var(--assistant-accent); | ||
| } | ||
| .text-assistant-accent-foreground { | ||
| color: var(--assistant-accent-foreground); | ||
| } | ||
| .text-assistant-foreground { | ||
| color: var(--assistant-foreground); | ||
| } | ||
| .text-assistant-muted { | ||
| color: var(--assistant-muted); | ||
| } | ||
| .uppercase { | ||
| text-transform: uppercase; | ||
| } | ||
| .underline { | ||
| text-decoration-line: underline; | ||
| } | ||
| .underline-offset-2 { | ||
| text-underline-offset: 2px; | ||
| } | ||
| .shadow-assistant-launcher { | ||
| --tw-shadow: 0 16px 40px var(--tw-shadow-color, color-mix(in srgb, CanvasText 20%, transparent)), 0 2px 8px var(--tw-shadow-color, color-mix(in srgb, CanvasText 14%, transparent)); | ||
| box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); | ||
| } | ||
| .shadow-assistant-panel { | ||
| --tw-shadow: 0 24px 72px var(--tw-shadow-color, color-mix(in srgb, CanvasText 20%, transparent)), 0 4px 16px var(--tw-shadow-color, color-mix(in srgb, CanvasText 10%, transparent)); | ||
| box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); | ||
| } | ||
| .transition-\[transform\,box-shadow\] { | ||
| transition-property: transform,box-shadow; | ||
| transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)); | ||
| transition-duration: var(--tw-duration, var(--default-transition-duration)); | ||
| } | ||
| .duration-150 { | ||
| --tw-duration: 150ms; | ||
| transition-duration: 150ms; | ||
| } | ||
| .outline-none { | ||
| --tw-outline-style: none; | ||
| outline-style: none; | ||
| } | ||
| .placeholder\:text-assistant-muted { | ||
| &::placeholder { | ||
| color: var(--assistant-muted); | ||
| } | ||
| } | ||
| .focus-within\:border-assistant-accent { | ||
| &:focus-within { | ||
| border-color: var(--assistant-accent); | ||
| } | ||
| } | ||
| .focus-within\:ring-\[3px\] { | ||
| &:focus-within { | ||
| --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor); | ||
| box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); | ||
| } | ||
| } | ||
| .focus-within\:ring-assistant-accent\/15 { | ||
| &:focus-within { | ||
| --tw-ring-color: var(--assistant-accent); | ||
| @supports (color: color-mix(in lab, red, red)) { | ||
| --tw-ring-color: color-mix(in oklab, var(--assistant-accent) 15%, transparent); | ||
| } | ||
| } | ||
| } | ||
| .hover\:-translate-y-px { | ||
| &:hover { | ||
| @media (hover: hover) { | ||
| --tw-translate-y: -1px; | ||
| translate: var(--tw-translate-x) var(--tw-translate-y); | ||
| } | ||
| } | ||
| } | ||
| .hover\:bg-assistant-subtle { | ||
| &:hover { | ||
| @media (hover: hover) { | ||
| background-color: var(--assistant-subtle); | ||
| } | ||
| } | ||
| } | ||
| .hover\:text-assistant-foreground { | ||
| &:hover { | ||
| @media (hover: hover) { | ||
| color: var(--assistant-foreground); | ||
| } | ||
| } | ||
| } | ||
| .hover\:shadow-assistant-launcher-hover { | ||
| &:hover { | ||
| @media (hover: hover) { | ||
| --tw-shadow: 0 18px 44px var(--tw-shadow-color, color-mix(in srgb, CanvasText 24%, transparent)), 0 3px 10px var(--tw-shadow-color, color-mix(in srgb, CanvasText 18%, transparent)); | ||
| box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); | ||
| } | ||
| } | ||
| } | ||
| .focus-visible\:outline-2 { | ||
| &:focus-visible { | ||
| outline-style: var(--tw-outline-style); | ||
| outline-width: 2px; | ||
| } | ||
| } | ||
| .focus-visible\:outline-offset-\[3px\] { | ||
| &:focus-visible { | ||
| outline-offset: 3px; | ||
| } | ||
| } | ||
| .focus-visible\:outline-assistant-accent { | ||
| &:focus-visible { | ||
| outline-color: var(--assistant-accent); | ||
| } | ||
| } | ||
| .disabled\:cursor-default { | ||
| &:disabled { | ||
| cursor: default; | ||
| } | ||
| } | ||
| .disabled\:cursor-not-allowed { | ||
| &:disabled { | ||
| cursor: not-allowed; | ||
| } | ||
| } | ||
| .disabled\:opacity-50 { | ||
| &:disabled { | ||
| opacity: 50%; | ||
| } | ||
| } | ||
| .motion-reduce\:animate-none { | ||
| @media (prefers-reduced-motion: reduce) { | ||
| animation: none; | ||
| } | ||
| } | ||
| .motion-reduce\:scroll-auto { | ||
| @media (prefers-reduced-motion: reduce) { | ||
| scroll-behavior: auto; | ||
| } | ||
| } | ||
| .motion-reduce\:transition-none { | ||
| @media (prefers-reduced-motion: reduce) { | ||
| transition-property: none; | ||
| } | ||
| } | ||
| .max-\[520px\]\:m-4 { | ||
| @media (width < 520px) { | ||
| margin: calc(var(--spacing) * 4); | ||
| } | ||
| } | ||
| .max-\[520px\]\:h-\[min\(680px\,calc\(100vh-88px\)\)\] { | ||
| @media (width < 520px) { | ||
| height: min(680px, calc(100vh - 88px)); | ||
| } | ||
| } | ||
| .max-\[520px\]\:w-\[calc\(100vw-32px\)\] { | ||
| @media (width < 520px) { | ||
| width: calc(100vw - 32px); | ||
| } | ||
| } | ||
| } | ||
| @layer base { | ||
| :host { | ||
| all: initial !important; | ||
| --mintlify-assistant-z-index: 2147483000; | ||
| --assistant-default-background: #ffffff; | ||
| --assistant-default-foreground: #111827; | ||
| --assistant-default-border: rgb(17 24 39 / 12%); | ||
| --assistant-background: var( | ||
| --mintlify-assistant-background-color, | ||
| var(--assistant-default-background) | ||
| ); | ||
| --assistant-foreground: var( | ||
| --mintlify-assistant-foreground-color, | ||
| var(--assistant-default-foreground) | ||
| ); | ||
| --assistant-accent: var(--mintlify-assistant-accent-color, AccentColor); | ||
| --assistant-accent-foreground: AccentColorText; | ||
| --assistant-border: var(--mintlify-assistant-border-color, var(--assistant-default-border)); | ||
| --assistant-radius: var(--mintlify-assistant-border-radius, 18px); | ||
| --assistant-muted: var(--assistant-foreground); | ||
| @supports (color: color-mix(in lab, red, red)) { | ||
| --assistant-muted: color-mix(in srgb, var(--assistant-foreground) 62%, transparent); | ||
| } | ||
| --assistant-subtle: var(--assistant-foreground); | ||
| @supports (color: color-mix(in lab, red, red)) { | ||
| --assistant-subtle: color-mix( | ||
| in srgb, | ||
| var(--assistant-foreground) 6%, | ||
| var(--assistant-background) | ||
| ); | ||
| } | ||
| --assistant-error-background: Mark; | ||
| @supports (color: color-mix(in lab, red, red)) { | ||
| --assistant-error-background: color-mix(in srgb, Mark 20%, var(--assistant-background)); | ||
| } | ||
| --assistant-error-border: color-mix(in srgb, MarkText 20%, transparent); | ||
| color-scheme: light; | ||
| display: block !important; | ||
| font-family: var(--mintlify-assistant-font-family, ui-sans-serif), system-ui, sans-serif !important; | ||
| font-size: 16px !important; | ||
| font-style: normal !important; | ||
| font-weight: 400 !important; | ||
| line-height: 1.5 !important; | ||
| position: fixed !important; | ||
| inset: auto 0 0 auto !important; | ||
| isolation: isolate !important; | ||
| text-align: start !important; | ||
| z-index: var(--mintlify-assistant-z-index) !important; | ||
| } | ||
| :host([data-theme='dark']) { | ||
| --assistant-default-background: #111827; | ||
| --assistant-default-foreground: #f9fafb; | ||
| --assistant-default-border: rgb(255 255 255 / 14%); | ||
| color-scheme: dark; | ||
| } | ||
| @media (prefers-color-scheme: dark) { | ||
| :host([data-theme='system']) { | ||
| --assistant-default-background: #111827; | ||
| --assistant-default-foreground: #f9fafb; | ||
| --assistant-default-border: rgb(255 255 255 / 14%); | ||
| color-scheme: dark; | ||
| } | ||
| } | ||
| } | ||
| @property --tw-border-style { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: solid; | ||
| } | ||
| @property --tw-leading { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-font-weight { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-tracking { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-shadow { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0 0 #0000; | ||
| } | ||
| @property --tw-shadow-color { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-shadow-alpha { | ||
| syntax: "<percentage>"; | ||
| inherits: false; | ||
| initial-value: 100%; | ||
| } | ||
| @property --tw-inset-shadow { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0 0 #0000; | ||
| } | ||
| @property --tw-inset-shadow-color { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-inset-shadow-alpha { | ||
| syntax: "<percentage>"; | ||
| inherits: false; | ||
| initial-value: 100%; | ||
| } | ||
| @property --tw-ring-color { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-ring-shadow { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0 0 #0000; | ||
| } | ||
| @property --tw-inset-ring-color { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-inset-ring-shadow { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0 0 #0000; | ||
| } | ||
| @property --tw-ring-inset { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-ring-offset-width { | ||
| syntax: "<length>"; | ||
| inherits: false; | ||
| initial-value: 0px; | ||
| } | ||
| @property --tw-ring-offset-color { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: #fff; | ||
| } | ||
| @property --tw-ring-offset-shadow { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0 0 #0000; | ||
| } | ||
| @property --tw-duration { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| } | ||
| @property --tw-translate-x { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0; | ||
| } | ||
| @property --tw-translate-y { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0; | ||
| } | ||
| @property --tw-translate-z { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: 0; | ||
| } | ||
| @property --tw-outline-style { | ||
| syntax: "*"; | ||
| inherits: false; | ||
| initial-value: solid; | ||
| } | ||
| @keyframes assistant-pulse { | ||
| 0%, 100% { | ||
| opacity: 0.35; | ||
| transform: scale(0.85); | ||
| } | ||
| 50% { | ||
| opacity: 1; | ||
| transform: scale(1); | ||
| } | ||
| } | ||
| @layer properties { | ||
| @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) { | ||
| *, ::before, ::after, ::backdrop { | ||
| --tw-border-style: solid; | ||
| --tw-leading: initial; | ||
| --tw-font-weight: initial; | ||
| --tw-tracking: initial; | ||
| --tw-shadow: 0 0 #0000; | ||
| --tw-shadow-color: initial; | ||
| --tw-shadow-alpha: 100%; | ||
| --tw-inset-shadow: 0 0 #0000; | ||
| --tw-inset-shadow-color: initial; | ||
| --tw-inset-shadow-alpha: 100%; | ||
| --tw-ring-color: initial; | ||
| --tw-ring-shadow: 0 0 #0000; | ||
| --tw-inset-ring-color: initial; | ||
| --tw-inset-ring-shadow: 0 0 #0000; | ||
| --tw-ring-inset: initial; | ||
| --tw-ring-offset-width: 0px; | ||
| --tw-ring-offset-color: #fff; | ||
| --tw-ring-offset-shadow: 0 0 #0000; | ||
| --tw-duration: initial; | ||
| --tw-translate-x: 0; | ||
| --tw-translate-y: 0; | ||
| --tw-translate-z: 0; | ||
| --tw-outline-style: solid; | ||
| } | ||
| } | ||
| } |
| import type { AssistantWidgetActions, AssistantWidgetClient, AssistantWidgetSnapshot } from './types.js'; | ||
| type AssistantWidgetProps = Readonly<{ | ||
| actions: AssistantWidgetActions; | ||
| client: AssistantWidgetClient; | ||
| focusRequest: number; | ||
| snapshot: AssistantWidgetSnapshot; | ||
| }>; | ||
| export declare function AssistantWidget({ actions, client, focusRequest, snapshot }: AssistantWidgetProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=assistant-widget.d.ts.map |
| {"version":3,"file":"assistant-widget.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-widget.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,KAAK,oBAAoB,GAAG,QAAQ,CAAC;IACnC,OAAO,EAAE,sBAAsB,CAAC;IAChC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,uBAAuB,CAAC;CACnC,CAAC,CAAC;AAEH,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAuGhG"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| import { useEffect, useRef, useState, useSyncExternalStore, } from 'react'; | ||
| import { AssistantComposer } from './assistant-composer.js'; | ||
| import { AssistantConversation } from './assistant-conversation.js'; | ||
| import { AssistantLauncher } from './assistant-launcher.js'; | ||
| import { AssistantPanelHeader } from './assistant-panel-header.js'; | ||
| export function AssistantWidget({ actions, client, focusRequest, snapshot }) { | ||
| var _a, _b, _c, _d, _e; | ||
| const assistantSnapshot = useSyncExternalStore(client.subscribe, client.getSnapshot, client.getSnapshot); | ||
| const [input, setInput] = useState(''); | ||
| const composerRef = useRef(null); | ||
| const formRef = useRef(null); | ||
| const launcherRef = useRef(null); | ||
| const messagesRef = useRef(null); | ||
| const handledFocusRequest = useRef(0); | ||
| const isBusy = assistantSnapshot.status === 'submitted' || assistantSnapshot.status === 'streaming'; | ||
| const lastMessage = assistantSnapshot.messages.at(-1); | ||
| const lastMessageContent = (_a = lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.content) !== null && _a !== void 0 ? _a : ''; | ||
| const showThinking = isBusy && ((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.role) !== 'assistant' || lastMessage.content.length === 0); | ||
| useEffect(() => { | ||
| if (focusRequest === 0 || handledFocusRequest.current === focusRequest) | ||
| return; | ||
| handledFocusRequest.current = focusRequest; | ||
| const target = snapshot.isOpen ? composerRef.current : launcherRef.current; | ||
| target === null || target === void 0 ? void 0 : target.focus(); | ||
| }, [focusRequest, snapshot.isOpen]); | ||
| useEffect(() => { | ||
| const messages = messagesRef.current; | ||
| if (!messages) | ||
| return; | ||
| messages.scrollTop = messages.scrollHeight; | ||
| }, [assistantSnapshot.messages.length, lastMessageContent]); | ||
| const submit = (event) => { | ||
| event.preventDefault(); | ||
| const content = input.trim(); | ||
| if (content.length === 0 || isBusy) | ||
| return; | ||
| setInput(''); | ||
| void actions.ask(content).catch(() => { | ||
| // Core publishes the normalized error snapshot consumed by this component. | ||
| }); | ||
| }; | ||
| const handleComposerKeyDown = (event) => { | ||
| var _a; | ||
| if (event.key !== 'Enter' || event.shiftKey || event.nativeEvent.isComposing) | ||
| return; | ||
| event.preventDefault(); | ||
| (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.requestSubmit(); | ||
| }; | ||
| const handleNewThread = () => { | ||
| var _a; | ||
| client.newThread(); | ||
| setInput(''); | ||
| (_a = composerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); | ||
| }; | ||
| const handleRetry = () => { | ||
| void client.retry().catch(() => { | ||
| // Core publishes the normalized error snapshot consumed by this component. | ||
| }); | ||
| }; | ||
| const showLauncher = snapshot.surface === 'floating-widget' && !snapshot.isOpen; | ||
| const errorMessage = (_c = (_b = assistantSnapshot.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : (assistantSnapshot.unavailable.unavailable ? assistantSnapshot.unavailable.message : undefined); | ||
| return (_jsxs("div", { className: "pointer-events-none m-6 flex flex-col items-end gap-3 max-[520px]:m-4", "data-mintlify-assistant-viewport": "", children: [snapshot.isOpen ? (_jsxs("section", { "aria-label": "Mintlify Assistant", "aria-modal": false, className: "pointer-events-auto flex h-[min(620px,calc(100vh-116px))] w-[min(400px,calc(100vw-32px))] flex-col overflow-hidden rounded-assistant border border-assistant-border bg-assistant-background text-assistant-foreground shadow-assistant-panel max-[520px]:h-[min(680px,calc(100vh-88px))] max-[520px]:w-[calc(100vw-32px)]", "data-mintlify-assistant-panel": "", role: "dialog", children: [_jsx(AssistantPanelHeader, { onClose: actions.close, onNewThread: handleNewThread }), _jsx(AssistantConversation, { errorMessage: errorMessage, messages: assistantSnapshot.messages, messagesRef: messagesRef, onRetry: handleRetry, retryable: (_e = (_d = assistantSnapshot.error) === null || _d === void 0 ? void 0 : _d.retryable) !== null && _e !== void 0 ? _e : false, showThinking: showThinking }), _jsx(AssistantComposer, { composerRef: composerRef, formRef: formRef, input: input, isBusy: isBusy, onAbort: client.abort, onInputChange: setInput, onKeyDown: handleComposerKeyDown, onSubmit: submit })] })) : null, showLauncher ? _jsx(AssistantLauncher, { launcherRef: launcherRef, onOpen: actions.open }) : null] })); | ||
| } | ||
| //# sourceMappingURL=assistant-widget.js.map |
| {"version":3,"file":"assistant-widget.js","sourceRoot":"","sources":["../../src/ui/assistant-widget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EACT,MAAM,EACN,QAAQ,EACR,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAcnE,MAAM,UAAU,eAAe,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAwB;;IAC/F,MAAM,iBAAiB,GAA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CAAC,CAAC,KAAC,iBAAiB,IAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,IACxF,CACP,CAAC;AACJ,CAAC"} |
| type SparkleIconProps = Readonly<{ | ||
| size?: number; | ||
| }>; | ||
| export declare function SparkleIcon({ size }: SparkleIconProps): import("react/jsx-runtime").JSX.Element; | ||
| export declare function CloseIcon(): import("react/jsx-runtime").JSX.Element; | ||
| export declare function NewThreadIcon(): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=icons.d.ts.map |
| {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/ui/icons.tsx"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,QAAQ,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,wBAAgB,WAAW,CAAC,EAAE,IAAS,EAAE,EAAE,gBAAgB,2CAc1D;AAED,wBAAgB,SAAS,4CAWxB;AAED,wBAAgB,aAAa,4CAM5B"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| export function SparkleIcon({ size = 20 }) { | ||
| return (_jsxs("svg", { "aria-hidden": "true", fill: "none", height: size, viewBox: "0 0 24 24", width: size, children: [_jsx("path", { d: "M12 2.75c.5 4.75 2.5 6.75 7.25 7.25-4.75.5-6.75 2.5-7.25 7.25-.5-4.75-2.5-6.75-7.25-7.25C9.5 9.5 11.5 7.5 12 2.75Z", fill: "currentColor" }), _jsx("path", { d: "M18.5 15.75c.2 1.9 1.1 2.8 3 3-1.9.2-2.8 1.1-3 3-.2-1.9-1.1-2.8-3-3 1.9-.2 2.8-1.1 3-3Z", fill: "currentColor", opacity: "0.7" })] })); | ||
| } | ||
| export function CloseIcon() { | ||
| return (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "18", viewBox: "0 0 24 24", width: "18", children: _jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "1.8" }) })); | ||
| } | ||
| export function NewThreadIcon() { | ||
| return (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "18", viewBox: "0 0 24 24", width: "18", children: _jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "1.8" }) })); | ||
| } | ||
| //# sourceMappingURL=icons.js.map |
| {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/ui/icons.tsx"],"names":[],"mappings":";AAIA,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,GAAG,EAAE,EAAoB;IACzD,OAAO,CACL,8BAAiB,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,IAAI,aAC/E,eACE,CAAC,EAAC,oHAAoH,EACtH,IAAI,EAAC,cAAc,GACnB,EACF,eACE,CAAC,EAAC,yFAAyF,EAC3F,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,KAAK,GACb,IACE,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,CACL,6BAAiB,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,YAC5E,eACE,CAAC,EAAC,sBAAsB,EACxB,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,WAAW,EAAC,KAAK,GACjB,GACE,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,6BAAiB,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,YAC5E,eAAM,CAAC,EAAC,kBAAkB,EAAC,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,GAAG,GACvF,CACP,CAAC;AACJ,CAAC"} |
| import type { AssistantWidgetHandle, AssistantWidgetMountOptions } from './types.js'; | ||
| export declare function mountAssistantWidget({ actions, client, root, snapshot: initialSnapshot, styleNonce, }: AssistantWidgetMountOptions): AssistantWidgetHandle; | ||
| //# sourceMappingURL=mount-assistant-widget.d.ts.map |
| {"version":3,"file":"mount-assistant-widget.d.ts","sourceRoot":"","sources":["../../src/ui/mount-assistant-widget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,qBAAqB,EACrB,2BAA2B,EAE5B,MAAM,YAAY,CAAC;AAIpB,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EAAE,eAAe,EACzB,UAAU,GACX,EAAE,2BAA2B,GAAG,qBAAqB,CA0CrD"} |
| import { jsx as _jsx } from "react/jsx-runtime"; | ||
| import { createRoot } from 'react-dom/client'; | ||
| import { AssistantWidget } from './assistant-widget.js'; | ||
| const ASSISTANT_STYLESHEET_URL = new URL('./assistant-widget.css', import.meta.url).href; | ||
| export function mountAssistantWidget({ actions, client, root, snapshot: initialSnapshot, styleNonce, }) { | ||
| const ownerDocument = root.ownerDocument; | ||
| const stylesheet = ownerDocument.createElement('link'); | ||
| stylesheet.href = ASSISTANT_STYLESHEET_URL; | ||
| stylesheet.rel = 'stylesheet'; | ||
| if (styleNonce) | ||
| stylesheet.nonce = styleNonce; | ||
| const container = ownerDocument.createElement('div'); | ||
| root.append(stylesheet, container); | ||
| const reactRoot = createRoot(container); | ||
| let focusRequest = 0; | ||
| let snapshot = initialSnapshot; | ||
| const render = () => { | ||
| reactRoot.render(_jsx(AssistantWidget, { actions: actions, client: client, focusRequest: focusRequest, snapshot: snapshot })); | ||
| }; | ||
| render(); | ||
| return { | ||
| update(nextSnapshot) { | ||
| snapshot = nextSnapshot; | ||
| render(); | ||
| }, | ||
| focus() { | ||
| focusRequest += 1; | ||
| render(); | ||
| }, | ||
| destroy() { | ||
| reactRoot.unmount(); | ||
| container.remove(); | ||
| stylesheet.remove(); | ||
| }, | ||
| }; | ||
| } | ||
| //# sourceMappingURL=mount-assistant-widget.js.map |
| {"version":3,"file":"mount-assistant-widget.js","sourceRoot":"","sources":["../../src/ui/mount-assistant-widget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEzF,MAAM,UAAU,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EAAE,eAAe,EACzB,UAAU,GACkB;IAC5B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IACzC,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACvD,UAAU,CAAC,IAAI,GAAG,wBAAwB,CAAC;IAC3C,UAAU,CAAC,GAAG,GAAG,YAAY,CAAC;IAC9B,IAAI,UAAU;QAAE,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC;IAE9C,MAAM,SAAS,GAAG,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,QAAQ,GAA4B,eAAe,CAAC;IAExD,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,SAAS,CAAC,MAAM,CACd,KAAC,eAAe,IACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,EAAE,CAAC;IAET,OAAO;QACL,MAAM,CAAC,YAAY;YACjB,QAAQ,GAAG,YAAY,CAAC;YACxB,MAAM,EAAE,CAAC;QACX,CAAC;QACD,KAAK;YACH,YAAY,IAAI,CAAC,CAAC;YAClB,MAAM,EAAE,CAAC;QACX,CAAC;QACD,OAAO;YACL,SAAS,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,MAAM,EAAE,CAAC;YACnB,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"} |
| import type { AssistantCore, AssistantSurface } from '@mintlify/assistant-core'; | ||
| export type AssistantWidgetClient = Readonly<Pick<AssistantCore, 'send' | 'abort' | 'retry' | 'newThread' | 'getSnapshot' | 'subscribe'>>; | ||
| export type AssistantWidgetSnapshot = Readonly<{ | ||
| isDestroyed: boolean; | ||
| isOpen: boolean; | ||
| entryPoint: string; | ||
| surface: Exclude<AssistantSurface, 'headless'>; | ||
| theme: 'light' | 'dark' | 'system'; | ||
| }>; | ||
| export type AssistantWidgetActions = Readonly<{ | ||
| open: () => void; | ||
| close: () => void; | ||
| ask: (content: string) => Promise<void>; | ||
| }>; | ||
| export type AssistantWidgetMountOptions = Readonly<{ | ||
| actions: AssistantWidgetActions; | ||
| client: AssistantWidgetClient; | ||
| root: ShadowRoot; | ||
| snapshot: AssistantWidgetSnapshot; | ||
| styleNonce?: string; | ||
| }>; | ||
| export type AssistantWidgetHandle = Readonly<{ | ||
| update: (snapshot: AssistantWidgetSnapshot) => void; | ||
| focus: () => void; | ||
| destroy: () => void; | ||
| }>; | ||
| //# sourceMappingURL=types.d.ts.map |
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ui/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAC1C,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,aAAa,GAAG,WAAW,CAAC,CAC5F,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC/C,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IACjD,OAAO,EAAE,sBAAsB,CAAC;IAChC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,MAAM,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC,CAAC"} |
| export {}; | ||
| //# sourceMappingURL=types.js.map |
| {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ui/types.ts"],"names":[],"mappings":""} |
| import type { RefObject } from 'react'; | ||
| type AssistantLauncherProps = Readonly<{ | ||
| launcherRef: RefObject<HTMLButtonElement | null>; | ||
| onOpen: () => void; | ||
| }>; | ||
| export declare function AssistantLauncher({ launcherRef, onOpen }: AssistantLauncherProps): import("react/jsx-runtime").JSX.Element; | ||
| export {}; | ||
| //# sourceMappingURL=launcher.d.ts.map |
| {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../src/widget/shell/launcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,sBAAsB,GAAG,QAAQ,CAAC;IACrC,WAAW,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,sBAAsB,2CAsBhF"} |
| import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| import { cn } from '../../utils/cn'; | ||
| import { MintlifyMarkIcon } from '../primitives/icons'; | ||
| export function AssistantLauncher({ launcherRef, onOpen }) { | ||
| return (_jsxs("button", { "aria-label": "Open Mintlify Assistant", className: cn('assistant-launcher-elevation pointer-events-auto flex', 'cursor-pointer items-center justify-center gap-3 rounded-full px-4 py-3', 'bg-assistant-accent text-assistant-accent-foreground typography-body-m-semibold', 'animate-assistant-launcher-enter transition-[transform,box-shadow] duration-200 ease-out', 'hover:-translate-y-px hover:scale-[1.04] active:translate-y-0 active:scale-[0.98]', 'focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-assistant-accent', 'motion-reduce:animate-none motion-reduce:transition-none'), "data-mintlify-assistant-launcher": "", onClick: onOpen, ref: launcherRef, type: "button", children: [_jsx(MintlifyMarkIcon, { size: 22 }), "Ask AI"] })); | ||
| } | ||
| //# sourceMappingURL=launcher.js.map |
| {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../src/widget/shell/launcher.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD,MAAM,UAAU,iBAAiB,CAAC,EAAE,WAAW,EAAE,MAAM,EAA0B;IAC/E,OAAO,CACL,gCACa,yBAAyB,EACpC,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,yEAAyE,EACzE,iFAAiF,EACjF,0FAA0F,EAC1F,mFAAmF,EACnF,mGAAmG,EACnG,0DAA0D,CAC3D,sCACgC,EAAE,EACnC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,QAAQ,aAEb,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,cAEvB,CACV,CAAC;AACJ,CAAC"} |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
15
-37.5%1809988
-10.16%128
-43.86%5554
-36.05%