@botonic/webchat-lit 2.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,331 @@
1
+ import { css } from 'lit';
2
+ export const debugEventStyles = css `
3
+ @layer components {
4
+ :host {
5
+ display: block;
6
+ box-sizing: border-box;
7
+ width: 100%;
8
+ }
9
+
10
+ .debug-root {
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: stretch;
14
+ justify-content: space-between;
15
+ gap: var(--spacing-s);
16
+
17
+ background-color: var(
18
+ --botonic-debug-event-bg,
19
+ var(--surface-foreground)
20
+ );
21
+ border-radius: var(--radius-s);
22
+ font-family: var(--font-family);
23
+ box-sizing: border-box;
24
+ width: fit-content;
25
+ }
26
+
27
+ .debug-root.is-collapsible {
28
+ cursor: pointer;
29
+ }
30
+
31
+ .debug-root.is-collapsible:hover {
32
+ background-color: var(
33
+ --botonic-debug-event-hover-bg,
34
+ var(--color-neutral-50)
35
+ );
36
+ }
37
+
38
+ .debug-header {
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: space-between;
42
+ gap: var(--spacing-xxs);
43
+ box-sizing: border-box;
44
+ user-select: none;
45
+ border-radius: var(--radius-s);
46
+ padding: var(--spacing-xs) var(--spacing-xs);
47
+ width: 100%;
48
+ }
49
+
50
+ .debug-arrow {
51
+ display: inline-flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ width: 16px;
55
+ height: 16px;
56
+ flex-shrink: 0;
57
+ }
58
+
59
+ .debug-arrow svg {
60
+ width: 100%;
61
+ height: 100%;
62
+ }
63
+
64
+ .debug-icon {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ width: 14px;
69
+ height: 14px;
70
+ margin-right: var(--spacing-xs);
71
+ flex-shrink: 0;
72
+ }
73
+
74
+ .debug-icon svg {
75
+ width: 100%;
76
+ height: 100%;
77
+ }
78
+
79
+ .debug-title {
80
+ flex: 1;
81
+ min-width: 0;
82
+ overflow: hidden;
83
+ display: flex;
84
+ align-items: center;
85
+
86
+ font-weight: var(--font-weight-bold);
87
+ font-size: var(--font-size-xs);
88
+ color: var(--botonic-debug-event-text, var(--text-base));
89
+ line-height: 1.5;
90
+ white-space: nowrap;
91
+ gap: var(--spacing-xxs);
92
+ }
93
+
94
+ .debug-title span {
95
+ font-weight: var(--font-weight-regular);
96
+ }
97
+
98
+ .debug-content {
99
+ display: flex;
100
+ flex-direction: column;
101
+ position: relative;
102
+ width: 100%;
103
+ min-width: 0;
104
+ overflow: hidden;
105
+
106
+ font-size: var(--font-size-xs);
107
+ line-height: 1.5;
108
+ color: var(--botonic-debug-event-text, var(--text-base));
109
+ }
110
+
111
+ .debug-detail {
112
+ display: flex;
113
+ flex-direction: column;
114
+ gap: var(--spacing-xxs);
115
+ padding: 0 calc(var(--spacing-ml) + var(--spacing-xxs));
116
+ line-height: 1.5;
117
+ width: 100%;
118
+ min-width: 0;
119
+ overflow: hidden;
120
+ box-sizing: border-box;
121
+ }
122
+
123
+ .debug-label {
124
+ color: var(--botonic-debug-event-text, var(--text-base));
125
+ font-weight: var(--font-weight-regular);
126
+ font-size: var(--font-size-xs);
127
+ line-height: 1.5;
128
+ }
129
+
130
+ .debug-value {
131
+ font-weight: var(--font-weight-bold);
132
+ font-size: var(--font-size-xs);
133
+ color: var(--botonic-debug-event-text, var(--text-base));
134
+ line-height: 1.5;
135
+ width: 100%;
136
+ overflow-wrap: break-word;
137
+ word-break: break-word;
138
+ }
139
+
140
+ .debug-value > svg {
141
+ width: 14px;
142
+ height: 14px;
143
+ min-width: 14px;
144
+ min-height: 14px;
145
+ flex-shrink: 0;
146
+ display: inline-block;
147
+ vertical-align: middle;
148
+ margin-right: var(--spacing-xs);
149
+ }
150
+
151
+ .debug-item-with-icon {
152
+ display: flex;
153
+ align-items: center;
154
+ gap: var(--spacing-xs);
155
+ padding: 0;
156
+ font-weight: var(--font-weight-bold);
157
+ font-size: var(--font-size-xs);
158
+ color: var(--botonic-debug-event-text, var(--text-base));
159
+ line-height: 1.5;
160
+ min-width: 0;
161
+ width: 100%;
162
+ }
163
+
164
+ .debug-item-with-icon:not(:last-child) {
165
+ margin-bottom: var(--spacing-xxs);
166
+ }
167
+
168
+ .debug-item-with-icon > svg {
169
+ width: 14px;
170
+ height: 14px;
171
+ min-width: 14px;
172
+ min-height: 14px;
173
+ flex-shrink: 0;
174
+ display: block;
175
+ }
176
+
177
+ .debug-metadata {
178
+ margin-top: var(--spacing-xs);
179
+ padding-top: var(--spacing-s);
180
+ border-top: 1px solid
181
+ var(
182
+ --botonic-debug-event-border,
183
+ var(--surface-foreground-border-color)
184
+ );
185
+ color: var(--botonic-debug-event-text, var(--text-base));
186
+ font-size: var(--font-size-xs);
187
+ padding-left: calc(var(--spacing-ml) + var(--spacing-xxs));
188
+ }
189
+
190
+ .debug-metadata > div {
191
+ margin-top: 6px;
192
+ font-weight: var(--font-weight-regular);
193
+ }
194
+
195
+ .debug-content-wrapper {
196
+ display: flex;
197
+ flex-direction: column;
198
+ gap: var(--spacing-sm);
199
+ position: relative;
200
+ width: 100%;
201
+ min-width: 0;
202
+ overflow: hidden;
203
+ padding-bottom: var(--spacing-xs);
204
+ }
205
+
206
+ .debug-content-wrapper::before {
207
+ content: '';
208
+ position: absolute;
209
+ left: 13px;
210
+ width: 1px;
211
+ background-color: var(
212
+ --botonic-debug-event-connector,
213
+ var(--surface-foreground-border-color)
214
+ );
215
+ top: 0;
216
+ height: var(--last-label-bottom, 100%);
217
+ }
218
+
219
+ .debug-root.is-collapsible:hover .debug-content-wrapper::before {
220
+ background-color: var(
221
+ --botonic-debug-event-connector-hover,
222
+ var(--color-neutral-200)
223
+ );
224
+ }
225
+
226
+ .see-info-button {
227
+ border: 1px solid
228
+ var(--botonic-debug-event-button-border, var(--color-neutral-200));
229
+ border-radius: var(--radius-s);
230
+ padding: var(--spacing-xs);
231
+ height: calc(var(--spacing-ml) + var(--spacing-xxs));
232
+ background-color: transparent;
233
+ color: var(--botonic-debug-event-button-text, var(--color-neutral-800));
234
+ font-family: var(--font-family);
235
+ font-size: var(--font-size-xs);
236
+ font-weight: var(--font-weight-medium);
237
+ line-height: 1.5;
238
+ cursor: pointer;
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ width: fit-content;
243
+ }
244
+
245
+ .see-info-button:hover {
246
+ background-color: var(
247
+ --botonic-debug-event-button-hover-bg,
248
+ var(--color-neutral-100)
249
+ );
250
+ }
251
+
252
+ .guardrail-item {
253
+ display: flex;
254
+ align-items: center;
255
+ gap: var(--spacing-xs);
256
+ padding-left: calc(var(--spacing-ml) + var(--spacing-xxs));
257
+ margin-bottom: var(--spacing-xs);
258
+ font-size: var(--font-size-xs);
259
+ line-height: 1.5;
260
+ color: var(--botonic-debug-event-text, var(--text-base));
261
+ }
262
+
263
+ .guardrail-item.is-last {
264
+ margin-bottom: 0;
265
+ }
266
+
267
+ .guardrail-item svg {
268
+ width: 14px;
269
+ height: 14px;
270
+ flex-shrink: 0;
271
+ }
272
+
273
+ .guardrail-label {
274
+ font-weight: var(--font-weight-bold);
275
+ font-size: var(--font-size-xs);
276
+ line-height: 1.5;
277
+ color: var(--botonic-debug-event-text, var(--text-base));
278
+ }
279
+
280
+ .guardrail-value {
281
+ font-weight: var(--font-weight-regular);
282
+ font-size: var(--font-size-xs);
283
+ line-height: 1.5;
284
+ color: var(--botonic-debug-event-text, var(--text-base));
285
+ }
286
+
287
+ .source-value {
288
+ font-weight: var(--font-weight-bold);
289
+ font-size: var(--font-size-xs);
290
+ line-height: 1.5;
291
+ color: var(--botonic-debug-event-text, var(--text-base));
292
+ }
293
+
294
+ .file-source-value {
295
+ font-weight: var(--font-weight-bold);
296
+ font-size: var(--font-size-xs);
297
+ line-height: 1.5;
298
+ color: var(--botonic-debug-event-text, var(--text-base));
299
+ display: block;
300
+ overflow: hidden;
301
+ text-overflow: ellipsis;
302
+ white-space: nowrap;
303
+ min-width: 0;
304
+ flex: 1;
305
+ }
306
+
307
+ .url-source-value {
308
+ font-weight: var(--font-weight-bold);
309
+ font-size: var(--font-size-xs);
310
+ line-height: 1.5;
311
+ color: var(--botonic-debug-event-text, var(--text-base));
312
+ text-decoration: none;
313
+ overflow: hidden;
314
+ text-overflow: ellipsis;
315
+ white-space: nowrap;
316
+ min-width: 0;
317
+ width: 0;
318
+ flex: 1 1 0%;
319
+ }
320
+
321
+ .url-source-value:hover {
322
+ text-decoration: underline;
323
+ color: var(--botonic-debug-event-link-hover, var(--primary-500));
324
+ }
325
+
326
+ .url-source-value:visited {
327
+ color: var(--botonic-debug-event-text, var(--text-base));
328
+ }
329
+ }
330
+ `;
331
+ //# sourceMappingURL=debug-event.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-event.css.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/webchat-lit/src/lib/debug-event/debug-event.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwUlC,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { LitElement } from 'lit';
2
+ import type { DebugEvent, DebugEventAction } from './types';
3
+ export declare class BotonicDebugEvent extends LitElement {
4
+ action: DebugEventAction;
5
+ data: DebugEvent;
6
+ noteContent?: string;
7
+ private _expanded;
8
+ private _hasBeenOpened;
9
+ private _lineEndElements;
10
+ static styles: import("lit").CSSResult[];
11
+ connectedCallback(): void;
12
+ updated(changed: Map<string, unknown>): void;
13
+ private _maybeRequestNote;
14
+ private _updateConnectorLine;
15
+ private get _config();
16
+ private get _isCollapsible();
17
+ private _handleHeaderClick;
18
+ private _handleSeeChunks;
19
+ private _handleSeeToolDetails;
20
+ private _renderCtx;
21
+ private _renderContent;
22
+ render(): import("lit").TemplateResult<1>;
23
+ }
@@ -0,0 +1,157 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { EventAction } from '@botonic/shared';
3
+ import { html, LitElement, nothing } from 'lit';
4
+ import { property, queryAll, state } from 'lit/decorators.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+ import { resetStyles } from '../shared/base-styles';
7
+ import { debugEventStyles } from './debug-event.css';
8
+ import { EVENT_CONFIG } from './event-config';
9
+ import { caretDownIcon, caretUpIcon } from './icons';
10
+ export class BotonicDebugEvent extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.data = {};
14
+ this._expanded = false;
15
+ this._hasBeenOpened = false;
16
+ this._handleSeeChunks = () => {
17
+ const d = this.data;
18
+ this.dispatchEvent(new CustomEvent('open-chunks', {
19
+ detail: { chunksWithSources: d.knowledge_base_chunks_with_sources },
20
+ bubbles: true,
21
+ composed: true,
22
+ }));
23
+ };
24
+ this._handleSeeToolDetails = (tool) => {
25
+ var _a;
26
+ this.dispatchEvent(new CustomEvent('open-tool-results', {
27
+ detail: {
28
+ toolName: tool.tool_name,
29
+ toolArguments: (_a = tool.tool_arguments) !== null && _a !== void 0 ? _a : {},
30
+ toolResults: tool.tool_results,
31
+ knowledgebaseSourcesIds: tool.knowledgebase_sources_ids,
32
+ knowledgebaseChunksIds: tool.knowledgebase_chunks_ids,
33
+ },
34
+ bubbles: true,
35
+ composed: true,
36
+ }));
37
+ };
38
+ }
39
+ connectedCallback() {
40
+ super.connectedCallback();
41
+ this.setAttribute('role', 'system-message');
42
+ }
43
+ updated(changed) {
44
+ super.updated(changed);
45
+ this._maybeRequestNote(changed);
46
+ this._updateConnectorLine();
47
+ }
48
+ _maybeRequestNote(changed) {
49
+ if (!changed.has('data') && !changed.has('noteContent'))
50
+ return;
51
+ if (this.action !== EventAction.HandoffSuccess)
52
+ return;
53
+ const data = this.data;
54
+ if (data.handoff_note_id && this.noteContent === undefined) {
55
+ this.dispatchEvent(new CustomEvent('load-note', {
56
+ detail: { noteId: data.handoff_note_id },
57
+ bubbles: true,
58
+ composed: true,
59
+ }));
60
+ }
61
+ }
62
+ _updateConnectorLine() {
63
+ const elements = [...this._lineEndElements];
64
+ const last = elements[elements.length - 1];
65
+ if (last) {
66
+ const bottom = last.offsetTop + last.offsetHeight;
67
+ const wrapper = this.renderRoot.querySelector('.debug-content-wrapper');
68
+ if (wrapper instanceof HTMLElement) {
69
+ wrapper.style.setProperty('--last-label-bottom', `${bottom}px`);
70
+ }
71
+ }
72
+ }
73
+ get _config() {
74
+ return EVENT_CONFIG[this.action];
75
+ }
76
+ get _isCollapsible() {
77
+ var _a;
78
+ return Boolean((_a = this._config) === null || _a === void 0 ? void 0 : _a.renderContent);
79
+ }
80
+ _handleHeaderClick() {
81
+ if (!this._isCollapsible)
82
+ return;
83
+ this._expanded = !this._expanded;
84
+ if (this._expanded && !this._hasBeenOpened) {
85
+ this._hasBeenOpened = true;
86
+ this.dispatchEvent(new CustomEvent('event-opened', {
87
+ detail: { action: this.action },
88
+ bubbles: true,
89
+ composed: true,
90
+ }));
91
+ }
92
+ }
93
+ _renderCtx() {
94
+ return {
95
+ noteContent: this.noteContent,
96
+ onSeeChunks: this._handleSeeChunks,
97
+ onSeeToolDetails: this._handleSeeToolDetails,
98
+ };
99
+ }
100
+ _renderContent() {
101
+ var _a, _b, _c;
102
+ if (!this._expanded)
103
+ return nothing;
104
+ return ((_c = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.renderContent) === null || _b === void 0 ? void 0 : _b.call(_a, this.data, this._renderCtx())) !== null && _c !== void 0 ? _c : nothing);
105
+ }
106
+ render() {
107
+ const config = this._config;
108
+ const collapsible = this._isCollapsible;
109
+ return html `
110
+ <div
111
+ class=${classMap({ 'debug-root': true, 'is-collapsible': collapsible })}
112
+ >
113
+ <div class="debug-header" @click=${this._handleHeaderClick}>
114
+ <div class="debug-title">
115
+ <span class="debug-icon">${config === null || config === void 0 ? void 0 : config.icon()}</span>
116
+ ${config === null || config === void 0 ? void 0 : config.renderTitle(this.data)}
117
+ </div>
118
+ ${collapsible
119
+ ? html `
120
+ <span class="debug-arrow">
121
+ ${this._expanded ? caretUpIcon() : caretDownIcon()}
122
+ </span>
123
+ `
124
+ : nothing}
125
+ </div>
126
+ ${this._expanded
127
+ ? html `<div class="debug-content">${this._renderContent()}</div>`
128
+ : nothing}
129
+ </div>
130
+ `;
131
+ }
132
+ }
133
+ BotonicDebugEvent.styles = [resetStyles, debugEventStyles];
134
+ __decorate([
135
+ property({ type: String }),
136
+ __metadata("design:type", String)
137
+ ], BotonicDebugEvent.prototype, "action", void 0);
138
+ __decorate([
139
+ property({ type: Object }),
140
+ __metadata("design:type", Object)
141
+ ], BotonicDebugEvent.prototype, "data", void 0);
142
+ __decorate([
143
+ property({ attribute: 'note-content' }),
144
+ __metadata("design:type", String)
145
+ ], BotonicDebugEvent.prototype, "noteContent", void 0);
146
+ __decorate([
147
+ state(),
148
+ __metadata("design:type", Object)
149
+ ], BotonicDebugEvent.prototype, "_expanded", void 0);
150
+ __decorate([
151
+ queryAll('[data-line-end]'),
152
+ __metadata("design:type", Object)
153
+ ], BotonicDebugEvent.prototype, "_lineEndElements", void 0);
154
+ if (!customElements.get('botonic-debug-event')) {
155
+ customElements.define('botonic-debug-event', BotonicDebugEvent);
156
+ }
157
+ //# sourceMappingURL=debug-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-event.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/webchat-lit/src/lib/debug-event/debug-event.ts"],"names":[],"mappings":";AAAA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C,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAA;AACjE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import { type RenderCtx } from './content-renderers';
3
+ import type { DebugEvent, DebugEventAction } from './types';
4
+ export interface EventConfig {
5
+ icon: () => TemplateResult;
6
+ renderTitle: (data: DebugEvent) => TemplateResult;
7
+ renderContent?: (data: DebugEvent, ctx: RenderCtx) => TemplateResult;
8
+ }
9
+ export declare const EVENT_CONFIG: Record<DebugEventAction, EventConfig>;
@@ -0,0 +1,74 @@
1
+ import { EventAction } from '@botonic/shared';
2
+ import { html } from 'lit';
3
+ import { renderAiAgentContent, renderAiAgentRouterContent, renderConditionalCustomContent, renderConditionalQueueStatusContent, renderHandoffContent, renderKnowledgeBaseContent, } from './content-renderers';
4
+ import { aiRouterIcon, aiSpecialistIcon, arrowProgressIcon, brainIcon, codeIcon, headSetIcon, lifeRingIcon, quoteRightIcon, splitIcon, wandIcon, windowRestoreIcon, } from './icons';
5
+ // Each entry is authored with a data type narrowed to its action key. The
6
+ // outer `as` cast trades strict variance in the mapped type for readable
7
+ // per-entry authoring — the component always looks up an entry by
8
+ // `this.action`, so the concrete data type at the call site is guaranteed to
9
+ // match by construction.
10
+ export const EVENT_CONFIG = {
11
+ [EventAction.Keyword]: {
12
+ icon: quoteRightIcon,
13
+ renderTitle: (d) => html `Keyword matched <span>- "${d.nlu_keyword_name}"</span>`,
14
+ },
15
+ [EventAction.IntentSmart]: {
16
+ icon: brainIcon,
17
+ renderTitle: (d) => html `Smart intent triggered <span>- "${d.nlu_intent_smart_title}"</span>`,
18
+ },
19
+ [EventAction.Fallback]: {
20
+ icon: lifeRingIcon,
21
+ renderTitle: (d) => html `Fallback message triggered <span>- ${d.fallback_out} message</span>`,
22
+ },
23
+ [EventAction.BotAction]: {
24
+ icon: codeIcon,
25
+ renderTitle: (d) => html `Bot action triggered <span>- ${d.payload}</span>`,
26
+ },
27
+ [EventAction.HandoffSuccess]: {
28
+ icon: headSetIcon,
29
+ renderTitle: (d) => html `Handoff to agent <span>- ${d.handoff_queue_name}</span>`,
30
+ renderContent: renderHandoffContent,
31
+ },
32
+ [EventAction.RedirectFlow]: {
33
+ icon: arrowProgressIcon,
34
+ renderTitle: (d) => html `Redirected to flow <span>- ${d.flow_target_name}</span>`,
35
+ },
36
+ [EventAction.WebviewActionTriggered]: {
37
+ icon: windowRestoreIcon,
38
+ renderTitle: (d) => html `Webview action triggered <span>- ${d.webview_name}</span>`,
39
+ },
40
+ [EventAction.ConditionalChannel]: {
41
+ icon: splitIcon,
42
+ renderTitle: (d) => html `Channel checked <span>- ${d.channel}</span>`,
43
+ },
44
+ [EventAction.ConditionalCountry]: {
45
+ icon: splitIcon,
46
+ renderTitle: (d) => html `Country checked <span>- ${d.country}</span>`,
47
+ },
48
+ [EventAction.ConditionalCustom]: {
49
+ icon: splitIcon,
50
+ renderTitle: () => html `Custom condition`,
51
+ renderContent: renderConditionalCustomContent,
52
+ },
53
+ [EventAction.ConditionalQueueStatus]: {
54
+ icon: splitIcon,
55
+ renderTitle: (d) => html `Queue status checked <span>- ${d.queue_name}</span>`,
56
+ renderContent: renderConditionalQueueStatusContent,
57
+ },
58
+ [EventAction.Knowledgebase]: {
59
+ icon: wandIcon,
60
+ renderTitle: () => html `Knowledge Base triggered`,
61
+ renderContent: renderKnowledgeBaseContent,
62
+ },
63
+ [EventAction.AiAgent]: {
64
+ icon: aiSpecialistIcon,
65
+ renderTitle: (d) => html `Specialist triggered <span>- ${d.flow_node_content_id}</span>`,
66
+ renderContent: renderAiAgentContent,
67
+ },
68
+ [EventAction.AiAgentRouter]: {
69
+ icon: aiRouterIcon,
70
+ renderTitle: (d) => html `Router triggered <span>- ${d.flow_node_content_id}</span>`,
71
+ renderContent: (data) => renderAiAgentRouterContent(data),
72
+ },
73
+ };
74
+ //# sourceMappingURL=event-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-config.js","source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AAE,mCAAmC;KACnD;IACD,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE;QAC3B,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA,0BAA0B;QACjD,aAAa,EAAE,0BAA0B;KAC1C;IACD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACrB,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,CAAC,CAAoB,EAAE,EAAE,CACpC,IAAI,CAAA,gCAAgC,CAAC,CAAC,oBAAoB,SAAS;QACrE,aAAa,EAAE,oBAAoB;KACpC;IACD,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE;QAC3B,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,CAAC,CAA0B,EAAE,EAAE,CAC1C,IAAI,CAAA,4BAA4B,CAAC,CAAC,oBAAoB,SAAS;QACjE,aAAa,EAAE,CAAC,IAA6B,EAAE,EAAE,CAC/C,0BAA0B,CAAC,IAAI,CAAC;KACnC;CACuC,CAAA"}
@@ -0,0 +1,19 @@
1
+ export declare const aiSpecialistIcon: () => import("lit").TemplateResult<1>;
2
+ export declare const aiRouterIcon: () => import("lit").TemplateResult<1>;
3
+ export declare const wandIcon: () => import("lit").TemplateResult<1>;
4
+ export declare const headSetIcon: () => import("lit").TemplateResult<1>;
5
+ export declare const handIcon: () => import("lit").TemplateResult<1>;
6
+ export declare const lifeRingIcon: () => import("lit").TemplateResult<1>;
7
+ export declare const quoteRightIcon: () => import("lit").TemplateResult<1>;
8
+ export declare const arrowProgressIcon: () => import("lit").TemplateResult<1>;
9
+ export declare const splitIcon: () => import("lit").TemplateResult<1>;
10
+ export declare const codeIcon: () => import("lit").TemplateResult<1>;
11
+ export declare const windowRestoreIcon: () => import("lit").TemplateResult<1>;
12
+ export declare const brainIcon: () => import("lit").TemplateResult<1>;
13
+ export declare const screwdriverWrenchIcon: () => import("lit").TemplateResult<1>;
14
+ export declare const circleCheckIcon: () => import("lit").TemplateResult<1>;
15
+ export declare const filePdfIcon: () => import("lit").TemplateResult<1>;
16
+ export declare const fileWordIcon: () => import("lit").TemplateResult<1>;
17
+ export declare const linkIcon: () => import("lit").TemplateResult<1>;
18
+ export declare const caretDownIcon: () => import("lit").TemplateResult<1>;
19
+ export declare const caretUpIcon: () => import("lit").TemplateResult<1>;