@copilotkit/web-components 1.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/index.cjs +12 -0
  4. package/dist/index.d.cts +7 -0
  5. package/dist/index.d.mts +7 -0
  6. package/dist/index.mjs +7 -0
  7. package/dist/index.umd.js +2548 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/threads-drawer/copilotkit-threads-drawer.cjs +677 -0
  10. package/dist/threads-drawer/copilotkit-threads-drawer.cjs.map +1 -0
  11. package/dist/threads-drawer/copilotkit-threads-drawer.d.cts +182 -0
  12. package/dist/threads-drawer/copilotkit-threads-drawer.d.cts.map +1 -0
  13. package/dist/threads-drawer/copilotkit-threads-drawer.d.mts +182 -0
  14. package/dist/threads-drawer/copilotkit-threads-drawer.d.mts.map +1 -0
  15. package/dist/threads-drawer/copilotkit-threads-drawer.mjs +676 -0
  16. package/dist/threads-drawer/copilotkit-threads-drawer.mjs.map +1 -0
  17. package/dist/threads-drawer/define.cjs +15 -0
  18. package/dist/threads-drawer/define.cjs.map +1 -0
  19. package/dist/threads-drawer/define.d.cts +17 -0
  20. package/dist/threads-drawer/define.d.cts.map +1 -0
  21. package/dist/threads-drawer/define.d.mts +17 -0
  22. package/dist/threads-drawer/define.d.mts.map +1 -0
  23. package/dist/threads-drawer/define.mjs +15 -0
  24. package/dist/threads-drawer/define.mjs.map +1 -0
  25. package/dist/threads-drawer/generated-tokens.cjs +33 -0
  26. package/dist/threads-drawer/generated-tokens.cjs.map +1 -0
  27. package/dist/threads-drawer/generated-tokens.d.cts +32 -0
  28. package/dist/threads-drawer/generated-tokens.d.cts.map +1 -0
  29. package/dist/threads-drawer/generated-tokens.d.mts +32 -0
  30. package/dist/threads-drawer/generated-tokens.d.mts.map +1 -0
  31. package/dist/threads-drawer/generated-tokens.mjs +32 -0
  32. package/dist/threads-drawer/generated-tokens.mjs.map +1 -0
  33. package/dist/threads-drawer/index.cjs +11 -0
  34. package/dist/threads-drawer/index.d.cts +6 -0
  35. package/dist/threads-drawer/index.d.mts +6 -0
  36. package/dist/threads-drawer/index.mjs +6 -0
  37. package/dist/threads-drawer/styles.cjs +499 -0
  38. package/dist/threads-drawer/styles.cjs.map +1 -0
  39. package/dist/threads-drawer/styles.d.cts +24 -0
  40. package/dist/threads-drawer/styles.d.cts.map +1 -0
  41. package/dist/threads-drawer/styles.d.mts +24 -0
  42. package/dist/threads-drawer/styles.d.mts.map +1 -0
  43. package/dist/threads-drawer/styles.mjs +499 -0
  44. package/dist/threads-drawer/styles.mjs.map +1 -0
  45. package/dist/threads-drawer/types.d.cts +97 -0
  46. package/dist/threads-drawer/types.d.cts.map +1 -0
  47. package/dist/threads-drawer/types.d.mts +97 -0
  48. package/dist/threads-drawer/types.d.mts.map +1 -0
  49. package/package.json +85 -0
