@runtypelabs/persona 4.33.0 → 4.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-ui.d.cts +3 -15
- package/dist/activity-ui.d.ts +3 -15
- package/dist/animations/glyph-cycle.d.cts +1 -3
- package/dist/animations/glyph-cycle.d.ts +1 -3
- package/dist/animations/wipe.d.cts +1 -3
- package/dist/animations/wipe.d.ts +1 -3
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +3 -15
- package/dist/approval-ui.d.ts +3 -15
- package/dist/approval-ui.js +1 -1
- package/dist/artifacts-ui.cjs +1 -1
- package/dist/artifacts-ui.d.cts +3 -21
- package/dist/artifacts-ui.d.ts +3 -21
- package/dist/background-runtime.d.cts +2 -3
- package/dist/background-runtime.d.ts +2 -3
- package/dist/{chunk-DW7Vg_l2.js → chunk-B1P8w9_X.js} +1 -1
- package/dist/{chunk-D6U0E82p.js → chunk-B30Jdgg6.js} +1 -1
- package/dist/{chunk-gu34lr-P.js → chunk-Brdx4NCz.js} +1 -1
- package/dist/{chunk-6CUrH_jm.js → chunk-Bzo9GaAi.js} +1 -1
- package/dist/{chunk-Ds_twaZn.js → chunk-C4v-HNhS.js} +1 -1
- package/dist/{chunk-Bkma5hIU.js → chunk-CE4seJxF.js} +1 -1
- package/dist/chunk-CNBMBx-Y.js +2 -0
- package/dist/{chunk-ql5N2I_t.js → chunk-CWzHNuVK.js} +1 -1
- package/dist/{chunk-DbGLjU2P.js → chunk-CYpt7PsO.js} +1 -1
- package/dist/chunk-Cd8mp8Sv.js +1 -0
- package/dist/chunk-CsfE8WRG.js +1 -0
- package/dist/{chunk-DOZmcve8.js → chunk-Csr59G5V.js} +1 -1
- package/dist/{chunk-Co3VVwGe.js → chunk-D2pHRNEq.js} +0 -0
- package/dist/chunk-D3kZO8u-.js +1 -0
- package/dist/chunk-DAthf5H3.js +1 -0
- package/dist/{chunk-CXQJG7pb.js → chunk-DZ_aillY.js} +2 -2
- package/dist/{chunk-6C23QQdP.js → chunk-DgJV9zbK.js} +1 -1
- package/dist/chunk-Dv6KtIT1.js +1 -0
- package/dist/chunk-Dws8IrdR.js +1 -0
- package/dist/chunk-ThxxD8oK.js +1 -0
- package/dist/{chunk-C-EHtpbB.js → chunk-h5aOI_Pa.js} +1 -1
- package/dist/chunk-kizhspe5.js +1 -0
- package/dist/client-dispatch.js +1 -1
- package/dist/client-history.js +1 -1
- package/dist/client-stream.js +1 -1
- package/dist/{code-generators-DqauYyfX.d.cts → code-generators-DPAqTcAz.d.cts} +0 -2
- package/dist/{code-generators-DqauYyfX.d.ts → code-generators-DPAqTcAz.d.ts} +0 -2
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.ts +1 -1
- package/dist/codegen.js +1 -1
- package/dist/composer-actions-runtime.cjs +1 -1
- package/dist/composer-actions-runtime.d.cts +4 -20
- package/dist/composer-actions-runtime.d.ts +4 -20
- package/dist/composer-actions-runtime.js +1 -1
- package/dist/{composer-input-DnqGCXZz.d.ts → composer-input-BSDNPOqV.d.cts} +1 -7
- package/dist/{composer-input-DnqGCXZz.d.cts → composer-input-BSDNPOqV.d.ts} +1 -7
- package/dist/{composer-store-6Iwy6WLI.d.ts → composer-store-DC-gAjtN.d.cts} +1 -3
- package/dist/{composer-store-6Iwy6WLI.d.cts → composer-store-DC-gAjtN.d.ts} +1 -3
- package/dist/config-diagnostics.d.cts +0 -2
- package/dist/config-diagnostics.d.ts +0 -2
- package/dist/{context-mention-manager-B-rHF98n.d.ts → context-mention-manager-CCpeoGL2.d.cts} +2 -6
- package/dist/{context-mention-manager-B-rHF98n.d.cts → context-mention-manager-CCpeoGL2.d.ts} +2 -6
- package/dist/context-mentions-inline.cjs +1 -1
- package/dist/context-mentions-inline.d.cts +2 -4
- package/dist/context-mentions-inline.d.ts +2 -4
- package/dist/context-mentions-inline.js +1 -1
- package/dist/context-mentions.cjs +2 -2
- package/dist/context-mentions.d.cts +3 -9
- package/dist/context-mentions.d.ts +3 -9
- package/dist/context-mentions.js +1 -1
- package/dist/{defaults-BuOjqUAG.d.ts → defaults-tj5RcN8r.d.cts} +1 -5
- package/dist/{defaults-BuOjqUAG.d.cts → defaults-tj5RcN8r.d.ts} +1 -5
- package/dist/dictation-runtime.cjs +1 -1
- package/dist/dictation-runtime.d.cts +4 -13
- package/dist/dictation-runtime.d.ts +4 -13
- package/dist/dictation-runtime.js +1 -1
- package/dist/{dom-context-DHTabIn7.d.cts → dom-context-Bw-_9Evh.d.cts} +0 -2
- package/dist/{dom-context-DHTabIn7.d.ts → dom-context-Bw-_9Evh.d.ts} +0 -2
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +3 -16
- package/dist/event-stream-view.d.ts +3 -16
- package/dist/{fallback-speech-engine-SqEfkGda.d.ts → fallback-speech-engine-gkhbjLiZ.d.cts} +1 -3
- package/dist/{fallback-speech-engine-SqEfkGda.d.cts → fallback-speech-engine-gkhbjLiZ.d.ts} +1 -3
- package/dist/{feature-preferences-DqAmje-2.d.ts → feature-preferences-CerDWGZ7.d.cts} +1 -5
- package/dist/{feature-preferences-DqAmje-2.d.cts → feature-preferences-CerDWGZ7.d.ts} +1 -5
- package/dist/forms-ui.d.cts +2 -4
- package/dist/forms-ui.d.ts +2 -4
- package/dist/{history-confirm-dialog-B3L7QNcO.d.cts → history-confirm-dialog-CrkSB3Ra.d.cts} +2 -14
- package/dist/{history-confirm-dialog-B3L7QNcO.d.ts → history-confirm-dialog-CrkSB3Ra.d.ts} +2 -14
- package/dist/history-shell.cjs +1 -1
- package/dist/history-shell.d.cts +8 -27
- package/dist/history-shell.d.ts +8 -27
- package/dist/history-shell.js +1 -1
- package/dist/history-view.d.cts +1 -1
- package/dist/history-view.d.ts +1 -1
- package/dist/icons-extra.cjs +1 -1
- package/dist/icons-extra.d.cts +0 -2
- package/dist/icons-extra.d.ts +0 -2
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +50 -50
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/{loading-label-runtime-loader-JecjOfJS.d.ts → loading-label-runtime-loader-fWIRrhUF.d.cts} +1 -3
- package/dist/{loading-label-runtime-loader-JecjOfJS.d.cts → loading-label-runtime-loader-fWIRrhUF.d.ts} +1 -3
- package/dist/loading-label-runtime.cjs +1 -1
- package/dist/loading-label-runtime.d.cts +1 -1
- package/dist/loading-label-runtime.d.ts +1 -1
- package/dist/loading-label-runtime.js +1 -1
- package/dist/markdown-parsers.js +1 -1
- package/dist/{message-bubble-CBYtpDsT.d.ts → message-bubble-Czc0lOHr.d.cts} +20 -3
- package/dist/{message-bubble-CBYtpDsT.d.cts → message-bubble-Czc0lOHr.d.ts} +20 -3
- package/dist/{plugin-kit-C1mRjLgW.d.cts → plugin-kit-C30jE-cw.d.cts} +3 -3
- package/dist/{plugin-kit-C1mRjLgW.d.ts → plugin-kit-C30jE-cw.d.ts} +3 -3
- package/dist/plugin-kit.cjs +1 -1
- package/dist/plugin-kit.d.cts +1 -1
- package/dist/plugin-kit.d.ts +1 -1
- package/dist/plugin-kit.js +1 -1
- package/dist/preferences-runtime.cjs +1 -1
- package/dist/preferences-runtime.d.cts +1 -1
- package/dist/preferences-runtime.d.ts +1 -1
- package/dist/preferences-runtime.js +1 -1
- package/dist/{preview-_UJwwt2L.d.cts → preview-D-osV3FU.d.cts} +2 -6
- package/dist/{preview-_UJwwt2L.d.ts → preview-D-osV3FU.d.ts} +2 -6
- package/dist/{registry-B5ZV3K-h.d.ts → registry-B6w91tx0.d.cts} +1 -8
- package/dist/{registry-B5ZV3K-h.d.cts → registry-B6w91tx0.d.ts} +1 -8
- package/dist/{session-Bys8_XuB.d.cts → session-BUQrs3Of.d.cts} +10 -93
- package/dist/{session-Bys8_XuB.d.ts → session-BUQrs3Of.d.ts} +10 -93
- package/dist/session-reconnect.d.cts +2 -4
- package/dist/session-reconnect.d.ts +2 -4
- package/dist/smart-dom-reader.d.cts +2 -8
- package/dist/smart-dom-reader.d.ts +2 -8
- package/dist/testing.d.cts +0 -2
- package/dist/testing.d.ts +0 -2
- package/dist/theme-editor-preview.cjs +50 -50
- package/dist/theme-editor-preview.d.cts +1 -1
- package/dist/theme-editor-preview.d.ts +1 -1
- package/dist/theme-editor-preview.js +25 -25
- package/dist/theme-editor.cjs +25 -5
- package/dist/theme-editor.d.cts +2 -22
- package/dist/theme-editor.d.ts +2 -22
- package/dist/theme-editor.js +1 -1
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +2 -4
- package/dist/theme-reference.d.ts +2 -4
- package/dist/theme-reference.js +1 -1
- package/dist/{tool-loading-animation-d5qAQcwv.d.ts → tool-loading-animation-B7XUf8TN.d.cts} +1 -7
- package/dist/{tool-loading-animation-d5qAQcwv.d.cts → tool-loading-animation-B7XUf8TN.d.ts} +1 -7
- package/dist/{tooltip-BkW-8MnD.d.cts → tooltip-DbXkAuJL.d.cts} +0 -2
- package/dist/{tooltip-BkW-8MnD.d.ts → tooltip-DbXkAuJL.d.ts} +0 -2
- package/dist/{turn-activity-ui-q6fHVnx-.d.cts → turn-activity-ui-CohuNMHT.d.cts} +2 -12
- package/dist/{turn-activity-ui-q6fHVnx-.d.ts → turn-activity-ui-CohuNMHT.d.ts} +2 -12
- package/dist/turn-activity-ui.d.cts +1 -1
- package/dist/turn-activity-ui.d.ts +1 -1
- package/dist/{types-B_mj21jg.d.cts → types-9i0xcAMT.d.cts} +128 -29
- package/dist/{types-B_mj21jg.d.ts → types-9i0xcAMT.d.ts} +128 -29
- package/dist/ui-extras.js +3 -3
- package/dist/voice-client-tools.d.cts +1 -3
- package/dist/voice-client-tools.d.ts +1 -3
- package/dist/voice-runtime.cjs +1 -1
- package/dist/voice-runtime.d.cts +2 -12
- package/dist/voice-runtime.d.ts +2 -12
- package/dist/voice-runtime.js +2 -2
- package/dist/voice-worklet-player.d.cts +2 -6
- package/dist/voice-worklet-player.d.ts +2 -6
- package/dist/{webmcp-runtime-entry-ClEO3qdI.d.ts → webmcp-runtime-entry-XNaXa-9h.d.cts} +9 -5
- package/dist/{webmcp-runtime-entry-ClEO3qdI.d.cts → webmcp-runtime-entry-XNaXa-9h.d.ts} +9 -5
- package/dist/webmcp-runtime.cjs +1 -1
- package/dist/webmcp-runtime.d.cts +1 -1
- package/dist/webmcp-runtime.d.ts +1 -1
- package/dist/webmcp-runtime.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +5 -5
- package/src/client-dispatch.ts +13 -0
- package/src/client.ts +37 -2
- package/src/client.webmcp-require-confirm.test.ts +212 -0
- package/src/components/composer-model-picker.ts +0 -14
- package/src/components/composer-overflow-menu.ts +0 -15
- package/src/components/composer-tokens.ts +0 -20
- package/src/components/event-stream-view.test.ts +5 -0
- package/src/components/message-bubble.ts +26 -6
- package/src/components/scroll-to-bottom.test.ts +135 -0
- package/src/components/scroll-to-bottom.ts +50 -13
- package/src/components/user-message-collapse.ts +117 -0
- package/src/defaults.ts +6 -0
- package/src/generated/runtype-openapi-contract.ts +13 -0
- package/src/plugin-kit.test.ts +101 -0
- package/src/plugin-kit.ts +29 -1
- package/src/session.ts +6 -2
- package/src/session.webmcp.test.ts +32 -0
- package/src/styles/widget.css +56 -0
- package/src/theme-reference.ts +2 -2
- package/src/types/theme.ts +29 -0
- package/src/types.ts +84 -5
- package/src/ui.composer-models.test.ts +5 -7
- package/src/ui.composer-overflow.test.ts +14 -21
- package/src/ui.scroll-additive.test.ts +219 -117
- package/src/ui.scroll.test.ts +176 -13
- package/src/ui.ts +230 -107
- package/src/ui.turn-activity.test.ts +7 -7
- package/src/ui.user-message-collapse.test.ts +540 -0
- package/src/utils/auto-follow.test.ts +0 -38
- package/src/utils/auto-follow.ts +0 -35
- package/src/utils/context-mention-controller.test.ts +56 -0
- package/src/utils/theme.test.ts +23 -0
- package/src/utils/tokens.ts +16 -0
- package/src/webmcp-bridge.test.ts +102 -0
- package/src/webmcp-runtime-entry.ts +29 -1
- package/dist/chunk-BAkaTZpd.js +0 -1
- package/dist/chunk-BEDTp-dm.js +0 -1
- package/dist/chunk-C7-m0EmI.js +0 -1
- package/dist/chunk-CNhThrLX.js +0 -1
- package/dist/chunk-CVMIncEY.js +0 -1
- package/dist/chunk-CzLEhoB_.js +0 -2
- package/dist/chunk-DVgzoVCB.js +0 -1
- package/dist/chunk-d54BJdKd.js +0 -1
- package/dist/chunk-dLJWKfOb.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
//#region src/utils/scroll-animation.d.ts
|
|
1
|
+
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-9i0xcAMT.cjs";
|
|
3
2
|
/** Explicit jump only: automatic following keeps its separate policy and animation. */
|
|
4
3
|
declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLElement, onFrame: () => void, onComplete: () => void, onCancel: () => void): {
|
|
5
4
|
readonly active: boolean;
|
|
@@ -9,16 +8,13 @@ declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLE
|
|
|
9
8
|
start(config: AgentWidgetConfig): void;
|
|
10
9
|
destroy(): void;
|
|
11
10
|
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/components/scroll-to-bottom.d.ts
|
|
14
11
|
/** Shared chrome; custom renderers own only the decorative glyph. */
|
|
15
12
|
declare function createScrollToBottomControl(renderIcon: (name: string, size?: string, color?: string, strokeWidth?: number) => SVGElement | null, view: "transcript" | "event-stream", focusTarget?: HTMLElement): {
|
|
16
13
|
element: HTMLButtonElement;
|
|
17
|
-
|
|
14
|
+
/** `approval` marks a pending approval below the fold: the control names it. */
|
|
15
|
+
update(nextConfig: AgentWidgetConfig, visible: boolean, active?: boolean, count?: number, approval?: boolean): void;
|
|
18
16
|
destroy(): void;
|
|
19
17
|
};
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/utils/event-stream-store.d.ts
|
|
22
18
|
export declare class EventStreamStore {
|
|
23
19
|
#private;
|
|
24
20
|
constructor(dbName?: string, storeName?: string);
|
|
@@ -31,8 +27,6 @@ export declare class EventStreamStore {
|
|
|
31
27
|
close(): void;
|
|
32
28
|
destroy(): Promise<void>;
|
|
33
29
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/utils/event-stream-buffer.d.ts
|
|
36
30
|
export declare class EventStreamBuffer {
|
|
37
31
|
#private;
|
|
38
32
|
constructor(maxSize?: number, store?: EventStreamStore | null);
|
|
@@ -48,8 +42,6 @@ export declare class EventStreamBuffer {
|
|
|
48
42
|
destroy(): void;
|
|
49
43
|
getEventTypes(): string[];
|
|
50
44
|
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/utils/throughput-tracker.d.ts
|
|
53
45
|
type ThroughputMetricStatus = "idle" | "running" | "complete" | "error";
|
|
54
46
|
type ThroughputMetricSource = "usage" | "estimate";
|
|
55
47
|
interface ThroughputMetric {
|
|
@@ -76,8 +68,6 @@ export declare class ThroughputTracker {
|
|
|
76
68
|
reset(): void;
|
|
77
69
|
processEvent(eventType: string, payload: unknown): void;
|
|
78
70
|
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/components/event-stream-view.d.ts
|
|
81
71
|
type EventStreamViewOptions = {
|
|
82
72
|
scroll: {
|
|
83
73
|
createScrollToLatest: typeof createScrollToLatest;
|
|
@@ -113,10 +103,7 @@ export declare function createEventStreamView(options: EventStreamViewOptions):
|
|
|
113
103
|
update: () => void;
|
|
114
104
|
destroy: () => void;
|
|
115
105
|
};
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/event-stream-view-entry.d.ts
|
|
118
106
|
/** Mounted-view handle: what `createEventStreamView` returns. */
|
|
119
107
|
type EventStreamViewHandle = ReturnType<typeof createEventStreamView>;
|
|
120
|
-
//#endregion
|
|
121
108
|
export type { EventStreamViewHandle, EventStreamViewOptions };
|
|
122
109
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
//#region src/utils/scroll-animation.d.ts
|
|
1
|
+
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-9i0xcAMT.js";
|
|
3
2
|
/** Explicit jump only: automatic following keeps its separate policy and animation. */
|
|
4
3
|
declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLElement, onFrame: () => void, onComplete: () => void, onCancel: () => void): {
|
|
5
4
|
readonly active: boolean;
|
|
@@ -9,16 +8,13 @@ declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLE
|
|
|
9
8
|
start(config: AgentWidgetConfig): void;
|
|
10
9
|
destroy(): void;
|
|
11
10
|
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/components/scroll-to-bottom.d.ts
|
|
14
11
|
/** Shared chrome; custom renderers own only the decorative glyph. */
|
|
15
12
|
declare function createScrollToBottomControl(renderIcon: (name: string, size?: string, color?: string, strokeWidth?: number) => SVGElement | null, view: "transcript" | "event-stream", focusTarget?: HTMLElement): {
|
|
16
13
|
element: HTMLButtonElement;
|
|
17
|
-
|
|
14
|
+
/** `approval` marks a pending approval below the fold: the control names it. */
|
|
15
|
+
update(nextConfig: AgentWidgetConfig, visible: boolean, active?: boolean, count?: number, approval?: boolean): void;
|
|
18
16
|
destroy(): void;
|
|
19
17
|
};
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/utils/event-stream-store.d.ts
|
|
22
18
|
export declare class EventStreamStore {
|
|
23
19
|
#private;
|
|
24
20
|
constructor(dbName?: string, storeName?: string);
|
|
@@ -31,8 +27,6 @@ export declare class EventStreamStore {
|
|
|
31
27
|
close(): void;
|
|
32
28
|
destroy(): Promise<void>;
|
|
33
29
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/utils/event-stream-buffer.d.ts
|
|
36
30
|
export declare class EventStreamBuffer {
|
|
37
31
|
#private;
|
|
38
32
|
constructor(maxSize?: number, store?: EventStreamStore | null);
|
|
@@ -48,8 +42,6 @@ export declare class EventStreamBuffer {
|
|
|
48
42
|
destroy(): void;
|
|
49
43
|
getEventTypes(): string[];
|
|
50
44
|
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/utils/throughput-tracker.d.ts
|
|
53
45
|
type ThroughputMetricStatus = "idle" | "running" | "complete" | "error";
|
|
54
46
|
type ThroughputMetricSource = "usage" | "estimate";
|
|
55
47
|
interface ThroughputMetric {
|
|
@@ -76,8 +68,6 @@ export declare class ThroughputTracker {
|
|
|
76
68
|
reset(): void;
|
|
77
69
|
processEvent(eventType: string, payload: unknown): void;
|
|
78
70
|
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/components/event-stream-view.d.ts
|
|
81
71
|
type EventStreamViewOptions = {
|
|
82
72
|
scroll: {
|
|
83
73
|
createScrollToLatest: typeof createScrollToLatest;
|
|
@@ -113,10 +103,7 @@ export declare function createEventStreamView(options: EventStreamViewOptions):
|
|
|
113
103
|
update: () => void;
|
|
114
104
|
destroy: () => void;
|
|
115
105
|
};
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/event-stream-view-entry.d.ts
|
|
118
106
|
/** Mounted-view handle: what `createEventStreamView` returns. */
|
|
119
107
|
type EventStreamViewHandle = ReturnType<typeof createEventStreamView>;
|
|
120
|
-
//#endregion
|
|
121
108
|
export type { EventStreamViewHandle, EventStreamViewOptions };
|
|
122
109
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-
|
|
2
|
-
//#region src/voice/fallback-speech-engine.d.ts
|
|
1
|
+
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-9i0xcAMT.cjs";
|
|
3
2
|
interface FallbackSpeechEngineOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Called once when the primary engine fails before audio starts and the
|
|
@@ -20,6 +19,5 @@ declare class FallbackSpeechEngine implements SpeechEngine {
|
|
|
20
19
|
stop(): void;
|
|
21
20
|
destroy(): void;
|
|
22
21
|
}
|
|
23
|
-
//#endregion
|
|
24
22
|
export { FallbackSpeechEngineOptions as n, FallbackSpeechEngine as t };
|
|
25
23
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-
|
|
2
|
-
//#region src/voice/fallback-speech-engine.d.ts
|
|
1
|
+
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-9i0xcAMT.js";
|
|
3
2
|
interface FallbackSpeechEngineOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Called once when the primary engine fails before audio starts and the
|
|
@@ -20,6 +19,5 @@ declare class FallbackSpeechEngine implements SpeechEngine {
|
|
|
20
19
|
stop(): void;
|
|
21
20
|
destroy(): void;
|
|
22
21
|
}
|
|
23
|
-
//#endregion
|
|
24
22
|
export { FallbackSpeechEngineOptions as n, FallbackSpeechEngine as t };
|
|
25
23
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-
|
|
2
|
-
//#region src/utils/artifact-display.d.ts
|
|
1
|
+
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-9i0xcAMT.cjs";
|
|
3
2
|
/** Canonicalize the deprecated `"card"` alias to `"collapsed"`. */
|
|
4
3
|
declare function canonicalArtifactDisplayMode(mode: PersonaArtifactDisplayModeInput): PersonaArtifactDisplayMode;
|
|
5
4
|
type PersonaArtifactDisplayDescriptor = Pick<PersonaArtifactRecord, "artifactType" | "file" | "presentation">;
|
|
@@ -41,8 +40,6 @@ declare function resolveArtifactDisplay(feature: AgentWidgetArtifactsFeature | u
|
|
|
41
40
|
* explain which rule selected it.
|
|
42
41
|
*/
|
|
43
42
|
declare function resolveArtifactDisplayMode(feature: AgentWidgetArtifactsFeature | undefined, artifact: PersonaArtifactDisplayDescriptor): PersonaArtifactDisplayMode;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/utils/feature-preferences.d.ts
|
|
46
43
|
type WidgetPreferenceParseIssueCode = "invalid_type" | "invalid_value" | "unknown_key" | "deprecated_key";
|
|
47
44
|
type WidgetPreferenceParseIssue = {
|
|
48
45
|
path: string;
|
|
@@ -71,6 +68,5 @@ declare function applyFeaturePreferences(baseFeatures: AgentWidgetFeatureFlags |
|
|
|
71
68
|
* pre-preference base features, not from a previously resolved result.
|
|
72
69
|
*/
|
|
73
70
|
declare function resolveConfigPreferences(config: AgentWidgetConfig): AgentWidgetConfig;
|
|
74
|
-
//#endregion
|
|
75
71
|
export { parseWidgetPreferenceSlice as a, PersonaArtifactDisplayMatch as c, normalizeMediaType as d, resolveArtifactDisplay as f, applyFeaturePreferences as i, PersonaArtifactDisplayResolution as l, WidgetPreferenceParseIssueCode as n, resolveConfigPreferences as o, resolveArtifactDisplayMode as p, WidgetPreferenceParseResult as r, PersonaArtifactDisplayDescriptor as s, WidgetPreferenceParseIssue as t, canonicalArtifactDisplayMode as u };
|
|
76
72
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-
|
|
2
|
-
//#region src/utils/artifact-display.d.ts
|
|
1
|
+
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-9i0xcAMT.js";
|
|
3
2
|
/** Canonicalize the deprecated `"card"` alias to `"collapsed"`. */
|
|
4
3
|
declare function canonicalArtifactDisplayMode(mode: PersonaArtifactDisplayModeInput): PersonaArtifactDisplayMode;
|
|
5
4
|
type PersonaArtifactDisplayDescriptor = Pick<PersonaArtifactRecord, "artifactType" | "file" | "presentation">;
|
|
@@ -41,8 +40,6 @@ declare function resolveArtifactDisplay(feature: AgentWidgetArtifactsFeature | u
|
|
|
41
40
|
* explain which rule selected it.
|
|
42
41
|
*/
|
|
43
42
|
declare function resolveArtifactDisplayMode(feature: AgentWidgetArtifactsFeature | undefined, artifact: PersonaArtifactDisplayDescriptor): PersonaArtifactDisplayMode;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/utils/feature-preferences.d.ts
|
|
46
43
|
type WidgetPreferenceParseIssueCode = "invalid_type" | "invalid_value" | "unknown_key" | "deprecated_key";
|
|
47
44
|
type WidgetPreferenceParseIssue = {
|
|
48
45
|
path: string;
|
|
@@ -71,6 +68,5 @@ declare function applyFeaturePreferences(baseFeatures: AgentWidgetFeatureFlags |
|
|
|
71
68
|
* pre-preference base features, not from a previously resolved result.
|
|
72
69
|
*/
|
|
73
70
|
declare function resolveConfigPreferences(config: AgentWidgetConfig): AgentWidgetConfig;
|
|
74
|
-
//#endregion
|
|
75
71
|
export { parseWidgetPreferenceSlice as a, PersonaArtifactDisplayMatch as c, normalizeMediaType as d, resolveArtifactDisplay as f, applyFeaturePreferences as i, PersonaArtifactDisplayResolution as l, WidgetPreferenceParseIssueCode as n, resolveConfigPreferences as o, resolveArtifactDisplayMode as p, WidgetPreferenceParseResult as r, PersonaArtifactDisplayDescriptor as s, WidgetPreferenceParseIssue as t, canonicalArtifactDisplayMode as u };
|
|
76
72
|
export {}
|
package/dist/forms-ui.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
import { t as AgentWidgetSession } from "./session-
|
|
3
|
-
//#region src/components/forms.d.ts
|
|
1
|
+
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-9i0xcAMT.cjs";
|
|
2
|
+
import { t as AgentWidgetSession } from "./session-BUQrs3Of.cjs";
|
|
4
3
|
export declare const formDefinitions: Record<string, {
|
|
5
4
|
title: string;
|
|
6
5
|
description?: string;
|
|
@@ -14,5 +13,4 @@ export declare const formDefinitions: Record<string, {
|
|
|
14
13
|
submitLabel?: string;
|
|
15
14
|
}>;
|
|
16
15
|
export declare const enhanceWithForms: (bubble: HTMLElement, message: AgentWidgetMessage, config: AgentWidgetConfig, session: AgentWidgetSession) => void;
|
|
17
|
-
//#endregion
|
|
18
16
|
export {}
|
package/dist/forms-ui.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
import { t as AgentWidgetSession } from "./session-
|
|
3
|
-
//#region src/components/forms.d.ts
|
|
1
|
+
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-9i0xcAMT.js";
|
|
2
|
+
import { t as AgentWidgetSession } from "./session-BUQrs3Of.js";
|
|
4
3
|
export declare const formDefinitions: Record<string, {
|
|
5
4
|
title: string;
|
|
6
5
|
description?: string;
|
|
@@ -14,5 +13,4 @@ export declare const formDefinitions: Record<string, {
|
|
|
14
13
|
submitLabel?: string;
|
|
15
14
|
}>;
|
|
16
15
|
export declare const enhanceWithForms: (bubble: HTMLElement, message: AgentWidgetMessage, config: AgentWidgetConfig, session: AgentWidgetSession) => void;
|
|
17
|
-
//#endregion
|
|
18
16
|
export {}
|
package/dist/{history-confirm-dialog-B3L7QNcO.d.cts → history-confirm-dialog-CrkSB3Ra.d.cts}
RENAMED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-
|
|
2
|
-
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-
|
|
3
|
-
//#region src/components/history-view/copy.d.ts
|
|
1
|
+
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-9i0xcAMT.cjs";
|
|
2
|
+
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-DbXkAuJL.cjs";
|
|
4
3
|
type HistoryViewCopyInput = AgentWidgetHistoryCopy;
|
|
5
4
|
type ResolvedHistoryViewCopy = Required<AgentWidgetHistoryCopy>;
|
|
6
5
|
declare const HISTORY_VIEW_COPY_DEFAULTS: ResolvedHistoryViewCopy;
|
|
7
6
|
/** Idempotent: safe to call on an already-resolved copy object. */
|
|
8
7
|
declare function resolveHistoryViewCopy(copy: HistoryViewCopyInput | undefined): ResolvedHistoryViewCopy;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/components/history-view/grouping.d.ts
|
|
11
8
|
/** `features.history.grouping`. Starred rows keep their pinned group in both. */
|
|
12
9
|
type HistoryGroupingMode = "time" | "none";
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/components/history-view/rows.d.ts
|
|
15
10
|
type RowPending = "opening" | "deleting" | null;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/components/history-view/state.d.ts
|
|
18
11
|
type HistoryListErrorReason = "unavailable" | "authentication_failed" | "authentication_required" | "identity_provider_failed" | "proof_not_admitted" | "unsupported_scope" | "unknown";
|
|
19
12
|
type HistoryListState = {
|
|
20
13
|
kind: "loading";
|
|
@@ -33,8 +26,6 @@ type HistoryListState = {
|
|
|
33
26
|
} | {
|
|
34
27
|
kind: "new_conversation_required";
|
|
35
28
|
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/components/history-view.d.ts
|
|
38
29
|
type HistoryViewPresentation = "panel" | "rail";
|
|
39
30
|
/**
|
|
40
31
|
* Where the top bar's contents live. `"external"` hands them to the shell,
|
|
@@ -296,8 +287,6 @@ interface HistoryViewHandle {
|
|
|
296
287
|
destroy(): void;
|
|
297
288
|
}
|
|
298
289
|
declare function createHistoryView(options: HistoryViewOptions): HistoryViewHandle;
|
|
299
|
-
//#endregion
|
|
300
|
-
//#region src/components/history-confirm-dialog.d.ts
|
|
301
290
|
/**
|
|
302
291
|
* Shell-owned destructive confirmation for history actions
|
|
303
292
|
* (`docs/visitor-history-implementation-plan.md` D7, accessibility contract).
|
|
@@ -317,6 +306,5 @@ interface HistoryConfirmOptions {
|
|
|
317
306
|
}
|
|
318
307
|
/** Resolves `true` only for the confirming action. */
|
|
319
308
|
declare function showHistoryConfirm(options: HistoryConfirmOptions): Promise<boolean>;
|
|
320
|
-
//#endregion
|
|
321
309
|
export { HistoryViewPresentation as a, HistoryListState as c, ResolvedHistoryViewCopy as d, resolveHistoryViewCopy as f, HistoryViewPendingAction as i, HISTORY_VIEW_COPY_DEFAULTS as l, HistoryViewHandle as n, createHistoryView as o, HistoryViewOptions as r, HistoryListErrorReason as s, showHistoryConfirm as t, HistoryViewCopyInput as u };
|
|
322
310
|
export {}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-
|
|
2
|
-
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-
|
|
3
|
-
//#region src/components/history-view/copy.d.ts
|
|
1
|
+
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-9i0xcAMT.js";
|
|
2
|
+
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-DbXkAuJL.js";
|
|
4
3
|
type HistoryViewCopyInput = AgentWidgetHistoryCopy;
|
|
5
4
|
type ResolvedHistoryViewCopy = Required<AgentWidgetHistoryCopy>;
|
|
6
5
|
declare const HISTORY_VIEW_COPY_DEFAULTS: ResolvedHistoryViewCopy;
|
|
7
6
|
/** Idempotent: safe to call on an already-resolved copy object. */
|
|
8
7
|
declare function resolveHistoryViewCopy(copy: HistoryViewCopyInput | undefined): ResolvedHistoryViewCopy;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/components/history-view/grouping.d.ts
|
|
11
8
|
/** `features.history.grouping`. Starred rows keep their pinned group in both. */
|
|
12
9
|
type HistoryGroupingMode = "time" | "none";
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/components/history-view/rows.d.ts
|
|
15
10
|
type RowPending = "opening" | "deleting" | null;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/components/history-view/state.d.ts
|
|
18
11
|
type HistoryListErrorReason = "unavailable" | "authentication_failed" | "authentication_required" | "identity_provider_failed" | "proof_not_admitted" | "unsupported_scope" | "unknown";
|
|
19
12
|
type HistoryListState = {
|
|
20
13
|
kind: "loading";
|
|
@@ -33,8 +26,6 @@ type HistoryListState = {
|
|
|
33
26
|
} | {
|
|
34
27
|
kind: "new_conversation_required";
|
|
35
28
|
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/components/history-view.d.ts
|
|
38
29
|
type HistoryViewPresentation = "panel" | "rail";
|
|
39
30
|
/**
|
|
40
31
|
* Where the top bar's contents live. `"external"` hands them to the shell,
|
|
@@ -296,8 +287,6 @@ interface HistoryViewHandle {
|
|
|
296
287
|
destroy(): void;
|
|
297
288
|
}
|
|
298
289
|
declare function createHistoryView(options: HistoryViewOptions): HistoryViewHandle;
|
|
299
|
-
//#endregion
|
|
300
|
-
//#region src/components/history-confirm-dialog.d.ts
|
|
301
290
|
/**
|
|
302
291
|
* Shell-owned destructive confirmation for history actions
|
|
303
292
|
* (`docs/visitor-history-implementation-plan.md` D7, accessibility contract).
|
|
@@ -317,6 +306,5 @@ interface HistoryConfirmOptions {
|
|
|
317
306
|
}
|
|
318
307
|
/** Resolves `true` only for the confirming action. */
|
|
319
308
|
declare function showHistoryConfirm(options: HistoryConfirmOptions): Promise<boolean>;
|
|
320
|
-
//#endregion
|
|
321
309
|
export { HistoryViewPresentation as a, HistoryListState as c, ResolvedHistoryViewCopy as d, resolveHistoryViewCopy as f, HistoryViewPendingAction as i, HISTORY_VIEW_COPY_DEFAULTS as l, HistoryViewHandle as n, createHistoryView as o, HistoryViewOptions as r, HistoryListErrorReason as s, showHistoryConfirm as t, HistoryViewCopyInput as u };
|
|
322
310
|
export {}
|
package/dist/history-shell.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e?.layout?.embedded===!0&&e.launcher?.enabled===!1&&!e.launcher.sidebarMode&&(e.launcher.mountMode??`floating`)===`floating`,t=t=>t?.layout?.showHeader??!e(t),n=/* @__PURE__ */ `viewTitle.openHistoryLabel.openHistoryBusyLabel.newConversationLabel.expandLabel.collapseLabel.resizeLabel.showEarlierMessagesLabel.openConversationLoadingLabel.openConversationErrorTitle.openConversationRetryLabel.openConversationBackLabel.confirmCancelLabel.deleteConversationConfirmTitle.deleteConversationConfirm.deleteConversationConfirmLabel.clearHistoryConfirmTitle.clearHistoryConfirm.clearHistoryVerifiedConfirm.clearHistoryConfirmLabel.resetIdentityConfirmTitle.resetIdentityConfirm.resetIdentityConfirmLabel.conversationDeletedNotice.identityResetNotice.identityResetUnconfirmedNotice`.split(`.`),r={viewTitle:`Messages`,openHistoryLabel:`Messages`,openHistoryBusyLabel:`Messages, available once the reply finishes`,newConversationLabel:`New conversation`,expandLabel:`Expand conversation list`,collapseLabel:`Collapse conversation list`,resizeLabel:`Resize conversation list`,showEarlierMessagesLabel:`Show earlier messages`,openConversationLoadingLabel:`Loading conversation`,openConversationErrorTitle:`Could not open the conversation.`,openConversationRetryLabel:`Try again`,openConversationBackLabel:`Back to messages`,confirmCancelLabel:`Cancel`,deleteConversationConfirmTitle:`Delete conversation`,deleteConversationConfirm:`Delete this conversation? This cannot be undone.`,deleteConversationConfirmLabel:`Delete`,clearHistoryConfirmTitle:`Delete all conversations`,clearHistoryConfirm:`Delete all conversations for this assistant on this browser? This cannot be undone.`,clearHistoryVerifiedConfirm:`Delete all conversations for this assistant and signed-in user? This cannot be undone.`,clearHistoryConfirmLabel:`Delete all`,resetIdentityConfirmTitle:`Forget this device`,resetIdentityConfirm:`Forget this device? All Persona data stored in this browser is cleared. Records are not deleted elsewhere.`,resetIdentityConfirmLabel:`Forget this device`,conversationDeletedNotice:`That conversation was deleted. You are now in a new conversation.`,identityResetNotice:`This device was forgotten.`,identityResetUnconfirmedNotice:`This device was cleared here, but the server could not confirm it.`};function i(e){if(!e)return r;let t={...r};for(let r of n){let n=e[r];typeof n==`string`&&n.length>0&&(t[r]=n)}return t}const a=(e,t)=>{console.warn(`[persona] ${e} threw`,t)},o=e=>Object.freeze({...e}),s=e=>Object.freeze({id:e.id,title:e.title,targetId:e.targetId,preview:e.preview,messageCount:e.messageCount,createdAt:e.createdAt,updatedAt:e.updatedAt}),c=e=>e?o(e):null;function l(e){let{plugins:t,config:n}=e,r=!1,i=!1,l=!1,u=!1,d=null,f=[],p=()=>{for(let e of f.splice(0))try{e()}catch(e){a(`renderHistoryView cleanup`,e)}},m=(e,n)=>{for(let r of t){let t=r[e];if(t)try{let e=t(n);if(e)return e}catch(t){a(e,t)}}return null},h=()=>({presentation:e.getPresentation(),config:n}),g={header:t=>u?m(`renderHistoryHeader`,Object.freeze({...h(),returnSurface:e.getReturnSurface(),identityStatus:o(t.identityStatus),pendingAction:c(t.pendingAction),copy:o(t.copy),actions:Object.freeze({close:y.close,startNewConversation:y.startNewConversation}),defaultRenderer:t.defaultRenderer})):null,conversation:e=>u?m(`renderHistoryConversation`,Object.freeze({...h(),conversation:s(e.conversation),active:e.active,pending:e.pending,open:e.open,requestDelete:e.requestDelete,defaultRenderer:e.defaultRenderer})):null,state:e=>u?m(`renderHistoryState`,Object.freeze({...h(),state:o(e.state),identityStatus:o(e.identityStatus),copy:o(e.copy),...e.retry?{retry:e.retry}:{},...e.startNewConversation?{startNewConversation:e.startNewConversation}:{},defaultRenderer:e.defaultRenderer})):null},_=t.flatMap(t=>(t.railSections??[]).map(t=>({...t,placement:t.placement??`above-conversations`,items:[],render:n=>t.render(Object.freeze({collapsed:n,presentation:e.getPresentation(),actions:y}))}))),v=e.createView({slots:g,renderDom:!1,onModelChange:()=>C(),railSections:_}),y=Object.freeze({...v.operations,close:e.close}),b=()=>(u=!0,v.setDomRenderEnabled(!0),v.element),x=t=>Object.freeze({conversations:Object.freeze(t.conversations.map(s)),activeConversationId:t.activeConversationId,state:o(t.state),pendingAction:c(t.pendingAction),identityStatus:o(t.identityStatus),nextCursor:t.nextCursor,presentation:e.getPresentation(),returnSurface:e.getReturnSurface(),config:n,copy:o(v.copy),actions:y,defaultRenderer:b,requestRender:()=>C(),onCleanup:e=>{f.push(e)}}),S=()=>{u=!1;let e=null;for(let n of t)if(n.renderHistoryView){try{e=n.renderHistoryView(x(v.getModel()))}catch(t){a(`renderHistoryView`,t),e=null}if(e)break}let n=!e||e.contains(v.element);return u=n,v.setDomRenderEnabled(n),e??v.element};function C(){if(!(!l||r||i)){i=!0;try{p();let t=S();if(t===d)return;let n=d;d=t,e.onElementChanged(t,n)}finally{i=!1}}}return l=!0,C(),{view:v,get element(){return d??v.element},requestRender:C,dispose:()=>{r=!0,p()}}}const u=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n},d=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r},f=(...e)=>e.filter(Boolean).join(` `);function p(e){return typeof e==`string`?e:e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function m(e){return typeof e!=`string`&&e.some(e=>e.type===`image`)}function h(e){return{type:`text`,text:e}}function g(e,t){return{type:`image`,image:e,...t?.mimeType&&{mimeType:t.mimeType},...t?.alt&&{alt:t.alt}}}const _=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`image/bmp`],v=[`application/pdf`,`text/plain`,`text/markdown`,`text/csv`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/json`];[..._,...v];function y(e,t,n){return{type:`file`,data:e,mimeType:t,filename:n}}const b=[`user`,`assistant`,`system`,`operator`];function x(e){if(typeof e!=`string`||e===``)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function S(e){return typeof e==`string`?e:void 0}function C(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`text`:return typeof t.text==`string`?h(t.text):null;case`image`:return typeof t.image==`string`?g(t.image,{mimeType:S(t.mimeType),alt:S(t.alt)}):null;case`file`:return typeof t.data==`string`&&typeof t.mimeType==`string`&&typeof t.filename==`string`?y(t.data,t.mimeType,t.filename):null;case`audio`:return typeof t.audio==`string`?{type:`audio`,audio:t.audio,...S(t.mimeType)!==void 0&&{mimeType:t.mimeType}}:null;case`video`:return typeof t.video==`string`?{type:`video`,video:t.video,...S(t.mimeType)!==void 0&&{mimeType:t.mimeType}}:null;default:return null}}function ee(e,t){let n=x(t),r=e.map(e=>x(e.timestamp)),i=Array(e.length),a=0;for(;a<r.length;){let e=r[a];if(e!==null){i[a]=e,a+=1;continue}let t=a;for(;t+1<r.length&&r[t+1]===null;)t+=1;let o=t-a+1,s=a>0?i[a-1]:null,c=t+1<r.length?r[t+1]:null,l=c!==null&&n!==null?Math.min(c,n):c??n;for(let e=0;e<o;e+=1)i[a+e]=l===null?s===null?0+e:s+e+1:l-(o-e);a=t+1}return i.map(e=>new Date(e).toISOString())}function w(e,t){let n=ee(e,t?.beforeCreatedAt),r=[];return e.forEach((e,t)=>{if(typeof e?.id!=`string`||e.id===``||!b.includes(e.role))return;let i=e.role,a=n[t],o=e.author,s=o&&typeof o==`object`?{...typeof o.id==`string`&&{id:o.id},...typeof o.displayName==`string`&&{displayName:o.displayName},...[`human`,`ai`,`system`].includes(o.kind??``)&&{kind:o.kind}}:void 0;if(e.displayAvailable===!1){let t={historyDisplayUnavailable:!0};r.push({id:e.id,role:i,...s&&{author:s},content:``,createdAt:a,agentMetadata:t})}else if(typeof e.displayContent==`string`)r.push({id:e.id,role:i,...s&&{author:s},content:e.displayContent,createdAt:a});else if(typeof e.content==`string`)r.push({id:e.id,role:i,...s&&{author:s},content:e.content,createdAt:a});else if(Array.isArray(e.content)){let t=e.content.map(C).filter(e=>e!==null),n=p(t);r.push({id:e.id,role:i,...s&&{author:s},content:n||(m(t)?`[Image]`:``),createdAt:a,...t.length>0&&{contentParts:t}})}else r.push({id:e.id,role:i,...s&&{author:s},content:``,createdAt:a})}),r}function te(e,t){let n=/* @__PURE__ */ new Map;for(let t of e)n.set(t.id,t);for(let e of t)n.set(e.id,e);return[...n.values()].sort((e,t)=>{let n=new Date(e.createdAt).getTime(),r=new Date(t.createdAt).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r)return n-r;let i=e.sequence??0,a=t.sequence??0;return i===a?e.id.localeCompare(t.id):i-a})}const ne=/* @__PURE__ */ new Map([[`not_found`,`not_found`],[`conversation_deleted`,`not_found`],[`rate_limited`,`rate_limited`],[`authentication_required`,`authentication_required`],[`invalid_identity_proof`,`authentication_required`],[`visitor_identity_mismatch`,`authentication_required`],[`visitor_required`,`authentication_required`],[`identity_provider_failed`,`identity_provider_failed`],[`proof_not_admitted`,`proof_not_admitted`],[`identity_contract_violation`,`proof_not_admitted`],[`unauthorized`,`authentication_failed`],[`visitor_token_missing`,`authentication_failed`],[`conversation_credential_missing`,`authentication_failed`]]),re=/* @__PURE__ */ new Map([[`not_found`,`That conversation is no longer available.`],[`rate_limited`,`Too many history requests.`],[`authentication_failed`,`History access was not authorized.`],[`authentication_required`,`Sign in again to view account history.`],[`identity_provider_failed`,`The identity provider did not respond.`],[`proof_not_admitted`,`Account history is not available for this configuration.`],[`unsupported_scope`,`This history scope is not supported.`],[`unavailable`,`Conversation history is unavailable right now.`]]),T=e=>re.get(e)??`Conversation history is unavailable right now.`;function ie(e,{HistoryClientError:t,HistoryProviderError:n}){if(e instanceof n)return e;if(e instanceof t){let t=ne.get(e.code)??`unavailable`;return new n(t,T(t),{...e.retryAfterSeconds===void 0?{}:{retryAfterSeconds:e.retryAfterSeconds}})}return new n(`unavailable`,T(`unavailable`))}function ae(e){let{HistoryProviderError:t}=e.errors,n=()=>e.getClient?.()??e.client,r=e.getIdentityProofConfigured()?[`browser`,`verified-user`]:[`browser`],i={scopes:r},a=e=>{if(!r.includes(e))throw new t(`unsupported_scope`,T(`unsupported_scope`))},o=async(t,n)=>{a(t);try{return await n()}catch(t){throw ie(t,e.errors)}},s=t=>{let n=!1;return{conversationId:t.session.conversationId??``,conversationRevision:t.session.conversationRevision??``,async commit(){n||(n=!0,t.commit(),await e.onActivationCommitted(t.session))},discard(){n||(n=!0,t.discard())}}};return{capabilities:i,getIdentityStatus(){return n().getHistoryIdentityStatus()},subscribeIdentityStatus(e){return n().subscribeHistoryIdentityStatus(e)},subscribeAvailability(e){return n().subscribeHistoryAvailability(e)},async list(e){return o(e.context.scope,async()=>{let t=await n().listConversations({...e.cursor?{cursor:e.cursor}:{},...e.limit===void 0?{}:{limit:e.limit},...e.targetId?{targetId:e.targetId}:{},scope:e.context.scope});return{items:t.data,nextCursor:t.nextCursor}})},async getPage(e,t){return o(t.context.scope,async()=>{let r=await n().getConversation(e,{...t.cursor?{messageCursor:t.cursor}:{},scope:t.context.scope}),i=w(r.messages,{...t.beforeCreatedAt?{beforeCreatedAt:t.beforeCreatedAt}:{}});return{summary:r.summary,messages:te([],i),conversationRevision:r.conversationRevision??``,nextCursor:r.nextMessageCursor}})},async prepareOpen(e,t){return o(t.context.scope,async()=>s(await n().prepareConversationSession(e)))},async prepareStartNew(e){return o(e.context.scope,async()=>s(await n().prepareNewConversationSession()))},async delete(e,t){await o(t.context.scope,()=>n().deleteConversation(e,{scope:t.context.scope}))},async deleteAll(e){return o(e.context.scope,()=>n().deleteAllConversations({...e.targetId===void 0?{}:{targetId:e.targetId},scope:e.context.scope}))},async resetDevice(){try{return await n().resetVisitor(),{remoteRevocationConfirmed:!0}}catch{return{remoteRevocationConfirmed:!1}}}}}const oe=e=>{let n=i(e.config.features?.history?.copy),r=null,a=!1,o=null,s=null,c=`conversation`,p=null,m=null,h=null,g=null,_=0,v=null,y=null,b=null,x=`persona-history-${Math.random().toString(36).slice(2,8)}`,S=()=>e.historyFeatureEnabled()&&!!r&&!a,C=()=>{let t=e.session.getStatus();return e.isStreaming||t===`paused`||t===`resuming`},ee=()=>{let t=e.config.features?.history?.scope;if(t)return t;let n=e.config.getIdentityProof?`verified-user`:`browser`,i=r?.capabilities.scopes;return!i||i.includes(n)?n:i[0]??n},w=()=>s?.scope??ee(),te=()=>e.session.getClientSession()?.targetId??null,ne=e=>`${e.state}:${`reason`in e?e.reason:``}`,re=t=>{let n=ne(t);n!==g&&(g=n,e.eventBus.emit(`history:identityStatusChanged`,{status:t,timestamp:Date.now()}))},T=null,ie=null,oe=()=>{if(!e.historyFeatureEnabled())return null;let t=e.getHistoryProviderFactory();if(t)return t();let n=e.config.features?.history?.provider;return n?typeof n==`function`?(T!==n&&(T=n,ie=n()),ie):n:e.session.isClientTokenMode()?ae({errors:e.historyErrors,client:e.session.getClient(),getIdentityProofConfigured:()=>typeof e.config.getIdentityProof==`function`,onActivationCommitted:t=>e.session.bindActivatedSession(t),getClient:()=>e.session.getClient()}):null},se=()=>{y?.(),y=null,b?.(),b=null,a=!1;let t=r;r=oe(),t&&t!==r&&e.discardConversationContinuity();let n={...e.historyInternals};r?n.historyProvider=r:delete n.historyProvider,e.historyInternals=n,e.session.setHistoryInternals(e.historyInternals),r&&(y=r.subscribeAvailability?.(e=>{a=!e,e||q({restoreFocus:!1}),$()})??null,b=r.subscribeIdentityStatus(e=>re(e)),g=ne(r.getIdentityStatus()))},ce=()=>{let t=e.config.features?.history?.presentation??`panel`;if(t===`panel`||t===`auto`&&e.launcherEnabled&&!e.isDockedMountMode(e.config))return`panel`;let n=e.artifactSplitRoot??e.container;return(n.getBoundingClientRect().width||n.clientWidth)>=720?`rail`:`panel`},E=(e,t)=>{t?(e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``)):(e.removeAttribute(`aria-hidden`),e.removeAttribute(`inert`))},le=`data-persona-history-suppressed`,D=null,O=null,k=null,ue=null,de=null,fe=``,pe=()=>e.header===de?fe:t(e.config)?``:`none`,me=()=>e.historyPresentation===`panel`&&!!k&&ue===k.element&&t(e.config)&&pe()!==`none`,he=()=>{for(let t of Array.from(e.header.children))t!==D&&t.setAttribute(le,``)},ge=()=>{for(let t of Array.from(e.container.querySelectorAll(`[${le}]`)))t.removeAttribute(le)},_e=()=>{let t=k;if(!t)return;if(Array.from(e.header.children).some(e=>e!==D&&!e.hasAttribute(le))){O&&O!==e.header&&(O.style.removeProperty(`min-height`),O=null);let t=e.header.offsetHeight;t>0&&(e.header.style.minHeight=`${t}px`,O=e.header)}D||=u(`div`,`persona-history-header-host`),t.setHeaderPlacement(`external`);let n=t.getHeaderElement();n.parentNode!==D&&D.replaceChildren(n),D.parentNode!==e.header&&e.header.appendChild(D),he()},ve=()=>{O&&=(O.style.removeProperty(`min-height`),null),D&&(k?.setHeaderPlacement(`inline`),D.remove(),D=null,ge())},ye=null,be=()=>{ye&&(e.body.style.display=`none`,E(e.body,!0),e.footer.hidden=!0,E(e.footer,!0),e.panelSuggestions.style.display=`none`,E(e.panelSuggestions,!0),e.panelSuggestionsFade.style.display=`none`,me()?(_e(),e.header.style.display=pe(),E(e.header,!1)):(ve(),e.header.style.display=`none`,E(e.header,!0)))};e.reapplyHistoryHostChrome=be;let xe=n=>{let r=e.body.style.display,i=e.footer.hidden,a=e.panelSuggestions.style.display,o=e.panelSuggestionsFade.style.display,s=e.footer,c=e.header,l=e.header.style.display;de=c,fe=l,ye=()=>{ye=null,ve(),de=null,e.body.style.display=r,E(e.body,!1),e.panelSuggestions.style.display=a,E(e.panelSuggestions,!1),e.panelSuggestionsFade.style.display=o,s.hidden=i,E(s,!1),e.footer!==s&&(e.footer.hidden=!1,E(e.footer,!1)),c.style.display=l,E(c,!1),e.header!==c&&(e.header.style.display=t(e.config)?``:`none`,E(e.header,!1))},e.container.insertBefore(n,e.footer.parentNode===e.container?e.footer:e.panelSuggestions),be()},A=null,j=null,Se=null,M=null,Ce=()=>[e.header,e.panelElements.closeButtonWrapper,e.panelElements.clearChatButtonWrapper,e.body,e.footer,e.scrollToBottomButton],we=()=>e.config.features?.history?.rail?.collapsible!==!1,N=()=>e.config.features?.history?.rail?.side===`right`?`right`:`left`,Te=e=>Math.min(400,Math.max(200,Math.round(e))),Ee=()=>e.config.features?.history?.rail?.resizable===!0,P,De=()=>{if(P===void 0&&(P=null,e.config.persistState!==!1))try{let t=Number(window.localStorage.getItem(`${e.currentKeyPrefix()}rail-width`));t&&(P=t)}catch{}return P},F=()=>Te(De()??e.config.features?.history?.rail?.width??260),Oe=t=>{if(P=t,e.config.persistState!==!1)try{window.localStorage.setItem(`${e.currentKeyPrefix()}rail-width`,String(t))}catch{}},ke=()=>we()&&e.config.features?.history?.rail?.collapsedBehavior===`overlay`,I=!1,Ae=e=>{let t=u(`img`);return t.src=e,t.alt=``,t.setAttribute(`aria-hidden`,`true`),t},je=()=>{let t=e.config.features?.history?.rail?.brand;if(!t)return;let n=!1,r;return i=>{if(t.render)try{return t.render({collapsed:i})??null}catch(e){return n||(n=!0,console.warn(`[persona] history rail brand threw`,e)),null}return r===void 0&&(r=t.iconUrl?Ae(t.iconUrl):t.icon?e.renderLucideIcon(t.icon,20):null),r?r.cloneNode(!0):null}},Me=()=>e.config.features?.history?.rail?.sections?.map(t=>{let n=!1,r=e=>{n||(n=!0,console.warn(`[persona] history rail section threw`,t.id,e))};return{id:t.id,title:t.title,placement:t.placement??`above-conversations`,items:t.items.map(t=>{let n;return{id:t.id,label:t.label,badge:t.badge,iconNode:()=>{if(n!==void 0)return n;try{n=t.renderIcon?t.renderIcon()??null:t.iconUrl?Ae(t.iconUrl):t.icon?e.renderLucideIcon(t.icon,20):null}catch(e){r(e),n=null}return n},onSelect:()=>{try{t.onSelect()}catch(e){r(e)}}}})}})??[],Ne=e=>{let t=Me();for(let n of e)t.some(e=>e.id===n.id)?console.warn(`[persona] duplicate history rail section id`,n.id):t.push(n);return t.length?t:void 0},L=null,Pe=()=>`${e.currentKeyPrefix()}rail-collapsed`,Fe=()=>{if(L===null&&(L=e.config.features?.history?.rail?.defaultCollapsed===!0,e.config.persistState!==!1))try{let e=window.localStorage.getItem(Pe());e&&(L=e===`1`)}catch{}return L},Ie=t=>{if(L=t,e.config.persistState!==!1)try{window.localStorage.setItem(Pe(),t?`1`:`0`)}catch{}},R=()=>e.historyPresentation===`rail`&&we()&&!ke()&&Fe(),Le=()=>{},Re=()=>{ke()?Le():(Ie(!Fe()),o?.view.setCollapsed(R()),e.applyRailChrome(),e.repinAnchoredMessage())},ze=()=>{let t=e.config.features?.history?.rail?.collapseShortcut;return!t||!e.parseCombo(t)?null:{combo:t,hint:e.formatCombo(t),aria:e.ariaCombo(t)}},Be=`var(--persona-history-overlay-margin,8px)`,z=null,B=null,Ve=0,V=null,H=null,U=!1,He=0,Ue=()=>window.matchMedia?.(`(pointer: coarse)`).matches===!0,W=()=>S()&&ke()&&(e.historyPresentation??ce())===`rail`,We=()=>e.historyVisible&&!I,G=()=>{H!==null&&clearTimeout(H),H=null},Ge=()=>{e.loadHistoryView().catch(()=>{})},Ke=()=>{G(),I&&(H=setTimeout(()=>{H=null,!U&&I&&(V?.contains(document.activeElement)||q({restoreFocus:!1}))},300))},qe=(e,t)=>{let n=V?.getBoundingClientRect();if(!n)return!1;let r=z?.getBoundingClientRect(),i=r?Math.min(r.top,n.top):n.top;return e>=n.left&&e<=n.right&&t>=i&&t<=n.bottom||!!r&&e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom},Je=e=>{I&&(U=qe(e.clientX,e.clientY),U?G():H===null&&Ke())},Ye=t=>{!e.historyVisible&&W()&&(I=!0,gt({invoker:z,keyboard:t?.keyboard===!0}).then(()=>{e.historyVisible?!U&&document.activeElement!==z&&q():I=!1}))},Xe=()=>{let e=ue?.querySelector(`[data-persona-history-focus="collapse"]`);e&&(e.setAttribute(`aria-label`,I?n.expandLabel:n.collapseLabel),e.setAttribute(`aria-expanded`,I?`false`:`true`))},Ze=()=>{Ie(!1);let t=o;if(!I||!t){gt({invoker:z});return}let n=document.activeElement===z;I=!1,ut(),t.element.remove(),ft(t.element),Xe(),n&&ht(),e.repinAnchoredMessage(),$()},Qe=()=>{Ie(!0),q()};Le=()=>{!e.historyVisible||I?Ze():Qe()};let $e=()=>{let t=ze(),r=e.createHeaderIconButton({ariaLabel:n.expandLabel,iconName:`panel-left`,wrapperClassName:`persona-relative persona-inline-flex persona-items-center persona-justify-center`,extraClassName:`persona-rail-trigger`,tooltip:!1,attrs:{"data-persona-rail-trigger":``,"aria-controls":x,...t?{"aria-keyshortcuts":t.aria}:{}}}),i=r.button;i.addEventListener(`mouseenter`,()=>{U=!0,G(),!(Ue()||Date.now()<He)&&Ye()}),i.addEventListener(`mouseleave`,()=>{U=!1,He=0,Ke()}),i.addEventListener(`focus`,()=>{e.historyVisible||Ge()}),i.addEventListener(`click`,t=>{S()&&(t.detail!==0&&Ue()&&!e.historyVisible?Ye():Ze())}),z=i,B=r.wrapper},et=()=>{if(B&&!B.isConnected&&(B=null,z=null),!W()){B?.remove(),B=null,z=null;return}z||$e();let t=B,r=z;if(!t||!r)return;let i=N()===`right`?null:e.header.firstChild;(i??e.header.lastChild)!==t&&e.header.insertBefore(t,i),t.style.display=We()||Ve>0?`none`:``,r.setAttribute(`aria-label`,n.expandLabel),r.setAttribute(`aria-expanded`,e.historyVisible?`true`:`false`),V&&e.applyRailChrome()},tt=e=>{if(!I)return;let t=e.target;t instanceof Node&&(V?.contains(t)||B?.contains(t)||t instanceof Element&&t.closest(`.persona-dropdown-menu,[role="alertdialog"]`)||q({restoreFocus:!1}))};document.addEventListener(`pointerdown`,tt,!0),e.destroyCallbacks.push(()=>{document.removeEventListener(`pointerdown`,tt,!0),document.removeEventListener(`pointermove`,Je),K?.(),G()});let nt=null,K=null,rt=t=>{Oe(Te(t)),e.applyRailChrome(),e.repinAnchoredMessage()},it=()=>{let t=u(`div`,`persona-rail-resizer`);return t.tabIndex=0,t.setAttribute(`role`,`separator`),t.setAttribute(`aria-orientation`,`vertical`),t.setAttribute(`aria-valuemin`,`200`),t.setAttribute(`aria-valuemax`,`400`),t.addEventListener(`pointerdown`,n=>{let r=j;if(!r||n.button!==0)return;n.preventDefault(),K?.();let i=n.clientX,a=r.getBoundingClientRect().width||F(),o=N()===`right`?-1:1,s=a,c=e.mount.ownerDocument;r.style.transition=`none`;let l=e=>{s=Te(a+o*(e.clientX-i)),r.style.flex=`0 0 ${s}px`,t.setAttribute(`aria-valuenow`,String(s))},u=()=>{K=null,c.removeEventListener(`pointermove`,l),c.removeEventListener(`pointerup`,u),c.removeEventListener(`pointercancel`,u),r.style.removeProperty(`transition`);try{t.releasePointerCapture(n.pointerId)}catch{}rt(s)};K=u,c.addEventListener(`pointermove`,l),c.addEventListener(`pointerup`,u),c.addEventListener(`pointercancel`,u);try{t.setPointerCapture(n.pointerId)}catch{}}),t.addEventListener(`keydown`,e=>{let t=N()===`right`?-16:16,n=F(),r=e.key===`ArrowRight`?n+t:e.key===`ArrowLeft`?n-t:e.key===`Home`?200:e.key===`End`?400:null;r!==null&&(e.preventDefault(),rt(r))}),t},at=(e,t)=>{if(!Ee()||R()){K?.(),nt?.remove();return}let r=nt??it();nt=r,r.setAttribute(`aria-label`,n.resizeLabel),r.setAttribute(`aria-valuenow`,String(F())),r.nextElementSibling!==t&&e.insertBefore(r,t)};e.applyRailChrome=()=>{o?.view.setRailSide(N());let t=N()===`right`,n=V;if(n){let r=z?z.getBoundingClientRect().bottom-e.container.getBoundingClientRect().top:0;n.style.top=`calc(${Math.max(0,Math.round(r))}px + ${Be})`,n.style.width=`${F()}px`,n.style.left=t?``:Be,n.style.right=t?Be:``}let r=j,i=A,a=Se;if(!r||!i||!a)return;r.style.flex=`0 0 ${R()?52:F()}px`;let s=`1px solid var(--persona-divider,#e5e7eb)`;r.style.borderRight=t?``:s,r.style.borderLeft=t?s:``;let c=t?a:r;i.firstElementChild!==c&&i.append(c,t?r:a),at(i,t?r:a)};let ot=t=>{if(M&&j){M.replaceWith(t),M=null,e.applyRailChrome();return}let n=u(`div`,`persona-history-rail-shell`);n.style.cssText=`display:flex;flex-direction:row;flex:1 1 auto;min-height:0`;let r=u(`div`,`persona-history-rail-conversation`);r.style.cssText=`display:flex;flex-direction:column;flex:1 1 auto;min-width:0;min-height:0;position:relative`;let i=u(`div`,`persona-history-rail-host`);i.style.cssText=`display:flex;min-height:0;overflow:hidden`,e.container.insertBefore(n,e.header.parentNode===e.container?e.header:e.body);for(let t of Ce())t?.parentNode===e.container&&r.appendChild(t);n.append(i,r),i.appendChild(t),A=n,j=i,Se=r,e.applyRailChrome()},st=()=>{if(A)return;let t=u(`div`,`persona-history-rail-placeholder`);t.style.cssText=`flex:1 1 auto;min-height:0`,M=t,ot(t),e.repinAnchoredMessage()},ct=()=>{M&&(ut(),e.repinAnchoredMessage())},lt=t=>{let n=u(`div`,`persona-history-rail-overlay`);n.style.cssText=`position:absolute;bottom:${Be};display:flex;overflow:hidden;z-index:100000;border-radius:var(--persona-history-overlay-radius,16px);background:var(--persona-history-overlay-bg,var(--persona-container,#f7f7f8));box-shadow:var(--persona-history-overlay-shadow,0 12px 40px rgba(0,0,0,0.25))`,e.container.style.position=`relative`,e.container.appendChild(n),n.appendChild(t),document.addEventListener(`pointermove`,Je),V=n,e.applyRailChrome(),Xe()},ut=()=>{ye?.(),V&&=(U&&(He=Date.now()+150),document.removeEventListener(`pointermove`,Je),V.remove(),null);let t=A;if(t){K?.();for(let n of Ce())if(n&&t.contains(n)){let r=n===e.scrollToBottomButton?e.panelSuggestions:t;e.container.insertBefore(n,r)}t.remove(),A=null,j=null,Se=null,M=null}},dt=e=>{ue=e,e.id=x,e.style.flex=`1 1 auto`,e.style.minHeight=`0`},ft=t=>{dt(t),(e.historyPresentation!==`rail`||I)&&ct(),e.historyPresentation===`rail`?I?lt(t):ot(t):xe(t)},pt=()=>{if(et(),Vt(),!e.historyVisible||!o)return;let t=ce();if(t===e.historyPresentation)return;let n=document.activeElement,r=n instanceof HTMLElement&&(o.element.contains(n)||D?.contains(n)===!0)?n:null;ut(),o.element.remove(),o.view.setHeaderPlacement(`inline`),e.historyPresentation=t,o.view.setPresentation(t),o.view.setCollapsed(R()),o.requestRender(),o.element.isConnected||ft(o.element),r?.isConnected?r.focus():ht(),e.syncScrollToBottomButton(),e.repinAnchoredMessage(),$()},mt=(e,t)=>D?.querySelector(t)??e.querySelector(t),ht=()=>{let e=o?.element??ue;if(!e)return;let t=mt(e,`[data-persona-history-focus="close"],[data-persona-history-focus="collapse"]`);if(t){t.focus();return}let n=mt(e,`.persona-history-title`)??e;n.tabIndex=-1,n.focus()},gt=async i=>{if(!S()||e.historyVisible)return;let a=r;if(!a)return;if(!I&&W()&&Fe()){et();return}_t();let u=++_;c=i?.returnSurface??`conversation`,p=i?.invoker??m;let d=W()&&!I;d&&(Ve+=1,et(),st());let f;try{f=await e.loadHistoryView()}catch{e.announceHistory(n.openHistoryLabel),d&&(--Ve,u===_&&(ct(),et()));return}if(d&&--Ve,u!==_||e.historyVisible)return;s={scope:ee()},e.historyPresentation=ce(),e.historyVisible=!0;let h=e.historyPresentation===`panel`&&t(e.config)&&e.header.style.display!==`none`?`external`:`inline`,g=e.config.features?.history?.rowAvatar,v=ze(),y=v?{hint:v.hint,aria:v.aria}:null,b={provider:a,context:s,targetId:te(),presentation:e.historyPresentation,collapsible:we(),collapsed:R(),railSide:N(),renderRailHeader:e.config.features?.history?.rail?.renderHeader,railBrand:je(),onToggleCollapse:Re,...y?{collapseShortcut:y}:{},headerPlacement:h,showScopeStatus:e.config.features?.history?.showScopeStatus!==!1,showDelete:e.config.features?.history?.showDelete!==!1,showDeleteAll:e.config.features?.history?.showDeleteAll!==!1,...e.config.features?.history?.listActions?.length?{listActions:e.config.features.history.listActions}:{},rowAvatar:g===!1?!1:typeof g==`string`?g:e.config.launcher?.iconUrl,activeConversationId:e.session.getActiveConversationId(),...e.config.features?.history?.grouping?{grouping:e.config.features.history.grouping}:{},...e.config.features?.history?.copy?{copy:e.config.features.history.copy}:{},...e.config.features?.history?.pageSize===void 0?{}:{pageSize:e.config.features.history.pageSize},onSelect:e=>kt(e,{focusComposer:!0}).catch(()=>{}),onActiveConversationChange:t=>e.setActiveConversationSummary(t),attachTooltip:e.attachTooltip,onStartNew:()=>At({focusComposer:!0}),onClose:()=>q(),onRequestDeleteConversation:e=>Lt(e),onRequestClearHistory:()=>Rt(),...a.resetDevice?{onRequestResetIdentity:()=>zt()}:{}};o=l({plugins:e.plugins,config:e.config,getPresentation:()=>e.historyPresentation??`panel`,getReturnSurface:()=>c,close:()=>q(),createView:({slots:t,renderDom:n,onModelChange:r,railSections:i})=>(k=f.createHistoryView({...b,railSections:Ne(i),slots:t,renderDom:n,onModelChange:r,onAnnounce:e.announceHistory}),k),onElementChanged:(e,t)=>{if(!t?.isConnected)return ft(e);dt(e),t.replaceWith(e),be()}}),o.view.setNewConversationRequired(e.historySessionState.recovery===`new_conversation_required`),i?.focus!==!1&&(e.historyPresentation!==`rail`||i?.keyboard===!0)&&ht(),e.syncScrollToBottomButton(),e.repinAnchoredMessage(),$(),e.eventBus.emit(`history:opened`,{presentation:e.historyPresentation,returnSurface:c,timestamp:Date.now()})},_t=()=>{},q=t=>{if(!e.historyVisible)return;_+=1;let n=c,r=p,i=o,a=t?.restoreFocus!==!1;e.historyVisible=!1;let l=!1,u=null,d=()=>{if(!l){if(l=!0,_t=()=>{},u!==null&&clearTimeout(u),I=!1,G(),ut(),i?.dispose(),i?.view.destroy(),i?.element.remove(),o===i&&(o=null,k=null,ue=null,e.historyPresentation=null,s=null,p=null),e.syncScrollToBottomButton(),e.repinAnchoredMessage(),$(),a){let t=r??m;t?.isConnected?t.focus():e.maybeFocusInput()}e.eventBus.emit(`history:closed`,{returnSurface:n,timestamp:Date.now()})}},f=i&&i.element===i.view.element?i.view.playExit():null;f?(_t=d,u=setTimeout(d,250),f.then(d)):d()},vt=t=>{if(t.key===`Escape`&&e.historyVisible&&o){if(e.historyPresentation===`rail`){let e=t.target;if(!(e instanceof Node)||!(o.element.contains(e)||I&&B?.contains(e)===!0))return}t.preventDefault(),t.stopPropagation(),q()}};e.container.addEventListener(`keydown`,vt),e.destroyCallbacks.push(()=>e.container.removeEventListener(`keydown`,vt));let yt=0,J=null,bt=null,Y=()=>{bt&&clearTimeout(bt),bt=null};e.destroyCallbacks.push(Y);let xt=()=>{Y();let t=e.conversationOpenPendingEl;t&&(e.conversationOpenTakeover=!0,t.hidden=!1,e.messagesWrapper.style.display=`none`,e.updateWelcome())},X=()=>{yt+=1,Y(),J?.remove(),J=null,e.conversationOpenPendingEl&&(e.conversationOpenPendingEl.remove(),e.conversationOpenPendingEl=null,e.conversationOpenTakeover=!1,e.messagesWrapper.style.removeProperty(`display`),E(e.footer,!1),e.updateWelcome())},St=()=>{try{if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches)return;e.messagesWrapper.animate([{opacity:0},{opacity:1}],{duration:150,easing:`ease-out`})}catch{}},Ct=t=>{let n=e.config.layout?.messages?.layout??`bubble`,r=d(`div`,{className:`persona-flex`,attrs:{"aria-hidden":`true`}});e.applyMessageRowLayout(r,t);let i=d(`div`,{className:f(e.getBubbleClasses(t,n).join(` `),`persona-conversation-loading-bubble`),attrs:{"data-persona-theme-zone":`${t}-message`},style:{width:t===`user`?`64%`:`100%`,backgroundColor:n===`flat`?`transparent`:`var(--persona-message-${t}-bg, var(--persona-${t===`user`?`accent`:`container`}))`,color:`var(--persona-message-${t}-text, ${t===`user`&&n!==`flat`?`white`:`var(--persona-text)`})`}},...[`94%`,...t===`assistant`?[`86%`]:[],`62%`].map(e=>d(`div`,{className:`persona-conversation-loading-line`,style:{width:e}})));return e.applyBubbleGeometry(i,t,n,{...e.resolveThemeDefaults(e.config.future).components.message[t],...e.config.theme?.components?.message?.[t],...e.config.darkTheme?.components?.message?.[t]}),r.appendChild(i),r},wt=()=>d(`div`,{className:`persona-conversation-loading-body`,style:{gap:e.messagesWrapper.style.gap}},Ct(`user`),Ct(`assistant`),Ct(`user`),Ct(`assistant`)),Tt=()=>e.config.loadingIndicator?.conversationOpenVariant===`skeleton`?wt():d(`div`,{className:`persona-conversation-loading-spinner`,attrs:{"aria-hidden":`true`}},d(`span`,{className:`persona-conversation-loading-ring`})),Et=t=>{e.conversationOpenPendingEl?.remove(),e.conversationOpenPendingEl=t,t.hidden=!e.conversationOpenTakeover,e.body.insertBefore(t,e.messagesWrapper),Y(),e.conversationOpenTakeover||(bt=setTimeout(xt,250)),E(e.footer,!0)},Dt=()=>{let t={config:e.config,streaming:!1,location:`conversation-open`,defaultRenderer:Tt},r=null,i=e.plugins.find(e=>e.renderLoadingIndicator);i?.renderLoadingIndicator&&(r=i.renderLoadingIndicator(t)),r===null&&e.config.loadingIndicator?.render&&(r=e.config.loadingIndicator.render(t));let a=r??Tt();Et(d(`div`,{className:f(`persona-conversation-loading`,a.classList.contains(`persona-conversation-loading-spinner`)&&`persona-conversation-loading--centered`),attrs:{role:`status`,"aria-label":n.openConversationLoadingLabel},style:{maxWidth:e.messagesWrapper.style.maxWidth||`none`}},a))},Ot=t=>{let r=()=>{kt(t,{focusComposer:!0}).catch(()=>{})},i=S()?()=>{X(),gt()}:void 0,a=(e,t)=>{let n=d(`button`,{className:`persona-conversation-loading-error-action`,attrs:{type:`button`},text:e});return n.addEventListener(`click`,t),n},o=()=>d(`div`,{className:`persona-conversation-loading-error-body`},d(`p`,{className:`persona-conversation-loading-error-title`,text:n.openConversationErrorTitle}),d(`div`,{className:`persona-conversation-loading-error-actions`},a(n.openConversationRetryLabel,r),i?a(n.openConversationBackLabel,i):null)),s=Object.freeze({conversationId:t,config:e.config,copy:Object.freeze({title:n.openConversationErrorTitle,retryLabel:n.openConversationRetryLabel,backLabel:n.openConversationBackLabel}),retry:r,...i?{back:i}:{},defaultRenderer:o}),c=null;for(let t of e.plugins)if(t.renderHistoryOpenError){try{c=t.renderHistoryOpenError(s)}catch(e){console.warn(`[persona] renderHistoryOpenError threw`,e),c=null}if(c)break}if(J?.remove(),J=d(`div`,{className:`persona-conversation-loading-error`,attrs:{role:`alert`}},c??o()),!e.session.getActiveConversationId()&&e.session.getMessages().length===0&&!e.composerStore.getState().text&&!e.attachmentManager?.hasAttachments()){let e=J;J=null,Et(e),xt()}else e.body.insertBefore(J,e.messagesWrapper);e.announceHistory(n.openConversationErrorTitle)};e.eventBus.on(`history:closed`,()=>{e.conversationOpenPendingEl&&E(e.footer,!0)});let kt=async(t,{focusComposer:n=!1,busy:r=`reject`}={})=>{let i=w();if(r===`background`&&(e.session.assertBackgroundSwitchable(),e.composerStore.getState().phase===`preparing`))throw new e.SessionHistoryError(`conversation_busy`,`Finish preparing this turn before switching conversations`);if(r===`reject`&&(e.session.isStreaming()||[`paused`,`resuming`].includes(e.session.getStatus())||e.composerStore.getState().phase===`preparing`))throw new e.SessionHistoryError(`conversation_busy`,`Finish or stop the current turn before switching conversations`);r===`stop`&&(++e.composerConversationGeneration,e.submissionAbort?.abort(),e.submissionAbort=null,e.composerStore.setPreparing(!1),e.session.cancel());let a=e.conversationStateKey();(!e.conversationOpenPendingEl||e.pendingConversationReading?.key!==a)&&(e.pendingConversationReading={key:a,reading:e.captureConversationReading()});let s=null,c=!!o;o?.view.setActiveConversationId(t),X();let l=yt;Dt(),e.historyVisible&&(e.historyPresentation===`panel`||I)&&q({restoreFocus:!1}),e.suppressScrollSend=!0;try{await e.session.openConversation(t,{scope:i,busy:r,onBeforeCommit:()=>{e.saveConversationContinuity(),s=e.composerConversationGeneration,e.conversationPersistenceOwner=s},onCommitted:()=>{e.restoreConversationContinuity(),e.conversationPersistenceOwner===s&&(e.conversationPersistenceOwner=null),e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),e.persistState()}})}catch(n){if(e.conversationPersistenceOwner===s&&(e.conversationPersistenceOwner=null),s===e.composerConversationGeneration&&e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),l===yt){let n=e.pendingConversationReading?.reading;X(),n&&e.restoreConversationReading(n),e.pendingConversationReading=null,o?.view.setActiveConversationId(e.session.getActiveConversationId()),Ot(t),e.suppressScrollSend=!1}throw n}finally{(l===yt||!e.conversationOpenPendingEl)&&(e.suppressScrollSend=!1)}l===yt&&(X(),e.pendingConversationReading=null,e.messageCache.clear(),St(),Q(),c||e.setActiveConversationSummary(null),e.eventBus.emit(`history:conversationOpened`,{conversationId:t,title:e.activeConversationTitle,scope:i,timestamp:Date.now()}),n&&e.maybeFocusInput())},At=async({focusComposer:t=!1}={})=>{X();let n=null;try{await e.session.startNewConversation({scope:w(),onBeforeCommit:()=>{e.saveConversationContinuity(),n=e.composerConversationGeneration,e.conversationPersistenceOwner=n},onCommitted:()=>{e.restoreConversationContinuity(!0),e.conversationPersistenceOwner===n&&(e.conversationPersistenceOwner=null),e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),e.persistState(),e.pendingConversationReading=null}})}catch(t){throw e.conversationPersistenceOwner===n&&(e.conversationPersistenceOwner=null),n===e.composerConversationGeneration&&e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),t}e.setActiveConversationSummary(null),e.messageCache.clear(),e.resetAnchorState(),e.resumeAutoScroll(),e.jumpToBottomInstant(),Q();let r=e.session.getActiveConversationId();o?.view.setActiveConversationId(r),e.eventBus.emit(`history:conversationStarted`,{conversationId:r,timestamp:Date.now()}),e.historyVisible&&(e.historyPresentation===`panel`||I)&&q({restoreFocus:!1}),t&&e.maybeFocusInput()},jt=async(t,n)=>{let r=await e.session.updateConversation(t,{...n,...n.title===void 0?{}:{title:n.title.trim()}});return o?.view.applyConversationSummary(r),!o&&t===e.session.getActiveConversationId()&&e.setActiveConversationSummary(r),r},Mt=async t=>{let n=w(),r=e.session.getActiveConversationId()===t;await e.session.deleteConversation(t,{scope:n}),e.discardConversationContinuity(t),r&&(e.attachmentManager?.destroy({release:!0}),e.attachmentManager=null,e.restoreConversationContinuity(!0)),o?.view.removeConversationSummary(t),r&&(e.setActiveConversationSummary(null),e.messageCache.clear(),e.resetAnchorState(),e.resumeAutoScroll(),Q()),e.eventBus.emit(`history:conversationDeleted`,{conversationId:t,scope:n,wasActive:r,timestamp:Date.now()})},Nt=async t=>{let n=t?.scope??w(),r=t?.allTargets?null:t?.targetId??te(),i=await e.session.clearConversationHistory({...r?{targetId:r}:{},scope:n});return e.discardConversationContinuity(),e.setActiveConversationSummary(null),e.messageCache.clear(),e.resetAnchorState(),e.resumeAutoScroll(),Q(),e.eventBus.emit(`history:cleared`,{deleted:i.deleted,scope:n,targetId:r,timestamp:Date.now()}),i},Pt=async()=>{if(!r?.resetDevice)throw Error(`[Persona] resetHistoryIdentity() requires a history provider that can reset this device`);let t=!1;try{t=(await e.session.resetHistoryDevice()).remoteRevocationConfirmed}finally{e.discardConversationContinuity(),X(),e.setActiveConversationSummary(null),e.session.clearArtifacts(),e.messageCache.clear(),e.lastAppliedMessages=null,e.config.clearStoredSessionId?.(),e.config.clearStoredConversationId?.(),e.persistentMetadata={},e.actionManager.syncFromMetadata(),e.clearPersistedDraft();let t=e.storageAdapter;t?.clear&&e.runStorageMutation(()=>t.clear(),`[AgentWidget] Failed to clear storage adapter:`),e.resetAnchorState(),e.resumeAutoScroll(),Q(),q({restoreFocus:!1}),e.maybeFocusInput(),e.open||e.launcherSurfaceInstance?.launcher.element.focus()}return e.announceHistory(t?n.identityResetNotice:n.identityResetUnconfirmedNotice),e.eventBus.emit(`history:identityReset`,{remoteRevocationConfirmed:t,timestamp:Date.now()}),{remoteRevocationConfirmed:t}},Ft=()=>e.artifactSplitRoot?e.panel:e.container,It=async t=>{let n=await e.loadHistoryView().catch(()=>null);return typeof n?.showHistoryConfirm==`function`?n.showHistoryConfirm(t):window.confirm(`${t.title}\n\n${t.description}`)},Lt=async e=>await It({host:Ft(),title:n.deleteConversationConfirmTitle,description:n.deleteConversationConfirm,confirmLabel:n.deleteConversationConfirmLabel,cancelLabel:n.confirmCancelLabel})?(await Mt(e),`deleted`):`cancelled`,Rt=async()=>{let e=w()===`verified-user`;return await It({host:Ft(),title:n.clearHistoryConfirmTitle,description:e?n.clearHistoryVerifiedConfirm:n.clearHistoryConfirm,confirmLabel:n.clearHistoryConfirmLabel,cancelLabel:n.confirmCancelLabel})?(await Nt(),`cleared`):`cancelled`},zt=async()=>{if(!await It({host:Ft(),title:n.resetIdentityConfirmTitle,description:n.resetIdentityConfirm,confirmLabel:n.resetIdentityConfirmLabel,cancelLabel:n.confirmCancelLabel}))return{outcome:`cancelled`};let{remoteRevocationConfirmed:e}=await Pt();return{outcome:`reset`,remoteRevocationConfirmed:e}},Z=u(`button`,`persona-history-earlier`);Z.type=`button`,Z.textContent=n.showEarlierMessagesLabel,Z.setAttribute(`data-persona-history-earlier`,``),Object.assign(Z.style,{alignSelf:`center`,minHeight:`44px`,padding:`0 16px`,borderRadius:`999px`,border:`1px solid var(--persona-border, rgba(0,0,0,0.12))`,background:`transparent`,color:`inherit`,font:`inherit`,cursor:`pointer`,flexShrink:`0`});let Q=()=>{S()&&e.historySessionState.nextMessageCursor&&e.session.getActiveConversationId()?(Z.textContent=n.showEarlierMessagesLabel,Z.parentNode!==e.body&&e.body.insertBefore(Z,e.body.firstChild)):Z.remove()};Z.addEventListener(`click`,()=>{let t=e.session.getActiveConversationId(),n=e.historySessionState.nextMessageCursor;if(!t||!n||Z.disabled)return;Z.disabled=!0;let r=e.body.scrollHeight,i=e.body.scrollTop;e.session.loadOlderMessages(t,n,{scope:w()}).then(()=>{e.body.scrollTop=i+(e.body.scrollHeight-r),e.repinAnchoredMessage()}).catch(()=>{}).finally(()=>{Z.disabled=!1,Q()})});let Bt=()=>{let t=e.createHeaderIconButton({ariaLabel:n.openHistoryLabel,iconName:`history`,wrapperClassName:`persona-relative persona-inline-flex persona-items-center persona-justify-center`,extraClassName:`persona-history-toggle`,attrs:{"data-persona-history-toggle":``}});return t.button.addEventListener(`click`,n=>{S()&&!C()&&(e.historyVisible?q():gt({invoker:t.button,keyboard:n.detail===0}))}),t},Vt=()=>{if(!S()){h?.remove(),m=null,h=null;return}if(h&&!h.isConnected&&(m=null,h=null),!m&&e.header){let t=Bt();m=t.button,h=t.wrapper;let n=e.panelElements.clearChatButtonWrapper||e.panelElements.closeButtonWrapper;n?.parentNode&&e.header.contains(n)?n.parentNode.insertBefore(h,n):e.header.appendChild(h)}if(!m||!h)return;let t=W()||e.historyVisible&&e.historyPresentation===`rail`;if(h.style.display=t?`none`:``,t){document.activeElement===m&&ht();return}let r=C();m.disabled=r,m.setAttribute(`aria-disabled`,r?`true`:`false`);let i=r?n.openHistoryBusyLabel:n.openHistoryLabel;m.setAttribute(`aria-label`,i),(e.config.features?.history?.presentation??`panel`)===`panel`?(m.removeAttribute(`aria-expanded`),m.removeAttribute(`aria-controls`)):(m.setAttribute(`aria-expanded`,e.historyVisible?`true`:`false`),m.setAttribute(`aria-controls`,x))},Ht=!1,Ut=()=>{let t=e.panelElements.clearChatButton;t&&(S()?(Ht||=(v=t.getAttribute(`aria-label`)??``,!0),t.setAttribute(`aria-label`,n.newConversationLabel),t.removeAttribute(`title`)):Ht&&(Ht=!1,v&&t.setAttribute(`aria-label`,v)))},$=()=>{n=i(e.config.features?.history?.copy),Vt(),et(),Ut(),Q()};return e.historyChromeSync=$,se(),$(),e.destroyCallbacks.push(()=>{y?.(),b?.(),_+=1,_t(),o?.dispose(),o?.view.destroy(),o=null}),{clearConversationOpenPending:X,cancelConversationOpenTakeover:Y,historyOperationScope:w,discardConversationContinuity:e.discardConversationContinuity,historyAvailable:S,historyScope:ee,installHistoryProvider:se,syncHistoryChromeImpl:$,syncHistoryPresentation:pt,syncEarlierMessagesPill:Q,openHistory:gt,closeHistory:q,openHistoryConversation:kt,startNewConversation:At,updateHistoryConversation:jt,deleteHistoryConversation:Mt,requestDeleteConversation:Lt,clearConversationHistory:Nt,resetHistoryIdentity:Pt,railCollapseShortcut:ze,railCollapsible:we,railTriggerApplies:W,railOverlayMode:ke,toggleRailCollapsed:Re,toggleRailPinned:()=>Le(),get historyProvider(){return r},get historySurface(){return o},get railShell(){return A},get railHost(){return j},get railColumn(){return Se}}};exports.createHistoryShell=oe;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e?.layout?.embedded===!0&&e.launcher?.enabled===!1&&!e.launcher.sidebarMode&&(e.launcher.mountMode??`floating`)===`floating`,t=t=>t?.layout?.showHeader??!e(t),n=/* @__PURE__ */ `viewTitle.openHistoryLabel.openHistoryBusyLabel.newConversationLabel.expandLabel.collapseLabel.resizeLabel.showEarlierMessagesLabel.openConversationLoadingLabel.openConversationErrorTitle.openConversationRetryLabel.openConversationBackLabel.confirmCancelLabel.deleteConversationConfirmTitle.deleteConversationConfirm.deleteConversationConfirmLabel.clearHistoryConfirmTitle.clearHistoryConfirm.clearHistoryVerifiedConfirm.clearHistoryConfirmLabel.resetIdentityConfirmTitle.resetIdentityConfirm.resetIdentityConfirmLabel.conversationDeletedNotice.identityResetNotice.identityResetUnconfirmedNotice`.split(`.`),r={viewTitle:`Messages`,openHistoryLabel:`Messages`,openHistoryBusyLabel:`Messages, available once the reply finishes`,newConversationLabel:`New conversation`,expandLabel:`Expand conversation list`,collapseLabel:`Collapse conversation list`,resizeLabel:`Resize conversation list`,showEarlierMessagesLabel:`Show earlier messages`,openConversationLoadingLabel:`Loading conversation`,openConversationErrorTitle:`Could not open the conversation.`,openConversationRetryLabel:`Try again`,openConversationBackLabel:`Back to messages`,confirmCancelLabel:`Cancel`,deleteConversationConfirmTitle:`Delete conversation`,deleteConversationConfirm:`Delete this conversation? This cannot be undone.`,deleteConversationConfirmLabel:`Delete`,clearHistoryConfirmTitle:`Delete all conversations`,clearHistoryConfirm:`Delete all conversations for this assistant on this browser? This cannot be undone.`,clearHistoryVerifiedConfirm:`Delete all conversations for this assistant and signed-in user? This cannot be undone.`,clearHistoryConfirmLabel:`Delete all`,resetIdentityConfirmTitle:`Forget this device`,resetIdentityConfirm:`Forget this device? All Persona data stored in this browser is cleared. Records are not deleted elsewhere.`,resetIdentityConfirmLabel:`Forget this device`,conversationDeletedNotice:`That conversation was deleted. You are now in a new conversation.`,identityResetNotice:`This device was forgotten.`,identityResetUnconfirmedNotice:`This device was cleared here, but the server could not confirm it.`};function i(e){if(!e)return r;let t={...r};for(let r of n){let n=e[r];typeof n==`string`&&n.length>0&&(t[r]=n)}return t}const a=(e,t)=>{console.warn(`[persona] ${e} threw`,t)},o=e=>Object.freeze({...e}),s=e=>Object.freeze({id:e.id,title:e.title,targetId:e.targetId,preview:e.preview,messageCount:e.messageCount,createdAt:e.createdAt,updatedAt:e.updatedAt}),c=e=>e?o(e):null;function l(e){let{plugins:t,config:n}=e,r=!1,i=!1,l=!1,u=!1,d=null,f=[],p=()=>{for(let e of f.splice(0))try{e()}catch(e){a(`renderHistoryView cleanup`,e)}},m=(e,n)=>{for(let r of t){let t=r[e];if(t)try{let e=t(n);if(e)return e}catch(t){a(e,t)}}return null},h=()=>({presentation:e.getPresentation(),config:n}),g={header:t=>u?m(`renderHistoryHeader`,Object.freeze({...h(),returnSurface:e.getReturnSurface(),identityStatus:o(t.identityStatus),pendingAction:c(t.pendingAction),copy:o(t.copy),actions:Object.freeze({close:y.close,startNewConversation:y.startNewConversation}),defaultRenderer:t.defaultRenderer})):null,conversation:e=>u?m(`renderHistoryConversation`,Object.freeze({...h(),conversation:s(e.conversation),active:e.active,pending:e.pending,open:e.open,requestDelete:e.requestDelete,defaultRenderer:e.defaultRenderer})):null,state:e=>u?m(`renderHistoryState`,Object.freeze({...h(),state:o(e.state),identityStatus:o(e.identityStatus),copy:o(e.copy),...e.retry?{retry:e.retry}:{},...e.startNewConversation?{startNewConversation:e.startNewConversation}:{},defaultRenderer:e.defaultRenderer})):null},_=t.flatMap(t=>(t.railSections??[]).map(t=>({...t,placement:t.placement??`above-conversations`,items:[],render:n=>t.render(Object.freeze({collapsed:n,presentation:e.getPresentation(),actions:y}))}))),v=e.createView({slots:g,renderDom:!1,onModelChange:()=>C(),railSections:_}),y=Object.freeze({...v.operations,close:e.close}),b=()=>(u=!0,v.setDomRenderEnabled(!0),v.element),x=t=>Object.freeze({conversations:Object.freeze(t.conversations.map(s)),activeConversationId:t.activeConversationId,state:o(t.state),pendingAction:c(t.pendingAction),identityStatus:o(t.identityStatus),nextCursor:t.nextCursor,presentation:e.getPresentation(),returnSurface:e.getReturnSurface(),config:n,copy:o(v.copy),actions:y,defaultRenderer:b,requestRender:()=>C(),onCleanup:e=>{f.push(e)}}),S=()=>{u=!1;let e=null;for(let n of t)if(n.renderHistoryView){try{e=n.renderHistoryView(x(v.getModel()))}catch(t){a(`renderHistoryView`,t),e=null}if(e)break}let n=!e||e.contains(v.element);return u=n,v.setDomRenderEnabled(n),e??v.element};function C(){if(!(!l||r||i)){i=!0;try{p();let t=S();if(t===d)return;let n=d;d=t,e.onElementChanged(t,n)}finally{i=!1}}}return l=!0,C(),{view:v,get element(){return d??v.element},requestRender:C,dispose:()=>{r=!0,p()}}}const u=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n},d=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r},f=(...e)=>e.filter(Boolean).join(` `);function p(e){return typeof e==`string`?e:e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function m(e){return typeof e!=`string`&&e.some(e=>e.type===`image`)}function h(e){return{type:`text`,text:e}}function g(e,t){return{type:`image`,image:e,...t?.mimeType&&{mimeType:t.mimeType},...t?.alt&&{alt:t.alt}}}const _=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`image/bmp`],v=[`application/pdf`,`text/plain`,`text/markdown`,`text/csv`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/json`];[..._,...v];function y(e,t,n){return{type:`file`,data:e,mimeType:t,filename:n}}const b=[`user`,`assistant`,`system`,`operator`];function x(e){if(typeof e!=`string`||e===``)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function S(e){return typeof e==`string`?e:void 0}function C(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`text`:return typeof t.text==`string`?h(t.text):null;case`image`:return typeof t.image==`string`?g(t.image,{mimeType:S(t.mimeType),alt:S(t.alt)}):null;case`file`:return typeof t.data==`string`&&typeof t.mimeType==`string`&&typeof t.filename==`string`?y(t.data,t.mimeType,t.filename):null;case`audio`:return typeof t.audio==`string`?{type:`audio`,audio:t.audio,...S(t.mimeType)!==void 0&&{mimeType:t.mimeType}}:null;case`video`:return typeof t.video==`string`?{type:`video`,video:t.video,...S(t.mimeType)!==void 0&&{mimeType:t.mimeType}}:null;default:return null}}function ee(e,t){let n=x(t),r=e.map(e=>x(e.timestamp)),i=Array(e.length),a=0;for(;a<r.length;){let e=r[a];if(e!==null){i[a]=e,a+=1;continue}let t=a;for(;t+1<r.length&&r[t+1]===null;)t+=1;let o=t-a+1,s=a>0?i[a-1]:null,c=t+1<r.length?r[t+1]:null,l=c!==null&&n!==null?Math.min(c,n):c??n;for(let e=0;e<o;e+=1)i[a+e]=l===null?s===null?0+e:s+e+1:l-(o-e);a=t+1}return i.map(e=>new Date(e).toISOString())}function w(e,t){let n=ee(e,t?.beforeCreatedAt),r=[];return e.forEach((e,t)=>{if(typeof e?.id!=`string`||e.id===``||!b.includes(e.role))return;let i=e.role,a=n[t],o=e.author,s=o&&typeof o==`object`?{...typeof o.id==`string`&&{id:o.id},...typeof o.displayName==`string`&&{displayName:o.displayName},...[`human`,`ai`,`system`].includes(o.kind??``)&&{kind:o.kind}}:void 0;if(e.displayAvailable===!1){let t={historyDisplayUnavailable:!0};r.push({id:e.id,role:i,...s&&{author:s},content:``,createdAt:a,agentMetadata:t})}else if(typeof e.displayContent==`string`)r.push({id:e.id,role:i,...s&&{author:s},content:e.displayContent,createdAt:a});else if(typeof e.content==`string`)r.push({id:e.id,role:i,...s&&{author:s},content:e.content,createdAt:a});else if(Array.isArray(e.content)){let t=e.content.map(C).filter(e=>e!==null),n=p(t);r.push({id:e.id,role:i,...s&&{author:s},content:n||(m(t)?`[Image]`:``),createdAt:a,...t.length>0&&{contentParts:t}})}else r.push({id:e.id,role:i,...s&&{author:s},content:``,createdAt:a})}),r}function te(e,t){let n=/* @__PURE__ */ new Map;for(let t of e)n.set(t.id,t);for(let e of t)n.set(e.id,e);return[...n.values()].sort((e,t)=>{let n=new Date(e.createdAt).getTime(),r=new Date(t.createdAt).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r)return n-r;let i=e.sequence??0,a=t.sequence??0;return i===a?e.id.localeCompare(t.id):i-a})}const ne=/* @__PURE__ */ new Map([[`not_found`,`not_found`],[`conversation_deleted`,`not_found`],[`rate_limited`,`rate_limited`],[`authentication_required`,`authentication_required`],[`invalid_identity_proof`,`authentication_required`],[`visitor_identity_mismatch`,`authentication_required`],[`visitor_required`,`authentication_required`],[`identity_provider_failed`,`identity_provider_failed`],[`proof_not_admitted`,`proof_not_admitted`],[`identity_contract_violation`,`proof_not_admitted`],[`unauthorized`,`authentication_failed`],[`visitor_token_missing`,`authentication_failed`],[`conversation_credential_missing`,`authentication_failed`]]),re=/* @__PURE__ */ new Map([[`not_found`,`That conversation is no longer available.`],[`rate_limited`,`Too many history requests.`],[`authentication_failed`,`History access was not authorized.`],[`authentication_required`,`Sign in again to view account history.`],[`identity_provider_failed`,`The identity provider did not respond.`],[`proof_not_admitted`,`Account history is not available for this configuration.`],[`unsupported_scope`,`This history scope is not supported.`],[`unavailable`,`Conversation history is unavailable right now.`]]),T=e=>re.get(e)??`Conversation history is unavailable right now.`;function ie(e,{HistoryClientError:t,HistoryProviderError:n}){if(e instanceof n)return e;if(e instanceof t){let t=ne.get(e.code)??`unavailable`;return new n(t,T(t),{...e.retryAfterSeconds===void 0?{}:{retryAfterSeconds:e.retryAfterSeconds}})}return new n(`unavailable`,T(`unavailable`))}function ae(e){let{HistoryProviderError:t}=e.errors,n=()=>e.getClient?.()??e.client,r=e.getIdentityProofConfigured()?[`browser`,`verified-user`]:[`browser`],i={scopes:r},a=e=>{if(!r.includes(e))throw new t(`unsupported_scope`,T(`unsupported_scope`))},o=async(t,n)=>{a(t);try{return await n()}catch(t){throw ie(t,e.errors)}},s=t=>{let n=!1;return{conversationId:t.session.conversationId??``,conversationRevision:t.session.conversationRevision??``,async commit(){n||(n=!0,t.commit(),await e.onActivationCommitted(t.session))},discard(){n||(n=!0,t.discard())}}};return{capabilities:i,getIdentityStatus(){return n().getHistoryIdentityStatus()},subscribeIdentityStatus(e){return n().subscribeHistoryIdentityStatus(e)},subscribeAvailability(e){return n().subscribeHistoryAvailability(e)},async list(e){return o(e.context.scope,async()=>{let t=await n().listConversations({...e.cursor?{cursor:e.cursor}:{},...e.limit===void 0?{}:{limit:e.limit},...e.targetId?{targetId:e.targetId}:{},scope:e.context.scope});return{items:t.data,nextCursor:t.nextCursor}})},async getPage(e,t){return o(t.context.scope,async()=>{let r=await n().getConversation(e,{...t.cursor?{messageCursor:t.cursor}:{},scope:t.context.scope}),i=w(r.messages,{...t.beforeCreatedAt?{beforeCreatedAt:t.beforeCreatedAt}:{}});return{summary:r.summary,messages:te([],i),conversationRevision:r.conversationRevision??``,nextCursor:r.nextMessageCursor}})},async prepareOpen(e,t){return o(t.context.scope,async()=>s(await n().prepareConversationSession(e)))},async prepareStartNew(e){return o(e.context.scope,async()=>s(await n().prepareNewConversationSession()))},async delete(e,t){await o(t.context.scope,()=>n().deleteConversation(e,{scope:t.context.scope}))},async deleteAll(e){return o(e.context.scope,()=>n().deleteAllConversations({...e.targetId===void 0?{}:{targetId:e.targetId},scope:e.context.scope}))},async resetDevice(){try{return await n().resetVisitor(),{remoteRevocationConfirmed:!0}}catch{return{remoteRevocationConfirmed:!1}}}}}const oe=e=>{let n=i(e.config.features?.history?.copy),r=null,a=!1,o=null,s=null,c=`conversation`,p=null,m=null,h=null,g=null,_=0,v=null,y=null,b=null,x=`persona-history-${Math.random().toString(36).slice(2,8)}`,S=()=>e.historyFeatureEnabled()&&!!r&&!a,C=()=>{let t=e.session.getStatus();return e.isStreaming||t===`paused`||t===`resuming`},ee=()=>{let t=e.config.features?.history?.scope;if(t)return t;let n=e.config.getIdentityProof?`verified-user`:`browser`,i=r?.capabilities.scopes;return!i||i.includes(n)?n:i[0]??n},w=()=>s?.scope??ee(),te=()=>e.session.getClientSession()?.targetId??null,ne=e=>`${e.state}:${`reason`in e?e.reason:``}`,re=t=>{let n=ne(t);n!==g&&(g=n,e.eventBus.emit(`history:identityStatusChanged`,{status:t,timestamp:Date.now()}))},T=null,ie=null,oe=()=>{if(!e.historyFeatureEnabled())return null;let t=e.getHistoryProviderFactory();if(t)return t();let n=e.config.features?.history?.provider;return n?typeof n==`function`?(T!==n&&(T=n,ie=n()),ie):n:e.session.isClientTokenMode()?ae({errors:e.historyErrors,client:e.session.getClient(),getIdentityProofConfigured:()=>typeof e.config.getIdentityProof==`function`,onActivationCommitted:t=>e.session.bindActivatedSession(t),getClient:()=>e.session.getClient()}):null},se=()=>{y?.(),y=null,b?.(),b=null,a=!1;let t=r;r=oe(),t&&t!==r&&e.discardConversationContinuity();let n={...e.historyInternals};r?n.historyProvider=r:delete n.historyProvider,e.historyInternals=n,e.session.setHistoryInternals(e.historyInternals),r&&(y=r.subscribeAvailability?.(e=>{a=!e,e||q({restoreFocus:!1}),$()})??null,b=r.subscribeIdentityStatus(e=>re(e)),g=ne(r.getIdentityStatus()))},ce=()=>{let t=e.config.features?.history?.presentation??`panel`;if(t===`panel`||t===`auto`&&e.launcherEnabled&&!e.isDockedMountMode(e.config))return`panel`;let n=e.artifactSplitRoot??e.container;return(n.getBoundingClientRect().width||n.clientWidth)>=720?`rail`:`panel`},E=(e,t)=>{t?(e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``)):(e.removeAttribute(`aria-hidden`),e.removeAttribute(`inert`))},le=`data-persona-history-suppressed`,D=null,O=null,k=null,ue=null,de=null,fe=``,pe=()=>e.header===de?fe:t(e.config)?``:`none`,me=()=>e.historyPresentation===`panel`&&!!k&&ue===k.element&&t(e.config)&&pe()!==`none`,he=()=>{for(let t of Array.from(e.header.children))t!==D&&t.setAttribute(le,``)},ge=()=>{for(let t of Array.from(e.container.querySelectorAll(`[${le}]`)))t.removeAttribute(le)},_e=()=>{let t=k;if(!t)return;if(Array.from(e.header.children).some(e=>e!==D&&!e.hasAttribute(le))){O&&O!==e.header&&(O.style.removeProperty(`min-height`),O=null);let t=e.header.offsetHeight;t>0&&(e.header.style.minHeight=`${t}px`,O=e.header)}D||=u(`div`,`persona-history-header-host`),t.setHeaderPlacement(`external`);let n=t.getHeaderElement();n.parentNode!==D&&D.replaceChildren(n),D.parentNode!==e.header&&e.header.appendChild(D),he()},ve=()=>{O&&=(O.style.removeProperty(`min-height`),null),D&&(k?.setHeaderPlacement(`inline`),D.remove(),D=null,ge())},ye=null,be=()=>{ye&&(e.body.style.display=`none`,E(e.body,!0),e.footer.hidden=!0,E(e.footer,!0),e.panelSuggestions.style.display=`none`,E(e.panelSuggestions,!0),e.panelSuggestionsFade.style.display=`none`,me()?(_e(),e.header.style.display=pe(),E(e.header,!1)):(ve(),e.header.style.display=`none`,E(e.header,!0)))};e.reapplyHistoryHostChrome=be;let xe=n=>{let r=e.body.style.display,i=e.footer.hidden,a=e.panelSuggestions.style.display,o=e.panelSuggestionsFade.style.display,s=e.footer,c=e.header,l=e.header.style.display;de=c,fe=l,ye=()=>{ye=null,ve(),de=null,e.body.style.display=r,E(e.body,!1),e.panelSuggestions.style.display=a,E(e.panelSuggestions,!1),e.panelSuggestionsFade.style.display=o,s.hidden=i,E(s,!1),e.footer!==s&&(e.footer.hidden=!1,E(e.footer,!1)),c.style.display=l,E(c,!1),e.header!==c&&(e.header.style.display=t(e.config)?``:`none`,E(e.header,!1))},e.container.insertBefore(n,e.footer.parentNode===e.container?e.footer:e.panelSuggestions),be()},A=null,j=null,Se=null,M=null,Ce=()=>[e.header,e.panelElements.closeButtonWrapper,e.panelElements.clearChatButtonWrapper,e.body,e.footer,e.scrollToBottomButton],we=()=>e.config.features?.history?.rail?.collapsible!==!1,N=()=>e.config.features?.history?.rail?.side===`right`?`right`:`left`,Te=e=>Math.min(400,Math.max(200,Math.round(e))),Ee=()=>e.config.features?.history?.rail?.resizable===!0,P,De=()=>{if(P===void 0&&(P=null,e.config.persistState!==!1))try{let t=Number(window.localStorage.getItem(`${e.currentKeyPrefix()}rail-width`));t&&(P=t)}catch{}return P},F=()=>Te(De()??e.config.features?.history?.rail?.width??260),Oe=t=>{if(P=t,e.config.persistState!==!1)try{window.localStorage.setItem(`${e.currentKeyPrefix()}rail-width`,String(t))}catch{}},ke=()=>we()&&e.config.features?.history?.rail?.collapsedBehavior===`overlay`,I=!1,Ae=e=>{let t=u(`img`);return t.src=e,t.alt=``,t.setAttribute(`aria-hidden`,`true`),t},je=()=>{let t=e.config.features?.history?.rail?.brand;if(!t)return;let n=!1,r;return i=>{if(t.render)try{return t.render({collapsed:i})??null}catch(e){return n||(n=!0,console.warn(`[persona] history rail brand threw`,e)),null}return r===void 0&&(r=t.iconUrl?Ae(t.iconUrl):t.icon?e.renderLucideIcon(t.icon,20):null),r?r.cloneNode(!0):null}},Me=()=>e.config.features?.history?.rail?.sections?.map(t=>{let n=!1,r=e=>{n||(n=!0,console.warn(`[persona] history rail section threw`,t.id,e))};return{id:t.id,title:t.title,placement:t.placement??`above-conversations`,items:t.items.map(t=>{let n;return{id:t.id,label:t.label,badge:t.badge,iconNode:()=>{if(n!==void 0)return n;try{n=t.renderIcon?t.renderIcon()??null:t.iconUrl?Ae(t.iconUrl):t.icon?e.renderLucideIcon(t.icon,20):null}catch(e){r(e),n=null}return n},onSelect:()=>{try{t.onSelect()}catch(e){r(e)}}}})}})??[],Ne=e=>{let t=Me();for(let n of e)t.some(e=>e.id===n.id)?console.warn(`[persona] duplicate history rail section id`,n.id):t.push(n);return t.length?t:void 0},L=null,Pe=()=>`${e.currentKeyPrefix()}rail-collapsed`,Fe=()=>{if(L===null&&(L=e.config.features?.history?.rail?.defaultCollapsed===!0,e.config.persistState!==!1))try{let e=window.localStorage.getItem(Pe());e&&(L=e===`1`)}catch{}return L},Ie=t=>{if(L=t,e.config.persistState!==!1)try{window.localStorage.setItem(Pe(),t?`1`:`0`)}catch{}},R=()=>e.historyPresentation===`rail`&&we()&&!ke()&&Fe(),Le=()=>{},Re=()=>{ke()?Le():(Ie(!Fe()),o?.view.setCollapsed(R()),e.applyRailChrome(),e.repinAnchoredMessage())},ze=()=>{let t=e.config.features?.history?.rail?.collapseShortcut;return!t||!e.parseCombo(t)?null:{combo:t,hint:e.formatCombo(t),aria:e.ariaCombo(t)}},Be=`var(--persona-history-overlay-margin,8px)`,z=null,B=null,Ve=0,V=null,H=null,U=!1,He=0,Ue=()=>window.matchMedia?.(`(pointer: coarse)`).matches===!0,W=()=>S()&&ke()&&(e.historyPresentation??ce())===`rail`,We=()=>e.historyVisible&&!I,G=()=>{H!==null&&clearTimeout(H),H=null},Ge=()=>{e.loadHistoryView().catch(()=>{})},Ke=()=>{G(),I&&(H=setTimeout(()=>{H=null,!U&&I&&(V?.contains(document.activeElement)||q({restoreFocus:!1}))},300))},qe=(e,t)=>{let n=V?.getBoundingClientRect();if(!n)return!1;let r=z?.getBoundingClientRect(),i=r?Math.min(r.top,n.top):n.top;return e>=n.left&&e<=n.right&&t>=i&&t<=n.bottom||!!r&&e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom},Je=e=>{I&&(U=qe(e.clientX,e.clientY),U?G():H===null&&Ke())},Ye=t=>{!e.historyVisible&&W()&&(I=!0,gt({invoker:z,keyboard:t?.keyboard===!0}).then(()=>{e.historyVisible?!U&&document.activeElement!==z&&q():I=!1}))},Xe=()=>{let e=ue?.querySelector(`[data-persona-history-focus="collapse"]`);e&&(e.setAttribute(`aria-label`,I?n.expandLabel:n.collapseLabel),e.setAttribute(`aria-expanded`,I?`false`:`true`))},Ze=()=>{Ie(!1);let t=o;if(!I||!t){gt({invoker:z});return}let n=document.activeElement===z;I=!1,ut(),t.element.remove(),ft(t.element),Xe(),n&&ht(),e.repinAnchoredMessage(),$()},Qe=()=>{Ie(!0),q()};Le=()=>{!e.historyVisible||I?Ze():Qe()};let $e=()=>{let t=ze(),r=e.createHeaderIconButton({ariaLabel:n.expandLabel,iconName:`panel-left`,wrapperClassName:`persona-relative persona-inline-flex persona-items-center persona-justify-center`,extraClassName:`persona-rail-trigger`,tooltip:!1,attrs:{"data-persona-rail-trigger":``,"aria-controls":x,...t?{"aria-keyshortcuts":t.aria}:{}}}),i=r.button;i.addEventListener(`mouseenter`,()=>{U=!0,G(),!(Ue()||Date.now()<He)&&Ye()}),i.addEventListener(`mouseleave`,()=>{U=!1,He=0,Ke()}),i.addEventListener(`focus`,()=>{e.historyVisible||Ge()}),i.addEventListener(`click`,t=>{S()&&(t.detail!==0&&Ue()&&!e.historyVisible?Ye():Ze())}),z=i,B=r.wrapper},et=()=>{if(B&&!B.isConnected&&(B=null,z=null),!W()){B?.remove(),B=null,z=null;return}z||$e();let t=B,r=z;if(!t||!r)return;let i=N()===`right`?null:e.header.firstChild;(i??e.header.lastChild)!==t&&e.header.insertBefore(t,i),t.style.display=We()||Ve>0?`none`:``,r.setAttribute(`aria-label`,n.expandLabel),r.setAttribute(`aria-expanded`,e.historyVisible?`true`:`false`),V&&e.applyRailChrome()},tt=e=>{if(!I)return;let t=e.target;t instanceof Node&&(V?.contains(t)||B?.contains(t)||t instanceof Element&&t.closest(`.persona-dropdown-menu,[role="alertdialog"]`)||q({restoreFocus:!1}))};document.addEventListener(`pointerdown`,tt,!0),e.destroyCallbacks.push(()=>{document.removeEventListener(`pointerdown`,tt,!0),document.removeEventListener(`pointermove`,Je),K?.(),G()});let nt=null,K=null,rt=t=>{Oe(Te(t)),e.applyRailChrome(),e.repinAnchoredMessage()},it=()=>{let t=u(`div`,`persona-rail-resizer`);return t.tabIndex=0,t.setAttribute(`role`,`separator`),t.setAttribute(`aria-orientation`,`vertical`),t.setAttribute(`aria-valuemin`,`200`),t.setAttribute(`aria-valuemax`,`400`),t.addEventListener(`pointerdown`,n=>{let r=j;if(!r||n.button!==0)return;n.preventDefault(),K?.();let i=n.clientX,a=r.getBoundingClientRect().width||F(),o=N()===`right`?-1:1,s=a,c=e.mount.ownerDocument;r.style.transition=`none`;let l=e=>{s=Te(a+o*(e.clientX-i)),r.style.flex=`0 0 ${s}px`,t.setAttribute(`aria-valuenow`,String(s))},u=()=>{K=null,c.removeEventListener(`pointermove`,l),c.removeEventListener(`pointerup`,u),c.removeEventListener(`pointercancel`,u),r.style.removeProperty(`transition`);try{t.releasePointerCapture(n.pointerId)}catch{}rt(s)};K=u,c.addEventListener(`pointermove`,l),c.addEventListener(`pointerup`,u),c.addEventListener(`pointercancel`,u);try{t.setPointerCapture(n.pointerId)}catch{}}),t.addEventListener(`keydown`,e=>{let t=N()===`right`?-16:16,n=F(),r=e.key===`ArrowRight`?n+t:e.key===`ArrowLeft`?n-t:e.key===`Home`?200:e.key===`End`?400:null;r!==null&&(e.preventDefault(),rt(r))}),t},at=(e,t)=>{if(!Ee()||R()){K?.(),nt?.remove();return}let r=nt??it();nt=r,r.setAttribute(`aria-label`,n.resizeLabel),r.setAttribute(`aria-valuenow`,String(F())),r.nextElementSibling!==t&&e.insertBefore(r,t)};e.applyRailChrome=()=>{o?.view.setRailSide(N());let t=N()===`right`,n=V;if(n){let r=z?z.getBoundingClientRect().bottom-e.container.getBoundingClientRect().top:0;n.style.top=`calc(${Math.max(0,Math.round(r))}px + ${Be})`,n.style.width=`${F()}px`,n.style.left=t?``:Be,n.style.right=t?Be:``}let r=j,i=A,a=Se;if(!r||!i||!a)return;r.style.flex=`0 0 ${R()?52:F()}px`;let s=`1px solid var(--persona-divider,#e5e7eb)`;r.style.borderRight=t?``:s,r.style.borderLeft=t?s:``;let c=t?a:r;i.firstElementChild!==c&&i.append(c,t?r:a),at(i,t?r:a)};let ot=t=>{if(M&&j){M.replaceWith(t),M=null,e.applyRailChrome();return}let n=u(`div`,`persona-history-rail-shell`);n.style.cssText=`display:flex;flex-direction:row;flex:1 1 auto;min-height:0`;let r=u(`div`,`persona-history-rail-conversation`);r.style.cssText=`display:flex;flex-direction:column;flex:1 1 auto;min-width:0;min-height:0;position:relative`;let i=u(`div`,`persona-history-rail-host`);i.style.cssText=`display:flex;min-height:0;overflow:hidden`,e.container.insertBefore(n,e.header.parentNode===e.container?e.header:e.body);for(let t of Ce())t?.parentNode===e.container&&r.appendChild(t);n.append(i,r),i.appendChild(t),A=n,j=i,Se=r,e.applyRailChrome()},st=()=>{if(A)return;let t=u(`div`,`persona-history-rail-placeholder`);t.style.cssText=`flex:1 1 auto;min-height:0`,M=t,ot(t),e.repinAnchoredMessage()},ct=()=>{M&&(ut(),e.repinAnchoredMessage())},lt=t=>{let n=u(`div`,`persona-history-rail-overlay`);n.style.cssText=`position:absolute;bottom:${Be};display:flex;overflow:hidden;z-index:100000;border-radius:var(--persona-history-overlay-radius,16px);background:var(--persona-history-overlay-bg,var(--persona-container,#f7f7f8));box-shadow:var(--persona-history-overlay-shadow,0 12px 40px rgba(0,0,0,0.25))`,e.container.style.position=`relative`,e.container.appendChild(n),n.appendChild(t),document.addEventListener(`pointermove`,Je),V=n,e.applyRailChrome(),Xe()},ut=()=>{ye?.(),V&&=(U&&(He=Date.now()+150),document.removeEventListener(`pointermove`,Je),V.remove(),null);let t=A;if(t){K?.();for(let n of Ce())if(n&&t.contains(n)){let r=n===e.scrollToBottomButton?e.panelSuggestions:t;e.container.insertBefore(n,r)}t.remove(),A=null,j=null,Se=null,M=null}},dt=e=>{ue=e,e.id=x,e.style.flex=`1 1 auto`,e.style.minHeight=`0`},ft=t=>{dt(t),(e.historyPresentation!==`rail`||I)&&ct(),e.historyPresentation===`rail`?I?lt(t):ot(t):xe(t)},pt=()=>{if(et(),Vt(),!e.historyVisible||!o)return;let t=ce();if(t===e.historyPresentation)return;let n=document.activeElement,r=n instanceof HTMLElement&&(o.element.contains(n)||D?.contains(n)===!0)?n:null;ut(),o.element.remove(),o.view.setHeaderPlacement(`inline`),e.historyPresentation=t,o.view.setPresentation(t),o.view.setCollapsed(R()),o.requestRender(),o.element.isConnected||ft(o.element),r?.isConnected?r.focus():ht(),e.syncScrollToBottomButton(),e.repinAnchoredMessage(),$()},mt=(e,t)=>D?.querySelector(t)??e.querySelector(t),ht=()=>{let e=o?.element??ue;if(!e)return;let t=mt(e,`[data-persona-history-focus="close"],[data-persona-history-focus="collapse"]`);if(t){t.focus();return}let n=mt(e,`.persona-history-title`)??e;n.tabIndex=-1,n.focus()},gt=async i=>{if(!S()||e.historyVisible)return;let a=r;if(!a)return;if(!I&&W()&&Fe()){et();return}_t();let u=++_;c=i?.returnSurface??`conversation`,p=i?.invoker??m;let d=W()&&!I;d&&(Ve+=1,et(),st());let f;try{f=await e.loadHistoryView()}catch{e.announceHistory(n.openHistoryLabel),d&&(--Ve,u===_&&(ct(),et()));return}if(d&&--Ve,u!==_||e.historyVisible)return;s={scope:ee()},e.historyPresentation=ce(),e.historyVisible=!0;let h=e.historyPresentation===`panel`&&t(e.config)&&e.header.style.display!==`none`?`external`:`inline`,g=e.config.features?.history?.rowAvatar,v=ze(),y=v?{hint:v.hint,aria:v.aria}:null,b={provider:a,context:s,targetId:te(),presentation:e.historyPresentation,collapsible:we(),collapsed:R(),railSide:N(),renderRailHeader:e.config.features?.history?.rail?.renderHeader,railBrand:je(),onToggleCollapse:Re,...y?{collapseShortcut:y}:{},headerPlacement:h,showScopeStatus:e.config.features?.history?.showScopeStatus!==!1,showDelete:e.config.features?.history?.showDelete!==!1,showDeleteAll:e.config.features?.history?.showDeleteAll!==!1,...e.config.features?.history?.listActions?.length?{listActions:e.config.features.history.listActions}:{},rowAvatar:g===!1?!1:typeof g==`string`?g:e.config.launcher?.iconUrl,activeConversationId:e.session.getActiveConversationId(),...e.config.features?.history?.grouping?{grouping:e.config.features.history.grouping}:{},...e.config.features?.history?.copy?{copy:e.config.features.history.copy}:{},...e.config.features?.history?.pageSize===void 0?{}:{pageSize:e.config.features.history.pageSize},onSelect:e=>kt(e,{focusComposer:!0}).catch(()=>{}),onActiveConversationChange:t=>e.setActiveConversationSummary(t),attachTooltip:e.attachTooltip,onStartNew:()=>At({focusComposer:!0}),onClose:()=>q(),onRequestDeleteConversation:e=>Lt(e),onRequestClearHistory:()=>Rt(),...a.resetDevice?{onRequestResetIdentity:()=>zt()}:{}};o=l({plugins:e.plugins,config:e.config,getPresentation:()=>e.historyPresentation??`panel`,getReturnSurface:()=>c,close:()=>q(),createView:({slots:t,renderDom:n,onModelChange:r,railSections:i})=>(k=f.createHistoryView({...b,railSections:Ne(i),slots:t,renderDom:n,onModelChange:r,onAnnounce:e.announceHistory}),k),onElementChanged:(e,t)=>{if(!t?.isConnected)return ft(e);dt(e),t.replaceWith(e),be()}}),o.view.setNewConversationRequired(e.historySessionState.recovery===`new_conversation_required`),i?.focus!==!1&&(e.historyPresentation!==`rail`||i?.keyboard===!0)&&ht(),e.syncScrollToBottomButton(),e.repinAnchoredMessage(),$(),e.eventBus.emit(`history:opened`,{presentation:e.historyPresentation,returnSurface:c,timestamp:Date.now()})},_t=()=>{},q=t=>{if(!e.historyVisible)return;_+=1;let n=c,r=p,i=o,a=t?.restoreFocus!==!1;e.historyVisible=!1;let l=!1,u=null,d=()=>{if(!l){if(l=!0,_t=()=>{},u!==null&&clearTimeout(u),I=!1,G(),ut(),i?.dispose(),i?.view.destroy(),i?.element.remove(),o===i&&(o=null,k=null,ue=null,e.historyPresentation=null,s=null,p=null),e.syncScrollToBottomButton(),e.repinAnchoredMessage(),$(),a){let t=r??m;t?.isConnected?t.focus():e.maybeFocusInput()}e.eventBus.emit(`history:closed`,{returnSurface:n,timestamp:Date.now()})}},f=i&&i.element===i.view.element?i.view.playExit():null;f?(_t=d,u=setTimeout(d,250),f.then(d)):d()},vt=t=>{if(t.key===`Escape`&&e.historyVisible&&o){if(e.historyPresentation===`rail`){let e=t.target;if(!(e instanceof Node)||!(o.element.contains(e)||I&&B?.contains(e)===!0))return}t.preventDefault(),t.stopPropagation(),q()}};e.container.addEventListener(`keydown`,vt),e.destroyCallbacks.push(()=>e.container.removeEventListener(`keydown`,vt));let yt=0,J=null,bt=null,Y=()=>{bt&&clearTimeout(bt),bt=null};e.destroyCallbacks.push(Y);let xt=()=>{Y();let t=e.conversationOpenPendingEl;t&&(e.conversationOpenTakeover=!0,t.hidden=!1,e.messagesWrapper.style.display=`none`,e.updateWelcome())},X=()=>{yt+=1,Y(),J?.remove(),J=null,e.conversationOpenPendingEl&&(e.conversationOpenPendingEl.remove(),e.conversationOpenPendingEl=null,e.conversationOpenTakeover=!1,e.messagesWrapper.style.removeProperty(`display`),E(e.footer,!1),e.updateWelcome())},St=()=>{try{if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches)return;e.messagesWrapper.animate([{opacity:0},{opacity:1}],{duration:150,easing:`ease-out`})}catch{}},Ct=t=>{let n=e.config.layout?.messages?.layout??`bubble`,r=d(`div`,{className:`persona-flex`,attrs:{"aria-hidden":`true`}});e.applyMessageRowLayout(r,t);let i=d(`div`,{className:f(e.getBubbleClasses(t,n).join(` `),`persona-conversation-loading-bubble`),attrs:{"data-persona-theme-zone":`${t}-message`},style:{width:t===`user`?`64%`:`100%`,backgroundColor:n===`flat`?`transparent`:`var(--persona-message-${t}-bg, var(--persona-${t===`user`?`accent`:`container`}))`,color:`var(--persona-message-${t}-text, ${t===`user`&&n!==`flat`?`white`:`var(--persona-text)`})`}},...[`94%`,...t===`assistant`?[`86%`]:[],`62%`].map(e=>d(`div`,{className:`persona-conversation-loading-line`,style:{width:e}})));return e.applyBubbleGeometry(i,t,n,{...e.resolveThemeDefaults(e.config.future).components.message[t],...e.config.theme?.components?.message?.[t],...e.config.darkTheme?.components?.message?.[t]}),r.appendChild(i),r},wt=()=>d(`div`,{className:`persona-conversation-loading-body`,style:{gap:e.messagesWrapper.style.gap}},Ct(`user`),Ct(`assistant`),Ct(`user`),Ct(`assistant`)),Tt=()=>e.config.loadingIndicator?.conversationOpenVariant===`skeleton`?wt():d(`div`,{className:`persona-conversation-loading-spinner`,attrs:{"aria-hidden":`true`}},d(`span`,{className:`persona-conversation-loading-ring`})),Et=t=>{e.conversationOpenPendingEl?.remove(),e.conversationOpenPendingEl=t,t.hidden=!e.conversationOpenTakeover,e.body.insertBefore(t,e.messagesWrapper),Y(),e.conversationOpenTakeover||(bt=setTimeout(xt,250)),E(e.footer,!0)},Dt=()=>{let t={config:e.config,streaming:!1,location:`conversation-open`,defaultRenderer:Tt},r=null,i=e.plugins.find(e=>e.renderLoadingIndicator);i?.renderLoadingIndicator&&(r=i.renderLoadingIndicator(t)),r===null&&e.config.loadingIndicator?.render&&(r=e.config.loadingIndicator.render(t));let a=r??Tt();Et(d(`div`,{className:f(`persona-conversation-loading`,a.classList.contains(`persona-conversation-loading-spinner`)&&`persona-conversation-loading--centered`),attrs:{role:`status`,"aria-label":n.openConversationLoadingLabel},style:{maxWidth:e.messagesWrapper.style.maxWidth||`none`}},a))},Ot=t=>{let r=()=>{kt(t,{focusComposer:!0}).catch(()=>{})},i=S()?()=>{X(),gt()}:void 0,a=(e,t)=>{let n=d(`button`,{className:`persona-conversation-loading-error-action`,attrs:{type:`button`},text:e});return n.addEventListener(`click`,t),n},o=()=>d(`div`,{className:`persona-conversation-loading-error-body`},d(`p`,{className:`persona-conversation-loading-error-title`,text:n.openConversationErrorTitle}),d(`div`,{className:`persona-conversation-loading-error-actions`},a(n.openConversationRetryLabel,r),i?a(n.openConversationBackLabel,i):null)),s=Object.freeze({conversationId:t,config:e.config,copy:Object.freeze({title:n.openConversationErrorTitle,retryLabel:n.openConversationRetryLabel,backLabel:n.openConversationBackLabel}),retry:r,...i?{back:i}:{},defaultRenderer:o}),c=null;for(let t of e.plugins)if(t.renderHistoryOpenError){try{c=t.renderHistoryOpenError(s)}catch(e){console.warn(`[persona] renderHistoryOpenError threw`,e),c=null}if(c)break}if(J?.remove(),J=d(`div`,{className:`persona-conversation-loading-error`,attrs:{role:`alert`}},c??o()),!e.session.getActiveConversationId()&&e.session.getMessages().length===0&&!e.composerStore.getState().text&&!e.attachmentManager?.hasAttachments()){let e=J;J=null,Et(e),xt()}else e.body.insertBefore(J,e.messagesWrapper);e.announceHistory(n.openConversationErrorTitle)};e.eventBus.on(`history:closed`,()=>{e.conversationOpenPendingEl&&E(e.footer,!0)});let kt=async(t,{focusComposer:n=!1,busy:r=`reject`}={})=>{let i=w();if(r===`background`&&(e.session.assertBackgroundSwitchable(),e.composerStore.getState().phase===`preparing`))throw new e.SessionHistoryError(`conversation_busy`,`Finish preparing this turn before switching conversations`);if(r===`reject`&&(e.session.isStreaming()||[`paused`,`resuming`].includes(e.session.getStatus())||e.composerStore.getState().phase===`preparing`))throw new e.SessionHistoryError(`conversation_busy`,`Finish or stop the current turn before switching conversations`);r===`stop`&&(++e.composerConversationGeneration,e.submissionAbort?.abort(),e.submissionAbort=null,e.composerStore.setPreparing(!1),e.session.cancel());let a=e.conversationStateKey();e.conversationOpenPendingEl&&e.pendingConversationReading?.key===a||(e.pendingConversationReading={key:a,reading:e.captureConversationReading()});let s=null,c=!!o;o?.view.setActiveConversationId(t),X();let l=yt;Dt(),e.historyVisible&&(e.historyPresentation===`panel`||I)&&q({restoreFocus:!1}),e.suppressScrollSend=!0;try{await e.session.openConversation(t,{scope:i,busy:r,onBeforeCommit:()=>{e.saveConversationContinuity(),s=e.composerConversationGeneration,e.conversationPersistenceOwner=s},onCommitted:()=>{e.restoreConversationContinuity(),e.conversationPersistenceOwner===s&&(e.conversationPersistenceOwner=null),e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),e.persistState()}})}catch(n){if(e.conversationPersistenceOwner===s&&(e.conversationPersistenceOwner=null),s===e.composerConversationGeneration&&e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),l===yt){let n=e.pendingConversationReading?.reading;X(),n&&e.restoreConversationReading(n),e.pendingConversationReading=null,o?.view.setActiveConversationId(e.session.getActiveConversationId()),Ot(t),e.suppressScrollSend=!1}throw n}finally{l!==yt&&e.conversationOpenPendingEl||(e.suppressScrollSend=!1)}l===yt&&(X(),e.pendingConversationReading=null,e.messageCache.clear(),St(),Q(),c||e.setActiveConversationSummary(null),e.eventBus.emit(`history:conversationOpened`,{conversationId:t,title:e.activeConversationTitle,scope:i,timestamp:Date.now()}),n&&e.maybeFocusInput())},At=async({focusComposer:t=!1}={})=>{X();let n=null;try{await e.session.startNewConversation({scope:w(),onBeforeCommit:()=>{e.saveConversationContinuity(),n=e.composerConversationGeneration,e.conversationPersistenceOwner=n},onCommitted:()=>{e.restoreConversationContinuity(!0),e.conversationPersistenceOwner===n&&(e.conversationPersistenceOwner=null),e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),e.persistState(),e.pendingConversationReading=null}})}catch(t){throw e.conversationPersistenceOwner===n&&(e.conversationPersistenceOwner=null),n===e.composerConversationGeneration&&e.usesSessionVoiceForConfig(e.config)&&e.session.setupVoice(),t}e.setActiveConversationSummary(null),e.messageCache.clear(),e.resetAnchorState(),e.resumeAutoScroll(),e.jumpToBottomInstant(),Q();let r=e.session.getActiveConversationId();o?.view.setActiveConversationId(r),e.eventBus.emit(`history:conversationStarted`,{conversationId:r,timestamp:Date.now()}),e.historyVisible&&(e.historyPresentation===`panel`||I)&&q({restoreFocus:!1}),t&&e.maybeFocusInput()},jt=async(t,n)=>{let r=await e.session.updateConversation(t,{...n,...n.title===void 0?{}:{title:n.title.trim()}});return o?.view.applyConversationSummary(r),!o&&t===e.session.getActiveConversationId()&&e.setActiveConversationSummary(r),r},Mt=async t=>{let n=w(),r=e.session.getActiveConversationId()===t;await e.session.deleteConversation(t,{scope:n}),e.discardConversationContinuity(t),r&&(e.attachmentManager?.destroy({release:!0}),e.attachmentManager=null,e.restoreConversationContinuity(!0)),o?.view.removeConversationSummary(t),r&&(e.setActiveConversationSummary(null),e.messageCache.clear(),e.resetAnchorState(),e.resumeAutoScroll(),Q()),e.eventBus.emit(`history:conversationDeleted`,{conversationId:t,scope:n,wasActive:r,timestamp:Date.now()})},Nt=async t=>{let n=t?.scope??w(),r=t?.allTargets?null:t?.targetId??te(),i=await e.session.clearConversationHistory({...r?{targetId:r}:{},scope:n});return e.discardConversationContinuity(),e.setActiveConversationSummary(null),e.messageCache.clear(),e.resetAnchorState(),e.resumeAutoScroll(),Q(),e.eventBus.emit(`history:cleared`,{deleted:i.deleted,scope:n,targetId:r,timestamp:Date.now()}),i},Pt=async()=>{if(!r?.resetDevice)throw Error(`[Persona] resetHistoryIdentity() requires a history provider that can reset this device`);let t=!1;try{t=(await e.session.resetHistoryDevice()).remoteRevocationConfirmed}finally{e.discardConversationContinuity(),X(),e.setActiveConversationSummary(null),e.session.clearArtifacts(),e.messageCache.clear(),e.lastAppliedMessages=null,e.config.clearStoredSessionId?.(),e.config.clearStoredConversationId?.(),e.persistentMetadata={},e.actionManager.syncFromMetadata(),e.clearPersistedDraft();let t=e.storageAdapter;t?.clear&&e.runStorageMutation(()=>t.clear(),`[AgentWidget] Failed to clear storage adapter:`),e.resetAnchorState(),e.resumeAutoScroll(),Q(),q({restoreFocus:!1}),e.maybeFocusInput(),e.open||e.launcherSurfaceInstance?.launcher.element.focus()}return e.announceHistory(t?n.identityResetNotice:n.identityResetUnconfirmedNotice),e.eventBus.emit(`history:identityReset`,{remoteRevocationConfirmed:t,timestamp:Date.now()}),{remoteRevocationConfirmed:t}},Ft=()=>e.artifactSplitRoot?e.panel:e.container,It=async t=>{let n=await e.loadHistoryView().catch(()=>null);return typeof n?.showHistoryConfirm==`function`?n.showHistoryConfirm(t):window.confirm(`${t.title}\n\n${t.description}`)},Lt=async e=>await It({host:Ft(),title:n.deleteConversationConfirmTitle,description:n.deleteConversationConfirm,confirmLabel:n.deleteConversationConfirmLabel,cancelLabel:n.confirmCancelLabel})?(await Mt(e),`deleted`):`cancelled`,Rt=async()=>{let e=w()===`verified-user`;return await It({host:Ft(),title:n.clearHistoryConfirmTitle,description:e?n.clearHistoryVerifiedConfirm:n.clearHistoryConfirm,confirmLabel:n.clearHistoryConfirmLabel,cancelLabel:n.confirmCancelLabel})?(await Nt(),`cleared`):`cancelled`},zt=async()=>{if(!await It({host:Ft(),title:n.resetIdentityConfirmTitle,description:n.resetIdentityConfirm,confirmLabel:n.resetIdentityConfirmLabel,cancelLabel:n.confirmCancelLabel}))return{outcome:`cancelled`};let{remoteRevocationConfirmed:e}=await Pt();return{outcome:`reset`,remoteRevocationConfirmed:e}},Z=u(`button`,`persona-history-earlier`);Z.type=`button`,Z.textContent=n.showEarlierMessagesLabel,Z.setAttribute(`data-persona-history-earlier`,``),Object.assign(Z.style,{alignSelf:`center`,minHeight:`44px`,padding:`0 16px`,borderRadius:`999px`,border:`1px solid var(--persona-border, rgba(0,0,0,0.12))`,background:`transparent`,color:`inherit`,font:`inherit`,cursor:`pointer`,flexShrink:`0`});let Q=()=>{S()&&e.historySessionState.nextMessageCursor&&e.session.getActiveConversationId()?(Z.textContent=n.showEarlierMessagesLabel,Z.parentNode!==e.body&&e.body.insertBefore(Z,e.body.firstChild)):Z.remove()};Z.addEventListener(`click`,()=>{let t=e.session.getActiveConversationId(),n=e.historySessionState.nextMessageCursor;if(!t||!n||Z.disabled)return;Z.disabled=!0;let r=e.body.scrollHeight,i=e.body.scrollTop;e.session.loadOlderMessages(t,n,{scope:w()}).then(()=>{e.body.scrollTop=i+(e.body.scrollHeight-r),e.repinAnchoredMessage()}).catch(()=>{}).finally(()=>{Z.disabled=!1,Q()})});let Bt=()=>{let t=e.createHeaderIconButton({ariaLabel:n.openHistoryLabel,iconName:`history`,wrapperClassName:`persona-relative persona-inline-flex persona-items-center persona-justify-center`,extraClassName:`persona-history-toggle`,attrs:{"data-persona-history-toggle":``}});return t.button.addEventListener(`click`,n=>{S()&&!C()&&(e.historyVisible?q():gt({invoker:t.button,keyboard:n.detail===0}))}),t},Vt=()=>{if(!S()){h?.remove(),m=null,h=null;return}if(h&&!h.isConnected&&(m=null,h=null),!m&&e.header){let t=Bt();m=t.button,h=t.wrapper;let n=e.panelElements.clearChatButtonWrapper||e.panelElements.closeButtonWrapper;n?.parentNode&&e.header.contains(n)?n.parentNode.insertBefore(h,n):e.header.appendChild(h)}if(!m||!h)return;let t=W()||e.historyVisible&&e.historyPresentation===`rail`;if(h.style.display=t?`none`:``,t){document.activeElement===m&&ht();return}let r=C();m.disabled=r,m.setAttribute(`aria-disabled`,r?`true`:`false`);let i=r?n.openHistoryBusyLabel:n.openHistoryLabel;m.setAttribute(`aria-label`,i),(e.config.features?.history?.presentation??`panel`)===`panel`?(m.removeAttribute(`aria-expanded`),m.removeAttribute(`aria-controls`)):(m.setAttribute(`aria-expanded`,e.historyVisible?`true`:`false`),m.setAttribute(`aria-controls`,x))},Ht=!1,Ut=()=>{let t=e.panelElements.clearChatButton;t&&(S()?(Ht||=(v=t.getAttribute(`aria-label`)??``,!0),t.setAttribute(`aria-label`,n.newConversationLabel),t.removeAttribute(`title`)):Ht&&(Ht=!1,v&&t.setAttribute(`aria-label`,v)))},$=()=>{n=i(e.config.features?.history?.copy),Vt(),et(),Ut(),Q()};return e.historyChromeSync=$,se(),$(),e.destroyCallbacks.push(()=>{y?.(),b?.(),_+=1,_t(),o?.dispose(),o?.view.destroy(),o=null}),{clearConversationOpenPending:X,cancelConversationOpenTakeover:Y,historyOperationScope:w,discardConversationContinuity:e.discardConversationContinuity,historyAvailable:S,historyScope:ee,installHistoryProvider:se,syncHistoryChromeImpl:$,syncHistoryPresentation:pt,syncEarlierMessagesPill:Q,openHistory:gt,closeHistory:q,openHistoryConversation:kt,startNewConversation:At,updateHistoryConversation:jt,deleteHistoryConversation:Mt,requestDeleteConversation:Lt,clearConversationHistory:Nt,resetHistoryIdentity:Pt,railCollapseShortcut:ze,railCollapsible:we,railTriggerApplies:W,railOverlayMode:ke,toggleRailCollapsed:Re,toggleRailPinned:()=>Le(),get historyProvider(){return r},get historySurface(){return o},get railShell(){return A},get railHost(){return j},get railColumn(){return Se}}};exports.createHistoryShell=oe;
|