@telia-ace/widget-runtime-flamingo 1.0.16 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/{dist/component-platform-factory.d.ts → component-platform-factory.d.ts} +1 -2
  2. package/context/children.context.d.ts +4 -0
  3. package/context/component-node.context.d.ts +4 -0
  4. package/{dist/context → context}/container.context.d.ts +0 -1
  5. package/{dist/context → context}/context.context.d.ts +0 -1
  6. package/{dist/context → context}/layout.context.d.ts +0 -1
  7. package/{dist/context → context}/properties.context.d.ts +0 -1
  8. package/{dist/controllers → controllers}/actions-controller.d.ts +1 -2
  9. package/{dist/core → core}/create-lit-component.d.ts +1 -2
  10. package/{dist/core → core}/get-render-state.d.ts +1 -2
  11. package/{dist/data-provider → data-provider}/data-provider.d.ts +1 -2
  12. package/{dist/data-provider → data-provider}/providers/guide-provider.plugin.d.ts +0 -1
  13. package/{dist/index-9688347a.js → index-5087564d.mjs} +1 -2
  14. package/index-6dd00f59.js +1 -0
  15. package/index-7a734709.mjs +3405 -0
  16. package/index-c94328c7.js +206 -0
  17. package/{dist/index.d.ts → index.d.ts} +0 -1
  18. package/index.js +1 -0
  19. package/{dist/index.js → index.mjs} +3 -4
  20. package/{dist/mixins → mixins}/widget-component.mixin.d.ts +1 -2
  21. package/package.json +10 -45
  22. package/render-42bea194.js +118 -0
  23. package/{dist/render-369a79dd.js → render-ad873416.mjs} +124 -150
  24. package/{dist/services.d.ts → services.d.ts} +3 -4
  25. package/{dist/ui → ui}/area.d.ts +0 -1
  26. package/{dist/ui → ui}/branding.d.ts +0 -1
  27. package/{dist/ui → ui}/get-css-props.d.ts +0 -1
  28. package/{dist/ui → ui}/get-layout-props.d.ts +0 -1
  29. package/{dist/ui → ui}/html-element-handlers.d.ts +0 -1
  30. package/{dist/ui → ui}/prepare-dom.d.ts +2 -2
  31. package/{dist/ui → ui}/render.d.ts +0 -2
  32. package/{dist/ui → ui}/trigger-component.d.ts +4 -2
  33. package/{dist/ui → ui}/view-outlet.d.ts +0 -1
  34. package/{dist/ui → ui}/wrapper.d.ts +1 -2
  35. package/{dist/widget.d.ts → widget.d.ts} +1 -2
  36. package/LICENSE.txt +0 -6
  37. package/README.md +0 -3
  38. package/dist/component-platform-factory.d.ts.map +0 -1
  39. package/dist/context/children.context.d.ts +0 -5
  40. package/dist/context/children.context.d.ts.map +0 -1
  41. package/dist/context/component-node.context.d.ts +0 -5
  42. package/dist/context/component-node.context.d.ts.map +0 -1
  43. package/dist/context/container.context.d.ts.map +0 -1
  44. package/dist/context/context.context.d.ts.map +0 -1
  45. package/dist/context/layout.context.d.ts.map +0 -1
  46. package/dist/context/properties.context.d.ts.map +0 -1
  47. package/dist/controllers/actions-controller.d.ts.map +0 -1
  48. package/dist/core/create-lit-component.d.ts.map +0 -1
  49. package/dist/core/get-render-state.d.ts.map +0 -1
  50. package/dist/data-provider/data-provider.d.ts.map +0 -1
  51. package/dist/data-provider/providers/guide-provider.plugin.d.ts.map +0 -1
  52. package/dist/index-9688347a.js.map +0 -1
  53. package/dist/index-bd7f8b31.js +0 -3837
  54. package/dist/index-bd7f8b31.js.map +0 -1
  55. package/dist/index.d.ts.map +0 -1
  56. package/dist/index.js.map +0 -1
  57. package/dist/mixins/widget-component.mixin.d.ts.map +0 -1
  58. package/dist/render-369a79dd.js.map +0 -1
  59. package/dist/services.d.ts.map +0 -1
  60. package/dist/ui/area.d.ts.map +0 -1
  61. package/dist/ui/branding.d.ts.map +0 -1
  62. package/dist/ui/get-css-props.d.ts.map +0 -1
  63. package/dist/ui/get-layout-props.d.ts.map +0 -1
  64. package/dist/ui/html-element-handlers.d.ts.map +0 -1
  65. package/dist/ui/index.d.ts +0 -2
  66. package/dist/ui/index.d.ts.map +0 -1
  67. package/dist/ui/prepare-dom.d.ts.map +0 -1
  68. package/dist/ui/render.d.ts.map +0 -1
  69. package/dist/ui/trigger-component.d.ts.map +0 -1
  70. package/dist/ui/view-outlet.d.ts.map +0 -1
  71. package/dist/ui/wrapper.d.ts.map +0 -1
  72. package/dist/widget.d.ts.map +0 -1
