@telia-ace/widget-components-widget-header-flamingo 1.0.14 → 1.0.45

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,2569 @@
1
+ const ht = (i, t, e, ...s) => {
2
+ const n = `[${i.get("$environment").name || "webprovisions"}] ${e}`;
3
+ switch (t) {
4
+ case "info":
5
+ console.info(n, ...s);
6
+ break;
7
+ case "warning":
8
+ console.warn(n, ...s);
9
+ break;
10
+ case "error":
11
+ console.error(n, ...s);
12
+ break;
13
+ }
14
+ }, Oe = (i) => {
15
+ const t = i.container || i;
16
+ return {
17
+ info: (e, ...s) => ht(t, "info", e, ...s),
18
+ warn: (e, ...s) => ht(t, "warning", e, ...s),
19
+ error: (e, ...s) => ht(t, "error", e, ...s)
20
+ };
21
+ };
22
+ var W = /* @__PURE__ */ ((i) => (i.Implementation = "implementation", i.Widget = "widget", i))(W || {}), O = /* @__PURE__ */ ((i) => (i.Pre = "pre", i.Post = "post", i))(O || {});
23
+ const Se = (i, t, e, s) => {
24
+ try {
25
+ const n = new t(e, s);
26
+ return {
27
+ name: i,
28
+ invoke: (r, o) => {
29
+ let a;
30
+ return n[r] && (a = n[r].call(n, o)), Promise.resolve(a);
31
+ },
32
+ getInstance: () => n
33
+ };
34
+ } catch (n) {
35
+ if (n.message && n.message.indexOf("is not a constructor") >= 0)
36
+ return {
37
+ name: i,
38
+ invoke: (r) => {
39
+ let o;
40
+ return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
41
+ },
42
+ getInstance: () => t
43
+ };
44
+ throw n;
45
+ }
46
+ };
47
+ function It(i, t) {
48
+ return typeof i > "u" ? t : i;
49
+ }
50
+ let Ne = class {
51
+ constructor(t = {}) {
52
+ this.part = t;
53
+ }
54
+ createCommand(t, e, s) {
55
+ let n;
56
+ typeof e == "function" ? n = {
57
+ scope: W.Widget,
58
+ stage: O.Post,
59
+ defaultArgs: void 0,
60
+ handlerResolver: e
61
+ } : n = {
62
+ scope: It(e.scope, W.Widget),
63
+ stage: It(e.stage, O.Post),
64
+ defaultArgs: e.defaultArgs,
65
+ handlerResolver: s
66
+ };
67
+ let r = this.part;
68
+ const o = t.split(".");
69
+ return o.forEach((a, h) => {
70
+ h === o.length - 1 ? r[a] || (r[a] = () => n) : r = this.part[a] = this.part[a] || {};
71
+ }), this;
72
+ }
73
+ get() {
74
+ return this.part;
75
+ }
76
+ };
77
+ const pe = (i) => {
78
+ const t = new Ne({});
79
+ return i(t), t.get();
80
+ };
81
+ pe((i) => {
82
+ i.createCommand(
83
+ "types.register",
84
+ { scope: W.Implementation, stage: O.Pre },
85
+ (t) => (e, s) => {
86
+ t.container.get("$types")[e] = s;
87
+ }
88
+ ).createCommand(
89
+ "type",
90
+ { stage: O.Pre },
91
+ (t) => (e) => {
92
+ t.container.register("$type", e);
93
+ }
94
+ ).createCommand(
95
+ "settings",
96
+ { stage: O.Pre, defaultArgs: [null] },
97
+ (t) => (e) => {
98
+ t.events.dispatch(
99
+ "settings:change",
100
+ e,
101
+ { bubbles: !0 }
102
+ ), t.container.register("$settings", e);
103
+ }
104
+ ).createCommand(
105
+ "plugin",
106
+ { stage: O.Pre },
107
+ (t) => (e, s, n) => {
108
+ const { container: r } = t;
109
+ let o = null, a = e, h = s;
110
+ typeof e == "string" && (o = e, a = s, h = n);
111
+ const c = (l) => {
112
+ const { transformPluginSettings: d } = t.container.get("$environmentOptions"), p = d ? d(
113
+ h || {},
114
+ o,
115
+ t.container,
116
+ a
117
+ ) : s;
118
+ try {
119
+ const u = Se(
120
+ o,
121
+ a,
122
+ r,
123
+ p
124
+ );
125
+ r.get("$plugins").push(u), l && u.invoke("initialize", null);
126
+ } catch (u) {
127
+ Oe(t).warn("Error when initializing plugin", u);
128
+ }
129
+ };
130
+ t.container.get("$instance") ? c(!0) : t.events.subscribeOnce("widget:instance-created", () => c(!1));
131
+ }
132
+ ).createCommand(
133
+ "container.register",
134
+ (t) => (e, s) => {
135
+ t.container.register(e, s);
136
+ }
137
+ ).createCommand(
138
+ "container.registerAsync",
139
+ (t) => (e, s) => {
140
+ t.container.registerAsync(e, s);
141
+ }
142
+ ).createCommand(
143
+ "container.registerFactory",
144
+ (t) => (e, s) => {
145
+ t.container.registerFactory(e, s);
146
+ }
147
+ ).createCommand(
148
+ "container.touch",
149
+ (t) => (e, s) => {
150
+ t.container.touch(e, s);
151
+ }
152
+ ).createCommand(
153
+ "csp",
154
+ {},
155
+ (t) => (e) => {
156
+ t.container.register("csp", e);
157
+ }
158
+ );
159
+ });
160
+ const Te = pe((i) => {
161
+ i.createCommand(
162
+ "ready",
163
+ { scope: W.Implementation, stage: O.Pre },
164
+ (t) => (e) => {
165
+ const { container: s } = t, n = s.owner;
166
+ s.get("bootstrapping").ready ? e(n) : n.events.subscribeOnce("bootstrap:ready", () => {
167
+ e(n);
168
+ });
169
+ }
170
+ );
171
+ }), lt = /* @__PURE__ */ new WeakMap();
172
+ function j() {
173
+ return (i) => (lt.has(i) || lt.set(i, {}), lt.get(i));
174
+ }
175
+ const dt = (i, t, e, ...s) => {
176
+ const n = `[${i.get("$environment").name || "webprovisions"}] ${e}`;
177
+ switch (t) {
178
+ case "info":
179
+ console.info(n, ...s);
180
+ break;
181
+ case "warning":
182
+ console.warn(n, ...s);
183
+ break;
184
+ case "error":
185
+ console.error(n, ...s);
186
+ break;
187
+ }
188
+ }, f = (i) => {
189
+ const t = i.container || i;
190
+ return {
191
+ info: (e, ...s) => dt(t, "info", e, ...s),
192
+ warn: (e, ...s) => dt(t, "warning", e, ...s),
193
+ error: (e, ...s) => dt(t, "error", e, ...s)
194
+ };
195
+ }, g = j(), Ct = (() => {
196
+ let i = 0;
197
+ return () => ++i;
198
+ })(), Pt = (i, t, e) => {
199
+ const s = g(i).touchQueue.get(t);
200
+ s && s.forEach((n) => {
201
+ n(e, i);
202
+ });
203
+ };
204
+ class Me {
205
+ constructor(t, e, s, n) {
206
+ this.key = t, this.factory = e, this.parent = s, this.container = n, this.id = Ct(), this.resolved = !1, this.constructed = !1, this.async = !0;
207
+ }
208
+ resolve() {
209
+ if (!this.constructed) {
210
+ const t = this.factory(this.parent, this.container);
211
+ return this.constructed = !0, this.value = Promise.resolve(t).then((e) => (this.resolved = !0, Pt(this.container, this.key, e), e));
212
+ }
213
+ return this.value;
214
+ }
215
+ }
216
+ class Ue {
217
+ constructor(t, e, s, n) {
218
+ this.key = t, this.value = e, this.parent = s, this.container = n, this.id = Ct(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, Pt(this.container, this.key, this.value), this.value);
219
+ }
220
+ }
221
+ class He {
222
+ constructor(t, e, s, n) {
223
+ this.key = t, this.value = e, this.parent = s, this.container = n, this.id = Ct(), this.async = !1, this.resolved = !1, this.constructed = !1, this.resolve = () => {
224
+ this.resolved = !0, this.constructed = !0;
225
+ const r = this.value(this.parent, this.container);
226
+ return Pt(this.container, this.key, this.value), r;
227
+ };
228
+ }
229
+ }
230
+ class kt {
231
+ /**
232
+ * Creates a new instance of `Container`.
233
+ * @param owner The object owning this inctance.
234
+ * @param name Optional name for the container.
235
+ * @param parent Parent container this should be a child of.
236
+ */
237
+ constructor(t, e, s) {
238
+ this.owner = t, this.name = e, this.parent = s, g(this).resolvers = /* @__PURE__ */ new Map(), g(this).touchQueue = /* @__PURE__ */ new Map(), g(this).children = [];
239
+ }
240
+ /**
241
+ * Deletes an existing resolver by its unique id.
242
+ * @param id Resolver id.
243
+ */
244
+ delete(t) {
245
+ const e = g(this).resolvers, s = Array.from(e.values()).find((n) => n.id === t);
246
+ return s ? (g(this).touchQueue.delete(s.key), Promise.resolve(e.delete(s.key))) : this.parent ? this.parent.delete(t) : Promise.resolve(!1);
247
+ }
248
+ /**
249
+ * Clears the `Container` and any child containers by deleteing all registered resolvers.
250
+ */
251
+ clear() {
252
+ const t = g(this).resolvers, e = Array.from(t.values());
253
+ return Promise.all(e.map((s) => {
254
+ if (s.constructed)
255
+ return Promise.resolve(s.resolve()).then((n) => {
256
+ if (n !== null && typeof n == "object" && typeof n.dispose == "function")
257
+ return n.dispose.call(n, this, s);
258
+ });
259
+ })).then(() => {
260
+ e.forEach((s) => this.delete(s.id)), g(this).children.forEach((s) => s.clear());
261
+ });
262
+ }
263
+ /**
264
+ * Detaches this `Container` instance from its parent, allowing it to be garbage-collected.
265
+ */
266
+ detach() {
267
+ if (this.parent) {
268
+ const t = g(this.parent).children, e = t.indexOf(this);
269
+ e > -1 && (t.splice(e, 1), delete this.parent);
270
+ }
271
+ }
272
+ /**
273
+ * Provides a way of touching a value in the `Container` without forcing it to be resolved.
274
+ * @param key Key of the resolved value to touch.
275
+ * @param handler Handler function for touching the resolved value.
276
+ */
277
+ touch(t, e) {
278
+ const s = g(this).resolvers.get(t);
279
+ if (s && s.constructed)
280
+ Promise.resolve(s.resolve()).then((n) => {
281
+ e(n, this);
282
+ });
283
+ else {
284
+ const n = g(this).touchQueue;
285
+ let r = n.get(t);
286
+ r || (r = [], n.set(t, r)), r.push(e);
287
+ }
288
+ return this.parent && !s ? this.parent.touch(t, e) : Promise.resolve();
289
+ }
290
+ /**
291
+ * Registers an asynchronous resolver.
292
+ * @param key Key of the resolver.
293
+ * @param factory Value factory.
294
+ */
295
+ registerAsync(t, e) {
296
+ const s = g(this).resolvers.get(t);
297
+ s && !s.async && process.env.NODE_ENV !== "production" && f(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);
298
+ const n = new Me(t, e, s, this);
299
+ return g(this).resolvers.set(t, n), n.id;
300
+ }
301
+ /**
302
+ * Registers a factory resolver for constructing the value to be resolved.
303
+ * @param key Key of the resolver.
304
+ * @param factory Value factory.
305
+ */
306
+ registerFactory(t, e) {
307
+ const s = g(this).resolvers.get(t);
308
+ s && s.async && process.env.NODE_ENV !== "production" && f(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);
309
+ const n = new He(t, e, s, this);
310
+ return g(this).resolvers.set(t, n), n.id;
311
+ }
312
+ /**
313
+ * Registers an synchronous resolver.
314
+ * @param key Key of the resolver.
315
+ * @param value Value.
316
+ */
317
+ register(t, e) {
318
+ const s = g(this).resolvers.get(t);
319
+ s && s.async && process.env.NODE_ENV !== "production" && f(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);
320
+ const n = new Ue(t, e, s, this);
321
+ return g(this).resolvers.set(t, n), n.id;
322
+ }
323
+ /**
324
+ * Gets the value for a synchronous resolver.
325
+ * @param key Key of resolver to get.
326
+ */
327
+ get(t) {
328
+ const e = g(this).resolvers.get(t);
329
+ if (e)
330
+ return e.async && process.env.NODE_ENV !== "production" && f(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), e.resolve();
331
+ if (this.parent)
332
+ return this.parent.get(t);
333
+ }
334
+ /**
335
+ * Gets the value for a asynchronous resolver.
336
+ * @param key Key of resolver to get.
337
+ */
338
+ getAsync(t) {
339
+ const e = g(this).resolvers.get(t);
340
+ if (e) {
341
+ if (!e.async)
342
+ throw process.env.NODE_ENV !== "production" && f(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), "Mismatching resolver type";
343
+ return e.resolve();
344
+ }
345
+ return this.parent ? this.parent.getAsync(t) : Promise.resolve(void 0);
346
+ }
347
+ getMany(...t) {
348
+ const e = {};
349
+ return t.forEach((s) => e[s] = this.get(s)), e;
350
+ }
351
+ getManyAsync(...t) {
352
+ const e = {};
353
+ return Promise.all(t.map((s) => this.getAsync(s).then((n) => e[s] = n))).then(() => e);
354
+ }
355
+ createChild(t, e) {
356
+ const s = new kt(t, e, this);
357
+ return g(this).children.push(s), s;
358
+ }
359
+ }
360
+ let Bt = class {
361
+ /**
362
+ *
363
+ * @param type Type of event.
364
+ * @param target The target of the event, which will handle the default behavour.
365
+ * @param cancelable Whether the event is cancelable by calling preventDefault().
366
+ * @param bubbles Whether the event will bubble up the parent hierarchy.
367
+ */
368
+ constructor(t, e, s = !1, n = !1) {
369
+ this.type = t, this.target = e, this.cancelable = !!s, this.bubbles = !!n, this.defaultPrevented = !1;
370
+ }
371
+ /**
372
+ * Cancels the default behaviour (if the event is cancelable).
373
+ */
374
+ preventDefault() {
375
+ this.cancelable && (this.defaultPrevented = !0);
376
+ }
377
+ };
378
+ const _ = j(), Vt = (i, t) => [].concat(
379
+ _(i).listenerLookup.get(t.toLowerCase()) || [],
380
+ _(i).listenerLookup.get("*") || []
381
+ ), Wt = (i, t, e, s) => {
382
+ let n, r;
383
+ return t instanceof Bt ? (n = t, r = t.type) : (n = new Bt(t, i.target, !!e.cancelable, !!e.bubbles), r = t), { event: n, type: r, async: s };
384
+ };
385
+ let Le = class ue {
386
+ /**
387
+ * Creates a new Event Manager instance.
388
+ * @param target The target of events dispatched from this Event Manager instance.
389
+ * @param parent Parent Event Manager instance.
390
+ */
391
+ constructor(t, e) {
392
+ this.target = t, this.parent = e, _(this).listenerLookup = /* @__PURE__ */ new Map(), _(this).children = [];
393
+ }
394
+ /**
395
+ * Clears registered event listeners in this `EventManager` as well as in any children.
396
+ */
397
+ clear() {
398
+ _(this).listenerLookup.clear(), _(this).children.forEach((t) => t.clear());
399
+ }
400
+ /**
401
+ * Detaches this `EventManager` instance from its parent, allowing it to be garbage-collected.
402
+ */
403
+ detach() {
404
+ if (this.parent) {
405
+ const t = _(this.parent).children, e = t.indexOf(this);
406
+ e > -1 && t.splice(e, 1);
407
+ }
408
+ }
409
+ /**
410
+ * Creates an event subscription by registering an listener for an event type.
411
+ * @param type Event type to subscribe to.
412
+ * @param listener Listener for the event.
413
+ */
414
+ subscribe(t, e, s) {
415
+ const n = _(this).listenerLookup, r = t.toLowerCase();
416
+ return n.has(r) || n.set(r, []), n.get(r).push(e), () => this.unsubscribe(t, e);
417
+ }
418
+ /**
419
+ * Similar to `subscribe()` but immediately removes the subscription after the first call.
420
+ * @param type Event type to subscribe to.
421
+ * @param listener Listener for the event.
422
+ */
423
+ subscribeOnce(t, e) {
424
+ const s = this.subscribe(t, (n, r) => (s(), e(n, r)));
425
+ }
426
+ /**
427
+ * Removes a listener for the specified event type.
428
+ * @param type Event type to remove subscription for.
429
+ * @param listener Event listener to remove.
430
+ */
431
+ unsubscribe(t, e) {
432
+ const s = _(this).listenerLookup.get(t.toLowerCase());
433
+ if (s) {
434
+ const n = s.indexOf(e);
435
+ n > -1 && s.splice(n, 1);
436
+ }
437
+ }
438
+ /**
439
+ * Dispatches an asynchonous event to registered event listeners.
440
+ * @param eventOrType Event type or Event object to dispatch.
441
+ * @param data Optional data to be passed to event listeners.
442
+ * @param options Optional event options used if first parameter is an event type.
443
+ */
444
+ dispatchAsync(t, e, s = {}) {
445
+ const { event: n, type: r } = Wt(this, t, s, !0), o = Vt(this, r);
446
+ let a = 0;
447
+ const h = o.length;
448
+ let c = Promise.resolve();
449
+ for (a = 0; a < h; a++)
450
+ ((l) => {
451
+ c = c.then((d) => d ? Promise.resolve(!0) : Promise.resolve(l(n, e)).then(() => n.defaultPrevented));
452
+ })(o[a]);
453
+ return c.then((l) => !l && n.bubbles && this.parent ? this.parent.dispatchAsync(n, e) : l);
454
+ }
455
+ /**
456
+ * Dispatches an event to registered event listeners.
457
+ * @param eventOrType Event type or Event object to dispatch.
458
+ * @param data Optional data to be passed to event listeners.
459
+ * @param options Optional event options used if first parameter is an event type.
460
+ */
461
+ dispatch(t, e, s = {}) {
462
+ const { event: n, type: r } = Wt(this, t, s, !1), o = Vt(this, r);
463
+ let a = 0;
464
+ const h = o.length;
465
+ let c = !1;
466
+ for (a = 0; a < h; a++)
467
+ if (o[a](n, e), n.defaultPrevented) {
468
+ c = !0;
469
+ break;
470
+ }
471
+ return !c && n.bubbles && this.parent && (c = this.parent.dispatch(n, e)), c;
472
+ }
473
+ /**
474
+ * Creates a child instance to the current Event manager.
475
+ */
476
+ createChild(t) {
477
+ const e = new ue(t, this);
478
+ return _(this).children.push(e), e;
479
+ }
480
+ };
481
+ const J = (i, t, e) => {
482
+ const s = i.get("$plugins").map((n) => {
483
+ try {
484
+ return n.invoke(t, e);
485
+ } catch (r) {
486
+ f(i).error("An error occured when invoking a plugin.", n, r);
487
+ }
488
+ });
489
+ return Promise.all(s);
490
+ };
491
+ let Re = class {
492
+ constructor(t) {
493
+ this.widget = t.get("$widget"), this.events = this.widget.events, this.container = this.widget.container, this.initialized = null, this.activated = null, this.initialize = this.initialize.bind(this), this.activate = this.activate.bind(this), this.deactivate = this.deactivate.bind(this), this.invoke = this.invoke.bind(this), this.createInstance();
494
+ }
495
+ createInstance() {
496
+ if (!this.widget.container.get("$instance")) {
497
+ const t = this.widget.container.get("$types"), e = this.widget.container.get("$type");
498
+ !e && f(this).error("Unable to create widget. No type is specified.");
499
+ const s = t[e];
500
+ !s && f(this).error(`Unable to create widget. Type '${e}' is not registered.`), this.widget.events.dispatch("widget:create-instance", {}, { bubbles: !0 });
501
+ try {
502
+ this.widget.container.register(
503
+ "$instance",
504
+ new s(this.container)
505
+ );
506
+ } catch (n) {
507
+ f(this).error("Unable to create widget type.", n);
508
+ }
509
+ this.widget.events.dispatch("widget:instance-created", {}, { bubbles: !0 });
510
+ }
511
+ }
512
+ /**
513
+ * The initialization is performed before the widget is activated but after it's configured
514
+ * and thus all required services are available. This hook is a good place to bind events that
515
+ * should trigger activation (e.g. click on "trigger links" or routing events)
516
+ * @param {object} data Custom initialization data passed to the widget.
517
+ */
518
+ initialize(t) {
519
+ return this.initialized = this.initialized || (() => {
520
+ const e = this.container.get("$instance"), s = e.initialize || (() => {
521
+ });
522
+ return this.initialized = Promise.resolve(s.call(e, t)).then(() => J(this.container, "initialize", t)).then(() => {
523
+ });
524
+ })();
525
+ }
526
+ /**
527
+ * The activation is where the widget is actually created and rendered.
528
+ * Activation can be initialized from the outside or from an event originated
529
+ * in the "initialize" hook.
530
+ * @param {object} data Custom activation data passed to the widget.
531
+ */
532
+ activate(t) {
533
+ return (this.initialized || this.initialize()).then(() => {
534
+ this.activated = this.activated || (() => J(this.container, "activate").then(() => {
535
+ const e = this.container.get("$instance");
536
+ return this.activated = e.activate(t);
537
+ }))();
538
+ });
539
+ }
540
+ deactivate() {
541
+ const t = this.container.get("$instance"), e = t.deactivate || (() => {
542
+ });
543
+ return J(this.container, "deactivate").then(() => Promise.resolve(e.call(t))).then(() => {
544
+ this.initialized = null, this.activated = null;
545
+ }).then(() => {
546
+ });
547
+ }
548
+ /**
549
+ * Invokes a command on the widget component.
550
+ * @param command Name of command
551
+ * @param args Command arguments
552
+ */
553
+ invoke(t, ...e) {
554
+ return J(this.container, "invoke", { command: t, args: e }).then(() => {
555
+ const s = this.container.get("$instance");
556
+ if (s[t])
557
+ return s[t].apply(s, e);
558
+ const n = s.invoke;
559
+ if (n)
560
+ return n.call(s, t, ...e);
561
+ });
562
+ }
563
+ };
564
+ const H = (i, t) => {
565
+ if (!t)
566
+ return !0;
567
+ if (typeof t == "string") {
568
+ const e = t.split(",");
569
+ for (let s = 0, n = e.length; s < n; s++) {
570
+ const r = e[s].trim();
571
+ if (r === i || r === "*")
572
+ return !0;
573
+ }
574
+ }
575
+ return t instanceof Array ? t.indexOf(i) > -1 : !1;
576
+ }, je = (i, t) => {
577
+ if (typeof t == "function")
578
+ return t(i);
579
+ const e = typeof t == "string" ? Ie(t) : t;
580
+ return !(!H(i.implementation.tenant || "", e.tenant || "") || !H(i.implementation.name, e.implementation || "") || !H(i.name, e.widget || "") || !H(i.container.get("$type"), e.type || ""));
581
+ }, ze = (i, t) => {
582
+ if (typeof t == "function")
583
+ return t(i);
584
+ const e = typeof t == "string" ? Be(t) : t;
585
+ return !(!H(i.tenant || "", e.tenant || "") || !H(i.name, e.implementation || ""));
586
+ }, ge = (i) => (t) => je(t, i), De = (i) => (t) => ze(t, i), x = (i) => i instanceof Array && i.length === 1 ? i[0] : i, Ie = (i) => {
587
+ const t = {}, e = i.split(":");
588
+ return e.length === 1 ? t.widget = x(e[0].split(",")) : e.length === 2 ? (t.implementation = x(e[0].split(",")), t.widget = x(e[1].split(","))) : (t.tenant = x(e[0].split(",")), t.implementation = x(e[1].split(",")), t.widget = x(e[2].split(","))), t;
589
+ }, Be = (i) => {
590
+ const t = {}, e = i.split(":");
591
+ return e.length === 1 ? t.implementation = x(e[0].split(",")) : (t.tenant = x(e[0].split(",")), t.implementation = x(e[1].split(","))), t;
592
+ }, et = j(), Ft = (i, t, e) => i.filter((s) => s.stage === t && ge(s.selector)(e));
593
+ function Ve(i) {
594
+ const t = i.container.get("$environment");
595
+ let e = et(t).configurationCache;
596
+ e && (e = e.filter((s) => s[0] !== i), et(t).configurationCache = e);
597
+ }
598
+ var st = /* @__PURE__ */ ((i) => (i.Implementation = "implementation", i.Widget = "widget", i))(st || {}), C = /* @__PURE__ */ ((i) => (i.Pre = "pre", i.Post = "post", i))(C || {});
599
+ const ve = (i, t, e) => (Object.keys(t).forEach((s) => {
600
+ const n = t[s];
601
+ if (typeof n == "function") {
602
+ const r = n();
603
+ typeof r.defaultArgs < "u" && e(r, ...r.defaultArgs), i[s] = (...o) => {
604
+ const a = Object.assign(
605
+ {},
606
+ r,
607
+ { handlerResolver: r.handlerResolver.bind({}) }
608
+ );
609
+ return e(a, ...o), i;
610
+ };
611
+ } else
612
+ i[s] = ve(
613
+ {},
614
+ n,
615
+ e
616
+ );
617
+ }), i), We = (i, t) => {
618
+ switch (t) {
619
+ case "implementation":
620
+ return i.implementation;
621
+ case "widget":
622
+ return i;
623
+ }
624
+ }, qt = (i, t, e, s) => (s.forEach((n) => {
625
+ ve(
626
+ i,
627
+ n,
628
+ (r, ...o) => {
629
+ const a = {
630
+ selector: t,
631
+ stage: r.stage,
632
+ handler: (h) => {
633
+ const c = We(h, r.scope), l = { container: c.container, events: c.events }, d = r.handlerResolver, p = d(l);
634
+ let u = et(e.environment).configurationCache;
635
+ return u || (u = et(e.environment).configurationCache = []), u.find((y) => y.indexOf(c) > -1 && y.indexOf(d) > -1) ? Promise.resolve() : (u.push([c, d]), Promise.resolve(p(...o)));
636
+ }
637
+ };
638
+ e.instructions.push(a);
639
+ }
640
+ );
641
+ }), i);
642
+ function Fe(i, t) {
643
+ function e(s) {
644
+ return qt(
645
+ {},
646
+ s,
647
+ i,
648
+ t
649
+ );
650
+ }
651
+ return qt(
652
+ e,
653
+ "*",
654
+ i,
655
+ t
656
+ );
657
+ }
658
+ const qe = (i, t, e, s) => {
659
+ try {
660
+ const n = new t(e, s);
661
+ return {
662
+ name: i,
663
+ invoke: (r, o) => {
664
+ let a;
665
+ return n[r] && (a = n[r].call(n, o)), Promise.resolve(a);
666
+ },
667
+ getInstance: () => n
668
+ };
669
+ } catch (n) {
670
+ if (n.message && n.message.indexOf("is not a constructor") >= 0)
671
+ return {
672
+ name: i,
673
+ invoke: (r) => {
674
+ let o;
675
+ return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
676
+ },
677
+ getInstance: () => t
678
+ };
679
+ throw n;
680
+ }
681
+ };
682
+ function Yt(i, t) {
683
+ return typeof i > "u" ? t : i;
684
+ }
685
+ let Ye = class {
686
+ constructor(t = {}) {
687
+ this.part = t;
688
+ }
689
+ createCommand(t, e, s) {
690
+ let n;
691
+ typeof e == "function" ? n = {
692
+ scope: st.Widget,
693
+ stage: C.Post,
694
+ defaultArgs: void 0,
695
+ handlerResolver: e
696
+ } : n = {
697
+ scope: Yt(e.scope, st.Widget),
698
+ stage: Yt(e.stage, C.Post),
699
+ defaultArgs: e.defaultArgs,
700
+ handlerResolver: s
701
+ };
702
+ let r = this.part;
703
+ const o = t.split(".");
704
+ return o.forEach((a, h) => {
705
+ h === o.length - 1 ? r[a] || (r[a] = () => n) : r = this.part[a] = this.part[a] || {};
706
+ }), this;
707
+ }
708
+ get() {
709
+ return this.part;
710
+ }
711
+ };
712
+ const me = (i) => {
713
+ const t = new Ye({});
714
+ return i(t), t.get();
715
+ }, Qe = me((i) => {
716
+ i.createCommand(
717
+ "types.register",
718
+ { scope: st.Implementation, stage: C.Pre },
719
+ (t) => (e, s) => {
720
+ t.container.get("$types")[e] = s;
721
+ }
722
+ ).createCommand(
723
+ "type",
724
+ { stage: C.Pre },
725
+ (t) => (e) => {
726
+ t.container.register("$type", e);
727
+ }
728
+ ).createCommand(
729
+ "settings",
730
+ { stage: C.Pre, defaultArgs: [null] },
731
+ (t) => (e) => {
732
+ t.events.dispatch(
733
+ "settings:change",
734
+ e,
735
+ { bubbles: !0 }
736
+ ), t.container.register("$settings", e);
737
+ }
738
+ ).createCommand(
739
+ "plugin",
740
+ { stage: C.Pre },
741
+ (t) => (e, s, n) => {
742
+ const { container: r } = t;
743
+ let o = null, a = e, h = s;
744
+ typeof e == "string" && (o = e, a = s, h = n);
745
+ const c = (l) => {
746
+ const { transformPluginSettings: d } = t.container.get("$environmentOptions"), p = d ? d(
747
+ h || {},
748
+ o,
749
+ t.container,
750
+ a
751
+ ) : s;
752
+ try {
753
+ const u = qe(
754
+ o,
755
+ a,
756
+ r,
757
+ p
758
+ );
759
+ r.get("$plugins").push(u), l && u.invoke("initialize", null);
760
+ } catch (u) {
761
+ f(t).warn("Error when initializing plugin", u);
762
+ }
763
+ };
764
+ t.container.get("$instance") ? c(!0) : t.events.subscribeOnce("widget:instance-created", () => c(!1));
765
+ }
766
+ ).createCommand(
767
+ "container.register",
768
+ (t) => (e, s) => {
769
+ t.container.register(e, s);
770
+ }
771
+ ).createCommand(
772
+ "container.registerAsync",
773
+ (t) => (e, s) => {
774
+ t.container.registerAsync(e, s);
775
+ }
776
+ ).createCommand(
777
+ "container.registerFactory",
778
+ (t) => (e, s) => {
779
+ t.container.registerFactory(e, s);
780
+ }
781
+ ).createCommand(
782
+ "container.touch",
783
+ (t) => (e, s) => {
784
+ t.container.touch(e, s);
785
+ }
786
+ ).createCommand(
787
+ "csp",
788
+ {},
789
+ (t) => (e) => {
790
+ t.container.register("csp", e);
791
+ }
792
+ );
793
+ }), Ze = Qe;
794
+ function Ke(i, t, e = []) {
795
+ const s = [Ze].concat(e), n = Fe(
796
+ t,
797
+ s
798
+ );
799
+ i(n, t);
800
+ }
801
+ let Je = class {
802
+ constructor() {
803
+ this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
804
+ }
805
+ add(t, e, s, n) {
806
+ this.tasks.push({ task: t, resolve: e, reject: s, done: n }), this.next();
807
+ }
808
+ next() {
809
+ this.current = this.current.then(() => {
810
+ const t = this.tasks.shift();
811
+ if (t) {
812
+ const e = Promise.resolve(t.task());
813
+ return Promise.resolve(e).then(this.next).then(() => e.then((s) => {
814
+ t.done(), t.resolve(s);
815
+ })).catch((s) => (t.done(), t.reject(s), this.next()));
816
+ }
817
+ return Promise.resolve();
818
+ });
819
+ }
820
+ };
821
+ const G = /* @__PURE__ */ new WeakMap();
822
+ function Ge(i) {
823
+ return G.has(i) || G.set(i, new Je()), (t) => new Promise((e, s) => {
824
+ const n = G.get(i);
825
+ n.add(t, e, s, () => {
826
+ n.tasks.length || G.delete(i);
827
+ });
828
+ });
829
+ }
830
+ const Qt = (i) => typeof i < "u", D = (i, t) => {
831
+ i.events.dispatch("widget:state-change", { state: t }, { bubbles: !0 }), i.state = t, i.events.dispatch("widget:state-changed", {}, { bubbles: !0 });
832
+ }, b = j(), Xe = (i) => {
833
+ const { container: t, events: e } = i;
834
+ t.get("$controller") || (t.register("$controller", new Re(t)), e.dispatch("widget:controller-created", {}, { bubbles: !0 }));
835
+ };
836
+ class ts {
837
+ /**
838
+ * Creates a new `Widget` instance.
839
+ * @param name Name of widget.
840
+ * @param implementation The implementation this instance belongs to.
841
+ * @param configuration Configuration for the widget.
842
+ */
843
+ constructor(t, e, s) {
844
+ this.state = "deactivated", this.name = t, this.implementation = e, this.container = e.container.createChild(this, t), this.events = e.events.createChild(this), b(this).subscriptions = [], s && e.configure((n) => {
845
+ const r = n(t);
846
+ Qt(s.type) && r.type(s.type), Qt(s.settings) && r.settings(s.settings), s.plugins && Object.keys(s.plugins).forEach((o) => {
847
+ var a;
848
+ const h = (a = s.plugins) == null ? void 0 : a[o];
849
+ r.plugin(o, h);
850
+ });
851
+ }), this.load = this.load.bind(this), this.activate = this.activate.bind(this), this.invoke = this.invoke.bind(this), this.deactivate = this.deactivate.bind(this);
852
+ }
853
+ /**
854
+ * Initializes the widget, if not already initialized, and applies any
855
+ * pending configuration.
856
+ */
857
+ load() {
858
+ return Ge(this)(() => {
859
+ b(this).deactivatedPromise = null;
860
+ const t = this.state === "deactivated";
861
+ t && (D(
862
+ this,
863
+ "activating"
864
+ /* Activating */
865
+ ), this.container.register("$widget", this), this.container.register("$controller", null), this.container.register("$plugins", []), this.container.register("$type", null), this.container.register("$instance", null)), D(
866
+ this,
867
+ "loading"
868
+ /* Loading */
869
+ );
870
+ const e = this.implementation.instructions, s = Ft(e, C.Pre, this);
871
+ return Promise.all(s.map((n) => n.handler(this))).then(() => {
872
+ Xe(this);
873
+ const n = Ft(e, C.Post, this);
874
+ return Promise.all(n.map((r) => r.handler(this))).then(() => {
875
+ t && this.container.get("$controller").initialize();
876
+ });
877
+ }).then(() => (D(
878
+ this,
879
+ "activated"
880
+ /* Activated */
881
+ ), this));
882
+ });
883
+ }
884
+ /**
885
+ * Activates the widget and makes it ready for receiving commands.
886
+ * @param data Activation data
887
+ */
888
+ activate(t) {
889
+ b(this).subscriptions.push(
890
+ this.implementation.events.subscribe("implementation:configured", () => {
891
+ [
892
+ "activated",
893
+ "activating",
894
+ "loading"
895
+ /* Loading */
896
+ ].indexOf(this.state) > -1 && this.load();
897
+ })
898
+ );
899
+ const e = b(this).activatedPromise;
900
+ return e ? (process.env.NODE_ENV !== "production" && f(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, t), e) : b(this).activatedPromise = this.load().then(() => this.container.get("$controller").activate(t));
901
+ }
902
+ /**
903
+ * Invokes a command on a widget. If the widget isn't activate the invocation
904
+ * will be suspended until activation.
905
+ * @param command Command to invoke.
906
+ * @param args Command arguments.
907
+ */
908
+ invoke(t, ...e) {
909
+ const s = b(this).activatedPromise, n = (r, ...o) => s.then(this.load).then(() => this.container.get("$controller").invoke(r, ...o));
910
+ return s ? n(t, ...e) : (process.env.NODE_ENV !== "production" && f(this).warn("You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.", this), new Promise((r) => {
911
+ const o = this.events.subscribe("widget:state-changed", () => {
912
+ this.state === "activated" && (o(), r(n(t, ...e)));
913
+ });
914
+ }));
915
+ }
916
+ /**
917
+ * Deactivates the widget by clearing the `Container` and removing any event subscriptions in the
918
+ * `EventManager`.
919
+ */
920
+ deactivate() {
921
+ return b(this).deactivatedPromise || (this.state === "deactivated" ? Promise.resolve() : (D(
922
+ this,
923
+ "deactivating"
924
+ /* Deactivating */
925
+ ), b(this).deactivatedPromise = this.container.get("$controller").deactivate().then(() => (b(this).activatedPromise = null, b(this).subscriptions.forEach((e) => e()), b(this).subscriptions = [], this.container.clear().then(() => {
926
+ this.events.clear(), Ve(this), D(
927
+ this,
928
+ "deactivated"
929
+ /* Deactivated */
930
+ );
931
+ })))));
932
+ }
933
+ }
934
+ const Zt = j();
935
+ class es {
936
+ /**
937
+ * Creates a new Implementation instance.
938
+ * @param configuration Configuration for the implementation.
939
+ * @param environment The parent environment.
940
+ * @param configurationApiExtensions Optional configuration API extensions.
941
+ */
942
+ constructor(t, e, s = []) {
943
+ this.instructions = [], this.widgets = /* @__PURE__ */ new Map(), this.name = t.name, this.tenant = t.tenant, this.environment = e, this.container = e.container.createChild(this, this.name), this.events = e.events.createChild(this), this.container.register("$types", {}), Zt(this).configurationApiExtensions = s;
944
+ }
945
+ /**
946
+ * Loads all widgets in the implementation.
947
+ */
948
+ load() {
949
+ const t = Array.from(this.widgets.values());
950
+ return Promise.all(t.map((e) => e.load())).then(() => t);
951
+ }
952
+ /**
953
+ * Configures the implementation by adding a configuration callback.
954
+ * @param configFn Callback function for configuration.
955
+ */
956
+ configure(t) {
957
+ return Ke(t, this, Zt(this).configurationApiExtensions), this.events.dispatch(
958
+ "implementation:configured",
959
+ { implementation: this },
960
+ { bubbles: !0 }
961
+ ), this;
962
+ }
963
+ /**
964
+ * Creates a widget on the implementation and returns its `WidgetData`.
965
+ * @param name Widget name.
966
+ * @param configuration Widget configuration.
967
+ */
968
+ createWidget(t, e) {
969
+ const s = new ts(t, this, e);
970
+ return this.widgets.set(s.name, s), s;
971
+ }
972
+ }
973
+ function ss(i, t, e) {
974
+ const s = new es(i, t, e);
975
+ return i.widgets && Object.keys(i.widgets).forEach((n) => {
976
+ var r;
977
+ const o = (r = i.widgets) == null ? void 0 : r[n];
978
+ s.createWidget(n, o);
979
+ }), s;
980
+ }
981
+ let Kt = class fe {
982
+ constructor(t, e) {
983
+ this.selectorFactory = e, typeof t == "function" ? this.resolver = t : this.resolver = () => t;
984
+ }
985
+ append(t) {
986
+ const e = typeof t == "function" ? t : () => t;
987
+ return new fe(
988
+ () => this.all().concat(e()),
989
+ this.selectorFactory
990
+ );
991
+ }
992
+ all() {
993
+ return this.resolver().concat([]);
994
+ }
995
+ query(t) {
996
+ return this.all().filter(this.selectorFactory(t));
997
+ }
998
+ find(t) {
999
+ const e = this.query(t);
1000
+ if (e.length)
1001
+ return e[0];
1002
+ }
1003
+ };
1004
+ const Ot = "#____version____#", pt = j(), is = (i) => i.tenant ? `${i.name}:${i.tenant}` : i.name, ye = class {
1005
+ constructor(t, e = [], s = {}) {
1006
+ this.widgets = new Kt(
1007
+ () => {
1008
+ let n = [];
1009
+ return this.implementations.all().forEach((r) => {
1010
+ n = n.concat(Array.from(r.widgets.values()));
1011
+ }), n;
1012
+ },
1013
+ ge
1014
+ ), this.implementations = new Kt([], De), this.name = t, this.container = new kt(this, t), this.events = new Le(this), this.container.register("$version", Ot), this.container.register("$environment", this), this.container.register("$environmentOptions", s), pt(this).configurationApiExtensions = e;
1015
+ }
1016
+ /**
1017
+ * Creates an implementation based on the provided configuration.
1018
+ * @param config Implementation configuration.
1019
+ */
1020
+ createImplementation(t) {
1021
+ const e = is(t);
1022
+ let s = this.implementations.find(e);
1023
+ if (s)
1024
+ return process.env.NODE_ENV !== "production" && f(s).warn(`Implementation "${e}" already exist on current environment.`), s;
1025
+ const n = pt(this).configurationApiExtensions;
1026
+ return s = ss(
1027
+ t,
1028
+ this,
1029
+ n
1030
+ ), this.implementations = this.implementations.append([s]), this.events.dispatch("implementation:created", { implementation: s }), s;
1031
+ }
1032
+ /**
1033
+ * Patches the Environment instance configuration.
1034
+ * @param configuration Environment configuration.
1035
+ */
1036
+ patch(t = {}) {
1037
+ const { name: e, configurationApiExtensions: s } = t;
1038
+ typeof e < "u" && e !== null && (this.name = e), s && s.forEach(
1039
+ (n) => {
1040
+ pt(this).configurationApiExtensions.push(n);
1041
+ }
1042
+ );
1043
+ }
1044
+ /**
1045
+ * Creates a new Environment instance based on the provided configuration.
1046
+ * @param configuration Environment configuration.
1047
+ */
1048
+ static create(t = {}) {
1049
+ return new ye(
1050
+ t.name || "",
1051
+ t.configurationApiExtensions,
1052
+ t.options
1053
+ );
1054
+ }
1055
+ };
1056
+ let $e = ye;
1057
+ $e.version = Ot;
1058
+ const rt = (i, t, ...e) => typeof t == "string" ? i(`[humany] ${t}`, ...e) : i(t, ...e), B = class {
1059
+ constructor() {
1060
+ this.keys = [], this.log = (t, ...e) => this.lookup(t, () => B.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => B.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => B.error(...e)), this.info = (t, ...e) => this.lookup(t, () => B.info(...e));
1061
+ }
1062
+ lookup(t, e) {
1063
+ this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
1064
+ }
1065
+ };
1066
+ let Q = B;
1067
+ Q.log = (...i) => rt(console.log, ...i);
1068
+ Q.warn = (...i) => rt(console.warn, ...i);
1069
+ Q.error = (...i) => rt(console.error, ...i);
1070
+ Q.info = (...i) => rt(console.info, ...i);
1071
+ const P = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
1072
+ function St() {
1073
+ return P() + P() + "-" + P() + "-" + P() + "-" + P() + "-" + P() + P() + P();
1074
+ }
1075
+ var ns = Object.defineProperty, rs = Object.defineProperties, os = Object.getOwnPropertyDescriptors, Jt = Object.getOwnPropertySymbols, as = Object.prototype.hasOwnProperty, cs = Object.prototype.propertyIsEnumerable, Gt = (i, t, e) => t in i ? ns(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, _t = (i, t) => {
1076
+ for (var e in t || (t = {}))
1077
+ as.call(t, e) && Gt(i, e, t[e]);
1078
+ if (Jt)
1079
+ for (var e of Jt(t))
1080
+ cs.call(t, e) && Gt(i, e, t[e]);
1081
+ return i;
1082
+ }, hs = (i, t) => rs(i, os(t));
1083
+ const ls = (i) => {
1084
+ const t = [];
1085
+ return [
1086
+ (e, s) => {
1087
+ t.push(i.subscribe(e, s));
1088
+ },
1089
+ () => {
1090
+ t.forEach((e) => {
1091
+ e();
1092
+ });
1093
+ }
1094
+ ];
1095
+ };
1096
+ let Nt = class {
1097
+ constructor(t, e = []) {
1098
+ this.platform = t, this.rules = e;
1099
+ }
1100
+ match(t) {
1101
+ return this.rules.every((e) => !(e.id && e.id !== t.id || e.type && e.type !== t.type));
1102
+ }
1103
+ ofType(t) {
1104
+ return this.rules.push({ type: t }), this;
1105
+ }
1106
+ withId(t) {
1107
+ return this.rules.push({ id: t }), this;
1108
+ }
1109
+ select() {
1110
+ return new ds(this.platform, this);
1111
+ }
1112
+ }, be = class {
1113
+ constructor(t, e, s) {
1114
+ this.platform = t, this.node = e, this.actions = new Tt(
1115
+ t,
1116
+ new Nt(t).withId(e.id),
1117
+ s
1118
+ );
1119
+ const [n, r] = ls(this.platform.events);
1120
+ this.subscribe = n, this.unsubscribe = r;
1121
+ }
1122
+ properties(t) {
1123
+ return t && this.node.touchProperties((e) => t(e)), this.node.attributes.properties;
1124
+ }
1125
+ context(t) {
1126
+ return t && this.subscribe("components:context-changed", (e, { node: s }) => {
1127
+ s === this.node && t(this.node.attributes.context);
1128
+ }), this.node.attributes.context;
1129
+ }
1130
+ layout(t) {
1131
+ return t && this.subscribe("components:layout-changed", (e, { node: s }) => {
1132
+ s === this.node && t(this.node.attributes.layout);
1133
+ }), this.node.attributes.layout;
1134
+ }
1135
+ writeProperties(t, e) {
1136
+ this.node.writeProperties(t, e);
1137
+ }
1138
+ writeContext(t, e) {
1139
+ this.node.writeProperties(t, e);
1140
+ }
1141
+ writeLayout(t, e) {
1142
+ this.node.writeLayout(t, e);
1143
+ }
1144
+ dispose() {
1145
+ this.unsubscribe(), this.actions.dispose();
1146
+ }
1147
+ };
1148
+ class ds {
1149
+ constructor(t, e, s = !0) {
1150
+ this.platform = t, this.target = e, this.clearOnDispose = s, this.removes = [], this.actions = new Tt(this.platform, this.target);
1151
+ }
1152
+ writeProperties(t, e) {
1153
+ this.removes.push(
1154
+ this.platform.write({
1155
+ options: e,
1156
+ attributes: { properties: t },
1157
+ target: this.target,
1158
+ removable: this.clearOnDispose
1159
+ })
1160
+ );
1161
+ }
1162
+ writeContext(t, e) {
1163
+ this.removes.push(
1164
+ this.platform.write({
1165
+ options: e,
1166
+ attributes: { context: t },
1167
+ target: this.target,
1168
+ removable: this.clearOnDispose
1169
+ })
1170
+ );
1171
+ }
1172
+ writeLayout(t, e) {
1173
+ this.removes.push(
1174
+ this.platform.write({
1175
+ options: e,
1176
+ attributes: { layout: t },
1177
+ target: this.target,
1178
+ removable: this.clearOnDispose
1179
+ })
1180
+ );
1181
+ }
1182
+ dispose() {
1183
+ this.removes.forEach((t) => {
1184
+ t();
1185
+ }), this.actions.dispose();
1186
+ }
1187
+ }
1188
+ const ps = (i, t, e) => {
1189
+ const s = i.concat(), n = (r, o, a) => {
1190
+ let h = !0;
1191
+ if (s.length) {
1192
+ const c = s.shift(), l = (d, p) => (h = !1, n(d, Object.assign({}, o, p), a));
1193
+ return Promise.resolve(c(r, l, a)).then((d) => hs(_t({}, d), {
1194
+ cancelled: h
1195
+ }));
1196
+ }
1197
+ return Promise.resolve({ data: r, cancelled: !1, options: o });
1198
+ };
1199
+ return n(t, {}, e);
1200
+ };
1201
+ let Tt = class {
1202
+ constructor(t, e, s) {
1203
+ this.platform = t, this.target = e, this.ns = s, this.subscriptions = [], this.create = this.create.bind(this);
1204
+ }
1205
+ create(t, e = () => {
1206
+ }) {
1207
+ const s = {
1208
+ key: t,
1209
+ fn: e,
1210
+ target: this.target,
1211
+ ns: this.ns
1212
+ };
1213
+ this.platform.actionsState.handlers.push(s);
1214
+ const n = () => {
1215
+ const r = this.platform.actionsState.handlers.indexOf(s);
1216
+ r > -1 && this.platform.actionsState.handlers.splice(r, 1);
1217
+ };
1218
+ return this.subscriptions.push(n), n;
1219
+ }
1220
+ dispatch(t, e) {
1221
+ const s = this.platform.nodes.all.concat(
1222
+ this.platform.nodes.detached
1223
+ ), n = {}, r = this.platform.actionsState.handlers.filter(
1224
+ (o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)
1225
+ );
1226
+ return Promise.all(
1227
+ r.map((o) => {
1228
+ const a = s.filter(
1229
+ (c) => o.target.match(c) && this.target.match(c)
1230
+ ), h = this.platform.actionsState.watchers.filter((c) => c.key === t && (!c.ns || !this.ns || c.ns === this.ns) && a.some((l) => c.target.match(l))).map((c) => c.fn);
1231
+ return Promise.all(
1232
+ a.map((c) => {
1233
+ const l = new be(
1234
+ this.platform,
1235
+ c,
1236
+ this.ns
1237
+ );
1238
+ return ps(h, e, l).then((d) => {
1239
+ const { data: p = {}, options: u, cancelled: y } = d;
1240
+ return Promise.resolve(
1241
+ y ? {} : o.fn(p, u, l)
1242
+ ).then((w) => {
1243
+ n[c.id] = w;
1244
+ });
1245
+ });
1246
+ })
1247
+ );
1248
+ })
1249
+ ).then(() => n);
1250
+ }
1251
+ watch(t, e) {
1252
+ let s = t, n = this.ns;
1253
+ const r = t.split(".");
1254
+ r.length > 1 && (n = r[0], s = r.splice(1).join("."));
1255
+ const o = {
1256
+ fn: e,
1257
+ target: this.target,
1258
+ key: s,
1259
+ ns: n
1260
+ };
1261
+ this.platform.actionsState.watchers.push(o);
1262
+ const a = () => {
1263
+ const h = this.platform.actionsState.watchers.indexOf(o);
1264
+ h > -1 && this.platform.actionsState.watchers.splice(h, 1);
1265
+ };
1266
+ return this.subscriptions.push(a), a;
1267
+ }
1268
+ dispose() {
1269
+ this.subscriptions.forEach((t) => t());
1270
+ }
1271
+ };
1272
+ me((i) => {
1273
+ i.createCommand("components", (t) => (e) => {
1274
+ t.events.subscribeOnce("components:platform-created", (s, { platform: n }) => {
1275
+ e.handlers && e.handlers.forEach(([r, o]) => {
1276
+ n.addComponentHandler(r, o);
1277
+ });
1278
+ });
1279
+ });
1280
+ });
1281
+ let Xt = class {
1282
+ constructor(t, e) {
1283
+ this.events = t, this.tags = [], this.children = {}, this.changesets = [], this.mountCount = 0, this.id = St(), this.type = e, this.attributes = {
1284
+ context: {},
1285
+ properties: {},
1286
+ layout: {},
1287
+ tags: []
1288
+ }, this.writeLayout({ size: "full", indent: 0 });
1289
+ }
1290
+ mount(t, e) {
1291
+ let s = t.get("mounted-nodes");
1292
+ return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" && Q.error("Trying to mount an already mounted component node.", this), () => {
1293
+ }) : (this.events.dispatch("components:node-mounted", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch("components:node-enter", { node: this })), () => {
1294
+ s.delete(this), this.events.dispatch("components:node-unmounted", { node: this }), this.mountCount = this.mountCount - 1, this.mountCount === 0 && this.events.dispatch("components:node-exit", { node: this });
1295
+ });
1296
+ }
1297
+ appendChild(t, e = "default") {
1298
+ if (t.parent) {
1299
+ if (t.parent === this)
1300
+ return;
1301
+ t.parent.removeChild(t);
1302
+ }
1303
+ t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].push(t), this.events.dispatch("components:node-appended", { node: t });
1304
+ }
1305
+ prependChild(t, e = "default") {
1306
+ if (t.parent) {
1307
+ if (t.parent === this)
1308
+ return;
1309
+ t.parent.removeChild(t);
1310
+ }
1311
+ t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].unshift(t), this.events.dispatch("components:node-appended", { node: t });
1312
+ }
1313
+ touchProperties(t, e = {}, s) {
1314
+ const n = [{ properties: t }, e];
1315
+ return this.changesets.push(n), this.events.dispatch("components:set-properties", { node: this }), () => {
1316
+ if (s) {
1317
+ const r = this.changesets.indexOf(n);
1318
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
1319
+ }
1320
+ };
1321
+ }
1322
+ writeProperties(t, e = {}, s) {
1323
+ const n = [{ properties: t }, e];
1324
+ return this.changesets.push(n), this.events.dispatch("components:set-properties", { node: this }), () => {
1325
+ if (s) {
1326
+ const r = this.changesets.indexOf(n);
1327
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
1328
+ }
1329
+ };
1330
+ }
1331
+ writeLayout(t, e = {}, s) {
1332
+ const n = [{ layout: t }, e];
1333
+ return this.changesets.push(n), this.events.dispatch("components:set-layout", { node: this }), () => {
1334
+ if (!s)
1335
+ return;
1336
+ const r = this.changesets.indexOf(n);
1337
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-layout", { node: this }));
1338
+ };
1339
+ }
1340
+ writeContext(t, e = {}, s) {
1341
+ const n = [{ context: t }, e];
1342
+ return this.changesets.push(n), this.events.dispatch("components:set-context", { node: this }), () => {
1343
+ if (!s)
1344
+ return;
1345
+ const r = this.changesets.indexOf(n);
1346
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-context", { node: this }));
1347
+ };
1348
+ }
1349
+ getChildren(t = "default") {
1350
+ const e = this.children[t] || [];
1351
+ return e.reduce((s, n, r) => {
1352
+ const { order: o = r } = n.attributes.layout;
1353
+ return s[o] ? s.splice(o, 0, n) : s[o] = n, s;
1354
+ }, Array(e.length));
1355
+ }
1356
+ remove() {
1357
+ this.parent && this.parent.removeChild(this);
1358
+ }
1359
+ removeChild(t) {
1360
+ Object.keys(this.children).forEach((e) => {
1361
+ const s = this.children[e], n = s.indexOf(t);
1362
+ n > -1 && (s.splice(n, 1), this.events.dispatch("components:node-removed", { node: t, parentNode: this }));
1363
+ }), delete t.parent;
1364
+ }
1365
+ };
1366
+ const we = (i, t, e) => {
1367
+ for (let s = 0, n = i.length; s < n && e(i[s]) !== !0; s++) {
1368
+ const r = t[i[s].id] || "default", o = i[s].getChildren(r);
1369
+ we(o, t, e);
1370
+ }
1371
+ }, Mt = (i, t, e) => {
1372
+ if (e(i) !== !0) {
1373
+ const s = t[i.id] || "default", n = i.children[s];
1374
+ we(n, t, e);
1375
+ }
1376
+ }, ut = (i, t) => {
1377
+ const e = [];
1378
+ return Mt(i, t, (s) => {
1379
+ e.push(s);
1380
+ }), e;
1381
+ }, us = (i, t, e) => {
1382
+ let s;
1383
+ return Mt(i, t, (n) => {
1384
+ if (e(n))
1385
+ return s = n, !0;
1386
+ }), s;
1387
+ };
1388
+ class gs {
1389
+ constructor(t, e, s) {
1390
+ this.root = t, this.switches = e, this.all = [], this.visible = [], this.detached = [], s.subscribe("components:node-appended", (n, r) => {
1391
+ this.all.push(r.node), this.visible = ut(t, e);
1392
+ }), s.subscribe("components:node-removed", (n, r) => {
1393
+ let o = this.all.indexOf(r.node);
1394
+ o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(r.node), o > -1 && this.visible.splice(o, 1), this.visible = ut(t, e);
1395
+ }), s.subscribe("components:node-switched", (n, r) => {
1396
+ this.visible = ut(t, e);
1397
+ });
1398
+ }
1399
+ query(t = {}) {
1400
+ const e = [];
1401
+ return Mt(this.root, this.switches, (s) => {
1402
+ Object.keys(t).every((n) => t[n] === s[n]) && e.push(s);
1403
+ }), e;
1404
+ }
1405
+ get(t) {
1406
+ return us(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
1407
+ }
1408
+ }
1409
+ class vs {
1410
+ constructor() {
1411
+ this.handlers = /* @__PURE__ */ new Map();
1412
+ }
1413
+ add(t, e) {
1414
+ this.handlers.set(t, e);
1415
+ }
1416
+ get(t) {
1417
+ return this.handlers.get(t);
1418
+ }
1419
+ }
1420
+ const ms = (i) => {
1421
+ let t = i, e = 0;
1422
+ for (; t.parent; )
1423
+ e = e + 1, t = t.parent;
1424
+ return e;
1425
+ }, fs = (i) => i.map(([t, e]) => [ms(t), t, e]).sort(([t], [e]) => t - e).map(([, t, e]) => [t, e]), gt = (i) => i instanceof Date ? !1 : i && typeof i == "object" && !Array.isArray(i), E = (i, ...t) => {
1426
+ if (!t.length)
1427
+ return i;
1428
+ const e = t.shift();
1429
+ if (gt(i) && gt(e))
1430
+ for (const s in e)
1431
+ gt(e[s]) ? (i[s] || Object.assign(i, { [s]: {} }), E(i[s], e[s])) : Object.assign(i, { [s]: e[s] });
1432
+ return E(i, ...t);
1433
+ }, ys = (i, t) => !i || i === "all" ? !0 : i.some((e) => t.indexOf(e) > -1), $s = (i, t) => {
1434
+ let e = [], s = [], n;
1435
+ const r = () => {
1436
+ process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
1437
+ const a = /* @__PURE__ */ new Map(), h = fs(e.map((l, d) => [l, s[d]])), c = (l, d) => {
1438
+ var p;
1439
+ const u = a.get(l) || {}, y = d.context && !u.context, w = d.properties && !u.properties, at = d.layout && !u.layout;
1440
+ a.set(l, {
1441
+ context: u.context || y,
1442
+ properties: u.properties || w,
1443
+ layout: u.layout || at
1444
+ }), w && (l.attributes.properties = {}), at && (l.attributes.layout = {}), y && (l.attributes.context = E({}, (p = l.parent) == null ? void 0 : p.attributes.context));
1445
+ const jt = [], zt = [], Dt = [];
1446
+ if (l.changesets.forEach((A) => {
1447
+ const [$, ct] = A;
1448
+ ys(ct.breakpoints, i.breakpoints) && (w && (typeof $.properties == "function" ? jt.push(
1449
+ $.properties
1450
+ ) : E(l.attributes.properties, $.properties)), at && (typeof $.layout == "function" ? zt.push($.layout) : E(l.attributes.layout, $.layout)), y && (typeof $.context == "function" ? Dt.push($.context) : E(l.attributes.context, $.context)));
1451
+ }), jt.forEach((A) => {
1452
+ E(l.attributes.properties, A(l.attributes.properties));
1453
+ }), zt.forEach((A) => {
1454
+ E(l.attributes.layout, A(l.attributes.layout));
1455
+ }), Dt.forEach((A) => {
1456
+ E(l.attributes.context, A(l.attributes.context));
1457
+ }), y || d.recursive) {
1458
+ const A = i.getBranch(l), $ = d.recursive ? d : {
1459
+ context: !!y
1460
+ };
1461
+ l.getChildren(A).forEach((ct) => {
1462
+ c(ct, $);
1463
+ });
1464
+ }
1465
+ };
1466
+ process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"), h.forEach(([l, d]) => {
1467
+ c(l, d);
1468
+ }), e = [], s = [], t(a);
1469
+ }, o = () => {
1470
+ clearTimeout(n), n = setTimeout(r, 0);
1471
+ };
1472
+ return (a, h) => {
1473
+ const c = e.indexOf(a);
1474
+ if (c > -1) {
1475
+ const l = s[c];
1476
+ return h.context && (l.context = !0), h.properties && (l.properties = !0), h.layout && (l.layout = !0), h.recursive && (l.recursive = !0), o();
1477
+ }
1478
+ return e.push(a), s.push(h), o();
1479
+ };
1480
+ };
1481
+ class bs {
1482
+ constructor(t, e = {}) {
1483
+ this.providers = e, this.breakpoints = [], this.actionsState = { handlers: [], watchers: [] }, this.switches = {}, this.changesets = [], this.subscriptions = [], this.customComponentHandler = new vs(), this.events = t.events.createChild(this);
1484
+ const s = new Xt(this.events, "root");
1485
+ s.name = `root-${t.name}`, this.nodes = new gs(s, this.switches, this.events);
1486
+ const n = this.processNode = $s(this, (r) => {
1487
+ const o = Array.from(r.keys());
1488
+ process.env.NODE_ENV !== "production" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
1489
+ ${o.map(
1490
+ (a) => `${a.name || "<no name>"} (${a.id})
1491
+ `
1492
+ )}`), o.forEach((a) => {
1493
+ const h = r.get(a);
1494
+ a.parent && a.parent.type === "root" && this.events.dispatch("components:root-children-changed", { node: a }), h != null && h.context && this.events.dispatch("components:context-changed", { node: a }), h != null && h.properties && this.events.dispatch("components:properties-changed", { node: a }), h != null && h.layout && this.events.dispatch("components:layout-changed", { node: a });
1495
+ }), this.events.dispatch("components:component-model-initialized", {}, { bubbles: !0 });
1496
+ });
1497
+ Promise.all(
1498
+ Object.keys(e).map((r) => e[r].load(this))
1499
+ ), this.subscriptions.push(
1500
+ this.events.subscribe(
1501
+ "components:node-appended",
1502
+ (r, o) => {
1503
+ const { node: a } = o;
1504
+ this.changesets.forEach((h) => {
1505
+ const { changeset: c, target: l, removes: d } = h, [p, u] = c;
1506
+ l.match(o.node) && (p.properties && d.push(a.writeProperties(p.properties, u)), p.context && d.push(a.writeContext(p.context, u)), p.layout && d.push(a.writeLayout(p.layout, u)));
1507
+ });
1508
+ }
1509
+ )
1510
+ ), this.subscriptions.push(
1511
+ this.events.subscribe(
1512
+ "components:node-appended",
1513
+ (r, o) => {
1514
+ n(o.node, { properties: !0, context: !0 });
1515
+ }
1516
+ )
1517
+ ), this.subscriptions.push(
1518
+ this.events.subscribe(
1519
+ "components:set-properties",
1520
+ (r, o) => {
1521
+ n(o.node, { properties: !0 });
1522
+ }
1523
+ )
1524
+ ), this.subscriptions.push(
1525
+ this.events.subscribe(
1526
+ "components:set-context",
1527
+ (r, o) => {
1528
+ n(o.node, { properties: !0, context: !0 });
1529
+ }
1530
+ )
1531
+ ), this.subscriptions.push(
1532
+ this.events.subscribe(
1533
+ "components:set-indent",
1534
+ (r, o) => {
1535
+ n(o.node, { layout: !0 });
1536
+ }
1537
+ )
1538
+ ), this.subscriptions.push(
1539
+ this.events.subscribe(
1540
+ "components:set-layout",
1541
+ (r, o) => {
1542
+ n(o.node, { layout: !0 });
1543
+ }
1544
+ )
1545
+ ), this.subscriptions.push(
1546
+ this.events.subscribe("components:node-switched", (r, { node: o, branch: a }) => {
1547
+ n(o, {
1548
+ layout: !0,
1549
+ recursive: !0,
1550
+ properties: !0,
1551
+ context: !0
1552
+ });
1553
+ })
1554
+ ), this.subscriptions.push(
1555
+ this.events.subscribe("components:node-removed", (r, { parentNode: o }) => {
1556
+ n(o, { properties: !0 });
1557
+ })
1558
+ ), this.events.parent && this.events.parent.dispatch("components:platform-created", { platform: this });
1559
+ }
1560
+ static getInstance(t) {
1561
+ return t.getAsync("components");
1562
+ }
1563
+ addBreakpoint(t) {
1564
+ this.breakpoints.indexOf(t) === -1 && (this.breakpoints.push(t), this.processNode(this.nodes.root, {
1565
+ context: !0,
1566
+ properties: !0,
1567
+ layout: !0,
1568
+ recursive: !0
1569
+ }));
1570
+ }
1571
+ removeBreakpoint(t) {
1572
+ const e = this.breakpoints.indexOf(t);
1573
+ e > -1 && (this.breakpoints.splice(e, 1), this.processNode(this.nodes.root, {
1574
+ context: !0,
1575
+ properties: !0,
1576
+ layout: !0,
1577
+ recursive: !0
1578
+ }));
1579
+ }
1580
+ setSwitch(t, e) {
1581
+ this.switches[t.id] = e, this.events.dispatch("components:node-switched", { node: t, branch: e });
1582
+ }
1583
+ getBranch(t) {
1584
+ return this.switches[t.id];
1585
+ }
1586
+ /**
1587
+ * Creates a `ComponentNode` of the specified type.
1588
+ * @param type Type of node.
1589
+ */
1590
+ createNode(t, e = {}) {
1591
+ const s = new Xt(this.events, t);
1592
+ return e.detached && this.nodes.detached.push(s), s;
1593
+ }
1594
+ components() {
1595
+ return new Nt(this);
1596
+ }
1597
+ actions(t, e) {
1598
+ return new Tt(this, t, e);
1599
+ }
1600
+ write(t) {
1601
+ const { provider: e, target: s, attributes: n, options: r = {}, removable: o } = t, a = t.key || St(), h = { changeset: [n, r], target: s, removes: [] };
1602
+ if (e) {
1603
+ const c = this.providers[e];
1604
+ c.write(a, s, n, r), h.removes.push(() => {
1605
+ c.remove(a);
1606
+ });
1607
+ }
1608
+ return this.changesets.push(h), this.nodes.all.forEach((c) => {
1609
+ if (s.match(c)) {
1610
+ let l = () => {
1611
+ };
1612
+ n.properties && (l = c.writeProperties(n.properties, r, o)), n.context && (l = c.writeContext(n.context, r, o)), n.layout && (l = c.writeContext(n.layout, r, o)), h.removes.push(l);
1613
+ }
1614
+ }), () => {
1615
+ if (o) {
1616
+ h.removes.forEach((l) => l());
1617
+ const c = this.changesets.indexOf(h);
1618
+ c > -1 && this.changesets.splice(c, 1);
1619
+ }
1620
+ };
1621
+ }
1622
+ addComponentHandler(t, e) {
1623
+ this.customComponentHandler.add(t, e);
1624
+ }
1625
+ getComponentHandler(t) {
1626
+ return this.customComponentHandler.get(t);
1627
+ }
1628
+ dispose() {
1629
+ this.subscriptions.forEach((t) => t());
1630
+ }
1631
+ }
1632
+ const oi = (i, t) => ({
1633
+ id: i.id,
1634
+ type: i.type,
1635
+ name: i.name,
1636
+ branch: t || "default"
1637
+ }), ws = (i, t, e, s = St(), n = {}) => i.getAsync("components").then((r) => {
1638
+ let o;
1639
+ if (typeof t == "string") {
1640
+ const c = new Nt(r);
1641
+ c.ofType(t), o = c;
1642
+ } else
1643
+ o = t;
1644
+ const a = {}, h = (c) => {
1645
+ const l = a[c.id];
1646
+ return l ? Promise.resolve(l.controller) : bs.getInstance(i).then((d) => new be(d, c, s));
1647
+ };
1648
+ r.events.subscribe(
1649
+ "components:node-enter",
1650
+ (c, { node: l }) => {
1651
+ o.match(l) && h(l).then((d) => {
1652
+ Promise.resolve(e(d)).then((p) => {
1653
+ a[l.id] = {
1654
+ dispose: p,
1655
+ controller: d
1656
+ };
1657
+ });
1658
+ });
1659
+ }
1660
+ ), r.events.subscribe(
1661
+ "components:node-exit",
1662
+ (c, { node: l }) => {
1663
+ const d = a[l.id];
1664
+ d && (d.dispose && d.dispose(), n.reuseController || (d.controller.dispose(), delete a[l.id]));
1665
+ }
1666
+ );
1667
+ }), _s = "#____version____#", _e = class extends $e {
1668
+ constructor(t, e = []) {
1669
+ super(t, e, {
1670
+ transformPluginSettings: (s, n, r) => {
1671
+ const o = r.get("$settings"), a = o.plugins && n ? o.plugins[n] || {} : {};
1672
+ return _t(_t({}, a), s);
1673
+ }
1674
+ });
1675
+ }
1676
+ createImplementation(t) {
1677
+ const e = super.createImplementation(t);
1678
+ return e.bindings = t.bindings, e;
1679
+ }
1680
+ /**
1681
+ * Performs navigation for widgets matching the specified selector by invoking a
1682
+ * 'navigate' command.
1683
+ * @param selector Widget selector matching the widget(s) to perform navigation on.
1684
+ * @param route Route name.
1685
+ * @param params Route params.
1686
+ */
1687
+ navigate(t, e, s) {
1688
+ this.widgets.query(t).forEach((n) => n.invoke("navigate", { route: e, params: s }));
1689
+ }
1690
+ /**
1691
+ * Creates a runtime based on provided configuration.
1692
+ * @param configuration Runtime configuration.
1693
+ */
1694
+ static create(t = {}) {
1695
+ const e = [Te].concat(
1696
+ t.configurationApiExtensions || []
1697
+ );
1698
+ return new _e("humany", e);
1699
+ }
1700
+ /**
1701
+ * Creates a widget runtime based on provided configuration and retains configuration handlers
1702
+ * registered on global context. Use this factory to fully support the default embed script.
1703
+ * Will return any existing widget runtime if available.
1704
+ * @param configuration Runtime configuration.
1705
+ * @param global Object to read configuration handlers from (default: window).
1706
+ */
1707
+ static createFromGlobal(t, e = {}) {
1708
+ if (this.isRuntime(t))
1709
+ return t.patch(e), t;
1710
+ const s = [], n = t && t._c;
1711
+ n && n.forEach((o) => s.push(o));
1712
+ const r = this.create(e);
1713
+ return r.container.register("$runtimecfg", s), r;
1714
+ }
1715
+ /**
1716
+ * Determines whether the specified object is a valid widget runtime.
1717
+ * @param obj Object to compare.
1718
+ */
1719
+ static isRuntime(t) {
1720
+ return !!(t && typeof t == "object" && t.container && typeof t.container.get == "function" && t.container.get("$environment") === t && t.container.owner === t);
1721
+ }
1722
+ };
1723
+ let As = _e;
1724
+ As.version = `${_s} (${Ot})`;
1725
+ /**
1726
+ * @license
1727
+ * Copyright 2019 Google LLC
1728
+ * SPDX-License-Identifier: BSD-3-Clause
1729
+ */
1730
+ const tt = window, Ut = tt.ShadowRoot && (tt.ShadyCSS === void 0 || tt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ht = Symbol(), te = /* @__PURE__ */ new WeakMap();
1731
+ let Ae = class {
1732
+ constructor(t, e, s) {
1733
+ if (this._$cssResult$ = !0, s !== Ht)
1734
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
1735
+ this.cssText = t, this.t = e;
1736
+ }
1737
+ get styleSheet() {
1738
+ let t = this.o;
1739
+ const e = this.t;
1740
+ if (Ut && t === void 0) {
1741
+ const s = e !== void 0 && e.length === 1;
1742
+ s && (t = te.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && te.set(e, t));
1743
+ }
1744
+ return t;
1745
+ }
1746
+ toString() {
1747
+ return this.cssText;
1748
+ }
1749
+ };
1750
+ const Es = (i) => new Ae(typeof i == "string" ? i : i + "", void 0, Ht), xs = (i, ...t) => {
1751
+ const e = i.length === 1 ? i[0] : t.reduce((s, n, r) => s + ((o) => {
1752
+ if (o._$cssResult$ === !0)
1753
+ return o.cssText;
1754
+ if (typeof o == "number")
1755
+ return o;
1756
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
1757
+ })(n) + i[r + 1], i[0]);
1758
+ return new Ae(e, i, Ht);
1759
+ }, Cs = (i, t) => {
1760
+ Ut ? i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
1761
+ const s = document.createElement("style"), n = tt.litNonce;
1762
+ n !== void 0 && s.setAttribute("nonce", n), s.textContent = e.cssText, i.appendChild(s);
1763
+ });
1764
+ }, ee = Ut ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
1765
+ let e = "";
1766
+ for (const s of t.cssRules)
1767
+ e += s.cssText;
1768
+ return Es(e);
1769
+ })(i) : i;
1770
+ /**
1771
+ * @license
1772
+ * Copyright 2017 Google LLC
1773
+ * SPDX-License-Identifier: BSD-3-Clause
1774
+ */
1775
+ var vt;
1776
+ const it = window, se = it.trustedTypes, Ps = se ? se.emptyScript : "", ie = it.reactiveElementPolyfillSupport, At = { toAttribute(i, t) {
1777
+ switch (t) {
1778
+ case Boolean:
1779
+ i = i ? Ps : null;
1780
+ break;
1781
+ case Object:
1782
+ case Array:
1783
+ i = i == null ? i : JSON.stringify(i);
1784
+ }
1785
+ return i;
1786
+ }, fromAttribute(i, t) {
1787
+ let e = i;
1788
+ switch (t) {
1789
+ case Boolean:
1790
+ e = i !== null;
1791
+ break;
1792
+ case Number:
1793
+ e = i === null ? null : Number(i);
1794
+ break;
1795
+ case Object:
1796
+ case Array:
1797
+ try {
1798
+ e = JSON.parse(i);
1799
+ } catch {
1800
+ e = null;
1801
+ }
1802
+ }
1803
+ return e;
1804
+ } }, Ee = (i, t) => t !== i && (t == t || i == i), mt = { attribute: !0, type: String, converter: At, reflect: !1, hasChanged: Ee }, Et = "finalized";
1805
+ let U = class extends HTMLElement {
1806
+ constructor() {
1807
+ super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this._$Eu();
1808
+ }
1809
+ static addInitializer(t) {
1810
+ var e;
1811
+ this.finalize(), ((e = this.h) !== null && e !== void 0 ? e : this.h = []).push(t);
1812
+ }
1813
+ static get observedAttributes() {
1814
+ this.finalize();
1815
+ const t = [];
1816
+ return this.elementProperties.forEach((e, s) => {
1817
+ const n = this._$Ep(s, e);
1818
+ n !== void 0 && (this._$Ev.set(n, s), t.push(n));
1819
+ }), t;
1820
+ }
1821
+ static createProperty(t, e = mt) {
1822
+ if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
1823
+ const s = typeof t == "symbol" ? Symbol() : "__" + t, n = this.getPropertyDescriptor(t, s, e);
1824
+ n !== void 0 && Object.defineProperty(this.prototype, t, n);
1825
+ }
1826
+ }
1827
+ static getPropertyDescriptor(t, e, s) {
1828
+ return { get() {
1829
+ return this[e];
1830
+ }, set(n) {
1831
+ const r = this[t];
1832
+ this[e] = n, this.requestUpdate(t, r, s);
1833
+ }, configurable: !0, enumerable: !0 };
1834
+ }
1835
+ static getPropertyOptions(t) {
1836
+ return this.elementProperties.get(t) || mt;
1837
+ }
1838
+ static finalize() {
1839
+ if (this.hasOwnProperty(Et))
1840
+ return !1;
1841
+ this[Et] = !0;
1842
+ const t = Object.getPrototypeOf(this);
1843
+ if (t.finalize(), t.h !== void 0 && (this.h = [...t.h]), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
1844
+ const e = this.properties, s = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
1845
+ for (const n of s)
1846
+ this.createProperty(n, e[n]);
1847
+ }
1848
+ return this.elementStyles = this.finalizeStyles(this.styles), !0;
1849
+ }
1850
+ static finalizeStyles(t) {
1851
+ const e = [];
1852
+ if (Array.isArray(t)) {
1853
+ const s = new Set(t.flat(1 / 0).reverse());
1854
+ for (const n of s)
1855
+ e.unshift(ee(n));
1856
+ } else
1857
+ t !== void 0 && e.push(ee(t));
1858
+ return e;
1859
+ }
1860
+ static _$Ep(t, e) {
1861
+ const s = e.attribute;
1862
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
1863
+ }
1864
+ _$Eu() {
1865
+ var t;
1866
+ this._$E_ = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), (t = this.constructor.h) === null || t === void 0 || t.forEach((e) => e(this));
1867
+ }
1868
+ addController(t) {
1869
+ var e, s;
1870
+ ((e = this._$ES) !== null && e !== void 0 ? e : this._$ES = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((s = t.hostConnected) === null || s === void 0 || s.call(t));
1871
+ }
1872
+ removeController(t) {
1873
+ var e;
1874
+ (e = this._$ES) === null || e === void 0 || e.splice(this._$ES.indexOf(t) >>> 0, 1);
1875
+ }
1876
+ _$Eg() {
1877
+ this.constructor.elementProperties.forEach((t, e) => {
1878
+ this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]);
1879
+ });
1880
+ }
1881
+ createRenderRoot() {
1882
+ var t;
1883
+ const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
1884
+ return Cs(e, this.constructor.elementStyles), e;
1885
+ }
1886
+ connectedCallback() {
1887
+ var t;
1888
+ this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
1889
+ var s;
1890
+ return (s = e.hostConnected) === null || s === void 0 ? void 0 : s.call(e);
1891
+ });
1892
+ }
1893
+ enableUpdating(t) {
1894
+ }
1895
+ disconnectedCallback() {
1896
+ var t;
1897
+ (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
1898
+ var s;
1899
+ return (s = e.hostDisconnected) === null || s === void 0 ? void 0 : s.call(e);
1900
+ });
1901
+ }
1902
+ attributeChangedCallback(t, e, s) {
1903
+ this._$AK(t, s);
1904
+ }
1905
+ _$EO(t, e, s = mt) {
1906
+ var n;
1907
+ const r = this.constructor._$Ep(t, s);
1908
+ if (r !== void 0 && s.reflect === !0) {
1909
+ const o = (((n = s.converter) === null || n === void 0 ? void 0 : n.toAttribute) !== void 0 ? s.converter : At).toAttribute(e, s.type);
1910
+ this._$El = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$El = null;
1911
+ }
1912
+ }
1913
+ _$AK(t, e) {
1914
+ var s;
1915
+ const n = this.constructor, r = n._$Ev.get(t);
1916
+ if (r !== void 0 && this._$El !== r) {
1917
+ const o = n.getPropertyOptions(r), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((s = o.converter) === null || s === void 0 ? void 0 : s.fromAttribute) !== void 0 ? o.converter : At;
1918
+ this._$El = r, this[r] = a.fromAttribute(e, o.type), this._$El = null;
1919
+ }
1920
+ }
1921
+ requestUpdate(t, e, s) {
1922
+ let n = !0;
1923
+ t !== void 0 && (((s = s || this.constructor.getPropertyOptions(t)).hasChanged || Ee)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, s))) : n = !1), !this.isUpdatePending && n && (this._$E_ = this._$Ej());
1924
+ }
1925
+ async _$Ej() {
1926
+ this.isUpdatePending = !0;
1927
+ try {
1928
+ await this._$E_;
1929
+ } catch (e) {
1930
+ Promise.reject(e);
1931
+ }
1932
+ const t = this.scheduleUpdate();
1933
+ return t != null && await t, !this.isUpdatePending;
1934
+ }
1935
+ scheduleUpdate() {
1936
+ return this.performUpdate();
1937
+ }
1938
+ performUpdate() {
1939
+ var t;
1940
+ if (!this.isUpdatePending)
1941
+ return;
1942
+ this.hasUpdated, this._$Ei && (this._$Ei.forEach((n, r) => this[r] = n), this._$Ei = void 0);
1943
+ let e = !1;
1944
+ const s = this._$AL;
1945
+ try {
1946
+ e = this.shouldUpdate(s), e ? (this.willUpdate(s), (t = this._$ES) === null || t === void 0 || t.forEach((n) => {
1947
+ var r;
1948
+ return (r = n.hostUpdate) === null || r === void 0 ? void 0 : r.call(n);
1949
+ }), this.update(s)) : this._$Ek();
1950
+ } catch (n) {
1951
+ throw e = !1, this._$Ek(), n;
1952
+ }
1953
+ e && this._$AE(s);
1954
+ }
1955
+ willUpdate(t) {
1956
+ }
1957
+ _$AE(t) {
1958
+ var e;
1959
+ (e = this._$ES) === null || e === void 0 || e.forEach((s) => {
1960
+ var n;
1961
+ return (n = s.hostUpdated) === null || n === void 0 ? void 0 : n.call(s);
1962
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
1963
+ }
1964
+ _$Ek() {
1965
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
1966
+ }
1967
+ get updateComplete() {
1968
+ return this.getUpdateComplete();
1969
+ }
1970
+ getUpdateComplete() {
1971
+ return this._$E_;
1972
+ }
1973
+ shouldUpdate(t) {
1974
+ return !0;
1975
+ }
1976
+ update(t) {
1977
+ this._$EC !== void 0 && (this._$EC.forEach((e, s) => this._$EO(s, this[s], e)), this._$EC = void 0), this._$Ek();
1978
+ }
1979
+ updated(t) {
1980
+ }
1981
+ firstUpdated(t) {
1982
+ }
1983
+ };
1984
+ U[Et] = !0, U.elementProperties = /* @__PURE__ */ new Map(), U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, ie == null || ie({ ReactiveElement: U }), ((vt = it.reactiveElementVersions) !== null && vt !== void 0 ? vt : it.reactiveElementVersions = []).push("1.6.3");
1985
+ /**
1986
+ * @license
1987
+ * Copyright 2017 Google LLC
1988
+ * SPDX-License-Identifier: BSD-3-Clause
1989
+ */
1990
+ var ft;
1991
+ const nt = window, L = nt.trustedTypes, ne = L ? L.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, xt = "$lit$", k = `lit$${(Math.random() + "").slice(9)}$`, xe = "?" + k, ks = `<${xe}>`, T = document, F = () => T.createComment(""), q = (i) => i === null || typeof i != "object" && typeof i != "function", Ce = Array.isArray, Os = (i) => Ce(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", yt = `[
1992
+ \f\r]`, I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, re = /-->/g, oe = />/g, S = RegExp(`>|${yt}(?:([^\\s"'>=/]+)(${yt}*=${yt}*(?:[^
1993
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), ae = /'/g, ce = /"/g, Pe = /^(?:script|style|textarea|title)$/i, Ss = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), X = Ss(1), M = Symbol.for("lit-noChange"), v = Symbol.for("lit-nothing"), he = /* @__PURE__ */ new WeakMap(), N = T.createTreeWalker(T, 129, null, !1);
1994
+ function ke(i, t) {
1995
+ if (!Array.isArray(i) || !i.hasOwnProperty("raw"))
1996
+ throw Error("invalid template strings array");
1997
+ return ne !== void 0 ? ne.createHTML(t) : t;
1998
+ }
1999
+ const Ns = (i, t) => {
2000
+ const e = i.length - 1, s = [];
2001
+ let n, r = t === 2 ? "<svg>" : "", o = I;
2002
+ for (let a = 0; a < e; a++) {
2003
+ const h = i[a];
2004
+ let c, l, d = -1, p = 0;
2005
+ for (; p < h.length && (o.lastIndex = p, l = o.exec(h), l !== null); )
2006
+ p = o.lastIndex, o === I ? l[1] === "!--" ? o = re : l[1] !== void 0 ? o = oe : l[2] !== void 0 ? (Pe.test(l[2]) && (n = RegExp("</" + l[2], "g")), o = S) : l[3] !== void 0 && (o = S) : o === S ? l[0] === ">" ? (o = n ?? I, d = -1) : l[1] === void 0 ? d = -2 : (d = o.lastIndex - l[2].length, c = l[1], o = l[3] === void 0 ? S : l[3] === '"' ? ce : ae) : o === ce || o === ae ? o = S : o === re || o === oe ? o = I : (o = S, n = void 0);
2007
+ const u = o === S && i[a + 1].startsWith("/>") ? " " : "";
2008
+ r += o === I ? h + ks : d >= 0 ? (s.push(c), h.slice(0, d) + xt + h.slice(d) + k + u) : h + k + (d === -2 ? (s.push(void 0), a) : u);
2009
+ }
2010
+ return [ke(i, r + (i[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
2011
+ };
2012
+ class Y {
2013
+ constructor({ strings: t, _$litType$: e }, s) {
2014
+ let n;
2015
+ this.parts = [];
2016
+ let r = 0, o = 0;
2017
+ const a = t.length - 1, h = this.parts, [c, l] = Ns(t, e);
2018
+ if (this.el = Y.createElement(c, s), N.currentNode = this.el.content, e === 2) {
2019
+ const d = this.el.content, p = d.firstChild;
2020
+ p.remove(), d.append(...p.childNodes);
2021
+ }
2022
+ for (; (n = N.nextNode()) !== null && h.length < a; ) {
2023
+ if (n.nodeType === 1) {
2024
+ if (n.hasAttributes()) {
2025
+ const d = [];
2026
+ for (const p of n.getAttributeNames())
2027
+ if (p.endsWith(xt) || p.startsWith(k)) {
2028
+ const u = l[o++];
2029
+ if (d.push(p), u !== void 0) {
2030
+ const y = n.getAttribute(u.toLowerCase() + xt).split(k), w = /([.?@])?(.*)/.exec(u);
2031
+ h.push({ type: 1, index: r, name: w[2], strings: y, ctor: w[1] === "." ? Ms : w[1] === "?" ? Hs : w[1] === "@" ? Ls : ot });
2032
+ } else
2033
+ h.push({ type: 6, index: r });
2034
+ }
2035
+ for (const p of d)
2036
+ n.removeAttribute(p);
2037
+ }
2038
+ if (Pe.test(n.tagName)) {
2039
+ const d = n.textContent.split(k), p = d.length - 1;
2040
+ if (p > 0) {
2041
+ n.textContent = L ? L.emptyScript : "";
2042
+ for (let u = 0; u < p; u++)
2043
+ n.append(d[u], F()), N.nextNode(), h.push({ type: 2, index: ++r });
2044
+ n.append(d[p], F());
2045
+ }
2046
+ }
2047
+ } else if (n.nodeType === 8)
2048
+ if (n.data === xe)
2049
+ h.push({ type: 2, index: r });
2050
+ else {
2051
+ let d = -1;
2052
+ for (; (d = n.data.indexOf(k, d + 1)) !== -1; )
2053
+ h.push({ type: 7, index: r }), d += k.length - 1;
2054
+ }
2055
+ r++;
2056
+ }
2057
+ }
2058
+ static createElement(t, e) {
2059
+ const s = T.createElement("template");
2060
+ return s.innerHTML = t, s;
2061
+ }
2062
+ }
2063
+ function R(i, t, e = i, s) {
2064
+ var n, r, o, a;
2065
+ if (t === M)
2066
+ return t;
2067
+ let h = s !== void 0 ? (n = e._$Co) === null || n === void 0 ? void 0 : n[s] : e._$Cl;
2068
+ const c = q(t) ? void 0 : t._$litDirective$;
2069
+ return (h == null ? void 0 : h.constructor) !== c && ((r = h == null ? void 0 : h._$AO) === null || r === void 0 || r.call(h, !1), c === void 0 ? h = void 0 : (h = new c(i), h._$AT(i, e, s)), s !== void 0 ? ((o = (a = e)._$Co) !== null && o !== void 0 ? o : a._$Co = [])[s] = h : e._$Cl = h), h !== void 0 && (t = R(i, h._$AS(i, t.values), h, s)), t;
2070
+ }
2071
+ class Ts {
2072
+ constructor(t, e) {
2073
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
2074
+ }
2075
+ get parentNode() {
2076
+ return this._$AM.parentNode;
2077
+ }
2078
+ get _$AU() {
2079
+ return this._$AM._$AU;
2080
+ }
2081
+ u(t) {
2082
+ var e;
2083
+ const { el: { content: s }, parts: n } = this._$AD, r = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : T).importNode(s, !0);
2084
+ N.currentNode = r;
2085
+ let o = N.nextNode(), a = 0, h = 0, c = n[0];
2086
+ for (; c !== void 0; ) {
2087
+ if (a === c.index) {
2088
+ let l;
2089
+ c.type === 2 ? l = new Z(o, o.nextSibling, this, t) : c.type === 1 ? l = new c.ctor(o, c.name, c.strings, this, t) : c.type === 6 && (l = new Rs(o, this, t)), this._$AV.push(l), c = n[++h];
2090
+ }
2091
+ a !== (c == null ? void 0 : c.index) && (o = N.nextNode(), a++);
2092
+ }
2093
+ return N.currentNode = T, r;
2094
+ }
2095
+ v(t) {
2096
+ let e = 0;
2097
+ for (const s of this._$AV)
2098
+ s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
2099
+ }
2100
+ }
2101
+ class Z {
2102
+ constructor(t, e, s, n) {
2103
+ var r;
2104
+ this.type = 2, this._$AH = v, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = n, this._$Cp = (r = n == null ? void 0 : n.isConnected) === null || r === void 0 || r;
2105
+ }
2106
+ get _$AU() {
2107
+ var t, e;
2108
+ return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$Cp;
2109
+ }
2110
+ get parentNode() {
2111
+ let t = this._$AA.parentNode;
2112
+ const e = this._$AM;
2113
+ return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
2114
+ }
2115
+ get startNode() {
2116
+ return this._$AA;
2117
+ }
2118
+ get endNode() {
2119
+ return this._$AB;
2120
+ }
2121
+ _$AI(t, e = this) {
2122
+ t = R(this, t, e), q(t) ? t === v || t == null || t === "" ? (this._$AH !== v && this._$AR(), this._$AH = v) : t !== this._$AH && t !== M && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Os(t) ? this.T(t) : this._(t);
2123
+ }
2124
+ k(t) {
2125
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
2126
+ }
2127
+ $(t) {
2128
+ this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
2129
+ }
2130
+ _(t) {
2131
+ this._$AH !== v && q(this._$AH) ? this._$AA.nextSibling.data = t : this.$(T.createTextNode(t)), this._$AH = t;
2132
+ }
2133
+ g(t) {
2134
+ var e;
2135
+ const { values: s, _$litType$: n } = t, r = typeof n == "number" ? this._$AC(t) : (n.el === void 0 && (n.el = Y.createElement(ke(n.h, n.h[0]), this.options)), n);
2136
+ if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === r)
2137
+ this._$AH.v(s);
2138
+ else {
2139
+ const o = new Ts(r, this), a = o.u(this.options);
2140
+ o.v(s), this.$(a), this._$AH = o;
2141
+ }
2142
+ }
2143
+ _$AC(t) {
2144
+ let e = he.get(t.strings);
2145
+ return e === void 0 && he.set(t.strings, e = new Y(t)), e;
2146
+ }
2147
+ T(t) {
2148
+ Ce(this._$AH) || (this._$AH = [], this._$AR());
2149
+ const e = this._$AH;
2150
+ let s, n = 0;
2151
+ for (const r of t)
2152
+ n === e.length ? e.push(s = new Z(this.k(F()), this.k(F()), this, this.options)) : s = e[n], s._$AI(r), n++;
2153
+ n < e.length && (this._$AR(s && s._$AB.nextSibling, n), e.length = n);
2154
+ }
2155
+ _$AR(t = this._$AA.nextSibling, e) {
2156
+ var s;
2157
+ for ((s = this._$AP) === null || s === void 0 || s.call(this, !1, !0, e); t && t !== this._$AB; ) {
2158
+ const n = t.nextSibling;
2159
+ t.remove(), t = n;
2160
+ }
2161
+ }
2162
+ setConnected(t) {
2163
+ var e;
2164
+ this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
2165
+ }
2166
+ }
2167
+ class ot {
2168
+ constructor(t, e, s, n, r) {
2169
+ this.type = 1, this._$AH = v, this._$AN = void 0, this.element = t, this.name = e, this._$AM = n, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = v;
2170
+ }
2171
+ get tagName() {
2172
+ return this.element.tagName;
2173
+ }
2174
+ get _$AU() {
2175
+ return this._$AM._$AU;
2176
+ }
2177
+ _$AI(t, e = this, s, n) {
2178
+ const r = this.strings;
2179
+ let o = !1;
2180
+ if (r === void 0)
2181
+ t = R(this, t, e, 0), o = !q(t) || t !== this._$AH && t !== M, o && (this._$AH = t);
2182
+ else {
2183
+ const a = t;
2184
+ let h, c;
2185
+ for (t = r[0], h = 0; h < r.length - 1; h++)
2186
+ c = R(this, a[s + h], e, h), c === M && (c = this._$AH[h]), o || (o = !q(c) || c !== this._$AH[h]), c === v ? t = v : t !== v && (t += (c ?? "") + r[h + 1]), this._$AH[h] = c;
2187
+ }
2188
+ o && !n && this.j(t);
2189
+ }
2190
+ j(t) {
2191
+ t === v ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
2192
+ }
2193
+ }
2194
+ class Ms extends ot {
2195
+ constructor() {
2196
+ super(...arguments), this.type = 3;
2197
+ }
2198
+ j(t) {
2199
+ this.element[this.name] = t === v ? void 0 : t;
2200
+ }
2201
+ }
2202
+ const Us = L ? L.emptyScript : "";
2203
+ class Hs extends ot {
2204
+ constructor() {
2205
+ super(...arguments), this.type = 4;
2206
+ }
2207
+ j(t) {
2208
+ t && t !== v ? this.element.setAttribute(this.name, Us) : this.element.removeAttribute(this.name);
2209
+ }
2210
+ }
2211
+ class Ls extends ot {
2212
+ constructor(t, e, s, n, r) {
2213
+ super(t, e, s, n, r), this.type = 5;
2214
+ }
2215
+ _$AI(t, e = this) {
2216
+ var s;
2217
+ if ((t = (s = R(this, t, e, 0)) !== null && s !== void 0 ? s : v) === M)
2218
+ return;
2219
+ const n = this._$AH, r = t === v && n !== v || t.capture !== n.capture || t.once !== n.once || t.passive !== n.passive, o = t !== v && (n === v || r);
2220
+ r && this.element.removeEventListener(this.name, this, n), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
2221
+ }
2222
+ handleEvent(t) {
2223
+ var e, s;
2224
+ typeof this._$AH == "function" ? this._$AH.call((s = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && s !== void 0 ? s : this.element, t) : this._$AH.handleEvent(t);
2225
+ }
2226
+ }
2227
+ class Rs {
2228
+ constructor(t, e, s) {
2229
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
2230
+ }
2231
+ get _$AU() {
2232
+ return this._$AM._$AU;
2233
+ }
2234
+ _$AI(t) {
2235
+ R(this, t);
2236
+ }
2237
+ }
2238
+ const le = nt.litHtmlPolyfillSupport;
2239
+ le == null || le(Y, Z), ((ft = nt.litHtmlVersions) !== null && ft !== void 0 ? ft : nt.litHtmlVersions = []).push("2.8.0");
2240
+ const js = (i, t, e) => {
2241
+ var s, n;
2242
+ const r = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : t;
2243
+ let o = r._$litPart$;
2244
+ if (o === void 0) {
2245
+ const a = (n = e == null ? void 0 : e.renderBefore) !== null && n !== void 0 ? n : null;
2246
+ r._$litPart$ = o = new Z(t.insertBefore(F(), a), a, void 0, e ?? {});
2247
+ }
2248
+ return o._$AI(i), o;
2249
+ };
2250
+ /**
2251
+ * @license
2252
+ * Copyright 2017 Google LLC
2253
+ * SPDX-License-Identifier: BSD-3-Clause
2254
+ */
2255
+ var $t, bt;
2256
+ class V extends U {
2257
+ constructor() {
2258
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
2259
+ }
2260
+ createRenderRoot() {
2261
+ var t, e;
2262
+ const s = super.createRenderRoot();
2263
+ return (t = (e = this.renderOptions).renderBefore) !== null && t !== void 0 || (e.renderBefore = s.firstChild), s;
2264
+ }
2265
+ update(t) {
2266
+ const e = this.render();
2267
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = js(e, this.renderRoot, this.renderOptions);
2268
+ }
2269
+ connectedCallback() {
2270
+ var t;
2271
+ super.connectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!0);
2272
+ }
2273
+ disconnectedCallback() {
2274
+ var t;
2275
+ super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
2276
+ }
2277
+ render() {
2278
+ return M;
2279
+ }
2280
+ }
2281
+ V.finalized = !0, V._$litElement$ = !0, ($t = globalThis.litElementHydrateSupport) === null || $t === void 0 || $t.call(globalThis, { LitElement: V });
2282
+ const de = globalThis.litElementPolyfillSupport;
2283
+ de == null || de({ LitElement: V });
2284
+ ((bt = globalThis.litElementVersions) !== null && bt !== void 0 ? bt : globalThis.litElementVersions = []).push("3.3.3");
2285
+ /**
2286
+ * @license
2287
+ * Copyright 2017 Google LLC
2288
+ * SPDX-License-Identifier: BSD-3-Clause
2289
+ */
2290
+ const zs = (i, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
2291
+ e.createProperty(t.key, i);
2292
+ } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
2293
+ typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
2294
+ }, finisher(e) {
2295
+ e.createProperty(t.key, i);
2296
+ } }, Ds = (i, t, e) => {
2297
+ t.constructor.createProperty(e, i);
2298
+ };
2299
+ function Lt(i) {
2300
+ return (t, e) => e !== void 0 ? Ds(i, t, e) : zs(i, t);
2301
+ }
2302
+ /**
2303
+ * @license
2304
+ * Copyright 2017 Google LLC
2305
+ * SPDX-License-Identifier: BSD-3-Clause
2306
+ */
2307
+ function Rt(i) {
2308
+ return Lt({ ...i, state: !0 });
2309
+ }
2310
+ /**
2311
+ * @license
2312
+ * Copyright 2021 Google LLC
2313
+ * SPDX-License-Identifier: BSD-3-Clause
2314
+ */
2315
+ var wt;
2316
+ ((wt = window.HTMLSlotElement) === null || wt === void 0 ? void 0 : wt.prototype.assignedElements) != null;
2317
+ /**
2318
+ * @license
2319
+ * Copyright 2017 Google LLC
2320
+ * SPDX-License-Identifier: BSD-3-Clause
2321
+ */
2322
+ const Is = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, Bs = (i) => (...t) => ({ _$litDirective$: i, values: t });
2323
+ class Vs {
2324
+ constructor(t) {
2325
+ }
2326
+ get _$AU() {
2327
+ return this._$AM._$AU;
2328
+ }
2329
+ _$AT(t, e, s) {
2330
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
2331
+ }
2332
+ _$AS(t, e) {
2333
+ return this.update(t, e);
2334
+ }
2335
+ update(t, e) {
2336
+ return this.render(...e);
2337
+ }
2338
+ }
2339
+ /**
2340
+ * @license
2341
+ * Copyright 2018 Google LLC
2342
+ * SPDX-License-Identifier: BSD-3-Clause
2343
+ */
2344
+ const Ws = Bs(class extends Vs {
2345
+ constructor(i) {
2346
+ var t;
2347
+ if (super(i), i.type !== Is.ATTRIBUTE || i.name !== "class" || ((t = i.strings) === null || t === void 0 ? void 0 : t.length) > 2)
2348
+ throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
2349
+ }
2350
+ render(i) {
2351
+ return " " + Object.keys(i).filter((t) => i[t]).join(" ") + " ";
2352
+ }
2353
+ update(i, [t]) {
2354
+ var e, s;
2355
+ if (this.it === void 0) {
2356
+ this.it = /* @__PURE__ */ new Set(), i.strings !== void 0 && (this.nt = new Set(i.strings.join(" ").split(/\s/).filter((r) => r !== "")));
2357
+ for (const r in t)
2358
+ t[r] && !(!((e = this.nt) === null || e === void 0) && e.has(r)) && this.it.add(r);
2359
+ return this.render(t);
2360
+ }
2361
+ const n = i.element.classList;
2362
+ this.it.forEach((r) => {
2363
+ r in t || (n.remove(r), this.it.delete(r));
2364
+ });
2365
+ for (const r in t) {
2366
+ const o = !!t[r];
2367
+ o === this.it.has(r) || !((s = this.nt) === null || s === void 0) && s.has(r) || (o ? (n.add(r), this.it.add(r)) : (n.remove(r), this.it.delete(r)));
2368
+ }
2369
+ return M;
2370
+ }
2371
+ }), m = (i, t, e) => {
2372
+ i && e.style.setProperty(t, i);
2373
+ }, Fs = (i, t) => {
2374
+ var e, s, n, r, o, a, h, c, l, d, p;
2375
+ m((e = i.colors) == null ? void 0 : e.primary, "--primary-color", t), m((s = i.colors) == null ? void 0 : s.secondary, "--secondary-color", t), m((n = i.colors) == null ? void 0 : n.text, "--text-color", t), m((r = i.colors) == null ? void 0 : r.link, "--link-color", t), m((o = i.colors) == null ? void 0 : o.gray, "--gray-color", t), m((a = i.colors) == null ? void 0 : a.grayDark, "--gray-dark-color", t), m((h = i.spacing) == null ? void 0 : h.xs, "--spacing-xs", t), m((c = i.spacing) == null ? void 0 : c.sm, "--spacing-sm", t), m((l = i.spacing) == null ? void 0 : l.md, "--spacing-md", t), m((d = i.spacing) == null ? void 0 : d.lg, "--spacing-lg", t), m((p = i.spacing) == null ? void 0 : p.xl, "--spacing-xl", t), m(i.boxShadow, "--box-shadow", t), m(i.borderRadius, "--border-radius", t), m(i.borderRadiusSm, "--border-radius-sm", t), m(i.fontFamily, "--font-family", t);
2376
+ };
2377
+ var qs = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, K = (i, t, e, s) => {
2378
+ for (var n = s > 1 ? void 0 : s ? Ys(t, e) : t, r = i.length - 1, o; r >= 0; r--)
2379
+ (o = i[r]) && (n = (s ? o(t, e, n) : o(n)) || n);
2380
+ return s && n && qs(t, e, n), n;
2381
+ };
2382
+ class z extends V {
2383
+ constructor() {
2384
+ super(...arguments), this.active = !1, this.loaded = !1;
2385
+ }
2386
+ async connectedCallback() {
2387
+ super.connectedCallback(), this.icon = await this._renderSymbol(this.symbol), this.loaded = !0, this._applyBranding();
2388
+ }
2389
+ _toggleActive() {
2390
+ this.active = !this.active;
2391
+ }
2392
+ _applyBranding() {
2393
+ var s;
2394
+ const t = ((s = this.container) == null ? void 0 : s.get("$settings")) ?? {}, e = t == null ? void 0 : t.components[t == null ? void 0 : t.entry];
2395
+ e && Fs(e.context, this);
2396
+ }
2397
+ async _renderSymbol(t) {
2398
+ const e = async (s) => await import("./index-5087564d.mjs").then((r) => r[s]);
2399
+ if (t) {
2400
+ const { type: s, content: n } = t;
2401
+ switch (s) {
2402
+ case "Telia": {
2403
+ const r = await e(n);
2404
+ return r ? X`<telia-icon
2405
+ class="trigger-icon"
2406
+ svg=${r.svg}
2407
+ size="lg"
2408
+ ></telia-icon>` : v;
2409
+ }
2410
+ case "FontAwesome":
2411
+ return X`<i class="trigger-fa-icon fa fa-${n}"></i>`;
2412
+ case "Uri":
2413
+ return X`<i
2414
+ class="trigger-custom-icon"
2415
+ style="background: url(${n}) no-repeat center center;background-size: contain;"
2416
+ ></i>`;
2417
+ default:
2418
+ return v;
2419
+ }
2420
+ }
2421
+ }
2422
+ render() {
2423
+ return X`<button
2424
+ class=${Ws({
2425
+ trigger: !0,
2426
+ active: this.active,
2427
+ rendered: this.loaded
2428
+ })}
2429
+ @click=${this._toggleActive}
2430
+ >
2431
+ ${this.icon}
2432
+ <span class="trigger-close">
2433
+ <svg
2434
+ width="18"
2435
+ height="9"
2436
+ viewBox="0 0 18 9"
2437
+ fill="none"
2438
+ xmlns="http://www.w3.org/2000/svg"
2439
+ >
2440
+ <path
2441
+ d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z"
2442
+ fill="white"
2443
+ />
2444
+ </svg>
2445
+ </span>
2446
+ <span class="trigger-loader">
2447
+ <svg viewBox="25 25 50 50">
2448
+ <circle
2449
+ cx="50"
2450
+ cy="50"
2451
+ r="20"
2452
+ fill="none"
2453
+ stroke="#000"
2454
+ stroke-width="2"
2455
+ stroke-miterlimit="10"
2456
+ />
2457
+ </svg>
2458
+ </span>
2459
+ </button>`;
2460
+ }
2461
+ }
2462
+ z.styles = [
2463
+ xs`
2464
+ :host {
2465
+ --voca-rem-multiplier: 0.625;
2466
+ display: block;
2467
+ box-sizing: border-box;
2468
+ }
2469
+
2470
+ .trigger {
2471
+ position: fixed;
2472
+ transform: scale(0);
2473
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
2474
+ bottom: 20px;
2475
+ right: 20px;
2476
+ z-index: 5;
2477
+ display: flex;
2478
+ align-items: center;
2479
+ justify-content: center;
2480
+ border: none;
2481
+ line-height: 55px;
2482
+ height: 55px;
2483
+ width: 55px;
2484
+ border-radius: 55px;
2485
+ cursor: pointer;
2486
+ background-color: var(--trigger-bg, var(--primary-color));
2487
+ font-family: Lato;
2488
+ text-decoration: none;
2489
+ border: 3px dashed transparent;
2490
+ box-sizing: border-box;
2491
+ transition: transform 200ms ease-out;
2492
+ }
2493
+ .trigger:hover {
2494
+ transform: scale(1.1) !important;
2495
+ }
2496
+ .trigger.rendered {
2497
+ transform: scale(1);
2498
+ }
2499
+ .trigger.active .trigger-icon {
2500
+ opacity: 0;
2501
+ transform: rotate(-180deg) scale(0);
2502
+ }
2503
+ .trigger.active .trigger-close {
2504
+ opacity: 1;
2505
+ transform: rotate(0deg) scale(1);
2506
+ }
2507
+
2508
+ .trigger-icon {
2509
+ display: inline-block;
2510
+ line-height: inherit;
2511
+ text-align: center;
2512
+ opacity: 1;
2513
+ transform: rotate(0deg) scale(1);
2514
+ transition: opacity 200ms ease-out, transform 200ms ease-out;
2515
+ color: var(--trigger-text-color, #fff);
2516
+ }
2517
+ .trigger-close {
2518
+ opacity: 0;
2519
+ transition: transform 200ms ease-out;
2520
+ transform: rotate(180deg) scale(0);
2521
+ position: absolute;
2522
+ top: 0;
2523
+ bottom: 0;
2524
+ left: 0;
2525
+ right: 0;
2526
+ display: flex;
2527
+ justify-content: center;
2528
+ align-items: center;
2529
+ fill: var(--trigger-text-color, #fff);
2530
+ }
2531
+ `
2532
+ ];
2533
+ K([
2534
+ Lt({ attribute: !1 })
2535
+ ], z.prototype, "symbol", 2);
2536
+ K([
2537
+ Lt({ attribute: !1 })
2538
+ ], z.prototype, "container", 2);
2539
+ K([
2540
+ Rt()
2541
+ ], z.prototype, "active", 2);
2542
+ K([
2543
+ Rt()
2544
+ ], z.prototype, "loaded", 2);
2545
+ K([
2546
+ Rt()
2547
+ ], z.prototype, "icon", 2);
2548
+ const Qs = (i, t, e, s, n) => i.getAsync("componentResolver").then((r) => (r.registerComponent(t, e), ws(i, t, s || (() => {
2549
+ }), t, n))), li = (i) => Qs(
2550
+ i,
2551
+ "widget-header",
2552
+ import("./widget-header-6b3ce33d.mjs"),
2553
+ (t) => {
2554
+ }
2555
+ );
2556
+ export {
2557
+ v as A,
2558
+ oi as E,
2559
+ Nt as P,
2560
+ li as W,
2561
+ St as h,
2562
+ xs as i,
2563
+ Fs as m,
2564
+ Lt as n,
2565
+ bs as p,
2566
+ V as s,
2567
+ Rt as t,
2568
+ X as x
2569
+ };