@appcues/web-sdk 7.13.3 → 7.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3077 @@
1
+ import { c as wt, g as gi, o as vi, a as _i, n as Se, b as bi } from "./index.Ce_rhcOH.js";
2
+ const yi = !1, xt = window, pe = xt.ShadowRoot && (xt.ShadyCSS === void 0 || xt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, me = /* @__PURE__ */ Symbol(), Ae = /* @__PURE__ */ new WeakMap();
3
+ class Ye {
4
+ constructor(t, i, s) {
5
+ if (this._$cssResult$ = !0, s !== me)
6
+ throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
7
+ this.cssText = t, this._strings = i;
8
+ }
9
+ // This is a getter so that it's lazy. In practice, this means stylesheets
10
+ // are not created until the first element instance is made.
11
+ get styleSheet() {
12
+ let t = this._styleSheet;
13
+ const i = this._strings;
14
+ if (pe && t === void 0) {
15
+ const s = i !== void 0 && i.length === 1;
16
+ s && (t = Ae.get(i)), t === void 0 && ((this._styleSheet = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Ae.set(i, t));
17
+ }
18
+ return t;
19
+ }
20
+ toString() {
21
+ return this.cssText;
22
+ }
23
+ }
24
+ const $i = (e) => {
25
+ if (e._$cssResult$ === !0)
26
+ return e.cssText;
27
+ if (typeof e == "number")
28
+ return e;
29
+ throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`);
30
+ }, wi = (e) => new Ye(typeof e == "string" ? e : String(e), void 0, me), y = (e, ...t) => {
31
+ const i = e.length === 1 ? e[0] : t.reduce((s, r, n) => s + $i(r) + e[n + 1], e[0]);
32
+ return new Ye(i, e, me);
33
+ }, xi = (e, t) => {
34
+ pe ? e.adoptedStyleSheets = t.map((i) => i instanceof CSSStyleSheet ? i : i.styleSheet) : t.forEach((i) => {
35
+ const s = document.createElement("style"), r = xt.litNonce;
36
+ r !== void 0 && s.setAttribute("nonce", r), s.textContent = i.cssText, e.appendChild(s);
37
+ });
38
+ }, Ci = (e) => {
39
+ let t = "";
40
+ for (const i of e.cssRules)
41
+ t += i.cssText;
42
+ return wi(t);
43
+ }, Te = pe || yi ? (e) => e : (e) => e instanceof CSSStyleSheet ? Ci(e) : e;
44
+ var jt, Bt, Wt, Ke;
45
+ const P = window;
46
+ let Qe, L;
47
+ const Ee = P.trustedTypes, ki = Ee ? Ee.emptyScript : "", Ct = P.reactiveElementPolyfillSupportDevMode;
48
+ {
49
+ const e = (jt = P.litIssuedWarnings) !== null && jt !== void 0 ? jt : P.litIssuedWarnings = /* @__PURE__ */ new Set();
50
+ L = (t, i) => {
51
+ i += ` See https://lit.dev/msg/${t} for more information.`, e.has(i) || e.add(i);
52
+ }, L("dev-mode", "Lit is in dev mode. Not recommended for production!"), !((Bt = P.ShadyDOM) === null || Bt === void 0) && Bt.inUse && Ct === void 0 && L("polyfill-support-missing", "Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded."), Qe = (t) => ({
53
+ then: (i, s) => {
54
+ L("request-update-promise", `The \`requestUpdate\` method should no longer return a Promise but does so on \`${t}\`. Use \`updateComplete\` instead.`), i !== void 0 && i(!1);
55
+ }
56
+ });
57
+ }
58
+ const qt = (e) => {
59
+ P.emitLitDebugLogEvents && P.dispatchEvent(new CustomEvent("lit-debug", {
60
+ detail: e
61
+ }));
62
+ }, Je = (e, t) => e, le = {
63
+ toAttribute(e, t) {
64
+ switch (t) {
65
+ case Boolean:
66
+ e = e ? ki : null;
67
+ break;
68
+ case Object:
69
+ case Array:
70
+ e = e == null ? e : JSON.stringify(e);
71
+ break;
72
+ }
73
+ return e;
74
+ },
75
+ fromAttribute(e, t) {
76
+ let i = e;
77
+ switch (t) {
78
+ case Boolean:
79
+ i = e !== null;
80
+ break;
81
+ case Number:
82
+ i = e === null ? null : Number(e);
83
+ break;
84
+ case Object:
85
+ case Array:
86
+ try {
87
+ i = JSON.parse(e);
88
+ } catch {
89
+ i = null;
90
+ }
91
+ break;
92
+ }
93
+ return i;
94
+ }
95
+ }, fe = (e, t) => t !== e && (t === t || e === e), Ft = {
96
+ attribute: !0,
97
+ type: String,
98
+ converter: le,
99
+ reflect: !1,
100
+ hasChanged: fe
101
+ }, de = "finalized";
102
+ class N extends HTMLElement {
103
+ constructor() {
104
+ super(), this.__instanceProperties = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this.__reflectingProperty = null, this.__initialize();
105
+ }
106
+ /**
107
+ * Adds an initializer function to the class that is called during instance
108
+ * construction.
109
+ *
110
+ * This is useful for code that runs against a `ReactiveElement`
111
+ * subclass, such as a decorator, that needs to do work for each
112
+ * instance, such as setting up a `ReactiveController`.
113
+ *
114
+ * ```ts
115
+ * const myDecorator = (target: typeof ReactiveElement, key: string) => {
116
+ * target.addInitializer((instance: ReactiveElement) => {
117
+ * // This is run during construction of the element
118
+ * new MyController(instance);
119
+ * });
120
+ * }
121
+ * ```
122
+ *
123
+ * Decorating a field will then cause each instance to run an initializer
124
+ * that adds a controller:
125
+ *
126
+ * ```ts
127
+ * class MyElement extends LitElement {
128
+ * @myDecorator foo;
129
+ * }
130
+ * ```
131
+ *
132
+ * Initializers are stored per-constructor. Adding an initializer to a
133
+ * subclass does not add it to a superclass. Since initializers are run in
134
+ * constructors, initializers will run in order of the class hierarchy,
135
+ * starting with superclasses and progressing to the instance's class.
136
+ *
137
+ * @nocollapse
138
+ */
139
+ static addInitializer(t) {
140
+ var i;
141
+ this.finalize(), ((i = this._initializers) !== null && i !== void 0 ? i : this._initializers = []).push(t);
142
+ }
143
+ /**
144
+ * Returns a list of attributes corresponding to the registered properties.
145
+ * @nocollapse
146
+ * @category attributes
147
+ */
148
+ static get observedAttributes() {
149
+ this.finalize();
150
+ const t = [];
151
+ return this.elementProperties.forEach((i, s) => {
152
+ const r = this.__attributeNameForProperty(s, i);
153
+ r !== void 0 && (this.__attributeToPropertyMap.set(r, s), t.push(r));
154
+ }), t;
155
+ }
156
+ /**
157
+ * Creates a property accessor on the element prototype if one does not exist
158
+ * and stores a {@linkcode PropertyDeclaration} for the property with the
159
+ * given options. The property setter calls the property's `hasChanged`
160
+ * property option or uses a strict identity check to determine whether or not
161
+ * to request an update.
162
+ *
163
+ * This method may be overridden to customize properties; however,
164
+ * when doing so, it's important to call `super.createProperty` to ensure
165
+ * the property is setup correctly. This method calls
166
+ * `getPropertyDescriptor` internally to get a descriptor to install.
167
+ * To customize what properties do when they are get or set, override
168
+ * `getPropertyDescriptor`. To customize the options for a property,
169
+ * implement `createProperty` like this:
170
+ *
171
+ * ```ts
172
+ * static createProperty(name, options) {
173
+ * options = Object.assign(options, {myOption: true});
174
+ * super.createProperty(name, options);
175
+ * }
176
+ * ```
177
+ *
178
+ * @nocollapse
179
+ * @category properties
180
+ */
181
+ static createProperty(t, i = Ft) {
182
+ var s;
183
+ if (i.state && (i.attribute = !1), this.finalize(), this.elementProperties.set(t, i), !i.noAccessor && !this.prototype.hasOwnProperty(t)) {
184
+ const r = typeof t == "symbol" ? /* @__PURE__ */ Symbol() : `__${t}`, n = this.getPropertyDescriptor(t, r, i);
185
+ n !== void 0 && (Object.defineProperty(this.prototype, t, n), this.hasOwnProperty("__reactivePropertyKeys") || (this.__reactivePropertyKeys = new Set((s = this.__reactivePropertyKeys) !== null && s !== void 0 ? s : [])), this.__reactivePropertyKeys.add(t));
186
+ }
187
+ }
188
+ /**
189
+ * Returns a property descriptor to be defined on the given named property.
190
+ * If no descriptor is returned, the property will not become an accessor.
191
+ * For example,
192
+ *
193
+ * ```ts
194
+ * class MyElement extends LitElement {
195
+ * static getPropertyDescriptor(name, key, options) {
196
+ * const defaultDescriptor =
197
+ * super.getPropertyDescriptor(name, key, options);
198
+ * const setter = defaultDescriptor.set;
199
+ * return {
200
+ * get: defaultDescriptor.get,
201
+ * set(value) {
202
+ * setter.call(this, value);
203
+ * // custom action.
204
+ * },
205
+ * configurable: true,
206
+ * enumerable: true
207
+ * }
208
+ * }
209
+ * }
210
+ * ```
211
+ *
212
+ * @nocollapse
213
+ * @category properties
214
+ */
215
+ static getPropertyDescriptor(t, i, s) {
216
+ return {
217
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
218
+ get() {
219
+ return this[i];
220
+ },
221
+ set(r) {
222
+ const n = this[t];
223
+ this[i] = r, this.requestUpdate(t, n, s);
224
+ },
225
+ configurable: !0,
226
+ enumerable: !0
227
+ };
228
+ }
229
+ /**
230
+ * Returns the property options associated with the given property.
231
+ * These options are defined with a `PropertyDeclaration` via the `properties`
232
+ * object or the `@property` decorator and are registered in
233
+ * `createProperty(...)`.
234
+ *
235
+ * Note, this method should be considered "final" and not overridden. To
236
+ * customize the options for a given property, override
237
+ * {@linkcode createProperty}.
238
+ *
239
+ * @nocollapse
240
+ * @final
241
+ * @category properties
242
+ */
243
+ static getPropertyOptions(t) {
244
+ return this.elementProperties.get(t) || Ft;
245
+ }
246
+ /**
247
+ * Creates property accessors for registered properties, sets up element
248
+ * styling, and ensures any superclasses are also finalized. Returns true if
249
+ * the element was finalized.
250
+ * @nocollapse
251
+ */
252
+ static finalize() {
253
+ if (this.hasOwnProperty(de))
254
+ return !1;
255
+ this[de] = !0;
256
+ const t = Object.getPrototypeOf(this);
257
+ if (t.finalize(), t._initializers !== void 0 && (this._initializers = [...t._initializers]), this.elementProperties = new Map(t.elementProperties), this.__attributeToPropertyMap = /* @__PURE__ */ new Map(), this.hasOwnProperty(Je("properties"))) {
258
+ const i = this.properties, s = [
259
+ ...Object.getOwnPropertyNames(i),
260
+ ...Object.getOwnPropertySymbols(i)
261
+ ];
262
+ for (const r of s)
263
+ this.createProperty(r, i[r]);
264
+ }
265
+ this.elementStyles = this.finalizeStyles(this.styles);
266
+ {
267
+ const i = (s, r = !1) => {
268
+ this.prototype.hasOwnProperty(s) && L(r ? "renamed-api" : "removed-api", `\`${s}\` is implemented on class ${this.name}. It has been ${r ? "renamed" : "removed"} in this version of LitElement.`);
269
+ };
270
+ i("initialize"), i("requestUpdateInternal"), i("_getUpdateComplete", !0);
271
+ }
272
+ return !0;
273
+ }
274
+ /**
275
+ * Takes the styles the user supplied via the `static styles` property and
276
+ * returns the array of styles to apply to the element.
277
+ * Override this method to integrate into a style management system.
278
+ *
279
+ * Styles are deduplicated preserving the _last_ instance in the list. This
280
+ * is a performance optimization to avoid duplicated styles that can occur
281
+ * especially when composing via subclassing. The last item is kept to try
282
+ * to preserve the cascade order with the assumption that it's most important
283
+ * that last added styles override previous styles.
284
+ *
285
+ * @nocollapse
286
+ * @category styles
287
+ */
288
+ static finalizeStyles(t) {
289
+ const i = [];
290
+ if (Array.isArray(t)) {
291
+ const s = new Set(t.flat(1 / 0).reverse());
292
+ for (const r of s)
293
+ i.unshift(Te(r));
294
+ } else t !== void 0 && i.push(Te(t));
295
+ return i;
296
+ }
297
+ /**
298
+ * Returns the property name for the given attribute `name`.
299
+ * @nocollapse
300
+ */
301
+ static __attributeNameForProperty(t, i) {
302
+ const s = i.attribute;
303
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
304
+ }
305
+ /**
306
+ * Internal only override point for customizing work done when elements
307
+ * are constructed.
308
+ */
309
+ __initialize() {
310
+ var t;
311
+ this.__updatePromise = new Promise((i) => this.enableUpdating = i), this._$changedProperties = /* @__PURE__ */ new Map(), this.__saveInstanceProperties(), this.requestUpdate(), (t = this.constructor._initializers) === null || t === void 0 || t.forEach((i) => i(this));
312
+ }
313
+ /**
314
+ * Registers a `ReactiveController` to participate in the element's reactive
315
+ * update cycle. The element automatically calls into any registered
316
+ * controllers during its lifecycle callbacks.
317
+ *
318
+ * If the element is connected when `addController()` is called, the
319
+ * controller's `hostConnected()` callback will be immediately called.
320
+ * @category controllers
321
+ */
322
+ addController(t) {
323
+ var i, s;
324
+ ((i = this.__controllers) !== null && i !== void 0 ? i : this.__controllers = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((s = t.hostConnected) === null || s === void 0 || s.call(t));
325
+ }
326
+ /**
327
+ * Removes a `ReactiveController` from the element.
328
+ * @category controllers
329
+ */
330
+ removeController(t) {
331
+ var i;
332
+ (i = this.__controllers) === null || i === void 0 || i.splice(this.__controllers.indexOf(t) >>> 0, 1);
333
+ }
334
+ /**
335
+ * Fixes any properties set on the instance before upgrade time.
336
+ * Otherwise these would shadow the accessor and break these properties.
337
+ * The properties are stored in a Map which is played back after the
338
+ * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
339
+ * (<=41), properties created for native platform properties like (`id` or
340
+ * `name`) may not have default values set in the element constructor. On
341
+ * these browsers native properties appear on instances and therefore their
342
+ * default value will overwrite any element default (e.g. if the element sets
343
+ * this.id = 'id' in the constructor, the 'id' will become '' since this is
344
+ * the native platform default).
345
+ */
346
+ __saveInstanceProperties() {
347
+ this.constructor.elementProperties.forEach((t, i) => {
348
+ this.hasOwnProperty(i) && (this.__instanceProperties.set(i, this[i]), delete this[i]);
349
+ });
350
+ }
351
+ /**
352
+ * Returns the node into which the element should render and by default
353
+ * creates and returns an open shadowRoot. Implement to customize where the
354
+ * element's DOM is rendered. For example, to render into the element's
355
+ * childNodes, return `this`.
356
+ *
357
+ * @return Returns a node into which to render.
358
+ * @category rendering
359
+ */
360
+ createRenderRoot() {
361
+ var t;
362
+ const i = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
363
+ return xi(i, this.constructor.elementStyles), i;
364
+ }
365
+ /**
366
+ * On first connection, creates the element's renderRoot, sets up
367
+ * element styling, and enables updating.
368
+ * @category lifecycle
369
+ */
370
+ connectedCallback() {
371
+ var t;
372
+ this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this.__controllers) === null || t === void 0 || t.forEach((i) => {
373
+ var s;
374
+ return (s = i.hostConnected) === null || s === void 0 ? void 0 : s.call(i);
375
+ });
376
+ }
377
+ /**
378
+ * Note, this method should be considered final and not overridden. It is
379
+ * overridden on the element instance with a function that triggers the first
380
+ * update.
381
+ * @category updates
382
+ */
383
+ enableUpdating(t) {
384
+ }
385
+ /**
386
+ * Allows for `super.disconnectedCallback()` in extensions while
387
+ * reserving the possibility of making non-breaking feature additions
388
+ * when disconnecting at some point in the future.
389
+ * @category lifecycle
390
+ */
391
+ disconnectedCallback() {
392
+ var t;
393
+ (t = this.__controllers) === null || t === void 0 || t.forEach((i) => {
394
+ var s;
395
+ return (s = i.hostDisconnected) === null || s === void 0 ? void 0 : s.call(i);
396
+ });
397
+ }
398
+ /**
399
+ * Synchronizes property values when attributes change.
400
+ *
401
+ * Specifically, when an attribute is set, the corresponding property is set.
402
+ * You should rarely need to implement this callback. If this method is
403
+ * overridden, `super.attributeChangedCallback(name, _old, value)` must be
404
+ * called.
405
+ *
406
+ * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)
407
+ * on MDN for more information about the `attributeChangedCallback`.
408
+ * @category attributes
409
+ */
410
+ attributeChangedCallback(t, i, s) {
411
+ this._$attributeToProperty(t, s);
412
+ }
413
+ __propertyToAttribute(t, i, s = Ft) {
414
+ var r;
415
+ const n = this.constructor.__attributeNameForProperty(t, s);
416
+ if (n !== void 0 && s.reflect === !0) {
417
+ const l = (((r = s.converter) === null || r === void 0 ? void 0 : r.toAttribute) !== void 0 ? s.converter : le).toAttribute(i, s.type);
418
+ this.constructor.enabledWarnings.indexOf("migration") >= 0 && l === void 0 && L("undefined-attribute-value", `The attribute value for the ${t} property is undefined on element ${this.localName}. The attribute will be removed, but in the previous version of \`ReactiveElement\`, the attribute would not have changed.`), this.__reflectingProperty = t, l == null ? this.removeAttribute(n) : this.setAttribute(n, l), this.__reflectingProperty = null;
419
+ }
420
+ }
421
+ /** @internal */
422
+ _$attributeToProperty(t, i) {
423
+ var s;
424
+ const r = this.constructor, n = r.__attributeToPropertyMap.get(t);
425
+ if (n !== void 0 && this.__reflectingProperty !== n) {
426
+ const o = r.getPropertyOptions(n), l = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((s = o.converter) === null || s === void 0 ? void 0 : s.fromAttribute) !== void 0 ? o.converter : le;
427
+ this.__reflectingProperty = n, this[n] = l.fromAttribute(
428
+ i,
429
+ o.type
430
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
431
+ ), this.__reflectingProperty = null;
432
+ }
433
+ }
434
+ /**
435
+ * Requests an update which is processed asynchronously. This should be called
436
+ * when an element should update based on some state not triggered by setting
437
+ * a reactive property. In this case, pass no arguments. It should also be
438
+ * called when manually implementing a property setter. In this case, pass the
439
+ * property `name` and `oldValue` to ensure that any configured property
440
+ * options are honored.
441
+ *
442
+ * @param name name of requesting property
443
+ * @param oldValue old value of requesting property
444
+ * @param options property options to use instead of the previously
445
+ * configured options
446
+ * @category updates
447
+ */
448
+ requestUpdate(t, i, s) {
449
+ let r = !0;
450
+ return t !== void 0 && (s = s || this.constructor.getPropertyOptions(t), (s.hasChanged || fe)(this[t], i) ? (this._$changedProperties.has(t) || this._$changedProperties.set(t, i), s.reflect === !0 && this.__reflectingProperty !== t && (this.__reflectingProperties === void 0 && (this.__reflectingProperties = /* @__PURE__ */ new Map()), this.__reflectingProperties.set(t, s))) : r = !1), !this.isUpdatePending && r && (this.__updatePromise = this.__enqueueUpdate()), Qe(this.localName);
451
+ }
452
+ /**
453
+ * Sets up the element to asynchronously update.
454
+ */
455
+ async __enqueueUpdate() {
456
+ this.isUpdatePending = !0;
457
+ try {
458
+ await this.__updatePromise;
459
+ } catch (i) {
460
+ Promise.reject(i);
461
+ }
462
+ const t = this.scheduleUpdate();
463
+ return t != null && await t, !this.isUpdatePending;
464
+ }
465
+ /**
466
+ * Schedules an element update. You can override this method to change the
467
+ * timing of updates by returning a Promise. The update will await the
468
+ * returned Promise, and you should resolve the Promise to allow the update
469
+ * to proceed. If this method is overridden, `super.scheduleUpdate()`
470
+ * must be called.
471
+ *
472
+ * For instance, to schedule updates to occur just before the next frame:
473
+ *
474
+ * ```ts
475
+ * override protected async scheduleUpdate(): Promise<unknown> {
476
+ * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
477
+ * super.scheduleUpdate();
478
+ * }
479
+ * ```
480
+ * @category updates
481
+ */
482
+ scheduleUpdate() {
483
+ return this.performUpdate();
484
+ }
485
+ /**
486
+ * Performs an element update. Note, if an exception is thrown during the
487
+ * update, `firstUpdated` and `updated` will not be called.
488
+ *
489
+ * Call `performUpdate()` to immediately process a pending update. This should
490
+ * generally not be needed, but it can be done in rare cases when you need to
491
+ * update synchronously.
492
+ *
493
+ * Note: To ensure `performUpdate()` synchronously completes a pending update,
494
+ * it should not be overridden. In LitElement 2.x it was suggested to override
495
+ * `performUpdate()` to also customizing update scheduling. Instead, you should now
496
+ * override `scheduleUpdate()`. For backwards compatibility with LitElement 2.x,
497
+ * scheduling updates via `performUpdate()` continues to work, but will make
498
+ * also calling `performUpdate()` to synchronously process updates difficult.
499
+ *
500
+ * @category updates
501
+ */
502
+ performUpdate() {
503
+ var t, i;
504
+ if (!this.isUpdatePending)
505
+ return;
506
+ if (qt?.({ kind: "update" }), !this.hasUpdated) {
507
+ const n = [];
508
+ if ((t = this.constructor.__reactivePropertyKeys) === null || t === void 0 || t.forEach((o) => {
509
+ var l;
510
+ this.hasOwnProperty(o) && !(!((l = this.__instanceProperties) === null || l === void 0) && l.has(o)) && n.push(o);
511
+ }), n.length)
512
+ throw new Error(`The following properties on element ${this.localName} will not trigger updates as expected because they are set using class fields: ${n.join(", ")}. Native class fields and some compiled output will overwrite accessors used for detecting changes. See https://lit.dev/msg/class-field-shadowing for more information.`);
513
+ }
514
+ this.__instanceProperties && (this.__instanceProperties.forEach((n, o) => this[o] = n), this.__instanceProperties = void 0);
515
+ let s = !1;
516
+ const r = this._$changedProperties;
517
+ try {
518
+ s = this.shouldUpdate(r), s ? (this.willUpdate(r), (i = this.__controllers) === null || i === void 0 || i.forEach((n) => {
519
+ var o;
520
+ return (o = n.hostUpdate) === null || o === void 0 ? void 0 : o.call(n);
521
+ }), this.update(r)) : this.__markUpdated();
522
+ } catch (n) {
523
+ throw s = !1, this.__markUpdated(), n;
524
+ }
525
+ s && this._$didUpdate(r);
526
+ }
527
+ /**
528
+ * Invoked before `update()` to compute values needed during the update.
529
+ *
530
+ * Implement `willUpdate` to compute property values that depend on other
531
+ * properties and are used in the rest of the update process.
532
+ *
533
+ * ```ts
534
+ * willUpdate(changedProperties) {
535
+ * // only need to check changed properties for an expensive computation.
536
+ * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {
537
+ * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
538
+ * }
539
+ * }
540
+ *
541
+ * render() {
542
+ * return html`SHA: ${this.sha}`;
543
+ * }
544
+ * ```
545
+ *
546
+ * @category updates
547
+ */
548
+ willUpdate(t) {
549
+ }
550
+ // Note, this is an override point for polyfill-support.
551
+ // @internal
552
+ _$didUpdate(t) {
553
+ var i;
554
+ (i = this.__controllers) === null || i === void 0 || i.forEach((s) => {
555
+ var r;
556
+ return (r = s.hostUpdated) === null || r === void 0 ? void 0 : r.call(s);
557
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t), this.isUpdatePending && this.constructor.enabledWarnings.indexOf("change-in-update") >= 0 && L("change-in-update", `Element ${this.localName} scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update.`);
558
+ }
559
+ __markUpdated() {
560
+ this._$changedProperties = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
561
+ }
562
+ /**
563
+ * Returns a Promise that resolves when the element has completed updating.
564
+ * The Promise value is a boolean that is `true` if the element completed the
565
+ * update without triggering another update. The Promise result is `false` if
566
+ * a property was set inside `updated()`. If the Promise is rejected, an
567
+ * exception was thrown during the update.
568
+ *
569
+ * To await additional asynchronous work, override the `getUpdateComplete`
570
+ * method. For example, it is sometimes useful to await a rendered element
571
+ * before fulfilling this Promise. To do this, first await
572
+ * `super.getUpdateComplete()`, then any subsequent state.
573
+ *
574
+ * @return A promise of a boolean that resolves to true if the update completed
575
+ * without triggering another update.
576
+ * @category updates
577
+ */
578
+ get updateComplete() {
579
+ return this.getUpdateComplete();
580
+ }
581
+ /**
582
+ * Override point for the `updateComplete` promise.
583
+ *
584
+ * It is not safe to override the `updateComplete` getter directly due to a
585
+ * limitation in TypeScript which means it is not possible to call a
586
+ * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
587
+ * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
588
+ * This method should be overridden instead. For example:
589
+ *
590
+ * ```ts
591
+ * class MyElement extends LitElement {
592
+ * override async getUpdateComplete() {
593
+ * const result = await super.getUpdateComplete();
594
+ * await this._myChild.updateComplete;
595
+ * return result;
596
+ * }
597
+ * }
598
+ * ```
599
+ *
600
+ * @return A promise of a boolean that resolves to true if the update completed
601
+ * without triggering another update.
602
+ * @category updates
603
+ */
604
+ getUpdateComplete() {
605
+ return this.__updatePromise;
606
+ }
607
+ /**
608
+ * Controls whether or not `update()` should be called when the element requests
609
+ * an update. By default, this method always returns `true`, but this can be
610
+ * customized to control when to update.
611
+ *
612
+ * @param _changedProperties Map of changed properties with old values
613
+ * @category updates
614
+ */
615
+ shouldUpdate(t) {
616
+ return !0;
617
+ }
618
+ /**
619
+ * Updates the element. This method reflects property values to attributes.
620
+ * It can be overridden to render and keep updated element DOM.
621
+ * Setting properties inside this method will *not* trigger
622
+ * another update.
623
+ *
624
+ * @param _changedProperties Map of changed properties with old values
625
+ * @category updates
626
+ */
627
+ update(t) {
628
+ this.__reflectingProperties !== void 0 && (this.__reflectingProperties.forEach((i, s) => this.__propertyToAttribute(s, this[s], i)), this.__reflectingProperties = void 0), this.__markUpdated();
629
+ }
630
+ /**
631
+ * Invoked whenever the element is updated. Implement to perform
632
+ * post-updating tasks via DOM APIs, for example, focusing an element.
633
+ *
634
+ * Setting properties inside this method will trigger the element to update
635
+ * again after this update cycle completes.
636
+ *
637
+ * @param _changedProperties Map of changed properties with old values
638
+ * @category updates
639
+ */
640
+ updated(t) {
641
+ }
642
+ /**
643
+ * Invoked when the element is first updated. Implement to perform one time
644
+ * work on the element after update.
645
+ *
646
+ * ```ts
647
+ * firstUpdated() {
648
+ * this.renderRoot.getElementById('my-text-area').focus();
649
+ * }
650
+ * ```
651
+ *
652
+ * Setting properties inside this method will trigger the element to update
653
+ * again after this update cycle completes.
654
+ *
655
+ * @param _changedProperties Map of changed properties with old values
656
+ * @category updates
657
+ */
658
+ firstUpdated(t) {
659
+ }
660
+ }
661
+ Ke = de;
662
+ N[Ke] = !0;
663
+ N.elementProperties = /* @__PURE__ */ new Map();
664
+ N.elementStyles = [];
665
+ N.shadowRootOptions = { mode: "open" };
666
+ Ct?.({ ReactiveElement: N });
667
+ {
668
+ N.enabledWarnings = ["change-in-update"];
669
+ const e = function(t) {
670
+ t.hasOwnProperty(Je("enabledWarnings")) || (t.enabledWarnings = t.enabledWarnings.slice());
671
+ };
672
+ N.enableWarning = function(t) {
673
+ e(this), this.enabledWarnings.indexOf(t) < 0 && this.enabledWarnings.push(t);
674
+ }, N.disableWarning = function(t) {
675
+ e(this);
676
+ const i = this.enabledWarnings.indexOf(t);
677
+ i >= 0 && this.enabledWarnings.splice(i, 1);
678
+ };
679
+ }
680
+ ((Wt = P.reactiveElementVersions) !== null && Wt !== void 0 ? Wt : P.reactiveElementVersions = []).push("1.6.3");
681
+ P.reactiveElementVersions.length > 1 && L("multiple-versions", "Multiple versions of Lit loaded. Loading multiple versions is not recommended.");
682
+ var Gt, Zt, Yt, Kt;
683
+ const k = window, c = (e) => {
684
+ k.emitLitDebugLogEvents && k.dispatchEvent(new CustomEvent("lit-debug", {
685
+ detail: e
686
+ }));
687
+ };
688
+ let Si = 0, St;
689
+ (Gt = k.litIssuedWarnings) !== null && Gt !== void 0 || (k.litIssuedWarnings = /* @__PURE__ */ new Set()), St = (e, t) => {
690
+ t += e ? ` See https://lit.dev/msg/${e} for more information.` : "", k.litIssuedWarnings.has(t) || k.litIssuedWarnings.add(t);
691
+ }, St("dev-mode", "Lit is in dev mode. Not recommended for production!");
692
+ const S = !((Zt = k.ShadyDOM) === null || Zt === void 0) && Zt.inUse && ((Yt = k.ShadyDOM) === null || Yt === void 0 ? void 0 : Yt.noPatch) === !0 ? k.ShadyDOM.wrap : (e) => e, et = k.trustedTypes, Pe = et ? et.createPolicy("lit-html", {
693
+ createHTML: (e) => e
694
+ }) : void 0, Ai = (e) => e, It = (e, t, i) => Ai, Ti = (e) => {
695
+ if (q !== It)
696
+ throw new Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");
697
+ q = e;
698
+ }, Ei = () => {
699
+ q = It;
700
+ }, ce = (e, t, i) => q(e, t, i), he = "$lit$", R = `lit$${String(Math.random()).slice(9)}$`, Xe = "?" + R, Pi = `<${Xe}>`, B = document, pt = () => B.createComment(""), mt = (e) => e === null || typeof e != "object" && typeof e != "function", ti = Array.isArray, Ni = (e) => ti(e) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
701
+ typeof e?.[Symbol.iterator] == "function", Qt = `[
702
+ \f\r]`, Ii = `[^
703
+ \f\r"'\`<>=]`, Ri = `[^\\s"'>=/]`, ct = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ne = 1, Jt = 2, Mi = 3, Ie = /-->/g, Re = />/g, tt = new RegExp(`>|${Qt}(?:(${Ri}+)(${Qt}*=${Qt}*(?:${Ii}|("|')|))|$)`, "g"), zi = 0, Me = 1, Oi = 2, ze = 3, Oe = /'/g, Le = /"/g, ei = /^(?:script|style|textarea|title)$/i, Li = 1, At = 2, ge = 1, Tt = 2, Hi = 3, Ui = 4, Vi = 5, ve = 6, Di = 7, ii = (e) => (t, ...i) => (t.some((s) => s === void 0), {
704
+ // This property needs to remain unminified.
705
+ _$litType$: e,
706
+ strings: t,
707
+ values: i
708
+ }), w = ii(Li), si = ii(At), W = /* @__PURE__ */ Symbol.for("lit-noChange"), _ = /* @__PURE__ */ Symbol.for("lit-nothing"), He = /* @__PURE__ */ new WeakMap(), D = B.createTreeWalker(B, 129, null, !1);
709
+ let q = It;
710
+ function ri(e, t) {
711
+ if (!Array.isArray(e) || !e.hasOwnProperty("raw")) {
712
+ let i = "invalid template strings array";
713
+ throw i = `
714
+ Internal Error: expected template strings to be an array
715
+ with a 'raw' field. Faking a template strings array by
716
+ calling html or svg like an ordinary function is effectively
717
+ the same as calling unsafeHtml and can lead to major security
718
+ issues, e.g. opening your code up to XSS attacks.
719
+ If you're using the html or svg tagged template functions normally
720
+ and still seeing this error, please file a bug at
721
+ https://github.com/lit/lit/issues/new?template=bug_report.md
722
+ and include information about your build tooling, if any.
723
+ `.trim().replace(/\n */g, `
724
+ `), new Error(i);
725
+ }
726
+ return Pe !== void 0 ? Pe.createHTML(t) : t;
727
+ }
728
+ const ji = (e, t) => {
729
+ const i = e.length - 1, s = [];
730
+ let r = t === At ? "<svg>" : "", n, o = ct;
731
+ for (let a = 0; a < i; a++) {
732
+ const d = e[a];
733
+ let h = -1, u, p = 0, g;
734
+ for (; p < d.length && (o.lastIndex = p, g = o.exec(d), g !== null); )
735
+ if (p = o.lastIndex, o === ct) {
736
+ if (g[Ne] === "!--")
737
+ o = Ie;
738
+ else if (g[Ne] !== void 0)
739
+ o = Re;
740
+ else if (g[Jt] !== void 0)
741
+ ei.test(g[Jt]) && (n = new RegExp(`</${g[Jt]}`, "g")), o = tt;
742
+ else if (g[Mi] !== void 0)
743
+ throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions");
744
+ } else o === tt ? g[zi] === ">" ? (o = n ?? ct, h = -1) : g[Me] === void 0 ? h = -2 : (h = o.lastIndex - g[Oi].length, u = g[Me], o = g[ze] === void 0 ? tt : g[ze] === '"' ? Le : Oe) : o === Le || o === Oe ? o = tt : o === Ie || o === Re ? o = ct : (o = tt, n = void 0);
745
+ const E = o === tt && e[a + 1].startsWith("/>") ? " " : "";
746
+ r += o === ct ? d + Pi : h >= 0 ? (s.push(u), d.slice(0, h) + he + d.slice(h) + R + E) : d + R + (h === -2 ? (s.push(void 0), a) : E);
747
+ }
748
+ const l = r + (e[i] || "<?>") + (t === At ? "</svg>" : "");
749
+ return [ri(e, l), s];
750
+ };
751
+ class ft {
752
+ constructor({ strings: t, ["_$litType$"]: i }, s) {
753
+ this.parts = [];
754
+ let r, n = 0, o = 0;
755
+ const l = t.length - 1, a = this.parts, [d, h] = ji(t, i);
756
+ if (this.el = ft.createElement(d, s), D.currentNode = this.el.content, i === At) {
757
+ const u = this.el.content, p = u.firstChild;
758
+ p.remove(), u.append(...p.childNodes);
759
+ }
760
+ for (; (r = D.nextNode()) !== null && a.length < l; ) {
761
+ if (r.nodeType === 1) {
762
+ {
763
+ const u = r.localName;
764
+ if (/^(?:textarea|template)$/i.test(u) && r.innerHTML.includes(R)) {
765
+ const p = `Expressions are not supported inside \`${u}\` elements. See https://lit.dev/msg/expression-in-${u} for more information.`;
766
+ if (u === "template")
767
+ throw new Error(p);
768
+ St("", p);
769
+ }
770
+ }
771
+ if (r.hasAttributes()) {
772
+ const u = [];
773
+ for (const p of r.getAttributeNames())
774
+ if (p.endsWith(he) || p.startsWith(R)) {
775
+ const g = h[o++];
776
+ if (u.push(p), g !== void 0) {
777
+ const nt = r.getAttribute(g.toLowerCase() + he).split(R), Q = /([.?@])?(.*)/.exec(g);
778
+ a.push({
779
+ type: ge,
780
+ index: n,
781
+ name: Q[2],
782
+ strings: nt,
783
+ ctor: Q[1] === "." ? Wi : Q[1] === "?" ? Fi : Q[1] === "@" ? Gi : Rt
784
+ });
785
+ } else
786
+ a.push({
787
+ type: ve,
788
+ index: n
789
+ });
790
+ }
791
+ for (const p of u)
792
+ r.removeAttribute(p);
793
+ }
794
+ if (ei.test(r.tagName)) {
795
+ const u = r.textContent.split(R), p = u.length - 1;
796
+ if (p > 0) {
797
+ r.textContent = et ? et.emptyScript : "";
798
+ for (let g = 0; g < p; g++)
799
+ r.append(u[g], pt()), D.nextNode(), a.push({ type: Tt, index: ++n });
800
+ r.append(u[p], pt());
801
+ }
802
+ }
803
+ } else if (r.nodeType === 8)
804
+ if (r.data === Xe)
805
+ a.push({ type: Tt, index: n });
806
+ else {
807
+ let p = -1;
808
+ for (; (p = r.data.indexOf(R, p + 1)) !== -1; )
809
+ a.push({ type: Di, index: n }), p += R.length - 1;
810
+ }
811
+ n++;
812
+ }
813
+ c?.({
814
+ kind: "template prep",
815
+ template: this,
816
+ clonableTemplate: this.el,
817
+ parts: this.parts,
818
+ strings: t
819
+ });
820
+ }
821
+ // Overridden via `litHtmlPolyfillSupport` to provide platform support.
822
+ /** @nocollapse */
823
+ static createElement(t, i) {
824
+ const s = B.createElement("template");
825
+ return s.innerHTML = t, s;
826
+ }
827
+ }
828
+ function it(e, t, i = e, s) {
829
+ var r, n, o, l;
830
+ if (t === W)
831
+ return t;
832
+ let a = s !== void 0 ? (r = i.__directives) === null || r === void 0 ? void 0 : r[s] : i.__directive;
833
+ const d = mt(t) ? void 0 : (
834
+ // This property needs to remain unminified.
835
+ t._$litDirective$
836
+ );
837
+ return a?.constructor !== d && ((n = a?._$notifyDirectiveConnectionChanged) === null || n === void 0 || n.call(a, !1), d === void 0 ? a = void 0 : (a = new d(e), a._$initialize(e, i, s)), s !== void 0 ? ((o = (l = i).__directives) !== null && o !== void 0 ? o : l.__directives = [])[s] = a : i.__directive = a), a !== void 0 && (t = it(e, a._$resolve(e, t.values), a, s)), t;
838
+ }
839
+ class Bi {
840
+ constructor(t, i) {
841
+ this._$parts = [], this._$disconnectableChildren = void 0, this._$template = t, this._$parent = i;
842
+ }
843
+ // Called by ChildPart parentNode getter
844
+ get parentNode() {
845
+ return this._$parent.parentNode;
846
+ }
847
+ // See comment in Disconnectable interface for why this is a getter
848
+ get _$isConnected() {
849
+ return this._$parent._$isConnected;
850
+ }
851
+ // This method is separate from the constructor because we need to return a
852
+ // DocumentFragment and we don't want to hold onto it with an instance field.
853
+ _clone(t) {
854
+ var i;
855
+ const { el: { content: s }, parts: r } = this._$template, n = ((i = t?.creationScope) !== null && i !== void 0 ? i : B).importNode(s, !0);
856
+ D.currentNode = n;
857
+ let o = D.nextNode(), l = 0, a = 0, d = r[0];
858
+ for (; d !== void 0; ) {
859
+ if (l === d.index) {
860
+ let h;
861
+ d.type === Tt ? h = new _t(o, o.nextSibling, this, t) : d.type === ge ? h = new d.ctor(o, d.name, d.strings, this, t) : d.type === ve && (h = new Zi(o, this, t)), this._$parts.push(h), d = r[++a];
862
+ }
863
+ l !== d?.index && (o = D.nextNode(), l++);
864
+ }
865
+ return D.currentNode = B, n;
866
+ }
867
+ _update(t) {
868
+ let i = 0;
869
+ for (const s of this._$parts)
870
+ s !== void 0 && (c?.({
871
+ kind: "set part",
872
+ part: s,
873
+ value: t[i],
874
+ valueIndex: i,
875
+ values: t,
876
+ templateInstance: this
877
+ }), s.strings !== void 0 ? (s._$setValue(t, s, i), i += s.strings.length - 2) : s._$setValue(t[i])), i++;
878
+ }
879
+ }
880
+ class _t {
881
+ constructor(t, i, s, r) {
882
+ var n;
883
+ this.type = Tt, this._$committedValue = _, this._$disconnectableChildren = void 0, this._$startNode = t, this._$endNode = i, this._$parent = s, this.options = r, this.__isConnected = (n = r?.isConnected) !== null && n !== void 0 ? n : !0, this._textSanitizer = void 0;
884
+ }
885
+ // See comment in Disconnectable interface for why this is a getter
886
+ get _$isConnected() {
887
+ var t, i;
888
+ return (i = (t = this._$parent) === null || t === void 0 ? void 0 : t._$isConnected) !== null && i !== void 0 ? i : this.__isConnected;
889
+ }
890
+ /**
891
+ * The parent node into which the part renders its content.
892
+ *
893
+ * A ChildPart's content consists of a range of adjacent child nodes of
894
+ * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and
895
+ * `.endNode`).
896
+ *
897
+ * - If both `.startNode` and `.endNode` are non-null, then the part's content
898
+ * consists of all siblings between `.startNode` and `.endNode`, exclusively.
899
+ *
900
+ * - If `.startNode` is non-null but `.endNode` is null, then the part's
901
+ * content consists of all siblings following `.startNode`, up to and
902
+ * including the last child of `.parentNode`. If `.endNode` is non-null, then
903
+ * `.startNode` will always be non-null.
904
+ *
905
+ * - If both `.endNode` and `.startNode` are null, then the part's content
906
+ * consists of all child nodes of `.parentNode`.
907
+ */
908
+ get parentNode() {
909
+ let t = S(this._$startNode).parentNode;
910
+ const i = this._$parent;
911
+ return i !== void 0 && t?.nodeType === 11 && (t = i.parentNode), t;
912
+ }
913
+ /**
914
+ * The part's leading marker node, if any. See `.parentNode` for more
915
+ * information.
916
+ */
917
+ get startNode() {
918
+ return this._$startNode;
919
+ }
920
+ /**
921
+ * The part's trailing marker node, if any. See `.parentNode` for more
922
+ * information.
923
+ */
924
+ get endNode() {
925
+ return this._$endNode;
926
+ }
927
+ _$setValue(t, i = this) {
928
+ var s;
929
+ if (this.parentNode === null)
930
+ throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");
931
+ if (t = it(this, t, i), mt(t))
932
+ t === _ || t == null || t === "" ? (this._$committedValue !== _ && (c?.({
933
+ kind: "commit nothing to child",
934
+ start: this._$startNode,
935
+ end: this._$endNode,
936
+ parent: this._$parent,
937
+ options: this.options
938
+ }), this._$clear()), this._$committedValue = _) : t !== this._$committedValue && t !== W && this._commitText(t);
939
+ else if (t._$litType$ !== void 0)
940
+ this._commitTemplateResult(t);
941
+ else if (t.nodeType !== void 0) {
942
+ if (((s = this.options) === null || s === void 0 ? void 0 : s.host) === t) {
943
+ this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]");
944
+ return;
945
+ }
946
+ this._commitNode(t);
947
+ } else Ni(t) ? this._commitIterable(t) : this._commitText(t);
948
+ }
949
+ _insert(t) {
950
+ return S(S(this._$startNode).parentNode).insertBefore(t, this._$endNode);
951
+ }
952
+ _commitNode(t) {
953
+ var i;
954
+ if (this._$committedValue !== t) {
955
+ if (this._$clear(), q !== It) {
956
+ const s = (i = this._$startNode.parentNode) === null || i === void 0 ? void 0 : i.nodeName;
957
+ if (s === "STYLE" || s === "SCRIPT") {
958
+ let r = "Forbidden";
959
+ throw s === "STYLE" ? r = "Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and make do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets." : r = "Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.", new Error(r);
960
+ }
961
+ }
962
+ c?.({
963
+ kind: "commit node",
964
+ start: this._$startNode,
965
+ parent: this._$parent,
966
+ value: t,
967
+ options: this.options
968
+ }), this._$committedValue = this._insert(t);
969
+ }
970
+ }
971
+ _commitText(t) {
972
+ if (this._$committedValue !== _ && mt(this._$committedValue)) {
973
+ const i = S(this._$startNode).nextSibling;
974
+ this._textSanitizer === void 0 && (this._textSanitizer = ce(i, "data", "property")), t = this._textSanitizer(t), c?.({
975
+ kind: "commit text",
976
+ node: i,
977
+ value: t,
978
+ options: this.options
979
+ }), i.data = t;
980
+ } else {
981
+ const i = B.createTextNode("");
982
+ this._commitNode(i), this._textSanitizer === void 0 && (this._textSanitizer = ce(i, "data", "property")), t = this._textSanitizer(t), c?.({
983
+ kind: "commit text",
984
+ node: i,
985
+ value: t,
986
+ options: this.options
987
+ }), i.data = t;
988
+ }
989
+ this._$committedValue = t;
990
+ }
991
+ _commitTemplateResult(t) {
992
+ var i;
993
+ const { values: s, ["_$litType$"]: r } = t, n = typeof r == "number" ? this._$getTemplate(t) : (r.el === void 0 && (r.el = ft.createElement(ri(r.h, r.h[0]), this.options)), r);
994
+ if (((i = this._$committedValue) === null || i === void 0 ? void 0 : i._$template) === n)
995
+ c?.({
996
+ kind: "template updating",
997
+ template: n,
998
+ instance: this._$committedValue,
999
+ parts: this._$committedValue._$parts,
1000
+ options: this.options,
1001
+ values: s
1002
+ }), this._$committedValue._update(s);
1003
+ else {
1004
+ const o = new Bi(n, this), l = o._clone(this.options);
1005
+ c?.({
1006
+ kind: "template instantiated",
1007
+ template: n,
1008
+ instance: o,
1009
+ parts: o._$parts,
1010
+ options: this.options,
1011
+ fragment: l,
1012
+ values: s
1013
+ }), o._update(s), c?.({
1014
+ kind: "template instantiated and updated",
1015
+ template: n,
1016
+ instance: o,
1017
+ parts: o._$parts,
1018
+ options: this.options,
1019
+ fragment: l,
1020
+ values: s
1021
+ }), this._commitNode(l), this._$committedValue = o;
1022
+ }
1023
+ }
1024
+ // Overridden via `litHtmlPolyfillSupport` to provide platform support.
1025
+ /** @internal */
1026
+ _$getTemplate(t) {
1027
+ let i = He.get(t.strings);
1028
+ return i === void 0 && He.set(t.strings, i = new ft(t)), i;
1029
+ }
1030
+ _commitIterable(t) {
1031
+ ti(this._$committedValue) || (this._$committedValue = [], this._$clear());
1032
+ const i = this._$committedValue;
1033
+ let s = 0, r;
1034
+ for (const n of t)
1035
+ s === i.length ? i.push(r = new _t(this._insert(pt()), this._insert(pt()), this, this.options)) : r = i[s], r._$setValue(n), s++;
1036
+ s < i.length && (this._$clear(r && S(r._$endNode).nextSibling, s), i.length = s);
1037
+ }
1038
+ /**
1039
+ * Removes the nodes contained within this Part from the DOM.
1040
+ *
1041
+ * @param start Start node to clear from, for clearing a subset of the part's
1042
+ * DOM (used when truncating iterables)
1043
+ * @param from When `start` is specified, the index within the iterable from
1044
+ * which ChildParts are being removed, used for disconnecting directives in
1045
+ * those Parts.
1046
+ *
1047
+ * @internal
1048
+ */
1049
+ _$clear(t = S(this._$startNode).nextSibling, i) {
1050
+ var s;
1051
+ for ((s = this._$notifyConnectionChanged) === null || s === void 0 || s.call(this, !1, !0, i); t && t !== this._$endNode; ) {
1052
+ const r = S(t).nextSibling;
1053
+ S(t).remove(), t = r;
1054
+ }
1055
+ }
1056
+ /**
1057
+ * Implementation of RootPart's `isConnected`. Note that this metod
1058
+ * should only be called on `RootPart`s (the `ChildPart` returned from a
1059
+ * top-level `render()` call). It has no effect on non-root ChildParts.
1060
+ * @param isConnected Whether to set
1061
+ * @internal
1062
+ */
1063
+ setConnected(t) {
1064
+ var i;
1065
+ if (this._$parent === void 0)
1066
+ this.__isConnected = t, (i = this._$notifyConnectionChanged) === null || i === void 0 || i.call(this, t);
1067
+ else
1068
+ throw new Error("part.setConnected() may only be called on a RootPart returned from render().");
1069
+ }
1070
+ }
1071
+ class Rt {
1072
+ constructor(t, i, s, r, n) {
1073
+ this.type = ge, this._$committedValue = _, this._$disconnectableChildren = void 0, this.element = t, this.name = i, this._$parent = r, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$committedValue = new Array(s.length - 1).fill(new String()), this.strings = s) : this._$committedValue = _, this._sanitizer = void 0;
1074
+ }
1075
+ get tagName() {
1076
+ return this.element.tagName;
1077
+ }
1078
+ // See comment in Disconnectable interface for why this is a getter
1079
+ get _$isConnected() {
1080
+ return this._$parent._$isConnected;
1081
+ }
1082
+ /**
1083
+ * Sets the value of this part by resolving the value from possibly multiple
1084
+ * values and static strings and committing it to the DOM.
1085
+ * If this part is single-valued, `this._strings` will be undefined, and the
1086
+ * method will be called with a single value argument. If this part is
1087
+ * multi-value, `this._strings` will be defined, and the method is called
1088
+ * with the value array of the part's owning TemplateInstance, and an offset
1089
+ * into the value array from which the values should be read.
1090
+ * This method is overloaded this way to eliminate short-lived array slices
1091
+ * of the template instance values, and allow a fast-path for single-valued
1092
+ * parts.
1093
+ *
1094
+ * @param value The part value, or an array of values for multi-valued parts
1095
+ * @param valueIndex the index to start reading values from. `undefined` for
1096
+ * single-valued parts
1097
+ * @param noCommit causes the part to not commit its value to the DOM. Used
1098
+ * in hydration to prime attribute parts with their first-rendered value,
1099
+ * but not set the attribute, and in SSR to no-op the DOM operation and
1100
+ * capture the value for serialization.
1101
+ *
1102
+ * @internal
1103
+ */
1104
+ _$setValue(t, i = this, s, r) {
1105
+ const n = this.strings;
1106
+ let o = !1;
1107
+ if (n === void 0)
1108
+ t = it(this, t, i, 0), o = !mt(t) || t !== this._$committedValue && t !== W, o && (this._$committedValue = t);
1109
+ else {
1110
+ const l = t;
1111
+ t = n[0];
1112
+ let a, d;
1113
+ for (a = 0; a < n.length - 1; a++)
1114
+ d = it(this, l[s + a], i, a), d === W && (d = this._$committedValue[a]), o || (o = !mt(d) || d !== this._$committedValue[a]), d === _ ? t = _ : t !== _ && (t += (d ?? "") + n[a + 1]), this._$committedValue[a] = d;
1115
+ }
1116
+ o && !r && this._commitValue(t);
1117
+ }
1118
+ /** @internal */
1119
+ _commitValue(t) {
1120
+ t === _ ? S(this.element).removeAttribute(this.name) : (this._sanitizer === void 0 && (this._sanitizer = q(this.element, this.name, "attribute")), t = this._sanitizer(t ?? ""), c?.({
1121
+ kind: "commit attribute",
1122
+ element: this.element,
1123
+ name: this.name,
1124
+ value: t,
1125
+ options: this.options
1126
+ }), S(this.element).setAttribute(this.name, t ?? ""));
1127
+ }
1128
+ }
1129
+ class Wi extends Rt {
1130
+ constructor() {
1131
+ super(...arguments), this.type = Hi;
1132
+ }
1133
+ /** @internal */
1134
+ _commitValue(t) {
1135
+ this._sanitizer === void 0 && (this._sanitizer = q(this.element, this.name, "property")), t = this._sanitizer(t), c?.({
1136
+ kind: "commit property",
1137
+ element: this.element,
1138
+ name: this.name,
1139
+ value: t,
1140
+ options: this.options
1141
+ }), this.element[this.name] = t === _ ? void 0 : t;
1142
+ }
1143
+ }
1144
+ const qi = et ? et.emptyScript : "";
1145
+ class Fi extends Rt {
1146
+ constructor() {
1147
+ super(...arguments), this.type = Ui;
1148
+ }
1149
+ /** @internal */
1150
+ _commitValue(t) {
1151
+ c?.({
1152
+ kind: "commit boolean attribute",
1153
+ element: this.element,
1154
+ name: this.name,
1155
+ value: !!(t && t !== _),
1156
+ options: this.options
1157
+ }), t && t !== _ ? S(this.element).setAttribute(this.name, qi) : S(this.element).removeAttribute(this.name);
1158
+ }
1159
+ }
1160
+ class Gi extends Rt {
1161
+ constructor(t, i, s, r, n) {
1162
+ if (super(t, i, s, r, n), this.type = Vi, this.strings !== void 0)
1163
+ throw new Error(`A \`<${t.localName}>\` has a \`@${i}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`);
1164
+ }
1165
+ // EventPart does not use the base _$setValue/_resolveValue implementation
1166
+ // since the dirty checking is more complex
1167
+ /** @internal */
1168
+ _$setValue(t, i = this) {
1169
+ var s;
1170
+ if (t = (s = it(this, t, i, 0)) !== null && s !== void 0 ? s : _, t === W)
1171
+ return;
1172
+ const r = this._$committedValue, n = t === _ && r !== _ || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, o = t !== _ && (r === _ || n);
1173
+ c?.({
1174
+ kind: "commit event listener",
1175
+ element: this.element,
1176
+ name: this.name,
1177
+ value: t,
1178
+ options: this.options,
1179
+ removeListener: n,
1180
+ addListener: o,
1181
+ oldListener: r
1182
+ }), n && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, t), this._$committedValue = t;
1183
+ }
1184
+ handleEvent(t) {
1185
+ var i, s;
1186
+ typeof this._$committedValue == "function" ? this._$committedValue.call((s = (i = this.options) === null || i === void 0 ? void 0 : i.host) !== null && s !== void 0 ? s : this.element, t) : this._$committedValue.handleEvent(t);
1187
+ }
1188
+ }
1189
+ class Zi {
1190
+ constructor(t, i, s) {
1191
+ this.element = t, this.type = ve, this._$disconnectableChildren = void 0, this._$parent = i, this.options = s;
1192
+ }
1193
+ // See comment in Disconnectable interface for why this is a getter
1194
+ get _$isConnected() {
1195
+ return this._$parent._$isConnected;
1196
+ }
1197
+ _$setValue(t) {
1198
+ c?.({
1199
+ kind: "commit to element binding",
1200
+ element: this.element,
1201
+ value: t,
1202
+ options: this.options
1203
+ }), it(this, t);
1204
+ }
1205
+ }
1206
+ const Xt = k.litHtmlPolyfillSupportDevMode;
1207
+ Xt?.(ft, _t);
1208
+ ((Kt = k.litHtmlVersions) !== null && Kt !== void 0 ? Kt : k.litHtmlVersions = []).push("2.8.0");
1209
+ k.litHtmlVersions.length > 1 && St("multiple-versions", "Multiple versions of Lit loaded. Loading multiple versions is not recommended.");
1210
+ const kt = (e, t, i) => {
1211
+ var s, r;
1212
+ if (t == null)
1213
+ throw new TypeError(`The container to render into may not be ${t}`);
1214
+ const n = Si++, o = (s = i?.renderBefore) !== null && s !== void 0 ? s : t;
1215
+ let l = o._$litPart$;
1216
+ if (c?.({
1217
+ kind: "begin render",
1218
+ id: n,
1219
+ value: e,
1220
+ container: t,
1221
+ options: i,
1222
+ part: l
1223
+ }), l === void 0) {
1224
+ const a = (r = i?.renderBefore) !== null && r !== void 0 ? r : null;
1225
+ o._$litPart$ = l = new _t(t.insertBefore(pt(), a), a, void 0, i ?? {});
1226
+ }
1227
+ return l._$setValue(e), c?.({
1228
+ kind: "end render",
1229
+ id: n,
1230
+ value: e,
1231
+ container: t,
1232
+ options: i,
1233
+ part: l
1234
+ }), l;
1235
+ };
1236
+ kt.setSanitizer = Ti, kt.createSanitizer = ce, kt._testOnlyClearSanitizerFactoryDoNotCallOrElse = Ei;
1237
+ var te, ee, ie;
1238
+ let _e;
1239
+ {
1240
+ const e = (te = globalThis.litIssuedWarnings) !== null && te !== void 0 ? te : globalThis.litIssuedWarnings = /* @__PURE__ */ new Set();
1241
+ _e = (t, i) => {
1242
+ i += ` See https://lit.dev/msg/${t} for more information.`, e.has(i) || e.add(i);
1243
+ };
1244
+ }
1245
+ class A extends N {
1246
+ constructor() {
1247
+ super(...arguments), this.renderOptions = { host: this }, this.__childPart = void 0;
1248
+ }
1249
+ /**
1250
+ * @category rendering
1251
+ */
1252
+ createRenderRoot() {
1253
+ var t, i;
1254
+ const s = super.createRenderRoot();
1255
+ return (t = (i = this.renderOptions).renderBefore) !== null && t !== void 0 || (i.renderBefore = s.firstChild), s;
1256
+ }
1257
+ /**
1258
+ * Updates the element. This method reflects property values to attributes
1259
+ * and calls `render` to render DOM via lit-html. Setting properties inside
1260
+ * this method will *not* trigger another update.
1261
+ * @param changedProperties Map of changed properties with old values
1262
+ * @category updates
1263
+ */
1264
+ update(t) {
1265
+ const i = this.render();
1266
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this.__childPart = kt(i, this.renderRoot, this.renderOptions);
1267
+ }
1268
+ /**
1269
+ * Invoked when the component is added to the document's DOM.
1270
+ *
1271
+ * In `connectedCallback()` you should setup tasks that should only occur when
1272
+ * the element is connected to the document. The most common of these is
1273
+ * adding event listeners to nodes external to the element, like a keydown
1274
+ * event handler added to the window.
1275
+ *
1276
+ * ```ts
1277
+ * connectedCallback() {
1278
+ * super.connectedCallback();
1279
+ * addEventListener('keydown', this._handleKeydown);
1280
+ * }
1281
+ * ```
1282
+ *
1283
+ * Typically, anything done in `connectedCallback()` should be undone when the
1284
+ * element is disconnected, in `disconnectedCallback()`.
1285
+ *
1286
+ * @category lifecycle
1287
+ */
1288
+ connectedCallback() {
1289
+ var t;
1290
+ super.connectedCallback(), (t = this.__childPart) === null || t === void 0 || t.setConnected(!0);
1291
+ }
1292
+ /**
1293
+ * Invoked when the component is removed from the document's DOM.
1294
+ *
1295
+ * This callback is the main signal to the element that it may no longer be
1296
+ * used. `disconnectedCallback()` should ensure that nothing is holding a
1297
+ * reference to the element (such as event listeners added to nodes external
1298
+ * to the element), so that it is free to be garbage collected.
1299
+ *
1300
+ * ```ts
1301
+ * disconnectedCallback() {
1302
+ * super.disconnectedCallback();
1303
+ * window.removeEventListener('keydown', this._handleKeydown);
1304
+ * }
1305
+ * ```
1306
+ *
1307
+ * An element may be re-connected after being disconnected.
1308
+ *
1309
+ * @category lifecycle
1310
+ */
1311
+ disconnectedCallback() {
1312
+ var t;
1313
+ super.disconnectedCallback(), (t = this.__childPart) === null || t === void 0 || t.setConnected(!1);
1314
+ }
1315
+ /**
1316
+ * Invoked on each update to perform rendering tasks. This method may return
1317
+ * any value renderable by lit-html's `ChildPart` - typically a
1318
+ * `TemplateResult`. Setting properties inside this method will *not* trigger
1319
+ * the element to update.
1320
+ * @category rendering
1321
+ */
1322
+ render() {
1323
+ return W;
1324
+ }
1325
+ }
1326
+ A.finalized = !0;
1327
+ A._$litElement$ = !0;
1328
+ (ee = globalThis.litElementHydrateSupport) === null || ee === void 0 || ee.call(globalThis, { LitElement: A });
1329
+ const se = globalThis.litElementPolyfillSupportDevMode;
1330
+ se?.({ LitElement: A });
1331
+ A.finalize = function() {
1332
+ if (!N.finalize.call(this))
1333
+ return !1;
1334
+ const t = (i, s, r = !1) => {
1335
+ if (i.hasOwnProperty(s)) {
1336
+ const n = (typeof i == "function" ? i : i.constructor).name;
1337
+ _e(r ? "renamed-api" : "removed-api", `\`${s}\` is implemented on class ${n}. It has been ${r ? "renamed" : "removed"} in this version of LitElement.`);
1338
+ }
1339
+ };
1340
+ return t(this, "render"), t(this, "getStyles", !0), t(this.prototype, "adoptStyles"), !0;
1341
+ };
1342
+ ((ie = globalThis.litElementVersions) !== null && ie !== void 0 ? ie : globalThis.litElementVersions = []).push("3.3.3");
1343
+ globalThis.litElementVersions.length > 1 && _e("multiple-versions", "Multiple versions of Lit loaded. Loading multiple versions is not recommended.");
1344
+ const Yi = (e, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? {
1345
+ ...t,
1346
+ finisher(i) {
1347
+ i.createProperty(t.key, e);
1348
+ }
1349
+ } : {
1350
+ kind: "field",
1351
+ key: /* @__PURE__ */ Symbol(),
1352
+ placement: "own",
1353
+ descriptor: {},
1354
+ // store the original key so subsequent decorators have access to it.
1355
+ originalKey: t.key,
1356
+ // When @babel/plugin-proposal-decorators implements initializers,
1357
+ // do this instead of the initializer below. See:
1358
+ // https://github.com/babel/babel/issues/9260 extras: [
1359
+ // {
1360
+ // kind: 'initializer',
1361
+ // placement: 'own',
1362
+ // initializer: descriptor.initializer,
1363
+ // }
1364
+ // ],
1365
+ initializer() {
1366
+ typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
1367
+ },
1368
+ finisher(i) {
1369
+ i.createProperty(t.key, e);
1370
+ }
1371
+ }, Ki = (e, t, i) => {
1372
+ t.constructor.createProperty(i, e);
1373
+ };
1374
+ function v(e) {
1375
+ return (t, i) => i !== void 0 ? Ki(e, t, i) : Yi(e, t);
1376
+ }
1377
+ function H(e) {
1378
+ return v({
1379
+ ...e,
1380
+ state: !0
1381
+ });
1382
+ }
1383
+ var re;
1384
+ const Qi = window;
1385
+ ((re = Qi.HTMLSlotElement) === null || re === void 0 ? void 0 : re.prototype.assignedElements) != null;
1386
+ const Ji = {
1387
+ CHILD: 2
1388
+ }, Xi = (e) => (...t) => ({
1389
+ // This property needs to remain unminified.
1390
+ _$litDirective$: e,
1391
+ values: t
1392
+ });
1393
+ class ts {
1394
+ constructor(t) {
1395
+ }
1396
+ // See comment in Disconnectable interface for why this is a getter
1397
+ get _$isConnected() {
1398
+ return this._$parent._$isConnected;
1399
+ }
1400
+ /** @internal */
1401
+ _$initialize(t, i, s) {
1402
+ this.__part = t, this._$parent = i, this.__attributeIndex = s;
1403
+ }
1404
+ /** @internal */
1405
+ _$resolve(t, i) {
1406
+ return this.update(t, i);
1407
+ }
1408
+ update(t, i) {
1409
+ return this.render(...i);
1410
+ }
1411
+ }
1412
+ const es = 1;
1413
+ class be extends ts {
1414
+ constructor(t) {
1415
+ if (super(t), this._value = _, t.type !== Ji.CHILD)
1416
+ throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
1417
+ }
1418
+ render(t) {
1419
+ if (t === _ || t == null)
1420
+ return this._templateResult = void 0, this._value = t;
1421
+ if (t === W)
1422
+ return t;
1423
+ if (typeof t != "string")
1424
+ throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
1425
+ if (t === this._value)
1426
+ return this._templateResult;
1427
+ this._value = t;
1428
+ const i = [t];
1429
+ return i.raw = i, this._templateResult = {
1430
+ // Cast to a known set of integers that satisfy ResultType so that we
1431
+ // don't have to export ResultType and possibly encourage this pattern.
1432
+ // This property needs to remain unminified.
1433
+ _$litType$: this.constructor.resultType,
1434
+ strings: i,
1435
+ values: []
1436
+ };
1437
+ }
1438
+ }
1439
+ be.directiveName = "unsafeHTML";
1440
+ be.resultType = es;
1441
+ const is = Xi(be);
1442
+ const C = {
1443
+ INITIAL: 0,
1444
+ PENDING: 1,
1445
+ COMPLETE: 2,
1446
+ ERROR: 3
1447
+ }, ss = /* @__PURE__ */ Symbol();
1448
+ class rs {
1449
+ /**
1450
+ * A Promise that resolve when the current task run is complete.
1451
+ *
1452
+ * If a new task run is started while a previous run is pending, the Promise
1453
+ * is kept and only resolved when the new run is completed.
1454
+ */
1455
+ get taskComplete() {
1456
+ return this._taskComplete ? this._taskComplete : (this._status === C.PENDING ? this._taskComplete = new Promise((t, i) => {
1457
+ this._resolveTaskComplete = t, this._rejectTaskComplete = i;
1458
+ }) : this._status === C.ERROR ? this._taskComplete = Promise.reject(this._error) : this._taskComplete = Promise.resolve(this._value), this._taskComplete);
1459
+ }
1460
+ constructor(t, i, s) {
1461
+ this._callId = 0, this._status = C.INITIAL, (this._host = t).addController(this);
1462
+ const r = typeof i == "object" ? i : { task: i, args: s };
1463
+ this._task = r.task, this._argsFn = r.args, this._argsEqual = r.argsEqual ?? ns, this._onComplete = r.onComplete, this._onError = r.onError, this.autoRun = r.autoRun ?? !0, "initialValue" in r && (this._value = r.initialValue, this._status = C.COMPLETE, this._previousArgs = this._getArgs?.());
1464
+ }
1465
+ hostUpdate() {
1466
+ this.autoRun === !0 && this._performTask();
1467
+ }
1468
+ hostUpdated() {
1469
+ this.autoRun === "afterUpdate" && this._performTask();
1470
+ }
1471
+ _getArgs() {
1472
+ if (this._argsFn === void 0)
1473
+ return;
1474
+ const t = this._argsFn();
1475
+ if (!Array.isArray(t))
1476
+ throw new Error("The args function must return an array");
1477
+ return t;
1478
+ }
1479
+ /**
1480
+ * Determines if the task should run when it's triggered because of a
1481
+ * host update, and runs the task if it should.
1482
+ *
1483
+ * A task should run when its arguments change from the previous run, based on
1484
+ * the args equality function.
1485
+ *
1486
+ * This method is side-effectful: it stores the new args as the previous args.
1487
+ */
1488
+ async _performTask() {
1489
+ const t = this._getArgs(), i = this._previousArgs;
1490
+ this._previousArgs = t, t !== i && t !== void 0 && (i === void 0 || !this._argsEqual(i, t)) && await this.run(t);
1491
+ }
1492
+ /**
1493
+ * Runs a task manually.
1494
+ *
1495
+ * This can be useful for running tasks in response to events as opposed to
1496
+ * automatically running when host element state changes.
1497
+ *
1498
+ * @param args an optional set of arguments to use for this task run. If args
1499
+ * is not given, the args function is called to get the arguments for
1500
+ * this run.
1501
+ */
1502
+ async run(t) {
1503
+ t ??= this._getArgs(), this._previousArgs = t, this._status === C.PENDING ? this._abortController?.abort() : (this._taskComplete = void 0, this._resolveTaskComplete = void 0, this._rejectTaskComplete = void 0), this._status = C.PENDING;
1504
+ let i, s;
1505
+ this.autoRun === "afterUpdate" ? queueMicrotask(() => this._host.requestUpdate()) : this._host.requestUpdate();
1506
+ const r = ++this._callId;
1507
+ this._abortController = new AbortController();
1508
+ let n = !1;
1509
+ try {
1510
+ i = await this._task(t, { signal: this._abortController.signal });
1511
+ } catch (o) {
1512
+ n = !0, s = o;
1513
+ }
1514
+ if (this._callId === r) {
1515
+ if (i === ss)
1516
+ this._status = C.INITIAL;
1517
+ else {
1518
+ if (n === !1) {
1519
+ try {
1520
+ this._onComplete?.(i);
1521
+ } catch {
1522
+ }
1523
+ this._status = C.COMPLETE, this._resolveTaskComplete?.(i);
1524
+ } else {
1525
+ try {
1526
+ this._onError?.(s);
1527
+ } catch {
1528
+ }
1529
+ this._status = C.ERROR, this._rejectTaskComplete?.(s);
1530
+ }
1531
+ this._value = i, this._error = s;
1532
+ }
1533
+ this._host.requestUpdate();
1534
+ }
1535
+ }
1536
+ /**
1537
+ * Aborts the currently pending task run by aborting the AbortSignal
1538
+ * passed to the task function.
1539
+ *
1540
+ * Aborting a task does nothing if the task is not running: ie, in the
1541
+ * complete, error, or initial states.
1542
+ *
1543
+ * Aborting a task does not automatically cancel the task function. The task
1544
+ * function must be written to accept the AbortSignal and either forward it
1545
+ * to other APIs like `fetch()`, or handle cancellation manually by using
1546
+ * [`signal.throwIfAborted()`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted}
1547
+ * or the
1548
+ * [`abort`]{@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event}
1549
+ * event.
1550
+ *
1551
+ * @param reason The reason for aborting. Passed to
1552
+ * `AbortController.abort()`.
1553
+ */
1554
+ abort(t) {
1555
+ this._status === C.PENDING && this._abortController?.abort(t);
1556
+ }
1557
+ /**
1558
+ * The result of the previous task run, if it resolved.
1559
+ *
1560
+ * Is `undefined` if the task has not run yet, or if the previous run errored.
1561
+ */
1562
+ get value() {
1563
+ return this._value;
1564
+ }
1565
+ /**
1566
+ * The error from the previous task run, if it rejected.
1567
+ *
1568
+ * Is `undefined` if the task has not run yet, or if the previous run
1569
+ * completed successfully.
1570
+ */
1571
+ get error() {
1572
+ return this._error;
1573
+ }
1574
+ get status() {
1575
+ return this._status;
1576
+ }
1577
+ render(t) {
1578
+ switch (this._status) {
1579
+ case C.INITIAL:
1580
+ return t.initial?.();
1581
+ case C.PENDING:
1582
+ return t.pending?.();
1583
+ case C.COMPLETE:
1584
+ return t.complete?.(this.value);
1585
+ case C.ERROR:
1586
+ return t.error?.(this.error);
1587
+ default:
1588
+ throw new Error(`Unexpected status: ${this._status}`);
1589
+ }
1590
+ }
1591
+ }
1592
+ const ns = (e, t) => e === t || e.length === t.length && e.every((i, s) => !fe(i, t[s]));
1593
+ var ne, Ue;
1594
+ function os() {
1595
+ if (Ue) return ne;
1596
+ Ue = 1;
1597
+ var e = "Expected a function", t = NaN, i = "[object Symbol]", s = /^\s+|\s+$/g, r = /^[-+]0x[0-9a-f]+$/i, n = /^0b[01]+$/i, o = /^0o[0-7]+$/i, l = parseInt, a = typeof wt == "object" && wt && wt.Object === Object && wt, d = typeof self == "object" && self && self.Object === Object && self, h = a || d || Function("return this")(), u = Object.prototype, p = u.toString, g = Math.max, E = Math.min, nt = function() {
1598
+ return h.Date.now();
1599
+ };
1600
+ function Q(m, x, I) {
1601
+ var J, ot, yt, X, T, U, at = 0, we = !1, lt = !1, Ut = !0;
1602
+ if (typeof m != "function")
1603
+ throw new TypeError(e);
1604
+ x = $e(x) || 0, Ht(I) && (we = !!I.leading, lt = "maxWait" in I, yt = lt ? g($e(I.maxWait) || 0, x) : yt, Ut = "trailing" in I ? !!I.trailing : Ut);
1605
+ function Vt(b) {
1606
+ var z = J, dt = ot;
1607
+ return J = ot = void 0, at = b, X = m.apply(dt, z), X;
1608
+ }
1609
+ function ui(b) {
1610
+ return at = b, T = setTimeout($t, x), we ? Vt(b) : X;
1611
+ }
1612
+ function pi(b) {
1613
+ var z = b - U, dt = b - at, ke = x - z;
1614
+ return lt ? E(ke, yt - dt) : ke;
1615
+ }
1616
+ function xe(b) {
1617
+ var z = b - U, dt = b - at;
1618
+ return U === void 0 || z >= x || z < 0 || lt && dt >= yt;
1619
+ }
1620
+ function $t() {
1621
+ var b = nt();
1622
+ if (xe(b))
1623
+ return Ce(b);
1624
+ T = setTimeout($t, pi(b));
1625
+ }
1626
+ function Ce(b) {
1627
+ return T = void 0, Ut && J ? Vt(b) : (J = ot = void 0, X);
1628
+ }
1629
+ function mi() {
1630
+ T !== void 0 && clearTimeout(T), at = 0, J = U = ot = T = void 0;
1631
+ }
1632
+ function fi() {
1633
+ return T === void 0 ? X : Ce(nt());
1634
+ }
1635
+ function Dt() {
1636
+ var b = nt(), z = xe(b);
1637
+ if (J = arguments, ot = this, U = b, z) {
1638
+ if (T === void 0)
1639
+ return ui(U);
1640
+ if (lt)
1641
+ return T = setTimeout($t, x), Vt(U);
1642
+ }
1643
+ return T === void 0 && (T = setTimeout($t, x)), X;
1644
+ }
1645
+ return Dt.cancel = mi, Dt.flush = fi, Dt;
1646
+ }
1647
+ function Ht(m) {
1648
+ var x = typeof m;
1649
+ return !!m && (x == "object" || x == "function");
1650
+ }
1651
+ function ci(m) {
1652
+ return !!m && typeof m == "object";
1653
+ }
1654
+ function hi(m) {
1655
+ return typeof m == "symbol" || ci(m) && p.call(m) == i;
1656
+ }
1657
+ function $e(m) {
1658
+ if (typeof m == "number")
1659
+ return m;
1660
+ if (hi(m))
1661
+ return t;
1662
+ if (Ht(m)) {
1663
+ var x = typeof m.valueOf == "function" ? m.valueOf() : m;
1664
+ m = Ht(x) ? x + "" : x;
1665
+ }
1666
+ if (typeof m != "string")
1667
+ return m === 0 ? m : +m;
1668
+ m = m.replace(s, "");
1669
+ var I = n.test(m);
1670
+ return I || o.test(m) ? l(m.slice(2), I ? 2 : 8) : r.test(m) ? t : +m;
1671
+ }
1672
+ return ne = Q, ne;
1673
+ }
1674
+ var as = os();
1675
+ const ls = /* @__PURE__ */ gi(as);
1676
+ var ds = Object.defineProperty, f = (e, t, i, s) => {
1677
+ for (var r = void 0, n = e.length - 1, o; n >= 0; n--) (o = e[n]) && (r = o(t, i, r) || r);
1678
+ return r && ds(t, i, r), r;
1679
+ }, G = (e = "", t) => {
1680
+ customElements.get(e) || customElements.define(e, t);
1681
+ }, Ve = (e, t) => [...e].reduce((i, s) => t?.skip?.includes(s.name) ? i : `${i}${s.name}="${s.value}" `, ""), bt = class extends A {
1682
+ constructor() {
1683
+ super(...arguments), this.name = "", this.fallbackTag = null, this.defaultStyle = null, this.refElement = null;
1684
+ }
1685
+ connectedCallback() {
1686
+ super.connectedCallback();
1687
+ let e = this;
1688
+ for (; e.parentNode; )
1689
+ e = e.parentNode;
1690
+ if (this.refElement = e.host.querySelector(`[refElement="${this.name}"]`), this.refElement && this.fallbackTag !== null && this.refElement.tagName.toLowerCase() !== this.fallbackTag)
1691
+ throw new Error(`Your html tag to customize ${this.name} should be <${this.fallbackTag}></<${this.fallbackTag}>`);
1692
+ }
1693
+ render() {
1694
+ const e = Ve(this.attributes, { skip: ["name", "fallbacktag"] }), t = Ve(this.refElement?.attributes ?? []);
1695
+ return w`${is(`
1696
+ <style>${this.defaultStyle}</style>
1697
+ <${this.fallbackTag} ${e} ${t}>
1698
+ <slot></slot>
1699
+ </${this.fallbackTag}>`)}`;
1700
+ }
1701
+ };
1702
+ f([v()], bt.prototype, "name");
1703
+ f([v({ type: String || null })], bt.prototype, "fallbackTag");
1704
+ f([v({ type: String || null })], bt.prototype, "defaultStyle");
1705
+ f([v({ type: String || null })], bt.prototype, "refElement");
1706
+ G("appcues-use-ref", bt);
1707
+ var cs = () => {
1708
+ let e = {};
1709
+ const t = window.AppcuesSettings?.userIdSignature;
1710
+ return t && (e = { Authorization: `Bearer ${t}` }), e;
1711
+ }, hs = async (e, t) => {
1712
+ const i = cs();
1713
+ return await fetch(e, { headers: i, ...t });
1714
+ }, us = "https://api.appcues.net/v1/", ps = y`
1715
+ .container {
1716
+ background: #fff;
1717
+ box-shadow: var(--flows-list-block-shadow);
1718
+ border-radius: var(--flows-list-block-radius);
1719
+ padding: 8px 0;
1720
+ width: 100%;
1721
+ }
1722
+
1723
+ .container .loading,
1724
+ .container .error-message {
1725
+ align-items: center;
1726
+ color: var(--flows-list-block-color);
1727
+ display: flex;
1728
+ font-size: 14px;
1729
+ font-style: normal;
1730
+ font-weight: 400;
1731
+ justify-content: center;
1732
+ line-height: 160%;
1733
+ padding: 16px;
1734
+ text-align: center;
1735
+ }
1736
+ `, ms = y`
1737
+ slot[name='empty-message'],
1738
+ ::slotted(p[slot='empty-message']) {
1739
+ align-items: center;
1740
+ color: var(--flows-list-block-color);
1741
+ display: flex;
1742
+ font-style: normal;
1743
+ font-weight: 400;
1744
+ justify-content: center;
1745
+ line-height: 160%;
1746
+ padding: 16px;
1747
+ text-align: center;
1748
+ font-size: 14px;
1749
+ }
1750
+ `, fs = y`
1751
+ ul {
1752
+ list-style-type: square;
1753
+ list-style-position: inside;
1754
+ margin: 0;
1755
+ padding: 0 4px;
1756
+ }
1757
+ `, gs = y`
1758
+ li {
1759
+ cursor: pointer;
1760
+ font-size: 14px;
1761
+ font-style: normal;
1762
+ font-weight: 400;
1763
+ line-height: 160%;
1764
+ padding: 8px 16px;
1765
+ border-radius: var(--flows-list-block-item-radius);
1766
+ transition: background-color 0.3s ease 0s;
1767
+ }
1768
+
1769
+ li:hover {
1770
+ background-color: var(--flows-list-block-background-hover);
1771
+ }
1772
+
1773
+ li::marker {
1774
+ color: var(--flows-list-block-marker-color);
1775
+ }
1776
+
1777
+ li:hover > span {
1778
+ background-color: var(--flows-list-block-background-hover);
1779
+ }
1780
+
1781
+ li > span {
1782
+ color: var(--flows-list-block-color);
1783
+ }
1784
+
1785
+ li appcues-use-ref {
1786
+ display: inline-flex;
1787
+ max-width: calc(100% - 20px);
1788
+ }
1789
+ `, vs = y`
1790
+ ::slotted(h1[slot='title']),
1791
+ ::slotted(h2[slot='title']),
1792
+ ::slotted(h3[slot='title']) {
1793
+ color: var(--flows-list-block-color);
1794
+ font-size: 15px;
1795
+ font-weight: 700;
1796
+ line-height: 24px;
1797
+ margin: 0 0 8px;
1798
+ padding: 0 16px 0;
1799
+
1800
+ display: -webkit-box;
1801
+ -webkit-box-orient: vertical;
1802
+ -webkit-line-clamp: 2;
1803
+ max-height: 48px;
1804
+ max-width: calc(100% - 32px);
1805
+ overflow: hidden;
1806
+ text-overflow: ellipsis;
1807
+ white-space: normal;
1808
+ }
1809
+ `, oe, Et = window, st = Et.trustedTypes, De = st ? st.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ue = "$lit$", O = `lit$${(Math.random() + "").slice(9)}$`, ni = "?" + O, _s = `<${ni}>`, F = document, Pt = () => F.createComment(""), gt = (e) => e === null || typeof e != "object" && typeof e != "function", oi = Array.isArray, bs = (e) => oi(e) || typeof e?.[Symbol.iterator] == "function", ae = `[
1810
+ \f\r]`, ht = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, je = /-->/g, Be = />/g, V = RegExp(`>|${ae}(?:([^\\s"'>=/]+)(${ae}*=${ae}*(?:[^
1811
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), We = /'/g, qe = /"/g, ai = /^(?:script|style|textarea|title)$/i, li = (e) => (t, ...i) => ({ _$litType$: e, strings: t, values: i }), ut = li(1), Mt = li(2), vt = /* @__PURE__ */ Symbol.for("lit-noChange"), $ = /* @__PURE__ */ Symbol.for("lit-nothing"), Fe = /* @__PURE__ */ new WeakMap(), j = F.createTreeWalker(F, 129, null, !1);
1812
+ function di(e, t) {
1813
+ if (!Array.isArray(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
1814
+ return De !== void 0 ? De.createHTML(t) : t;
1815
+ }
1816
+ var ys = (e, t) => {
1817
+ const i = e.length - 1, s = [];
1818
+ let r, n = t === 2 ? "<svg>" : "", o = ht;
1819
+ for (let l = 0; l < i; l++) {
1820
+ const a = e[l];
1821
+ let d, h, u = -1, p = 0;
1822
+ for (; p < a.length && (o.lastIndex = p, h = o.exec(a), h !== null); ) p = o.lastIndex, o === ht ? h[1] === "!--" ? o = je : h[1] !== void 0 ? o = Be : h[2] !== void 0 ? (ai.test(h[2]) && (r = RegExp("</" + h[2], "g")), o = V) : h[3] !== void 0 && (o = V) : o === V ? h[0] === ">" ? (o = r ?? ht, u = -1) : h[1] === void 0 ? u = -2 : (u = o.lastIndex - h[2].length, d = h[1], o = h[3] === void 0 ? V : h[3] === '"' ? qe : We) : o === qe || o === We ? o = V : o === je || o === Be ? o = ht : (o = V, r = void 0);
1823
+ const g = o === V && e[l + 1].startsWith("/>") ? " " : "";
1824
+ n += o === ht ? a + _s : u >= 0 ? (s.push(d), a.slice(0, u) + ue + a.slice(u) + O + g) : a + O + (u === -2 ? (s.push(void 0), l) : g);
1825
+ }
1826
+ return [di(e, n + (e[i] || "<?>") + (t === 2 ? "</svg>" : "")), s];
1827
+ }, Nt = class {
1828
+ constructor({ strings: e, _$litType$: t }, i) {
1829
+ let s;
1830
+ this.parts = [];
1831
+ let r = 0, n = 0;
1832
+ const o = e.length - 1, l = this.parts, [a, d] = ys(e, t);
1833
+ if (this.el = Nt.createElement(a, i), j.currentNode = this.el.content, t === 2) {
1834
+ const h = this.el.content, u = h.firstChild;
1835
+ u.remove(), h.append(...u.childNodes);
1836
+ }
1837
+ for (; (s = j.nextNode()) !== null && l.length < o; ) {
1838
+ if (s.nodeType === 1) {
1839
+ if (s.hasAttributes()) {
1840
+ const h = [];
1841
+ for (const u of s.getAttributeNames()) if (u.endsWith(ue) || u.startsWith(O)) {
1842
+ const p = d[n++];
1843
+ if (h.push(u), p !== void 0) {
1844
+ const g = s.getAttribute(p.toLowerCase() + ue).split(O), E = /([.?@])?(.*)/.exec(p);
1845
+ l.push({ type: 1, index: r, name: E[2], strings: g, ctor: E[1] === "." ? ws : E[1] === "?" ? Cs : E[1] === "@" ? ks : zt });
1846
+ } else l.push({ type: 6, index: r });
1847
+ }
1848
+ for (const u of h) s.removeAttribute(u);
1849
+ }
1850
+ if (ai.test(s.tagName)) {
1851
+ const h = s.textContent.split(O), u = h.length - 1;
1852
+ if (u > 0) {
1853
+ s.textContent = st ? st.emptyScript : "";
1854
+ for (let p = 0; p < u; p++) s.append(h[p], Pt()), j.nextNode(), l.push({ type: 2, index: ++r });
1855
+ s.append(h[u], Pt());
1856
+ }
1857
+ }
1858
+ } else if (s.nodeType === 8) if (s.data === ni) l.push({ type: 2, index: r });
1859
+ else {
1860
+ let h = -1;
1861
+ for (; (h = s.data.indexOf(O, h + 1)) !== -1; ) l.push({ type: 7, index: r }), h += O.length - 1;
1862
+ }
1863
+ r++;
1864
+ }
1865
+ }
1866
+ static createElement(e, t) {
1867
+ const i = F.createElement("template");
1868
+ return i.innerHTML = e, i;
1869
+ }
1870
+ };
1871
+ function rt(e, t, i = e, s) {
1872
+ var r, n, o, l;
1873
+ if (t === vt) return t;
1874
+ let a = s !== void 0 ? (r = i._$Co) === null || r === void 0 ? void 0 : r[s] : i._$Cl;
1875
+ const d = gt(t) ? void 0 : t._$litDirective$;
1876
+ return a?.constructor !== d && ((n = a?._$AO) === null || n === void 0 || n.call(a, !1), d === void 0 ? a = void 0 : (a = new d(e), a._$AT(e, i, s)), s !== void 0 ? ((o = (l = i)._$Co) !== null && o !== void 0 ? o : l._$Co = [])[s] = a : i._$Cl = a), a !== void 0 && (t = rt(e, a._$AS(e, t.values), a, s)), t;
1877
+ }
1878
+ var $s = class {
1879
+ constructor(e, t) {
1880
+ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
1881
+ }
1882
+ get parentNode() {
1883
+ return this._$AM.parentNode;
1884
+ }
1885
+ get _$AU() {
1886
+ return this._$AM._$AU;
1887
+ }
1888
+ u(e) {
1889
+ var t;
1890
+ const { el: { content: i }, parts: s } = this._$AD, r = ((t = e?.creationScope) !== null && t !== void 0 ? t : F).importNode(i, !0);
1891
+ j.currentNode = r;
1892
+ let n = j.nextNode(), o = 0, l = 0, a = s[0];
1893
+ for (; a !== void 0; ) {
1894
+ if (o === a.index) {
1895
+ let d;
1896
+ a.type === 2 ? d = new ye(n, n.nextSibling, this, e) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, e) : a.type === 6 && (d = new Ss(n, this, e)), this._$AV.push(d), a = s[++l];
1897
+ }
1898
+ o !== a?.index && (n = j.nextNode(), o++);
1899
+ }
1900
+ return j.currentNode = F, r;
1901
+ }
1902
+ v(e) {
1903
+ let t = 0;
1904
+ for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++;
1905
+ }
1906
+ }, ye = class {
1907
+ constructor(e, t, i, s) {
1908
+ var r;
1909
+ this.type = 2, this._$AH = $, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cp = (r = s?.isConnected) === null || r === void 0 || r;
1910
+ }
1911
+ get _$AU() {
1912
+ var e, t;
1913
+ return (t = (e = this._$AM) === null || e === void 0 ? void 0 : e._$AU) !== null && t !== void 0 ? t : this._$Cp;
1914
+ }
1915
+ get parentNode() {
1916
+ let e = this._$AA.parentNode;
1917
+ const t = this._$AM;
1918
+ return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
1919
+ }
1920
+ get startNode() {
1921
+ return this._$AA;
1922
+ }
1923
+ get endNode() {
1924
+ return this._$AB;
1925
+ }
1926
+ _$AI(e, t = this) {
1927
+ e = rt(this, e, t), gt(e) ? e === $ || e == null || e === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : e !== this._$AH && e !== vt && this._(e) : e._$litType$ !== void 0 ? this.g(e) : e.nodeType !== void 0 ? this.$(e) : bs(e) ? this.T(e) : this._(e);
1928
+ }
1929
+ k(e) {
1930
+ return this._$AA.parentNode.insertBefore(e, this._$AB);
1931
+ }
1932
+ $(e) {
1933
+ this._$AH !== e && (this._$AR(), this._$AH = this.k(e));
1934
+ }
1935
+ _(e) {
1936
+ this._$AH !== $ && gt(this._$AH) ? this._$AA.nextSibling.data = e : this.$(F.createTextNode(e)), this._$AH = e;
1937
+ }
1938
+ g(e) {
1939
+ var t;
1940
+ const { values: i, _$litType$: s } = e, r = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = Nt.createElement(di(s.h, s.h[0]), this.options)), s);
1941
+ if (((t = this._$AH) === null || t === void 0 ? void 0 : t._$AD) === r) this._$AH.v(i);
1942
+ else {
1943
+ const n = new $s(r, this), o = n.u(this.options);
1944
+ n.v(i), this.$(o), this._$AH = n;
1945
+ }
1946
+ }
1947
+ _$AC(e) {
1948
+ let t = Fe.get(e.strings);
1949
+ return t === void 0 && Fe.set(e.strings, t = new Nt(e)), t;
1950
+ }
1951
+ T(e) {
1952
+ oi(this._$AH) || (this._$AH = [], this._$AR());
1953
+ const t = this._$AH;
1954
+ let i, s = 0;
1955
+ for (const r of e) s === t.length ? t.push(i = new ye(this.k(Pt()), this.k(Pt()), this, this.options)) : i = t[s], i._$AI(r), s++;
1956
+ s < t.length && (this._$AR(i && i._$AB.nextSibling, s), t.length = s);
1957
+ }
1958
+ _$AR(e = this._$AA.nextSibling, t) {
1959
+ var i;
1960
+ for ((i = this._$AP) === null || i === void 0 || i.call(this, !1, !0, t); e && e !== this._$AB; ) {
1961
+ const s = e.nextSibling;
1962
+ e.remove(), e = s;
1963
+ }
1964
+ }
1965
+ setConnected(e) {
1966
+ var t;
1967
+ this._$AM === void 0 && (this._$Cp = e, (t = this._$AP) === null || t === void 0 || t.call(this, e));
1968
+ }
1969
+ }, zt = class {
1970
+ constructor(e, t, i, s, r) {
1971
+ this.type = 1, this._$AH = $, this._$AN = void 0, this.element = e, this.name = t, this._$AM = s, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = $;
1972
+ }
1973
+ get tagName() {
1974
+ return this.element.tagName;
1975
+ }
1976
+ get _$AU() {
1977
+ return this._$AM._$AU;
1978
+ }
1979
+ _$AI(e, t = this, i, s) {
1980
+ const r = this.strings;
1981
+ let n = !1;
1982
+ if (r === void 0) e = rt(this, e, t, 0), n = !gt(e) || e !== this._$AH && e !== vt, n && (this._$AH = e);
1983
+ else {
1984
+ const o = e;
1985
+ let l, a;
1986
+ for (e = r[0], l = 0; l < r.length - 1; l++) a = rt(this, o[i + l], t, l), a === vt && (a = this._$AH[l]), n || (n = !gt(a) || a !== this._$AH[l]), a === $ ? e = $ : e !== $ && (e += (a ?? "") + r[l + 1]), this._$AH[l] = a;
1987
+ }
1988
+ n && !s && this.j(e);
1989
+ }
1990
+ j(e) {
1991
+ e === $ ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1992
+ }
1993
+ }, ws = class extends zt {
1994
+ constructor() {
1995
+ super(...arguments), this.type = 3;
1996
+ }
1997
+ j(e) {
1998
+ this.element[this.name] = e === $ ? void 0 : e;
1999
+ }
2000
+ }, xs = st ? st.emptyScript : "", Cs = class extends zt {
2001
+ constructor() {
2002
+ super(...arguments), this.type = 4;
2003
+ }
2004
+ j(e) {
2005
+ e && e !== $ ? this.element.setAttribute(this.name, xs) : this.element.removeAttribute(this.name);
2006
+ }
2007
+ }, ks = class extends zt {
2008
+ constructor(e, t, i, s, r) {
2009
+ super(e, t, i, s, r), this.type = 5;
2010
+ }
2011
+ _$AI(e, t = this) {
2012
+ var i;
2013
+ if ((e = (i = rt(this, e, t, 0)) !== null && i !== void 0 ? i : $) === vt) return;
2014
+ const s = this._$AH, r = e === $ && s !== $ || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, n = e !== $ && (s === $ || r);
2015
+ r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
2016
+ }
2017
+ handleEvent(e) {
2018
+ var t, i;
2019
+ typeof this._$AH == "function" ? this._$AH.call((i = (t = this.options) === null || t === void 0 ? void 0 : t.host) !== null && i !== void 0 ? i : this.element, e) : this._$AH.handleEvent(e);
2020
+ }
2021
+ }, Ss = class {
2022
+ constructor(e, t, i) {
2023
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = i;
2024
+ }
2025
+ get _$AU() {
2026
+ return this._$AM._$AU;
2027
+ }
2028
+ _$AI(e) {
2029
+ rt(this, e);
2030
+ }
2031
+ }, Ge = Et.litHtmlPolyfillSupport;
2032
+ Ge?.(Nt, ye), ((oe = Et.litHtmlVersions) !== null && oe !== void 0 ? oe : Et.litHtmlVersions = []).push("2.8.0");
2033
+ var As = Mt`
2034
+ <svg
2035
+ version="1.1"
2036
+ xmlns="http://www.w3.org/2000/svg"
2037
+ xmlns:xlink="http://www.w3.org/1999/xlink"
2038
+ x="0px"
2039
+ y="0px"
2040
+ width="40px"
2041
+ height="40px"
2042
+ fill="#0072D6"
2043
+ viewBox="0 0 40 40"
2044
+ enable-background="new 0 0 40 40"
2045
+ xml:space="preserve"
2046
+ >
2047
+ <path
2048
+ opacity="0.2"
2049
+ fill="#0072D6"
2050
+ d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
2051
+ s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
2052
+ c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"
2053
+ />
2054
+ <path
2055
+ fill="#0072D6"
2056
+ d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
2057
+ C22.32,8.481,24.301,9.057,26.013,10.047z"
2058
+ >
2059
+ <animateTransform
2060
+ attributeType="xml"
2061
+ attributeName="transform"
2062
+ type="rotate"
2063
+ from="0 20 20"
2064
+ to="360 20 20"
2065
+ keySplines="0.17 0.27 0.8 0.65"
2066
+ calcMode="spline"
2067
+ dur="0.6s"
2068
+ repeatCount="indefinite"
2069
+ keyTimes="0;1"
2070
+ />
2071
+ </path>
2072
+ </svg>
2073
+ `, Ts = JSON.stringify([{ id: "1", name: "Item 1", publicName: "Item 1 public lorem ipsum dolor lorem impsum" }, { id: "2", name: "Item 2" }, { id: "3", name: "Item 3" }, { id: "4", name: "Item 4" }, { id: "5", name: "Item 5" }]), Es = async ({ accountId: e, userId: t }, i) => {
2074
+ if (!e || !t)
2075
+ return [];
2076
+ const s = window.location.href, r = new URL(`${us}/accounts/${e}/users/${t}/widget`);
2077
+ return r.searchParams.set("url", s), r.searchParams.set("order_by", i), (await hs(r.toString())).json();
2078
+ }, Z = class extends A {
2079
+ constructor() {
2080
+ super(...arguments), this.listItems = [], this.orderBy = "sort_order", this.limit = 5, this.listMock = Ts, this.mode = "live", this.fetchListItems = async () => {
2081
+ if (this.mode === "preview")
2082
+ return this.listItems = JSON.parse(this.listMock), JSON.parse(this.listMock);
2083
+ const e = await Appcues?.user() ?? {}, { contents: t } = await Es({ accountId: AppcuesBundleSettings?.accountId, userId: e?.userId }, this.orderBy), i = t.map(({ id: s, name: r, public_name: n }) => ({ id: s, name: r, publicName: n }));
2084
+ return this.listItems = i, i;
2085
+ }, this.getListItems = new rs(this, { task: this.fetchListItems, args: () => [] }), this.handleItemClick = (e) => () => {
2086
+ const t = new CustomEvent("flow-item-clicked", { detail: this.listItems.find((i) => i.id === e), bubbles: !0, composed: !0 });
2087
+ this.dispatchEvent(t);
2088
+ }, this.handleItemHover = (e) => () => {
2089
+ const t = new CustomEvent("flow-item-hovered", { detail: this.listItems.find((i) => i.id === e), bubbles: !0, composed: !0 });
2090
+ this.dispatchEvent(t);
2091
+ }, this.containerTemplate = (e) => w`
2092
+ <appcues-use-ref
2093
+ name="list-container"
2094
+ fallbackTag="ul"
2095
+ defaultStyle=${fs}
2096
+ >
2097
+ ${e.slice(0, this.limit).map(this.itemTemplate)}
2098
+ </appcues-use-ref>
2099
+ `, this.itemTemplate = (e) => w`
2100
+ <li
2101
+ @click="${this.handleItemClick(e.id)}"
2102
+ @mouseover="${this.handleItemHover(e.id)}"
2103
+ >
2104
+ <appcues-use-ref fallbackTag="span" name="list-item">
2105
+ ${e.publicName ?? e.name}
2106
+ </appcues-use-ref>
2107
+ </li>
2108
+ `, this.emptyMessageTemplate = w`
2109
+ <slot name="empty-message">
2110
+ <p>Nothing to see here at the moment</p>
2111
+ </slot>
2112
+ `;
2113
+ }
2114
+ connectedCallback() {
2115
+ super.connectedCallback(), this.mode !== "live" && new MutationObserver((t) => {
2116
+ t.forEach((i) => {
2117
+ const [s] = i.addedNodes;
2118
+ (i.type === "attributes" || s && ["UL", "LI", "SPAN"].includes(s.nodeName)) && this.getListItems.run();
2119
+ });
2120
+ }).observe(this, { childList: !0, subtree: !0, attributes: !0 });
2121
+ }
2122
+ render() {
2123
+ return w`
2124
+ <div class="container">
2125
+ <slot name="title"></slot>
2126
+ ${this.getListItems.render({ pending: () => w`<div class="loading">${As}</div>`, complete: (e) => e.slice(0, this.limit).length === 0 ? this.emptyMessageTemplate : this.containerTemplate(e), error: () => w`
2127
+ <div class="error-message">Nothing to see here at the moment</div>
2128
+ ` })}
2129
+ </div>
2130
+ `;
2131
+ }
2132
+ };
2133
+ Z.styles = [ps, ms, vs, gs];
2134
+ f([H()], Z.prototype, "listItems");
2135
+ f([v()], Z.prototype, "orderBy");
2136
+ f([v({ type: Number })], Z.prototype, "limit");
2137
+ f([v()], Z.prototype, "listMock");
2138
+ f([v({ type: String })], Z.prototype, "mode");
2139
+ G("appcues-flows-list", Z);
2140
+ var Ps = y`
2141
+ .btn-wrapper {
2142
+ display: flex;
2143
+ flex-direction: row;
2144
+ flex-wrap: nowrap;
2145
+ }
2146
+
2147
+ .btn-wrapper button {
2148
+ background-color: var(--launcher-main-color, #0072d6);
2149
+ color: white;
2150
+ cursor: pointer;
2151
+ outline-color: #0072d6;
2152
+ outline-width: 2px;
2153
+ }
2154
+
2155
+ .btn-wrapper button {
2156
+ border: none;
2157
+ border-start-start-radius: 80px;
2158
+ border-end-start-radius: 80px;
2159
+ border-start-end-radius: 0;
2160
+ border-end-end-radius: 0;
2161
+ padding-inline: 16px 8px;
2162
+ padding-block: 4px;
2163
+ height: 52px;
2164
+ outline-offset: 3px;
2165
+ }
2166
+
2167
+ .btn-wrapper ::slotted(button) {
2168
+ padding: 10px 16px;
2169
+ border-radius: 80px;
2170
+ border: 2px solid transparent;
2171
+ height: 52px;
2172
+ display: flex;
2173
+ align-items: center;
2174
+ justify-content: center;
2175
+ gap: 8px;
2176
+ outline-offset: 4px;
2177
+ }
2178
+
2179
+ .btn-wrapper button:hover:not(:active):not([disabled]) {
2180
+ background-color: var(--launcher-hover-color, #4848eb) !important;
2181
+ }
2182
+
2183
+ .btn-wrapper button:active {
2184
+ background-color: var(--launcher-active-color, #8c8cff) !important;
2185
+ }
2186
+
2187
+ .btn-wrapper > .slot-wrapper {
2188
+ border: 2px solid white;
2189
+ margin-top: -2px;
2190
+ border-radius: 80px;
2191
+ width: max-content;
2192
+ }
2193
+
2194
+ .btn-wrapper > .slot-wrapper.active {
2195
+ margin-inline-start: -18px;
2196
+ }
2197
+ `, Ns = y`
2198
+ .checklist-content {
2199
+ display: flex;
2200
+ flex-direction: column;
2201
+ text-align: left;
2202
+ margin-inline-end: 18px;
2203
+ justify-content: center;
2204
+ gap: 6px;
2205
+ line-height: 1.2;
2206
+ }
2207
+ `, Is = y`
2208
+ .progress-wrapper {
2209
+ display: flex;
2210
+ align-items: center;
2211
+ gap: 2px;
2212
+ border-radius: 6px;
2213
+ min-width: 100px;
2214
+ overflow: hidden;
2215
+ }
2216
+
2217
+ .progress-bar,
2218
+ progress {
2219
+ background-color: rgba(255, 255, 255, 0.4);
2220
+ height: 4px;
2221
+ flex-grow: 1;
2222
+ }
2223
+
2224
+ .progress-bar.completed {
2225
+ background-color: white;
2226
+ }
2227
+
2228
+ progress[value] {
2229
+ --color: white;
2230
+ --background: rgba(255, 255, 255, 0.4);
2231
+ appearance: none;
2232
+ background: var(--background);
2233
+ border: none;
2234
+ }
2235
+
2236
+ progress[value]::-webkit-progress-bar {
2237
+ background: var(--background);
2238
+ }
2239
+
2240
+ progress[value]::-webkit-progress-value {
2241
+ background: var(--color);
2242
+ }
2243
+
2244
+ progress[value]::-moz-progress-bar {
2245
+ background: var(--color);
2246
+ }
2247
+ `, M = class extends A {
2248
+ constructor() {
2249
+ super(...arguments), this.title = "Checklist", this.totalItems = 0, this.completedItems = 0, this.activeColor = "#4848eb", this.hoverColor = "#4848eb", this.mainColor = "#0072d6", this.checklistId = "", this.handleSlotchange = (e) => {
2250
+ const r = (e.target?.assignedNodes({ flatten: !0 })).find((l) => l.querySelector ? l.querySelector("button") : !1)?.querySelector("button");
2251
+ if (!r) return;
2252
+ const { backgroundColor: n, background: o } = getComputedStyle(r);
2253
+ this.mainColor = n || o, this.style.setProperty("--launcher-main-color", this.mainColor);
2254
+ }, this.progressbar = () => {
2255
+ if (this.totalItems > 8)
2256
+ return ut`<progress
2257
+ id="items"
2258
+ value="${this.completedItems}"
2259
+ max="${this.totalItems}"
2260
+ ></progress>`;
2261
+ const e = [];
2262
+ for (let t = 0; t < this.totalItems; t++)
2263
+ e.push(ut`<div
2264
+ class="progress-bar ${t < this.completedItems && "completed"}"
2265
+ ></div>`);
2266
+ return e;
2267
+ }, this.slotElement = () => ut`
2268
+ <slot @slotchange=${this.handleSlotchange}></slot>
2269
+ `;
2270
+ }
2271
+ connectedCallback() {
2272
+ super.connectedCallback(), this.totalItems = Number.parseInt(this.getAttribute("totalitems") || "0", 10), this.completedItems = Number.parseInt(this.getAttribute("completeditems") || "0", 10), this.title = this.getAttribute("title") || "Checklist", vi((e) => {
2273
+ const t = e, { id: i, name: s, totalItems: r, completedItems: n } = t.detail;
2274
+ this.totalItems = r, this.completedItems = n, this.title = s, this.checklistId = i, bi();
2275
+ }), _i(() => {
2276
+ this.totalItems = 0, this.completedItems = 0, this.title = "Checklist", this.checklistId = "";
2277
+ });
2278
+ }
2279
+ attributeChangedCallback(e, t, i) {
2280
+ if (e === "totalitems") {
2281
+ const s = Number.parseInt(i || "0", 10);
2282
+ this.totalItems = s > 0 ? s : 0;
2283
+ }
2284
+ if (e === "completeditems") {
2285
+ const s = Number.parseInt(i || "0", 10);
2286
+ s > this.totalItems ? this.completedItems = this.totalItems : s < 0 ? this.completedItems = 0 : this.completedItems = s;
2287
+ }
2288
+ e === "title" && (this.title = i || "Checklist"), e === "hovercolor" && (this.hoverColor = i || "#4848eb", this.style.setProperty("--launcher-hover-color", this.hoverColor)), e === "activecolor" && (this.activeColor = i || "#8c8cff", this.style.setProperty("--launcher-active-color", this.activeColor));
2289
+ }
2290
+ render() {
2291
+ return ut`
2292
+ <div class="btn-wrapper">
2293
+ ${this.totalItems === 0 ? this.slotElement() : ut`
2294
+ <button @click="${() => Se(this.checklistId)}">
2295
+ <div class="checklist-content">
2296
+ ${this.title}
2297
+ <div class="progress-wrapper" aria-role="progressbar">
2298
+ ${this.progressbar()}
2299
+ </div>
2300
+ </div>
2301
+ </button>
2302
+ <div
2303
+ class="slot-wrapper ${this.totalItems > 0 && "active"}"
2304
+ @click="${{ handleEvent: () => Se(this.checklistId, !0), capture: !0 }}"
2305
+ >
2306
+ ${this.slotElement()}
2307
+ </div>
2308
+ `}
2309
+ </div>
2310
+ `;
2311
+ }
2312
+ };
2313
+ M.styles = [Ps, Ns, Is];
2314
+ f([v()], M.prototype, "title");
2315
+ f([v()], M.prototype, "totalItems");
2316
+ f([v()], M.prototype, "completedItems");
2317
+ f([v()], M.prototype, "activeColor");
2318
+ f([v()], M.prototype, "hoverColor");
2319
+ f([H()], M.prototype, "mainColor");
2320
+ f([H()], M.prototype, "checklistId");
2321
+ G("appcues-checklist-wrapper", M);
2322
+ var Rs = y`
2323
+ .page {
2324
+ display: block;
2325
+ width: 100%;
2326
+ height: 100%;
2327
+ }
2328
+
2329
+ .idle {
2330
+ display: none;
2331
+ }
2332
+
2333
+ .hidden {
2334
+ pointer-events: none;
2335
+ }
2336
+
2337
+ .animated {
2338
+ position: absolute;
2339
+ top: 0;
2340
+ left: 0;
2341
+ }
2342
+ `, Ms = y`
2343
+ .slide-in-bottom {
2344
+ animation: slide-in-bottom 0.4s cubic-bezier(0.15, 1.03, 0.8, 1.03) forwards;
2345
+ }
2346
+
2347
+ @keyframes slide-in-bottom {
2348
+ 0% {
2349
+ opacity: 0;
2350
+ transform: translateY(80%);
2351
+ }
2352
+ 20% {
2353
+ opacity: 0;
2354
+ }
2355
+ 100% {
2356
+ opacity: 1;
2357
+ transform: translateY(0);
2358
+ }
2359
+ }
2360
+ `, zs = y`
2361
+ .slide-out-bottom {
2362
+ animation: slide-out-bottom 0.4s cubic-bezier(0.7, 0, 0.57, 0.55) forwards;
2363
+ }
2364
+
2365
+ @keyframes slide-out-bottom {
2366
+ 0% {
2367
+ opacity: 1;
2368
+ transform: translateY(0);
2369
+ }
2370
+
2371
+ 80% {
2372
+ opacity: 1;
2373
+ }
2374
+
2375
+ 99% {
2376
+ transform: translateY(80%);
2377
+ opacity: 0;
2378
+ }
2379
+
2380
+ 100% {
2381
+ display: none;
2382
+ max-height: 0;
2383
+ overflow: hidden;
2384
+ }
2385
+ }
2386
+ `, Ot = class extends A {
2387
+ constructor() {
2388
+ super(...arguments), this.status = "idle", this.animation = "", this.minHeight = "auto";
2389
+ }
2390
+ show({ animation: e = "" } = {}) {
2391
+ e !== "" && (this.animation = e), this.status = "showing";
2392
+ }
2393
+ hide({ animation: e = "" } = {}) {
2394
+ e !== "" && (this.animation = e), this.status = "hidden";
2395
+ }
2396
+ render() {
2397
+ return w`
2398
+ <div
2399
+ class="page ${this.status} ${this.animation && "animated"} ${this.animation}"
2400
+ aria-hidden="${["hidden", "idle"].includes(this.status)}"
2401
+ >
2402
+ <slot></slot>
2403
+ </div>
2404
+ `;
2405
+ }
2406
+ };
2407
+ Ot.styles = [Rs, Ms, zs];
2408
+ f([H()], Ot.prototype, "status");
2409
+ f([v()], Ot.prototype, "minHeight");
2410
+ G("appcues-page", Ot);
2411
+ var Os = y`
2412
+ .grow {
2413
+ animation: grow-min-height 0.4s cubic-bezier(0.7, 0, 0.57, 0.55) forwards;
2414
+ min-height: auto;
2415
+ }
2416
+
2417
+ .shrink {
2418
+ animation: shrink-min-height 0.4s cubic-bezier(0.7, 0, 0.57, 0.55) forwards;
2419
+ }
2420
+ `, Y = class extends A {
2421
+ constructor() {
2422
+ super(...arguments), this.currentPage = 0, this.pages = [], this.currentHeight = "auto", this.entry = "slide-in-bottom", this.exit = "slide-out-bottom";
2423
+ }
2424
+ getChildren() {
2425
+ return this.shadowRoot ? this.shadowRoot.querySelector("slot")?.assignedElements({ flatten: !0 }) ?? [] : [];
2426
+ }
2427
+ updateHeight(e = this.currentPage) {
2428
+ const t = this.pages[e].minHeight || "auto";
2429
+ this.currentHeight = t !== "auto" ? t : "auto";
2430
+ }
2431
+ showFirstPage() {
2432
+ this.updateHeight(), this.pages[this.currentPage].show();
2433
+ }
2434
+ prev() {
2435
+ this.currentPage <= 0 || (this.updateHeight(this.currentPage - 1), this.pages[this.currentPage].hide({ animation: this.exit }), this.pages[this.currentPage - 1].show(), this.currentPage -= 1);
2436
+ }
2437
+ next() {
2438
+ this.currentPage >= this.pages.length - 1 || (this.currentPage += 1, this.updateHeight(), this.pages[this.currentPage].show({ animation: this.entry }), this.pages[this.currentPage - 1].hide());
2439
+ }
2440
+ goTo(e = 0) {
2441
+ e !== this.currentPage && (this.pages[e].show({ animation: e !== 0 ? this.entry : "" }), this.pages[this.currentPage].hide({ animation: this.currentPage !== 0 ? this.exit : "" }), this.currentPage = e, this.updateHeight());
2442
+ }
2443
+ firstUpdated() {
2444
+ this.pages = this.getChildren(), this.showFirstPage();
2445
+ }
2446
+ connectedCallback() {
2447
+ super.connectedCallback();
2448
+ }
2449
+ render() {
2450
+ return w`
2451
+ <style>
2452
+ @keyframes grow-min-height {
2453
+ 0% {
2454
+ min-height: 0;
2455
+ }
2456
+
2457
+ 100% {
2458
+ min-height: ${this.currentHeight};
2459
+ }
2460
+ }
2461
+
2462
+ @keyframes shrink-min-height {
2463
+ 0% {
2464
+ min-height: ${this.currentHeight};
2465
+ }
2466
+
2467
+ 100% {
2468
+ min-height: auto;
2469
+ }
2470
+ }
2471
+ </style>
2472
+ <div
2473
+ class="${this.currentPage !== 0 ? "grow" : "shrink"}"
2474
+ style="position: relative;"
2475
+ >
2476
+ <slot></slot>
2477
+ </div>
2478
+ `;
2479
+ }
2480
+ };
2481
+ Y.styles = [Os];
2482
+ f([H()], Y.prototype, "currentPage");
2483
+ f([H()], Y.prototype, "pages");
2484
+ f([H()], Y.prototype, "currentHeight");
2485
+ f([v()], Y.prototype, "entry");
2486
+ f([v()], Y.prototype, "exit");
2487
+ G("appcues-navigation-stack", Y);
2488
+ var Ls = Mt`
2489
+ <svg
2490
+ version="1.1"
2491
+ xmlns="http://www.w3.org/2000/svg"
2492
+ xmlns:xlink="http://www.w3.org/1999/xlink"
2493
+ x="0px"
2494
+ y="0px"
2495
+ width="40px"
2496
+ height="40px"
2497
+ fill="#0072D6"
2498
+ viewBox="0 0 40 40"
2499
+ enable-background="new 0 0 40 40"
2500
+ xml:space="preserve"
2501
+ >
2502
+ <path
2503
+ opacity="0.2"
2504
+ fill="#0072D6"
2505
+ d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946
2506
+ s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634
2507
+ c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"
2508
+ />
2509
+ <path
2510
+ fill="#0072D6"
2511
+ d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0
2512
+ C22.32,8.481,24.301,9.057,26.013,10.047z"
2513
+ >
2514
+ <animateTransform
2515
+ attributeType="xml"
2516
+ attributeName="transform"
2517
+ type="rotate"
2518
+ from="0 20 20"
2519
+ to="360 20 20"
2520
+ keySplines="0.17 0.27 0.8 0.65"
2521
+ calcMode="spline"
2522
+ dur="0.6s"
2523
+ repeatCount="indefinite"
2524
+ keyTimes="0;1"
2525
+ />
2526
+ </path>
2527
+ </svg>
2528
+ `, Hs = Mt`
2529
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2530
+ <g id="material-icon" clip-path="url(#clip0_19386_6120)">
2531
+ <path
2532
+ id="Vector"
2533
+ d="M6.12522 8.00305L11.9239 13.8017C12.1702 14.048 12.2953 14.3528 12.2993 14.7161C12.3033 15.0794 12.1822 15.3842 11.9359 15.6305C11.6896 15.8769 11.3828 16 11.0155 16C10.6481 16 10.3413 15.8769 10.095 15.6305L3.93523 9.47075C3.7234 9.25892 3.57007 9.02893 3.47524 8.78077C3.38042 8.53262 3.33301 8.27338 3.33301 8.00305C3.33301 7.73273 3.38042 7.47349 3.47524 7.22534C3.57007 6.97718 3.7234 6.74719 3.93523 6.53536L10.095 0.375561C10.3413 0.129259 10.6461 0.00410428 11.0094 9.62603e-05C11.3727 -0.00391176 11.6776 0.117242 11.9239 0.363558C12.1702 0.60986 12.2933 0.916664 12.2933 1.28397C12.2933 1.65128 12.1702 1.95809 11.9239 2.20441L6.12522 8.00305Z"
2534
+ fill="currentColor"
2535
+ />
2536
+ </g>
2537
+ </svg>
2538
+ `, Ze = Mt`
2539
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
2540
+ <path
2541
+ fill="currentColor"
2542
+ d="M8.9 17.81a8.6 8.6 0 0 1-6.31-2.59A8.6 8.6 0 0 1 0 8.91c0-2.49.86-4.6 2.59-6.32A8.6 8.6 0 0 1 8.9 0a8.6 8.6 0 0 1 6.32 2.59A8.6 8.6 0 0 1 17.8 8.9a8.39 8.39 0 0 1-1.68 5.07l7.45 7.46c.28.29.42.65.42 1.07 0 .43-.14.78-.43 1.06-.29.29-.64.43-1.07.43-.43 0-.78-.14-1.07-.43L14 16.13a8.42 8.42 0 0 1-5.09 1.68Zm0-3.05c1.63 0 3.01-.57 4.15-1.7a5.65 5.65 0 0 0 1.7-4.15c0-1.63-.56-3.02-1.7-4.15a5.64 5.64 0 0 0-4.15-1.7c-1.63 0-3 .56-4.14 1.7a5.65 5.65 0 0 0-1.7 4.15c0 1.63.56 3 1.7 4.15a5.64 5.64 0 0 0 4.14 1.7Z"
2543
+ />
2544
+ </svg>
2545
+ `, Us = y`
2546
+ @keyframes fade-in {
2547
+ 0% {
2548
+ opacity: 0;
2549
+ display: none;
2550
+ }
2551
+
2552
+ 100% {
2553
+ opacity: 1;
2554
+ display: flex;
2555
+ }
2556
+ }
2557
+
2558
+ @keyframes fade-out {
2559
+ 0% {
2560
+ opacity: 1;
2561
+ display: flex;
2562
+ }
2563
+
2564
+ 100% {
2565
+ opacity: 0;
2566
+ display: none;
2567
+ }
2568
+ }
2569
+
2570
+ @keyframes expand {
2571
+ 0% {
2572
+ width: 0%;
2573
+ }
2574
+
2575
+ 100% {
2576
+ width: 100%;
2577
+ }
2578
+ }
2579
+
2580
+ @keyframes collapse {
2581
+ 0% {
2582
+ width: 100%;
2583
+ }
2584
+
2585
+ 100% {
2586
+ width: 0%;
2587
+ }
2588
+ }
2589
+
2590
+ @keyframes slide-in {
2591
+ 0% {
2592
+ transform: translateX(120px);
2593
+ }
2594
+
2595
+ 100% {
2596
+ transform: translateX(0);
2597
+ }
2598
+ }
2599
+
2600
+ @keyframes slide-out {
2601
+ 0% {
2602
+ transform: translateX(0);
2603
+ }
2604
+
2605
+ 100% {
2606
+ transform: translateX(120px);
2607
+ }
2608
+ }
2609
+ `, Vs = y`
2610
+ :host {
2611
+ display: flex;
2612
+ width: 100%;
2613
+ }
2614
+
2615
+ .container {
2616
+ align-items: center;
2617
+ display: flex;
2618
+ height: 40px;
2619
+ justify-content: space-between;
2620
+ position: relative;
2621
+ width: 100%;
2622
+ }
2623
+
2624
+ svg {
2625
+ height: 16px;
2626
+ }
2627
+
2628
+ button {
2629
+ align-items: center;
2630
+ color: inherit;
2631
+ cursor: pointer;
2632
+ background: transparent;
2633
+ border: none;
2634
+ display: flex;
2635
+ justify-content: center;
2636
+ padding: 12px;
2637
+ }
2638
+ `, Ds = y`
2639
+ .search-container {
2640
+ align-items: center;
2641
+ display: none;
2642
+ opacity: 0;
2643
+ position: absolute;
2644
+ width: calc(100% + 12px);
2645
+ left: -12px;
2646
+ }
2647
+
2648
+ .search-container input {
2649
+ border: none;
2650
+ border-start-start-radius: 8px;
2651
+ border-end-start-radius: 8px;
2652
+ border-start-end-radius: 0;
2653
+ border-end-end-radius: 0;
2654
+ box-sizing: border-box;
2655
+ height: 40px;
2656
+ padding: 8px 12px 8px 16px;
2657
+ width: 0;
2658
+ }
2659
+
2660
+ .search-container input:focus {
2661
+ outline: none;
2662
+ }
2663
+
2664
+ .search-container .search-form {
2665
+ display: flex;
2666
+ flex: 1;
2667
+ justify-content: flex-end;
2668
+ margin-bottom: 0;
2669
+ }
2670
+
2671
+ .search-container .search-button {
2672
+ background: white;
2673
+ border-start-end-radius: 8px;
2674
+ border-end-end-radius: 8px;
2675
+ border-start-start-radius: 0;
2676
+ border-end-start-radius: 0;
2677
+ padding: 0 12px;
2678
+ }
2679
+
2680
+ .search-container .search-button svg {
2681
+ width: 16px;
2682
+ }
2683
+
2684
+ .search-container .search-button svg path {
2685
+ fill: black;
2686
+ }
2687
+
2688
+ .search-container.show {
2689
+ animation: fade-in 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2690
+ display: flex;
2691
+ }
2692
+
2693
+ .search-container.show input {
2694
+ animation: expand 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2695
+ width: 100%;
2696
+ }
2697
+
2698
+ .search-container.hide {
2699
+ animation: fade-out 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2700
+ }
2701
+
2702
+ .search-container.hide input {
2703
+ animation: collapse 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2704
+ width: 0;
2705
+ }
2706
+
2707
+ .content-container {
2708
+ align-items: center;
2709
+ display: flex;
2710
+ height: 40px;
2711
+ justify-content: space-between;
2712
+ width: 100%;
2713
+ }
2714
+
2715
+ .content-container .content {
2716
+ text-wrap: nowrap;
2717
+ }
2718
+
2719
+ .content-container.show {
2720
+ display: flex;
2721
+ animation: fade-in 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2722
+ }
2723
+
2724
+ .content-container.show .content {
2725
+ animation: slide-in 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2726
+ }
2727
+
2728
+ .content-container.hide {
2729
+ animation: fade-out 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2730
+ }
2731
+
2732
+ .content-container.hide .content {
2733
+ animation: slide-out 0.3s cubic-bezier(0.3, 0.4, 0.3, 0.8) forwards;
2734
+ }
2735
+
2736
+ .search-bar {
2737
+ align-items: center;
2738
+ background: white;
2739
+ border: none;
2740
+ display: none;
2741
+ justify-content: flex-end;
2742
+ gap: 16px;
2743
+ width: 100%;
2744
+ }
2745
+
2746
+ .search-bar.show {
2747
+ display: flex;
2748
+ }
2749
+ `, Lt = class extends A {
2750
+ constructor() {
2751
+ super(...arguments), this.showSearchBar = null, this.loading = !1, this.handleSubmit = () => {
2752
+ const t = this.shadowRoot?.querySelector("input")?.value || "";
2753
+ this.dispatchEvent(new CustomEvent("onSearch", { detail: { inputValue: t }, bubbles: !0, composed: !0 })), this.requestUpdate();
2754
+ }, this.handleSearch = ls(this.handleSubmit, 700);
2755
+ }
2756
+ setSearchMode(e) {
2757
+ this.showSearchBar = e;
2758
+ const t = this.shadowRoot?.querySelector("input");
2759
+ this.requestUpdate(), e ? setTimeout(() => {
2760
+ t?.focus();
2761
+ }, 100) : (this.dispatchEvent(new CustomEvent("onCancel", { bubbles: !0, composed: !0 })), t && (t.value = ""));
2762
+ }
2763
+ render() {
2764
+ return w`
2765
+ <div class="container">
2766
+ <div
2767
+ class="content-container ${this.showSearchBar === null ? "" : this.showSearchBar ? "hide" : "show"}"
2768
+ >
2769
+ <div class="content" style="${this.style}">
2770
+ <slot></slot>
2771
+ </div>
2772
+ <button @click="${() => this.setSearchMode(!0)}">
2773
+ ${Ze}
2774
+ </button>
2775
+ </div>
2776
+ <div class="search-container ${this.showSearchBar ? "show" : "hide"}">
2777
+ <button
2778
+ class="return-button"
2779
+ @click="${() => this.setSearchMode(!1)}"
2780
+ >
2781
+ ${Hs}
2782
+ </button>
2783
+ <form
2784
+ class="search-form"
2785
+ @submit="${(e) => {
2786
+ e.preventDefault(), this.handleSubmit();
2787
+ }}"
2788
+ >
2789
+ <input
2790
+ type="text"
2791
+ placeholder="Type to search"
2792
+ @keyup=${this.handleSearch}
2793
+ />
2794
+ <button class="search-button" type="submit">
2795
+ ${this.loading ? Ls : Ze}
2796
+ </button>
2797
+ </form>
2798
+ </div>
2799
+ </div>
2800
+ `;
2801
+ }
2802
+ };
2803
+ Lt.styles = [Us, Vs, Ds];
2804
+ f([H()], Lt.prototype, "showSearchBar");
2805
+ f([v({ converter: (e) => e === "true" })], Lt.prototype, "loading");
2806
+ G("appcues-search-header", Lt);
2807
+ var js = (e) => e && new DOMParser().parseFromString(e, "text/html").body.textContent || "", Bs = y`
2808
+ :host {
2809
+ height: 100%;
2810
+ display: block;
2811
+ }
2812
+
2813
+ * {
2814
+ margin: 0;
2815
+ padding: 0;
2816
+ box-sizing: border-box;
2817
+ }
2818
+
2819
+ .root-wrapper {
2820
+ height: 100%;
2821
+ box-shadow: var(--search-results-block-shadow);
2822
+ color: var(--search-results-block-color);
2823
+ background-color: var(--search-results-block-background-color);
2824
+ }
2825
+
2826
+ .content-wrapper {
2827
+ padding: 16px 16px 16px 16px;
2828
+ background: var(--search-results-block-content-wrapper-background-color);
2829
+ min-height: 100%;
2830
+ }
2831
+
2832
+ .content-wrapper .root-wrapper {
2833
+ height: auto;
2834
+ border-radius: var(--search-results-block-radius);
2835
+ }
2836
+
2837
+ .root-wrapper[loading='true'] {
2838
+ overflow: hidden;
2839
+ }
2840
+
2841
+ .alert-wrapper {
2842
+ display: flex;
2843
+ flex-direction: column;
2844
+ gap: 16px;
2845
+ align-items: center;
2846
+ justify-content: center;
2847
+ text-align: center;
2848
+ padding: 16px;
2849
+ }
2850
+ `, Ws = y`
2851
+ .pagination-btn {
2852
+ align-items: center;
2853
+ background: transparent;
2854
+ border-bottom-left-radius: var(--search-results-block-radius);
2855
+ border-bottom-right-radius: var(--search-results-block-radius);
2856
+ border-top: 1px solid rgba(66, 86, 120, 0.1);
2857
+ border-left: none;
2858
+ border-right: none;
2859
+ border-bottom: none;
2860
+ cursor: pointer;
2861
+ display: flex;
2862
+ font-size: 14px;
2863
+ font-weight: 500;
2864
+ justify-content: center;
2865
+ line-height: 24px;
2866
+ padding: 8px 16px;
2867
+ width: 100%;
2868
+ position: relative;
2869
+ top: 1px;
2870
+ }
2871
+
2872
+ .pagination-btn:hover {
2873
+ background: var(--search-results-block-background-color-hover);
2874
+ }
2875
+
2876
+ .pagination-btn:focus {
2877
+ outline: 2px solid var(--search-results-block-outline-color);
2878
+ background: var(--search-results-block-background-color-active);
2879
+ }
2880
+ `, qs = y`
2881
+ .article-main-title-wrapper {
2882
+ padding: 8px 16px;
2883
+ }
2884
+
2885
+ .article-main-title {
2886
+ font-size: 15px;
2887
+ font-style: normal;
2888
+ font-weight: 700;
2889
+ }
2890
+
2891
+ .article-list {
2892
+ font-style: normal;
2893
+ display: flex;
2894
+ flex-direction: column;
2895
+ gap: 4px;
2896
+ list-style: none;
2897
+ }
2898
+
2899
+ .article-list a {
2900
+ text-decoration: none;
2901
+ display: flex;
2902
+ flex-direction: column;
2903
+ gap: 8px;
2904
+ padding: 8px 16px;
2905
+ color: currentColor;
2906
+ }
2907
+
2908
+ .article-list a[loading='false']:hover {
2909
+ background-color: var(--search-results-block-background-color-hover);
2910
+ }
2911
+
2912
+ .article-list a[loading='false']:focus {
2913
+ outline: 2px solid var(--search-results-block-outline-color);
2914
+ background: var(--search-results-block-background-color-active);
2915
+ }
2916
+
2917
+ .article-title-wrapper {
2918
+ font-size: 14px;
2919
+ font-weight: bold;
2920
+ line-height: 160%;
2921
+ display: flex;
2922
+ gap: 8px;
2923
+ align-items: center;
2924
+ justify-content: space-between;
2925
+ }
2926
+
2927
+ .article-title-wrapper p {
2928
+ text-overflow: ellipsis;
2929
+ display: -webkit-box;
2930
+ -webkit-line-clamp: 2;
2931
+ -webkit-box-orient: vertical;
2932
+ overflow: hidden;
2933
+ }
2934
+
2935
+ .article-title-wrapper svg {
2936
+ min-width: 12px;
2937
+ min-height: 12px;
2938
+ width: 12px;
2939
+ height: 12px;
2940
+ }
2941
+
2942
+ .article-title-wrapper.loading {
2943
+ width: 70%;
2944
+ }
2945
+
2946
+ .article-description {
2947
+ font-size: 13px;
2948
+ font-weight: normal;
2949
+ line-height: 160%;
2950
+ text-overflow: ellipsis;
2951
+ display: -webkit-box;
2952
+ -webkit-line-clamp: 3;
2953
+ -webkit-box-orient: vertical;
2954
+ overflow: hidden;
2955
+ }
2956
+
2957
+ .article-description.loading {
2958
+ height: 50px;
2959
+ }
2960
+ `, Fs = y`
2961
+ @keyframes animatedBackgroundPosition {
2962
+ 0% {
2963
+ background-position: 0% 92%;
2964
+ }
2965
+ 100% {
2966
+ background-position: 100% 9%;
2967
+ }
2968
+ }
2969
+
2970
+ .loading {
2971
+ opacity: 0.5;
2972
+ background: linear-gradient(
2973
+ 135deg,
2974
+ rgba(211, 223, 232, 0.5) 30%,
2975
+ rgba(169, 184, 197, 0.5) 38%,
2976
+ rgba(168, 182, 193, 0.6) 41%,
2977
+ rgba(168, 182, 193, 0.6) 50%,
2978
+ rgba(168, 182, 193, 0.6) 50%,
2979
+ rgba(169, 184, 197, 0.6) 51%,
2980
+ rgba(211, 223, 232, 0.6) 57%,
2981
+ rgba(211, 223, 232, 0.6) 80%,
2982
+ rgba(211, 223, 232, 0.6) 80%
2983
+ );
2984
+ background-size: 1200% 1200%;
2985
+ animation: animatedBackgroundPosition 3s ease infinite reverse;
2986
+ color: transparent;
2987
+ }
2988
+ `, Gs = si`
2989
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2990
+ <g id="Icon">
2991
+ <path id="Vector" d="M11.4752 14.475L7.8502 10.85C7.8002 10.8 7.7627 10.7458 7.7377 10.6875C7.7127 10.6292 7.7002 10.5667 7.7002 10.5C7.7002 10.3667 7.74603 10.25 7.8377 10.15C7.92936 10.05 8.0502 10 8.2002 10H15.8002C15.9502 10 16.071 10.05 16.1627 10.15C16.2544 10.25 16.3002 10.3667 16.3002 10.5C16.3002 10.5333 16.2502 10.65 16.1502 10.85L12.5252 14.475C12.4419 14.5583 12.3585 14.6167 12.2752 14.65C12.1919 14.6833 12.1002 14.7 12.0002 14.7C11.9002 14.7 11.8085 14.6833 11.7252 14.65C11.6419 14.6167 11.5585 14.5583 11.4752 14.475Z" fill="currentColor"/>
2992
+ </g>
2993
+ </svg>
2994
+ `, Zs = si`
2995
+ <svg
2996
+ xmlns="http://www.w3.org/2000/svg"
2997
+ width="12px"
2998
+ height="12px"
2999
+ viewBox="0 0 24 24"
3000
+ fill="none"
3001
+ aria-hidden
3002
+ >
3003
+ <path
3004
+ d="M3.44444 23C2.77222 23 2.19676 22.7606 1.71806 22.2819C1.23935 21.8032 1 21.2278 1 20.5556V3.44444C1 2.77222 1.23935 2.19676 1.71806 1.71806C2.19676 1.23935 2.77222 1 3.44444 1H10.7778C11.1241 1 11.4144 1.11713 11.6486 1.35139C11.8829 1.58565 12 1.87593 12 2.22222C12 2.56852 11.8829 2.8588 11.6486 3.09306C11.4144 3.32731 11.1241 3.44444 10.7778 3.44444H3.44444V20.5556H20.5556V13.2222C20.5556 12.8759 20.6727 12.5856 20.9069 12.3514C21.1412 12.1171 21.4315 12 21.7778 12C22.1241 12 22.4144 12.1171 22.6486 12.3514C22.8829 12.5856 23 12.8759 23 13.2222V20.5556C23 21.2278 22.7606 21.8032 22.2819 22.2819C21.8032 22.7606 21.2278 23 20.5556 23H3.44444ZM20.5556 5.15556L10.0444 15.6667C9.82037 15.8907 9.53518 16.0028 9.18889 16.0028C8.84259 16.0028 8.55741 15.8907 8.33333 15.6667C8.10926 15.4426 7.99722 15.1574 7.99722 14.8111C7.99722 14.4648 8.10926 14.1796 8.33333 13.9556L18.8444 3.44444H15.6667C15.3204 3.44444 15.0301 3.32731 14.7958 3.09306C14.5616 2.8588 14.4444 2.56852 14.4444 2.22222C14.4444 1.87593 14.5616 1.58565 14.7958 1.35139C15.0301 1.11713 15.3204 1 15.6667 1H21.7778C22.1241 1 22.4144 1.11713 22.6486 1.35139C22.8829 1.58565 23 1.87593 23 2.22222V8.33333C23 8.67963 22.8829 8.96991 22.6486 9.20417C22.4144 9.43843 22.1241 9.55556 21.7778 9.55556C21.4315 9.55556 21.1412 9.43843 20.9069 9.20417C20.6727 8.96991 20.5556 8.67963 20.5556 8.33333V5.15556Z"
3005
+ fill="currentColor"
3006
+ />
3007
+ </svg>
3008
+ `, K = class extends A {
3009
+ constructor() {
3010
+ super(...arguments), this.state = "empty", this.searchTerm = "", this.hasNextPage = !1, this.pageSize = 10, this.results = [], this.handleRequestNextPage = () => {
3011
+ this.dispatchEvent(new CustomEvent("onRequestNextPage", { bubbles: !0, composed: !0 }));
3012
+ }, this.handleLinkClicked = (e) => () => {
3013
+ this.dispatchEvent(new CustomEvent("onLinkClicked", { bubbles: !0, composed: !0, detail: e }));
3014
+ }, this.mockResultData = () => {
3015
+ this.results = Array.from({ length: this.pageSize }).map((e, t) => ({ url: `url ${t}`, excerpt: `excerpt ${t}`, title: `title ${t}` }));
3016
+ };
3017
+ }
3018
+ connectedCallback() {
3019
+ super.connectedCallback(), this.state === "loading" && this.mockResultData();
3020
+ }
3021
+ attributeChangedCallback(e, t, i) {
3022
+ super.attributeChangedCallback(e, t, i), e === "state" && (i === "loading" && this.mockResultData(), this.state = i);
3023
+ }
3024
+ render() {
3025
+ return this.state === "empty" ? w`
3026
+ <div class="root-wrapper alert-wrapper">
3027
+ <p>No results for '${this.searchTerm}'</p>
3028
+ </div>
3029
+ ` : this.state === "error" ? w`
3030
+ <div class="root-wrapper alert-wrapper">
3031
+ <p>We could not load the results</p>
3032
+ <p>Try again later</p>
3033
+ </div>
3034
+ ` : w`
3035
+ <div class="content-wrapper">
3036
+ <div class="root-wrapper" loading="${this.state === "loading"}">
3037
+ <ul class="article-list">
3038
+ ${this.results.map((e) => w`
3039
+ <li @click=${this.handleLinkClicked(e)}>
3040
+ <a
3041
+ href="${e.url}"
3042
+ target="_blank"
3043
+ rel="noopener noreferrer"
3044
+ loading="${this.state === "loading"}"
3045
+ >
3046
+ <div class="article-title-wrapper ${this.state}">
3047
+ <p>${e.title}</p>
3048
+ ${Zs}
3049
+ </div>
3050
+ <p class="article-description ${this.state}">
3051
+ ${js(e.excerpt)}
3052
+ </p>
3053
+ </a>
3054
+ </li>
3055
+ `)}
3056
+ </ul>
3057
+
3058
+ ${this.hasNextPage && this.state !== "loading" ? w`
3059
+ <button
3060
+ class="pagination-btn"
3061
+ @click=${this.handleRequestNextPage}
3062
+ >
3063
+ See more ${this.results.length} results ${Gs}
3064
+ </button>
3065
+ ` : w``}
3066
+ </div>
3067
+ </div>
3068
+ `;
3069
+ }
3070
+ };
3071
+ K.styles = [Bs, qs, Fs, Ws];
3072
+ f([v()], K.prototype, "state");
3073
+ f([v()], K.prototype, "searchTerm");
3074
+ f([v({ converter: (e) => e === "true" })], K.prototype, "hasNextPage");
3075
+ f([v()], K.prototype, "pageSize");
3076
+ f([v({ type: Array })], K.prototype, "results");
3077
+ G("appcues-search-results", K);