@@ -1,3837 +0,0 @@
1
- var _s = Object.defineProperty, Cs = Object.defineProperties;
2
- var Es = Object.getOwnPropertyDescriptors;
3
- var _e = Object.getOwnPropertySymbols, As = Object.getPrototypeOf, Os = Object.prototype.hasOwnProperty, xs = Object.prototype.propertyIsEnumerable, Ss = Reflect.get;
4
- var Ce = (s, t, e) => t in s ? _s(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, S = (s, t) => {
5
- for (var e in t || (t = {}))
6
- Os.call(t, e) && Ce(s, e, t[e]);
7
- if (_e)
8
- for (var e of _e(t))
9
- xs.call(t, e) && Ce(s, e, t[e]);
10
- return s;
11
- }, st = (s, t) => Cs(s, Es(t));
12
- var Ee = (s, t, e) => Ss(As(s), e, t);
13
- var y = (s, t, e) => new Promise((n, i) => {
14
- var r = (c) => {
15
- try {
16
- a(e.next(c));
17
- } catch (h) {
18
- i(h);
19
- }
20
- }, o = (c) => {
21
- try {
22
- a(e.throw(c));
23
- } catch (h) {
24
- i(h);
25
- }
26
- }, a = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(r, o);
27
- a((e = e.apply(s, t)).next());
28
- });
29
- var Ps = Object.defineProperty, ks = Object.defineProperties, Ns = Object.getOwnPropertyDescriptors, Ae = Object.getOwnPropertySymbols, Ds = Object.prototype.hasOwnProperty, Ms = Object.prototype.propertyIsEnumerable, Oe = (s, t, e) => t in s ? Ps(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, Ls = (s, t) => {
30
- for (var e in t || (t = {}))
31
- Ds.call(t, e) && Oe(s, e, t[e]);
32
- if (Ae)
33
- for (var e of Ae(t))
34
- Ms.call(t, e) && Oe(s, e, t[e]);
35
- return s;
36
- }, Is = (s, t) => ks(s, Ns(t));
37
- class Rs {
38
- constructor(t) {
39
- const { events: e } = t.get("$widget");
40
- this.events = e.createChild(this);
41
- }
42
- action(t, e, n) {
43
- this.events.dispatch(
44
- "data:action",
45
- { action: e, value: n, target: t },
46
- { bubbles: !0 }
47
- );
48
- }
49
- subscribe(t, e) {
50
- return this.events.subscribe(
51
- "data:action",
52
- (n, { action: i, value: r, target: o }) => t === o && e(t, i, r)
53
- );
54
- }
55
- }
56
- const Wt = (s, t, e, ...n) => {
57
- const i = `[${s.get("$environment").name || "webprovisions"}] ${e}`;
58
- switch (t) {
59
- case "info":
60
- console.info(i, ...n);
61
- break;
62
- case "warning":
63
- console.warn(i, ...n);
64
- break;
65
- case "error":
66
- console.error(i, ...n);
67
- break;
68
- }
69
- }, Ts = (s) => {
70
- const t = s.container || s;
71
- return {
72
- info: (e, ...n) => Wt(t, "info", e, ...n),
73
- warn: (e, ...n) => Wt(t, "warning", e, ...n),
74
- error: (e, ...n) => Wt(t, "error", e, ...n)
75
- };
76
- };
77
- var ct = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(ct || {}), R = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(R || {});
78
- const js = (s, t, e, n) => {
79
- try {
80
- const i = new t(e, n);
81
- return {
82
- name: s,
83
- invoke: (r, o) => {
84
- let a;
85
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
86
- },
87
- getInstance: () => i
88
- };
89
- } catch (i) {
90
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
91
- return {
92
- name: s,
93
- invoke: (r) => {
94
- let o;
95
- return r === "initialize" && (o = t(e, n)), Promise.resolve(o);
96
- },
97
- getInstance: () => t
98
- };
99
- throw i;
100
- }
101
- };
102
- function xe(s, t) {
103
- return typeof s == "undefined" ? t : s;
104
- }
105
- let Vs = class {
106
- constructor(s = {}) {
107
- this.part = s;
108
- }
109
- createCommand(s, t, e) {
110
- let n;
111
- typeof t == "function" ? n = {
112
- scope: ct.Widget,
113
- stage: R.Post,
114
- defaultArgs: void 0,
115
- handlerResolver: t
116
- } : n = {
117
- scope: xe(t.scope, ct.Widget),
118
- stage: xe(t.stage, R.Post),
119
- defaultArgs: t.defaultArgs,
120
- handlerResolver: e
121
- };
122
- let i = this.part;
123
- const r = s.split(".");
124
- return r.forEach((o, a) => {
125
- a === r.length - 1 ? i[o] || (i[o] = () => n) : i = this.part[o] = this.part[o] || {};
126
- }), this;
127
- }
128
- get() {
129
- return this.part;
130
- }
131
- };
132
- const Qe = (s) => {
133
- const t = new Vs({});
134
- return s(t), t.get();
135
- };
136
- Qe((s) => {
137
- s.createCommand(
138
- "types.register",
139
- { scope: ct.Implementation, stage: R.Pre },
140
- (t) => (e, n) => {
141
- t.container.get("$types")[e] = n;
142
- }
143
- ).createCommand(
144
- "type",
145
- { stage: R.Pre },
146
- (t) => (e) => {
147
- t.container.register("$type", e);
148
- }
149
- ).createCommand(
150
- "settings",
151
- { stage: R.Pre, defaultArgs: [null] },
152
- (t) => (e) => {
153
- t.events.dispatch(
154
- "settings:change",
155
- e,
156
- { bubbles: !0 }
157
- ), t.container.register("$settings", e);
158
- }
159
- ).createCommand(
160
- "plugin",
161
- { stage: R.Pre },
162
- (t) => (e, n, i) => {
163
- const { container: r } = t;
164
- let o = null, a = e, c = n;
165
- typeof e == "string" && (o = e, a = n, c = i);
166
- const h = (l) => {
167
- const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
168
- c || {},
169
- o,
170
- t.container,
171
- a
172
- ) : n;
173
- try {
174
- const p = js(
175
- o,
176
- a,
177
- r,
178
- u
179
- );
180
- r.get("$plugins").push(p), l && p.invoke("initialize", null);
181
- } catch (p) {
182
- Ts(t).warn("Error when initializing plugin", p);
183
- }
184
- };
185
- t.container.get("$instance") ? h(!0) : t.events.subscribeOnce("widget:instance-created", () => h(!1));
186
- }
187
- ).createCommand(
188
- "container.register",
189
- (t) => (e, n) => {
190
- t.container.register(e, n);
191
- }
192
- ).createCommand(
193
- "container.registerAsync",
194
- (t) => (e, n) => {
195
- t.container.registerAsync(e, n);
196
- }
197
- ).createCommand(
198
- "container.registerFactory",
199
- (t) => (e, n) => {
200
- t.container.registerFactory(e, n);
201
- }
202
- ).createCommand(
203
- "container.touch",
204
- (t) => (e, n) => {
205
- t.container.touch(e, n);
206
- }
207
- ).createCommand(
208
- "csp",
209
- {},
210
- (t) => (e) => {
211
- t.container.register("csp", e);
212
- }
213
- );
214
- });
215
- Qe((s) => {
216
- s.createCommand(
217
- "ready",
218
- { scope: ct.Implementation, stage: R.Pre },
219
- (t) => (e) => {
220
- const { container: n } = t, i = n.owner;
221
- n.get("bootstrapping").ready ? e(i) : i.events.subscribeOnce("bootstrap:ready", () => {
222
- e(i);
223
- });
224
- }
225
- );
226
- });
227
- const Bt = (s, t, e, ...n) => {
228
- const i = `[${s.get("$environment").name || "webprovisions"}] ${e}`;
229
- switch (t) {
230
- case "info":
231
- console.info(i, ...n);
232
- break;
233
- case "warning":
234
- console.warn(i, ...n);
235
- break;
236
- case "error":
237
- console.error(i, ...n);
238
- break;
239
- }
240
- }, Us = (s) => {
241
- const t = s.container || s;
242
- return {
243
- info: (e, ...n) => Bt(t, "info", e, ...n),
244
- warn: (e, ...n) => Bt(t, "warning", e, ...n),
245
- error: (e, ...n) => Bt(t, "error", e, ...n)
246
- };
247
- };
248
- var Et = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(Et || {}), z = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(z || {});
249
- const zs = (s, t, e, n) => {
250
- try {
251
- const i = new t(e, n);
252
- return {
253
- name: s,
254
- invoke: (r, o) => {
255
- let a;
256
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
257
- },
258
- getInstance: () => i
259
- };
260
- } catch (i) {
261
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
262
- return {
263
- name: s,
264
- invoke: (r) => {
265
- let o;
266
- return r === "initialize" && (o = t(e, n)), Promise.resolve(o);
267
- },
268
- getInstance: () => t
269
- };
270
- throw i;
271
- }
272
- };
273
- function Se(s, t) {
274
- return typeof s == "undefined" ? t : s;
275
- }
276
- class Hs {
277
- constructor(t = {}) {
278
- this.part = t;
279
- }
280
- createCommand(t, e, n) {
281
- let i;
282
- typeof e == "function" ? i = {
283
- scope: Et.Widget,
284
- stage: z.Post,
285
- defaultArgs: void 0,
286
- handlerResolver: e
287
- } : i = {
288
- scope: Se(e.scope, Et.Widget),
289
- stage: Se(e.stage, z.Post),
290
- defaultArgs: e.defaultArgs,
291
- handlerResolver: n
292
- };
293
- let r = this.part;
294
- const o = t.split(".");
295
- return o.forEach((a, c) => {
296
- c === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
297
- }), this;
298
- }
299
- get() {
300
- return this.part;
301
- }
302
- }
303
- const Xe = (s) => {
304
- const t = new Hs({});
305
- return s(t), t.get();
306
- };
307
- Xe((s) => {
308
- s.createCommand(
309
- "types.register",
310
- { scope: Et.Implementation, stage: z.Pre },
311
- (t) => (e, n) => {
312
- t.container.get("$types")[e] = n;
313
- }
314
- ).createCommand(
315
- "type",
316
- { stage: z.Pre },
317
- (t) => (e) => {
318
- t.container.register("$type", e);
319
- }
320
- ).createCommand(
321
- "settings",
322
- { stage: z.Pre, defaultArgs: [null] },
323
- (t) => (e) => {
324
- t.events.dispatch(
325
- "settings:change",
326
- e,
327
- { bubbles: !0 }
328
- ), t.container.register("$settings", e);
329
- }
330
- ).createCommand(
331
- "plugin",
332
- { stage: z.Pre },
333
- (t) => (e, n, i) => {
334
- const { container: r } = t;
335
- let o = null, a = e, c = n;
336
- typeof e == "string" && (o = e, a = n, c = i);
337
- const h = (l) => {
338
- const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
339
- c || {},
340
- o,
341
- t.container,
342
- a
343
- ) : n;
344
- try {
345
- const p = zs(
346
- o,
347
- a,
348
- r,
349
- u
350
- );
351
- r.get("$plugins").push(p), l && p.invoke("initialize", null);
352
- } catch (p) {
353
- Us(t).warn("Error when initializing plugin", p);
354
- }
355
- };
356
- t.container.get("$instance") ? h(!0) : t.events.subscribeOnce("widget:instance-created", () => h(!1));
357
- }
358
- ).createCommand(
359
- "container.register",
360
- (t) => (e, n) => {
361
- t.container.register(e, n);
362
- }
363
- ).createCommand(
364
- "container.registerAsync",
365
- (t) => (e, n) => {
366
- t.container.registerAsync(e, n);
367
- }
368
- ).createCommand(
369
- "container.registerFactory",
370
- (t) => (e, n) => {
371
- t.container.registerFactory(e, n);
372
- }
373
- ).createCommand(
374
- "container.touch",
375
- (t) => (e, n) => {
376
- t.container.touch(e, n);
377
- }
378
- ).createCommand(
379
- "csp",
380
- {},
381
- (t) => (e) => {
382
- t.container.register("csp", e);
383
- }
384
- );
385
- });
386
- const ts = (s) => {
387
- const t = [];
388
- return [
389
- (e, n) => {
390
- t.push(s.subscribe(e, n));
391
- },
392
- () => {
393
- t.forEach((e) => {
394
- e();
395
- });
396
- }
397
- ];
398
- };
399
- let tt = class {
400
- constructor(t, e = []) {
401
- this.platform = t, this.rules = e;
402
- }
403
- match(t) {
404
- return this.rules.every((e) => !(e.id && e.id !== t.id || e.type && e.type !== t.type));
405
- }
406
- ofType(t) {
407
- return this.rules.push({ type: t }), this;
408
- }
409
- withId(t) {
410
- return this.rules.push({ id: t }), this;
411
- }
412
- select() {
413
- return new Ws(this.platform, this);
414
- }
415
- };
416
- class pe {
417
- constructor(t, e, n) {
418
- this.platform = t, this.node = e, this.actions = new Mt(
419
- t,
420
- new tt(t).withId(e.id),
421
- n
422
- );
423
- const [i, r] = ts(
424
- this.platform.events
425
- );
426
- this.subscribe = i, this.unsubscribe = r;
427
- }
428
- properties(t) {
429
- return t && this.node.touchProperties((e) => t(e)), this.node.attributes.properties;
430
- }
431
- context(t) {
432
- return t && this.subscribe("components:context-changed", (e, { node: n }) => {
433
- n === this.node && t(this.node.attributes.context);
434
- }), this.node.attributes.context;
435
- }
436
- layout(t) {
437
- return t && this.subscribe("components:layout-changed", (e, { node: n }) => {
438
- n === this.node && t(this.node.attributes.layout);
439
- }), this.node.attributes.layout;
440
- }
441
- writeProperties(t, e) {
442
- this.node.writeProperties(t, e);
443
- }
444
- writeContext(t, e) {
445
- this.node.writeProperties(t, e);
446
- }
447
- writeLayout(t, e) {
448
- this.node.writeLayout(t, e);
449
- }
450
- dispose() {
451
- this.unsubscribe(), this.actions.dispose();
452
- }
453
- }
454
- class Ws {
455
- constructor(t, e, n = !0) {
456
- this.platform = t, this.target = e, this.clearOnDispose = n, this.removes = [], this.actions = new Mt(this.platform, this.target);
457
- }
458
- writeProperties(t, e) {
459
- this.removes.push(
460
- this.platform.write({
461
- options: e,
462
- attributes: { properties: t },
463
- target: this.target,
464
- removable: this.clearOnDispose
465
- })
466
- );
467
- }
468
- writeContext(t, e) {
469
- this.removes.push(
470
- this.platform.write({
471
- options: e,
472
- attributes: { context: t },
473
- target: this.target,
474
- removable: this.clearOnDispose
475
- })
476
- );
477
- }
478
- writeLayout(t, e) {
479
- this.removes.push(
480
- this.platform.write({
481
- options: e,
482
- attributes: { layout: t },
483
- target: this.target,
484
- removable: this.clearOnDispose
485
- })
486
- );
487
- }
488
- dispose() {
489
- this.removes.forEach((t) => {
490
- t();
491
- }), this.actions.dispose();
492
- }
493
- }
494
- const Bs = (s, t, e) => {
495
- const n = s.concat(), i = (r, o, a) => {
496
- let c = !0;
497
- if (n.length) {
498
- const h = n.shift(), l = (d, u) => (c = !1, i(d, Object.assign({}, o, u), a));
499
- return Promise.resolve(h(r, l, a)).then((d) => Is(Ls({}, d), {
500
- cancelled: c
501
- }));
502
- }
503
- return Promise.resolve({ data: r, cancelled: !1, options: o });
504
- };
505
- return i(t, {}, e);
506
- };
507
- class Mt {
508
- constructor(t, e, n) {
509
- this.platform = t, this.target = e, this.ns = n, this.subscriptions = [], this.create = this.create.bind(this);
510
- }
511
- create(t, e = () => {
512
- }) {
513
- const n = {
514
- key: t,
515
- fn: e,
516
- target: this.target,
517
- ns: this.ns
518
- };
519
- this.platform.actionsState.handlers.push(n);
520
- const i = () => {
521
- const r = this.platform.actionsState.handlers.indexOf(n);
522
- r > -1 && this.platform.actionsState.handlers.splice(r, 1);
523
- };
524
- return this.subscriptions.push(i), i;
525
- }
526
- dispatch(t, e) {
527
- const n = this.platform.nodes.all.concat(
528
- this.platform.nodes.detached
529
- ), i = {}, r = this.platform.actionsState.handlers.filter(
530
- (o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)
531
- );
532
- return Promise.all(
533
- r.map((o) => {
534
- const a = n.filter(
535
- (h) => o.target.match(h) && this.target.match(h)
536
- ), c = this.platform.actionsState.watchers.filter((h) => h.key === t && (!h.ns || !this.ns || h.ns === this.ns) && a.some((l) => h.target.match(l))).map((h) => h.fn);
537
- return Promise.all(
538
- a.map((h) => {
539
- const l = new pe(
540
- this.platform,
541
- h,
542
- this.ns
543
- );
544
- return Bs(c, e, l).then((d) => {
545
- const { data: u = {}, options: p, cancelled: _ } = d;
546
- return Promise.resolve(
547
- _ ? {} : o.fn(u, p, l)
548
- ).then((f) => {
549
- i[h.id] = f;
550
- });
551
- });
552
- })
553
- );
554
- })
555
- ).then(() => i);
556
- }
557
- watch(t, e) {
558
- let n = t, i = this.ns;
559
- const r = t.split(".");
560
- r.length > 1 && (i = r[0], n = r.splice(1).join("."));
561
- const o = {
562
- fn: e,
563
- target: this.target,
564
- key: n,
565
- ns: i
566
- };
567
- this.platform.actionsState.watchers.push(o);
568
- const a = () => {
569
- const c = this.platform.actionsState.watchers.indexOf(o);
570
- c > -1 && this.platform.actionsState.watchers.splice(c, 1);
571
- };
572
- return this.subscriptions.push(a), a;
573
- }
574
- dispose() {
575
- this.subscriptions.forEach((t) => t());
576
- }
577
- }
578
- Xe((s) => {
579
- s.createCommand("components", (t) => (e) => {
580
- t.events.subscribeOnce(
581
- "components:platform-created",
582
- (n, { platform: i }) => {
583
- e.handlers && e.handlers.forEach(([r, o]) => {
584
- i.addComponentHandler(r, o);
585
- });
586
- }
587
- );
588
- });
589
- });
590
- const Lt = (s, t, ...e) => typeof t == "string" ? s(`[humany] ${t}`, ...e) : s(t, ...e), rt = class {
591
- constructor() {
592
- this.keys = [], this.log = (t, ...e) => this.lookup(t, () => rt.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => rt.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => rt.error(...e)), this.info = (t, ...e) => this.lookup(t, () => rt.info(...e));
593
- }
594
- lookup(t, e) {
595
- this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
596
- }
597
- };
598
- let K = rt;
599
- K.log = (...s) => Lt(console.log, ...s);
600
- K.warn = (...s) => Lt(console.warn, ...s);
601
- K.error = (...s) => Lt(console.error, ...s);
602
- K.info = (...s) => Lt(console.info, ...s);
603
- const N = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
604
- function ge() {
605
- return N() + N() + "-" + N() + "-" + N() + "-" + N() + "-" + N() + N() + N();
606
- }
607
- class ae {
608
- constructor(t, e) {
609
- this.events = t, this.tags = [], this.children = {}, this.changesets = [], this.mountCount = 0, this.id = ge(), this.type = e, this.attributes = {
610
- context: {},
611
- properties: {},
612
- layout: {},
613
- tags: []
614
- }, this.writeLayout({ size: "full", indent: 0 });
615
- }
616
- mount(t, e) {
617
- let n = t.get("mounted-nodes");
618
- return n || (n = /* @__PURE__ */ new Map(), t.register("mounted-nodes", n)), n.has(this) ? (process.env.NODE_ENV !== "production" && K.error(
619
- "Trying to mount an already mounted component node.",
620
- this
621
- ), () => {
622
- }) : (this.events.dispatch("components:node-mounted", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch("components:node-enter", { node: this })), () => {
623
- n.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 });
624
- });
625
- }
626
- appendChild(t, e = "default") {
627
- if (t.parent) {
628
- if (t.parent === this)
629
- return;
630
- t.parent.removeChild(t);
631
- }
632
- t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].push(t), this.events.dispatch("components:node-appended", { node: t });
633
- }
634
- prependChild(t, e = "default") {
635
- if (t.parent) {
636
- if (t.parent === this)
637
- return;
638
- t.parent.removeChild(t);
639
- }
640
- t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].unshift(t), this.events.dispatch("components:node-appended", { node: t });
641
- }
642
- touchProperties(t, e = {}, n) {
643
- const i = [{ properties: t }, e];
644
- return this.changesets.push(i), this.events.dispatch("components:set-properties", { node: this }), () => {
645
- if (n) {
646
- const r = this.changesets.indexOf(i);
647
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
648
- }
649
- };
650
- }
651
- writeProperties(t, e = {}, n) {
652
- const i = [{ properties: t }, e];
653
- return this.changesets.push(i), this.events.dispatch("components:set-properties", { node: this }), () => {
654
- if (n) {
655
- const r = this.changesets.indexOf(i);
656
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
657
- }
658
- };
659
- }
660
- writeLayout(t, e = {}, n) {
661
- const i = [{ layout: t }, e];
662
- return this.changesets.push(i), this.events.dispatch("components:set-layout", { node: this }), () => {
663
- if (!n)
664
- return;
665
- const r = this.changesets.indexOf(i);
666
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-layout", { node: this }));
667
- };
668
- }
669
- writeContext(t, e = {}, n) {
670
- const i = [{ context: t }, e];
671
- return this.changesets.push(i), this.events.dispatch("components:set-context", { node: this }), () => {
672
- if (!n)
673
- return;
674
- const r = this.changesets.indexOf(i);
675
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-context", { node: this }));
676
- };
677
- }
678
- getChildren(t = "default") {
679
- const e = this.children[t] || [];
680
- return e.reduce((n, i, r) => {
681
- const { order: o = r } = i.attributes.layout;
682
- return n[o] ? n.splice(o, 0, i) : n[o] = i, n;
683
- }, Array(e.length));
684
- }
685
- remove() {
686
- this.parent && this.parent.removeChild(this);
687
- }
688
- removeChild(t) {
689
- Object.keys(this.children).forEach((e) => {
690
- const n = this.children[e], i = n.indexOf(t);
691
- i > -1 && (n.splice(i, 1), this.events.dispatch("components:node-removed", {
692
- node: t,
693
- parentNode: this
694
- }));
695
- }), delete t.parent;
696
- }
697
- }
698
- const es = (s, t, e) => {
699
- for (let n = 0, i = s.length; n < i && e(s[n]) !== !0; n++) {
700
- const r = t[s[n].id] || "default", o = s[n].getChildren(r);
701
- es(o, t, e);
702
- }
703
- }, It = (s, t, e) => {
704
- if (e(s) !== !0) {
705
- const n = t[s.id] || "default", i = s.children[n];
706
- es(i, t, e);
707
- }
708
- }, wt = (s, t) => {
709
- const e = [];
710
- return It(s, t, (n) => {
711
- e.push(n);
712
- }), e;
713
- }, ss = (s, t, e) => {
714
- let n;
715
- return It(s, t, (i) => {
716
- if (e(i))
717
- return n = i, !0;
718
- }), n;
719
- };
720
- class qs {
721
- constructor(t, e, n) {
722
- this.root = t, this.switches = e, this.all = [], this.visible = [], this.detached = [], n.subscribe(
723
- "components:node-appended",
724
- (i, r) => {
725
- this.all.push(r.node), this.visible = wt(t, e);
726
- }
727
- ), n.subscribe(
728
- "components:node-removed",
729
- (i, r) => {
730
- let o = this.all.indexOf(r.node);
731
- o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(r.node), o > -1 && this.visible.splice(o, 1), this.visible = wt(t, e);
732
- }
733
- ), n.subscribe(
734
- "components:node-switched",
735
- (i, r) => {
736
- this.visible = wt(t, e);
737
- }
738
- );
739
- }
740
- query(t = {}) {
741
- const e = [];
742
- return It(this.root, this.switches, (n) => {
743
- Object.keys(t).every((i) => t[i] === n[i]) && e.push(n);
744
- }), e;
745
- }
746
- get(t) {
747
- return ss(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
748
- }
749
- }
750
- class Js {
751
- constructor() {
752
- this.handlers = /* @__PURE__ */ new Map();
753
- }
754
- add(t, e) {
755
- this.handlers.set(t, e);
756
- }
757
- get(t) {
758
- return this.handlers.get(t);
759
- }
760
- }
761
- const Fs = (s) => {
762
- let t = s, e = 0;
763
- for (; t.parent; )
764
- e = e + 1, t = t.parent;
765
- return e;
766
- }, Ks = (s) => s.map(([t, e]) => [Fs(t), t, e]).sort(([t], [e]) => t - e).map(([, t, e]) => [t, e]), qt = (s) => s instanceof Date ? !1 : s && typeof s == "object" && !Array.isArray(s), P = (s, ...t) => {
767
- if (!t.length)
768
- return s;
769
- const e = t.shift();
770
- if (qt(s) && qt(e))
771
- for (const n in e)
772
- qt(e[n]) ? (s[n] || Object.assign(s, { [n]: {} }), P(s[n], e[n])) : Object.assign(s, { [n]: e[n] });
773
- return P(s, ...t);
774
- }, Gs = (s, t) => !s || s === "all" ? !0 : s.some((e) => t.indexOf(e) > -1), Ys = (s, t) => {
775
- let e = [], n = [], i;
776
- const r = () => {
777
- process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
778
- const a = /* @__PURE__ */ new Map(), c = Ks(e.map((l, d) => [l, n[d]])), h = (l, d) => {
779
- var u;
780
- const p = a.get(l) || {}, _ = d.context && !p.context, f = d.properties && !p.properties, C = d.layout && !p.layout;
781
- a.set(l, {
782
- context: p.context || _,
783
- properties: p.properties || f,
784
- layout: p.layout || C
785
- }), f && (l.attributes.properties = {}), C && (l.attributes.layout = {}), _ && (l.attributes.context = P({}, (u = l.parent) == null ? void 0 : u.attributes.context));
786
- const x = [], mt = [], zt = [];
787
- if (l.changesets.forEach((A) => {
788
- const [$, Ht] = A;
789
- Gs(Ht.breakpoints, s.breakpoints) && (f && (typeof $.properties == "function" ? x.push(
790
- $.properties
791
- ) : P(l.attributes.properties, $.properties)), C && (typeof $.layout == "function" ? mt.push($.layout) : P(l.attributes.layout, $.layout)), _ && (typeof $.context == "function" ? zt.push($.context) : P(l.attributes.context, $.context)));
792
- }), x.forEach((A) => {
793
- P(l.attributes.properties, A(l.attributes.properties));
794
- }), mt.forEach((A) => {
795
- P(l.attributes.layout, A(l.attributes.layout));
796
- }), zt.forEach((A) => {
797
- P(l.attributes.context, A(l.attributes.context));
798
- }), _ || d.recursive) {
799
- const A = s.getBranch(l), $ = d.recursive ? d : {
800
- context: !!_
801
- };
802
- l.getChildren(A).forEach((Ht) => {
803
- h(Ht, $);
804
- });
805
- }
806
- };
807
- process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"), c.forEach(([l, d]) => {
808
- h(l, d);
809
- }), e = [], n = [], t(a);
810
- }, o = () => {
811
- clearTimeout(i), i = setTimeout(r, 0);
812
- };
813
- return (a, c) => {
814
- const h = e.indexOf(a);
815
- if (h > -1) {
816
- const l = n[h];
817
- return c.context && (l.context = !0), c.properties && (l.properties = !0), c.layout && (l.layout = !0), c.recursive && (l.recursive = !0), o();
818
- }
819
- return e.push(a), n.push(c), o();
820
- };
821
- };
822
- class pt {
823
- constructor(t, e = {}) {
824
- this.providers = e, this.breakpoints = [], this.actionsState = { handlers: [], watchers: [] }, this.switches = {}, this.changesets = [], this.subscriptions = [], this.customComponentHandler = new Js(), this.events = t.events.createChild(this);
825
- const n = new ae(this.events, "root");
826
- n.name = `root-${t.name}`, this.nodes = new qs(n, this.switches, this.events);
827
- const i = this.processNode = Ys(
828
- this,
829
- (r) => {
830
- const o = Array.from(r.keys());
831
- process.env.NODE_ENV !== "production" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
832
- ${o.map(
833
- (a) => `${a.name || "<no name>"} (${a.id})
834
- `
835
- )}`), o.forEach((a) => {
836
- const c = r.get(a);
837
- 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 });
838
- }), this.events.dispatch(
839
- "components:component-model-initialized",
840
- {},
841
- { bubbles: !0 }
842
- );
843
- }
844
- );
845
- Promise.all(
846
- Object.keys(e).map((r) => e[r].load(this))
847
- ), this.subscriptions.push(
848
- this.events.subscribe(
849
- "components:node-appended",
850
- (r, o) => {
851
- const { node: a } = o;
852
- this.changesets.forEach((c) => {
853
- const { changeset: h, target: l, removes: d } = c, [u, p] = h;
854
- l.match(o.node) && (u.properties && d.push(a.writeProperties(u.properties, p)), u.context && d.push(a.writeContext(u.context, p)), u.layout && d.push(a.writeLayout(u.layout, p)));
855
- });
856
- }
857
- )
858
- ), this.subscriptions.push(
859
- this.events.subscribe(
860
- "components:node-appended",
861
- (r, o) => {
862
- i(o.node, { properties: !0, context: !0 });
863
- }
864
- )
865
- ), this.subscriptions.push(
866
- this.events.subscribe(
867
- "components:set-properties",
868
- (r, o) => {
869
- i(o.node, { properties: !0 });
870
- }
871
- )
872
- ), this.subscriptions.push(
873
- this.events.subscribe(
874
- "components:set-context",
875
- (r, o) => {
876
- i(o.node, { properties: !0, context: !0 });
877
- }
878
- )
879
- ), this.subscriptions.push(
880
- this.events.subscribe(
881
- "components:set-indent",
882
- (r, o) => {
883
- i(o.node, { layout: !0 });
884
- }
885
- )
886
- ), this.subscriptions.push(
887
- this.events.subscribe(
888
- "components:set-layout",
889
- (r, o) => {
890
- i(o.node, { layout: !0 });
891
- }
892
- )
893
- ), this.subscriptions.push(
894
- this.events.subscribe(
895
- "components:node-switched",
896
- (r, { node: o, branch: a }) => {
897
- i(o, {
898
- layout: !0,
899
- recursive: !0,
900
- properties: !0,
901
- context: !0
902
- });
903
- }
904
- )
905
- ), this.subscriptions.push(
906
- this.events.subscribe(
907
- "components:node-removed",
908
- (r, { parentNode: o }) => {
909
- i(o, { properties: !0 });
910
- }
911
- )
912
- ), this.events.parent && this.events.parent.dispatch("components:platform-created", {
913
- platform: this
914
- });
915
- }
916
- static getInstance(t) {
917
- return t.getAsync("components");
918
- }
919
- addBreakpoint(t) {
920
- this.breakpoints.indexOf(t) === -1 && (this.breakpoints.push(t), this.processNode(this.nodes.root, {
921
- context: !0,
922
- properties: !0,
923
- layout: !0,
924
- recursive: !0
925
- }));
926
- }
927
- removeBreakpoint(t) {
928
- const e = this.breakpoints.indexOf(t);
929
- e > -1 && (this.breakpoints.splice(e, 1), this.processNode(this.nodes.root, {
930
- context: !0,
931
- properties: !0,
932
- layout: !0,
933
- recursive: !0
934
- }));
935
- }
936
- setSwitch(t, e) {
937
- this.switches[t.id] = e, this.events.dispatch("components:node-switched", { node: t, branch: e });
938
- }
939
- getBranch(t) {
940
- return this.switches[t.id];
941
- }
942
- /**
943
- * Creates a `ComponentNode` of the specified type.
944
- * @param type Type of node.
945
- */
946
- createNode(t, e = {}) {
947
- const n = new ae(this.events, t);
948
- return e.detached && this.nodes.detached.push(n), n;
949
- }
950
- components() {
951
- return new tt(this);
952
- }
953
- actions(t, e) {
954
- return new Mt(this, t, e);
955
- }
956
- write(t) {
957
- const {
958
- provider: e,
959
- target: n,
960
- attributes: i,
961
- options: r = {},
962
- removable: o
963
- } = t, a = t.key || ge(), c = { changeset: [i, r], target: n, removes: [] };
964
- if (e) {
965
- const h = this.providers[e];
966
- h.write(a, n, i, r), c.removes.push(() => {
967
- h.remove(a);
968
- });
969
- }
970
- return this.changesets.push(c), this.nodes.all.forEach((h) => {
971
- if (n.match(h)) {
972
- let l = () => {
973
- };
974
- i.properties && (l = h.writeProperties(
975
- i.properties,
976
- r,
977
- o
978
- )), i.context && (l = h.writeContext(i.context, r, o)), i.layout && (l = h.writeContext(i.layout, r, o)), c.removes.push(l);
979
- }
980
- }), () => {
981
- if (o) {
982
- c.removes.forEach((l) => l());
983
- const h = this.changesets.indexOf(c);
984
- h > -1 && this.changesets.splice(h, 1);
985
- }
986
- };
987
- }
988
- addComponentHandler(t, e) {
989
- this.customComponentHandler.add(t, e);
990
- }
991
- getComponentHandler(t) {
992
- return this.customComponentHandler.get(t);
993
- }
994
- dispose() {
995
- this.subscriptions.forEach((t) => t());
996
- }
997
- }
998
- const Zs = (s) => {
999
- if (Array.isArray(s)) {
1000
- const [t, ...e] = s;
1001
- return {
1002
- definitionId: t,
1003
- overrides: e
1004
- };
1005
- }
1006
- return {
1007
- definitionId: s,
1008
- overrides: []
1009
- };
1010
- }, At = (s, t, e, n, i, r) => {
1011
- e.forEach((o) => {
1012
- const a = Zs(o), c = n[a.definitionId];
1013
- if (a.definitionId === "view") {
1014
- const h = s.createNode("view");
1015
- h.name = "view", Object.keys(i).forEach((l) => {
1016
- const d = i[l];
1017
- At(s, h, [d.entry], n, i, l);
1018
- }), t.appendChild(h), a.overrides.forEach((l) => {
1019
- l.properties && h.writeProperties(l.properties, {
1020
- breakpoints: l.breakpoints
1021
- }), l.context && h.writeContext(l.context, { breakpoints: l.breakpoints }), l.layout && h.writeLayout(l.layout, { breakpoints: l.breakpoints });
1022
- });
1023
- } else if (s.getComponentHandler(c.type)) {
1024
- const h = s.getComponentHandler(c.type);
1025
- h && h(a, {
1026
- platform: s,
1027
- node: t,
1028
- references: e,
1029
- definitions: n,
1030
- views: i,
1031
- branch: r
1032
- });
1033
- } else {
1034
- const h = n[a.definitionId];
1035
- if (process.env.NODE_ENV !== "production" && !h) {
1036
- K.error(
1037
- `No definition found for component type '${a.definitionId}'.`
1038
- );
1039
- return;
1040
- }
1041
- const l = s.createNode(h.type);
1042
- l.name = a.definitionId, l.tags = h.tags || [], h.properties && l.writeProperties(h.properties), h.context && l.writeContext(h.context), h.layout && l.writeLayout(h.layout), t.appendChild(l, r), a.overrides.forEach((d) => {
1043
- const u = { breakpoints: d.breakpoints };
1044
- d.properties && l.writeProperties(d.properties, u), d.context && l.writeContext(d.context, u), d.layout && l.writeLayout(d.layout, u);
1045
- }), h.children && At(s, l, h.children, n, i);
1046
- }
1047
- });
1048
- }, ns = (s, t) => {
1049
- const { entry: e, components: n, breakpoints: i, views: r } = t, o = [];
1050
- return Object.keys(i).forEach((a) => {
1051
- const c = i[a], h = window.matchMedia(c);
1052
- h.matches && s.breakpoints.push(a);
1053
- const l = (d) => {
1054
- d.matches ? s.addBreakpoint(a) : s.removeBreakpoint(a);
1055
- };
1056
- h.addListener(l), o.push(() => h.removeListener(l));
1057
- }), At(s, s.nodes.root, [e], n, r), () => o.forEach((a) => {
1058
- a();
1059
- });
1060
- }, ce = (s, t) => ({
1061
- id: s.id,
1062
- type: s.type,
1063
- name: s.name,
1064
- branch: t || "default"
1065
- }), is = (s, t, e, n = ge(), i = {}) => s.getAsync("components").then((r) => {
1066
- let o;
1067
- if (typeof t == "string") {
1068
- const h = new tt(r);
1069
- h.ofType(t), o = h;
1070
- } else
1071
- o = t;
1072
- const a = {}, c = (h) => {
1073
- const l = a[h.id];
1074
- return l ? Promise.resolve(l.controller) : pt.getInstance(s).then((d) => new pe(d, h, n));
1075
- };
1076
- r.events.subscribe(
1077
- "components:node-enter",
1078
- (h, { node: l }) => {
1079
- o.match(l) && c(l).then((d) => {
1080
- Promise.resolve(e(d)).then((u) => {
1081
- a[l.id] = {
1082
- dispose: u,
1083
- controller: d
1084
- };
1085
- });
1086
- });
1087
- }
1088
- ), r.events.subscribe(
1089
- "components:node-exit",
1090
- (h, { node: l }) => {
1091
- const d = a[l.id];
1092
- d && (d.dispose && d.dispose(), i.reuseController || (d.controller.dispose(), delete a[l.id]));
1093
- }
1094
- );
1095
- });
1096
- class Qs {
1097
- constructor(t) {
1098
- this.aliases = /* @__PURE__ */ new Map(), this.components = /* @__PURE__ */ new Map(), this.logger = new K();
1099
- const { events: e } = t.get("$widget");
1100
- this.events = e;
1101
- }
1102
- getComponent(t) {
1103
- const e = this.aliases.get(t), n = this.components.get(e || t) || null;
1104
- return process.env.NODE_ENV !== "production" && (n || this.logger.warn(
1105
- e || t,
1106
- `Unable to resolve component: "${e || t}". You most likely forgot to register the required plugin for: ${e || t}.`
1107
- )), n;
1108
- }
1109
- registerComponent(t, e) {
1110
- return this.components.set(t, e), this.events.dispatch("component-resolver:resolve", t), () => {
1111
- this.components.delete(t);
1112
- };
1113
- }
1114
- registerResolver(t, e) {
1115
- return this.events.subscribe(
1116
- "component-resolver:resolve",
1117
- (n, i) => {
1118
- if (i === t) {
1119
- const r = this.getComponent(t);
1120
- e(r);
1121
- }
1122
- }
1123
- );
1124
- }
1125
- registerAlias(t, e) {
1126
- return this.aliases.set(t, e), this.events.dispatch("component-resolver:resolve", t), () => {
1127
- this.aliases.delete(t);
1128
- };
1129
- }
1130
- }
1131
- var E = /* @__PURE__ */ ((s) => (s.open = "open", s.closed = "closed", s.hidden = "hidden", s))(E || {});
1132
- const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1133
- __proto__: null,
1134
- ActionResolver: Rs,
1135
- ActionsController: Mt,
1136
- ComponentNode: ae,
1137
- ComponentNodeController: pe,
1138
- ComponentPlatform: pt,
1139
- ComponentQuery: tt,
1140
- ComponentResolver: Qs,
1141
- WidgetRenderState: E,
1142
- asDescriptor: ce,
1143
- createChildren: At,
1144
- createComponentModel: ns,
1145
- createEventSubscriber: ts,
1146
- extendComponent: is,
1147
- findComponent: ss,
1148
- findVisibleComponents: wt,
1149
- traverseComponents: It
1150
- }, Symbol.toStringTag, { value: "Module" })), Rt = (s, t, ...e) => typeof t == "string" ? s(`[humany] ${t}`, ...e) : s(t, ...e), ot = class {
1151
- constructor() {
1152
- this.keys = [], this.log = (t, ...e) => this.lookup(t, () => ot.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => ot.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => ot.error(...e)), this.info = (t, ...e) => this.lookup(t, () => ot.info(...e));
1153
- }
1154
- lookup(t, e) {
1155
- this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
1156
- }
1157
- };
1158
- let w = ot;
1159
- w.log = (...s) => Rt(console.log, ...s);
1160
- w.warn = (...s) => Rt(console.warn, ...s);
1161
- w.error = (...s) => Rt(console.error, ...s);
1162
- w.info = (...s) => Rt(console.info, ...s);
1163
- const rs = (s) => {
1164
- let t = {}, e, n;
1165
- if (typeof s != "object" || s === null)
1166
- return s;
1167
- t = Array.isArray(s) ? [] : {};
1168
- for (n in s)
1169
- e = s[n], t[n] = typeof e == "object" && e !== null ? rs(e) : e;
1170
- return t;
1171
- }, Xs = rs;
1172
- function Pe(s) {
1173
- let t = 0;
1174
- if (s.length === 0)
1175
- return t.toString();
1176
- for (let e = 0; e < s.length; e++) {
1177
- const n = s.charCodeAt(e);
1178
- t = (t << 5) - t + n, t = t & t;
1179
- }
1180
- return t.toString();
1181
- }
1182
- let tn = class {
1183
- constructor(t, e) {
1184
- this.lockWarningTime = t, this.lockErrorTime = e, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
1185
- }
1186
- add(t, e, n, i) {
1187
- this.tasks.push({ task: t, resolve: e, reject: n, done: i }), this.next();
1188
- }
1189
- next() {
1190
- this.current = this.current.then(() => {
1191
- const t = this.tasks.shift();
1192
- if (t) {
1193
- let e;
1194
- const n = setTimeout(() => {
1195
- process.env.NODE_ENV !== "production" && w.warn(
1196
- `A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
1197
- t
1198
- ), e = setTimeout(() => {
1199
- t.reject("lock timeout exceeded");
1200
- }, this.lockErrorTime);
1201
- }, this.lockWarningTime), i = Promise.resolve(t.task()).then((r) => (clearTimeout(n), clearTimeout(e), r));
1202
- return Promise.resolve(i).then(this.next).then(
1203
- () => i.then((r) => {
1204
- t.done(), t.resolve(r);
1205
- })
1206
- ).catch((r) => (t.done(), t.reject(r), this.next()));
1207
- }
1208
- return Promise.resolve();
1209
- });
1210
- }
1211
- };
1212
- const ft = /* @__PURE__ */ new WeakMap();
1213
- function O(s, t = 5e3, e = 1e3) {
1214
- return ft.has(s) || ft.set(s, new tn(t, e)), (n) => new Promise((i, r) => {
1215
- const o = ft.get(s);
1216
- o.add(n, i, r, () => {
1217
- o.tasks.length || ft.delete(s);
1218
- });
1219
- });
1220
- }
1221
- const en = (s, t) => {
1222
- const e = () => t.querySelectorAll("[data-loading=true]").length > 0, n = (() => {
1223
- let i = !1;
1224
- return () => {
1225
- i || (s.get("$widget").events.dispatch("widget:data-loaded", {
1226
- element: t
1227
- }), i = !0);
1228
- };
1229
- })();
1230
- if (!e())
1231
- return n();
1232
- new MutationObserver((i, r) => {
1233
- i.find(
1234
- (o) => o.type === "attributes" && o.attributeName === "data-loading"
1235
- ) && !e() && (r.disconnect(), n());
1236
- }).observe(t, {
1237
- attributes: !0,
1238
- childList: !0,
1239
- subtree: !0
1240
- });
1241
- }, sn = (s, t) => {
1242
- s.get("$widget").container.getAsync("components").then((e) => {
1243
- e.events.subscribeOnce("components:component-model-initialized", () => {
1244
- let n = e.nodes.visible.reduce(
1245
- (r, o) => (!o.name || !o.type || o.type === "view" || o.type === "root" || o.attributes.layout.size === "none" || t.querySelector(`[data-name="${o.name}"]`) || r.push(o.name), r),
1246
- []
1247
- ), i = !1;
1248
- new MutationObserver((r, o) => {
1249
- r.forEach((a) => {
1250
- if (a.addedNodes) {
1251
- const c = Array.from(
1252
- a.addedNodes
1253
- ).reduce((h, l) => {
1254
- const d = l.getAttribute && l.getAttribute("data-name");
1255
- return d && n.indexOf(d) > -1 && h.push(d), h;
1256
- }, []);
1257
- n = n.filter((h) => c.indexOf(h) === -1), !i && n.length === 0 && (i = !0, en(s, t), o.disconnect());
1258
- }
1259
- });
1260
- }).observe(t, {
1261
- attributes: !1,
1262
- characterData: !1,
1263
- childList: !0,
1264
- subtree: !0,
1265
- attributeOldValue: !1,
1266
- characterDataOldValue: !1
1267
- });
1268
- });
1269
- });
1270
- }, nn = sn, D = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
1271
- function os() {
1272
- return D() + D() + "-" + D() + "-" + D() + "-" + D() + "-" + D() + D() + D();
1273
- }
1274
- var rn = Object.defineProperty, ke = Object.getOwnPropertySymbols, on = Object.prototype.hasOwnProperty, an = Object.prototype.propertyIsEnumerable, Ne = (s, t, e) => t in s ? rn(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, G = (s, t) => {
1275
- for (var e in t || (t = {}))
1276
- on.call(t, e) && Ne(s, e, t[e]);
1277
- if (ke)
1278
- for (var e of ke(t))
1279
- an.call(t, e) && Ne(s, e, t[e]);
1280
- return s;
1281
- }, vt = (s, t, e) => new Promise((n, i) => {
1282
- var r = (c) => {
1283
- try {
1284
- a(e.next(c));
1285
- } catch (h) {
1286
- i(h);
1287
- }
1288
- }, o = (c) => {
1289
- try {
1290
- a(e.throw(c));
1291
- } catch (h) {
1292
- i(h);
1293
- }
1294
- }, a = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(r, o);
1295
- a((e = e.apply(s, t)).next());
1296
- }), m = /* @__PURE__ */ ((s) => (s.Cookie = "cookie", s.Local = "local", s.Session = "session", s))(m || {}), et = /* @__PURE__ */ ((s) => (s.Tenant = "tenant", s.Implementation = "implementation", s.Widget = "widget", s))(et || {}), g = /* @__PURE__ */ ((s) => (s.Necessary = "necessary", s.Functional = "functional", s.Analytical = "analytical", s.Marketing = "marketing", s))(g || {});
1297
- const M = (s, t, e, n = {}) => De(s, e).then((i) => (process.env.NODE_ENV !== "production" && i && w.warn(
1298
- `createStorageWriter: Attempted to create storage writer using unallowed category.
1299
- Key: ${t}
1300
- Category: ${JSON.stringify(e)}
1301
- Options: ${JSON.stringify(n)}`
1302
- ), (r) => (ye(s), De(s, e).then((o) => {
1303
- if (o) {
1304
- process.env.NODE_ENV !== "production" && w.warn(
1305
- `storageWriter: Attempted to write to storage using unallowed category.
1306
- Key: ${t}
1307
- Category: ${JSON.stringify(e)}
1308
- Value: ${JSON.stringify(r)}
1309
- Options: ${JSON.stringify(n)}`
1310
- );
1311
- return;
1312
- }
1313
- const {
1314
- scope: a = et.Widget,
1315
- medium: c = m.Session,
1316
- duration: h
1317
- } = n, l = hn();
1318
- return l[a][t] = ve(r, e, h), c === m.Cookie ? pn(s, l) : mn(s, c, l);
1319
- })))), k = (s, t, e = m.Session) => (ye(s), typeof t == "undefined" ? (process.env.NODE_ENV !== "production" && w.warn("readStorage: Undefined key passed when reading storage. ", t, e), Promise.resolve(void 0)) : e === m.Cookie ? un(s).then((n) => xt(n, t)) : gn(s, e).then((n) => xt(n, t))), Z = (s) => !!Object.entries(s).filter(([t, e]) => typeof e != "undefined").length, Jt = (s) => Object.entries(s).filter(([t, e]) => typeof e != "undefined").forEach(([t, { value: e }]) => {
1320
- typeof e == "undefined" && delete s[t];
1321
- }), as = (s, t) => {
1322
- const e = {
1323
- tenant: G(G({}, s.tenant), t.tenant),
1324
- implementation: G(G({}, s.implementation), t.implementation),
1325
- widget: G(G({}, s.widget), t.widget)
1326
- };
1327
- return Jt(e.tenant), Jt(e.implementation), Jt(e.widget), e;
1328
- }, cn = (s) => Object.entries(s).reduce((t, e) => {
1329
- const [n, i] = e;
1330
- return Object.entries(i).forEach((r) => {
1331
- const [o, { expiration: a }] = r;
1332
- a && t.push(a);
1333
- }), t;
1334
- }, []).slice().sort((t, e) => new Date(e).valueOf() - new Date(t).valueOf()).shift() || jt(), Tt = (s) => {
1335
- const {
1336
- name: t,
1337
- implementation: { name: e, tenant: n }
1338
- } = s.get("$widget");
1339
- return [
1340
- `humany_${n}`,
1341
- `humany_${Pe(n + e)}`,
1342
- `humany_${Pe(n + e + t)}`
1343
- ];
1344
- }, Ft = (s) => {
1345
- const t = new RegExp(`(?:^|;)\\s?${s}=(.*?)(?:;|$)`, "i"), e = document.cookie.match(t);
1346
- return e && e[1] && JSON.parse(e[1]) || void 0;
1347
- }, Kt = (s, t, e) => {
1348
- const n = `${s}=${JSON.stringify(t).trim()}`, i = `expires=${new Date(e).toUTCString()}`, r = "path=/", o = "SameSite=None;Secure";
1349
- return document.cookie = `${n}; ${i}; ${r}; ${o}`;
1350
- }, fe = (s) => {
1351
- const [t, e, n] = Tt(s), i = Ft(t) || {}, r = Ft(e) || {}, o = Ft(n) || {};
1352
- return {
1353
- tenant: i,
1354
- implementation: r,
1355
- widget: o
1356
- };
1357
- }, cs = (s, t) => {
1358
- const e = fe(s), n = as(e, t), [i, r, o] = Tt(s), { tenant: a, implementation: c, widget: h } = n, l = cn(t), d = jt({ days: -1 });
1359
- Kt(i, a, Z(a) ? l : d), Kt(
1360
- r,
1361
- c,
1362
- Z(c) ? l : d
1363
- ), Kt(o, h, Z(h) ? l : d);
1364
- }, Ot = (s, t) => {
1365
- const [e, n, i] = Tt(s), r = t.getItem(e) || "{}", o = t.getItem(n) || "{}", a = t.getItem(i) || "{}";
1366
- return {
1367
- tenant: JSON.parse(r),
1368
- implementation: JSON.parse(o),
1369
- widget: JSON.parse(a)
1370
- };
1371
- }, he = (s, t, e) => {
1372
- const n = Ot(s, t), i = as(n, e), [r, o, a] = Tt(s), { tenant: c, implementation: h, widget: l } = i;
1373
- Z(c) ? t.setItem(r, JSON.stringify(c)) : t.removeItem(r), Z(h) ? t.setItem(o, JSON.stringify(h)) : t.removeItem(o), Z(l) ? t.setItem(a, JSON.stringify(l)) : t.removeItem(a);
1374
- }, hn = () => ({ tenant: {}, implementation: {}, widget: {} }), ln = (s) => s ? !!s && /* @__PURE__ */ new Date() > new Date(s) : !1, xt = (s, t) => {
1375
- const e = s.widget[t] || s.implementation[t] || s.tenant[t];
1376
- return e == null ? void 0 : e.value;
1377
- }, ve = (s, t, e) => e ? {
1378
- value: s,
1379
- category: t,
1380
- expiration: typeof e == "object" ? jt(e) : e
1381
- } : {
1382
- value: s,
1383
- category: t
1384
- }, $t = (s, t) => {
1385
- const e = Xs(s);
1386
- return Object.entries(e).forEach(([n, i]) => {
1387
- Object.entries(i).forEach(([r, o]) => {
1388
- const { expiration: a, category: c } = o;
1389
- (ln(a) || dn(t, c)) && (i[r] = ve(void 0, c, a));
1390
- });
1391
- }), e;
1392
- }, De = (s, t) => k(s, "storagePolicy", m.Cookie).then(
1393
- (e = [g.Necessary]) => !!t && e.indexOf(t) === -1
1394
- ), dn = (s = [g.Necessary], t) => !!t && s.indexOf(t) === -1, ye = (s) => {
1395
- const t = fe(s), e = Ot(s, window.localStorage), n = Ot(s, sessionStorage), i = xt(t, "storagePolicy"), [r, o, a] = [
1396
- t,
1397
- e,
1398
- n
1399
- ].map((c) => $t(c, i));
1400
- cs(s, r), he(s, window.localStorage, o), he(s, window.sessionStorage, a);
1401
- }, jt = (s = { days: 30 }) => {
1402
- const { days: t = 0, hours: e = 0, minutes: n = 0, seconds: i = 0 } = s, r = /* @__PURE__ */ new Date();
1403
- return r.setTime(r.getTime() + e * 60 * 60 * 1e3), r.setTime(r.getTime() + t * 24 * 60 * 60 * 1e3), r.setTime(r.getTime() + n * 60 * 1e3), r.setTime(r.getTime() + i * 1e3), r.toISOString();
1404
- }, un = (s) => O(document)(() => fe(s)), pn = (s, t) => O(document)(() => cs(s, t)), gn = (s, t) => {
1405
- const e = t === m.Local ? window.localStorage : window.sessionStorage;
1406
- return O(e)(() => Ot(s, e));
1407
- }, mn = (s, t, e) => {
1408
- const n = t === m.Local ? window.localStorage : window.sessionStorage;
1409
- return O(n)(() => he(s, n, e));
1410
- };
1411
- let _t = class {
1412
- constructor() {
1413
- this.memory = {
1414
- tenant: {},
1415
- implementation: {},
1416
- widget: {}
1417
- };
1418
- }
1419
- setItem(t, e) {
1420
- return vt(this, arguments, function* (n, i, r = {}) {
1421
- return O(this)(() => {
1422
- const o = $t(this.memory, [g.Necessary]), { scope: a = et.Tenant, expiration: c } = r;
1423
- o[a][n] = ve(
1424
- i,
1425
- g.Necessary,
1426
- (c == null ? void 0 : c.toISOString()) || jt()
1427
- ), this.memory = o, process.env.NODE_ENV !== "production" && w.warn(
1428
- `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.
1429
- Key: ${n}
1430
- Value: ${JSON.stringify(i)}
1431
- Options: ${JSON.stringify(r)}
1432
- Memory: ${JSON.stringify(o)}`
1433
- );
1434
- });
1435
- });
1436
- }
1437
- getItem(t) {
1438
- return vt(this, null, function* () {
1439
- return O(this)(() => {
1440
- const e = $t(this.memory, [g.Necessary]);
1441
- process.env.NODE_ENV !== "production" && w.warn(
1442
- `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.
1443
- Key: ${t}
1444
- Memory: ${JSON.stringify(e)}`
1445
- );
1446
- const n = xt(e, t);
1447
- return this.memory = e, n;
1448
- });
1449
- });
1450
- }
1451
- removeItem(t) {
1452
- return vt(this, null, function* () {
1453
- return O(this)(() => {
1454
- const e = $t(this.memory, [g.Necessary]);
1455
- delete e.tenant[t], delete e.implementation[t], delete e.widget[t], this.memory = e, process.env.NODE_ENV !== "production" && w.warn(
1456
- `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.
1457
- Key: ${t}
1458
- Memory: ${JSON.stringify(e)}`
1459
- );
1460
- });
1461
- });
1462
- }
1463
- clear() {
1464
- return vt(this, null, function* () {
1465
- return Promise.resolve();
1466
- });
1467
- }
1468
- };
1469
- class fn {
1470
- constructor() {
1471
- this.cookies = new _t(), this.session = new _t(), this.local = new _t();
1472
- }
1473
- }
1474
- const Gt = (s, t, e, ...n) => {
1475
- const i = `[${s.get("$environment").name || "webprovisions"}] ${e}`;
1476
- switch (t) {
1477
- case "info":
1478
- console.info(i, ...n);
1479
- break;
1480
- case "warning":
1481
- console.warn(i, ...n);
1482
- break;
1483
- case "error":
1484
- console.error(i, ...n);
1485
- break;
1486
- }
1487
- }, vn = (s) => {
1488
- const t = s.container || s;
1489
- return {
1490
- info: (e, ...n) => Gt(t, "info", e, ...n),
1491
- warn: (e, ...n) => Gt(t, "warning", e, ...n),
1492
- error: (e, ...n) => Gt(t, "error", e, ...n)
1493
- };
1494
- };
1495
- var St = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(St || {}), H = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(H || {});
1496
- const yn = (s, t, e, n) => {
1497
- try {
1498
- const i = new t(e, n);
1499
- return {
1500
- name: s,
1501
- invoke: (r, o) => {
1502
- let a;
1503
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
1504
- },
1505
- getInstance: () => i
1506
- };
1507
- } catch (i) {
1508
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
1509
- return {
1510
- name: s,
1511
- invoke: (r) => {
1512
- let o;
1513
- return r === "initialize" && (o = t(e, n)), Promise.resolve(o);
1514
- },
1515
- getInstance: () => t
1516
- };
1517
- throw i;
1518
- }
1519
- };
1520
- function Me(s, t) {
1521
- return typeof s == "undefined" ? t : s;
1522
- }
1523
- class bn {
1524
- constructor(t = {}) {
1525
- this.part = t;
1526
- }
1527
- createCommand(t, e, n) {
1528
- let i;
1529
- typeof e == "function" ? i = {
1530
- scope: St.Widget,
1531
- stage: H.Post,
1532
- defaultArgs: void 0,
1533
- handlerResolver: e
1534
- } : i = {
1535
- scope: Me(e.scope, St.Widget),
1536
- stage: Me(e.stage, H.Post),
1537
- defaultArgs: e.defaultArgs,
1538
- handlerResolver: n
1539
- };
1540
- let r = this.part;
1541
- const o = t.split(".");
1542
- return o.forEach((a, c) => {
1543
- c === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
1544
- }), this;
1545
- }
1546
- get() {
1547
- return this.part;
1548
- }
1549
- }
1550
- const hs = (s) => {
1551
- const t = new bn({});
1552
- return s(t), t.get();
1553
- };
1554
- hs((s) => {
1555
- s.createCommand(
1556
- "types.register",
1557
- { scope: St.Implementation, stage: H.Pre },
1558
- (t) => (e, n) => {
1559
- t.container.get("$types")[e] = n;
1560
- }
1561
- ).createCommand(
1562
- "type",
1563
- { stage: H.Pre },
1564
- (t) => (e) => {
1565
- t.container.register("$type", e);
1566
- }
1567
- ).createCommand(
1568
- "settings",
1569
- { stage: H.Pre, defaultArgs: [null] },
1570
- (t) => (e) => {
1571
- t.events.dispatch(
1572
- "settings:change",
1573
- e,
1574
- { bubbles: !0 }
1575
- ), t.container.register("$settings", e);
1576
- }
1577
- ).createCommand(
1578
- "plugin",
1579
- { stage: H.Pre },
1580
- (t) => (e, n, i) => {
1581
- const { container: r } = t;
1582
- let o = null, a = e, c = n;
1583
- typeof e == "string" && (o = e, a = n, c = i);
1584
- const h = (l) => {
1585
- const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
1586
- c || {},
1587
- o,
1588
- t.container,
1589
- a
1590
- ) : n;
1591
- try {
1592
- const p = yn(
1593
- o,
1594
- a,
1595
- r,
1596
- u
1597
- );
1598
- r.get("$plugins").push(p), l && p.invoke("initialize", null);
1599
- } catch (p) {
1600
- vn(t).warn("Error when initializing plugin", p);
1601
- }
1602
- };
1603
- t.container.get("$instance") ? h(!0) : t.events.subscribeOnce("widget:instance-created", () => h(!1));
1604
- }
1605
- ).createCommand(
1606
- "container.register",
1607
- (t) => (e, n) => {
1608
- t.container.register(e, n);
1609
- }
1610
- ).createCommand(
1611
- "container.registerAsync",
1612
- (t) => (e, n) => {
1613
- t.container.registerAsync(e, n);
1614
- }
1615
- ).createCommand(
1616
- "container.registerFactory",
1617
- (t) => (e, n) => {
1618
- t.container.registerFactory(e, n);
1619
- }
1620
- ).createCommand(
1621
- "container.touch",
1622
- (t) => (e, n) => {
1623
- t.container.touch(e, n);
1624
- }
1625
- ).createCommand(
1626
- "csp",
1627
- {},
1628
- (t) => (e) => {
1629
- t.container.register("csp", e);
1630
- }
1631
- );
1632
- });
1633
- hs((s) => {
1634
- s.createCommand("storage", (t) => (e = {}) => {
1635
- const { consent: n } = e;
1636
- if (typeof n != "undefined") {
1637
- if (typeof n != "number" && typeof n != "string" && !Array.isArray(n)) {
1638
- process.env.NODE_ENV !== "production" && w.warn(
1639
- `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
1640
- Passed consent: ${JSON.stringify(n)}`
1641
- );
1642
- return;
1643
- }
1644
- if (Array.isArray(n) && !n.every(
1645
- (r) => typeof r == "number" || typeof r == "string"
1646
- )) {
1647
- process.env.NODE_ENV !== "production" && w.warn(
1648
- `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
1649
- Passed consent: ${JSON.stringify(n)}`
1650
- );
1651
- return;
1652
- }
1653
- const i = [
1654
- g.Necessary,
1655
- g.Functional,
1656
- g.Analytical,
1657
- g.Marketing
1658
- ].filter((r, o, a) => typeof n == "number" ? n > o : typeof n == "string" ? a.indexOf(n) + 1 > o : Array.isArray(n) ? n.findIndex((c) => c === o + 1 || c === r) > -1 : !0);
1659
- return i.indexOf(g.Necessary) === -1 && (process.env.NODE_ENV !== "production" && w.warn(
1660
- `storagePolicyConfigurationApi: passed consent does not include category: '${g.Necessary}'. Consent has to atleast include the '${g.Necessary}' category.
1661
- Passed consent: ${JSON.stringify(n)}`
1662
- ), i.unshift(g.Necessary)), M(
1663
- t.container,
1664
- "storagePolicy",
1665
- g.Necessary,
1666
- {
1667
- medium: m.Cookie,
1668
- scope: et.Tenant,
1669
- duration: { days: 365 }
1670
- }
1671
- ).then((r) => r(i)).then(() => {
1672
- ye(t.container), t.events.dispatch("storage:policy-changed", i);
1673
- });
1674
- }
1675
- });
1676
- });
1677
- const wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1678
- __proto__: null,
1679
- StorageCategory: g,
1680
- StorageMedium: m,
1681
- StorageProvider: fn,
1682
- StorageScope: et,
1683
- StorageService: _t,
1684
- createStorageWriter: M,
1685
- readStorage: k
1686
- }, Symbol.toStringTag, { value: "Module" })), Yt = (s, t, e, ...n) => {
1687
- const i = `[${s.get("$environment").name || "webprovisions"}] ${e}`;
1688
- switch (t) {
1689
- case "info":
1690
- console.info(i, ...n);
1691
- break;
1692
- case "warning":
1693
- console.warn(i, ...n);
1694
- break;
1695
- case "error":
1696
- console.error(i, ...n);
1697
- break;
1698
- }
1699
- }, $n = (s) => {
1700
- const t = s.container || s;
1701
- return {
1702
- info: (e, ...n) => Yt(t, "info", e, ...n),
1703
- warn: (e, ...n) => Yt(t, "warning", e, ...n),
1704
- error: (e, ...n) => Yt(t, "error", e, ...n)
1705
- };
1706
- };
1707
- var ht = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(ht || {}), T = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(T || {});
1708
- const _n = (s, t, e, n) => {
1709
- try {
1710
- const i = new t(e, n);
1711
- return {
1712
- name: s,
1713
- invoke: (r, o) => {
1714
- let a;
1715
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
1716
- },
1717
- getInstance: () => i
1718
- };
1719
- } catch (i) {
1720
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
1721
- return {
1722
- name: s,
1723
- invoke: (r) => {
1724
- let o;
1725
- return r === "initialize" && (o = t(e, n)), Promise.resolve(o);
1726
- },
1727
- getInstance: () => t
1728
- };
1729
- throw i;
1730
- }
1731
- };
1732
- function Le(s, t) {
1733
- return typeof s == "undefined" ? t : s;
1734
- }
1735
- class Cn {
1736
- constructor(t = {}) {
1737
- this.part = t;
1738
- }
1739
- createCommand(t, e, n) {
1740
- let i;
1741
- typeof e == "function" ? i = {
1742
- scope: ht.Widget,
1743
- stage: T.Post,
1744
- defaultArgs: void 0,
1745
- handlerResolver: e
1746
- } : i = {
1747
- scope: Le(e.scope, ht.Widget),
1748
- stage: Le(e.stage, T.Post),
1749
- defaultArgs: e.defaultArgs,
1750
- handlerResolver: n
1751
- };
1752
- let r = this.part;
1753
- const o = t.split(".");
1754
- return o.forEach((a, c) => {
1755
- c === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
1756
- }), this;
1757
- }
1758
- get() {
1759
- return this.part;
1760
- }
1761
- }
1762
- const ls = (s) => {
1763
- const t = new Cn({});
1764
- return s(t), t.get();
1765
- };
1766
- ls((s) => {
1767
- s.createCommand(
1768
- "types.register",
1769
- { scope: ht.Implementation, stage: T.Pre },
1770
- (t) => (e, n) => {
1771
- t.container.get("$types")[e] = n;
1772
- }
1773
- ).createCommand(
1774
- "type",
1775
- { stage: T.Pre },
1776
- (t) => (e) => {
1777
- t.container.register("$type", e);
1778
- }
1779
- ).createCommand(
1780
- "settings",
1781
- { stage: T.Pre, defaultArgs: [null] },
1782
- (t) => (e) => {
1783
- t.events.dispatch(
1784
- "settings:change",
1785
- e,
1786
- { bubbles: !0 }
1787
- ), t.container.register("$settings", e);
1788
- }
1789
- ).createCommand(
1790
- "plugin",
1791
- { stage: T.Pre },
1792
- (t) => (e, n, i) => {
1793
- const { container: r } = t;
1794
- let o = null, a = e, c = n;
1795
- typeof e == "string" && (o = e, a = n, c = i);
1796
- const h = (l) => {
1797
- const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
1798
- c || {},
1799
- o,
1800
- t.container,
1801
- a
1802
- ) : n;
1803
- try {
1804
- const p = _n(
1805
- o,
1806
- a,
1807
- r,
1808
- u
1809
- );
1810
- r.get("$plugins").push(p), l && p.invoke("initialize", null);
1811
- } catch (p) {
1812
- $n(t).warn("Error when initializing plugin", p);
1813
- }
1814
- };
1815
- t.container.get("$instance") ? h(!0) : t.events.subscribeOnce("widget:instance-created", () => h(!1));
1816
- }
1817
- ).createCommand(
1818
- "container.register",
1819
- (t) => (e, n) => {
1820
- t.container.register(e, n);
1821
- }
1822
- ).createCommand(
1823
- "container.registerAsync",
1824
- (t) => (e, n) => {
1825
- t.container.registerAsync(e, n);
1826
- }
1827
- ).createCommand(
1828
- "container.registerFactory",
1829
- (t) => (e, n) => {
1830
- t.container.registerFactory(e, n);
1831
- }
1832
- ).createCommand(
1833
- "container.touch",
1834
- (t) => (e, n) => {
1835
- t.container.touch(e, n);
1836
- }
1837
- ).createCommand(
1838
- "csp",
1839
- {},
1840
- (t) => (e) => {
1841
- t.container.register("csp", e);
1842
- }
1843
- );
1844
- });
1845
- function En(s) {
1846
- const t = {};
1847
- return [].filter.call(s.attributes, (e) => /^data-/.test(e.name)).map((e) => e.name).forEach((e) => t[e.substr(5)] = s.getAttribute(e)), t;
1848
- }
1849
- const Ie = (s, t, e) => {
1850
- const n = En(s);
1851
- e({
1852
- sourceDOMElement: s,
1853
- eventType: t,
1854
- data: n
1855
- });
1856
- };
1857
- function Re(s, t, e) {
1858
- s.forEach((n) => {
1859
- n.dataset.attached !== "true" && (t === "load" ? Ie(n, t, e) : n.addEventListener(t, (i) => {
1860
- i.preventDefault(), Ie(n, t, e);
1861
- }), n.dataset.monitored = "true");
1862
- });
1863
- }
1864
- function An(s, t, e) {
1865
- const n = s.container.get("bootstrapping.monitor");
1866
- n && n.events.subscribe("bootstrap:trigger-elements-updated", (r, o) => {
1867
- Re(
1868
- o.triggerElements,
1869
- t,
1870
- e
1871
- );
1872
- });
1873
- const i = s.container.get("triggerElements");
1874
- i && Re(
1875
- i,
1876
- t,
1877
- e
1878
- );
1879
- }
1880
- ls((s) => {
1881
- s.createCommand(
1882
- "ready",
1883
- { scope: ht.Implementation, stage: T.Pre },
1884
- (t) => (e) => {
1885
- const { container: n } = t, i = n.owner;
1886
- n.get("bootstrapping").ready ? e(i) : i.events.subscribeOnce("bootstrap:ready", () => {
1887
- e(i);
1888
- });
1889
- }
1890
- );
1891
- });
1892
- const Zt = (s, t, e, ...n) => {
1893
- const i = `[${s.get("$environment").name || "webprovisions"}] ${e}`;
1894
- switch (t) {
1895
- case "info":
1896
- console.info(i, ...n);
1897
- break;
1898
- case "warning":
1899
- console.warn(i, ...n);
1900
- break;
1901
- case "error":
1902
- console.error(i, ...n);
1903
- break;
1904
- }
1905
- }, On = (s) => {
1906
- const t = s.container || s;
1907
- return {
1908
- info: (e, ...n) => Zt(t, "info", e, ...n),
1909
- warn: (e, ...n) => Zt(t, "warning", e, ...n),
1910
- error: (e, ...n) => Zt(t, "error", e, ...n)
1911
- };
1912
- };
1913
- var Pt = /* @__PURE__ */ ((s) => (s.Implementation = "implementation", s.Widget = "widget", s))(Pt || {}), W = /* @__PURE__ */ ((s) => (s.Pre = "pre", s.Post = "post", s))(W || {});
1914
- const xn = (s, t, e, n) => {
1915
- try {
1916
- const i = new t(e, n);
1917
- return {
1918
- name: s,
1919
- invoke: (r, o) => {
1920
- let a;
1921
- return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
1922
- },
1923
- getInstance: () => i
1924
- };
1925
- } catch (i) {
1926
- if (i.message && i.message.indexOf("is not a constructor") >= 0)
1927
- return {
1928
- name: s,
1929
- invoke: (r) => {
1930
- let o;
1931
- return r === "initialize" && (o = t(e, n)), Promise.resolve(o);
1932
- },
1933
- getInstance: () => t
1934
- };
1935
- throw i;
1936
- }
1937
- };
1938
- function Te(s, t) {
1939
- return typeof s == "undefined" ? t : s;
1940
- }
1941
- class Sn {
1942
- constructor(t = {}) {
1943
- this.part = t;
1944
- }
1945
- createCommand(t, e, n) {
1946
- let i;
1947
- typeof e == "function" ? i = {
1948
- scope: Pt.Widget,
1949
- stage: W.Post,
1950
- defaultArgs: void 0,
1951
- handlerResolver: e
1952
- } : i = {
1953
- scope: Te(e.scope, Pt.Widget),
1954
- stage: Te(e.stage, W.Post),
1955
- defaultArgs: e.defaultArgs,
1956
- handlerResolver: n
1957
- };
1958
- let r = this.part;
1959
- const o = t.split(".");
1960
- return o.forEach((a, c) => {
1961
- c === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
1962
- }), this;
1963
- }
1964
- get() {
1965
- return this.part;
1966
- }
1967
- }
1968
- const Pn = (s) => {
1969
- const t = new Sn({});
1970
- return s(t), t.get();
1971
- };
1972
- Pn((s) => {
1973
- s.createCommand(
1974
- "types.register",
1975
- { scope: Pt.Implementation, stage: W.Pre },
1976
- (t) => (e, n) => {
1977
- t.container.get("$types")[e] = n;
1978
- }
1979
- ).createCommand(
1980
- "type",
1981
- { stage: W.Pre },
1982
- (t) => (e) => {
1983
- t.container.register("$type", e);
1984
- }
1985
- ).createCommand(
1986
- "settings",
1987
- { stage: W.Pre, defaultArgs: [null] },
1988
- (t) => (e) => {
1989
- t.events.dispatch(
1990
- "settings:change",
1991
- e,
1992
- { bubbles: !0 }
1993
- ), t.container.register("$settings", e);
1994
- }
1995
- ).createCommand(
1996
- "plugin",
1997
- { stage: W.Pre },
1998
- (t) => (e, n, i) => {
1999
- const { container: r } = t;
2000
- let o = null, a = e, c = n;
2001
- typeof e == "string" && (o = e, a = n, c = i);
2002
- const h = (l) => {
2003
- const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
2004
- c || {},
2005
- o,
2006
- t.container,
2007
- a
2008
- ) : n;
2009
- try {
2010
- const p = xn(
2011
- o,
2012
- a,
2013
- r,
2014
- u
2015
- );
2016
- r.get("$plugins").push(p), l && p.invoke("initialize", null);
2017
- } catch (p) {
2018
- On(t).warn("Error when initializing plugin", p);
2019
- }
2020
- };
2021
- t.container.get("$instance") ? h(!0) : t.events.subscribeOnce("widget:instance-created", () => h(!1));
2022
- }
2023
- ).createCommand(
2024
- "container.register",
2025
- (t) => (e, n) => {
2026
- t.container.register(e, n);
2027
- }
2028
- ).createCommand(
2029
- "container.registerAsync",
2030
- (t) => (e, n) => {
2031
- t.container.registerAsync(e, n);
2032
- }
2033
- ).createCommand(
2034
- "container.registerFactory",
2035
- (t) => (e, n) => {
2036
- t.container.registerFactory(e, n);
2037
- }
2038
- ).createCommand(
2039
- "container.touch",
2040
- (t) => (e, n) => {
2041
- t.container.touch(e, n);
2042
- }
2043
- ).createCommand(
2044
- "csp",
2045
- {},
2046
- (t) => (e) => {
2047
- t.container.register("csp", e);
2048
- }
2049
- );
2050
- });
2051
- var ds = /* @__PURE__ */ ((s) => (s.Activating = "activating", s.Loading = "loading", s.Activated = "activated", s.Deactivating = "deactivating", s.Deactivated = "deactivated", s))(ds || {});
2052
- class kn {
2053
- /**
2054
- * Creates a new `Widget` instance.
2055
- * @param container The `Container` instance to base the widget upon.
2056
- */
2057
- constructor(t) {
2058
- this.container = t, this.widget = t.get("$widget"), this.settings = t.get("$settings"), this.events = this.widget.events, this.widget.events.subscribe("settings:change", (e, n) => {
2059
- this.settings = n;
2060
- });
2061
- }
2062
- }
2063
- const Nn = (s) => {
2064
- const t = (i, r) => {
2065
- i && (r ? i.classList.add("ace-tabbing") : i.classList.remove("ace-tabbing"));
2066
- }, e = (i) => {
2067
- i.key === "Tab" ? t(s, !0) : i.key === "Enter" && document.activeElement && document.activeElement.classList.contains("ace-widget-trigger") || t(s, !1);
2068
- }, n = (i) => {
2069
- document.activeElement && document.activeElement.classList.contains("ace-widget-trigger") && document.activeElement.classList.contains("ace-tabbing") || t(s, !1);
2070
- };
2071
- return document.addEventListener("keydown", e), document.addEventListener("click", n), () => {
2072
- document.removeEventListener("keydown", e), document.removeEventListener("click", n);
2073
- };
2074
- };
2075
- function Dn(s, t) {
2076
- const {
2077
- // symbol,
2078
- widgetName: e,
2079
- label: n = "",
2080
- ariaLabel: i = "",
2081
- tooltip: r = ""
2082
- } = t;
2083
- return s.classList.add("ace-widget-trigger"), s.classList.add(`ace-widget_${e}`), n.length && s.classList.add("trigger-has-text"), i.length && !s.getAttribute("aria-label") && s.setAttribute("aria-label", i), i.length && !s.getAttribute("tabindex") && s.setAttribute("tabindex", "0"), r.length && !s.getAttribute("title") && s.setAttribute("title", r), Nn(s);
2084
- }
2085
- function Mn(s, t) {
2086
- s instanceof HTMLElement ? (t && s.setAttribute("title", t), s.classList.remove("ace-trigger-active"), s.classList.remove("ace-trigger-loading")) : s instanceof Array && s.forEach((e) => {
2087
- t && e.setAttribute("title", t), e.classList.remove("ace-trigger-active"), e.classList.remove("ace-trigger-loading");
2088
- });
2089
- }
2090
- function Ln(s) {
2091
- s instanceof HTMLElement ? (s.classList.remove("ace-trigger-active"), s.classList.add("ace-trigger-loading")) : s instanceof Array && s.forEach((t) => {
2092
- t.classList.remove("ace-trigger-active"), t.classList.add("ace-trigger-loading");
2093
- });
2094
- }
2095
- function us(s, t) {
2096
- s instanceof HTMLElement ? (t && s.setAttribute("title", t), s.classList.add("ace-trigger-active"), s.classList.remove("ace-trigger-loading")) : s instanceof Array && s.forEach((e) => {
2097
- t && e.setAttribute("title", t), e.classList.add("ace-trigger-active"), e.classList.remove("ace-trigger-loading");
2098
- });
2099
- }
2100
- /**
2101
- * @license
2102
- * Copyright 2019 Google LLC
2103
- * SPDX-License-Identifier: BSD-3-Clause
2104
- */
2105
- const Ct = window, be = Ct.ShadowRoot && (Ct.ShadyCSS === void 0 || Ct.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, we = Symbol(), je = /* @__PURE__ */ new WeakMap();
2106
- let ps = class {
2107
- constructor(t, e, n) {
2108
- if (this._$cssResult$ = !0, n !== we)
2109
- throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
2110
- this.cssText = t, this.t = e;
2111
- }
2112
- get styleSheet() {
2113
- let t = this.o;
2114
- const e = this.t;
2115
- if (be && t === void 0) {
2116
- const n = e !== void 0 && e.length === 1;
2117
- n && (t = je.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), n && je.set(e, t));
2118
- }
2119
- return t;
2120
- }
2121
- toString() {
2122
- return this.cssText;
2123
- }
2124
- };
2125
- const In = (s) => new ps(typeof s == "string" ? s : s + "", void 0, we), gs = (s, ...t) => {
2126
- const e = s.length === 1 ? s[0] : t.reduce((n, i, r) => n + ((o) => {
2127
- if (o._$cssResult$ === !0)
2128
- return o.cssText;
2129
- if (typeof o == "number")
2130
- return o;
2131
- 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.");
2132
- })(i) + s[r + 1], s[0]);
2133
- return new ps(e, s, we);
2134
- }, Rn = (s, t) => {
2135
- be ? s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
2136
- const n = document.createElement("style"), i = Ct.litNonce;
2137
- i !== void 0 && n.setAttribute("nonce", i), n.textContent = e.cssText, s.appendChild(n);
2138
- });
2139
- }, Ve = be ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
2140
- let e = "";
2141
- for (const n of t.cssRules)
2142
- e += n.cssText;
2143
- return In(e);
2144
- })(s) : s;
2145
- /**
2146
- * @license
2147
- * Copyright 2017 Google LLC
2148
- * SPDX-License-Identifier: BSD-3-Clause
2149
- */
2150
- var Qt;
2151
- const kt = window, Ue = kt.trustedTypes, Tn = Ue ? Ue.emptyScript : "", ze = kt.reactiveElementPolyfillSupport, le = { toAttribute(s, t) {
2152
- switch (t) {
2153
- case Boolean:
2154
- s = s ? Tn : null;
2155
- break;
2156
- case Object:
2157
- case Array:
2158
- s = s == null ? s : JSON.stringify(s);
2159
- }
2160
- return s;
2161
- }, fromAttribute(s, t) {
2162
- let e = s;
2163
- switch (t) {
2164
- case Boolean:
2165
- e = s !== null;
2166
- break;
2167
- case Number:
2168
- e = s === null ? null : Number(s);
2169
- break;
2170
- case Object:
2171
- case Array:
2172
- try {
2173
- e = JSON.parse(s);
2174
- } catch (n) {
2175
- e = null;
2176
- }
2177
- }
2178
- return e;
2179
- } }, ms = (s, t) => t !== s && (t == t || s == s), Xt = { attribute: !0, type: String, converter: le, reflect: !1, hasChanged: ms }, de = "finalized";
2180
- let Y = class extends HTMLElement {
2181
- constructor() {
2182
- super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this._$Eu();
2183
- }
2184
- static addInitializer(t) {
2185
- var e;
2186
- this.finalize(), ((e = this.h) !== null && e !== void 0 ? e : this.h = []).push(t);
2187
- }
2188
- static get observedAttributes() {
2189
- this.finalize();
2190
- const t = [];
2191
- return this.elementProperties.forEach((e, n) => {
2192
- const i = this._$Ep(n, e);
2193
- i !== void 0 && (this._$Ev.set(i, n), t.push(i));
2194
- }), t;
2195
- }
2196
- static createProperty(t, e = Xt) {
2197
- if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
2198
- const n = typeof t == "symbol" ? Symbol() : "__" + t, i = this.getPropertyDescriptor(t, n, e);
2199
- i !== void 0 && Object.defineProperty(this.prototype, t, i);
2200
- }
2201
- }
2202
- static getPropertyDescriptor(t, e, n) {
2203
- return { get() {
2204
- return this[e];
2205
- }, set(i) {
2206
- const r = this[t];
2207
- this[e] = i, this.requestUpdate(t, r, n);
2208
- }, configurable: !0, enumerable: !0 };
2209
- }
2210
- static getPropertyOptions(t) {
2211
- return this.elementProperties.get(t) || Xt;
2212
- }
2213
- static finalize() {
2214
- if (this.hasOwnProperty(de))
2215
- return !1;
2216
- this[de] = !0;
2217
- const t = Object.getPrototypeOf(this);
2218
- if (t.finalize(), t.h !== void 0 && (this.h = [...t.h]), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
2219
- const e = this.properties, n = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
2220
- for (const i of n)
2221
- this.createProperty(i, e[i]);
2222
- }
2223
- return this.elementStyles = this.finalizeStyles(this.styles), !0;
2224
- }
2225
- static finalizeStyles(t) {
2226
- const e = [];
2227
- if (Array.isArray(t)) {
2228
- const n = new Set(t.flat(1 / 0).reverse());
2229
- for (const i of n)
2230
- e.unshift(Ve(i));
2231
- } else
2232
- t !== void 0 && e.push(Ve(t));
2233
- return e;
2234
- }
2235
- static _$Ep(t, e) {
2236
- const n = e.attribute;
2237
- return n === !1 ? void 0 : typeof n == "string" ? n : typeof t == "string" ? t.toLowerCase() : void 0;
2238
- }
2239
- _$Eu() {
2240
- var t;
2241
- this._$E_ = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), (t = this.constructor.h) === null || t === void 0 || t.forEach((e) => e(this));
2242
- }
2243
- addController(t) {
2244
- var e, n;
2245
- ((e = this._$ES) !== null && e !== void 0 ? e : this._$ES = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((n = t.hostConnected) === null || n === void 0 || n.call(t));
2246
- }
2247
- removeController(t) {
2248
- var e;
2249
- (e = this._$ES) === null || e === void 0 || e.splice(this._$ES.indexOf(t) >>> 0, 1);
2250
- }
2251
- _$Eg() {
2252
- this.constructor.elementProperties.forEach((t, e) => {
2253
- this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]);
2254
- });
2255
- }
2256
- createRenderRoot() {
2257
- var t;
2258
- const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
2259
- return Rn(e, this.constructor.elementStyles), e;
2260
- }
2261
- connectedCallback() {
2262
- var t;
2263
- this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
2264
- var n;
2265
- return (n = e.hostConnected) === null || n === void 0 ? void 0 : n.call(e);
2266
- });
2267
- }
2268
- enableUpdating(t) {
2269
- }
2270
- disconnectedCallback() {
2271
- var t;
2272
- (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
2273
- var n;
2274
- return (n = e.hostDisconnected) === null || n === void 0 ? void 0 : n.call(e);
2275
- });
2276
- }
2277
- attributeChangedCallback(t, e, n) {
2278
- this._$AK(t, n);
2279
- }
2280
- _$EO(t, e, n = Xt) {
2281
- var i;
2282
- const r = this.constructor._$Ep(t, n);
2283
- if (r !== void 0 && n.reflect === !0) {
2284
- const o = (((i = n.converter) === null || i === void 0 ? void 0 : i.toAttribute) !== void 0 ? n.converter : le).toAttribute(e, n.type);
2285
- this._$El = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$El = null;
2286
- }
2287
- }
2288
- _$AK(t, e) {
2289
- var n;
2290
- const i = this.constructor, r = i._$Ev.get(t);
2291
- if (r !== void 0 && this._$El !== r) {
2292
- const o = i.getPropertyOptions(r), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) === null || n === void 0 ? void 0 : n.fromAttribute) !== void 0 ? o.converter : le;
2293
- this._$El = r, this[r] = a.fromAttribute(e, o.type), this._$El = null;
2294
- }
2295
- }
2296
- requestUpdate(t, e, n) {
2297
- let i = !0;
2298
- t !== void 0 && (((n = n || this.constructor.getPropertyOptions(t)).hasChanged || ms)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), n.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, n))) : i = !1), !this.isUpdatePending && i && (this._$E_ = this._$Ej());
2299
- }
2300
- _$Ej() {
2301
- return y(this, null, function* () {
2302
- this.isUpdatePending = !0;
2303
- try {
2304
- yield this._$E_;
2305
- } catch (e) {
2306
- Promise.reject(e);
2307
- }
2308
- const t = this.scheduleUpdate();
2309
- return t != null && (yield t), !this.isUpdatePending;
2310
- });
2311
- }
2312
- scheduleUpdate() {
2313
- return this.performUpdate();
2314
- }
2315
- performUpdate() {
2316
- var t;
2317
- if (!this.isUpdatePending)
2318
- return;
2319
- this.hasUpdated, this._$Ei && (this._$Ei.forEach((i, r) => this[r] = i), this._$Ei = void 0);
2320
- let e = !1;
2321
- const n = this._$AL;
2322
- try {
2323
- e = this.shouldUpdate(n), e ? (this.willUpdate(n), (t = this._$ES) === null || t === void 0 || t.forEach((i) => {
2324
- var r;
2325
- return (r = i.hostUpdate) === null || r === void 0 ? void 0 : r.call(i);
2326
- }), this.update(n)) : this._$Ek();
2327
- } catch (i) {
2328
- throw e = !1, this._$Ek(), i;
2329
- }
2330
- e && this._$AE(n);
2331
- }
2332
- willUpdate(t) {
2333
- }
2334
- _$AE(t) {
2335
- var e;
2336
- (e = this._$ES) === null || e === void 0 || e.forEach((n) => {
2337
- var i;
2338
- return (i = n.hostUpdated) === null || i === void 0 ? void 0 : i.call(n);
2339
- }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
2340
- }
2341
- _$Ek() {
2342
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
2343
- }
2344
- get updateComplete() {
2345
- return this.getUpdateComplete();
2346
- }
2347
- getUpdateComplete() {
2348
- return this._$E_;
2349
- }
2350
- shouldUpdate(t) {
2351
- return !0;
2352
- }
2353
- update(t) {
2354
- this._$EC !== void 0 && (this._$EC.forEach((e, n) => this._$EO(n, this[n], e)), this._$EC = void 0), this._$Ek();
2355
- }
2356
- updated(t) {
2357
- }
2358
- firstUpdated(t) {
2359
- }
2360
- };
2361
- Y[de] = !0, Y.elementProperties = /* @__PURE__ */ new Map(), Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, ze == null || ze({ ReactiveElement: Y }), ((Qt = kt.reactiveElementVersions) !== null && Qt !== void 0 ? Qt : kt.reactiveElementVersions = []).push("1.6.3");
2362
- /**
2363
- * @license
2364
- * Copyright 2017 Google LLC
2365
- * SPDX-License-Identifier: BSD-3-Clause
2366
- */
2367
- var te;
2368
- const Nt = window, Q = Nt.trustedTypes, He = Q ? Q.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ue = "$lit$", L = `lit$${(Math.random() + "").slice(9)}$`, fs = "?" + L, jn = `<${fs}>`, J = document, lt = () => J.createComment(""), dt = (s) => s === null || typeof s != "object" && typeof s != "function", vs = Array.isArray, Vn = (s) => vs(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", ee = `[
2369
- \f\r]`, nt = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, We = /-->/g, Be = />/g, V = RegExp(`>|${ee}(?:([^\\s"'>=/]+)(${ee}*=${ee}*(?:[^
2370
- \f\r"'\`<>=]|("|')|))|$)`, "g"), qe = /'/g, Je = /"/g, ys = /^(?:script|style|textarea|title)$/i, Un = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), yt = Un(1), F = Symbol.for("lit-noChange"), v = Symbol.for("lit-nothing"), Fe = /* @__PURE__ */ new WeakMap(), B = J.createTreeWalker(J, 129, null, !1);
2371
- function bs(s, t) {
2372
- if (!Array.isArray(s) || !s.hasOwnProperty("raw"))
2373
- throw Error("invalid template strings array");
2374
- return He !== void 0 ? He.createHTML(t) : t;
2375
- }
2376
- const zn = (s, t) => {
2377
- const e = s.length - 1, n = [];
2378
- let i, r = t === 2 ? "<svg>" : "", o = nt;
2379
- for (let a = 0; a < e; a++) {
2380
- const c = s[a];
2381
- let h, l, d = -1, u = 0;
2382
- for (; u < c.length && (o.lastIndex = u, l = o.exec(c), l !== null); )
2383
- u = o.lastIndex, o === nt ? l[1] === "!--" ? o = We : l[1] !== void 0 ? o = Be : l[2] !== void 0 ? (ys.test(l[2]) && (i = RegExp("</" + l[2], "g")), o = V) : l[3] !== void 0 && (o = V) : o === V ? l[0] === ">" ? (o = i != null ? i : nt, d = -1) : l[1] === void 0 ? d = -2 : (d = o.lastIndex - l[2].length, h = l[1], o = l[3] === void 0 ? V : l[3] === '"' ? Je : qe) : o === Je || o === qe ? o = V : o === We || o === Be ? o = nt : (o = V, i = void 0);
2384
- const p = o === V && s[a + 1].startsWith("/>") ? " " : "";
2385
- r += o === nt ? c + jn : d >= 0 ? (n.push(h), c.slice(0, d) + ue + c.slice(d) + L + p) : c + L + (d === -2 ? (n.push(void 0), a) : p);
2386
- }
2387
- return [bs(s, r + (s[e] || "<?>") + (t === 2 ? "</svg>" : "")), n];
2388
- };
2389
- class ut {
2390
- constructor({ strings: t, _$litType$: e }, n) {
2391
- let i;
2392
- this.parts = [];
2393
- let r = 0, o = 0;
2394
- const a = t.length - 1, c = this.parts, [h, l] = zn(t, e);
2395
- if (this.el = ut.createElement(h, n), B.currentNode = this.el.content, e === 2) {
2396
- const d = this.el.content, u = d.firstChild;
2397
- u.remove(), d.append(...u.childNodes);
2398
- }
2399
- for (; (i = B.nextNode()) !== null && c.length < a; ) {
2400
- if (i.nodeType === 1) {
2401
- if (i.hasAttributes()) {
2402
- const d = [];
2403
- for (const u of i.getAttributeNames())
2404
- if (u.endsWith(ue) || u.startsWith(L)) {
2405
- const p = l[o++];
2406
- if (d.push(u), p !== void 0) {
2407
- const _ = i.getAttribute(p.toLowerCase() + ue).split(L), f = /([.?@])?(.*)/.exec(p);
2408
- c.push({ type: 1, index: r, name: f[2], strings: _, ctor: f[1] === "." ? Wn : f[1] === "?" ? qn : f[1] === "@" ? Jn : Vt });
2409
- } else
2410
- c.push({ type: 6, index: r });
2411
- }
2412
- for (const u of d)
2413
- i.removeAttribute(u);
2414
- }
2415
- if (ys.test(i.tagName)) {
2416
- const d = i.textContent.split(L), u = d.length - 1;
2417
- if (u > 0) {
2418
- i.textContent = Q ? Q.emptyScript : "";
2419
- for (let p = 0; p < u; p++)
2420
- i.append(d[p], lt()), B.nextNode(), c.push({ type: 2, index: ++r });
2421
- i.append(d[u], lt());
2422
- }
2423
- }
2424
- } else if (i.nodeType === 8)
2425
- if (i.data === fs)
2426
- c.push({ type: 2, index: r });
2427
- else {
2428
- let d = -1;
2429
- for (; (d = i.data.indexOf(L, d + 1)) !== -1; )
2430
- c.push({ type: 7, index: r }), d += L.length - 1;
2431
- }
2432
- r++;
2433
- }
2434
- }
2435
- static createElement(t, e) {
2436
- const n = J.createElement("template");
2437
- return n.innerHTML = t, n;
2438
- }
2439
- }
2440
- function X(s, t, e = s, n) {
2441
- var i, r, o, a;
2442
- if (t === F)
2443
- return t;
2444
- let c = n !== void 0 ? (i = e._$Co) === null || i === void 0 ? void 0 : i[n] : e._$Cl;
2445
- const h = dt(t) ? void 0 : t._$litDirective$;
2446
- return (c == null ? void 0 : c.constructor) !== h && ((r = c == null ? void 0 : c._$AO) === null || r === void 0 || r.call(c, !1), h === void 0 ? c = void 0 : (c = new h(s), c._$AT(s, e, n)), n !== void 0 ? ((o = (a = e)._$Co) !== null && o !== void 0 ? o : a._$Co = [])[n] = c : e._$Cl = c), c !== void 0 && (t = X(s, c._$AS(s, t.values), c, n)), t;
2447
- }
2448
- class Hn {
2449
- constructor(t, e) {
2450
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
2451
- }
2452
- get parentNode() {
2453
- return this._$AM.parentNode;
2454
- }
2455
- get _$AU() {
2456
- return this._$AM._$AU;
2457
- }
2458
- u(t) {
2459
- var e;
2460
- const { el: { content: n }, parts: i } = this._$AD, r = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : J).importNode(n, !0);
2461
- B.currentNode = r;
2462
- let o = B.nextNode(), a = 0, c = 0, h = i[0];
2463
- for (; h !== void 0; ) {
2464
- if (a === h.index) {
2465
- let l;
2466
- h.type === 2 ? l = new gt(o, o.nextSibling, this, t) : h.type === 1 ? l = new h.ctor(o, h.name, h.strings, this, t) : h.type === 6 && (l = new Fn(o, this, t)), this._$AV.push(l), h = i[++c];
2467
- }
2468
- a !== (h == null ? void 0 : h.index) && (o = B.nextNode(), a++);
2469
- }
2470
- return B.currentNode = J, r;
2471
- }
2472
- v(t) {
2473
- let e = 0;
2474
- for (const n of this._$AV)
2475
- n !== void 0 && (n.strings !== void 0 ? (n._$AI(t, n, e), e += n.strings.length - 2) : n._$AI(t[e])), e++;
2476
- }
2477
- }
2478
- class gt {
2479
- constructor(t, e, n, i) {
2480
- var r;
2481
- this.type = 2, this._$AH = v, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = n, this.options = i, this._$Cp = (r = i == null ? void 0 : i.isConnected) === null || r === void 0 || r;
2482
- }
2483
- get _$AU() {
2484
- var t, e;
2485
- return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$Cp;
2486
- }
2487
- get parentNode() {
2488
- let t = this._$AA.parentNode;
2489
- const e = this._$AM;
2490
- return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
2491
- }
2492
- get startNode() {
2493
- return this._$AA;
2494
- }
2495
- get endNode() {
2496
- return this._$AB;
2497
- }
2498
- _$AI(t, e = this) {
2499
- t = X(this, t, e), dt(t) ? t === v || t == null || t === "" ? (this._$AH !== v && this._$AR(), this._$AH = v) : t !== this._$AH && t !== F && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Vn(t) ? this.T(t) : this._(t);
2500
- }
2501
- k(t) {
2502
- return this._$AA.parentNode.insertBefore(t, this._$AB);
2503
- }
2504
- $(t) {
2505
- this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
2506
- }
2507
- _(t) {
2508
- this._$AH !== v && dt(this._$AH) ? this._$AA.nextSibling.data = t : this.$(J.createTextNode(t)), this._$AH = t;
2509
- }
2510
- g(t) {
2511
- var e;
2512
- const { values: n, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = ut.createElement(bs(i.h, i.h[0]), this.options)), i);
2513
- if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === r)
2514
- this._$AH.v(n);
2515
- else {
2516
- const o = new Hn(r, this), a = o.u(this.options);
2517
- o.v(n), this.$(a), this._$AH = o;
2518
- }
2519
- }
2520
- _$AC(t) {
2521
- let e = Fe.get(t.strings);
2522
- return e === void 0 && Fe.set(t.strings, e = new ut(t)), e;
2523
- }
2524
- T(t) {
2525
- vs(this._$AH) || (this._$AH = [], this._$AR());
2526
- const e = this._$AH;
2527
- let n, i = 0;
2528
- for (const r of t)
2529
- i === e.length ? e.push(n = new gt(this.k(lt()), this.k(lt()), this, this.options)) : n = e[i], n._$AI(r), i++;
2530
- i < e.length && (this._$AR(n && n._$AB.nextSibling, i), e.length = i);
2531
- }
2532
- _$AR(t = this._$AA.nextSibling, e) {
2533
- var n;
2534
- for ((n = this._$AP) === null || n === void 0 || n.call(this, !1, !0, e); t && t !== this._$AB; ) {
2535
- const i = t.nextSibling;
2536
- t.remove(), t = i;
2537
- }
2538
- }
2539
- setConnected(t) {
2540
- var e;
2541
- this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
2542
- }
2543
- }
2544
- class Vt {
2545
- constructor(t, e, n, i, r) {
2546
- this.type = 1, this._$AH = v, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = v;
2547
- }
2548
- get tagName() {
2549
- return this.element.tagName;
2550
- }
2551
- get _$AU() {
2552
- return this._$AM._$AU;
2553
- }
2554
- _$AI(t, e = this, n, i) {
2555
- const r = this.strings;
2556
- let o = !1;
2557
- if (r === void 0)
2558
- t = X(this, t, e, 0), o = !dt(t) || t !== this._$AH && t !== F, o && (this._$AH = t);
2559
- else {
2560
- const a = t;
2561
- let c, h;
2562
- for (t = r[0], c = 0; c < r.length - 1; c++)
2563
- h = X(this, a[n + c], e, c), h === F && (h = this._$AH[c]), o || (o = !dt(h) || h !== this._$AH[c]), h === v ? t = v : t !== v && (t += (h != null ? h : "") + r[c + 1]), this._$AH[c] = h;
2564
- }
2565
- o && !i && this.j(t);
2566
- }
2567
- j(t) {
2568
- t === v ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t != null ? t : "");
2569
- }
2570
- }
2571
- class Wn extends Vt {
2572
- constructor() {
2573
- super(...arguments), this.type = 3;
2574
- }
2575
- j(t) {
2576
- this.element[this.name] = t === v ? void 0 : t;
2577
- }
2578
- }
2579
- const Bn = Q ? Q.emptyScript : "";
2580
- class qn extends Vt {
2581
- constructor() {
2582
- super(...arguments), this.type = 4;
2583
- }
2584
- j(t) {
2585
- t && t !== v ? this.element.setAttribute(this.name, Bn) : this.element.removeAttribute(this.name);
2586
- }
2587
- }
2588
- class Jn extends Vt {
2589
- constructor(t, e, n, i, r) {
2590
- super(t, e, n, i, r), this.type = 5;
2591
- }
2592
- _$AI(t, e = this) {
2593
- var n;
2594
- if ((t = (n = X(this, t, e, 0)) !== null && n !== void 0 ? n : v) === F)
2595
- return;
2596
- const i = this._$AH, r = t === v && i !== v || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, o = t !== v && (i === v || r);
2597
- r && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
2598
- }
2599
- handleEvent(t) {
2600
- var e, n;
2601
- typeof this._$AH == "function" ? this._$AH.call((n = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && n !== void 0 ? n : this.element, t) : this._$AH.handleEvent(t);
2602
- }
2603
- }
2604
- class Fn {
2605
- constructor(t, e, n) {
2606
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = n;
2607
- }
2608
- get _$AU() {
2609
- return this._$AM._$AU;
2610
- }
2611
- _$AI(t) {
2612
- X(this, t);
2613
- }
2614
- }
2615
- const Ke = Nt.litHtmlPolyfillSupport;
2616
- Ke == null || Ke(ut, gt), ((te = Nt.litHtmlVersions) !== null && te !== void 0 ? te : Nt.litHtmlVersions = []).push("2.8.0");
2617
- const Kn = (s, t, e) => {
2618
- var n, i;
2619
- const r = (n = e == null ? void 0 : e.renderBefore) !== null && n !== void 0 ? n : t;
2620
- let o = r._$litPart$;
2621
- if (o === void 0) {
2622
- const a = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : null;
2623
- r._$litPart$ = o = new gt(t.insertBefore(lt(), a), a, void 0, e != null ? e : {});
2624
- }
2625
- return o._$AI(s), o;
2626
- };
2627
- /**
2628
- * @license
2629
- * Copyright 2017 Google LLC
2630
- * SPDX-License-Identifier: BSD-3-Clause
2631
- */
2632
- var se, ne;
2633
- let at = class extends Y {
2634
- constructor() {
2635
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
2636
- }
2637
- createRenderRoot() {
2638
- var t, e;
2639
- const n = super.createRenderRoot();
2640
- return (t = (e = this.renderOptions).renderBefore) !== null && t !== void 0 || (e.renderBefore = n.firstChild), n;
2641
- }
2642
- update(t) {
2643
- const e = this.render();
2644
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Kn(e, this.renderRoot, this.renderOptions);
2645
- }
2646
- connectedCallback() {
2647
- var t;
2648
- super.connectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!0);
2649
- }
2650
- disconnectedCallback() {
2651
- var t;
2652
- super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
2653
- }
2654
- render() {
2655
- return F;
2656
- }
2657
- };
2658
- at.finalized = !0, at._$litElement$ = !0, (se = globalThis.litElementHydrateSupport) === null || se === void 0 || se.call(globalThis, { LitElement: at });
2659
- const Ge = globalThis.litElementPolyfillSupport;
2660
- Ge == null || Ge({ LitElement: at });
2661
- ((ne = globalThis.litElementVersions) !== null && ne !== void 0 ? ne : globalThis.litElementVersions = []).push("3.3.3");
2662
- /**
2663
- * @license
2664
- * Copyright 2017 Google LLC
2665
- * SPDX-License-Identifier: BSD-3-Clause
2666
- */
2667
- const Gn = (s, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? st(S({}, t), { finisher(e) {
2668
- e.createProperty(t.key, s);
2669
- } }) : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
2670
- typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
2671
- }, finisher(e) {
2672
- e.createProperty(t.key, s);
2673
- } }, Yn = (s, t, e) => {
2674
- t.constructor.createProperty(e, s);
2675
- };
2676
- function Dt(s) {
2677
- return (t, e) => e !== void 0 ? Yn(s, t, e) : Gn(s, t);
2678
- }
2679
- /**
2680
- * @license
2681
- * Copyright 2017 Google LLC
2682
- * SPDX-License-Identifier: BSD-3-Clause
2683
- */
2684
- function I(s) {
2685
- return Dt(st(S({}, s), { state: !0 }));
2686
- }
2687
- /**
2688
- * @license
2689
- * Copyright 2017 Google LLC
2690
- * SPDX-License-Identifier: BSD-3-Clause
2691
- */
2692
- const Zn = ({ finisher: s, descriptor: t }) => (e, n) => {
2693
- var i;
2694
- if (n === void 0) {
2695
- const r = (i = e.originalKey) !== null && i !== void 0 ? i : e.key, o = t != null ? { kind: "method", placement: "prototype", key: r, descriptor: t(e.key) } : st(S({}, e), { key: r });
2696
- return s != null && (o.finisher = function(a) {
2697
- s(a, r);
2698
- }), o;
2699
- }
2700
- {
2701
- const r = e.constructor;
2702
- t !== void 0 && Object.defineProperty(e, n, t(n)), s == null || s(r, n);
2703
- }
2704
- };
2705
- /**
2706
- * @license
2707
- * Copyright 2021 Google LLC
2708
- * SPDX-License-Identifier: BSD-3-Clause
2709
- */
2710
- var ie;
2711
- ((ie = window.HTMLSlotElement) === null || ie === void 0 ? void 0 : ie.prototype.assignedElements) != null;
2712
- /**
2713
- * @license
2714
- * Copyright 2017 Google LLC
2715
- * SPDX-License-Identifier: BSD-3-Clause
2716
- */
2717
- const Qn = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, Xn = (s) => (...t) => ({ _$litDirective$: s, values: t });
2718
- let ti = class {
2719
- constructor(t) {
2720
- }
2721
- get _$AU() {
2722
- return this._$AM._$AU;
2723
- }
2724
- _$AT(t, e, n) {
2725
- this._$Ct = t, this._$AM = e, this._$Ci = n;
2726
- }
2727
- _$AS(t, e) {
2728
- return this.update(t, e);
2729
- }
2730
- update(t, e) {
2731
- return this.render(...e);
2732
- }
2733
- };
2734
- /**
2735
- * @license
2736
- * Copyright 2018 Google LLC
2737
- * SPDX-License-Identifier: BSD-3-Clause
2738
- */
2739
- const ei = Xn(class extends ti {
2740
- constructor(s) {
2741
- var t;
2742
- if (super(s), s.type !== Qn.ATTRIBUTE || s.name !== "class" || ((t = s.strings) === null || t === void 0 ? void 0 : t.length) > 2)
2743
- throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
2744
- }
2745
- render(s) {
2746
- return " " + Object.keys(s).filter((t) => s[t]).join(" ") + " ";
2747
- }
2748
- update(s, [t]) {
2749
- var e, n;
2750
- if (this.it === void 0) {
2751
- this.it = /* @__PURE__ */ new Set(), s.strings !== void 0 && (this.nt = new Set(s.strings.join(" ").split(/\s/).filter((r) => r !== "")));
2752
- for (const r in t)
2753
- t[r] && !(!((e = this.nt) === null || e === void 0) && e.has(r)) && this.it.add(r);
2754
- return this.render(t);
2755
- }
2756
- const i = s.element.classList;
2757
- this.it.forEach((r) => {
2758
- r in t || (i.remove(r), this.it.delete(r));
2759
- });
2760
- for (const r in t) {
2761
- const o = !!t[r];
2762
- o === this.it.has(r) || !((n = this.nt) === null || n === void 0) && n.has(r) || (o ? (i.add(r), this.it.add(r)) : (i.remove(r), this.it.delete(r)));
2763
- }
2764
- return F;
2765
- }
2766
- });
2767
- var si = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, Ut = (s, t, e, n) => {
2768
- for (var i = n > 1 ? void 0 : n ? ni(t, e) : t, r = s.length - 1, o; r >= 0; r--)
2769
- (o = s[r]) && (i = (n ? o(t, e, i) : o(i)) || i);
2770
- return n && i && si(t, e, i), i;
2771
- };
2772
- class j extends at {
2773
- constructor() {
2774
- super(...arguments), this.active = !1, this.loaded = !1;
2775
- }
2776
- connectedCallback() {
2777
- return y(this, null, function* () {
2778
- Ee(j.prototype, this, "connectedCallback").call(this), this.icon = yield this._renderSymbol(this.symbol), this.loaded = !0;
2779
- });
2780
- }
2781
- _toggleActive() {
2782
- this.active = !this.active;
2783
- }
2784
- _renderSymbol(t) {
2785
- return y(this, null, function* () {
2786
- const e = (n) => y(this, null, function* () {
2787
- return yield import("./index-9688347a.js").then((r) => r[n]);
2788
- });
2789
- if (t) {
2790
- const { type: n, content: i } = t;
2791
- switch (n) {
2792
- case "Telia": {
2793
- const r = yield e(i);
2794
- return r ? yt`<telia-icon
2795
- class="trigger-icon"
2796
- svg=${r.svg}
2797
- size="lg"
2798
- ></telia-icon>` : v;
2799
- }
2800
- case "FontAwesome":
2801
- return yt`<i class="trigger-fa-icon fa fa-${i}"></i>`;
2802
- case "Uri":
2803
- return yt`<i
2804
- class="trigger-custom-icon"
2805
- style="background: url(${i}) no-repeat center center;background-size: contain;"
2806
- ></i>`;
2807
- default:
2808
- return v;
2809
- }
2810
- }
2811
- });
2812
- }
2813
- render() {
2814
- return yt`<button
2815
- class=${ei({
2816
- trigger: !0,
2817
- active: this.active,
2818
- rendered: this.loaded
2819
- })}
2820
- @click=${this._toggleActive}
2821
- >
2822
- ${this.icon}
2823
- <span class="trigger-close">
2824
- <svg
2825
- width="18"
2826
- height="9"
2827
- viewBox="0 0 18 9"
2828
- fill="none"
2829
- xmlns="http://www.w3.org/2000/svg"
2830
- >
2831
- <path
2832
- 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"
2833
- fill="white"
2834
- />
2835
- </svg>
2836
- </span>
2837
- <span class="trigger-loader">
2838
- <svg viewBox="25 25 50 50">
2839
- <circle
2840
- cx="50"
2841
- cy="50"
2842
- r="20"
2843
- fill="none"
2844
- stroke="#000"
2845
- stroke-width="2"
2846
- stroke-miterlimit="10"
2847
- />
2848
- </svg>
2849
- </span>
2850
- </button>`;
2851
- }
2852
- }
2853
- j.styles = [
2854
- gs`
2855
- :host {
2856
- --voca-rem-multiplier: 0.625;
2857
- display: block;
2858
- box-sizing: border-box;
2859
- }
2860
-
2861
- .trigger {
2862
- position: fixed;
2863
- transform: scale(0);
2864
- box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
2865
- bottom: 20px;
2866
- right: 20px;
2867
- z-index: 5;
2868
- display: flex;
2869
- align-items: center;
2870
- justify-content: center;
2871
- border: none;
2872
- line-height: 55px;
2873
- height: 55px;
2874
- width: 55px;
2875
- border-radius: 55px;
2876
- cursor: pointer;
2877
- background-color: #990ae3;
2878
- font-family: Lato;
2879
- text-decoration: none;
2880
- border: 3px dashed transparent;
2881
- box-sizing: border-box;
2882
- transition: transform 200ms ease-out;
2883
- }
2884
- .trigger:hover {
2885
- transform: scale(1.1) !important;
2886
- }
2887
- .trigger.rendered {
2888
- transform: scale(1);
2889
- }
2890
- .trigger.active .trigger-icon {
2891
- opacity: 0;
2892
- transform: rotate(-180deg) scale(0);
2893
- }
2894
- .trigger.active .trigger-close {
2895
- opacity: 1;
2896
- transform: rotate(0deg) scale(1);
2897
- }
2898
-
2899
- .trigger-icon {
2900
- display: inline-block;
2901
- line-height: inherit;
2902
- text-align: center;
2903
- opacity: 1;
2904
- transform: rotate(0deg) scale(1);
2905
- transition:
2906
- opacity 200ms ease-out,
2907
- transform 200ms ease-out;
2908
- color: #ffffff;
2909
- }
2910
- .trigger-close {
2911
- opacity: 0;
2912
- transition: transform 200ms ease-out;
2913
- transform: rotate(180deg) scale(0);
2914
- position: absolute;
2915
- top: 0;
2916
- bottom: 0;
2917
- left: 0;
2918
- right: 0;
2919
- display: flex;
2920
- justify-content: center;
2921
- align-items: center;
2922
- fill: #ffffff;
2923
- }
2924
- `
2925
- ];
2926
- Ut([
2927
- Dt({ attribute: !1 })
2928
- ], j.prototype, "symbol", 2);
2929
- Ut([
2930
- I()
2931
- ], j.prototype, "active", 2);
2932
- Ut([
2933
- I()
2934
- ], j.prototype, "loaded", 2);
2935
- Ut([
2936
- I()
2937
- ], j.prototype, "icon", 2);
2938
- var q = /* @__PURE__ */ ((s) => (s.Inline = "inline", s.Link = "link", s.Badge = "badge", s.Unsupported = "unsupported", s))(q || {});
2939
- const ii = (s, t) => s && t ? "both" : s ? "widgetDOM" : t ? "triggerDOM" : "none", ws = (s) => s ? typeof s == "boolean" && s ? "link" : typeof s == "object" && !Array.isArray(s) ? "badge" : "unsupported" : "inline", ri = (s, t, e, n, i = !1) => y(void 0, null, function* () {
2940
- var h, l;
2941
- const r = ii(
2942
- t,
2943
- e
2944
- ), o = ws(n), a = {
2945
- widgetDOMElement: t ? t.cloneNode(!0) : void 0,
2946
- triggerDOMElement: e ? e.cloneNode(!0) : void 0
2947
- }, c = {
2948
- triggerType: o,
2949
- cachedOriginals: a,
2950
- widgetDOMElement: document.createElement("div")
2951
- };
2952
- switch (r) {
2953
- case "both": {
2954
- c.widgetDOMElement = t || document.createElement("div"), o !== "inline" && (c.triggerDOMElement = e);
2955
- break;
2956
- }
2957
- case "widgetDOM": {
2958
- if (c.widgetDOMElement = t || document.createElement("div"), o !== "inline") {
2959
- const d = document.body.appendChild(
2960
- document.createElement("a")
2961
- );
2962
- o === "link" && (d.innerText = s), c.triggerDOMElement = d;
2963
- }
2964
- break;
2965
- }
2966
- case "triggerDOM": {
2967
- const d = document.createElement("div");
2968
- c.widgetDOMElement = d, o === "inline" ? (d.id = (e == null ? void 0 : e.id) || "", i ? (d.style.display = "none", (h = e == null ? void 0 : e.parentNode) == null || h.appendChild(d), c.callback = () => {
2969
- var u;
2970
- (u = e == null ? void 0 : e.parentNode) == null || u.replaceChild(
2971
- d,
2972
- e
2973
- ), d.style.display = (e == null ? void 0 : e.style.display) || "block";
2974
- }) : (l = e == null ? void 0 : e.parentNode) == null || l.replaceChild(
2975
- d,
2976
- e
2977
- ), c.cachedOriginals.widgetDOMElement = e, c.cachedOriginals.triggerDOMElement = void 0) : (c.widgetDOMElement = document.body.appendChild(d), c.triggerDOMElement = e);
2978
- break;
2979
- }
2980
- case "none": {
2981
- const d = document.body.appendChild(
2982
- document.createElement("div")
2983
- );
2984
- if (c.widgetDOMElement = d, o !== "inline") {
2985
- customElements.get("ace-widget-trigger") || customElements.define("ace-widget-trigger", j);
2986
- const u = document.createElement("ace-widget-trigger");
2987
- u.symbol = n.symbol, document.body.appendChild(u), console.log("Created trigger"), c.triggerDOMElement = u;
2988
- }
2989
- break;
2990
- }
2991
- }
2992
- return c;
2993
- }), oi = "modals";
2994
- class ai {
2995
- constructor(t, e) {
2996
- this.options = e, this.unsubscribe = [], this.container = t.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register(
2997
- "triggerDOMElement",
2998
- this.options.triggerDOMElement
2999
- );
3000
- const n = this.container.get("$widget");
3001
- this.options.widgetDOMElement.classList.add("ace-widget"), this.options.widgetDOMElement.classList.add(`ace-widget_${n.name}`);
3002
- const i = t.get("widgetDOMElements") || [];
3003
- t.register("widgetDOMElements", [
3004
- ...i,
3005
- this.options.widgetDOMElement
3006
- ]);
3007
- }
3008
- /**
3009
- * Renders the view outlet to the DOM.
3010
- */
3011
- render() {
3012
- const { widgetDOMElement: t, triggerDOMElement: e } = this.options, n = this.container.get("$widget");
3013
- return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === q.Badge && Ln(e), import("./render-369a79dd.js").then((i) => i.default(this.container, t)).then(() => {
3014
- if (t.setAttribute("data-rendered", "true"), e && this.options.triggerType === q.Badge) {
3015
- const r = this.options.triggerOptions.openTooltip;
3016
- us(e, r);
3017
- }
3018
- nn(this.container, t);
3019
- const i = this.container.get("$environment").widgets.all();
3020
- k(
3021
- this.container,
3022
- oi,
3023
- m.Session
3024
- ).then((r) => {
3025
- r && r.forEach((o) => {
3026
- i.find(
3027
- (a) => a.name === o.name && a.state === "activated"
3028
- ) && n.events.dispatch("widget:modal-opened", o);
3029
- });
3030
- });
3031
- }));
3032
- }
3033
- renderBadge(t) {
3034
- const { triggerDOMElement: e } = this.options;
3035
- if (!e)
3036
- return;
3037
- e.getAttribute("role") || e.setAttribute("role", "button");
3038
- const { name: n } = this.container.get("$widget"), { label: i, symbol: r, ariaLabel: o, closedTooltip: a, openTooltip: c } = t, h = { closedTooltip: a, openTooltip: c };
3039
- this.options.triggerOptions = h;
3040
- const l = Dn(e, {
3041
- label: i,
3042
- symbol: r,
3043
- ariaLabel: o,
3044
- widgetName: n,
3045
- tooltip: a
3046
- });
3047
- this.unsubscribe.push(l);
3048
- }
3049
- dispose() {
3050
- return y(this, null, function* () {
3051
- var n, i, r, o;
3052
- const { triggerDOMElement: t, widgetDOMElement: e } = this.options;
3053
- this.options.cachedOriginals.widgetDOMElement && e && ((n = e.parentNode) == null || n.replaceChild(
3054
- this.options.cachedOriginals.widgetDOMElement,
3055
- e
3056
- )), this.options.cachedOriginals.triggerDOMElement && t && ((i = t.parentNode) == null || i.replaceChild(
3057
- this.options.cachedOriginals.triggerDOMElement,
3058
- t
3059
- )), this.unsubscribe.forEach((a) => {
3060
- a();
3061
- }), (r = e.parentNode) == null || r.removeChild(e), (o = t == null ? void 0 : t.parentNode) == null || o.removeChild(t);
3062
- });
3063
- }
3064
- }
3065
- const bt = "changesets", ci = (s) => {
3066
- const t = { tags: s.tags };
3067
- return s.context && typeof s.context != "function" && (t.context = s.context), s.properties && typeof s.properties != "function" && (t.properties = s.properties), s.layout && typeof s.layout != "function" && (t.layout = s.layout), t;
3068
- };
3069
- class $e {
3070
- constructor(t, e) {
3071
- this.container = t, this.storageWriter = e;
3072
- }
3073
- static create(t) {
3074
- return M(
3075
- t,
3076
- bt,
3077
- g.Necessary,
3078
- {
3079
- medium: m.Local
3080
- }
3081
- ).then(
3082
- (e) => new $e(t, e)
3083
- );
3084
- }
3085
- write(t, e, n, i) {
3086
- return O(this)(() => k(
3087
- this.container,
3088
- bt,
3089
- m.Local
3090
- ).then((r = {}) => {
3091
- const { keys: o = [], items: a = {} } = r, c = o.indexOf(t);
3092
- return c > -1 && o.splice(c, 1), o.push(t), a[t] = {
3093
- options: i,
3094
- attributes: ci(n),
3095
- rules: e.rules
3096
- }, this.storageWriter({ keys: o, items: a });
3097
- }));
3098
- }
3099
- remove(t) {
3100
- return O(this)(() => k(
3101
- this.container,
3102
- bt,
3103
- m.Local
3104
- ).then((e = {}) => {
3105
- const { keys: n = [], items: i = {} } = e, r = n.indexOf(t);
3106
- if (r > -1)
3107
- return n.splice(r, 1), delete i[t], this.storageWriter(e);
3108
- }));
3109
- }
3110
- load(t) {
3111
- return O(this)(() => k(
3112
- this.container,
3113
- bt,
3114
- m.Local
3115
- ).then((e = {}) => {
3116
- const { keys: n = [], items: i = {} } = e;
3117
- n.forEach((r) => {
3118
- const o = i[r];
3119
- if (o) {
3120
- const { rules: a, attributes: c, options: h } = o;
3121
- t.write({
3122
- attributes: c,
3123
- options: h,
3124
- target: new tt(t, a)
3125
- });
3126
- }
3127
- });
3128
- }));
3129
- }
3130
- }
3131
- const hi = (s) => {
3132
- const { container: t } = s;
3133
- return $e.create(t).then(
3134
- (e) => {
3135
- const n = t.get("$settings"), i = { localStorage: e }, r = new pt(s, i), o = ns(r, n);
3136
- return s.events.subscribe(
3137
- "widget:state-change",
3138
- (a, c) => {
3139
- c.state === ds.Deactivating && o();
3140
- }
3141
- ), r;
3142
- }
3143
- );
3144
- }, li = (s) => Promise.resolve().then(() => wn).then(({ StorageProvider: t }) => new t()), di = (s) => Promise.resolve().then(() => me).then(
3145
- ({ ActionResolver: t }) => new t(s)
3146
- ), ui = (s) => Promise.resolve().then(() => me).then(
3147
- ({ ComponentResolver: t }) => new t(s)
3148
- ), pi = (s) => Promise.resolve().then(() => me).then(() => hi(s.get("$widget"))), re = "$settings", oe = "open", Ye = "activeStickyWidget";
3149
- class Wi extends kn {
3150
- constructor(t) {
3151
- super(t), this.outlets = /* @__PURE__ */ new Map(), this.activated = void 0, this.subs = [], this.handleBootstrapping = (e) => {
3152
- const n = {
3153
- triggerDOMElement: e.sourceDOMElement,
3154
- withRenderState: "storage"
3155
- /* Storage */
3156
- };
3157
- this.container.get("settings").then((i) => {
3158
- const { activate: r } = i;
3159
- (typeof r == "undefined" || r === null || r === !0) && (this.activated = (this.activated || this.widget.activate()).then(
3160
- () => this.attach(n)
3161
- ));
3162
- });
3163
- }, this.container.registerAsync(
3164
- "storage",
3165
- () => li(this.container)
3166
- ), this.container.registerFactory("settings", () => k(
3167
- this.container,
3168
- re,
3169
- m.Local
3170
- ).then((e = {}) => S(S({}, this.container.get("$settings")), e))), An(this, "load", this.handleBootstrapping), this.container.registerAsync(
3171
- "componentResolver",
3172
- () => ui(this.container)
3173
- ), this.container.registerAsync(
3174
- "actionResolver",
3175
- () => di(this.container)
3176
- ), this.container.register("matchMedia", window.matchMedia), this.container.registerAsync(
3177
- "components",
3178
- () => pi(this.container)
3179
- );
3180
- }
3181
- initialize() {
3182
- const t = this.container.getManyAsync(
3183
- "actionResolver",
3184
- "components"
3185
- ), e = this.container.get("csp");
3186
- return e && (window.webprovisionsEnvironmentVariables || (window.webprovisionsEnvironmentVariables = {}), window.webprovisionsEnvironmentVariables.cspNonce = e.nonce), Promise.all([t, this.container.get("settings")]).then(
3187
- ([{ actionResolver: n, components: i }, r]) => (n.subscribe(
3188
- this.widget.name,
3189
- (c, h, l) => this.onAction(h, l)
3190
- ), ((c) => {
3191
- i.nodes.query({ type: "view" }).forEach((h) => {
3192
- i.setSwitch(h, c);
3193
- });
3194
- })("index"), this.events.subscribe("widget:data-loaded", (c, { element: h }) => {
3195
- this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
3196
- element: h
3197
- });
3198
- }), Promise.resolve())
3199
- );
3200
- }
3201
- attach(t = {}) {
3202
- return this.container.get("settings").then((n) => y(this, [n], function* ({ trigger: e }) {
3203
- var p, _;
3204
- const {
3205
- widgetDOMElement: i,
3206
- key: r = os(),
3207
- triggerDOMElement: o,
3208
- withRenderState: a
3209
- } = t, h = ws(e) === q.Inline && ((o == null ? void 0 : o.childElementCount) || 0) > 0, l = yield ri(
3210
- this.widget.name,
3211
- i,
3212
- o,
3213
- e,
3214
- h
3215
- );
3216
- this.outlets.size < 1 && !a && this.setRenderState("unset");
3217
- const d = () => {
3218
- const f = () => C.querySelectorAll("[data-loading=true]").length === 0, [C] = this.widget.container.get("widgetDOMElements"), x = (A, $) => {
3219
- f() && (l.callback && l.callback(), $.disconnect());
3220
- }, mt = {
3221
- attributes: !0,
3222
- subtree: !0,
3223
- childList: !0
3224
- };
3225
- f() && l.callback && l.callback(), new MutationObserver(x).observe(C, mt);
3226
- };
3227
- h && this.widget.container.getAsync("dataClient").then(({ events: f }) => {
3228
- f.subscribe(
3229
- "data-client:fetched",
3230
- (C, x) => {
3231
- x.unresolvedQueries === 0 && d();
3232
- }
3233
- );
3234
- });
3235
- const u = this.getOrCreateViewOutlet(r, l);
3236
- if (this.outlets.set(r, u), this.widget.events.dispatch("widget:attached", {}, { bubbles: !0 }), l.triggerType === q.Badge && e && ((p = l.triggerDOMElement) == null || p.setAttribute(
3237
- "aria-expanded",
3238
- "false"
3239
- ), u == null || u.renderBadge(e)), l.triggerType !== q.Inline && ((_ = l.triggerDOMElement) == null || _.addEventListener(
3240
- "click",
3241
- (f) => {
3242
- f.preventDefault(), this.container.get("settings").then(({ trigger: C }) => {
3243
- u.render().then(() => this.renderState()).then((x) => C && C.action && C.action === "hide" ? x === E.open ? this.hide() : this.open() : x === E.open ? this.close() : this.open());
3244
- });
3245
- }
3246
- )), this.outlets.size > 1)
3247
- return this.renderState().then((f) => {
3248
- this.triggerStateIfApplicable(f);
3249
- });
3250
- if (a)
3251
- return a === "storage" ? this.renderState().then((f) => {
3252
- if (l.triggerType === q.Inline) {
3253
- this.triggerStateIfApplicable("open");
3254
- return;
3255
- }
3256
- this.triggerStateIfApplicable(f);
3257
- }) : this.triggerStateIfApplicable(a);
3258
- }));
3259
- }
3260
- detach(t) {
3261
- if (t) {
3262
- if (this.outlets.has(t)) {
3263
- const e = this.outlets.get(t);
3264
- e == null || e.dispose(), this.outlets.delete(t);
3265
- return;
3266
- }
3267
- process.env.NODE_ENV !== "production" && console.warn(`detach(): Could not find View Outlet with key ${t}`);
3268
- return;
3269
- }
3270
- this.outlets.forEach((e) => {
3271
- e.dispose();
3272
- }), this.outlets.clear();
3273
- }
3274
- triggerStateIfApplicable(t) {
3275
- switch (t) {
3276
- case "closed":
3277
- this.close();
3278
- break;
3279
- case "open":
3280
- this.open();
3281
- break;
3282
- case "hidden":
3283
- this.hide();
3284
- break;
3285
- default:
3286
- return;
3287
- }
3288
- }
3289
- getOrCreateViewOutlet(t, e) {
3290
- return this.outlets.has(t) ? this.outlets.get(t) : new ai(this.container, e);
3291
- }
3292
- render(t = {}) {
3293
- if (process.env.NODE_ENV !== "production" && console.warn(
3294
- "widget.render() is deprecated. Use widget.attach() instead."
3295
- ), t.open) {
3296
- const e = st(S({}, t), {
3297
- withRenderState: "open"
3298
- /* Open */
3299
- });
3300
- return this.attach(e);
3301
- }
3302
- return this.attach(t);
3303
- }
3304
- activate(t) {
3305
- t != null && t.override && this.setSettings(() => t.override), t != null && t.apiNotificationPriorityBy && this.container.register(
3306
- "apiNotificationPriorityBy",
3307
- t.apiNotificationPriorityBy
3308
- );
3309
- }
3310
- setSettings(t) {
3311
- return Promise.all([
3312
- this.container.get("settings"),
3313
- M(
3314
- this.container,
3315
- re,
3316
- g.Necessary,
3317
- {
3318
- medium: m.Local
3319
- }
3320
- )
3321
- ]).then(([e, n]) => Promise.resolve(t(e)).then((i) => n(i).then(() => {
3322
- const r = S(S({}, e), i);
3323
- return this.widget.events.dispatch("widget:settings-updated", r), r;
3324
- })));
3325
- }
3326
- clearSettings() {
3327
- return M(
3328
- this.container,
3329
- re,
3330
- g.Necessary,
3331
- { medium: m.Local }
3332
- ).then((t) => t()).then(() => this.container.get("settings")).then((t) => {
3333
- this.widget.events.dispatch("widget:settings-updated", t);
3334
- });
3335
- }
3336
- action({ action: t, value: e }) {
3337
- return this.container.getAsync("actionResolver").then((n) => {
3338
- n.action(this.widget.name, t, e);
3339
- });
3340
- }
3341
- renderState() {
3342
- return (() => k(
3343
- this.container,
3344
- oe,
3345
- m.Session
3346
- ).then((e = E.closed) => e))();
3347
- }
3348
- hide() {
3349
- return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
3350
- "hide(): No-op as no view outlets are registered. Invoke the attach() command first."
3351
- ), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "hide" }).then(() => {
3352
- this.setTriggerState(!1);
3353
- }));
3354
- }
3355
- open() {
3356
- return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
3357
- "open(): No-op as no view outlets are registered. Invoke the attach() command first."
3358
- ), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "open" }).then(() => (this.widget.events.dispatch("tracking:widget-rendered", {}), this.onOpen())));
3359
- }
3360
- close() {
3361
- return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
3362
- "close(): No-op as no view outlets are registered. Invoke the attach() command first."
3363
- ), Promise.resolve()) : this.action({ action: "close" }).then(() => this.onClose());
3364
- }
3365
- show() {
3366
- return process.env.NODE_ENV !== "production" && console.warn(
3367
- "show(): Command is deprecated and will be removed in the future. Use open() instead."
3368
- ), this.open();
3369
- }
3370
- onAction(t, e) {
3371
- switch (t) {
3372
- case "close":
3373
- case "open":
3374
- case "hide":
3375
- const n = t === "open" ? E.open : t === "close" ? E.closed : E.hidden;
3376
- return this.setRenderState(n).then(() => {
3377
- this.setTriggerState(n === E.open), n !== E.hidden ? n === E.open ? this.onOpen() : this.onClose() : this.outlets.forEach(
3378
- (i) => {
3379
- var r;
3380
- return (r = i.options.triggerDOMElement) == null ? void 0 : r.setAttribute(
3381
- "aria-expanded",
3382
- "false"
3383
- );
3384
- }
3385
- );
3386
- });
3387
- }
3388
- }
3389
- setRenderState(t) {
3390
- const { invoke: e, events: n } = this.container.get("$widget");
3391
- return Promise.all([
3392
- M(
3393
- this.container,
3394
- oe,
3395
- g.Necessary,
3396
- {
3397
- medium: m.Session
3398
- }
3399
- ),
3400
- M(
3401
- this.container,
3402
- oe,
3403
- g.Necessary,
3404
- {
3405
- medium: m.Local,
3406
- duration: { minutes: 5 }
3407
- }
3408
- ),
3409
- e("renderState")
3410
- ]).then(([i, r, o]) => {
3411
- t === "unset" || !t ? (r(), i()) : i(t), n.dispatch("widget:render-state-changed", {
3412
- previous: o,
3413
- next: t
3414
- });
3415
- });
3416
- }
3417
- onOpen() {
3418
- return this.outlets.forEach(
3419
- (t) => {
3420
- var e;
3421
- return (e = t.options.triggerDOMElement) == null ? void 0 : e.setAttribute("aria-expanded", "true");
3422
- }
3423
- ), Promise.resolve();
3424
- }
3425
- onClose() {
3426
- const t = this.container.getManyAsync("components");
3427
- return (() => this.container.get("settings").then((n) => {
3428
- const { activate: i } = this.container.get("$settings");
3429
- return n.activate !== i ? this.setSettings(() => Promise.resolve({ activate: i })) : Promise.resolve();
3430
- }))().then(() => t).then(
3431
- ({ components: n }) => {
3432
- this.outlets.forEach(
3433
- (i) => {
3434
- var r;
3435
- return (r = i.options.triggerDOMElement) == null ? void 0 : r.setAttribute(
3436
- "aria-expanded",
3437
- "false"
3438
- );
3439
- }
3440
- );
3441
- }
3442
- );
3443
- }
3444
- setTriggerState(t) {
3445
- this.outlets.forEach((e) => {
3446
- const {
3447
- options: { triggerDOMElement: n, triggerOptions: i }
3448
- } = e, { openTooltip: r, closedTooltip: o } = i || {};
3449
- n && (t ? us(n, r) : Mn(n, o));
3450
- });
3451
- }
3452
- deactivate() {
3453
- this.subs.forEach((e) => e());
3454
- const t = [];
3455
- return this.outlets.forEach((e) => t.push(e.dispose())), k(
3456
- this.container,
3457
- Ye,
3458
- m.Local
3459
- ).then((e) => e === this.widget.name ? M(
3460
- this.container,
3461
- Ye,
3462
- g.Necessary,
3463
- {
3464
- medium: m.Local,
3465
- scope: et.Implementation
3466
- }
3467
- ).then((n) => n()).then(() => Promise.all(t)) : Promise.all(t));
3468
- }
3469
- }
3470
- /**
3471
- * @license
3472
- * Copyright 2021 Google LLC
3473
- * SPDX-License-Identifier: BSD-3-Clause
3474
- */
3475
- let $s = class extends Event {
3476
- constructor(t, e, n) {
3477
- super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.callback = e, this.subscribe = n != null && n;
3478
- }
3479
- };
3480
- /**
3481
- * @license
3482
- * Copyright 2021 Google LLC
3483
- * SPDX-License-Identifier: BSD-3-Clause
3484
- */
3485
- /**
3486
- * @license
3487
- * Copyright 2021 Google LLC
3488
- * SPDX-License-Identifier: BSD-3-Clause
3489
- */
3490
- let gi = class {
3491
- constructor(t, e, n, i) {
3492
- var r;
3493
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (o, a) => {
3494
- this.unsubscribe && (this.unsubscribe !== a && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = o, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(o, a)), this.unsubscribe = a;
3495
- }, this.host = t, e.context !== void 0) {
3496
- const o = e;
3497
- this.context = o.context, this.callback = o.callback, this.subscribe = (r = o.subscribe) !== null && r !== void 0 && r;
3498
- } else
3499
- this.context = e, this.callback = n, this.subscribe = i != null && i;
3500
- this.host.addController(this);
3501
- }
3502
- hostConnected() {
3503
- this.dispatchRequest();
3504
- }
3505
- hostDisconnected() {
3506
- this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
3507
- }
3508
- dispatchRequest() {
3509
- this.host.dispatchEvent(new $s(this.context, this.t, this.subscribe));
3510
- }
3511
- };
3512
- /**
3513
- * @license
3514
- * Copyright 2021 Google LLC
3515
- * SPDX-License-Identifier: BSD-3-Clause
3516
- */
3517
- class mi {
3518
- constructor(t) {
3519
- this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
3520
- for (const [e, { disposer: n }] of this.subscriptions)
3521
- e(this.o, n);
3522
- }, t !== void 0 && (this.value = t);
3523
- }
3524
- get value() {
3525
- return this.o;
3526
- }
3527
- set value(t) {
3528
- this.setValue(t);
3529
- }
3530
- setValue(t, e = !1) {
3531
- const n = e || !Object.is(t, this.o);
3532
- this.o = t, n && this.updateObservers();
3533
- }
3534
- addCallback(t, e, n) {
3535
- if (!n)
3536
- return void t(this.value);
3537
- this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
3538
- this.subscriptions.delete(t);
3539
- }, consumerHost: e });
3540
- const { disposer: i } = this.subscriptions.get(t);
3541
- t(this.value, i);
3542
- }
3543
- clearCallbacks() {
3544
- this.subscriptions.clear();
3545
- }
3546
- }
3547
- /**
3548
- * @license
3549
- * Copyright 2021 Google LLC
3550
- * SPDX-License-Identifier: BSD-3-Clause
3551
- */
3552
- class fi extends Event {
3553
- constructor(t) {
3554
- super("context-provider", { bubbles: !0, composed: !0 }), this.context = t;
3555
- }
3556
- }
3557
- class it extends mi {
3558
- constructor(t, e, n) {
3559
- super(e.context !== void 0 ? e.initialValue : n), this.onContextRequest = (i) => {
3560
- const r = i.composedPath()[0];
3561
- i.context === this.context && r !== this.host && (i.stopPropagation(), this.addCallback(i.callback, r, i.subscribe));
3562
- }, this.onProviderRequest = (i) => {
3563
- const r = i.composedPath()[0];
3564
- if (i.context === this.context && r !== this.host) {
3565
- for (const [o, { consumerHost: a }] of this.subscriptions)
3566
- a.dispatchEvent(new $s(this.context, o, !0));
3567
- i.stopPropagation();
3568
- }
3569
- }, this.host = t, e.context !== void 0 ? this.context = e.context : this.context = e, this.attachListeners(), this.host.addController(this);
3570
- }
3571
- attachListeners() {
3572
- this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
3573
- }
3574
- hostConnected() {
3575
- this.host.dispatchEvent(new fi(this.context));
3576
- }
3577
- }
3578
- /**
3579
- * @license
3580
- * Copyright 2022 Google LLC
3581
- * SPDX-License-Identifier: BSD-3-Clause
3582
- */
3583
- function vi({ context: s, subscribe: t }) {
3584
- return Zn({ finisher: (e, n) => {
3585
- e.addInitializer((i) => {
3586
- new gi(i, { context: s, callback: (r) => {
3587
- i[n] = r;
3588
- }, subscribe: t });
3589
- });
3590
- } });
3591
- }
3592
- const yi = "children", bi = "descriptor", wi = "container", $i = "context", _i = "layout", Ci = "properties";
3593
- class Ei {
3594
- constructor(t) {
3595
- (this.host = t).addController(this);
3596
- }
3597
- hostConnected() {
3598
- }
3599
- hostDisconnected() {
3600
- }
3601
- setDescriptor(t) {
3602
- this._descriptor = t;
3603
- }
3604
- setContainer(t) {
3605
- this._container = t;
3606
- }
3607
- dispatch(t, e) {
3608
- return y(this, null, function* () {
3609
- if (!this._container || !this._descriptor)
3610
- return;
3611
- const n = yield pt.getInstance(
3612
- this._container
3613
- ), i = new tt(n).withId(
3614
- this._descriptor.id
3615
- );
3616
- yield n.actions(
3617
- i,
3618
- this._descriptor.type || os()
3619
- ).dispatch(t, e);
3620
- });
3621
- }
3622
- }
3623
- const Ai = (s, t) => y(void 0, null, function* () {
3624
- const e = s.properties().provider;
3625
- let n = {}, i = "";
3626
- Array.isArray(e) ? (i = e[0], n = e[1]) : i = e || "";
3627
- const r = yield t.getAsync(i);
3628
- if (!r)
3629
- throw new Error("No provider defined in ListComponent");
3630
- return r.applyComponentNodeSettings(s.node.id, n), { provider: r, settings: n };
3631
- }), Ji = (s, t) => y(void 0, null, function* () {
3632
- const { provider: e, settings: n = {} } = yield Ai(s, t);
3633
- return {
3634
- addResource: (i, r) => e.addResource(i, r),
3635
- getData: (i, r) => e.getData(i, r, n)
3636
- };
3637
- });
3638
- class Oi {
3639
- constructor(t) {
3640
- this.container = t, this.resources = /* @__PURE__ */ new Map(), this.nodeConfiguration = /* @__PURE__ */ new Map();
3641
- }
3642
- getData(t, e, n) {
3643
- return y(this, null, function* () {
3644
- const i = this.resources.get(t);
3645
- if (!i)
3646
- throw new Error(`Unable to get EntityProvider for "${t}"`);
3647
- return yield i.query(e, n);
3648
- });
3649
- }
3650
- addResource(t, e) {
3651
- this.resources.set(t, e);
3652
- }
3653
- applyComponentNodeSettings(t, e) {
3654
- this.nodeConfiguration.set(t, e);
3655
- }
3656
- }
3657
- const Ze = (s) => ({
3658
- title: s.Title,
3659
- id: s.Id.toString()
3660
- });
3661
- class xi extends Oi {
3662
- constructor(t) {
3663
- super(t), this.addResource("item", {
3664
- query: (e, n) => y(this, null, function* () {
3665
- const i = e.itemId, r = "78aacc09-ae6f-5485-5ca3-9dacebb95825", o = t.get("$widget").name, a = n.projection || "", h = yield (yield fetch(
3666
- `${a}/guides/${i}?client=${r}&funnel=${o}&site=%2F%2Fdemo.humany.cc%2Fadmin%2Finterfaces&phrase=&connectionId=&p.LastGuideId=2857`
3667
- )).json();
3668
- return h ? Ze(h) : null;
3669
- })
3670
- }), this.addResource("items", {
3671
- query: (e, n) => y(this, null, function* () {
3672
- const i = "", r = t.get("$widget").name, o = n.projection || "", d = yield (yield fetch(
3673
- `${o}/guides?client=${i}&funnel=${r}&site=&phrase=&skip=0&take=10&sorting.type=popularity&sorting.direction=descending`
3674
- )).json();
3675
- return {
3676
- items: (d.Matches || []).map((u) => Ze(u)),
3677
- totalItems: (d == null ? void 0 : d.TotalMatches) || 0
3678
- };
3679
- })
3680
- });
3681
- }
3682
- }
3683
- const Fi = (s) => y(void 0, null, function* () {
3684
- s.registerAsync("guideProvider", () => new xi(s));
3685
- }), Ki = (s, t, e, n, i) => s.getAsync("componentResolver").then((r) => (r.registerComponent(t, e), is(s, t, n || (() => {
3686
- }), t, i))), b = (s, t, e) => {
3687
- s && e.style.setProperty(t, s);
3688
- }, Si = (s, t) => {
3689
- var e, n, i, r, o, a, c, h, l, d, u;
3690
- b((e = s.colors) == null ? void 0 : e.primary, "--primary-color", t), b((n = s.colors) == null ? void 0 : n.secondary, "--secondary-color", t), b((i = s.colors) == null ? void 0 : i.text, "--text-color", t), b((r = s.colors) == null ? void 0 : r.link, "--link-color", t), b((o = s.colors) == null ? void 0 : o.gray, "--gray-color", t), b((a = s.colors) == null ? void 0 : a.grayDark, "--gray-dark-color", t), b((c = s.spacing) == null ? void 0 : c.xs, "--spacing-xs", t), b((h = s.spacing) == null ? void 0 : h.sm, "--spacing-sm", t), b((l = s.spacing) == null ? void 0 : l.md, "--spacing-md", t), b((d = s.spacing) == null ? void 0 : d.lg, "--spacing-lg", t), b((u = s.spacing) == null ? void 0 : u.xl, "--spacing-xl", t), b(s.boxShadow, "--box-shadow", t), b(s.borderRadius, "--border-radius", t), b(s.borderRadiusSm, "--border-radius-sm", t), b(s.fontFamily, "--font-family", t);
3691
- }, Pi = (s) => {
3692
- const t = {};
3693
- return Object.keys(s).forEach((e) => {
3694
- e.indexOf("css-") > -1 && (t[e] = s[e]);
3695
- }), t;
3696
- }, ki = (s, t) => {
3697
- const e = Pi(t);
3698
- Object.entries(e).forEach(([n, i]) => {
3699
- s.style.setProperty(n.replace("css-", ""), i);
3700
- });
3701
- };
3702
- var Ni = Object.defineProperty, Di = Object.getOwnPropertyDescriptor, U = (s, t, e, n) => {
3703
- for (var i = n > 1 ? void 0 : n ? Di(t, e) : t, r = s.length - 1, o; r >= 0; r--)
3704
- (o = s[r]) && (i = (n ? o(t, e, i) : o(i)) || i);
3705
- return n && i && Ni(t, e, i), i;
3706
- };
3707
- const Gi = (s) => {
3708
- var e;
3709
- class t extends s {
3710
- constructor() {
3711
- super(...arguments), this.entry = "", this._descriptorProvider = new it(
3712
- this,
3713
- bi,
3714
- void 0
3715
- ), this._childrenProvider = new it(this, yi, []), this._propertiesProvider = new it(this, Ci, {}), this._contextProvider = new it(this, $i, {}), this._layoutProvider = new it(this, _i, {}), this.actions = new Ei(this), this.context = {}, this.layout = {}, this.properties = {};
3716
- }
3717
- connectedCallback() {
3718
- super.connectedCallback(), this.container && (this.actions.setContainer(this.container), pt.getInstance(this.container).then(
3719
- (i) => y(this, null, function* () {
3720
- var o;
3721
- const r = i.nodes.get(this.entry);
3722
- if (r) {
3723
- this._propertyChangeListener = i.events.subscribe(
3724
- "components:properties-changed",
3725
- (d, u) => {
3726
- r.id === u.node.id && this._setProperties(u.node.attributes.properties);
3727
- }
3728
- ), this._contextChangeListener = i.events.subscribe(
3729
- "components:context-changed",
3730
- (d, u) => {
3731
- r.id === u.node.id && this._setContext(u.node.attributes.context);
3732
- }
3733
- ), this._layoutChangeListener = i.events.subscribe(
3734
- "components:layout-changed",
3735
- (d, u) => {
3736
- r.id === u.node.id && this._setLayout(u.node.attributes.layout);
3737
- }
3738
- );
3739
- const a = "default";
3740
- this._unmountNode = r.mount(this.container), this._setDescriptor(ce(r, a)), this._setProperties(r.attributes.properties), this._setContext(r.attributes.context), this._setLayout(this.layout);
3741
- const c = r.getChildren(a).map((d) => ce(d));
3742
- this._childrenProvider.setValue(c);
3743
- const l = (yield this.container.getAsync("componentResolver")).getComponent(
3744
- ((o = this.descriptor) == null ? void 0 : o.type) || ""
3745
- );
3746
- l.then && l.then((d) => {
3747
- this.component = d.default;
3748
- });
3749
- }
3750
- })
3751
- ));
3752
- }
3753
- disconnectedCallback() {
3754
- super.disconnectedCallback(), this._propertyChangeListener && this._propertyChangeListener(), this._contextChangeListener && this._contextChangeListener(), this._layoutChangeListener && this._layoutChangeListener(), this._unmountNode && this._unmountNode();
3755
- }
3756
- updated() {
3757
- this.container && this.actions.setContainer(this.container), Si(this.context, this.renderRoot.host), this.renderRoot.host.style.setProperty(
3758
- "--width",
3759
- this.layout.size === "full" ? "var(--columns, 1)" : `min(${this.layout.size || "var(--columns)"}, var(--columns))`
3760
- ), ki(this.renderRoot.host, this.properties);
3761
- }
3762
- _setProperties(i) {
3763
- this._propertiesProvider.setValue(i), this.properties = i;
3764
- }
3765
- _setContext(i) {
3766
- this._contextProvider.setValue(i), this.context = i;
3767
- }
3768
- _setLayout(i) {
3769
- this._layoutProvider.setValue(i), this.layout = i;
3770
- }
3771
- _setDescriptor(i) {
3772
- this.descriptor = i, this._descriptorProvider.setValue(i), this.actions.setDescriptor(i);
3773
- }
3774
- }
3775
- return t.styles = [
3776
- (e = s.styles) != null ? e : [],
3777
- gs`
3778
- :host {
3779
- font-family: var(--font-family);
3780
- grid-column: span var(--width);
3781
- max-width: 100%;
3782
- overflow: hidden;
3783
- box-sizing: border-box;
3784
- display: block;
3785
- }
3786
- * {
3787
- box-sizing: border-box;
3788
- }
3789
- `
3790
- ], U([
3791
- vi({ context: wi }),
3792
- Dt({ attribute: !1 })
3793
- ], t.prototype, "container", 2), U([
3794
- Dt()
3795
- ], t.prototype, "entry", 2), U([
3796
- I()
3797
- ], t.prototype, "descriptor", 2), U([
3798
- I()
3799
- ], t.prototype, "component", 2), U([
3800
- I()
3801
- ], t.prototype, "context", 2), U([
3802
- I()
3803
- ], t.prototype, "layout", 2), U([
3804
- I()
3805
- ], t.prototype, "properties", 2), t;
3806
- };
3807
- export {
3808
- v as A,
3809
- Oi as D,
3810
- Fi as G,
3811
- pt as T,
3812
- Gi as W,
3813
- it as a,
3814
- gs as b,
3815
- wi as c,
3816
- I as d,
3817
- Xn as e,
3818
- F as f,
3819
- ki as g,
3820
- Wi as h,
3821
- ti as i,
3822
- yi as j,
3823
- bi as k,
3824
- $i as l,
3825
- Si as m,
3826
- Dt as n,
3827
- _i as o,
3828
- Ci as p,
3829
- E as q,
3830
- Ei as r,
3831
- at as s,
3832
- Qn as t,
3833
- Ji as u,
3834
- Ki as v,
3835
- yt as x
3836
- };
3837
- //# sourceMappingURL=index-bd7f8b31.js.map