@telia-ace/widget-components-widget-header-flamingo 1.1.12 → 1.1.13

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.
@@ -1,2608 +0,0 @@
1
- const pt = (n, t, e, ...s) => {
2
- const i = `[${n.get("$environment").name || "webprovisions"}] ${e}`;
3
- switch (t) {
4
- case "info":
5
- console.info(i, ...s);
6
- break;
7
- case "warning":
8
- console.warn(i, ...s);
9
- break;
10
- case "error":
11
- console.error(i, ...s);
12
- break;
13
- }
14
- }, xe = (n) => {
15
- const t = n.container || n;
16
- return {
17
- info: (e, ...s) => pt(t, "info", e, ...s),
18
- warn: (e, ...s) => pt(t, "warning", e, ...s),
19
- error: (e, ...s) => pt(t, "error", e, ...s)
20
- };
21
- };
22
- var q = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(q || {}), C = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(C || {});
23
- const Pe = (n, t, e, s) => {
24
- try {
25
- const i = new t(e, s);
26
- return {
27
- name: n,
28
- invoke: (r, o) => {
29
- let a;
30
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
31
- },
32
- getInstance: () => i
33
- };
34
- } catch (i) {
35
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
36
- return {
37
- name: n,
38
- invoke: (r) => {
39
- let o;
40
- return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
41
- },
42
- getInstance: () => t
43
- };
44
- throw i;
45
- }
46
- };
47
- function jt(n, t) {
48
- return typeof n > "u" ? t : n;
49
- }
50
- let Ce = class {
51
- constructor(t = {}) {
52
- this.part = t;
53
- }
54
- createCommand(t, e, s) {
55
- let i;
56
- typeof e == "function" ? i = {
57
- scope: q.Widget,
58
- stage: C.Post,
59
- defaultArgs: void 0,
60
- handlerResolver: e
61
- } : i = {
62
- scope: jt(e.scope, q.Widget),
63
- stage: jt(e.stage, C.Post),
64
- defaultArgs: e.defaultArgs,
65
- handlerResolver: s
66
- };
67
- let r = this.part;
68
- const o = t.split(".");
69
- return o.forEach((a, c) => {
70
- c === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
71
- }), this;
72
- }
73
- get() {
74
- return this.part;
75
- }
76
- };
77
- const ce = (n) => {
78
- const t = new Ce({});
79
- return n(t), t.get();
80
- };
81
- ce((n) => {
82
- n.createCommand(
83
- "types.register",
84
- { scope: q.Implementation, stage: C.Pre },
85
- (t) => (e, s) => {
86
- t.container.get("$types")[e] = s;
87
- }
88
- ).createCommand(
89
- "type",
90
- { stage: C.Pre },
91
- (t) => (e) => {
92
- t.container.register("$type", e);
93
- }
94
- ).createCommand(
95
- "settings",
96
- { stage: C.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: C.Pre },
107
- (t) => (e, s, i) => {
108
- const { container: r } = t;
109
- let o = null, a = e, c = s;
110
- typeof e == "string" && (o = e, a = s, c = i);
111
- const l = (h) => {
112
- const { transformPluginSettings: p } = t.container.get("$environmentOptions"), u = p ? p(
113
- c || {},
114
- o,
115
- t.container,
116
- a
117
- ) : s;
118
- try {
119
- const d = Pe(
120
- o,
121
- a,
122
- r,
123
- u
124
- );
125
- r.get("$plugins").push(d), h && d.invoke("initialize", null);
126
- } catch (d) {
127
- xe(t).warn("Error when initializing plugin", d);
128
- }
129
- };
130
- t.container.get("$instance") ? l(!0) : t.events.subscribeOnce("widget:instance-created", () => l(!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 ke = ce((n) => {
161
- n.createCommand(
162
- "ready",
163
- { scope: q.Implementation, stage: C.Pre },
164
- (t) => (e) => {
165
- const { container: s } = t, i = s.owner;
166
- s.get("bootstrapping").ready ? e(i) : i.events.subscribeOnce("bootstrap:ready", () => {
167
- e(i);
168
- });
169
- }
170
- );
171
- }), dt = /* @__PURE__ */ new WeakMap();
172
- function L() {
173
- return (n) => (dt.has(n) || dt.set(n, {}), dt.get(n));
174
- }
175
- const ut = (n, t, e, ...s) => {
176
- const i = `[${n.get("$environment").name || "webprovisions"}] ${e}`;
177
- switch (t) {
178
- case "info":
179
- console.info(i, ...s);
180
- break;
181
- case "warning":
182
- console.warn(i, ...s);
183
- break;
184
- case "error":
185
- console.error(i, ...s);
186
- break;
187
- }
188
- }, v = (n) => {
189
- const t = n.container || n;
190
- return {
191
- info: (e, ...s) => ut(t, "info", e, ...s),
192
- warn: (e, ...s) => ut(t, "warning", e, ...s),
193
- error: (e, ...s) => ut(t, "error", e, ...s)
194
- };
195
- }, g = L(), _t = (() => {
196
- let n = 0;
197
- return () => ++n;
198
- })(), At = (n, t, e) => {
199
- const s = g(n).touchQueue.get(t);
200
- s && s.forEach((i) => {
201
- i(e, n);
202
- });
203
- };
204
- class Oe {
205
- constructor(t, e, s, i) {
206
- this.key = t, this.factory = e, this.parent = s, this.container = i, this.id = _t(), 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, At(this.container, this.key, e), e));
212
- }
213
- return this.value;
214
- }
215
- }
216
- class Se {
217
- constructor(t, e, s, i) {
218
- this.key = t, this.value = e, this.parent = s, this.container = i, this.id = _t(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, At(this.container, this.key, this.value), this.value);
219
- }
220
- }
221
- class Ne {
222
- constructor(t, e, s, i) {
223
- this.key = t, this.value = e, this.parent = s, this.container = i, this.id = _t(), 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 At(this.container, this.key, this.value), r;
227
- };
228
- }
229
- }
230
- class Et {
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((i) => i.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((i) => {
256
- if (i !== null && typeof i == "object" && typeof i.dispose == "function")
257
- return i.dispose.call(i, 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((i) => {
281
- e(i, this);
282
- });
283
- else {
284
- const i = g(this).touchQueue;
285
- let r = i.get(t);
286
- r || (r = [], i.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" && v(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);
298
- const i = new Oe(t, e, s, this);
299
- return g(this).resolvers.set(t, i), i.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" && v(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);
309
- const i = new Ne(t, e, s, this);
310
- return g(this).resolvers.set(t, i), i.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" && v(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);
320
- const i = new Se(t, e, s, this);
321
- return g(this).resolvers.set(t, i), i.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" && v(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" && v(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((i) => e[s] = i))).then(() => e);
354
- }
355
- createChild(t, e) {
356
- const s = new Et(t, e, this);
357
- return g(this).children.push(s), s;
358
- }
359
- }
360
- let zt = 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, i = !1) {
369
- this.type = t, this.target = e, this.cancelable = !!s, this.bubbles = !!i, 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 b = L(), Dt = (n, t) => [].concat(
379
- b(n).listenerLookup.get(t.toLowerCase()) || [],
380
- b(n).listenerLookup.get("*") || []
381
- ), It = (n, t, e, s) => {
382
- let i, r;
383
- return t instanceof zt ? (i = t, r = t.type) : (i = new zt(t, n.target, !!e.cancelable, !!e.bubbles), r = t), { event: i, type: r, async: s };
384
- };
385
- let Te = class he {
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, b(this).listenerLookup = /* @__PURE__ */ new Map(), b(this).children = [];
393
- }
394
- /**
395
- * Clears registered event listeners in this `EventManager` as well as in any children.
396
- */
397
- clear() {
398
- b(this).listenerLookup.clear(), b(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 = b(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 i = b(this).listenerLookup, r = t.toLowerCase();
416
- return i.has(r) || i.set(r, []), i.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, (i, r) => (s(), e(i, 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 = b(this).listenerLookup.get(t.toLowerCase());
433
- if (s) {
434
- const i = s.indexOf(e);
435
- i > -1 && s.splice(i, 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: i, type: r } = It(this, t, s, !0), o = Dt(this, r);
446
- let a = 0;
447
- const c = o.length;
448
- let l = Promise.resolve();
449
- for (a = 0; a < c; a++)
450
- ((h) => {
451
- l = l.then((p) => p ? Promise.resolve(!0) : Promise.resolve(h(i, e)).then(() => i.defaultPrevented));
452
- })(o[a]);
453
- return l.then((h) => !h && i.bubbles && this.parent ? this.parent.dispatchAsync(i, e) : h);
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: i, type: r } = It(this, t, s, !1), o = Dt(this, r);
463
- let a = 0;
464
- const c = o.length;
465
- let l = !1;
466
- for (a = 0; a < c; a++)
467
- if (o[a](i, e), i.defaultPrevented) {
468
- l = !0;
469
- break;
470
- }
471
- return !l && i.bubbles && this.parent && (l = this.parent.dispatch(i, e)), l;
472
- }
473
- /**
474
- * Creates a child instance to the current Event manager.
475
- */
476
- createChild(t) {
477
- const e = new he(t, this);
478
- return b(this).children.push(e), e;
479
- }
480
- };
481
- const G = (n, t, e) => {
482
- const s = n.get("$plugins").map((i) => {
483
- try {
484
- return i.invoke(t, e);
485
- } catch (r) {
486
- v(n).error("An error occured when invoking a plugin.", i, r);
487
- }
488
- });
489
- return Promise.all(s);
490
- };
491
- let Me = 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 && v(this).error("Unable to create widget. No type is specified.");
499
- const s = t[e];
500
- !s && v(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 (i) {
507
- v(this).error("Unable to create widget type.", i);
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(() => G(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 || (() => G(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 G(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 G(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 i = s.invoke;
559
- if (i)
560
- return i.call(s, t, ...e);
561
- });
562
- }
563
- };
564
- const U = (n, t) => {
565
- if (!t)
566
- return !0;
567
- if (typeof t == "string") {
568
- const e = t.split(",");
569
- for (let s = 0, i = e.length; s < i; s++) {
570
- const r = e[s].trim();
571
- if (r === n || r === "*")
572
- return !0;
573
- }
574
- }
575
- return t instanceof Array ? t.indexOf(n) > -1 : !1;
576
- }, Ue = (n, t) => {
577
- if (typeof t == "function")
578
- return t(n);
579
- const e = typeof t == "string" ? Re(t) : t;
580
- return !(!U(n.implementation.tenant || "", e.tenant || "") || !U(n.implementation.name, e.implementation || "") || !U(n.name, e.widget || "") || !U(n.container.get("$type"), e.type || ""));
581
- }, He = (n, t) => {
582
- if (typeof t == "function")
583
- return t(n);
584
- const e = typeof t == "string" ? je(t) : t;
585
- return !(!U(n.tenant || "", e.tenant || "") || !U(n.name, e.implementation || ""));
586
- }, le = (n) => (t) => Ue(t, n), Le = (n) => (t) => He(t, n), A = (n) => n instanceof Array && n.length === 1 ? n[0] : n, Re = (n) => {
587
- const t = {}, e = n.split(":");
588
- return e.length === 1 ? t.widget = A(e[0].split(",")) : e.length === 2 ? (t.implementation = A(e[0].split(",")), t.widget = A(e[1].split(","))) : (t.tenant = A(e[0].split(",")), t.implementation = A(e[1].split(",")), t.widget = A(e[2].split(","))), t;
589
- }, je = (n) => {
590
- const t = {}, e = n.split(":");
591
- return e.length === 1 ? t.implementation = A(e[0].split(",")) : (t.tenant = A(e[0].split(",")), t.implementation = A(e[1].split(","))), t;
592
- }, it = L(), Bt = (n, t, e) => n.filter((s) => s.stage === t && le(s.selector)(e));
593
- function ze(n) {
594
- const t = n.container.get("$environment");
595
- let e = it(t).configurationCache;
596
- e && (e = e.filter((s) => s[0] !== n), it(t).configurationCache = e);
597
- }
598
- var nt = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(nt || {}), E = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(E || {});
599
- const pe = (n, t, e) => (Object.keys(t).forEach((s) => {
600
- const i = t[s];
601
- if (typeof i == "function") {
602
- const r = i();
603
- typeof r.defaultArgs < "u" && e(r, ...r.defaultArgs), n[s] = (...o) => {
604
- const a = Object.assign(
605
- {},
606
- r,
607
- { handlerResolver: r.handlerResolver.bind({}) }
608
- );
609
- return e(a, ...o), n;
610
- };
611
- } else
612
- n[s] = pe(
613
- {},
614
- i,
615
- e
616
- );
617
- }), n), De = (n, t) => {
618
- switch (t) {
619
- case "implementation":
620
- return n.implementation;
621
- case "widget":
622
- return n;
623
- }
624
- }, Vt = (n, t, e, s) => (s.forEach((i) => {
625
- pe(
626
- n,
627
- i,
628
- (r, ...o) => {
629
- const a = {
630
- selector: t,
631
- stage: r.stage,
632
- handler: (c) => {
633
- const l = De(c, r.scope), h = { container: l.container, events: l.events }, p = r.handlerResolver, u = p(h);
634
- let d = it(e.environment).configurationCache;
635
- return d || (d = it(e.environment).configurationCache = []), d.find((f) => f.indexOf(l) > -1 && f.indexOf(p) > -1) ? Promise.resolve() : (d.push([l, p]), Promise.resolve(u(...o)));
636
- }
637
- };
638
- e.instructions.push(a);
639
- }
640
- );
641
- }), n);
642
- function Ie(n, t) {
643
- function e(s) {
644
- return Vt(
645
- {},
646
- s,
647
- n,
648
- t
649
- );
650
- }
651
- return Vt(
652
- e,
653
- "*",
654
- n,
655
- t
656
- );
657
- }
658
- const Be = (n, t, e, s) => {
659
- try {
660
- const i = new t(e, s);
661
- return {
662
- name: n,
663
- invoke: (r, o) => {
664
- let a;
665
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
666
- },
667
- getInstance: () => i
668
- };
669
- } catch (i) {
670
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
671
- return {
672
- name: n,
673
- invoke: (r) => {
674
- let o;
675
- return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
676
- },
677
- getInstance: () => t
678
- };
679
- throw i;
680
- }
681
- };
682
- function Wt(n, t) {
683
- return typeof n > "u" ? t : n;
684
- }
685
- let Ve = class {
686
- constructor(t = {}) {
687
- this.part = t;
688
- }
689
- createCommand(t, e, s) {
690
- let i;
691
- typeof e == "function" ? i = {
692
- scope: nt.Widget,
693
- stage: E.Post,
694
- defaultArgs: void 0,
695
- handlerResolver: e
696
- } : i = {
697
- scope: Wt(e.scope, nt.Widget),
698
- stage: Wt(e.stage, E.Post),
699
- defaultArgs: e.defaultArgs,
700
- handlerResolver: s
701
- };
702
- let r = this.part;
703
- const o = t.split(".");
704
- return o.forEach((a, c) => {
705
- c === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
706
- }), this;
707
- }
708
- get() {
709
- return this.part;
710
- }
711
- };
712
- const de = (n) => {
713
- const t = new Ve({});
714
- return n(t), t.get();
715
- }, We = de((n) => {
716
- n.createCommand(
717
- "types.register",
718
- { scope: nt.Implementation, stage: E.Pre },
719
- (t) => (e, s) => {
720
- t.container.get("$types")[e] = s;
721
- }
722
- ).createCommand(
723
- "type",
724
- { stage: E.Pre },
725
- (t) => (e) => {
726
- t.container.register("$type", e);
727
- }
728
- ).createCommand(
729
- "settings",
730
- { stage: E.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: E.Pre },
741
- (t) => (e, s, i) => {
742
- const { container: r } = t;
743
- let o = null, a = e, c = s;
744
- typeof e == "string" && (o = e, a = s, c = i);
745
- const l = (h) => {
746
- const { transformPluginSettings: p } = t.container.get("$environmentOptions"), u = p ? p(
747
- c || {},
748
- o,
749
- t.container,
750
- a
751
- ) : s;
752
- try {
753
- const d = Be(
754
- o,
755
- a,
756
- r,
757
- u
758
- );
759
- r.get("$plugins").push(d), h && d.invoke("initialize", null);
760
- } catch (d) {
761
- v(t).warn("Error when initializing plugin", d);
762
- }
763
- };
764
- t.container.get("$instance") ? l(!0) : t.events.subscribeOnce("widget:instance-created", () => l(!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
- }), qe = We;
794
- function Fe(n, t, e = []) {
795
- const s = [qe].concat(e), i = Ie(
796
- t,
797
- s
798
- );
799
- n(i, t);
800
- }
801
- let Ye = class {
802
- constructor() {
803
- this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
804
- }
805
- add(t, e, s, i) {
806
- this.tasks.push({ task: t, resolve: e, reject: s, done: i }), 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 X = /* @__PURE__ */ new WeakMap();
822
- function Qe(n) {
823
- return X.has(n) || X.set(n, new Ye()), (t) => new Promise((e, s) => {
824
- const i = X.get(n);
825
- i.add(t, e, s, () => {
826
- i.tasks.length || X.delete(n);
827
- });
828
- });
829
- }
830
- const qt = (n) => typeof n < "u", z = (n, t) => {
831
- n.events.dispatch("widget:state-change", { state: t }, { bubbles: !0 }), n.state = t, n.events.dispatch("widget:state-changed", {}, { bubbles: !0 });
832
- }, $ = L(), Ze = (n) => {
833
- const { container: t, events: e } = n;
834
- t.get("$controller") || (t.register("$controller", new Me(t)), e.dispatch("widget:controller-created", {}, { bubbles: !0 }));
835
- };
836
- class Je {
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), $(this).subscriptions = [], s && e.configure((i) => {
845
- const r = i(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 c = (a = s.plugins) == null ? void 0 : a[o];
849
- r.plugin(o, c);
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 Qe(this)(() => {
859
- $(this).deactivatedPromise = null;
860
- const t = this.state === "deactivated";
861
- t && (z(
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)), z(
866
- this,
867
- "loading"
868
- /* Loading */
869
- );
870
- const e = this.implementation.instructions, s = Bt(e, E.Pre, this);
871
- return Promise.all(s.map((i) => i.handler(this))).then(() => {
872
- Ze(this);
873
- const i = Bt(e, E.Post, this);
874
- return Promise.all(i.map((r) => r.handler(this))).then(() => {
875
- t && this.container.get("$controller").initialize();
876
- });
877
- }).then(() => (z(
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
- $(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 = $(this).activatedPromise;
900
- return e ? (process.env.NODE_ENV !== "production" && v(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, t), e) : $(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 = $(this).activatedPromise, i = (r, ...o) => s.then(this.load).then(() => this.container.get("$controller").invoke(r, ...o));
910
- return s ? i(t, ...e) : (process.env.NODE_ENV !== "production" && v(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(i(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 $(this).deactivatedPromise || (this.state === "deactivated" ? Promise.resolve() : (z(
922
- this,
923
- "deactivating"
924
- /* Deactivating */
925
- ), $(this).deactivatedPromise = this.container.get("$controller").deactivate().then(() => ($(this).activatedPromise = null, $(this).subscriptions.forEach((e) => e()), $(this).subscriptions = [], this.container.clear().then(() => {
926
- this.events.clear(), ze(this), z(
927
- this,
928
- "deactivated"
929
- /* Deactivated */
930
- );
931
- })))));
932
- }
933
- }
934
- const Ft = L();
935
- class Ke {
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", {}), Ft(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 Fe(t, this, Ft(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 Je(t, this, e);
970
- return this.widgets.set(s.name, s), s;
971
- }
972
- }
973
- function Ge(n, t, e) {
974
- const s = new Ke(n, t, e);
975
- return n.widgets && Object.keys(n.widgets).forEach((i) => {
976
- var r;
977
- const o = (r = n.widgets) == null ? void 0 : r[i];
978
- s.createWidget(i, o);
979
- }), s;
980
- }
981
- let Yt = class ue {
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 ue(
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 xt = "#____version____#", gt = L(), Xe = (n) => n.tenant ? `${n.name}:${n.tenant}` : n.name, ge = class {
1005
- constructor(t, e = [], s = {}) {
1006
- this.widgets = new Yt(
1007
- () => {
1008
- let i = [];
1009
- return this.implementations.all().forEach((r) => {
1010
- i = i.concat(Array.from(r.widgets.values()));
1011
- }), i;
1012
- },
1013
- le
1014
- ), this.implementations = new Yt([], Le), this.name = t, this.container = new Et(this, t), this.events = new Te(this), this.container.register("$version", xt), this.container.register("$environment", this), this.container.register("$environmentOptions", s), gt(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 = Xe(t);
1022
- let s = this.implementations.find(e);
1023
- if (s)
1024
- return process.env.NODE_ENV !== "production" && v(s).warn(`Implementation "${e}" already exist on current environment.`), s;
1025
- const i = gt(this).configurationApiExtensions;
1026
- return s = Ge(
1027
- t,
1028
- this,
1029
- i
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
- (i) => {
1040
- gt(this).configurationApiExtensions.push(i);
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 ge(
1050
- t.name || "",
1051
- t.configurationApiExtensions,
1052
- t.options
1053
- );
1054
- }
1055
- };
1056
- let me = ge;
1057
- me.version = xt;
1058
- const at = (n, t, ...e) => typeof t == "string" ? n(`[humany] ${t}`, ...e) : n(t, ...e), I = class {
1059
- constructor() {
1060
- this.keys = [], this.log = (t, ...e) => this.lookup(t, () => I.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => I.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => I.error(...e)), this.info = (t, ...e) => this.lookup(t, () => I.info(...e));
1061
- }
1062
- lookup(t, e) {
1063
- this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
1064
- }
1065
- };
1066
- let Z = I;
1067
- Z.log = (...n) => at(console.log, ...n);
1068
- Z.warn = (...n) => at(console.warn, ...n);
1069
- Z.error = (...n) => at(console.error, ...n);
1070
- Z.info = (...n) => at(console.info, ...n);
1071
- const x = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
1072
- function Pt() {
1073
- return x() + x() + "-" + x() + "-" + x() + "-" + x() + "-" + x() + x() + x();
1074
- }
1075
- var ts = Object.defineProperty, es = Object.defineProperties, ss = Object.getOwnPropertyDescriptors, Qt = Object.getOwnPropertySymbols, is = Object.prototype.hasOwnProperty, ns = Object.prototype.propertyIsEnumerable, Zt = (n, t, e) => t in n ? ts(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, wt = (n, t) => {
1076
- for (var e in t || (t = {}))
1077
- is.call(t, e) && Zt(n, e, t[e]);
1078
- if (Qt)
1079
- for (var e of Qt(t))
1080
- ns.call(t, e) && Zt(n, e, t[e]);
1081
- return n;
1082
- }, rs = (n, t) => es(n, ss(t));
1083
- const os = (n) => {
1084
- const t = [];
1085
- return [
1086
- (e, s) => {
1087
- t.push(n.subscribe(e, s));
1088
- },
1089
- () => {
1090
- t.forEach((e) => {
1091
- e();
1092
- });
1093
- }
1094
- ];
1095
- };
1096
- let Ct = 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 as(this.platform, this);
1111
- }
1112
- }, fe = class {
1113
- constructor(t, e, s) {
1114
- this.platform = t, this.node = e, this.actions = new kt(
1115
- t,
1116
- new Ct(t).withId(e.id),
1117
- s
1118
- );
1119
- const [i, r] = os(this.platform.events);
1120
- this.subscribe = i, 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 as {
1149
- constructor(t, e, s = !0) {
1150
- this.platform = t, this.target = e, this.clearOnDispose = s, this.removes = [], this.actions = new kt(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 cs = (n, t, e) => {
1189
- const s = n.concat(), i = (r, o, a) => {
1190
- let c = !0;
1191
- if (s.length) {
1192
- const l = s.shift(), h = (p, u) => (c = !1, i(p, Object.assign({}, o, u), a));
1193
- return Promise.resolve(l(r, h, a)).then((p) => rs(wt({}, p), {
1194
- cancelled: c
1195
- }));
1196
- }
1197
- return Promise.resolve({ data: r, cancelled: !1, options: o });
1198
- };
1199
- return i(t, {}, e);
1200
- };
1201
- let kt = 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 i = () => {
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(i), i;
1219
- }
1220
- dispatch(t, e) {
1221
- const s = this.platform.nodes.all.concat(
1222
- this.platform.nodes.detached
1223
- ), i = {}, 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
- (l) => o.target.match(l) && this.target.match(l)
1230
- ), c = this.platform.actionsState.watchers.filter((l) => l.key === t && (!l.ns || !this.ns || l.ns === this.ns) && a.some((h) => l.target.match(h))).map((l) => l.fn);
1231
- return Promise.all(
1232
- a.map((l) => {
1233
- const h = new fe(
1234
- this.platform,
1235
- l,
1236
- this.ns
1237
- );
1238
- return cs(c, e, h).then((p) => {
1239
- const { data: u = {}, options: d, cancelled: f } = p;
1240
- return Promise.resolve(
1241
- f ? {} : o.fn(u, d, h)
1242
- ).then((j) => {
1243
- i[l.id] = j;
1244
- });
1245
- });
1246
- })
1247
- );
1248
- })
1249
- ).then(() => i);
1250
- }
1251
- watch(t, e) {
1252
- let s = t, i = this.ns;
1253
- const r = t.split(".");
1254
- r.length > 1 && (i = r[0], s = r.splice(1).join("."));
1255
- const o = {
1256
- fn: e,
1257
- target: this.target,
1258
- key: s,
1259
- ns: i
1260
- };
1261
- this.platform.actionsState.watchers.push(o);
1262
- const a = () => {
1263
- const c = this.platform.actionsState.watchers.indexOf(o);
1264
- c > -1 && this.platform.actionsState.watchers.splice(c, 1);
1265
- };
1266
- return this.subscriptions.push(a), a;
1267
- }
1268
- dispose() {
1269
- this.subscriptions.forEach((t) => t());
1270
- }
1271
- };
1272
- de((n) => {
1273
- n.createCommand("components", (t) => (e) => {
1274
- t.events.subscribeOnce("components:platform-created", (s, { platform: i }) => {
1275
- e.handlers && e.handlers.forEach(([r, o]) => {
1276
- i.addComponentHandler(r, o);
1277
- });
1278
- });
1279
- });
1280
- });
1281
- let Jt = class {
1282
- constructor(t, e) {
1283
- this.events = t, this.tags = [], this.children = {}, this.changesets = [], this.mountCount = 0, this.id = Pt(), 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" && Z.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 i = [{ properties: t }, e];
1315
- return this.changesets.push(i), this.events.dispatch("components:set-properties", { node: this }), () => {
1316
- if (s) {
1317
- const r = this.changesets.indexOf(i);
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 i = [{ properties: t }, e];
1324
- return this.changesets.push(i), this.events.dispatch("components:set-properties", { node: this }), () => {
1325
- if (s) {
1326
- const r = this.changesets.indexOf(i);
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 i = [{ layout: t }, e];
1333
- return this.changesets.push(i), this.events.dispatch("components:set-layout", { node: this }), () => {
1334
- if (!s)
1335
- return;
1336
- const r = this.changesets.indexOf(i);
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 i = [{ context: t }, e];
1342
- return this.changesets.push(i), this.events.dispatch("components:set-context", { node: this }), () => {
1343
- if (!s)
1344
- return;
1345
- const r = this.changesets.indexOf(i);
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, i, r) => {
1352
- const { order: o = r } = i.attributes.layout;
1353
- return s[o] ? s.splice(o, 0, i) : s[o] = i, 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], i = s.indexOf(t);
1362
- i > -1 && (s.splice(i, 1), this.events.dispatch("components:node-removed", { node: t, parentNode: this }));
1363
- }), delete t.parent;
1364
- }
1365
- };
1366
- const ve = (n, t, e) => {
1367
- for (let s = 0, i = n.length; s < i && e(n[s]) !== !0; s++) {
1368
- const r = t[n[s].id] || "default", o = n[s].getChildren(r);
1369
- ve(o, t, e);
1370
- }
1371
- }, Ot = (n, t, e) => {
1372
- if (e(n) !== !0) {
1373
- const s = t[n.id] || "default", i = n.children[s];
1374
- ve(i, t, e);
1375
- }
1376
- }, mt = (n, t) => {
1377
- const e = [];
1378
- return Ot(n, t, (s) => {
1379
- e.push(s);
1380
- }), e;
1381
- }, hs = (n, t, e) => {
1382
- let s;
1383
- return Ot(n, t, (i) => {
1384
- if (e(i))
1385
- return s = i, !0;
1386
- }), s;
1387
- };
1388
- class ls {
1389
- constructor(t, e, s) {
1390
- this.root = t, this.switches = e, this.all = [], this.visible = [], this.detached = [], s.subscribe("components:node-appended", (i, r) => {
1391
- this.all.push(r.node), this.visible = mt(t, e);
1392
- }), s.subscribe("components:node-removed", (i, 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 = mt(t, e);
1395
- }), s.subscribe("components:node-switched", (i, r) => {
1396
- this.visible = mt(t, e);
1397
- });
1398
- }
1399
- query(t = {}) {
1400
- const e = [];
1401
- return Ot(this.root, this.switches, (s) => {
1402
- Object.keys(t).every((i) => t[i] === s[i]) && e.push(s);
1403
- }), e;
1404
- }
1405
- get(t) {
1406
- return hs(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
1407
- }
1408
- }
1409
- class ps {
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 ds = (n) => {
1421
- let t = n, e = 0;
1422
- for (; t.parent; )
1423
- e = e + 1, t = t.parent;
1424
- return e;
1425
- }, us = (n) => n.map(([t, e]) => [ds(t), t, e]).sort(([t], [e]) => t - e).map(([, t, e]) => [t, e]), ft = (n) => n instanceof Date ? !1 : n && typeof n == "object" && !Array.isArray(n), _ = (n, ...t) => {
1426
- if (!t.length)
1427
- return n;
1428
- const e = t.shift();
1429
- if (ft(n) && ft(e))
1430
- for (const s in e)
1431
- ft(e[s]) ? (n[s] || Object.assign(n, { [s]: {} }), _(n[s], e[s])) : Object.assign(n, { [s]: e[s] });
1432
- return _(n, ...t);
1433
- }, gs = (n, t) => !n || n === "all" ? !0 : n.some((e) => t.indexOf(e) > -1), ms = (n, t) => {
1434
- let e = [], s = [], i;
1435
- const r = () => {
1436
- process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
1437
- const a = /* @__PURE__ */ new Map(), c = us(e.map((h, p) => [h, s[p]])), l = (h, p) => {
1438
- var u;
1439
- const d = a.get(h) || {}, f = p.context && !d.context, j = p.properties && !d.properties, ht = p.layout && !d.layout;
1440
- a.set(h, {
1441
- context: d.context || f,
1442
- properties: d.properties || j,
1443
- layout: d.layout || ht
1444
- }), j && (h.attributes.properties = {}), ht && (h.attributes.layout = {}), f && (h.attributes.context = _({}, (u = h.parent) == null ? void 0 : u.attributes.context));
1445
- const Ht = [], Lt = [], Rt = [];
1446
- if (h.changesets.forEach((w) => {
1447
- const [y, lt] = w;
1448
- gs(lt.breakpoints, n.breakpoints) && (j && (typeof y.properties == "function" ? Ht.push(
1449
- y.properties
1450
- ) : _(h.attributes.properties, y.properties)), ht && (typeof y.layout == "function" ? Lt.push(y.layout) : _(h.attributes.layout, y.layout)), f && (typeof y.context == "function" ? Rt.push(y.context) : _(h.attributes.context, y.context)));
1451
- }), Ht.forEach((w) => {
1452
- _(h.attributes.properties, w(h.attributes.properties));
1453
- }), Lt.forEach((w) => {
1454
- _(h.attributes.layout, w(h.attributes.layout));
1455
- }), Rt.forEach((w) => {
1456
- _(h.attributes.context, w(h.attributes.context));
1457
- }), f || p.recursive) {
1458
- const w = n.getBranch(h), y = p.recursive ? p : {
1459
- context: !!f
1460
- };
1461
- h.getChildren(w).forEach((lt) => {
1462
- l(lt, y);
1463
- });
1464
- }
1465
- };
1466
- process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"), c.forEach(([h, p]) => {
1467
- l(h, p);
1468
- }), e = [], s = [], t(a);
1469
- }, o = () => {
1470
- clearTimeout(i), i = setTimeout(r, 0);
1471
- };
1472
- return (a, c) => {
1473
- const l = e.indexOf(a);
1474
- if (l > -1) {
1475
- const h = s[l];
1476
- return c.context && (h.context = !0), c.properties && (h.properties = !0), c.layout && (h.layout = !0), c.recursive && (h.recursive = !0), o();
1477
- }
1478
- return e.push(a), s.push(c), o();
1479
- };
1480
- };
1481
- class fs {
1482
- constructor(t, e = {}) {
1483
- this.providers = e, this.breakpoints = [], this.actionsState = { handlers: [], watchers: [] }, this.switches = {}, this.changesets = [], this.subscriptions = [], this.customComponentHandler = new ps(), this.events = t.events.createChild(this);
1484
- const s = new Jt(this.events, "root");
1485
- s.name = `root-${t.name}`, this.nodes = new ls(s, this.switches, this.events);
1486
- const i = this.processNode = ms(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 c = r.get(a);
1494
- a.parent && a.parent.type === "root" && this.events.dispatch("components:root-children-changed", { node: a }), c != null && c.context && this.events.dispatch("components:context-changed", { node: a }), c != null && c.properties && this.events.dispatch("components:properties-changed", { node: a }), c != null && c.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((c) => {
1505
- const { changeset: l, target: h, removes: p } = c, [u, d] = l;
1506
- h.match(o.node) && (u.properties && p.push(a.writeProperties(u.properties, d)), u.context && p.push(a.writeContext(u.context, d)), u.layout && p.push(a.writeLayout(u.layout, d)));
1507
- });
1508
- }
1509
- )
1510
- ), this.subscriptions.push(
1511
- this.events.subscribe(
1512
- "components:node-appended",
1513
- (r, o) => {
1514
- i(o.node, { properties: !0, context: !0 });
1515
- }
1516
- )
1517
- ), this.subscriptions.push(
1518
- this.events.subscribe(
1519
- "components:set-properties",
1520
- (r, o) => {
1521
- i(o.node, { properties: !0 });
1522
- }
1523
- )
1524
- ), this.subscriptions.push(
1525
- this.events.subscribe(
1526
- "components:set-context",
1527
- (r, o) => {
1528
- i(o.node, { properties: !0, context: !0 });
1529
- }
1530
- )
1531
- ), this.subscriptions.push(
1532
- this.events.subscribe(
1533
- "components:set-indent",
1534
- (r, o) => {
1535
- i(o.node, { layout: !0 });
1536
- }
1537
- )
1538
- ), this.subscriptions.push(
1539
- this.events.subscribe(
1540
- "components:set-layout",
1541
- (r, o) => {
1542
- i(o.node, { layout: !0 });
1543
- }
1544
- )
1545
- ), this.subscriptions.push(
1546
- this.events.subscribe("components:node-switched", (r, { node: o, branch: a }) => {
1547
- i(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
- i(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 Jt(this.events, t);
1592
- return e.detached && this.nodes.detached.push(s), s;
1593
- }
1594
- components() {
1595
- return new Ct(this);
1596
- }
1597
- actions(t, e) {
1598
- return new kt(this, t, e);
1599
- }
1600
- write(t) {
1601
- const { provider: e, target: s, attributes: i, options: r = {}, removable: o } = t, a = t.key || Pt(), c = { changeset: [i, r], target: s, removes: [] };
1602
- if (e) {
1603
- const l = this.providers[e];
1604
- l.write(a, s, i, r), c.removes.push(() => {
1605
- l.remove(a);
1606
- });
1607
- }
1608
- return this.changesets.push(c), this.nodes.all.forEach((l) => {
1609
- if (s.match(l)) {
1610
- let h = () => {
1611
- };
1612
- i.properties && (h = l.writeProperties(i.properties, r, o)), i.context && (h = l.writeContext(i.context, r, o)), i.layout && (h = l.writeContext(i.layout, r, o)), c.removes.push(h);
1613
- }
1614
- }), () => {
1615
- if (o) {
1616
- c.removes.forEach((h) => h());
1617
- const l = this.changesets.indexOf(c);
1618
- l > -1 && this.changesets.splice(l, 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 ai = (n, t) => ({
1633
- id: n.id,
1634
- type: n.type,
1635
- name: n.name,
1636
- branch: t || "default"
1637
- }), vs = (n, t, e, s = Pt(), i = {}) => n.getAsync("components").then((r) => {
1638
- let o;
1639
- if (typeof t == "string") {
1640
- const l = new Ct(r);
1641
- l.ofType(t), o = l;
1642
- } else
1643
- o = t;
1644
- const a = {}, c = (l) => {
1645
- const h = a[l.id];
1646
- return h ? Promise.resolve(h.controller) : fs.getInstance(n).then((p) => new fe(p, l, s));
1647
- };
1648
- r.events.subscribe(
1649
- "components:node-enter",
1650
- (l, { node: h }) => {
1651
- o.match(h) && c(h).then((p) => {
1652
- Promise.resolve(e(p)).then((u) => {
1653
- a[h.id] = {
1654
- dispose: u,
1655
- controller: p
1656
- };
1657
- });
1658
- });
1659
- }
1660
- ), r.events.subscribe(
1661
- "components:node-exit",
1662
- (l, { node: h }) => {
1663
- const p = a[h.id];
1664
- p && (p.dispose && p.dispose(), i.reuseController || (p.controller.dispose(), delete a[h.id]));
1665
- }
1666
- );
1667
- }), ys = "#____version____#", ye = class extends me {
1668
- constructor(t, e = []) {
1669
- super(t, e, {
1670
- transformPluginSettings: (s, i, r) => {
1671
- const o = r.get("$settings"), a = o.plugins && i ? o.plugins[i] || {} : {};
1672
- return wt(wt({}, 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((i) => i.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 = [ke].concat(
1696
- t.configurationApiExtensions || []
1697
- );
1698
- return new ye("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 = [], i = t && t._c;
1711
- i && i.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 $s = ye;
1724
- $s.version = `${ys} (${xt})`;
1725
- /**
1726
- * @license
1727
- * Copyright 2019 Google LLC
1728
- * SPDX-License-Identifier: BSD-3-Clause
1729
- */
1730
- const st = globalThis, St = st.ShadowRoot && (st.ShadyCSS === void 0 || st.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Nt = Symbol(), Kt = /* @__PURE__ */ new WeakMap();
1731
- let $e = class {
1732
- constructor(t, e, s) {
1733
- if (this._$cssResult$ = !0, s !== Nt)
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 (St && t === void 0) {
1741
- const s = e !== void 0 && e.length === 1;
1742
- s && (t = Kt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Kt.set(e, t));
1743
- }
1744
- return t;
1745
- }
1746
- toString() {
1747
- return this.cssText;
1748
- }
1749
- };
1750
- const bs = (n) => new $e(typeof n == "string" ? n : n + "", void 0, Nt), ws = (n, ...t) => {
1751
- const e = n.length === 1 ? n[0] : t.reduce((s, i, 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
- })(i) + n[r + 1], n[0]);
1758
- return new $e(e, n, Nt);
1759
- }, _s = (n, t) => {
1760
- if (St)
1761
- n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
1762
- else
1763
- for (const e of t) {
1764
- const s = document.createElement("style"), i = st.litNonce;
1765
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, n.appendChild(s);
1766
- }
1767
- }, Gt = St ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
1768
- let e = "";
1769
- for (const s of t.cssRules)
1770
- e += s.cssText;
1771
- return bs(e);
1772
- })(n) : n;
1773
- /**
1774
- * @license
1775
- * Copyright 2017 Google LLC
1776
- * SPDX-License-Identifier: BSD-3-Clause
1777
- */
1778
- const { is: As, defineProperty: Es, getOwnPropertyDescriptor: xs, getOwnPropertyNames: Ps, getOwnPropertySymbols: Cs, getPrototypeOf: ks } = Object, k = globalThis, Xt = k.trustedTypes, Os = Xt ? Xt.emptyScript : "", vt = k.reactiveElementPolyfillSupport, B = (n, t) => n, rt = { toAttribute(n, t) {
1779
- switch (t) {
1780
- case Boolean:
1781
- n = n ? Os : null;
1782
- break;
1783
- case Object:
1784
- case Array:
1785
- n = n == null ? n : JSON.stringify(n);
1786
- }
1787
- return n;
1788
- }, fromAttribute(n, t) {
1789
- let e = n;
1790
- switch (t) {
1791
- case Boolean:
1792
- e = n !== null;
1793
- break;
1794
- case Number:
1795
- e = n === null ? null : Number(n);
1796
- break;
1797
- case Object:
1798
- case Array:
1799
- try {
1800
- e = JSON.parse(n);
1801
- } catch {
1802
- e = null;
1803
- }
1804
- }
1805
- return e;
1806
- } }, Tt = (n, t) => !As(n, t), te = { attribute: !0, type: String, converter: rt, reflect: !1, hasChanged: Tt };
1807
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), k.litPropertyMetadata ?? (k.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
1808
- class M extends HTMLElement {
1809
- static addInitializer(t) {
1810
- this._$Ei(), (this.l ?? (this.l = [])).push(t);
1811
- }
1812
- static get observedAttributes() {
1813
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
1814
- }
1815
- static createProperty(t, e = te) {
1816
- if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
1817
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
1818
- i !== void 0 && Es(this.prototype, t, i);
1819
- }
1820
- }
1821
- static getPropertyDescriptor(t, e, s) {
1822
- const { get: i, set: r } = xs(this.prototype, t) ?? { get() {
1823
- return this[e];
1824
- }, set(o) {
1825
- this[e] = o;
1826
- } };
1827
- return { get() {
1828
- return i == null ? void 0 : i.call(this);
1829
- }, set(o) {
1830
- const a = i == null ? void 0 : i.call(this);
1831
- r.call(this, o), this.requestUpdate(t, a, s);
1832
- }, configurable: !0, enumerable: !0 };
1833
- }
1834
- static getPropertyOptions(t) {
1835
- return this.elementProperties.get(t) ?? te;
1836
- }
1837
- static _$Ei() {
1838
- if (this.hasOwnProperty(B("elementProperties")))
1839
- return;
1840
- const t = ks(this);
1841
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
1842
- }
1843
- static finalize() {
1844
- if (this.hasOwnProperty(B("finalized")))
1845
- return;
1846
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(B("properties"))) {
1847
- const e = this.properties, s = [...Ps(e), ...Cs(e)];
1848
- for (const i of s)
1849
- this.createProperty(i, e[i]);
1850
- }
1851
- const t = this[Symbol.metadata];
1852
- if (t !== null) {
1853
- const e = litPropertyMetadata.get(t);
1854
- if (e !== void 0)
1855
- for (const [s, i] of e)
1856
- this.elementProperties.set(s, i);
1857
- }
1858
- this._$Eh = /* @__PURE__ */ new Map();
1859
- for (const [e, s] of this.elementProperties) {
1860
- const i = this._$Eu(e, s);
1861
- i !== void 0 && this._$Eh.set(i, e);
1862
- }
1863
- this.elementStyles = this.finalizeStyles(this.styles);
1864
- }
1865
- static finalizeStyles(t) {
1866
- const e = [];
1867
- if (Array.isArray(t)) {
1868
- const s = new Set(t.flat(1 / 0).reverse());
1869
- for (const i of s)
1870
- e.unshift(Gt(i));
1871
- } else
1872
- t !== void 0 && e.push(Gt(t));
1873
- return e;
1874
- }
1875
- static _$Eu(t, e) {
1876
- const s = e.attribute;
1877
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
1878
- }
1879
- constructor() {
1880
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
1881
- }
1882
- _$Ev() {
1883
- var t;
1884
- this._$Eg = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
1885
- }
1886
- addController(t) {
1887
- var e;
1888
- (this._$ES ?? (this._$ES = [])).push(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
1889
- }
1890
- removeController(t) {
1891
- var e;
1892
- (e = this._$ES) == null || e.splice(this._$ES.indexOf(t) >>> 0, 1);
1893
- }
1894
- _$E_() {
1895
- const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
1896
- for (const s of e.keys())
1897
- this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
1898
- t.size > 0 && (this._$Ep = t);
1899
- }
1900
- createRenderRoot() {
1901
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
1902
- return _s(t, this.constructor.elementStyles), t;
1903
- }
1904
- connectedCallback() {
1905
- var t;
1906
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) == null || t.forEach((e) => {
1907
- var s;
1908
- return (s = e.hostConnected) == null ? void 0 : s.call(e);
1909
- });
1910
- }
1911
- enableUpdating(t) {
1912
- }
1913
- disconnectedCallback() {
1914
- var t;
1915
- (t = this._$ES) == null || t.forEach((e) => {
1916
- var s;
1917
- return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
1918
- });
1919
- }
1920
- attributeChangedCallback(t, e, s) {
1921
- this._$AK(t, s);
1922
- }
1923
- _$EO(t, e) {
1924
- var r;
1925
- const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
1926
- if (i !== void 0 && s.reflect === !0) {
1927
- const o = (((r = s.converter) == null ? void 0 : r.toAttribute) !== void 0 ? s.converter : rt).toAttribute(e, s.type);
1928
- this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null;
1929
- }
1930
- }
1931
- _$AK(t, e) {
1932
- var r;
1933
- const s = this.constructor, i = s._$Eh.get(t);
1934
- if (i !== void 0 && this._$Em !== i) {
1935
- const o = s.getPropertyOptions(i), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((r = o.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? o.converter : rt;
1936
- this._$Em = i, this[i] = a.fromAttribute(e, o.type), this._$Em = null;
1937
- }
1938
- }
1939
- requestUpdate(t, e, s, i = !1, r) {
1940
- if (t !== void 0) {
1941
- if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? Tt)(i ? r : this[t], e))
1942
- return;
1943
- this.C(t, e, s);
1944
- }
1945
- this.isUpdatePending === !1 && (this._$Eg = this._$EP());
1946
- }
1947
- C(t, e, s) {
1948
- this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
1949
- }
1950
- async _$EP() {
1951
- this.isUpdatePending = !0;
1952
- try {
1953
- await this._$Eg;
1954
- } catch (e) {
1955
- Promise.reject(e);
1956
- }
1957
- const t = this.scheduleUpdate();
1958
- return t != null && await t, !this.isUpdatePending;
1959
- }
1960
- scheduleUpdate() {
1961
- return this.performUpdate();
1962
- }
1963
- performUpdate() {
1964
- var s;
1965
- if (!this.isUpdatePending)
1966
- return;
1967
- if (!this.hasUpdated) {
1968
- if (this._$Ep) {
1969
- for (const [r, o] of this._$Ep)
1970
- this[r] = o;
1971
- this._$Ep = void 0;
1972
- }
1973
- const i = this.constructor.elementProperties;
1974
- if (i.size > 0)
1975
- for (const [r, o] of i)
1976
- o.wrapped !== !0 || this._$AL.has(r) || this[r] === void 0 || this.C(r, this[r], o);
1977
- }
1978
- let t = !1;
1979
- const e = this._$AL;
1980
- try {
1981
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$ES) == null || s.forEach((i) => {
1982
- var r;
1983
- return (r = i.hostUpdate) == null ? void 0 : r.call(i);
1984
- }), this.update(e)) : this._$ET();
1985
- } catch (i) {
1986
- throw t = !1, this._$ET(), i;
1987
- }
1988
- t && this._$AE(e);
1989
- }
1990
- willUpdate(t) {
1991
- }
1992
- _$AE(t) {
1993
- var e;
1994
- (e = this._$ES) == null || e.forEach((s) => {
1995
- var i;
1996
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
1997
- }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
1998
- }
1999
- _$ET() {
2000
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
2001
- }
2002
- get updateComplete() {
2003
- return this.getUpdateComplete();
2004
- }
2005
- getUpdateComplete() {
2006
- return this._$Eg;
2007
- }
2008
- shouldUpdate(t) {
2009
- return !0;
2010
- }
2011
- update(t) {
2012
- this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EO(e, this[e]))), this._$ET();
2013
- }
2014
- updated(t) {
2015
- }
2016
- firstUpdated(t) {
2017
- }
2018
- }
2019
- M.elementStyles = [], M.shadowRootOptions = { mode: "open" }, M[B("elementProperties")] = /* @__PURE__ */ new Map(), M[B("finalized")] = /* @__PURE__ */ new Map(), vt == null || vt({ ReactiveElement: M }), (k.reactiveElementVersions ?? (k.reactiveElementVersions = [])).push("2.0.1");
2020
- /**
2021
- * @license
2022
- * Copyright 2017 Google LLC
2023
- * SPDX-License-Identifier: BSD-3-Clause
2024
- */
2025
- const V = globalThis, ot = V.trustedTypes, ee = ot ? ot.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, be = "$lit$", P = `lit$${(Math.random() + "").slice(9)}$`, we = "?" + P, Ss = `<${we}>`, N = document, F = () => N.createComment(""), Y = (n) => n === null || typeof n != "object" && typeof n != "function", _e = Array.isArray, Ns = (n) => _e(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", yt = `[
2026
- \f\r]`, D = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, se = /-->/g, ie = />/g, O = RegExp(`>|${yt}(?:([^\\s"'>=/]+)(${yt}*=${yt}*(?:[^
2027
- \f\r"'\`<>=]|("|')|))|$)`, "g"), ne = /'/g, re = /"/g, Ae = /^(?:script|style|textarea|title)$/i, Ts = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), tt = Ts(1), T = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), oe = /* @__PURE__ */ new WeakMap(), S = N.createTreeWalker(N, 129);
2028
- function Ee(n, t) {
2029
- if (!Array.isArray(n) || !n.hasOwnProperty("raw"))
2030
- throw Error("invalid template strings array");
2031
- return ee !== void 0 ? ee.createHTML(t) : t;
2032
- }
2033
- const Ms = (n, t) => {
2034
- const e = n.length - 1, s = [];
2035
- let i, r = t === 2 ? "<svg>" : "", o = D;
2036
- for (let a = 0; a < e; a++) {
2037
- const c = n[a];
2038
- let l, h, p = -1, u = 0;
2039
- for (; u < c.length && (o.lastIndex = u, h = o.exec(c), h !== null); )
2040
- u = o.lastIndex, o === D ? h[1] === "!--" ? o = se : h[1] !== void 0 ? o = ie : h[2] !== void 0 ? (Ae.test(h[2]) && (i = RegExp("</" + h[2], "g")), o = O) : h[3] !== void 0 && (o = O) : o === O ? h[0] === ">" ? (o = i ?? D, p = -1) : h[1] === void 0 ? p = -2 : (p = o.lastIndex - h[2].length, l = h[1], o = h[3] === void 0 ? O : h[3] === '"' ? re : ne) : o === re || o === ne ? o = O : o === se || o === ie ? o = D : (o = O, i = void 0);
2041
- const d = o === O && n[a + 1].startsWith("/>") ? " " : "";
2042
- r += o === D ? c + Ss : p >= 0 ? (s.push(l), c.slice(0, p) + be + c.slice(p) + P + d) : c + P + (p === -2 ? a : d);
2043
- }
2044
- return [Ee(n, r + (n[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
2045
- };
2046
- class Q {
2047
- constructor({ strings: t, _$litType$: e }, s) {
2048
- let i;
2049
- this.parts = [];
2050
- let r = 0, o = 0;
2051
- const a = t.length - 1, c = this.parts, [l, h] = Ms(t, e);
2052
- if (this.el = Q.createElement(l, s), S.currentNode = this.el.content, e === 2) {
2053
- const p = this.el.content.firstChild;
2054
- p.replaceWith(...p.childNodes);
2055
- }
2056
- for (; (i = S.nextNode()) !== null && c.length < a; ) {
2057
- if (i.nodeType === 1) {
2058
- if (i.hasAttributes())
2059
- for (const p of i.getAttributeNames())
2060
- if (p.endsWith(be)) {
2061
- const u = h[o++], d = i.getAttribute(p).split(P), f = /([.?@])?(.*)/.exec(u);
2062
- c.push({ type: 1, index: r, name: f[2], strings: d, ctor: f[1] === "." ? Hs : f[1] === "?" ? Ls : f[1] === "@" ? Rs : ct }), i.removeAttribute(p);
2063
- } else
2064
- p.startsWith(P) && (c.push({ type: 6, index: r }), i.removeAttribute(p));
2065
- if (Ae.test(i.tagName)) {
2066
- const p = i.textContent.split(P), u = p.length - 1;
2067
- if (u > 0) {
2068
- i.textContent = ot ? ot.emptyScript : "";
2069
- for (let d = 0; d < u; d++)
2070
- i.append(p[d], F()), S.nextNode(), c.push({ type: 2, index: ++r });
2071
- i.append(p[u], F());
2072
- }
2073
- }
2074
- } else if (i.nodeType === 8)
2075
- if (i.data === we)
2076
- c.push({ type: 2, index: r });
2077
- else {
2078
- let p = -1;
2079
- for (; (p = i.data.indexOf(P, p + 1)) !== -1; )
2080
- c.push({ type: 7, index: r }), p += P.length - 1;
2081
- }
2082
- r++;
2083
- }
2084
- }
2085
- static createElement(t, e) {
2086
- const s = N.createElement("template");
2087
- return s.innerHTML = t, s;
2088
- }
2089
- }
2090
- function H(n, t, e = n, s) {
2091
- var o, a;
2092
- if (t === T)
2093
- return t;
2094
- let i = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
2095
- const r = Y(t) ? void 0 : t._$litDirective$;
2096
- return (i == null ? void 0 : i.constructor) !== r && ((a = i == null ? void 0 : i._$AO) == null || a.call(i, !1), r === void 0 ? i = void 0 : (i = new r(n), i._$AT(n, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = H(n, i._$AS(n, t.values), i, s)), t;
2097
- }
2098
- class Us {
2099
- constructor(t, e) {
2100
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
2101
- }
2102
- get parentNode() {
2103
- return this._$AM.parentNode;
2104
- }
2105
- get _$AU() {
2106
- return this._$AM._$AU;
2107
- }
2108
- u(t) {
2109
- const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? N).importNode(e, !0);
2110
- S.currentNode = i;
2111
- let r = S.nextNode(), o = 0, a = 0, c = s[0];
2112
- for (; c !== void 0; ) {
2113
- if (o === c.index) {
2114
- let l;
2115
- c.type === 2 ? l = new J(r, r.nextSibling, this, t) : c.type === 1 ? l = new c.ctor(r, c.name, c.strings, this, t) : c.type === 6 && (l = new js(r, this, t)), this._$AV.push(l), c = s[++a];
2116
- }
2117
- o !== (c == null ? void 0 : c.index) && (r = S.nextNode(), o++);
2118
- }
2119
- return S.currentNode = N, i;
2120
- }
2121
- p(t) {
2122
- let e = 0;
2123
- for (const s of this._$AV)
2124
- s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
2125
- }
2126
- }
2127
- class J {
2128
- get _$AU() {
2129
- var t;
2130
- return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
2131
- }
2132
- constructor(t, e, s, i) {
2133
- this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
2134
- }
2135
- get parentNode() {
2136
- let t = this._$AA.parentNode;
2137
- const e = this._$AM;
2138
- return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
2139
- }
2140
- get startNode() {
2141
- return this._$AA;
2142
- }
2143
- get endNode() {
2144
- return this._$AB;
2145
- }
2146
- _$AI(t, e = this) {
2147
- t = H(this, t, e), Y(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== T && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Ns(t) ? this.T(t) : this._(t);
2148
- }
2149
- k(t) {
2150
- return this._$AA.parentNode.insertBefore(t, this._$AB);
2151
- }
2152
- $(t) {
2153
- this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
2154
- }
2155
- _(t) {
2156
- this._$AH !== m && Y(this._$AH) ? this._$AA.nextSibling.data = t : this.$(N.createTextNode(t)), this._$AH = t;
2157
- }
2158
- g(t) {
2159
- var r;
2160
- const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = Q.createElement(Ee(s.h, s.h[0]), this.options)), s);
2161
- if (((r = this._$AH) == null ? void 0 : r._$AD) === i)
2162
- this._$AH.p(e);
2163
- else {
2164
- const o = new Us(i, this), a = o.u(this.options);
2165
- o.p(e), this.$(a), this._$AH = o;
2166
- }
2167
- }
2168
- _$AC(t) {
2169
- let e = oe.get(t.strings);
2170
- return e === void 0 && oe.set(t.strings, e = new Q(t)), e;
2171
- }
2172
- T(t) {
2173
- _e(this._$AH) || (this._$AH = [], this._$AR());
2174
- const e = this._$AH;
2175
- let s, i = 0;
2176
- for (const r of t)
2177
- i === e.length ? e.push(s = new J(this.k(F()), this.k(F()), this, this.options)) : s = e[i], s._$AI(r), i++;
2178
- i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
2179
- }
2180
- _$AR(t = this._$AA.nextSibling, e) {
2181
- var s;
2182
- for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
2183
- const i = t.nextSibling;
2184
- t.remove(), t = i;
2185
- }
2186
- }
2187
- setConnected(t) {
2188
- var e;
2189
- this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
2190
- }
2191
- }
2192
- class ct {
2193
- get tagName() {
2194
- return this.element.tagName;
2195
- }
2196
- get _$AU() {
2197
- return this._$AM._$AU;
2198
- }
2199
- constructor(t, e, s, i, r) {
2200
- this.type = 1, this._$AH = m, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = m;
2201
- }
2202
- _$AI(t, e = this, s, i) {
2203
- const r = this.strings;
2204
- let o = !1;
2205
- if (r === void 0)
2206
- t = H(this, t, e, 0), o = !Y(t) || t !== this._$AH && t !== T, o && (this._$AH = t);
2207
- else {
2208
- const a = t;
2209
- let c, l;
2210
- for (t = r[0], c = 0; c < r.length - 1; c++)
2211
- l = H(this, a[s + c], e, c), l === T && (l = this._$AH[c]), o || (o = !Y(l) || l !== this._$AH[c]), l === m ? t = m : t !== m && (t += (l ?? "") + r[c + 1]), this._$AH[c] = l;
2212
- }
2213
- o && !i && this.O(t);
2214
- }
2215
- O(t) {
2216
- t === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
2217
- }
2218
- }
2219
- class Hs extends ct {
2220
- constructor() {
2221
- super(...arguments), this.type = 3;
2222
- }
2223
- O(t) {
2224
- this.element[this.name] = t === m ? void 0 : t;
2225
- }
2226
- }
2227
- class Ls extends ct {
2228
- constructor() {
2229
- super(...arguments), this.type = 4;
2230
- }
2231
- O(t) {
2232
- this.element.toggleAttribute(this.name, !!t && t !== m);
2233
- }
2234
- }
2235
- class Rs extends ct {
2236
- constructor(t, e, s, i, r) {
2237
- super(t, e, s, i, r), this.type = 5;
2238
- }
2239
- _$AI(t, e = this) {
2240
- if ((t = H(this, t, e, 0) ?? m) === T)
2241
- return;
2242
- const s = this._$AH, i = t === m && s !== m || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== m && (s === m || i);
2243
- i && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
2244
- }
2245
- handleEvent(t) {
2246
- var e;
2247
- typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
2248
- }
2249
- }
2250
- class js {
2251
- constructor(t, e, s) {
2252
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
2253
- }
2254
- get _$AU() {
2255
- return this._$AM._$AU;
2256
- }
2257
- _$AI(t) {
2258
- H(this, t);
2259
- }
2260
- }
2261
- const $t = V.litHtmlPolyfillSupport;
2262
- $t == null || $t(Q, J), (V.litHtmlVersions ?? (V.litHtmlVersions = [])).push("3.0.2");
2263
- const zs = (n, t, e) => {
2264
- const s = (e == null ? void 0 : e.renderBefore) ?? t;
2265
- let i = s._$litPart$;
2266
- if (i === void 0) {
2267
- const r = (e == null ? void 0 : e.renderBefore) ?? null;
2268
- s._$litPart$ = i = new J(t.insertBefore(F(), r), r, void 0, e ?? {});
2269
- }
2270
- return i._$AI(n), i;
2271
- };
2272
- /**
2273
- * @license
2274
- * Copyright 2017 Google LLC
2275
- * SPDX-License-Identifier: BSD-3-Clause
2276
- */
2277
- class W extends M {
2278
- constructor() {
2279
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
2280
- }
2281
- createRenderRoot() {
2282
- var e;
2283
- const t = super.createRenderRoot();
2284
- return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
2285
- }
2286
- update(t) {
2287
- const e = this.render();
2288
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = zs(e, this.renderRoot, this.renderOptions);
2289
- }
2290
- connectedCallback() {
2291
- var t;
2292
- super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
2293
- }
2294
- disconnectedCallback() {
2295
- var t;
2296
- super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
2297
- }
2298
- render() {
2299
- return T;
2300
- }
2301
- }
2302
- var ae;
2303
- W._$litElement$ = !0, W.finalized = !0, (ae = globalThis.litElementHydrateSupport) == null || ae.call(globalThis, { LitElement: W });
2304
- const bt = globalThis.litElementPolyfillSupport;
2305
- bt == null || bt({ LitElement: W });
2306
- (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.1");
2307
- /**
2308
- * @license
2309
- * Copyright 2017 Google LLC
2310
- * SPDX-License-Identifier: BSD-3-Clause
2311
- */
2312
- const Ds = { attribute: !0, type: String, converter: rt, reflect: !1, hasChanged: Tt }, Is = (n = Ds, t, e) => {
2313
- const { kind: s, metadata: i } = e;
2314
- let r = globalThis.litPropertyMetadata.get(i);
2315
- if (r === void 0 && globalThis.litPropertyMetadata.set(i, r = /* @__PURE__ */ new Map()), r.set(e.name, n), s === "accessor") {
2316
- const { name: o } = e;
2317
- return { set(a) {
2318
- const c = t.get.call(this);
2319
- t.set.call(this, a), this.requestUpdate(o, c, n);
2320
- }, init(a) {
2321
- return a !== void 0 && this.C(o, void 0, n), a;
2322
- } };
2323
- }
2324
- if (s === "setter") {
2325
- const { name: o } = e;
2326
- return function(a) {
2327
- const c = this[o];
2328
- t.call(this, a), this.requestUpdate(o, c, n);
2329
- };
2330
- }
2331
- throw Error("Unsupported decorator location: " + s);
2332
- };
2333
- function Mt(n) {
2334
- return (t, e) => typeof e == "object" ? Is(n, t, e) : ((s, i, r) => {
2335
- const o = i.hasOwnProperty(r);
2336
- return i.constructor.createProperty(r, o ? { ...s, wrapped: !0 } : s), o ? Object.getOwnPropertyDescriptor(i, r) : void 0;
2337
- })(n, t, e);
2338
- }
2339
- /**
2340
- * @license
2341
- * Copyright 2017 Google LLC
2342
- * SPDX-License-Identifier: BSD-3-Clause
2343
- */
2344
- function Ut(n) {
2345
- return Mt({ ...n, state: !0, attribute: !1 });
2346
- }
2347
- /**
2348
- * @license
2349
- * Copyright 2017 Google LLC
2350
- * SPDX-License-Identifier: BSD-3-Clause
2351
- */
2352
- const Bs = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, Vs = (n) => (...t) => ({ _$litDirective$: n, values: t });
2353
- class Ws {
2354
- constructor(t) {
2355
- }
2356
- get _$AU() {
2357
- return this._$AM._$AU;
2358
- }
2359
- _$AT(t, e, s) {
2360
- this._$Ct = t, this._$AM = e, this._$Ci = s;
2361
- }
2362
- _$AS(t, e) {
2363
- return this.update(t, e);
2364
- }
2365
- update(t, e) {
2366
- return this.render(...e);
2367
- }
2368
- }
2369
- /**
2370
- * @license
2371
- * Copyright 2018 Google LLC
2372
- * SPDX-License-Identifier: BSD-3-Clause
2373
- */
2374
- const qs = Vs(class extends Ws {
2375
- constructor(n) {
2376
- var t;
2377
- if (super(n), n.type !== Bs.ATTRIBUTE || n.name !== "class" || ((t = n.strings) == null ? void 0 : t.length) > 2)
2378
- throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
2379
- }
2380
- render(n) {
2381
- return " " + Object.keys(n).filter((t) => n[t]).join(" ") + " ";
2382
- }
2383
- update(n, [t]) {
2384
- var s, i;
2385
- if (this.it === void 0) {
2386
- this.it = /* @__PURE__ */ new Set(), n.strings !== void 0 && (this.st = new Set(n.strings.join(" ").split(/\s/).filter((r) => r !== "")));
2387
- for (const r in t)
2388
- t[r] && !((s = this.st) != null && s.has(r)) && this.it.add(r);
2389
- return this.render(t);
2390
- }
2391
- const e = n.element.classList;
2392
- for (const r of this.it)
2393
- r in t || (e.remove(r), this.it.delete(r));
2394
- for (const r in t) {
2395
- const o = !!t[r];
2396
- o === this.it.has(r) || (i = this.st) != null && i.has(r) || (o ? (e.add(r), this.it.add(r)) : (e.remove(r), this.it.delete(r)));
2397
- }
2398
- return T;
2399
- }
2400
- }), et = (n, t, e) => {
2401
- n && e.style.setProperty(t, n);
2402
- }, Fs = (n, t) => {
2403
- var e, s, i, r;
2404
- et((e = n.colors) == null ? void 0 : e.primaryBackground, "--primary-background", t), et(
2405
- (s = n.colors) == null ? void 0 : s.textOnPrimaryBackground,
2406
- "--text-on-primary-background",
2407
- t
2408
- ), et((i = n.colors) == null ? void 0 : i.secondaryBackground, "--secondary-background", t), et(
2409
- (r = n.colors) == null ? void 0 : r.textOnSecondaryBackground,
2410
- "--text-on-secondary-background",
2411
- t
2412
- );
2413
- };
2414
- var Ys = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, K = (n, t, e, s) => {
2415
- for (var i = s > 1 ? void 0 : s ? Qs(t, e) : t, r = n.length - 1, o; r >= 0; r--)
2416
- (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
2417
- return s && i && Ys(t, e, i), i;
2418
- };
2419
- class R extends W {
2420
- constructor() {
2421
- super(...arguments), this.active = !1, this.loaded = !1;
2422
- }
2423
- async connectedCallback() {
2424
- super.connectedCallback(), this.icon = await this._renderSymbol(this.symbol), this.loaded = !0, this._applyBranding();
2425
- }
2426
- _toggleActive() {
2427
- this.active = !this.active;
2428
- }
2429
- _applyBranding() {
2430
- var e;
2431
- const t = ((e = this.container) == null ? void 0 : e.get("$settings")) ?? {};
2432
- t != null && t.branding && Fs(t.branding, this);
2433
- }
2434
- async _renderSymbol(t) {
2435
- const e = async (s) => await import("./index-d18b6f25.mjs").then(
2436
- (r) => r[s]
2437
- );
2438
- if (t) {
2439
- const { type: s, content: i } = t;
2440
- switch (s) {
2441
- case "Telia": {
2442
- const r = await e(i);
2443
- return r ? tt`<telia-icon
2444
- class="trigger-icon"
2445
- svg=${r.svg}
2446
- size="lg"
2447
- ></telia-icon>` : m;
2448
- }
2449
- case "FontAwesome":
2450
- return tt`<i class="trigger-fa-icon fa fa-${i}"></i>`;
2451
- case "Uri":
2452
- return tt`<i
2453
- class="trigger-custom-icon"
2454
- style="background: url(${i}) no-repeat center center;background-size: contain;"
2455
- ></i>`;
2456
- default:
2457
- return m;
2458
- }
2459
- }
2460
- }
2461
- render() {
2462
- return tt`<button
2463
- class=${qs({
2464
- trigger: !0,
2465
- active: this.active,
2466
- rendered: this.loaded
2467
- })}
2468
- @click=${this._toggleActive}
2469
- >
2470
- ${this.icon}
2471
- <span class="trigger-close">
2472
- <svg
2473
- width="18"
2474
- height="9"
2475
- viewBox="0 0 18 9"
2476
- fill="none"
2477
- xmlns="http://www.w3.org/2000/svg"
2478
- >
2479
- <path
2480
- 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"
2481
- fill="white"
2482
- />
2483
- </svg>
2484
- </span>
2485
- <span class="trigger-loader">
2486
- <svg viewBox="25 25 50 50">
2487
- <circle
2488
- cx="50"
2489
- cy="50"
2490
- r="20"
2491
- fill="none"
2492
- stroke="#000"
2493
- stroke-width="2"
2494
- stroke-miterlimit="10"
2495
- />
2496
- </svg>
2497
- </span>
2498
- </button>`;
2499
- }
2500
- }
2501
- R.styles = [
2502
- ws`
2503
- :host {
2504
- --voca-rem-multiplier: 0.625;
2505
- display: block;
2506
- box-sizing: border-box;
2507
- }
2508
-
2509
- .trigger {
2510
- position: fixed;
2511
- transform: scale(0);
2512
- box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
2513
- bottom: 20px;
2514
- right: 20px;
2515
- z-index: 5;
2516
- display: flex;
2517
- align-items: center;
2518
- justify-content: center;
2519
- border: none;
2520
- line-height: 55px;
2521
- height: 55px;
2522
- width: 55px;
2523
- border-radius: 55px;
2524
- cursor: pointer;
2525
- background-color: var(--trigger-bg, var(--primary-background));
2526
- font-family: Lato;
2527
- text-decoration: none;
2528
- border: 3px dashed transparent;
2529
- box-sizing: border-box;
2530
- transition: transform 200ms ease-out;
2531
- }
2532
- .trigger:hover {
2533
- transform: scale(1.1) !important;
2534
- }
2535
- .trigger.rendered {
2536
- transform: scale(1);
2537
- }
2538
- .trigger.active .trigger-icon {
2539
- opacity: 0;
2540
- transform: rotate(-180deg) scale(0);
2541
- }
2542
- .trigger.active .trigger-close {
2543
- opacity: 1;
2544
- transform: rotate(0deg) scale(1);
2545
- }
2546
-
2547
- .trigger-icon {
2548
- display: inline-block;
2549
- line-height: inherit;
2550
- text-align: center;
2551
- opacity: 1;
2552
- transform: rotate(0deg) scale(1);
2553
- transition: opacity 200ms ease-out, transform 200ms ease-out;
2554
- color: var(--trigger-text-color, var(--text-on-primary-background));
2555
- }
2556
- .trigger-close {
2557
- opacity: 0;
2558
- transition: transform 200ms ease-out;
2559
- transform: rotate(180deg) scale(0);
2560
- position: absolute;
2561
- top: 0;
2562
- bottom: 0;
2563
- left: 0;
2564
- right: 0;
2565
- display: flex;
2566
- justify-content: center;
2567
- align-items: center;
2568
- fill: var(--trigger-text-color, var(--text-on-primary-background));
2569
- }
2570
- `
2571
- ];
2572
- K([
2573
- Mt({ attribute: !1 })
2574
- ], R.prototype, "symbol", 2);
2575
- K([
2576
- Mt({ attribute: !1 })
2577
- ], R.prototype, "container", 2);
2578
- K([
2579
- Ut()
2580
- ], R.prototype, "active", 2);
2581
- K([
2582
- Ut()
2583
- ], R.prototype, "loaded", 2);
2584
- K([
2585
- Ut()
2586
- ], R.prototype, "icon", 2);
2587
- const Zs = (n, t, e, s, i) => n.getAsync("componentResolver").then((r) => (r.registerComponent(t, e), vs(n, t, s || (() => {
2588
- }), t, i))), li = (n) => Zs(
2589
- n,
2590
- "widget-header",
2591
- import("./widget-header-f25f74cb.mjs"),
2592
- (t) => {
2593
- }
2594
- );
2595
- console.log("3");
2596
- export {
2597
- ai as E,
2598
- Ct as P,
2599
- m as T,
2600
- li as W,
2601
- Pt as h,
2602
- ws as i,
2603
- Mt as n,
2604
- fs as p,
2605
- Ut as r,
2606
- W as s,
2607
- tt as x
2608
- };