@@ -0,0 +1,2548 @@
1
+ (function(global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitWebComponents = {})));
5
+ })(this, function(exports) {
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7
+
8
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/lib/element-internals.js
9
+ const ElementInternalsShim = class ElementInternals {
10
+ get shadowRoot() {
11
+ return this.__host.__shadowRoot;
12
+ }
13
+ constructor(_host) {
14
+ this.ariaActiveDescendantElement = null;
15
+ this.ariaAtomic = "";
16
+ this.ariaAutoComplete = "";
17
+ this.ariaBrailleLabel = "";
18
+ this.ariaBrailleRoleDescription = "";
19
+ this.ariaBusy = "";
20
+ this.ariaChecked = "";
21
+ this.ariaColCount = "";
22
+ this.ariaColIndex = "";
23
+ this.ariaColIndexText = "";
24
+ this.ariaColSpan = "";
25
+ this.ariaControlsElements = null;
26
+ this.ariaCurrent = "";
27
+ this.ariaDescribedByElements = null;
28
+ this.ariaDescription = "";
29
+ this.ariaDetailsElements = null;
30
+ this.ariaDisabled = "";
31
+ this.ariaErrorMessageElements = null;
32
+ this.ariaExpanded = "";
33
+ this.ariaFlowToElements = null;
34
+ this.ariaHasPopup = "";
35
+ this.ariaHidden = "";
36
+ this.ariaInvalid = "";
37
+ this.ariaKeyShortcuts = "";
38
+ this.ariaLabel = "";
39
+ this.ariaLabelledByElements = null;
40
+ this.ariaLevel = "";
41
+ this.ariaLive = "";
42
+ this.ariaModal = "";
43
+ this.ariaMultiLine = "";
44
+ this.ariaMultiSelectable = "";
45
+ this.ariaOrientation = "";
46
+ this.ariaOwnsElements = null;
47
+ this.ariaPlaceholder = "";
48
+ this.ariaPosInSet = "";
49
+ this.ariaPressed = "";
50
+ this.ariaReadOnly = "";
51
+ this.ariaRelevant = "";
52
+ this.ariaRequired = "";
53
+ this.ariaRoleDescription = "";
54
+ this.ariaRowCount = "";
55
+ this.ariaRowIndex = "";
56
+ this.ariaRowIndexText = "";
57
+ this.ariaRowSpan = "";
58
+ this.ariaSelected = "";
59
+ this.ariaSetSize = "";
60
+ this.ariaSort = "";
61
+ this.ariaValueMax = "";
62
+ this.ariaValueMin = "";
63
+ this.ariaValueNow = "";
64
+ this.ariaValueText = "";
65
+ this.role = "";
66
+ this.form = null;
67
+ this.labels = [];
68
+ this.states = /* @__PURE__ */ new Set();
69
+ this.validationMessage = "";
70
+ this.validity = {};
71
+ this.willValidate = true;
72
+ this.__host = _host;
73
+ }
74
+ checkValidity() {
75
+ console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true.");
76
+ return true;
77
+ }
78
+ reportValidity() {
79
+ return true;
80
+ }
81
+ setFormValue() {}
82
+ setValidity() {}
83
+ };
84
+
85
+ //#endregion
86
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/lib/events.js
87
+ /**
88
+ * @license
89
+ * Copyright 2023 Google LLC
90
+ * SPDX-License-Identifier: BSD-3-Clause
91
+ */
92
+ var __classPrivateFieldSet = void 0 && (void 0).__classPrivateFieldSet || function(receiver, state, value, kind, f) {
93
+ if (kind === "m") throw new TypeError("Private method is not writable");
94
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
95
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
96
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
97
+ };
98
+ var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || function(receiver, state, kind, f) {
99
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
100
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
101
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
102
+ };
103
+ var _Event_cancelable, _Event_bubbles, _Event_composed, _Event_defaultPrevented, _Event_timestamp, _Event_propagationStopped, _Event_type, _Event_target, _Event_isBeingDispatched, _a$1, _CustomEvent_detail, _b;
104
+ const isCaptureEventListener = (options) => {
105
+ var _options$capture;
106
+ return typeof options === "boolean" ? options : (_options$capture = options === null || options === void 0 ? void 0 : options.capture) !== null && _options$capture !== void 0 ? _options$capture : false;
107
+ };
108
+ const NONE = 0;
109
+ const CAPTURING_PHASE = 1;
110
+ const AT_TARGET = 2;
111
+ const BUBBLING_PHASE = 3;
112
+ var EventTarget = class {
113
+ constructor() {
114
+ this.__eventListeners = /* @__PURE__ */ new Map();
115
+ this.__captureEventListeners = /* @__PURE__ */ new Map();
116
+ }
117
+ addEventListener(type, callback, options) {
118
+ var _normalizedOptions$si;
119
+ if (callback === void 0 || callback === null) return;
120
+ const eventListenersMap = isCaptureEventListener(options) ? this.__captureEventListeners : this.__eventListeners;
121
+ let eventListeners = eventListenersMap.get(type);
122
+ if (eventListeners === void 0) {
123
+ eventListeners = /* @__PURE__ */ new Map();
124
+ eventListenersMap.set(type, eventListeners);
125
+ } else if (eventListeners.has(callback)) return;
126
+ const normalizedOptions = typeof options === "object" && options ? options : {};
127
+ (_normalizedOptions$si = normalizedOptions.signal) === null || _normalizedOptions$si === void 0 || _normalizedOptions$si.addEventListener("abort", () => this.removeEventListener(type, callback, options));
128
+ eventListeners.set(callback, normalizedOptions !== null && normalizedOptions !== void 0 ? normalizedOptions : {});
129
+ }
130
+ removeEventListener(type, callback, options) {
131
+ if (callback === void 0 || callback === null) return;
132
+ const eventListenersMap = isCaptureEventListener(options) ? this.__captureEventListeners : this.__eventListeners;
133
+ const eventListeners = eventListenersMap.get(type);
134
+ if (eventListeners !== void 0) {
135
+ eventListeners.delete(callback);
136
+ if (!eventListeners.size) eventListenersMap.delete(type);
137
+ }
138
+ }
139
+ dispatchEvent(event) {
140
+ const composedPath = [this];
141
+ let parent = this.__eventTargetParent;
142
+ if (event.composed) while (parent) {
143
+ composedPath.push(parent);
144
+ parent = parent.__eventTargetParent;
145
+ }
146
+ else while (parent && parent !== this.__host) {
147
+ composedPath.push(parent);
148
+ parent = parent.__eventTargetParent;
149
+ }
150
+ let stopPropagation = false;
151
+ let stopImmediatePropagation = false;
152
+ let eventPhase = NONE;
153
+ let target = null;
154
+ let tmpTarget = null;
155
+ let currentTarget = null;
156
+ const originalStopPropagation = event.stopPropagation;
157
+ const originalStopImmediatePropagation = event.stopImmediatePropagation;
158
+ Object.defineProperties(event, {
159
+ target: {
160
+ get() {
161
+ var _target;
162
+ return (_target = target) !== null && _target !== void 0 ? _target : tmpTarget;
163
+ },
164
+ ...enumerableProperty
165
+ },
166
+ srcElement: {
167
+ get() {
168
+ return event.target;
169
+ },
170
+ ...enumerableProperty
171
+ },
172
+ currentTarget: {
173
+ get() {
174
+ return currentTarget;
175
+ },
176
+ ...enumerableProperty
177
+ },
178
+ eventPhase: {
179
+ get() {
180
+ return eventPhase;
181
+ },
182
+ ...enumerableProperty
183
+ },
184
+ composedPath: {
185
+ value: () => composedPath,
186
+ ...enumerableProperty
187
+ },
188
+ stopPropagation: {
189
+ value: () => {
190
+ stopPropagation = true;
191
+ originalStopPropagation.call(event);
192
+ },
193
+ ...enumerableProperty
194
+ },
195
+ stopImmediatePropagation: {
196
+ value: () => {
197
+ stopImmediatePropagation = true;
198
+ originalStopImmediatePropagation.call(event);
199
+ },
200
+ ...enumerableProperty
201
+ }
202
+ });
203
+ const invokeEventListener = (listener, options, eventListenerMap) => {
204
+ if (typeof listener === "function") listener(event);
205
+ else if (typeof (listener === null || listener === void 0 ? void 0 : listener.handleEvent) === "function") listener.handleEvent(event);
206
+ if (options.once) eventListenerMap.delete(listener);
207
+ };
208
+ const finishDispatch = () => {
209
+ currentTarget = null;
210
+ eventPhase = NONE;
211
+ return !event.defaultPrevented;
212
+ };
213
+ const captureEventPath = composedPath.slice().reverse();
214
+ target = !this.__host || !event.composed ? this : null;
215
+ const retarget = (eventTargets) => {
216
+ tmpTarget = this;
217
+ while (tmpTarget.__host && eventTargets.includes(tmpTarget.__host)) tmpTarget = tmpTarget.__host;
218
+ };
219
+ for (const eventTarget of captureEventPath) {
220
+ if (!target && (!tmpTarget || tmpTarget === eventTarget.__host)) retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget)));
221
+ currentTarget = eventTarget;
222
+ eventPhase = eventTarget === event.target ? AT_TARGET : CAPTURING_PHASE;
223
+ const captureEventListeners = eventTarget.__captureEventListeners.get(event.type);
224
+ if (captureEventListeners) for (const [listener, options] of captureEventListeners) {
225
+ invokeEventListener(listener, options, captureEventListeners);
226
+ if (stopImmediatePropagation) return finishDispatch();
227
+ }
228
+ if (stopPropagation) return finishDispatch();
229
+ }
230
+ const bubbleEventPath = event.bubbles ? composedPath : [this];
231
+ tmpTarget = null;
232
+ for (const eventTarget of bubbleEventPath) {
233
+ if (!target && (!tmpTarget || eventTarget === tmpTarget.__host)) retarget(bubbleEventPath.slice(0, bubbleEventPath.indexOf(eventTarget) + 1));
234
+ currentTarget = eventTarget;
235
+ eventPhase = eventTarget === event.target ? AT_TARGET : BUBBLING_PHASE;
236
+ const captureEventListeners = eventTarget.__eventListeners.get(event.type);
237
+ if (captureEventListeners) for (const [listener, options] of captureEventListeners) {
238
+ invokeEventListener(listener, options, captureEventListeners);
239
+ if (stopImmediatePropagation) return finishDispatch();
240
+ }
241
+ if (stopPropagation) return finishDispatch();
242
+ }
243
+ return finishDispatch();
244
+ }
245
+ };
246
+ const EventTargetShimWithRealType = EventTarget;
247
+ const enumerableProperty = { __proto__: null };
248
+ enumerableProperty.enumerable = true;
249
+ Object.freeze(enumerableProperty);
250
+ const EventShim = (_a$1 = class Event {
251
+ constructor(type, options = {}) {
252
+ _Event_cancelable.set(this, false);
253
+ _Event_bubbles.set(this, false);
254
+ _Event_composed.set(this, false);
255
+ _Event_defaultPrevented.set(this, false);
256
+ _Event_timestamp.set(this, Date.now());
257
+ _Event_propagationStopped.set(this, false);
258
+ _Event_type.set(this, void 0);
259
+ _Event_target.set(this, void 0);
260
+ _Event_isBeingDispatched.set(this, void 0);
261
+ this.NONE = NONE;
262
+ this.CAPTURING_PHASE = CAPTURING_PHASE;
263
+ this.AT_TARGET = AT_TARGET;
264
+ this.BUBBLING_PHASE = BUBBLING_PHASE;
265
+ if (arguments.length === 0) throw new Error(`The type argument must be specified`);
266
+ if (typeof options !== "object" || !options) throw new Error(`The "options" argument must be an object`);
267
+ const { bubbles, cancelable, composed } = options;
268
+ __classPrivateFieldSet(this, _Event_cancelable, !!cancelable, "f");
269
+ __classPrivateFieldSet(this, _Event_bubbles, !!bubbles, "f");
270
+ __classPrivateFieldSet(this, _Event_composed, !!composed, "f");
271
+ __classPrivateFieldSet(this, _Event_type, `${type}`, "f");
272
+ __classPrivateFieldSet(this, _Event_target, null, "f");
273
+ __classPrivateFieldSet(this, _Event_isBeingDispatched, false, "f");
274
+ }
275
+ initEvent(_type, _bubbles, _cancelable) {
276
+ throw new Error("Method not implemented.");
277
+ }
278
+ stopImmediatePropagation() {
279
+ this.stopPropagation();
280
+ }
281
+ preventDefault() {
282
+ __classPrivateFieldSet(this, _Event_defaultPrevented, true, "f");
283
+ }
284
+ get target() {
285
+ return __classPrivateFieldGet(this, _Event_target, "f");
286
+ }
287
+ get currentTarget() {
288
+ return __classPrivateFieldGet(this, _Event_target, "f");
289
+ }
290
+ get srcElement() {
291
+ return __classPrivateFieldGet(this, _Event_target, "f");
292
+ }
293
+ get type() {
294
+ return __classPrivateFieldGet(this, _Event_type, "f");
295
+ }
296
+ get cancelable() {
297
+ return __classPrivateFieldGet(this, _Event_cancelable, "f");
298
+ }
299
+ get defaultPrevented() {
300
+ return __classPrivateFieldGet(this, _Event_cancelable, "f") && __classPrivateFieldGet(this, _Event_defaultPrevented, "f");
301
+ }
302
+ get timeStamp() {
303
+ return __classPrivateFieldGet(this, _Event_timestamp, "f");
304
+ }
305
+ composedPath() {
306
+ return __classPrivateFieldGet(this, _Event_isBeingDispatched, "f") ? [__classPrivateFieldGet(this, _Event_target, "f")] : [];
307
+ }
308
+ get returnValue() {
309
+ return !__classPrivateFieldGet(this, _Event_cancelable, "f") || !__classPrivateFieldGet(this, _Event_defaultPrevented, "f");
310
+ }
311
+ get bubbles() {
312
+ return __classPrivateFieldGet(this, _Event_bubbles, "f");
313
+ }
314
+ get composed() {
315
+ return __classPrivateFieldGet(this, _Event_composed, "f");
316
+ }
317
+ get eventPhase() {
318
+ return __classPrivateFieldGet(this, _Event_isBeingDispatched, "f") ? _a$1.AT_TARGET : _a$1.NONE;
319
+ }
320
+ get cancelBubble() {
321
+ return __classPrivateFieldGet(this, _Event_propagationStopped, "f");
322
+ }
323
+ set cancelBubble(value) {
324
+ if (value) __classPrivateFieldSet(this, _Event_propagationStopped, true, "f");
325
+ }
326
+ stopPropagation() {
327
+ __classPrivateFieldSet(this, _Event_propagationStopped, true, "f");
328
+ }
329
+ get isTrusted() {
330
+ return false;
331
+ }
332
+ }, _Event_cancelable = /* @__PURE__ */ new WeakMap(), _Event_bubbles = /* @__PURE__ */ new WeakMap(), _Event_composed = /* @__PURE__ */ new WeakMap(), _Event_defaultPrevented = /* @__PURE__ */ new WeakMap(), _Event_timestamp = /* @__PURE__ */ new WeakMap(), _Event_propagationStopped = /* @__PURE__ */ new WeakMap(), _Event_type = /* @__PURE__ */ new WeakMap(), _Event_target = /* @__PURE__ */ new WeakMap(), _Event_isBeingDispatched = /* @__PURE__ */ new WeakMap(), _a$1.NONE = NONE, _a$1.CAPTURING_PHASE = CAPTURING_PHASE, _a$1.AT_TARGET = AT_TARGET, _a$1.BUBBLING_PHASE = BUBBLING_PHASE, _a$1);
333
+ Object.defineProperties(EventShim.prototype, {
334
+ initEvent: enumerableProperty,
335
+ stopImmediatePropagation: enumerableProperty,
336
+ preventDefault: enumerableProperty,
337
+ target: enumerableProperty,
338
+ currentTarget: enumerableProperty,
339
+ srcElement: enumerableProperty,
340
+ type: enumerableProperty,
341
+ cancelable: enumerableProperty,
342
+ defaultPrevented: enumerableProperty,
343
+ timeStamp: enumerableProperty,
344
+ composedPath: enumerableProperty,
345
+ returnValue: enumerableProperty,
346
+ bubbles: enumerableProperty,
347
+ composed: enumerableProperty,
348
+ eventPhase: enumerableProperty,
349
+ cancelBubble: enumerableProperty,
350
+ stopPropagation: enumerableProperty,
351
+ isTrusted: enumerableProperty
352
+ });
353
+ const CustomEventShim = (_b = class CustomEvent extends EventShim {
354
+ constructor(type, options = {}) {
355
+ var _options$detail;
356
+ super(type, options);
357
+ _CustomEvent_detail.set(this, void 0);
358
+ __classPrivateFieldSet(this, _CustomEvent_detail, (_options$detail = options === null || options === void 0 ? void 0 : options.detail) !== null && _options$detail !== void 0 ? _options$detail : null, "f");
359
+ }
360
+ initCustomEvent(_type, _bubbles, _cancelable, _detail) {
361
+ throw new Error("Method not implemented.");
362
+ }
363
+ get detail() {
364
+ return __classPrivateFieldGet(this, _CustomEvent_detail, "f");
365
+ }
366
+ }, _CustomEvent_detail = /* @__PURE__ */ new WeakMap(), _b);
367
+ Object.defineProperties(CustomEventShim.prototype, { detail: enumerableProperty });
368
+ const EventShimWithRealType = EventShim;
369
+ const CustomEventShimWithRealType = CustomEventShim;
370
+
371
+ //#endregion
372
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/lib/css.js
373
+ /**
374
+ * @license
375
+ * Copyright 2024 Google LLC
376
+ * SPDX-License-Identifier: BSD-3-Clause
377
+ */
378
+ var _a;
379
+ const CSSRuleShim = (_a = class CSSRule {
380
+ constructor() {
381
+ this.STYLE_RULE = 1;
382
+ this.CHARSET_RULE = 2;
383
+ this.IMPORT_RULE = 3;
384
+ this.MEDIA_RULE = 4;
385
+ this.FONT_FACE_RULE = 5;
386
+ this.PAGE_RULE = 6;
387
+ this.NAMESPACE_RULE = 10;
388
+ this.KEYFRAMES_RULE = 7;
389
+ this.KEYFRAME_RULE = 8;
390
+ this.SUPPORTS_RULE = 12;
391
+ this.COUNTER_STYLE_RULE = 11;
392
+ this.FONT_FEATURE_VALUES_RULE = 14;
393
+ this.__parentStyleSheet = null;
394
+ this.cssText = "";
395
+ }
396
+ get parentRule() {
397
+ return null;
398
+ }
399
+ get parentStyleSheet() {
400
+ return this.__parentStyleSheet;
401
+ }
402
+ get type() {
403
+ return 0;
404
+ }
405
+ }, _a.STYLE_RULE = 1, _a.CHARSET_RULE = 2, _a.IMPORT_RULE = 3, _a.MEDIA_RULE = 4, _a.FONT_FACE_RULE = 5, _a.PAGE_RULE = 6, _a.NAMESPACE_RULE = 10, _a.KEYFRAMES_RULE = 7, _a.KEYFRAME_RULE = 8, _a.SUPPORTS_RULE = 12, _a.COUNTER_STYLE_RULE = 11, _a.FONT_FEATURE_VALUES_RULE = 14, _a);
406
+
407
+ //#endregion
408
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/index.js
409
+ /**
410
+ * @license
411
+ * Copyright 2019 Google LLC
412
+ * SPDX-License-Identifier: BSD-3-Clause
413
+ */
414
+ var _globalThis, _globalThis$Event, _globalThis2, _globalThis2$CustomEv, _globalThis3, _globalThis3$litServe;
415
+ (_globalThis$Event = (_globalThis = globalThis).Event) !== null && _globalThis$Event !== void 0 || (_globalThis.Event = EventShimWithRealType);
416
+ (_globalThis2$CustomEv = (_globalThis2 = globalThis).CustomEvent) !== null && _globalThis2$CustomEv !== void 0 || (_globalThis2.CustomEvent = CustomEventShimWithRealType);
417
+ const attributes = /* @__PURE__ */ new WeakMap();
418
+ const attributesForElement = (element) => {
419
+ let attrs = attributes.get(element);
420
+ if (attrs === void 0) attributes.set(element, attrs = /* @__PURE__ */ new Map());
421
+ return attrs;
422
+ };
423
+ const ElementShim = class Element extends EventTargetShimWithRealType {
424
+ constructor() {
425
+ super(...arguments);
426
+ this.__shadowRootMode = null;
427
+ this.__shadowRoot = null;
428
+ this.__internals = null;
429
+ }
430
+ get attributes() {
431
+ return Array.from(attributesForElement(this)).map(([name, value]) => ({
432
+ name,
433
+ value
434
+ }));
435
+ }
436
+ get shadowRoot() {
437
+ if (this.__shadowRootMode === "closed") return null;
438
+ return this.__shadowRoot;
439
+ }
440
+ get localName() {
441
+ return this.constructor.__localName;
442
+ }
443
+ get tagName() {
444
+ var _this$localName;
445
+ return (_this$localName = this.localName) === null || _this$localName === void 0 ? void 0 : _this$localName.toUpperCase();
446
+ }
447
+ setAttribute(name, value) {
448
+ attributesForElement(this).set(name, String(value));
449
+ }
450
+ removeAttribute(name) {
451
+ attributesForElement(this).delete(name);
452
+ }
453
+ toggleAttribute(name, force) {
454
+ if (this.hasAttribute(name)) {
455
+ if (force === void 0 || !force) {
456
+ this.removeAttribute(name);
457
+ return false;
458
+ }
459
+ } else if (force === void 0 || force) {
460
+ this.setAttribute(name, "");
461
+ return true;
462
+ } else return false;
463
+ return true;
464
+ }
465
+ hasAttribute(name) {
466
+ return attributesForElement(this).has(name);
467
+ }
468
+ attachShadow(init) {
469
+ const shadowRoot = { host: this };
470
+ this.__shadowRootMode = init.mode;
471
+ if (init && init.mode === "open") this.__shadowRoot = shadowRoot;
472
+ return shadowRoot;
473
+ }
474
+ attachInternals() {
475
+ if (this.__internals !== null) throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
476
+ const internals = new ElementInternalsShim(this);
477
+ this.__internals = internals;
478
+ return internals;
479
+ }
480
+ getAttribute(name) {
481
+ const value = attributesForElement(this).get(name);
482
+ return value !== null && value !== void 0 ? value : null;
483
+ }
484
+ };
485
+ const HTMLElementShimWithRealType = class HTMLElement extends ElementShim {};
486
+ (_globalThis3$litServe = (_globalThis3 = globalThis).litServerRoot) !== null && _globalThis3$litServe !== void 0 || (_globalThis3.litServerRoot = Object.defineProperty(new HTMLElementShimWithRealType(), "localName", { get() {
487
+ return "lit-server-root";
488
+ } }));
489
+ function promiseWithResolvers() {
490
+ let resolve;
491
+ let reject;
492
+ return {
493
+ promise: new Promise((res, rej) => {
494
+ resolve = res;
495
+ reject = rej;
496
+ }),
497
+ resolve,
498
+ reject
499
+ };
500
+ }
501
+ var CustomElementRegistry = class {
502
+ constructor() {
503
+ this.__definitions = /* @__PURE__ */ new Map();
504
+ this.__reverseDefinitions = /* @__PURE__ */ new Map();
505
+ this.__pendingWhenDefineds = /* @__PURE__ */ new Map();
506
+ }
507
+ define(name, ctor) {
508
+ var _ctor$observedAttribu, _this$__pendingWhenDe;
509
+ if (this.__definitions.has(name)) if (process.env.NODE_ENV === "development") console.warn(`'CustomElementRegistry' already has "${name}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.\nMake sure to test your application with a production build as repeat registrations will throw in production.`);
510
+ else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${name}" has already been used with this registry`);
511
+ if (this.__reverseDefinitions.has(ctor)) throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(ctor)}`);
512
+ ctor.__localName = name;
513
+ this.__definitions.set(name, {
514
+ ctor,
515
+ observedAttributes: (_ctor$observedAttribu = ctor.observedAttributes) !== null && _ctor$observedAttribu !== void 0 ? _ctor$observedAttribu : []
516
+ });
517
+ this.__reverseDefinitions.set(ctor, name);
518
+ (_this$__pendingWhenDe = this.__pendingWhenDefineds.get(name)) === null || _this$__pendingWhenDe === void 0 || _this$__pendingWhenDe.resolve(ctor);
519
+ this.__pendingWhenDefineds.delete(name);
520
+ }
521
+ get(name) {
522
+ const definition = this.__definitions.get(name);
523
+ return definition === null || definition === void 0 ? void 0 : definition.ctor;
524
+ }
525
+ getName(ctor) {
526
+ var _this$__reverseDefini;
527
+ return (_this$__reverseDefini = this.__reverseDefinitions.get(ctor)) !== null && _this$__reverseDefini !== void 0 ? _this$__reverseDefini : null;
528
+ }
529
+ upgrade(_element) {
530
+ throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.");
531
+ }
532
+ async whenDefined(name) {
533
+ const definition = this.__definitions.get(name);
534
+ if (definition) return definition.ctor;
535
+ let withResolvers = this.__pendingWhenDefineds.get(name);
536
+ if (!withResolvers) {
537
+ withResolvers = promiseWithResolvers();
538
+ this.__pendingWhenDefineds.set(name, withResolvers);
539
+ }
540
+ return withResolvers.promise;
541
+ }
542
+ };
543
+ const CustomElementRegistryShimWithRealType = CustomElementRegistry;
544
+ const customElements$1 = new CustomElementRegistryShimWithRealType();
545
+
546
+ //#endregion
547
+ //#region ../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/node/css-tag.js
548
+ /**
549
+ * @license
550
+ * Copyright 2019 Google LLC
551
+ * SPDX-License-Identifier: BSD-3-Clause
552
+ */
553
+ const t$3 = globalThis, e$4 = t$3.ShadowRoot && (void 0 === t$3.ShadyCSS || t$3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$3 = Symbol(), o$3 = /* @__PURE__ */ new WeakMap();
554
+ var n$3 = class {
555
+ constructor(t, e, o) {
556
+ if (this._$cssResult$ = !0, o !== s$3) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
557
+ this.cssText = t, this.t = e;
558
+ }
559
+ get styleSheet() {
560
+ let t = this.o;
561
+ const s = this.t;
562
+ if (e$4 && void 0 === t) {
563
+ const e = void 0 !== s && 1 === s.length;
564
+ e && (t = o$3.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$3.set(s, t));
565
+ }
566
+ return t;
567
+ }
568
+ toString() {
569
+ return this.cssText;
570
+ }
571
+ };
572
+ const r$3 = (t) => new n$3("string" == typeof t ? t : t + "", void 0, s$3), i$4 = (t, ...e) => {
573
+ return new n$3(1 === t.length ? t[0] : e.reduce((e, s, o) => e + ((t) => {
574
+ if (!0 === t._$cssResult$) return t.cssText;
575
+ if ("number" == typeof t) return t;
576
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
577
+ })(s) + t[o + 1], t[0]), t, s$3);
578
+ }, S$1 = (s, o) => {
579
+ if (e$4) s.adoptedStyleSheets = o.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
580
+ else for (const e of o) {
581
+ const o = document.createElement("style"), n = t$3.litNonce;
582
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
583
+ }
584
+ }, c$4 = e$4 || void 0 === t$3.CSSStyleSheet ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((t) => {
585
+ let e = "";
586
+ for (const s of t.cssRules) e += s.cssText;
587
+ return r$3(e);
588
+ })(t) : t;
589
+
590
+ //#endregion
591
+ //#region ../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/node/reactive-element.js
592
+ var _l$customElements, _Symbol, _Symbol$metadata, _l$litPropertyMetadat, _globalThis$HTMLEleme, _l$reactiveElementVer;
593
+ const { is: h$2, defineProperty: r$2, getOwnPropertyDescriptor: o$2, getOwnPropertyNames: n$2, getOwnPropertySymbols: a$1, getPrototypeOf: c$3 } = Object, l$2 = globalThis;
594
+ (_l$customElements = l$2.customElements) !== null && _l$customElements !== void 0 || (l$2.customElements = customElements$1);
595
+ const p$2 = l$2.trustedTypes, d$2 = p$2 ? p$2.emptyScript : "", u$3 = l$2.reactiveElementPolyfillSupport, f$2 = (t, s) => t, b$1 = {
596
+ toAttribute(t, s) {
597
+ switch (s) {
598
+ case Boolean:
599
+ t = t ? d$2 : null;
600
+ break;
601
+ case Object:
602
+ case Array: t = null == t ? t : JSON.stringify(t);
603
+ }
604
+ return t;
605
+ },
606
+ fromAttribute(t, s) {
607
+ let i = t;
608
+ switch (s) {
609
+ case Boolean:
610
+ i = null !== t;
611
+ break;
612
+ case Number:
613
+ i = null === t ? null : Number(t);
614
+ break;
615
+ case Object:
616
+ case Array: try {
617
+ i = JSON.parse(t);
618
+ } catch (t) {
619
+ i = null;
620
+ }
621
+ }
622
+ return i;
623
+ }
624
+ }, m$2 = (t, s) => !h$2(t, s), y$1 = {
625
+ attribute: !0,
626
+ type: String,
627
+ converter: b$1,
628
+ reflect: !1,
629
+ useDefault: !1,
630
+ hasChanged: m$2
631
+ };
632
+ (_Symbol$metadata = (_Symbol = Symbol).metadata) !== null && _Symbol$metadata !== void 0 || (_Symbol.metadata = Symbol("metadata")), (_l$litPropertyMetadat = l$2.litPropertyMetadata) !== null && _l$litPropertyMetadat !== void 0 || (l$2.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
633
+ var g$1 = class extends ((_globalThis$HTMLEleme = globalThis.HTMLElement) !== null && _globalThis$HTMLEleme !== void 0 ? _globalThis$HTMLEleme : HTMLElementShimWithRealType) {
634
+ static addInitializer(t) {
635
+ var _this$l;
636
+ this._$Ei(), ((_this$l = this.l) !== null && _this$l !== void 0 ? _this$l : this.l = []).push(t);
637
+ }
638
+ static get observedAttributes() {
639
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
640
+ }
641
+ static createProperty(t, s = y$1) {
642
+ if (s.state && (s.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = !0), this.elementProperties.set(t, s), !s.noAccessor) {
643
+ const i = Symbol(), e = this.getPropertyDescriptor(t, i, s);
644
+ void 0 !== e && r$2(this.prototype, t, e);
645
+ }
646
+ }
647
+ static getPropertyDescriptor(t, s, i) {
648
+ var _o;
649
+ const { get: e, set: h } = (_o = o$2(this.prototype, t)) !== null && _o !== void 0 ? _o : {
650
+ get() {
651
+ return this[s];
652
+ },
653
+ set(t) {
654
+ this[s] = t;
655
+ }
656
+ };
657
+ return {
658
+ get: e,
659
+ set(s) {
660
+ const r = e === null || e === void 0 ? void 0 : e.call(this);
661
+ h === null || h === void 0 || h.call(this, s), this.requestUpdate(t, r, i);
662
+ },
663
+ configurable: !0,
664
+ enumerable: !0
665
+ };
666
+ }
667
+ static getPropertyOptions(t) {
668
+ var _this$elementProperti;
669
+ return (_this$elementProperti = this.elementProperties.get(t)) !== null && _this$elementProperti !== void 0 ? _this$elementProperti : y$1;
670
+ }
671
+ static _$Ei() {
672
+ if (this.hasOwnProperty(f$2("elementProperties"))) return;
673
+ const t = c$3(this);
674
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
675
+ }
676
+ static finalize() {
677
+ if (this.hasOwnProperty(f$2("finalized"))) return;
678
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(f$2("properties"))) {
679
+ const t = this.properties, s = [...n$2(t), ...a$1(t)];
680
+ for (const i of s) this.createProperty(i, t[i]);
681
+ }
682
+ const t = this[Symbol.metadata];
683
+ if (null !== t) {
684
+ const s = litPropertyMetadata.get(t);
685
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
686
+ }
687
+ this._$Eh = /* @__PURE__ */ new Map();
688
+ for (const [t, s] of this.elementProperties) {
689
+ const i = this._$Eu(t, s);
690
+ void 0 !== i && this._$Eh.set(i, t);
691
+ }
692
+ this.elementStyles = this.finalizeStyles(this.styles);
693
+ }
694
+ static finalizeStyles(t) {
695
+ const s = [];
696
+ if (Array.isArray(t)) {
697
+ const e = new Set(t.flat(Infinity).reverse());
698
+ for (const t of e) s.unshift(c$4(t));
699
+ } else void 0 !== t && s.push(c$4(t));
700
+ return s;
701
+ }
702
+ static _$Eu(t, s) {
703
+ const i = s.attribute;
704
+ return !1 === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
705
+ }
706
+ constructor() {
707
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
708
+ }
709
+ _$Ev() {
710
+ var _this$constructor$l;
711
+ this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (_this$constructor$l = this.constructor.l) === null || _this$constructor$l === void 0 || _this$constructor$l.forEach((t) => t(this));
712
+ }
713
+ addController(t) {
714
+ var _this$_$EO, _t$hostConnected;
715
+ ((_this$_$EO = this._$EO) !== null && _this$_$EO !== void 0 ? _this$_$EO : this._$EO = /* @__PURE__ */ new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && ((_t$hostConnected = t.hostConnected) === null || _t$hostConnected === void 0 || _t$hostConnected.call(t));
716
+ }
717
+ removeController(t) {
718
+ var _this$_$EO2;
719
+ (_this$_$EO2 = this._$EO) === null || _this$_$EO2 === void 0 || _this$_$EO2.delete(t);
720
+ }
721
+ _$E_() {
722
+ const t = /* @__PURE__ */ new Map(), s = this.constructor.elementProperties;
723
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
724
+ t.size > 0 && (this._$Ep = t);
725
+ }
726
+ createRenderRoot() {
727
+ var _this$shadowRoot;
728
+ const t = (_this$shadowRoot = this.shadowRoot) !== null && _this$shadowRoot !== void 0 ? _this$shadowRoot : this.attachShadow(this.constructor.shadowRootOptions);
729
+ return S$1(t, this.constructor.elementStyles), t;
730
+ }
731
+ connectedCallback() {
732
+ var _this$renderRoot, _this$_$EO3;
733
+ (_this$renderRoot = this.renderRoot) !== null && _this$renderRoot !== void 0 || (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (_this$_$EO3 = this._$EO) === null || _this$_$EO3 === void 0 || _this$_$EO3.forEach((t) => {
734
+ var _t$hostConnected2;
735
+ return (_t$hostConnected2 = t.hostConnected) === null || _t$hostConnected2 === void 0 ? void 0 : _t$hostConnected2.call(t);
736
+ });
737
+ }
738
+ enableUpdating(t) {}
739
+ disconnectedCallback() {
740
+ var _this$_$EO4;
741
+ (_this$_$EO4 = this._$EO) === null || _this$_$EO4 === void 0 || _this$_$EO4.forEach((t) => {
742
+ var _t$hostDisconnected;
743
+ return (_t$hostDisconnected = t.hostDisconnected) === null || _t$hostDisconnected === void 0 ? void 0 : _t$hostDisconnected.call(t);
744
+ });
745
+ }
746
+ attributeChangedCallback(t, s, i) {
747
+ this._$AK(t, i);
748
+ }
749
+ _$ET(t, s) {
750
+ const i = this.constructor.elementProperties.get(t), e = this.constructor._$Eu(t, i);
751
+ if (void 0 !== e && !0 === i.reflect) {
752
+ var _i$converter;
753
+ const h = (void 0 !== ((_i$converter = i.converter) === null || _i$converter === void 0 ? void 0 : _i$converter.toAttribute) ? i.converter : b$1).toAttribute(s, i.type);
754
+ this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
755
+ }
756
+ }
757
+ _$AK(t, s) {
758
+ const i = this.constructor, e = i._$Eh.get(t);
759
+ if (void 0 !== e && this._$Em !== e) {
760
+ var _t$converter, _ref, _this$_$Ej;
761
+ const t = i.getPropertyOptions(e), h = "function" == typeof t.converter ? { fromAttribute: t.converter } : void 0 !== ((_t$converter = t.converter) === null || _t$converter === void 0 ? void 0 : _t$converter.fromAttribute) ? t.converter : b$1;
762
+ this._$Em = e;
763
+ const r = h.fromAttribute(s, t.type);
764
+ this[e] = (_ref = r !== null && r !== void 0 ? r : (_this$_$Ej = this._$Ej) === null || _this$_$Ej === void 0 ? void 0 : _this$_$Ej.get(e)) !== null && _ref !== void 0 ? _ref : r, this._$Em = null;
765
+ }
766
+ }
767
+ requestUpdate(t, s, i, e = !1, h) {
768
+ if (void 0 !== t) {
769
+ var _i, _i$hasChanged, _this$_$Ej2;
770
+ const r = this.constructor;
771
+ if (!1 === e && (h = this[t]), (_i = i) !== null && _i !== void 0 || (i = r.getPropertyOptions(t)), !(((_i$hasChanged = i.hasChanged) !== null && _i$hasChanged !== void 0 ? _i$hasChanged : m$2)(h, s) || i.useDefault && i.reflect && h === ((_this$_$Ej2 = this._$Ej) === null || _this$_$Ej2 === void 0 ? void 0 : _this$_$Ej2.get(t)) && !this.hasAttribute(r._$Eu(t, i)))) return;
772
+ this.C(t, s, i);
773
+ }
774
+ !1 === this.isUpdatePending && (this._$ES = this._$EP());
775
+ }
776
+ C(t, s, { useDefault: i, reflect: e, wrapped: h }, r) {
777
+ var _this$_$Ej3, _ref2, _this$_$Eq;
778
+ i && !((_this$_$Ej3 = this._$Ej) !== null && _this$_$Ej3 !== void 0 ? _this$_$Ej3 : this._$Ej = /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, (_ref2 = r !== null && r !== void 0 ? r : s) !== null && _ref2 !== void 0 ? _ref2 : this[t]), !0 !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), !0 === e && this._$Em !== t && ((_this$_$Eq = this._$Eq) !== null && _this$_$Eq !== void 0 ? _this$_$Eq : this._$Eq = /* @__PURE__ */ new Set()).add(t));
779
+ }
780
+ async _$EP() {
781
+ this.isUpdatePending = !0;
782
+ try {
783
+ await this._$ES;
784
+ } catch (t) {
785
+ Promise.reject(t);
786
+ }
787
+ const t = this.scheduleUpdate();
788
+ return null != t && await t, !this.isUpdatePending;
789
+ }
790
+ scheduleUpdate() {
791
+ return this.performUpdate();
792
+ }
793
+ performUpdate() {
794
+ if (!this.isUpdatePending) return;
795
+ if (!this.hasUpdated) {
796
+ var _this$renderRoot2;
797
+ if ((_this$renderRoot2 = this.renderRoot) !== null && _this$renderRoot2 !== void 0 || (this.renderRoot = this.createRenderRoot()), this._$Ep) {
798
+ for (const [t, s] of this._$Ep) this[t] = s;
799
+ this._$Ep = void 0;
800
+ }
801
+ const t = this.constructor.elementProperties;
802
+ if (t.size > 0) for (const [s, i] of t) {
803
+ const { wrapped: t } = i, e = this[s];
804
+ !0 !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
805
+ }
806
+ }
807
+ let t = !1;
808
+ const s = this._$AL;
809
+ try {
810
+ var _this$_$EO5;
811
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), (_this$_$EO5 = this._$EO) === null || _this$_$EO5 === void 0 || _this$_$EO5.forEach((t) => {
812
+ var _t$hostUpdate;
813
+ return (_t$hostUpdate = t.hostUpdate) === null || _t$hostUpdate === void 0 ? void 0 : _t$hostUpdate.call(t);
814
+ }), this.update(s)) : this._$EM();
815
+ } catch (s) {
816
+ throw t = !1, this._$EM(), s;
817
+ }
818
+ t && this._$AE(s);
819
+ }
820
+ willUpdate(t) {}
821
+ _$AE(t) {
822
+ var _this$_$EO6;
823
+ (_this$_$EO6 = this._$EO) === null || _this$_$EO6 === void 0 || _this$_$EO6.forEach((t) => {
824
+ var _t$hostUpdated;
825
+ return (_t$hostUpdated = t.hostUpdated) === null || _t$hostUpdated === void 0 ? void 0 : _t$hostUpdated.call(t);
826
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
827
+ }
828
+ _$EM() {
829
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
830
+ }
831
+ get updateComplete() {
832
+ return this.getUpdateComplete();
833
+ }
834
+ getUpdateComplete() {
835
+ return this._$ES;
836
+ }
837
+ shouldUpdate(t) {
838
+ return !0;
839
+ }
840
+ update(t) {
841
+ this._$Eq && (this._$Eq = this._$Eq.forEach((t) => this._$ET(t, this[t]))), this._$EM();
842
+ }
843
+ updated(t) {}
844
+ firstUpdated(t) {}
845
+ };
846
+ g$1.elementStyles = [], g$1.shadowRootOptions = { mode: "open" }, g$1[f$2("elementProperties")] = /* @__PURE__ */ new Map(), g$1[f$2("finalized")] = /* @__PURE__ */ new Map(), u$3 === null || u$3 === void 0 || u$3({ ReactiveElement: g$1 }), ((_l$reactiveElementVer = l$2.reactiveElementVersions) !== null && _l$reactiveElementVer !== void 0 ? _l$reactiveElementVer : l$2.reactiveElementVersions = []).push("2.1.2");
847
+
848
+ //#endregion
849
+ //#region ../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/lit-html.js
850
+ var _t$litHtmlVersions;
851
+ /**
852
+ * @license
853
+ * Copyright 2017 Google LLC
854
+ * SPDX-License-Identifier: BSD-3-Clause
855
+ */
856
+ const t$2 = globalThis, i$3 = (t) => t, s$2 = t$2.trustedTypes, e$3 = s$2 ? s$2.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, h$1 = "$lit$", o$1 = `lit$${Math.random().toFixed(9).slice(2)}$`, n$1 = "?" + o$1, r$1 = `<${n$1}>`, l$1 = void 0 === t$2.document ? { createTreeWalker: () => ({}) } : document, c$2 = () => l$1.createComment(""), a = (t) => null === t || "object" != typeof t && "function" != typeof t, u$2 = Array.isArray, d$1 = (t) => u$2(t) || "function" == typeof (t === null || t === void 0 ? void 0 : t[Symbol.iterator]), f$1 = "[ \n\f\r]", v$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _ = /-->/g, m$1 = />/g, p$1 = RegExp(`>|${f$1}(?:([^\\s"'>=/]+)(${f$1}*=${f$1}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y = /^(?:script|style|textarea|title)$/i, x = (t) => (i, ...s) => ({
857
+ _$litType$: t,
858
+ strings: i,
859
+ values: s
860
+ }), T$1 = x(1), b = x(2), w = x(3), E = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), C = /* @__PURE__ */ new WeakMap(), P = l$1.createTreeWalker(l$1, 129);
861
+ function V(t, i) {
862
+ if (!u$2(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
863
+ return void 0 !== e$3 ? e$3.createHTML(i) : i;
864
+ }
865
+ const N = (t, i) => {
866
+ const s = t.length - 1, e = [];
867
+ let n, l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "", c = v$1;
868
+ for (let i = 0; i < s; i++) {
869
+ var _n;
870
+ const s = t[i];
871
+ let a, u, d = -1, f = 0;
872
+ for (; f < s.length && (c.lastIndex = f, u = c.exec(s), null !== u);) f = c.lastIndex, c === v$1 ? "!--" === u[1] ? c = _ : void 0 !== u[1] ? c = m$1 : void 0 !== u[2] ? (y.test(u[2]) && (n = RegExp("</" + u[2], "g")), c = p$1) : void 0 !== u[3] && (c = p$1) : c === p$1 ? ">" === u[0] ? (c = (_n = n) !== null && _n !== void 0 ? _n : v$1, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? p$1 : "\"" === u[3] ? $ : g) : c === $ || c === g ? c = p$1 : c === _ || c === m$1 ? c = v$1 : (c = p$1, n = void 0);
873
+ const x = c === p$1 && t[i + 1].startsWith("/>") ? " " : "";
874
+ l += c === v$1 ? s + r$1 : d >= 0 ? (e.push(a), s.slice(0, d) + h$1 + s.slice(d) + o$1 + x) : s + o$1 + (-2 === d ? i : x);
875
+ }
876
+ return [V(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), e];
877
+ };
878
+ var S = class S {
879
+ constructor({ strings: t, _$litType$: i }, e) {
880
+ let r;
881
+ this.parts = [];
882
+ let l = 0, a = 0;
883
+ const u = t.length - 1, d = this.parts, [f, v] = N(t, i);
884
+ if (this.el = S.createElement(f, e), P.currentNode = this.el.content, 2 === i || 3 === i) {
885
+ const t = this.el.content.firstChild;
886
+ t.replaceWith(...t.childNodes);
887
+ }
888
+ for (; null !== (r = P.nextNode()) && d.length < u;) {
889
+ if (1 === r.nodeType) {
890
+ if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(h$1)) {
891
+ const i = v[a++], s = r.getAttribute(t).split(o$1), e = /([.?@])?(.*)/.exec(i);
892
+ d.push({
893
+ type: 1,
894
+ index: l,
895
+ name: e[2],
896
+ strings: s,
897
+ ctor: "." === e[1] ? I : "?" === e[1] ? L : "@" === e[1] ? z : H
898
+ }), r.removeAttribute(t);
899
+ } else t.startsWith(o$1) && (d.push({
900
+ type: 6,
901
+ index: l
902
+ }), r.removeAttribute(t));
903
+ if (y.test(r.tagName)) {
904
+ const t = r.textContent.split(o$1), i = t.length - 1;
905
+ if (i > 0) {
906
+ r.textContent = s$2 ? s$2.emptyScript : "";
907
+ for (let s = 0; s < i; s++) r.append(t[s], c$2()), P.nextNode(), d.push({
908
+ type: 2,
909
+ index: ++l
910
+ });
911
+ r.append(t[i], c$2());
912
+ }
913
+ }
914
+ } else if (8 === r.nodeType) if (r.data === n$1) d.push({
915
+ type: 2,
916
+ index: l
917
+ });
918
+ else {
919
+ let t = -1;
920
+ for (; -1 !== (t = r.data.indexOf(o$1, t + 1));) d.push({
921
+ type: 7,
922
+ index: l
923
+ }), t += o$1.length - 1;
924
+ }
925
+ l++;
926
+ }
927
+ }
928
+ static createElement(t, i) {
929
+ const s = l$1.createElement("template");
930
+ return s.innerHTML = t, s;
931
+ }
932
+ };
933
+ function M$1(t, i, s = t, e) {
934
+ var _s$_$Co, _h$_$AO, _s$_$Co2;
935
+ if (i === E) return i;
936
+ let h = void 0 !== e ? (_s$_$Co = s._$Co) === null || _s$_$Co === void 0 ? void 0 : _s$_$Co[e] : s._$Cl;
937
+ const o = a(i) ? void 0 : i._$litDirective$;
938
+ return (h === null || h === void 0 ? void 0 : h.constructor) !== o && (h === null || h === void 0 || (_h$_$AO = h._$AO) === null || _h$_$AO === void 0 || _h$_$AO.call(h, !1), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? ((_s$_$Co2 = s._$Co) !== null && _s$_$Co2 !== void 0 ? _s$_$Co2 : s._$Co = [])[e] = h : s._$Cl = h), void 0 !== h && (i = M$1(t, h._$AS(t, i.values), h, e)), i;
939
+ }
940
+ var k = class {
941
+ constructor(t, i) {
942
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
943
+ }
944
+ get parentNode() {
945
+ return this._$AM.parentNode;
946
+ }
947
+ get _$AU() {
948
+ return this._$AM._$AU;
949
+ }
950
+ u(t) {
951
+ var _t$creationScope;
952
+ const { el: { content: i }, parts: s } = this._$AD, e = ((_t$creationScope = t === null || t === void 0 ? void 0 : t.creationScope) !== null && _t$creationScope !== void 0 ? _t$creationScope : l$1).importNode(i, !0);
953
+ P.currentNode = e;
954
+ let h = P.nextNode(), o = 0, n = 0, r = s[0];
955
+ for (; void 0 !== r;) {
956
+ if (o === r.index) {
957
+ let i;
958
+ 2 === r.type ? i = new R(h, h.nextSibling, this, t) : 1 === r.type ? i = new r.ctor(h, r.name, r.strings, this, t) : 6 === r.type && (i = new W(h, this, t)), this._$AV.push(i), r = s[++n];
959
+ }
960
+ o !== (r === null || r === void 0 ? void 0 : r.index) && (h = P.nextNode(), o++);
961
+ }
962
+ return P.currentNode = l$1, e;
963
+ }
964
+ p(t) {
965
+ let i = 0;
966
+ for (const s of this._$AV) void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
967
+ }
968
+ };
969
+ var R = class R {
970
+ get _$AU() {
971
+ var _this$_$AM$_$AU, _this$_$AM;
972
+ return (_this$_$AM$_$AU = (_this$_$AM = this._$AM) === null || _this$_$AM === void 0 ? void 0 : _this$_$AM._$AU) !== null && _this$_$AM$_$AU !== void 0 ? _this$_$AM$_$AU : this._$Cv;
973
+ }
974
+ constructor(t, i, s, e) {
975
+ var _e$isConnected;
976
+ this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = (_e$isConnected = e === null || e === void 0 ? void 0 : e.isConnected) !== null && _e$isConnected !== void 0 ? _e$isConnected : !0;
977
+ }
978
+ get parentNode() {
979
+ let t = this._$AA.parentNode;
980
+ const i = this._$AM;
981
+ return void 0 !== i && 11 === (t === null || t === void 0 ? void 0 : t.nodeType) && (t = i.parentNode), t;
982
+ }
983
+ get startNode() {
984
+ return this._$AA;
985
+ }
986
+ get endNode() {
987
+ return this._$AB;
988
+ }
989
+ _$AI(t, i = this) {
990
+ t = M$1(this, t, i), a(t) ? t === A || null == t || "" === t ? (this._$AH !== A && this._$AR(), this._$AH = A) : t !== this._$AH && t !== E && this._(t) : void 0 !== t._$litType$ ? this.$(t) : void 0 !== t.nodeType ? this.T(t) : d$1(t) ? this.k(t) : this._(t);
991
+ }
992
+ O(t) {
993
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
994
+ }
995
+ T(t) {
996
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
997
+ }
998
+ _(t) {
999
+ this._$AH !== A && a(this._$AH) ? this._$AA.nextSibling.data = t : this.T(l$1.createTextNode(t)), this._$AH = t;
1000
+ }
1001
+ $(t) {
1002
+ var _this$_$AH;
1003
+ const { values: i, _$litType$: s } = t, e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = S.createElement(V(s.h, s.h[0]), this.options)), s);
1004
+ if (((_this$_$AH = this._$AH) === null || _this$_$AH === void 0 ? void 0 : _this$_$AH._$AD) === e) this._$AH.p(i);
1005
+ else {
1006
+ const t = new k(e, this), s = t.u(this.options);
1007
+ t.p(i), this.T(s), this._$AH = t;
1008
+ }
1009
+ }
1010
+ _$AC(t) {
1011
+ let i = C.get(t.strings);
1012
+ return void 0 === i && C.set(t.strings, i = new S(t)), i;
1013
+ }
1014
+ k(t) {
1015
+ u$2(this._$AH) || (this._$AH = [], this._$AR());
1016
+ const i = this._$AH;
1017
+ let s, e = 0;
1018
+ for (const h of t) e === i.length ? i.push(s = new R(this.O(c$2()), this.O(c$2()), this, this.options)) : s = i[e], s._$AI(h), e++;
1019
+ e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
1020
+ }
1021
+ _$AR(t = this._$AA.nextSibling, s) {
1022
+ var _this$_$AP;
1023
+ for ((_this$_$AP = this._$AP) === null || _this$_$AP === void 0 || _this$_$AP.call(this, !1, !0, s); t !== this._$AB;) {
1024
+ const s = i$3(t).nextSibling;
1025
+ i$3(t).remove(), t = s;
1026
+ }
1027
+ }
1028
+ setConnected(t) {
1029
+ var _this$_$AP2;
1030
+ void 0 === this._$AM && (this._$Cv = t, (_this$_$AP2 = this._$AP) === null || _this$_$AP2 === void 0 || _this$_$AP2.call(this, t));
1031
+ }
1032
+ };
1033
+ var H = class {
1034
+ get tagName() {
1035
+ return this.element.tagName;
1036
+ }
1037
+ get _$AU() {
1038
+ return this._$AM._$AU;
1039
+ }
1040
+ constructor(t, i, s, e, h) {
1041
+ this.type = 1, this._$AH = A, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(/* @__PURE__ */ new String()), this.strings = s) : this._$AH = A;
1042
+ }
1043
+ _$AI(t, i = this, s, e) {
1044
+ const h = this.strings;
1045
+ let o = !1;
1046
+ if (void 0 === h) t = M$1(this, t, i, 0), o = !a(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
1047
+ else {
1048
+ var _r;
1049
+ const e = t;
1050
+ let n, r;
1051
+ for (t = h[0], n = 0; n < h.length - 1; n++) r = M$1(this, e[s + n], i, n), r === E && (r = this._$AH[n]), o || (o = !a(r) || r !== this._$AH[n]), r === A ? t = A : t !== A && (t += ((_r = r) !== null && _r !== void 0 ? _r : "") + h[n + 1]), this._$AH[n] = r;
1052
+ }
1053
+ o && !e && this.j(t);
1054
+ }
1055
+ j(t) {
1056
+ t === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t !== null && t !== void 0 ? t : "");
1057
+ }
1058
+ };
1059
+ var I = class extends H {
1060
+ constructor() {
1061
+ super(...arguments), this.type = 3;
1062
+ }
1063
+ j(t) {
1064
+ this.element[this.name] = t === A ? void 0 : t;
1065
+ }
1066
+ };
1067
+ var L = class extends H {
1068
+ constructor() {
1069
+ super(...arguments), this.type = 4;
1070
+ }
1071
+ j(t) {
1072
+ this.element.toggleAttribute(this.name, !!t && t !== A);
1073
+ }
1074
+ };
1075
+ var z = class extends H {
1076
+ constructor(t, i, s, e, h) {
1077
+ super(t, i, s, e, h), this.type = 5;
1078
+ }
1079
+ _$AI(t, i = this) {
1080
+ var _M;
1081
+ if ((t = (_M = M$1(this, t, i, 0)) !== null && _M !== void 0 ? _M : A) === E) return;
1082
+ const s = this._$AH, e = t === A && s !== A || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, h = t !== A && (s === A || e);
1083
+ e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
1084
+ }
1085
+ handleEvent(t) {
1086
+ var _this$options$host, _this$options;
1087
+ "function" == typeof this._$AH ? this._$AH.call((_this$options$host = (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.host) !== null && _this$options$host !== void 0 ? _this$options$host : this.element, t) : this._$AH.handleEvent(t);
1088
+ }
1089
+ };
1090
+ var W = class {
1091
+ constructor(t, i, s) {
1092
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
1093
+ }
1094
+ get _$AU() {
1095
+ return this._$AM._$AU;
1096
+ }
1097
+ _$AI(t) {
1098
+ M$1(this, t);
1099
+ }
1100
+ };
1101
+ const Z = {
1102
+ M: h$1,
1103
+ P: o$1,
1104
+ A: n$1,
1105
+ C: 1,
1106
+ L: N,
1107
+ R: k,
1108
+ D: d$1,
1109
+ V: M$1,
1110
+ I: R,
1111
+ H,
1112
+ N: L,
1113
+ U: z,
1114
+ B: I,
1115
+ F: W
1116
+ }, j$1 = t$2.litHtmlPolyfillSupport;
1117
+ j$1 === null || j$1 === void 0 || j$1(S, R), ((_t$litHtmlVersions = t$2.litHtmlVersions) !== null && _t$litHtmlVersions !== void 0 ? _t$litHtmlVersions : t$2.litHtmlVersions = []).push("3.3.2");
1118
+ const B = (t, i, s) => {
1119
+ var _s$renderBefore;
1120
+ const e = (_s$renderBefore = s === null || s === void 0 ? void 0 : s.renderBefore) !== null && _s$renderBefore !== void 0 ? _s$renderBefore : i;
1121
+ let h = e._$litPart$;
1122
+ if (void 0 === h) {
1123
+ var _s$renderBefore2;
1124
+ const t = (_s$renderBefore2 = s === null || s === void 0 ? void 0 : s.renderBefore) !== null && _s$renderBefore2 !== void 0 ? _s$renderBefore2 : null;
1125
+ e._$litPart$ = h = new R(i.insertBefore(c$2(), t), t, void 0, s !== null && s !== void 0 ? s : {});
1126
+ }
1127
+ return h._$AI(t), h;
1128
+ };
1129
+
1130
+ //#endregion
1131
+ //#region ../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/lit-element.js
1132
+ var _s$litElementHydrateS, _s$litElementVersions;
1133
+ /**
1134
+ * @license
1135
+ * Copyright 2017 Google LLC
1136
+ * SPDX-License-Identifier: BSD-3-Clause
1137
+ */ const s$1 = globalThis;
1138
+ var i$2 = class extends g$1 {
1139
+ constructor() {
1140
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1141
+ }
1142
+ createRenderRoot() {
1143
+ var _this$renderOptions, _this$renderOptions$r;
1144
+ const t = super.createRenderRoot();
1145
+ return (_this$renderOptions$r = (_this$renderOptions = this.renderOptions).renderBefore) !== null && _this$renderOptions$r !== void 0 || (_this$renderOptions.renderBefore = t.firstChild), t;
1146
+ }
1147
+ update(t) {
1148
+ const r = this.render();
1149
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = B(r, this.renderRoot, this.renderOptions);
1150
+ }
1151
+ connectedCallback() {
1152
+ var _this$_$Do;
1153
+ super.connectedCallback(), (_this$_$Do = this._$Do) === null || _this$_$Do === void 0 || _this$_$Do.setConnected(!0);
1154
+ }
1155
+ disconnectedCallback() {
1156
+ var _this$_$Do2;
1157
+ super.disconnectedCallback(), (_this$_$Do2 = this._$Do) === null || _this$_$Do2 === void 0 || _this$_$Do2.setConnected(!1);
1158
+ }
1159
+ render() {
1160
+ return E;
1161
+ }
1162
+ };
1163
+ i$2._$litElement$ = !0, i$2["finalized"] = !0, (_s$litElementHydrateS = s$1.litElementHydrateSupport) === null || _s$litElementHydrateS === void 0 || _s$litElementHydrateS.call(s$1, { LitElement: i$2 });
1164
+ const o = s$1.litElementPolyfillSupport;
1165
+ o === null || o === void 0 || o({ LitElement: i$2 });
1166
+ ((_s$litElementVersions = s$1.litElementVersions) !== null && _s$litElementVersions !== void 0 ? _s$litElementVersions : s$1.litElementVersions = []).push("4.2.2");
1167
+
1168
+ //#endregion
1169
+ //#region ../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/directive.js
1170
+ /**
1171
+ * @license
1172
+ * Copyright 2017 Google LLC
1173
+ * SPDX-License-Identifier: BSD-3-Clause
1174
+ */
1175
+ const t$1 = {
1176
+ ATTRIBUTE: 1,
1177
+ CHILD: 2,
1178
+ PROPERTY: 3,
1179
+ BOOLEAN_ATTRIBUTE: 4,
1180
+ EVENT: 5,
1181
+ ELEMENT: 6
1182
+ }, e$2 = (t) => (...e) => ({
1183
+ _$litDirective$: t,
1184
+ values: e
1185
+ });
1186
+ var i$1 = class {
1187
+ constructor(t) {}
1188
+ get _$AU() {
1189
+ return this._$AM._$AU;
1190
+ }
1191
+ _$AT(t, e, i) {
1192
+ this._$Ct = t, this._$AM = e, this._$Ci = i;
1193
+ }
1194
+ _$AS(t, e) {
1195
+ return this.update(t, e);
1196
+ }
1197
+ update(t, e) {
1198
+ return this.render(...e);
1199
+ }
1200
+ };
1201
+
1202
+ //#endregion
1203
+ //#region ../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/directive-helpers.js
1204
+ /**
1205
+ * @license
1206
+ * Copyright 2020 Google LLC
1207
+ * SPDX-License-Identifier: BSD-3-Clause
1208
+ */ const { I: t } = Z, i = (o) => o, n = (o) => null === o || "object" != typeof o && "function" != typeof o, e$1 = {
1209
+ HTML: 1,
1210
+ SVG: 2,
1211
+ MATHML: 3
1212
+ }, l = (o, t) => void 0 === t ? void 0 !== (o === null || o === void 0 ? void 0 : o._$litType$) : (o === null || o === void 0 ? void 0 : o._$litType$) === t, d = (o) => {
1213
+ var _o$_$litType$;
1214
+ return null != (o === null || o === void 0 || (_o$_$litType$ = o._$litType$) === null || _o$_$litType$ === void 0 ? void 0 : _o$_$litType$.h);
1215
+ }, c$1 = (o) => void 0 !== (o === null || o === void 0 ? void 0 : o._$litDirective$), f = (o) => o === null || o === void 0 ? void 0 : o._$litDirective$, r = (o) => void 0 === o.strings, s = () => document.createComment(""), v = (o, n, e) => {
1216
+ const l = o._$AA.parentNode, d = void 0 === n ? o._$AB : n._$AA;
1217
+ if (void 0 === e) e = new t(l.insertBefore(s(), d), l.insertBefore(s(), d), o, o.options);
1218
+ else {
1219
+ const t = e._$AB.nextSibling, n = e._$AM, c = n !== o;
1220
+ if (c) {
1221
+ var _e$_$AQ;
1222
+ let t;
1223
+ (_e$_$AQ = e._$AQ) === null || _e$_$AQ === void 0 || _e$_$AQ.call(e, o), e._$AM = o, void 0 !== e._$AP && (t = o._$AU) !== n._$AU && e._$AP(t);
1224
+ }
1225
+ if (t !== d || c) {
1226
+ let o = e._$AA;
1227
+ for (; o !== t;) {
1228
+ const t = i(o).nextSibling;
1229
+ i(l).insertBefore(o, d), o = t;
1230
+ }
1231
+ }
1232
+ }
1233
+ return e;
1234
+ }, u$1 = (o, t, i = o) => (o._$AI(t, i), o), m = {}, p = (o, t = m) => o._$AH = t, M = (o) => o._$AH, h = (o) => {
1235
+ o._$AR(), o._$AA.remove();
1236
+ }, j = (o) => {
1237
+ o._$AR();
1238
+ };
1239
+
1240
+ //#endregion
1241
+ //#region ../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/directives/repeat.js
1242
+ /**
1243
+ * @license
1244
+ * Copyright 2017 Google LLC
1245
+ * SPDX-License-Identifier: BSD-3-Clause
1246
+ */
1247
+ const u = (e, s, t) => {
1248
+ const r = /* @__PURE__ */ new Map();
1249
+ for (let l = s; l <= t; l++) r.set(e[l], l);
1250
+ return r;
1251
+ }, c = e$2(class extends i$1 {
1252
+ constructor(e) {
1253
+ if (super(e), e.type !== t$1.CHILD) throw Error("repeat() can only be used in text expressions");
1254
+ }
1255
+ dt(e, s, t) {
1256
+ let r;
1257
+ void 0 === t ? t = s : void 0 !== s && (r = s);
1258
+ const l = [], o = [];
1259
+ let i = 0;
1260
+ for (const s of e) l[i] = r ? r(s, i) : i, o[i] = t(s, i), i++;
1261
+ return {
1262
+ values: o,
1263
+ keys: l
1264
+ };
1265
+ }
1266
+ render(e, s, t) {
1267
+ return this.dt(e, s, t).values;
1268
+ }
1269
+ update(s, [t, r, c]) {
1270
+ var _this$ut;
1271
+ const d = M(s), { values: p$3, keys: a } = this.dt(t, r, c);
1272
+ if (!Array.isArray(d)) return this.ut = a, p$3;
1273
+ const h$3 = (_this$ut = this.ut) !== null && _this$ut !== void 0 ? _this$ut : this.ut = [], v$2 = [];
1274
+ let m, y, x = 0, j = d.length - 1, k = 0, w = p$3.length - 1;
1275
+ for (; x <= j && k <= w;) if (null === d[x]) x++;
1276
+ else if (null === d[j]) j--;
1277
+ else if (h$3[x] === a[k]) v$2[k] = u$1(d[x], p$3[k]), x++, k++;
1278
+ else if (h$3[j] === a[w]) v$2[w] = u$1(d[j], p$3[w]), j--, w--;
1279
+ else if (h$3[x] === a[w]) v$2[w] = u$1(d[x], p$3[w]), v(s, v$2[w + 1], d[x]), x++, w--;
1280
+ else if (h$3[j] === a[k]) v$2[k] = u$1(d[j], p$3[k]), v(s, d[x], d[j]), j--, k++;
1281
+ else if (void 0 === m && (m = u(a, k, w), y = u(h$3, x, j)), m.has(h$3[x])) if (m.has(h$3[j])) {
1282
+ const e = y.get(a[k]), t = void 0 !== e ? d[e] : null;
1283
+ if (null === t) {
1284
+ const e = v(s, d[x]);
1285
+ u$1(e, p$3[k]), v$2[k] = e;
1286
+ } else v$2[k] = u$1(t, p$3[k]), v(s, d[x], t), d[e] = null;
1287
+ k++;
1288
+ } else h(d[j]), j--;
1289
+ else h(d[x]), x++;
1290
+ for (; k <= w;) {
1291
+ const e = v(s, v$2[w + 1]);
1292
+ u$1(e, p$3[k]), v$2[k++] = e;
1293
+ }
1294
+ for (; x <= j;) {
1295
+ const e = d[x++];
1296
+ null !== e && h(e);
1297
+ }
1298
+ return this.ut = a, p(s, v$2), E;
1299
+ }
1300
+ });
1301
+
1302
+ //#endregion
1303
+ //#region ../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/directives/class-map.js
1304
+ /**
1305
+ * @license
1306
+ * Copyright 2018 Google LLC
1307
+ * SPDX-License-Identifier: BSD-3-Clause
1308
+ */ const e = e$2(class extends i$1 {
1309
+ constructor(t) {
1310
+ var _t$strings;
1311
+ if (super(t), t.type !== t$1.ATTRIBUTE || "class" !== t.name || ((_t$strings = t.strings) === null || _t$strings === void 0 ? void 0 : _t$strings.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
1312
+ }
1313
+ render(t) {
1314
+ return " " + Object.keys(t).filter((s) => t[s]).join(" ") + " ";
1315
+ }
1316
+ update(s, [i]) {
1317
+ if (void 0 === this.st) {
1318
+ var _this$nt;
1319
+ this.st = /* @__PURE__ */ new Set(), void 0 !== s.strings && (this.nt = new Set(s.strings.join(" ").split(/\s/).filter((t) => "" !== t)));
1320
+ for (const t in i) i[t] && !((_this$nt = this.nt) === null || _this$nt === void 0 ? void 0 : _this$nt.has(t)) && this.st.add(t);
1321
+ return this.render(i);
1322
+ }
1323
+ const r = s.element.classList;
1324
+ for (const t of this.st) t in i || (r.remove(t), this.st.delete(t));
1325
+ for (const t in i) {
1326
+ var _this$nt2;
1327
+ const s = !!i[t];
1328
+ s === this.st.has(t) || !((_this$nt2 = this.nt) === null || _this$nt2 === void 0) && _this$nt2.has(t) || (s ? (r.add(t), this.st.add(t)) : (r.remove(t), this.st.delete(t)));
1329
+ }
1330
+ return E;
1331
+ }
1332
+ });
1333
+
1334
+ //#endregion
1335
+ //#region src/threads-drawer/generated-tokens.ts
1336
+ /**
1337
+ * GENERATED FILE — DO NOT EDIT BY HAND.
1338
+ *
1339
+ * Bundled default values for the drawer's design tokens, derived at build time
1340
+ * from the canonical react-core theme (`packages/react-core/src/v2/styles/globals.css`)
1341
+ * by `scripts/generate-tokens.ts`. Run `pnpm run gen:tokens` to regenerate.
1342
+ *
1343
+ * The drawer's shadow-DOM CSS references these as fallbacks, e.g.
1344
+ * `var(--cpk-drawer-bg, <built default>)`, so consumers can override every
1345
+ * token while the built-in skin stays in sync with react-core.
1346
+ */
1347
+ const GENERATED_DRAWER_TOKEN_DEFAULTS = {
1348
+ "bg": "oklch(1 0 0)",
1349
+ "fg": "oklch(0.145 0 0)",
1350
+ "surface": "oklch(1 0 0)",
1351
+ "surface-fg": "oklch(0.145 0 0)",
1352
+ "muted": "oklch(0.97 0 0)",
1353
+ "muted-fg": "oklch(0.556 0 0)",
1354
+ "accent": "oklch(0.97 0 0)",
1355
+ "accent-fg": "oklch(0.205 0 0)",
1356
+ "primary": "oklch(0.205 0 0)",
1357
+ "primary-fg": "oklch(0.985 0 0)",
1358
+ "danger": "oklch(0.577 0.245 27.325)",
1359
+ "border": "oklch(0.922 0 0)",
1360
+ "ring": "oklch(0.708 0 0)",
1361
+ "radius": "0.625rem"
1362
+ };
1363
+
1364
+ //#endregion
1365
+ //#region src/threads-drawer/styles.ts
1366
+ /**
1367
+ * Wraps a generated token default value so it can be safely interpolated into a
1368
+ * lit `css` template. Values come from the checked-in generated tokens file
1369
+ * (derived from react-core), never from user input, so `unsafeCSS` is safe
1370
+ * here.
1371
+ */
1372
+ const tok = (value) => r$3(value);
1373
+ const T = GENERATED_DRAWER_TOKEN_DEFAULTS;
1374
+ /**
1375
+ * Self-contained shadow-DOM styles for `<copilotkit-threads-drawer>`.
1376
+ *
1377
+ * Authoring rules baked in here:
1378
+ * - Every visual value is a `var(--cpk-drawer-<token>, <built default>)`. The
1379
+ * built defaults come from {@link GENERATED_DRAWER_TOKEN_DEFAULTS}, derived
1380
+ * from react-core's canonical theme at build time (anti-drift). Consumers
1381
+ * override by setting `--cpk-drawer-*` from the light DOM — CSS custom
1382
+ * properties pierce the shadow boundary by design.
1383
+ * - Inherited properties (font, color, line-height) are RE-PINNED on `:host`
1384
+ * so a hostile host stylesheet (`all: unset`, `* { ... !important }`,
1385
+ * Tailwind preflight) cannot leak into or strip styling from the element.
1386
+ * - Structural nodes expose `::part(...)` hooks for fine-grained theming.
1387
+ *
1388
+ * Token fallbacks are interpolated as literals (not runtime-read) so the CSS is
1389
+ * static and ships compiled.
1390
+ */
1391
+ const drawerStyles = i$4`
1392
+ :host {
1393
+ /* Re-pin inheritable properties to close inheritance leaks from hostile
1394
+ host CSS. These are the only properties that cross the shadow boundary
1395
+ via inheritance, so we hard-set them at the root. */
1396
+ all: initial;
1397
+ display: block;
1398
+ height: 100%;
1399
+ box-sizing: border-box;
1400
+ font-family:
1401
+ var(--cpk-drawer-font-family, ui-sans-serif, system-ui, sans-serif);
1402
+ font-size: var(--cpk-drawer-font-size, 14px);
1403
+ line-height: var(--cpk-drawer-line-height, 1.4);
1404
+ color: var(--cpk-drawer-fg, var(--foreground, ${tok(T.fg)}));
1405
+
1406
+ /* Three-level token resolution, highest priority first:
1407
+ 1. explicit per-token override (--cpk-drawer-*),
1408
+ 2. the host app's theme variable (--background/--card/… — the standard
1409
+ react-core/shadcn names), so the drawer follows the host's light/dark
1410
+ theme by inheritance (custom properties are NOT reset by all:initial),
1411
+ 3. the built-in light default derived from react-core at build time, so a
1412
+ host with no theme still renders correctly (self-contained). */
1413
+ --_bg: var(--cpk-drawer-bg, var(--background, ${tok(T.bg)}));
1414
+ --_surface: var(--cpk-drawer-surface, var(--card, ${tok(T.surface)}));
1415
+ --_surface-fg: var(
1416
+ --cpk-drawer-surface-fg,
1417
+ var(--card-foreground, ${tok(T["surface-fg"])})
1418
+ );
1419
+ --_muted: var(--cpk-drawer-muted, var(--muted, ${tok(T.muted)}));
1420
+ --_muted-fg: var(
1421
+ --cpk-drawer-muted-fg,
1422
+ var(--muted-foreground, ${tok(T["muted-fg"])})
1423
+ );
1424
+ --_accent: var(--cpk-drawer-accent, var(--accent, ${tok(T.accent)}));
1425
+ --_accent-fg: var(
1426
+ --cpk-drawer-accent-fg,
1427
+ var(--accent-foreground, ${tok(T["accent-fg"])})
1428
+ );
1429
+ --_primary: var(--cpk-drawer-primary, var(--primary, ${tok(T.primary)}));
1430
+ --_primary-fg: var(
1431
+ --cpk-drawer-primary-fg,
1432
+ var(--primary-foreground, ${tok(T["primary-fg"])})
1433
+ );
1434
+ --_danger: var(--cpk-drawer-danger, var(--destructive, ${tok(T.danger)}));
1435
+ --_border: var(--cpk-drawer-border, var(--border, ${tok(T.border)}));
1436
+ --_ring: var(--cpk-drawer-ring, var(--ring, ${tok(T.ring)}));
1437
+ --_radius: var(--cpk-drawer-radius, var(--radius, ${tok(T.radius)}));
1438
+ --_width: var(--cpk-drawer-width, 320px);
1439
+ --_rail-width: var(--cpk-drawer-rail-width, 56px);
1440
+ }
1441
+
1442
+ :host([hidden]) {
1443
+ display: none;
1444
+ }
1445
+
1446
+ * {
1447
+ box-sizing: border-box;
1448
+ }
1449
+
1450
+ .root {
1451
+ display: flex;
1452
+ flex-direction: column;
1453
+ height: 100%;
1454
+ width: var(--_width);
1455
+ background: var(--_bg);
1456
+ border-right: 1px solid var(--_border);
1457
+ overflow: hidden;
1458
+ transition: width 0.2s ease;
1459
+ }
1460
+
1461
+ .root.collapsed {
1462
+ width: var(--_rail-width);
1463
+ }
1464
+
1465
+ /* Mobile: off-canvas overlay (modal pattern). */
1466
+ .root.mobile {
1467
+ position: fixed;
1468
+ inset: 0 auto 0 0;
1469
+ z-index: 1000;
1470
+ width: min(var(--_width), 85vw);
1471
+ transform: translateX(-100%);
1472
+ transition: transform 0.2s ease;
1473
+ box-shadow: 0 0 0 100vmax transparent;
1474
+ }
1475
+
1476
+ .root.mobile.open {
1477
+ transform: translateX(0);
1478
+ }
1479
+
1480
+ .backdrop {
1481
+ position: fixed;
1482
+ inset: 0;
1483
+ z-index: 999;
1484
+ background: rgba(0, 0, 0, 0.4);
1485
+ border: 0;
1486
+ padding: 0;
1487
+ margin: 0;
1488
+ cursor: pointer;
1489
+ }
1490
+
1491
+ /* Mobile-only floating affordance to OPEN the off-canvas drawer. Rendered by
1492
+ the element itself so phones always have a way in with no host wiring. */
1493
+ .launcher {
1494
+ position: fixed;
1495
+ z-index: 998;
1496
+ /* Position is themeable so a host can line the launcher up with its own
1497
+ header controls (e.g. vertically centering it on a toggle group). */
1498
+ top: var(--cpk-drawer-launcher-top, 12px);
1499
+ left: var(--cpk-drawer-launcher-left, 12px);
1500
+ display: inline-flex;
1501
+ align-items: center;
1502
+ justify-content: center;
1503
+ width: 40px;
1504
+ height: 40px;
1505
+ border-radius: 999px;
1506
+ border: 1px solid var(--_border);
1507
+ background: var(--_surface);
1508
+ color: var(--_surface-fg);
1509
+ cursor: pointer;
1510
+ box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
1511
+ }
1512
+
1513
+ .launcher-icon {
1514
+ width: 18px;
1515
+ height: 18px;
1516
+ display: block;
1517
+ }
1518
+
1519
+ .header {
1520
+ display: flex;
1521
+ align-items: center;
1522
+ justify-content: space-between;
1523
+ gap: 8px;
1524
+ padding: 12px;
1525
+ border-bottom: 1px solid var(--_border);
1526
+ }
1527
+
1528
+ .filters {
1529
+ display: flex;
1530
+ gap: 4px;
1531
+ padding: 8px 12px;
1532
+ }
1533
+
1534
+ .filter-btn {
1535
+ flex: 1;
1536
+ padding: 6px 10px;
1537
+ border: 1px solid var(--_border);
1538
+ border-radius: var(--_radius);
1539
+ background: var(--_bg);
1540
+ color: var(--_muted-fg);
1541
+ cursor: pointer;
1542
+ font: inherit;
1543
+ }
1544
+
1545
+ .filter-btn[aria-pressed="true"] {
1546
+ background: var(--_accent);
1547
+ color: var(--_accent-fg);
1548
+ border-color: var(--_ring);
1549
+ }
1550
+
1551
+ .list {
1552
+ flex: 1;
1553
+ min-height: 0;
1554
+ overflow-y: auto;
1555
+ padding: 8px 12px;
1556
+ margin: 0;
1557
+ list-style: none;
1558
+ display: flex;
1559
+ flex-direction: column;
1560
+ gap: 4px;
1561
+ }
1562
+
1563
+ .row {
1564
+ display: flex;
1565
+ align-items: center;
1566
+ gap: 8px;
1567
+ padding: 8px 10px;
1568
+ border-radius: var(--_radius);
1569
+ cursor: pointer;
1570
+ background: transparent;
1571
+ color: inherit;
1572
+ border: 1px solid transparent;
1573
+ opacity: 0;
1574
+ transform: translateY(4px);
1575
+ animation: cpk-drawer-row-in 0.18s ease forwards;
1576
+ /* Positioned so the hovered row can be lifted above later rows (below). */
1577
+ position: relative;
1578
+ }
1579
+
1580
+ /* The entry animation leaves each row with a (non-none) transform, making it
1581
+ its own stacking context — which would paint the name tooltip UNDER the
1582
+ following rows (their text bled through the bubble). Lifting the hovered
1583
+ row's z-index re-floats its tooltip above the rows beneath it. */
1584
+ .row.name-clipped:hover {
1585
+ z-index: 2;
1586
+ }
1587
+
1588
+ @keyframes cpk-drawer-row-in {
1589
+ to {
1590
+ opacity: 1;
1591
+ transform: translateY(0);
1592
+ }
1593
+ }
1594
+
1595
+ .row.active {
1596
+ background: var(--_accent);
1597
+ color: var(--_accent-fg);
1598
+ border-color: var(--_ring);
1599
+ }
1600
+
1601
+ .row.archived .row-name {
1602
+ color: var(--_muted-fg);
1603
+ }
1604
+
1605
+ .row-name {
1606
+ /* The outer name element owns NO overflow clip so it can host the name
1607
+ tooltip pseudo-element; the inner .row-name-text does the ellipsis. */
1608
+ flex: 1;
1609
+ min-width: 0;
1610
+ position: relative;
1611
+ }
1612
+
1613
+ .row-name-text {
1614
+ display: block;
1615
+ overflow: hidden;
1616
+ text-overflow: ellipsis;
1617
+ white-space: nowrap;
1618
+ }
1619
+
1620
+ /* Name tooltip: matches the row-action tooltip (instant primary bubble with
1621
+ an arrow), shown ONLY when the name is clipped. Positioned below the name,
1622
+ wrapping within the drawer width (a long name can't fit one line). */
1623
+ .row-name.name-clipped[data-tooltip]:hover::after {
1624
+ content: attr(data-tooltip);
1625
+ position: absolute;
1626
+ left: 0;
1627
+ top: calc(100% + 6px);
1628
+ white-space: normal;
1629
+ max-width: 240px;
1630
+ background: var(--_primary);
1631
+ color: var(--_primary-fg);
1632
+ border-radius: 6px;
1633
+ padding: 4px 8px;
1634
+ font-size: 12px;
1635
+ line-height: 1.4;
1636
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1637
+ pointer-events: none;
1638
+ z-index: 20;
1639
+ }
1640
+
1641
+ .row-name.name-clipped[data-tooltip]:hover::before {
1642
+ content: "";
1643
+ position: absolute;
1644
+ left: 10px;
1645
+ top: calc(100% + 1.5px);
1646
+ transform: rotate(45deg);
1647
+ width: 7px;
1648
+ height: 7px;
1649
+ background: var(--_primary);
1650
+ border-radius: 1px;
1651
+ pointer-events: none;
1652
+ z-index: 21;
1653
+ }
1654
+
1655
+ .row-name.placeholder {
1656
+ color: var(--_muted-fg);
1657
+ font-style: italic;
1658
+ }
1659
+
1660
+ .row-name.revealed {
1661
+ animation: cpk-drawer-name-reveal 0.3s ease;
1662
+ }
1663
+
1664
+ @keyframes cpk-drawer-name-reveal {
1665
+ from {
1666
+ opacity: 0.4;
1667
+ }
1668
+ to {
1669
+ opacity: 1;
1670
+ }
1671
+ }
1672
+
1673
+ .row-action {
1674
+ position: relative;
1675
+ display: inline-flex;
1676
+ align-items: center;
1677
+ justify-content: center;
1678
+ flex: none;
1679
+ border: 0;
1680
+ background: transparent;
1681
+ color: var(--_muted-fg);
1682
+ cursor: pointer;
1683
+ font: inherit;
1684
+ padding: 5px;
1685
+ border-radius: 6px;
1686
+ }
1687
+
1688
+ /* Instant tooltip (matches the react components' delayDuration:0) styled to
1689
+ match the CPK standard tooltip: a solid primary-colored bubble with
1690
+ primary-foreground text, rounded corners, no border, and a small arrow —
1691
+ NOT a surface/bordered box (which reads as a button). Rendered to the LEFT
1692
+ of the action so the list's vertical overflow never clips it; the native
1693
+ \`title\` tooltip is avoided because its show-delay is browser-fixed (~1.5s)
1694
+ and cannot be tuned. */
1695
+ .row-action[data-tooltip]:hover::after,
1696
+ .row-action[data-tooltip]:focus-visible::after {
1697
+ content: attr(data-tooltip);
1698
+ position: absolute;
1699
+ right: calc(100% + 8px);
1700
+ top: 50%;
1701
+ transform: translateY(-50%);
1702
+ white-space: nowrap;
1703
+ background: var(--_primary);
1704
+ color: var(--_primary-fg);
1705
+ border-radius: 6px;
1706
+ padding: 4px 8px;
1707
+ font-size: 12px;
1708
+ line-height: 1.4;
1709
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1710
+ pointer-events: none;
1711
+ z-index: 20;
1712
+ }
1713
+
1714
+ /* Arrow: a small rotated square at the bubble's right edge, pointing at the
1715
+ action — same primary fill as the bubble. */
1716
+ .row-action[data-tooltip]:hover::before,
1717
+ .row-action[data-tooltip]:focus-visible::before {
1718
+ content: "";
1719
+ position: absolute;
1720
+ right: calc(100% + 4.5px);
1721
+ top: 50%;
1722
+ transform: translateY(-50%) rotate(45deg);
1723
+ width: 7px;
1724
+ height: 7px;
1725
+ background: var(--_primary);
1726
+ border-radius: 1px;
1727
+ pointer-events: none;
1728
+ z-index: 21;
1729
+ }
1730
+
1731
+ /* While the delete-confirmation dialog is open, suppress row-action tooltips:
1732
+ the clicked trash button keeps :focus-visible (and may stay hovered), which
1733
+ would otherwise leave its "Delete" tooltip floating over the dialog. */
1734
+ .root.confirming .row-action[data-tooltip]:hover::after,
1735
+ .root.confirming .row-action[data-tooltip]:focus-visible::after,
1736
+ .root.confirming .row-action[data-tooltip]:hover::before,
1737
+ .root.confirming .row-action[data-tooltip]:focus-visible::before {
1738
+ content: none;
1739
+ display: none;
1740
+ }
1741
+
1742
+ .row-action:hover,
1743
+ .row-action:focus-visible {
1744
+ background: var(--_muted);
1745
+ color: inherit;
1746
+ }
1747
+
1748
+ .row-action.danger:hover,
1749
+ .row-action.danger:focus-visible {
1750
+ color: var(--_danger);
1751
+ }
1752
+
1753
+ .row-action-icon {
1754
+ width: 15px;
1755
+ height: 15px;
1756
+ display: block;
1757
+ }
1758
+
1759
+ button.primary {
1760
+ background: var(--_primary);
1761
+ color: var(--_primary-fg);
1762
+ border: 0;
1763
+ border-radius: var(--_radius);
1764
+ padding: 8px 12px;
1765
+ cursor: pointer;
1766
+ font: inherit;
1767
+ }
1768
+
1769
+ .state {
1770
+ padding: 24px 16px;
1771
+ text-align: center;
1772
+ color: var(--_muted-fg);
1773
+ }
1774
+
1775
+ .state.error {
1776
+ color: var(--_danger);
1777
+ }
1778
+
1779
+ .fetch-more-error {
1780
+ padding: 8px 12px;
1781
+ text-align: center;
1782
+ color: var(--_danger);
1783
+ font-size: 0.9em;
1784
+ }
1785
+
1786
+ .load-more {
1787
+ display: block;
1788
+ width: 100%;
1789
+ padding: 8px 12px;
1790
+ background: none;
1791
+ border: none;
1792
+ color: var(--_muted-fg);
1793
+ font: inherit;
1794
+ font-size: 0.9em;
1795
+ cursor: pointer;
1796
+ }
1797
+
1798
+ .load-more:hover,
1799
+ .load-more:focus-visible {
1800
+ color: var(--_surface-fg);
1801
+ background: var(--_muted);
1802
+ }
1803
+
1804
+ .licensed {
1805
+ padding: 24px 16px;
1806
+ text-align: center;
1807
+ display: flex;
1808
+ flex-direction: column;
1809
+ gap: 12px;
1810
+ }
1811
+
1812
+ .memories {
1813
+ border-top: 1px solid var(--_border);
1814
+ padding: 8px 12px;
1815
+ }
1816
+
1817
+ .memories[hidden] {
1818
+ display: none;
1819
+ }
1820
+
1821
+ .dialog-backdrop {
1822
+ position: absolute;
1823
+ inset: 0;
1824
+ background: rgba(0, 0, 0, 0.3);
1825
+ display: flex;
1826
+ align-items: center;
1827
+ justify-content: center;
1828
+ z-index: 10;
1829
+ }
1830
+
1831
+ .dialog {
1832
+ background: var(--_surface);
1833
+ color: var(--_surface-fg);
1834
+ border-radius: var(--_radius);
1835
+ padding: 16px;
1836
+ max-width: 80%;
1837
+ display: flex;
1838
+ flex-direction: column;
1839
+ gap: 12px;
1840
+ }
1841
+
1842
+ .dialog-actions {
1843
+ display: flex;
1844
+ justify-content: flex-end;
1845
+ gap: 8px;
1846
+ }
1847
+
1848
+ .footer {
1849
+ border-top: 1px solid var(--_border);
1850
+ padding: 12px;
1851
+ }
1852
+
1853
+ .footer[hidden] {
1854
+ display: none;
1855
+ }
1856
+ `;
1857
+
1858
+ //#endregion
1859
+ //#region src/threads-drawer/copilotkit-threads-drawer.ts
1860
+ /** Tag name the element registers under. */
1861
+ const COPILOTKIT_THREADS_DRAWER_TAG = "copilotkit-threads-drawer";
1862
+ /** Mobile breakpoint (px). At or below this width the drawer is a modal overlay. */
1863
+ const MOBILE_BREAKPOINT = 768;
1864
+ /**
1865
+ * Whether an inbound error message should surface an error state. Only a
1866
+ * non-empty, non-whitespace string counts — `null`, `""`, and whitespace-only
1867
+ * strings are treated as "no error" so an empty error never conflates with a
1868
+ * real one (and never blanks the list behind an empty error panel).
1869
+ */
1870
+ function hasErrorMessage(value) {
1871
+ return value !== null && value.trim().length > 0;
1872
+ }
1873
+ /**
1874
+ * Builds the per-row slot name (`row:<id>`) used for consumer projection, but
1875
+ * only when the thread id is safe to embed in a slot `name` / `slot` attribute
1876
+ * token. A slot name is matched character-for-character against the consumer's
1877
+ * `slot="..."` attribute; whitespace splits attribute tokens and quotes/angle
1878
+ * brackets can break attribute serialization, so an id containing any of those
1879
+ * would silently fail projection. For such an id we return `null` and the row
1880
+ * renders its default name span (no per-row slot), which is the safe fallback.
1881
+ */
1882
+ function rowSlotName(id) {
1883
+ if (id.length === 0 || /[\s"'<>=]/.test(id)) return null;
1884
+ return `row:${id}`;
1885
+ }
1886
+ /**
1887
+ * Inline row-action icons. The element is framework-agnostic Lit, so it cannot
1888
+ * depend on a React icon library — these are the lucide `archive`,
1889
+ * `archive-restore`, and `trash-2` glyphs inlined as SVG, drawn with
1890
+ * `currentColor` so they inherit the button's themed color.
1891
+ */
1892
+ const iconArchive = T$1`
1893
+ <svg
1894
+ class="row-action-icon"
1895
+ viewBox="0 0 24 24"
1896
+ fill="none"
1897
+ stroke="currentColor"
1898
+ stroke-width="2"
1899
+ stroke-linecap="round"
1900
+ stroke-linejoin="round"
1901
+ aria-hidden="true"
1902
+ >
1903
+ <rect width="20" height="5" x="2" y="3" rx="1" />
1904
+ <path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" />
1905
+ <path d="M10 12h4" />
1906
+ </svg>
1907
+ `;
1908
+ const iconUnarchive = T$1`
1909
+ <svg
1910
+ class="row-action-icon"
1911
+ viewBox="0 0 24 24"
1912
+ fill="none"
1913
+ stroke="currentColor"
1914
+ stroke-width="2"
1915
+ stroke-linecap="round"
1916
+ stroke-linejoin="round"
1917
+ aria-hidden="true"
1918
+ >
1919
+ <rect width="20" height="5" x="2" y="3" rx="1" />
1920
+ <path d="M4 8v11a2 2 0 0 0 2 2h2" />
1921
+ <path d="M20 8v11a2 2 0 0 1-2 2h-2" />
1922
+ <path d="m9 15 3-3 3 3" />
1923
+ <path d="M12 12v9" />
1924
+ </svg>
1925
+ `;
1926
+ const iconDelete = T$1`
1927
+ <svg
1928
+ class="row-action-icon"
1929
+ viewBox="0 0 24 24"
1930
+ fill="none"
1931
+ stroke="currentColor"
1932
+ stroke-width="2"
1933
+ stroke-linecap="round"
1934
+ stroke-linejoin="round"
1935
+ aria-hidden="true"
1936
+ >
1937
+ <path d="M3 6h18" />
1938
+ <path
1939
+ d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
1940
+ />
1941
+ <line x1="10" x2="10" y1="11" y2="17" />
1942
+ <line x1="14" x2="14" y1="11" y2="17" />
1943
+ </svg>
1944
+ `;
1945
+ const iconLauncher = T$1`
1946
+ <svg
1947
+ class="launcher-icon"
1948
+ viewBox="0 0 24 24"
1949
+ fill="none"
1950
+ stroke="currentColor"
1951
+ stroke-width="2"
1952
+ stroke-linecap="round"
1953
+ stroke-linejoin="round"
1954
+ aria-hidden="true"
1955
+ >
1956
+ <rect width="18" height="18" x="3" y="3" rx="2" />
1957
+ <path d="M9 3v18" />
1958
+ <path d="m14 9 3 3-3 3" />
1959
+ </svg>
1960
+ `;
1961
+ /**
1962
+ * `<copilotkit-threads-drawer>` — a public, self-contained, controlled, framework-agnostic
1963
+ * threads drawer rendered into a shadow root.
1964
+ *
1965
+ * Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and
1966
+ * user intent goes OUT as bubbling+composed DOM `CustomEvent`s. The element owns
1967
+ * VIEW state (open/collapsed, Active/All filter, confirm-delete dialog, per-row
1968
+ * animations) while the consumer owns DOMAIN state. `open` is additionally
1969
+ * externally controllable via the `open` property + `open-change` event so a
1970
+ * host can coordinate mobile open/close.
1971
+ *
1972
+ * The element is AUTHORITATIVE over row order and the Active/All filter.
1973
+ */
1974
+ var CopilotKitThreadsDrawer = class extends i$2 {
1975
+ constructor(..._args) {
1976
+ super(..._args);
1977
+ this.label = "Threads";
1978
+ this.threads = [];
1979
+ this.loading = false;
1980
+ this.error = null;
1981
+ this.activeThreadId = null;
1982
+ this.licensed = true;
1983
+ this.licenseUrl = "https://docs.copilotkit.ai/intelligence";
1984
+ this.hasMore = false;
1985
+ this.fetchingMore = false;
1986
+ this.fetchMoreError = null;
1987
+ this.open = true;
1988
+ this.collapsed = false;
1989
+ this._filter = "active";
1990
+ this._confirmingDeleteId = null;
1991
+ this._viewportIsMobile = false;
1992
+ this._hasMemories = false;
1993
+ this._hasFooter = false;
1994
+ this._mediaQuery = null;
1995
+ this._onMediaChange = (event) => {
1996
+ this._viewportIsMobile = event.matches;
1997
+ };
1998
+ this._onKeyDown = (event) => {
1999
+ if (event.key === "Escape") {
2000
+ if (this._confirmingDeleteId !== null) {
2001
+ this._confirmingDeleteId = null;
2002
+ event.stopPropagation();
2003
+ return;
2004
+ }
2005
+ if (this._viewportIsMobile && this.open) {
2006
+ this._setOpen(false);
2007
+ event.stopPropagation();
2008
+ }
2009
+ return;
2010
+ }
2011
+ if (event.key === "Tab") this._trapTab(event);
2012
+ };
2013
+ this._seenNamed = /* @__PURE__ */ new Set();
2014
+ this._justRevealed = /* @__PURE__ */ new Set();
2015
+ this._scrollLocked = false;
2016
+ this._prevBodyOverflow = "";
2017
+ this._trapTab = (event) => {
2018
+ var _activeElement;
2019
+ if (event.key !== "Tab" || !this._isMobileModalOpen()) return;
2020
+ const focusable = this._composedFocusable();
2021
+ if (focusable.length === 0) return;
2022
+ const first = focusable[0];
2023
+ const last = focusable[focusable.length - 1];
2024
+ const active = (_activeElement = this.renderRoot.activeElement) !== null && _activeElement !== void 0 ? _activeElement : document.activeElement;
2025
+ if (event.shiftKey && active === first) {
2026
+ last.focus();
2027
+ event.preventDefault();
2028
+ } else if (!event.shiftKey && active === last) {
2029
+ first.focus();
2030
+ event.preventDefault();
2031
+ }
2032
+ };
2033
+ }
2034
+ connectedCallback() {
2035
+ super.connectedCallback();
2036
+ if (typeof window !== "undefined" && window.matchMedia) {
2037
+ this._mediaQuery = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT}px)`);
2038
+ this._viewportIsMobile = this._mediaQuery.matches;
2039
+ this._mediaQuery.addEventListener("change", this._onMediaChange);
2040
+ }
2041
+ this.addEventListener("keydown", this._onKeyDown);
2042
+ }
2043
+ disconnectedCallback() {
2044
+ var _this$_mediaQuery;
2045
+ super.disconnectedCallback();
2046
+ (_this$_mediaQuery = this._mediaQuery) === null || _this$_mediaQuery === void 0 || _this$_mediaQuery.removeEventListener("change", this._onMediaChange);
2047
+ this.removeEventListener("keydown", this._onKeyDown);
2048
+ this._releaseScrollLock();
2049
+ }
2050
+ willUpdate(changed) {
2051
+ if (changed.has("threads")) {
2052
+ const presentIds = /* @__PURE__ */ new Set();
2053
+ const revealed = /* @__PURE__ */ new Set();
2054
+ for (const thread of this.threads) {
2055
+ presentIds.add(thread.id);
2056
+ const hasName = thread.name !== null && thread.name !== "";
2057
+ if (hasName && !this._seenNamed.has(thread.id)) revealed.add(thread.id);
2058
+ if (hasName) this._seenNamed.add(thread.id);
2059
+ }
2060
+ for (const id of this._seenNamed) if (!presentIds.has(id)) this._seenNamed.delete(id);
2061
+ this._justRevealed = revealed;
2062
+ if (this._confirmingDeleteId !== null) {
2063
+ if (!this._visibleThreads().some((t) => t.id === this._confirmingDeleteId)) this._confirmingDeleteId = null;
2064
+ }
2065
+ }
2066
+ }
2067
+ updated(changed) {
2068
+ if (changed.has("open") || changed.has("_viewportIsMobile")) if (this._isMobileModalOpen()) {
2069
+ this._applyScrollLock();
2070
+ this._focusFirstFocusable();
2071
+ } else this._releaseScrollLock();
2072
+ if (this._justRevealed.size > 0) this._justRevealed = /* @__PURE__ */ new Set();
2073
+ this._syncNameClipping();
2074
+ }
2075
+ /**
2076
+ * Marks each row whose name text is truncated with `name-clipped`, so the CSS
2077
+ * shows the name tooltip ONLY when the full name isn't already visible (an
2078
+ * always-on bubble over every row on hover would be noise). Measured after
2079
+ * render because truncation depends on the laid-out width.
2080
+ */
2081
+ _syncNameClipping() {
2082
+ this.renderRoot.querySelectorAll(".row-name").forEach((name) => {
2083
+ var _name$closest;
2084
+ const text = name.querySelector(".row-name-text");
2085
+ const clipped = !!text && text.scrollWidth > text.clientWidth;
2086
+ name.classList.toggle("name-clipped", clipped);
2087
+ (_name$closest = name.closest(".row")) === null || _name$closest === void 0 || _name$closest.classList.toggle("name-clipped", clipped);
2088
+ });
2089
+ }
2090
+ _isMobileModalOpen() {
2091
+ return this._viewportIsMobile && this.open;
2092
+ }
2093
+ _setOpen(next) {
2094
+ if (this.open === next) return;
2095
+ this.open = next;
2096
+ this._emit("open-change", { open: next });
2097
+ }
2098
+ _setFilter(next) {
2099
+ if (this._filter === next) return;
2100
+ this._filter = next;
2101
+ this._emit("filter-change", { filter: next });
2102
+ }
2103
+ /**
2104
+ * Element-authoritative ordering + filtering. Active filter hides archived
2105
+ * threads; ordering is most-recent-first by `lastRunAt`/`updatedAt`.
2106
+ */
2107
+ _visibleThreads() {
2108
+ const filtered = this._filter === "active" ? this.threads.filter((t) => !t.archived) : this.threads;
2109
+ const ts = (t) => {
2110
+ var _ref, _t$lastRunAt;
2111
+ const raw = (_ref = (_t$lastRunAt = t.lastRunAt) !== null && _t$lastRunAt !== void 0 ? _t$lastRunAt : t.updatedAt) !== null && _ref !== void 0 ? _ref : t.createdAt;
2112
+ const parsed = Date.parse(raw);
2113
+ return Number.isNaN(parsed) ? null : parsed;
2114
+ };
2115
+ return [...filtered].map((thread, index) => ({
2116
+ thread,
2117
+ index,
2118
+ ts: ts(thread)
2119
+ })).sort((a, b) => {
2120
+ if (a.ts === null && b.ts === null) return a.index - b.index;
2121
+ if (a.ts === null) return 1;
2122
+ if (b.ts === null) return -1;
2123
+ if (a.ts !== b.ts) return b.ts - a.ts;
2124
+ return a.index - b.index;
2125
+ }).map((entry) => entry.thread);
2126
+ }
2127
+ _emit(type, detail) {
2128
+ this.dispatchEvent(new CustomEvent(type, {
2129
+ detail,
2130
+ bubbles: true,
2131
+ composed: true
2132
+ }));
2133
+ }
2134
+ _applyScrollLock() {
2135
+ if (this._scrollLocked || typeof document === "undefined") return;
2136
+ this._prevBodyOverflow = document.body.style.overflow;
2137
+ document.body.style.overflow = "hidden";
2138
+ this._scrollLocked = true;
2139
+ }
2140
+ _releaseScrollLock() {
2141
+ if (!this._scrollLocked || typeof document === "undefined") return;
2142
+ document.body.style.overflow = this._prevBodyOverflow;
2143
+ this._scrollLocked = false;
2144
+ }
2145
+ /**
2146
+ * Returns the focusable elements in the composed/flattened tree of the drawer
2147
+ * root, INCLUDING slotted light-DOM content (so a focus trap covers slotted
2148
+ * rows). Walks assigned nodes of each `<slot>`.
2149
+ */
2150
+ _composedFocusable() {
2151
+ const selector = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
2152
+ const out = [];
2153
+ const backdrop = this.renderRoot.querySelector(".backdrop");
2154
+ if (backdrop) out.push(backdrop);
2155
+ const root = this.renderRoot.querySelector(".root");
2156
+ if (!root) return out;
2157
+ const collect = (node) => {
2158
+ node.querySelectorAll(selector).forEach((el) => out.push(el));
2159
+ };
2160
+ collect(root);
2161
+ root.querySelectorAll("slot").forEach((slot) => {
2162
+ slot.assignedElements({ flatten: true }).forEach((assigned) => {
2163
+ if (assigned.matches(selector)) out.push(assigned);
2164
+ collect(assigned);
2165
+ });
2166
+ });
2167
+ return out;
2168
+ }
2169
+ _focusFirstFocusable() {
2170
+ queueMicrotask(() => {
2171
+ var _focusable$find;
2172
+ const focusable = this._composedFocusable();
2173
+ const backdrop = this.renderRoot.querySelector(".backdrop");
2174
+ const target = (_focusable$find = focusable.find((el) => el !== backdrop)) !== null && _focusable$find !== void 0 ? _focusable$find : focusable[0];
2175
+ target === null || target === void 0 || target.focus();
2176
+ });
2177
+ }
2178
+ render() {
2179
+ const rootClasses = {
2180
+ root: true,
2181
+ collapsed: this.collapsed && !this._viewportIsMobile,
2182
+ mobile: this._viewportIsMobile,
2183
+ open: this.open,
2184
+ confirming: this._confirmingDeleteId !== null
2185
+ };
2186
+ return T$1`
2187
+ ${this._viewportIsMobile && !this.open ? T$1`<button
2188
+ class="launcher"
2189
+ part="launcher"
2190
+ aria-label="Open threads"
2191
+ @click=${() => this._setOpen(true)}
2192
+ >
2193
+ <slot name="launcher-icon">${iconLauncher}</slot>
2194
+ </button>` : A}
2195
+ ${this._isMobileModalOpen() ? T$1`<button
2196
+ class="backdrop"
2197
+ part="backdrop"
2198
+ aria-label="Close threads drawer"
2199
+ @click=${() => this._setOpen(false)}
2200
+ ></button>` : A}
2201
+ <div
2202
+ class=${e(rootClasses)}
2203
+ part="root"
2204
+ role=${this._isMobileModalOpen() ? "dialog" : "region"}
2205
+ aria-modal=${this._isMobileModalOpen() ? "true" : A}
2206
+ aria-label=${this.label}
2207
+ >
2208
+ ${this._renderHeader()} ${this._renderBody()} ${this._renderMemories()}
2209
+ ${this._renderFooter()} ${this._renderConfirmDialog()}
2210
+ </div>
2211
+ `;
2212
+ }
2213
+ _renderHeader() {
2214
+ return T$1`
2215
+ <div class="header" part="header">
2216
+ <slot name="header"><span>${this.label}</span></slot>
2217
+ <button
2218
+ class="primary"
2219
+ part="new-thread-button"
2220
+ aria-label="New thread"
2221
+ @click=${() => this._emit("new-thread", {})}
2222
+ >
2223
+ + New
2224
+ </button>
2225
+ </div>
2226
+ ${this.licensed && (!hasErrorMessage(this.error) || this.threads.length > 0) ? T$1`
2227
+ <div class="filters" part="filters" role="group" aria-label="Filter threads">
2228
+ <button
2229
+ class="filter-btn"
2230
+ part="filter-active"
2231
+ aria-pressed=${this._filter === "active"}
2232
+ @click=${() => this._setFilter("active")}
2233
+ >
2234
+ Active
2235
+ </button>
2236
+ <button
2237
+ class="filter-btn"
2238
+ part="filter-all"
2239
+ aria-pressed=${this._filter === "all"}
2240
+ @click=${() => this._setFilter("all")}
2241
+ >
2242
+ All
2243
+ </button>
2244
+ </div>
2245
+ ` : A}
2246
+ `;
2247
+ }
2248
+ _renderBody() {
2249
+ if (!this.licensed) return this._renderLicensed();
2250
+ if (hasErrorMessage(this.error) && this.threads.length === 0) return this._renderError();
2251
+ if (this.loading && this.threads.length === 0) return this._renderLoading();
2252
+ return this._renderList();
2253
+ }
2254
+ /**
2255
+ * Handles the Upgrade CTA click in the locked view. Dispatches a cancelable
2256
+ * `licensed` event carrying the resolved `licenseUrl`; unless a host calls
2257
+ * `preventDefault()`, opens that URL in a new tab. A blank `licenseUrl`
2258
+ * suppresses navigation so the event alone drives host behavior.
2259
+ */
2260
+ _onLicensedCta() {
2261
+ if (this.dispatchEvent(new CustomEvent("licensed", {
2262
+ detail: { licenseUrl: this.licenseUrl },
2263
+ bubbles: true,
2264
+ composed: true,
2265
+ cancelable: true
2266
+ })) && this.licenseUrl && typeof window !== "undefined") window.open(this.licenseUrl, "_blank", "noopener,noreferrer");
2267
+ }
2268
+ _renderLicensed() {
2269
+ return T$1`
2270
+ <div class="licensed" part="licensed" data-testid="drawer-licensed">
2271
+ <slot name="licensed">
2272
+ <p>Threads are a CopilotKit Intelligence feature.</p>
2273
+ <button
2274
+ class="primary"
2275
+ part="licensed-cta"
2276
+ @click=${() => this._onLicensedCta()}
2277
+ >
2278
+ Upgrade
2279
+ </button>
2280
+ </slot>
2281
+ </div>
2282
+ `;
2283
+ }
2284
+ _renderError() {
2285
+ return T$1`
2286
+ <div class="state error" part="error" role="alert" data-testid="drawer-error">
2287
+ <p>${this.error}</p>
2288
+ <button
2289
+ class="primary"
2290
+ part="retry-button"
2291
+ @click=${() => this._emit("retry", { scope: "initial" })}
2292
+ >
2293
+ Retry
2294
+ </button>
2295
+ </div>
2296
+ `;
2297
+ }
2298
+ _renderLoading() {
2299
+ return T$1`
2300
+ <div class="state" part="loading" data-testid="drawer-loading" aria-busy="true">
2301
+ Loading threads…
2302
+ </div>
2303
+ `;
2304
+ }
2305
+ _renderList() {
2306
+ const visible = this._visibleThreads();
2307
+ if (visible.length === 0) return T$1`
2308
+ <div class="state" part="empty" data-testid="drawer-empty">
2309
+ <slot name="empty">No threads yet.</slot>
2310
+ </div>
2311
+ `;
2312
+ return T$1`
2313
+ <ul class="list" part="list" role="listbox" aria-label=${this.label}>
2314
+ ${c(visible, (thread) => thread.id, (thread) => this._renderRow(thread))}
2315
+ </ul>
2316
+ ${this._renderFetchMore()}
2317
+ `;
2318
+ }
2319
+ _renderRow(thread) {
2320
+ var _thread$name, _thread$name2, _thread$name3;
2321
+ const isActive = thread.id === this.activeThreadId;
2322
+ const hasName = thread.name !== null && thread.name !== "";
2323
+ const justRevealed = this._justRevealed.has(thread.id);
2324
+ const rowClasses = {
2325
+ row: true,
2326
+ active: isActive,
2327
+ archived: thread.archived
2328
+ };
2329
+ const nameClasses = {
2330
+ "row-name": true,
2331
+ placeholder: !hasName,
2332
+ revealed: justRevealed
2333
+ };
2334
+ const slotName = rowSlotName(thread.id);
2335
+ const nameSpan = T$1`<span
2336
+ class=${e(nameClasses)}
2337
+ part="row-name"
2338
+ data-tooltip=${hasName ? thread.name : A}
2339
+ >
2340
+ <span class="row-name-text"
2341
+ >${hasName ? thread.name : "New thread"}</span
2342
+ >
2343
+ </span>`;
2344
+ return T$1`
2345
+ <li
2346
+ class=${e(rowClasses)}
2347
+ part=${isActive ? "row row-active" : "row"}
2348
+ role="option"
2349
+ aria-selected=${isActive ? "true" : "false"}
2350
+ tabindex="0"
2351
+ data-thread-id=${thread.id}
2352
+ @click=${() => this._emit("thread-selected", { threadId: thread.id })}
2353
+ @keydown=${(e) => {
2354
+ if (e.key === "Enter" || e.key === " ") {
2355
+ e.preventDefault();
2356
+ this._emit("thread-selected", { threadId: thread.id });
2357
+ }
2358
+ }}
2359
+ >
2360
+ ${slotName !== null ? T$1`<slot name=${slotName}>${nameSpan}</slot>` : nameSpan}
2361
+ ${thread.archived ? T$1`<button
2362
+ class="row-action"
2363
+ part="row-unarchive"
2364
+ data-tooltip="Unarchive"
2365
+ aria-label=${`Unarchive thread ${(_thread$name = thread.name) !== null && _thread$name !== void 0 ? _thread$name : "New thread"}`}
2366
+ @click=${(e) => {
2367
+ e.stopPropagation();
2368
+ this._emit("unarchive", { threadId: thread.id });
2369
+ }}
2370
+ >
2371
+ ${iconUnarchive}
2372
+ </button>` : T$1`<button
2373
+ class="row-action"
2374
+ part="row-archive"
2375
+ data-tooltip="Archive"
2376
+ aria-label=${`Archive thread ${(_thread$name2 = thread.name) !== null && _thread$name2 !== void 0 ? _thread$name2 : "New thread"}`}
2377
+ @click=${(e) => {
2378
+ e.stopPropagation();
2379
+ this._emit("archive", { threadId: thread.id });
2380
+ }}
2381
+ >
2382
+ ${iconArchive}
2383
+ </button>`}
2384
+ <button
2385
+ class="row-action danger"
2386
+ part="row-delete"
2387
+ data-tooltip="Delete"
2388
+ aria-label=${`Delete thread ${(_thread$name3 = thread.name) !== null && _thread$name3 !== void 0 ? _thread$name3 : "New thread"}`}
2389
+ @click=${(e) => {
2390
+ e.stopPropagation();
2391
+ this._confirmingDeleteId = thread.id;
2392
+ }}
2393
+ >
2394
+ ${iconDelete}
2395
+ </button>
2396
+ </li>
2397
+ `;
2398
+ }
2399
+ _renderFetchMore() {
2400
+ if (hasErrorMessage(this.fetchMoreError)) return T$1`
2401
+ <div class="fetch-more-error" part="fetch-more-error" role="alert">
2402
+ Couldn't load more —
2403
+ <button
2404
+ class="row-action"
2405
+ part="fetch-more-retry"
2406
+ @click=${() => this._emit("retry", { scope: "fetch-more" })}
2407
+ >
2408
+ retry
2409
+ </button>
2410
+ </div>
2411
+ `;
2412
+ if (this.fetchingMore) return T$1`
2413
+ <div class="state" part="fetching-more" aria-busy="true">Loading more…</div>
2414
+ `;
2415
+ if (this.hasMore) return T$1`
2416
+ <button
2417
+ class="load-more"
2418
+ part="load-more"
2419
+ @click=${() => this._emit("load-more", {})}
2420
+ >
2421
+ Load more
2422
+ </button>
2423
+ `;
2424
+ return A;
2425
+ }
2426
+ _renderMemories() {
2427
+ return T$1`
2428
+ <div class="memories" part="memories" ?hidden=${!this._hasMemories}>
2429
+ <slot
2430
+ name="memories"
2431
+ @slotchange=${(e) => {
2432
+ this._hasMemories = e.target.assignedElements().length > 0;
2433
+ }}
2434
+ ></slot>
2435
+ </div>
2436
+ `;
2437
+ }
2438
+ _renderFooter() {
2439
+ return T$1`
2440
+ <div class="footer" part="footer" ?hidden=${!this._hasFooter}>
2441
+ <slot
2442
+ name="footer"
2443
+ @slotchange=${(e) => {
2444
+ this._hasFooter = e.target.assignedElements().length > 0;
2445
+ }}
2446
+ ></slot>
2447
+ </div>
2448
+ `;
2449
+ }
2450
+ _renderConfirmDialog() {
2451
+ if (this._confirmingDeleteId === null) return A;
2452
+ const id = this._confirmingDeleteId;
2453
+ return T$1`
2454
+ <div class="dialog-backdrop" part="dialog-backdrop">
2455
+ <div
2456
+ class="dialog"
2457
+ part="confirm-dialog"
2458
+ role="alertdialog"
2459
+ aria-modal="true"
2460
+ aria-label="Confirm delete"
2461
+ data-testid="drawer-confirm-delete"
2462
+ >
2463
+ <p>Delete this thread? This cannot be undone.</p>
2464
+ <div class="dialog-actions">
2465
+ <button
2466
+ class="row-action"
2467
+ part="confirm-cancel"
2468
+ @click=${() => this._confirmingDeleteId = null}
2469
+ >
2470
+ Cancel
2471
+ </button>
2472
+ <button
2473
+ class="primary"
2474
+ part="confirm-delete"
2475
+ @click=${() => {
2476
+ this._confirmingDeleteId = null;
2477
+ this._emit("delete", { threadId: id });
2478
+ }}
2479
+ >
2480
+ Delete
2481
+ </button>
2482
+ </div>
2483
+ </div>
2484
+ </div>
2485
+ `;
2486
+ }
2487
+ };
2488
+ CopilotKitThreadsDrawer.styles = drawerStyles;
2489
+ CopilotKitThreadsDrawer.properties = {
2490
+ threads: { attribute: false },
2491
+ loading: { type: Boolean },
2492
+ error: { type: String },
2493
+ activeThreadId: {
2494
+ attribute: "active-thread-id",
2495
+ type: String
2496
+ },
2497
+ licensed: { type: Boolean },
2498
+ licenseUrl: {
2499
+ attribute: "license-url",
2500
+ type: String
2501
+ },
2502
+ hasMore: {
2503
+ attribute: "has-more",
2504
+ type: Boolean
2505
+ },
2506
+ fetchingMore: {
2507
+ attribute: "fetching-more",
2508
+ type: Boolean
2509
+ },
2510
+ fetchMoreError: {
2511
+ attribute: "fetch-more-error",
2512
+ type: String
2513
+ },
2514
+ label: { type: String },
2515
+ open: {
2516
+ type: Boolean,
2517
+ reflect: true
2518
+ },
2519
+ collapsed: {
2520
+ type: Boolean,
2521
+ reflect: true
2522
+ },
2523
+ _filter: { state: true },
2524
+ _confirmingDeleteId: { state: true },
2525
+ _viewportIsMobile: { state: true },
2526
+ _hasMemories: { state: true },
2527
+ _hasFooter: { state: true }
2528
+ };
2529
+
2530
+ //#endregion
2531
+ //#region src/threads-drawer/define.ts
2532
+ /**
2533
+ * Registers the `<copilotkit-threads-drawer>` custom element. Idempotent — safe to call
2534
+ * multiple times (e.g. from several framework wrappers in the same page); a
2535
+ * second registration of the same tag is a no-op.
2536
+ */
2537
+ function defineCopilotKitThreadsDrawer() {
2538
+ if (typeof customElements !== "undefined" && !customElements.get(COPILOTKIT_THREADS_DRAWER_TAG)) customElements.define(COPILOTKIT_THREADS_DRAWER_TAG, CopilotKitThreadsDrawer);
2539
+ }
2540
+
2541
+ //#endregion
2542
+ exports.COPILOTKIT_THREADS_DRAWER_TAG = COPILOTKIT_THREADS_DRAWER_TAG;
2543
+ exports.CopilotKitThreadsDrawer = CopilotKitThreadsDrawer;
2544
+ exports.GENERATED_DRAWER_TOKEN_DEFAULTS = GENERATED_DRAWER_TOKEN_DEFAULTS;
2545
+ exports.defineCopilotKitThreadsDrawer = defineCopilotKitThreadsDrawer;
2546
+ exports.drawerStyles = drawerStyles;
2547
+ });
2548
+ //# sourceMappingURL=index.umd.js.map