@telia-ace/widget-types-grid 1.0.30-experimental.5 → 1.0.30-experimental.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1465 @@
1
+ var ee = Object.defineProperty, ne = Object.defineProperties;
2
+ var se = Object.getOwnPropertyDescriptors;
3
+ var nt = Object.getOwnPropertySymbols;
4
+ var Ot = Object.prototype.hasOwnProperty, Nt = Object.prototype.propertyIsEnumerable;
5
+ var xt = (n, t, e) => t in n ? ee(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, f = (n, t) => {
6
+ for (var e in t || (t = {}))
7
+ Ot.call(t, e) && xt(n, e, t[e]);
8
+ if (nt)
9
+ for (var e of nt(t))
10
+ Nt.call(t, e) && xt(n, e, t[e]);
11
+ return n;
12
+ }, w = (n, t) => ne(n, se(t));
13
+ var D = (n, t) => {
14
+ var e = {};
15
+ for (var s in n)
16
+ Ot.call(n, s) && t.indexOf(s) < 0 && (e[s] = n[s]);
17
+ if (n != null && nt)
18
+ for (var s of nt(n))
19
+ t.indexOf(s) < 0 && Nt.call(n, s) && (e[s] = n[s]);
20
+ return e;
21
+ };
22
+ var St = (n, t, e) => new Promise((s, i) => {
23
+ var o = (a) => {
24
+ try {
25
+ u(e.next(a));
26
+ } catch (c) {
27
+ i(c);
28
+ }
29
+ }, r = (a) => {
30
+ try {
31
+ u(e.throw(a));
32
+ } catch (c) {
33
+ i(c);
34
+ }
35
+ }, u = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(o, r);
36
+ u((e = e.apply(n, t)).next());
37
+ });
38
+ import { Grid as Bt, useRouteData as ie, useRouter as oe, useProperties as jt, useContext as $t, useContainer as X, useComponentNode as wt, useScroll as Wt, transitionComposer as re, paddedBorderTabStyle as ae, useComponent as ce, useComponentDescriptor as le, filterCssPropsStyle as ue, Typography as he, useComponentPlatform as Ut, useIsMounted as de, useColumns as pe, useLayout as me, ComponentNodeContext as fe, ComponentPropertyContext as ge, filterCssProps as ye } from "@telia-ace/widget-ui";
39
+ import m, { useState as q, forwardRef as Ft, useMemo as ve, Suspense as be, useEffect as Y } from "react";
40
+ import { css as Gt, ThemeProvider as $e, useTheme as we } from "@emotion/react";
41
+ import { asDescriptor as ot, ComponentPlatform as Kt, createComponentModel as Ae, ComponentQuery as _e, WidgetRenderState as E } from "@telia-ace/widget-core";
42
+ import H from "@emotion/styled";
43
+ import { appendClassNames as rt, notifyDataLoaded as Ee, lock as mt, removeNullAndUndefinedValues as Mt, uuid as Ce } from "@telia-ace/widget-utilities";
44
+ import { TransitionGroup as xe, Transition as Oe } from "react-transition-group";
45
+ import { Switch as Ne, Route as ft } from "react-router";
46
+ import { spread as Se } from "@open-wc/lit-helpers";
47
+ import { nothing as Me, css as De, LitElement as Pe } from "lit";
48
+ import { onWidgetUrl as Le } from "@telia-ace/widget-routing";
49
+ import { readStorage as L, StorageMedium as A, createStorageWriter as z, StorageCategory as B, StorageScope as ke } from "@telia-ace/widget-services";
50
+ import { supportBootstrapping as Re } from "@webprovisions/bootstrapping";
51
+ import { WidgetState as Te, WidgetType as He } from "@webprovisions/platform";
52
+ var bt = /* @__PURE__ */ ((n) => (n.back = "back", n.forth = "forth", n))(bt || {});
53
+ const Ie = (n, t, e) => typeof e[n] == "number" && typeof e[t] == "number" && e[n] > e[t] ? "back" : "forth", Ve = ({ views: n, location: t, render: e }) => /* @__PURE__ */ m.createElement(
54
+ Ne,
55
+ {
56
+ location: t && w(f({}, t), {
57
+ pathname: t.pathname.split("?")[0]
58
+ })
59
+ },
60
+ [
61
+ ...Object.keys(n).filter((s) => !!n[s].path),
62
+ ...Object.keys(n).filter((s) => !n[s].path)
63
+ ].map((s) => {
64
+ const { path: i } = n[s];
65
+ return i ? Array.isArray(i) ? i.map((o) => /* @__PURE__ */ m.createElement(ft, { key: s, exact: !0, path: o, render: () => e(s) })) : /* @__PURE__ */ m.createElement(ft, { key: s, exact: !0, path: i, render: () => e(s) }) : /* @__PURE__ */ m.createElement(ft, { key: s, render: () => e(s) });
66
+ })
67
+ ), qt = Ve, ze = H.div`
68
+ position: relative;
69
+ width: 100%;
70
+ flex: 1;
71
+ `, Be = H(Bt)`
72
+ position: absolute;
73
+ left: 0;
74
+ right: 0;
75
+ ${(n) => !!n.animationCss && n.animationCss}
76
+ ${(n) => !!n.scrollableCss && n.scrollableCss}
77
+ `, je = {
78
+ index: 1,
79
+ search: 2,
80
+ browse: 3,
81
+ guide: 4,
82
+ contact: 5,
83
+ "contact-method": 6,
84
+ conversation: 7
85
+ }, We = (e) => {
86
+ var s = e, { className: n = "" } = s, t = D(s, ["className"]);
87
+ const [i, o] = q("index"), [r, u] = q(bt.forth), a = ie(), c = oe(), d = jt(), l = $t(), h = X(), p = wt(), { gap: g = "0" } = l, et = d, { columns: y = 1, animation: v = "none", scrollable: _ = !1 } = et, x = D(et, ["columns", "animation", "scrollable"]), [tt, k] = Wt(_);
88
+ if (!p || !c)
89
+ return null;
90
+ const { location: Ct } = c;
91
+ a.name !== i && a.name !== "" && v && (u(Ie(i, a.name, je)), o(a.name));
92
+ const { views: O } = h.get("$settings");
93
+ if (!Object.keys(O).length)
94
+ return null;
95
+ const N = ($, M, V) => {
96
+ const C = pt(M, V), G = p.getChildren($)[0];
97
+ return /* @__PURE__ */ m.createElement(
98
+ Be,
99
+ w(f(w(f(f({}, t), x), {
100
+ scrollableCss: tt,
101
+ ref: k,
102
+ columns: y,
103
+ gap: g
104
+ }), C), {
105
+ className: rt(n, "humany-view")
106
+ }),
107
+ /* @__PURE__ */ m.createElement(At, { id: G.id, branch: "default" })
108
+ );
109
+ }, pt = ($, M) => {
110
+ if (v === "slide" || v === "fade")
111
+ return {
112
+ animationCss: re.composeViewTransition(
113
+ $,
114
+ v,
115
+ M
116
+ ),
117
+ ["data-state"]: $
118
+ };
119
+ };
120
+ return /* @__PURE__ */ m.createElement(ze, { className: "humany-animated-view" }, /* @__PURE__ */ m.createElement(
121
+ xe,
122
+ {
123
+ component: null,
124
+ childFactory: ($) => m.cloneElement($, { direction: r })
125
+ },
126
+ /* @__PURE__ */ m.createElement(
127
+ Oe,
128
+ {
129
+ key: i,
130
+ timeout: { enter: 500, exit: 500 },
131
+ onEnter: ($) => $ == null ? void 0 : $.clientHeight,
132
+ unmountOnExit: !0,
133
+ direction: bt.forth
134
+ },
135
+ ($, { direction: M }) => /* @__PURE__ */ m.createElement(
136
+ qt,
137
+ {
138
+ views: O,
139
+ location: Ct,
140
+ render: (V) => N(V, $, M)
141
+ }
142
+ )
143
+ )
144
+ ));
145
+ }, Ue = We, Fe = H(Bt)`
146
+ ${(n) => !!n.scrollableCss && n.scrollableCss}
147
+ `, Ge = (e) => {
148
+ var s = e, { className: n = "" } = s, t = D(s, ["className"]);
149
+ const i = jt(), o = $t(), r = X(), u = wt(), { views: a } = r.get("$settings"), { gap: c = "0" } = o, v = i, { columns: d = 1, animation: l = "none", scrollable: h = !1 } = v, p = D(v, ["columns", "animation", "scrollable"]), [g, y] = Wt(h);
150
+ return u ? /* @__PURE__ */ m.createElement(
151
+ Fe,
152
+ w(f(f({}, t), p), {
153
+ scrollableCss: g,
154
+ ref: y,
155
+ columns: d,
156
+ gap: c,
157
+ className: rt(n, "humany-view")
158
+ }),
159
+ /* @__PURE__ */ m.createElement(
160
+ qt,
161
+ {
162
+ views: a,
163
+ render: (_) => {
164
+ const x = u.getChildren(_)[0];
165
+ return /* @__PURE__ */ m.createElement(At, { id: x.id, node: x, branch: "default" });
166
+ }
167
+ }
168
+ )
169
+ ) : null;
170
+ }, Ke = Ge, lt = (n) => {
171
+ var t, e;
172
+ return Gt`
173
+ outline: none;
174
+ box-sizing: border-box;
175
+ * {
176
+ box-sizing: border-box;
177
+ outline: none;
178
+ }
179
+
180
+ grid-column: ${n["data-indent"] ? `${n["data-indent"] + 1} / ${n["data-indent"] + (n["data-width"] || 0) + 1}` : `span ${n["data-width"]}`};
181
+
182
+ ${((t = n.theme.fonts) == null ? void 0 : t.type) && `
183
+ font-family: ${n.theme.fonts.type};
184
+
185
+ input, textarea {
186
+ font-family: ${n.theme.fonts.type};
187
+ }
188
+ `}
189
+
190
+ ${((e = n.theme.fonts) == null ? void 0 : e.base) && `
191
+ font-size: ${n.theme.fonts.base};
192
+ `}
193
+
194
+ &:focus-visible {
195
+ ${ae(n)};
196
+ }
197
+ `;
198
+ }, qe = H(Ke)`
199
+ ${(n) => lt(n)}
200
+ `, Ye = H(Ue)`
201
+ ${(n) => lt(n)}
202
+ `, Ze = H.div`
203
+ text-align: center;
204
+ ${(n) => {
205
+ var t, e, s;
206
+ return typeof ((t = n.theme.colors) == null ? void 0 : t.warning) != "undefined" && Gt`
207
+ color: ${(e = n.theme.colors) == null ? void 0 : e.warning};
208
+ border: 2px dashed ${(s = n.theme.colors) == null ? void 0 : s.warning};
209
+ `;
210
+ }}
211
+ ${(n) => typeof n.theme.borderRadius != "undefined" && `border-radius: ${n.theme.borderRadius};`}
212
+ ${(n) => lt(n)}
213
+ `, Qe = Ft(
214
+ (i, s) => {
215
+ var o = i, { className: n = "", children: t } = o, e = D(o, ["className", "children"]);
216
+ const r = ce(), { name: u, type: a, id: c } = le(), d = ve(() => r ? H(r)`
217
+ ${lt}
218
+ ${ue}
219
+ ` : null, [r]);
220
+ return typeof r == "undefined" ? null : r === null || d === null ? process.env.NODE_ENV !== "production" ? /* @__PURE__ */ m.createElement(
221
+ Ze,
222
+ w(f({}, e), {
223
+ title: `type: ${a}, definition-id: ${u}, instance-id: ${c}`,
224
+ className: rt(n, "humany-non-resolved-component")
225
+ }),
226
+ /* @__PURE__ */ m.createElement(he, { variant: "h5" }, "Non Resolved Component Type")
227
+ ) : null : /* @__PURE__ */ m.createElement(be, { fallback: null }, /* @__PURE__ */ m.createElement(
228
+ d,
229
+ w(f({
230
+ ref: s
231
+ }, e), {
232
+ className: rt(
233
+ n,
234
+ "humany-component",
235
+ `humany-component-${u}`
236
+ )
237
+ }),
238
+ t
239
+ ));
240
+ }
241
+ ), Je = Qe, Xe = (n) => {
242
+ const t = wt(n), e = Ut(), [s, i] = q({}), o = de();
243
+ return Y(() => {
244
+ t && o.current && i(t.attributes.properties);
245
+ }, [t, n, o]), Y(() => {
246
+ if (e) {
247
+ const r = e.events.subscribe(
248
+ "components:properties-changed",
249
+ (u, a) => {
250
+ t === a.node && o.current && i(a.node.attributes.properties);
251
+ }
252
+ );
253
+ return () => {
254
+ r();
255
+ };
256
+ }
257
+ }, [e, o, n, t]), s;
258
+ }, tn = (n, t) => t ? !0 : typeof n == "string" ? n === "full" : n > 0, en = Ft(
259
+ (c, a) => {
260
+ var d = c, { className: n = "", id: t, branch: e, node: s, ariaLabel: i, tabIndex: o, context: r } = d, u = D(d, ["className", "id", "branch", "node", "ariaLabel", "tabIndex", "context"]);
261
+ const l = Ut(), h = X(), [p, g] = q(), y = pe(), v = $t(t), _ = Xe(t), { size: x = "none", indent: tt = 0 } = me(t), k = tn(x, s);
262
+ if (Y(() => {
263
+ if (l) {
264
+ if (t && !s) {
265
+ const C = l.nodes.get(t);
266
+ if (C && (g(ot(C, e)), k)) {
267
+ const G = C.mount(h);
268
+ return () => {
269
+ G();
270
+ };
271
+ }
272
+ } else if (s) {
273
+ g(ot(s, e));
274
+ const C = s.mount(h);
275
+ return () => {
276
+ C();
277
+ };
278
+ }
279
+ }
280
+ }, [l, t, s, k]), !p || !k)
281
+ return null;
282
+ const V = f(f({}, v), r || {}), {
283
+ cardinal: O,
284
+ fonts: N = {},
285
+ accessibility: pt = {}
286
+ } = V, et = D(V, [
287
+ "cardinal",
288
+ "fonts",
289
+ "accessibility"
290
+ ]), $ = {
291
+ type: N.type,
292
+ base: N.base || "16px",
293
+ small: N.small || "0.8em",
294
+ normal: N.normal || "1em",
295
+ medium: N.medium || "1.2em",
296
+ large: N.large || "1.6em",
297
+ huge: N.huge || "2.5em"
298
+ }, M = w(f({}, et), {
299
+ fonts: $,
300
+ accessibility: f({}, pt)
301
+ });
302
+ return typeof O == "number" && (M.sizes = {
303
+ cardinal: O,
304
+ small: `${O}px`,
305
+ normal: `${O * 3}px`,
306
+ medium: `${O * 5}px`,
307
+ large: `${O * 8}px`
308
+ }), /* @__PURE__ */ m.createElement($e, { theme: M }, /* @__PURE__ */ m.createElement(fe.Provider, { value: p }, /* @__PURE__ */ m.createElement(ge.Provider, { value: _ }, (() => {
309
+ const C = f({
310
+ "data-width": x === "full" ? y : Math.min(x, y),
311
+ "data-indent": tt,
312
+ "data-name": p.name,
313
+ "data-node-id": p.id,
314
+ "data-component-type": p.type,
315
+ "aria-label": i,
316
+ tabIndex: o,
317
+ id: p.id,
318
+ role: _ && _.role
319
+ }, u);
320
+ switch (p.type) {
321
+ case "view":
322
+ return typeof _.animation == "string" && _.animation !== "none" ? /* @__PURE__ */ m.createElement(Ye, w(f({}, C), { className: n })) : /* @__PURE__ */ m.createElement(qe, w(f({}, C), { className: n }));
323
+ default: {
324
+ const G = ye(_);
325
+ return /* @__PURE__ */ m.createElement(
326
+ Je,
327
+ w(f(f({
328
+ ref: a
329
+ }, C), G), {
330
+ className: n
331
+ })
332
+ );
333
+ }
334
+ }
335
+ })())));
336
+ }
337
+ ), At = en, nn = ({ builder: n }) => {
338
+ const t = X(), [e, s] = q(null);
339
+ return Y(() => {
340
+ t.getAsync("components").then((i) => n(i).then((o) => {
341
+ s(o);
342
+ }));
343
+ }, []), Y(() => () => {
344
+ e && t.getAsync("components").then((i) => {
345
+ i.nodes.detached = i.nodes.detached.filter(
346
+ (o) => o.id !== e.id
347
+ );
348
+ });
349
+ }, [e]), e ? /* @__PURE__ */ m.createElement(At, { id: e.id, node: e, branch: "default" }) : null;
350
+ }, sn = nn, on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
351
+ __proto__: null,
352
+ default: sn
353
+ }, Symbol.toStringTag, { value: "Module" })), rn = m.lazy(() => Promise.resolve().then(() => on)), an = ({ showSearch: n = !1 }) => {
354
+ const t = we(), e = X();
355
+ return /* @__PURE__ */ m.createElement(m.Suspense, { fallback: null }, /* @__PURE__ */ m.createElement(
356
+ rn,
357
+ {
358
+ builder: (s) => e.get("settings").then((i) => {
359
+ var c;
360
+ const { properties: o, context: r } = Object.keys(i.components).reduce(
361
+ (d, l) => (i.components[l].type === "not-found" && (d.properties = i.components[l].properties, d.context = i.components[l].context), d),
362
+ { properties: {}, context: {} }
363
+ );
364
+ o.showSearch = n;
365
+ const u = s.createNode("area", { detached: !0 });
366
+ if (u.name = "not-found-area", u.writeLayout({
367
+ size: "full"
368
+ }), n) {
369
+ const d = Object.keys(i.components).reduce(
370
+ (h, p) => i.components[p].type === "search" ? i.components[p].properties : h,
371
+ {}
372
+ ), l = s.createNode("search", { detached: !0 });
373
+ l.writeLayout({ size: "full" }), l.writeProperties(f({
374
+ "css-margin-bottom": ((c = t == null ? void 0 : t.sizes) == null ? void 0 : c.normal) || "15px"
375
+ }, d)), u.appendChild(l);
376
+ }
377
+ const a = s.createNode("not-found", { detached: !0 });
378
+ return a.writeLayout({ size: "full" }), a.writeProperties(o), a.writeContext(r), u.appendChild(a), u;
379
+ })
380
+ }
381
+ ));
382
+ }, as = an;
383
+ /**
384
+ * @license
385
+ * Copyright 2017 Google LLC
386
+ * SPDX-License-Identifier: BSD-3-Clause
387
+ */
388
+ const cn = (n) => (t) => typeof t == "function" ? ((e, s) => (customElements.define(e, s), s))(n, t) : ((e, s) => {
389
+ const { kind: i, elements: o } = s;
390
+ return { kind: i, elements: o, finisher(r) {
391
+ customElements.define(e, r);
392
+ } };
393
+ })(n, t);
394
+ /**
395
+ * @license
396
+ * Copyright 2017 Google LLC
397
+ * SPDX-License-Identifier: BSD-3-Clause
398
+ */
399
+ const ln = (n, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? w(f({}, t), { finisher(e) {
400
+ e.createProperty(t.key, n);
401
+ } }) : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
402
+ typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
403
+ }, finisher(e) {
404
+ e.createProperty(t.key, n);
405
+ } };
406
+ function _t(n) {
407
+ return (t, e) => e !== void 0 ? ((s, i, o) => {
408
+ i.constructor.createProperty(o, s);
409
+ })(n, t, e) : ln(n, t);
410
+ }
411
+ /**
412
+ * @license
413
+ * Copyright 2017 Google LLC
414
+ * SPDX-License-Identifier: BSD-3-Clause
415
+ */
416
+ function ut(n) {
417
+ return _t(w(f({}, n), { state: !0 }));
418
+ }
419
+ /**
420
+ * @license
421
+ * Copyright 2021 Google LLC
422
+ * SPDX-License-Identifier: BSD-3-Clause
423
+ */
424
+ var gt;
425
+ ((gt = window.HTMLSlotElement) === null || gt === void 0 ? void 0 : gt.prototype.assignedElements) != null;
426
+ /**
427
+ * @license
428
+ * Copyright 2017 Google LLC
429
+ * SPDX-License-Identifier: BSD-3-Clause
430
+ */
431
+ var yt;
432
+ const at = window, W = at.trustedTypes, Dt = W ? W.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, P = `lit$${(Math.random() + "").slice(9)}$`, Yt = "?" + P, un = `<${Yt}>`, U = document, ct = (n = "") => U.createComment(n), Z = (n) => n === null || typeof n != "object" && typeof n != "function", Zt = Array.isArray, hn = (n) => Zt(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", K = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Pt = /-->/g, Lt = />/g, R = RegExp(`>|[
433
+ \f\r](?:([^\\s"'>=/]+)([
434
+ \f\r]*=[
435
+ \f\r]*(?:[^
436
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), kt = /'/g, Rt = /"/g, Qt = /^(?:script|style|textarea|title)$/i, dn = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), pn = dn(1), Q = Symbol.for("lit-noChange"), b = Symbol.for("lit-nothing"), Tt = /* @__PURE__ */ new WeakMap(), j = U.createTreeWalker(U, 129, null, !1), mn = (n, t) => {
437
+ const e = n.length - 1, s = [];
438
+ let i, o = t === 2 ? "<svg>" : "", r = K;
439
+ for (let a = 0; a < e; a++) {
440
+ const c = n[a];
441
+ let d, l, h = -1, p = 0;
442
+ for (; p < c.length && (r.lastIndex = p, l = r.exec(c), l !== null); )
443
+ p = r.lastIndex, r === K ? l[1] === "!--" ? r = Pt : l[1] !== void 0 ? r = Lt : l[2] !== void 0 ? (Qt.test(l[2]) && (i = RegExp("</" + l[2], "g")), r = R) : l[3] !== void 0 && (r = R) : r === R ? l[0] === ">" ? (r = i != null ? i : K, h = -1) : l[1] === void 0 ? h = -2 : (h = r.lastIndex - l[2].length, d = l[1], r = l[3] === void 0 ? R : l[3] === '"' ? Rt : kt) : r === Rt || r === kt ? r = R : r === Pt || r === Lt ? r = K : (r = R, i = void 0);
444
+ const g = r === R && n[a + 1].startsWith("/>") ? " " : "";
445
+ o += r === K ? c + un : h >= 0 ? (s.push(d), c.slice(0, h) + "$lit$" + c.slice(h) + P + g) : c + P + (h === -2 ? (s.push(void 0), a) : g);
446
+ }
447
+ const u = o + (n[e] || "<?>") + (t === 2 ? "</svg>" : "");
448
+ if (!Array.isArray(n) || !n.hasOwnProperty("raw"))
449
+ throw Error("invalid template strings array");
450
+ return [Dt !== void 0 ? Dt.createHTML(u) : u, s];
451
+ };
452
+ class J {
453
+ constructor({ strings: t, _$litType$: e }, s) {
454
+ let i;
455
+ this.parts = [];
456
+ let o = 0, r = 0;
457
+ const u = t.length - 1, a = this.parts, [c, d] = mn(t, e);
458
+ if (this.el = J.createElement(c, s), j.currentNode = this.el.content, e === 2) {
459
+ const l = this.el.content, h = l.firstChild;
460
+ h.remove(), l.append(...h.childNodes);
461
+ }
462
+ for (; (i = j.nextNode()) !== null && a.length < u; ) {
463
+ if (i.nodeType === 1) {
464
+ if (i.hasAttributes()) {
465
+ const l = [];
466
+ for (const h of i.getAttributeNames())
467
+ if (h.endsWith("$lit$") || h.startsWith(P)) {
468
+ const p = d[r++];
469
+ if (l.push(h), p !== void 0) {
470
+ const g = i.getAttribute(p.toLowerCase() + "$lit$").split(P), y = /([.?@])?(.*)/.exec(p);
471
+ a.push({ type: 1, index: o, name: y[2], strings: g, ctor: y[1] === "." ? gn : y[1] === "?" ? vn : y[1] === "@" ? bn : dt });
472
+ } else
473
+ a.push({ type: 6, index: o });
474
+ }
475
+ for (const h of l)
476
+ i.removeAttribute(h);
477
+ }
478
+ if (Qt.test(i.tagName)) {
479
+ const l = i.textContent.split(P), h = l.length - 1;
480
+ if (h > 0) {
481
+ i.textContent = W ? W.emptyScript : "";
482
+ for (let p = 0; p < h; p++)
483
+ i.append(l[p], ct()), j.nextNode(), a.push({ type: 2, index: ++o });
484
+ i.append(l[h], ct());
485
+ }
486
+ }
487
+ } else if (i.nodeType === 8)
488
+ if (i.data === Yt)
489
+ a.push({ type: 2, index: o });
490
+ else {
491
+ let l = -1;
492
+ for (; (l = i.data.indexOf(P, l + 1)) !== -1; )
493
+ a.push({ type: 7, index: o }), l += P.length - 1;
494
+ }
495
+ o++;
496
+ }
497
+ }
498
+ static createElement(t, e) {
499
+ const s = U.createElement("template");
500
+ return s.innerHTML = t, s;
501
+ }
502
+ }
503
+ function F(n, t, e = n, s) {
504
+ var i, o, r, u;
505
+ if (t === Q)
506
+ return t;
507
+ let a = s !== void 0 ? (i = e._$Co) === null || i === void 0 ? void 0 : i[s] : e._$Cl;
508
+ const c = Z(t) ? void 0 : t._$litDirective$;
509
+ return (a == null ? void 0 : a.constructor) !== c && ((o = a == null ? void 0 : a._$AO) === null || o === void 0 || o.call(a, !1), c === void 0 ? a = void 0 : (a = new c(n), a._$AT(n, e, s)), s !== void 0 ? ((r = (u = e)._$Co) !== null && r !== void 0 ? r : u._$Co = [])[s] = a : e._$Cl = a), a !== void 0 && (t = F(n, a._$AS(n, t.values), a, s)), t;
510
+ }
511
+ class fn {
512
+ constructor(t, e) {
513
+ this.u = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
514
+ }
515
+ get parentNode() {
516
+ return this._$AM.parentNode;
517
+ }
518
+ get _$AU() {
519
+ return this._$AM._$AU;
520
+ }
521
+ v(t) {
522
+ var e;
523
+ const { el: { content: s }, parts: i } = this._$AD, o = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : U).importNode(s, !0);
524
+ j.currentNode = o;
525
+ let r = j.nextNode(), u = 0, a = 0, c = i[0];
526
+ for (; c !== void 0; ) {
527
+ if (u === c.index) {
528
+ let d;
529
+ c.type === 2 ? d = new ht(r, r.nextSibling, this, t) : c.type === 1 ? d = new c.ctor(r, c.name, c.strings, this, t) : c.type === 6 && (d = new $n(r, this, t)), this.u.push(d), c = i[++a];
530
+ }
531
+ u !== (c == null ? void 0 : c.index) && (r = j.nextNode(), u++);
532
+ }
533
+ return o;
534
+ }
535
+ p(t) {
536
+ let e = 0;
537
+ for (const s of this.u)
538
+ s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
539
+ }
540
+ }
541
+ class ht {
542
+ constructor(t, e, s, i) {
543
+ var o;
544
+ this.type = 2, this._$AH = b, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cm = (o = i == null ? void 0 : i.isConnected) === null || o === void 0 || o;
545
+ }
546
+ get _$AU() {
547
+ var t, e;
548
+ return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$Cm;
549
+ }
550
+ get parentNode() {
551
+ let t = this._$AA.parentNode;
552
+ const e = this._$AM;
553
+ return e !== void 0 && t.nodeType === 11 && (t = e.parentNode), t;
554
+ }
555
+ get startNode() {
556
+ return this._$AA;
557
+ }
558
+ get endNode() {
559
+ return this._$AB;
560
+ }
561
+ _$AI(t, e = this) {
562
+ t = F(this, t, e), Z(t) ? t === b || t == null || t === "" ? (this._$AH !== b && this._$AR(), this._$AH = b) : t !== this._$AH && t !== Q && this.g(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : hn(t) ? this.k(t) : this.g(t);
563
+ }
564
+ O(t, e = this._$AB) {
565
+ return this._$AA.parentNode.insertBefore(t, e);
566
+ }
567
+ T(t) {
568
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
569
+ }
570
+ g(t) {
571
+ this._$AH !== b && Z(this._$AH) ? this._$AA.nextSibling.data = t : this.T(U.createTextNode(t)), this._$AH = t;
572
+ }
573
+ $(t) {
574
+ var e;
575
+ const { values: s, _$litType$: i } = t, o = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = J.createElement(i.h, this.options)), i);
576
+ if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o)
577
+ this._$AH.p(s);
578
+ else {
579
+ const r = new fn(o, this), u = r.v(this.options);
580
+ r.p(s), this.T(u), this._$AH = r;
581
+ }
582
+ }
583
+ _$AC(t) {
584
+ let e = Tt.get(t.strings);
585
+ return e === void 0 && Tt.set(t.strings, e = new J(t)), e;
586
+ }
587
+ k(t) {
588
+ Zt(this._$AH) || (this._$AH = [], this._$AR());
589
+ const e = this._$AH;
590
+ let s, i = 0;
591
+ for (const o of t)
592
+ i === e.length ? e.push(s = new ht(this.O(ct()), this.O(ct()), this, this.options)) : s = e[i], s._$AI(o), i++;
593
+ i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
594
+ }
595
+ _$AR(t = this._$AA.nextSibling, e) {
596
+ var s;
597
+ for ((s = this._$AP) === null || s === void 0 || s.call(this, !1, !0, e); t && t !== this._$AB; ) {
598
+ const i = t.nextSibling;
599
+ t.remove(), t = i;
600
+ }
601
+ }
602
+ setConnected(t) {
603
+ var e;
604
+ this._$AM === void 0 && (this._$Cm = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
605
+ }
606
+ }
607
+ class dt {
608
+ constructor(t, e, s, i, o) {
609
+ this.type = 1, this._$AH = b, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = b;
610
+ }
611
+ get tagName() {
612
+ return this.element.tagName;
613
+ }
614
+ get _$AU() {
615
+ return this._$AM._$AU;
616
+ }
617
+ _$AI(t, e = this, s, i) {
618
+ const o = this.strings;
619
+ let r = !1;
620
+ if (o === void 0)
621
+ t = F(this, t, e, 0), r = !Z(t) || t !== this._$AH && t !== Q, r && (this._$AH = t);
622
+ else {
623
+ const u = t;
624
+ let a, c;
625
+ for (t = o[0], a = 0; a < o.length - 1; a++)
626
+ c = F(this, u[s + a], e, a), c === Q && (c = this._$AH[a]), r || (r = !Z(c) || c !== this._$AH[a]), c === b ? t = b : t !== b && (t += (c != null ? c : "") + o[a + 1]), this._$AH[a] = c;
627
+ }
628
+ r && !i && this.j(t);
629
+ }
630
+ j(t) {
631
+ t === b ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t != null ? t : "");
632
+ }
633
+ }
634
+ class gn extends dt {
635
+ constructor() {
636
+ super(...arguments), this.type = 3;
637
+ }
638
+ j(t) {
639
+ this.element[this.name] = t === b ? void 0 : t;
640
+ }
641
+ }
642
+ const yn = W ? W.emptyScript : "";
643
+ class vn extends dt {
644
+ constructor() {
645
+ super(...arguments), this.type = 4;
646
+ }
647
+ j(t) {
648
+ t && t !== b ? this.element.setAttribute(this.name, yn) : this.element.removeAttribute(this.name);
649
+ }
650
+ }
651
+ class bn extends dt {
652
+ constructor(t, e, s, i, o) {
653
+ super(t, e, s, i, o), this.type = 5;
654
+ }
655
+ _$AI(t, e = this) {
656
+ var s;
657
+ if ((t = (s = F(this, t, e, 0)) !== null && s !== void 0 ? s : b) === Q)
658
+ return;
659
+ const i = this._$AH, o = t === b && i !== b || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, r = t !== b && (i === b || o);
660
+ o && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
661
+ }
662
+ handleEvent(t) {
663
+ var e, s;
664
+ typeof this._$AH == "function" ? this._$AH.call((s = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && s !== void 0 ? s : this.element, t) : this._$AH.handleEvent(t);
665
+ }
666
+ }
667
+ class $n {
668
+ constructor(t, e, s) {
669
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
670
+ }
671
+ get _$AU() {
672
+ return this._$AM._$AU;
673
+ }
674
+ _$AI(t) {
675
+ F(this, t);
676
+ }
677
+ }
678
+ const Ht = at.litHtmlPolyfillSupport;
679
+ Ht == null || Ht(J, ht), ((yt = at.litHtmlVersions) !== null && yt !== void 0 ? yt : at.litHtmlVersions = []).push("2.6.0");
680
+ /**
681
+ * @license
682
+ * Copyright 2020 Google LLC
683
+ * SPDX-License-Identifier: BSD-3-Clause
684
+ */
685
+ const Jt = Symbol.for(""), wn = (n) => {
686
+ if ((n == null ? void 0 : n.r) === Jt)
687
+ return n == null ? void 0 : n._$litStatic$;
688
+ }, An = (n) => ({ _$litStatic$: n, r: Jt }), It = /* @__PURE__ */ new Map(), _n = (n) => (t, ...e) => {
689
+ const s = e.length;
690
+ let i, o;
691
+ const r = [], u = [];
692
+ let a, c = 0, d = !1;
693
+ for (; c < s; ) {
694
+ for (a = t[c]; c < s && (o = e[c], (i = wn(o)) !== void 0); )
695
+ a += i + t[++c], d = !0;
696
+ u.push(o), r.push(a), c++;
697
+ }
698
+ if (c === s && r.push(t[s]), d) {
699
+ const l = r.join("$$lit$$");
700
+ (t = It.get(l)) === void 0 && (r.raw = r, It.set(l, t = r)), e = u;
701
+ }
702
+ return n(t, ...e);
703
+ }, En = _n(pn), Cn = (n) => {
704
+ class t extends n {
705
+ requestInstance(s) {
706
+ const i = new CustomEvent("request-instance", {
707
+ detail: { key: s },
708
+ bubbles: !0,
709
+ composed: !0,
710
+ cancelable: !0
711
+ });
712
+ return this.dispatchEvent(i), i.detail.instance;
713
+ }
714
+ }
715
+ return t;
716
+ };
717
+ var xn = Object.defineProperty, On = Object.getOwnPropertyDescriptor, I = (n, t, e, s) => {
718
+ for (var i = s > 1 ? void 0 : s ? On(t, e) : t, o = n.length - 1, r; o >= 0; o--)
719
+ (r = n[o]) && (i = (s ? r(t, e, i) : r(i)) || i);
720
+ return s && i && xn(t, e, i), i;
721
+ };
722
+ const Nn = (n) => `w-${n}`, Vt = (n = "none", t = 1) => n === "full" ? t : Math.min(n, t);
723
+ let S = class extends Cn(Pe) {
724
+ constructor() {
725
+ super(...arguments), this.listeners = [], this.branch = "default", this._descriptor = null, this._properties = {}, this._context = {}, this._layout = {};
726
+ }
727
+ connectedCallback() {
728
+ super.connectedCallback(), this.container = this.requestInstance("container"), this.container && Promise.all([
729
+ Kt.getInstance(this.container),
730
+ this.container.getAsync("componentResolver")
731
+ ]).then((n) => {
732
+ const t = n[0], e = n[1], s = t.nodes.get(this.nodeId || "");
733
+ if (s) {
734
+ this._descriptor = ot(s, this.branch), this._properties = s.attributes.properties, this._context = s.attributes.context, this._layout = s.attributes.layout;
735
+ const i = this.style.getPropertyValue("--columns") ? +this.style.getPropertyValue("--columns") : 1, o = Vt(this._layout.size, i), r = typeof this._layout.indent != "undefined" ? `${this._layout.indent + 1} / ${this._layout.indent + (o || 0) + 1}` : `span ${o}`;
736
+ this.style.setProperty("--gridColumn", r), this.listeners.push(
737
+ t.events.subscribe(
738
+ "components:properties-changed",
739
+ (d, l) => {
740
+ var h;
741
+ this.nodeId === ((h = l.node) == null ? void 0 : h.id) && (this._properties = l.node.attributes.properties);
742
+ }
743
+ )
744
+ ), this.listeners.push(
745
+ t.events.subscribe("components:context-changed", (d, l) => {
746
+ var h;
747
+ this.nodeId === ((h = l.node) == null ? void 0 : h.id) && (this._context = l.node.attributes.context);
748
+ })
749
+ ), this.listeners.push(
750
+ t.events.subscribe("components:layout-changed", (d, l) => {
751
+ var h;
752
+ this.nodeId === ((h = l.node) == null ? void 0 : h.id) && (this._layout = l.node.attributes.layout);
753
+ })
754
+ );
755
+ const u = s.mount(this.container);
756
+ if (this.listeners.push(u), !e) {
757
+ console.warn(
758
+ "Could not find resolver. Make sure it is registered on the container."
759
+ );
760
+ return;
761
+ }
762
+ const a = Nn(this._descriptor.type);
763
+ if (customElements.get(a))
764
+ return;
765
+ const c = e.getComponent(this._descriptor.type);
766
+ if (!c) {
767
+ console.warn("Component is missing or using incorrect import.");
768
+ return;
769
+ }
770
+ return c().then((d) => {
771
+ customElements.get(a) || customElements.define(a, d.default);
772
+ });
773
+ }
774
+ });
775
+ }
776
+ disconnectedCallback() {
777
+ this.listeners.forEach((n) => {
778
+ n();
779
+ });
780
+ }
781
+ mapProps() {
782
+ var t;
783
+ const n = this.style.getPropertyValue("--columns") ? +this.style.getPropertyValue("--columns") : 1;
784
+ return Object.entries(this._properties).reduce(
785
+ (e, [s, i]) => (typeof i == "object" ? e[`.${s}`] = i : e[s] = i, e),
786
+ {
787
+ "data-width": Vt(this._layout.size, n),
788
+ "data-indent": (t = this._layout.indent) != null ? t : 0,
789
+ id: this._descriptor.id,
790
+ "data-name": this._descriptor.name,
791
+ "data-component-type": this._descriptor.type,
792
+ "data-node-id": this.nodeId
793
+ }
794
+ );
795
+ }
796
+ render() {
797
+ if (!this._descriptor)
798
+ return Me;
799
+ const n = `w-${this._descriptor.type}`, t = this.mapProps();
800
+ return En`
801
+ <${An(n)}
802
+ ${Se(t)}
803
+ .layout=${this._layout}
804
+ .context=${this._context}
805
+ />
806
+ `;
807
+ }
808
+ };
809
+ S.styles = [
810
+ De`
811
+ :host {
812
+ outline: none;
813
+ box-sizing: border-box;
814
+ }
815
+
816
+ * {
817
+ box-sizing: border-box;
818
+ outline: none;
819
+ }
820
+
821
+ grid-column: var(--gridColumn);
822
+ `
823
+ ];
824
+ I([
825
+ _t({ type: String })
826
+ ], S.prototype, "nodeId", 2);
827
+ I([
828
+ _t({ type: String })
829
+ ], S.prototype, "branch", 2);
830
+ I([
831
+ ut()
832
+ ], S.prototype, "_descriptor", 2);
833
+ I([
834
+ ut()
835
+ ], S.prototype, "_properties", 2);
836
+ I([
837
+ ut()
838
+ ], S.prototype, "_context", 2);
839
+ I([
840
+ ut()
841
+ ], S.prototype, "_layout", 2);
842
+ S = I([
843
+ cn("widget-component")
844
+ ], S);
845
+ const Sn = (n) => `w-${n}`, cs = (n, t, e) => St(void 0, null, function* () {
846
+ const s = e.nodes.get(n);
847
+ if (!t) {
848
+ console.warn("Could not find resolver. Make sure it is registered on the container.");
849
+ return;
850
+ }
851
+ if (!s) {
852
+ console.warn(`Unable to find node with id: ${n}`);
853
+ return;
854
+ }
855
+ const i = ot(s);
856
+ if (!(i != null && i.type)) {
857
+ console.warn(`Could not get descriptor for: ${s.name}`);
858
+ return;
859
+ }
860
+ const o = Sn(i.type);
861
+ if (customElements.get(o))
862
+ return;
863
+ const r = t.getComponent(i.type);
864
+ if (!r) {
865
+ console.warn("Component is missing or using incorrect import.");
866
+ return;
867
+ }
868
+ const u = yield r();
869
+ if (!customElements.get(o))
870
+ try {
871
+ customElements.define(o, u.default);
872
+ } catch (a) {
873
+ console.log("error", a);
874
+ }
875
+ return customElements.whenDefined(o).then(() => ({
876
+ nodeId: n,
877
+ tag: o
878
+ }));
879
+ }), Mn = (n) => {
880
+ if (n) {
881
+ const { type: t, content: e } = n;
882
+ switch (t) {
883
+ case "FontAwesome":
884
+ return `<i class="humany-icon fa fa-${e}"></i>`;
885
+ case "Uri":
886
+ return `<i class="humany-icon humany-custom-icon" style="background: url(${e}) no-repeat center center;background-size: contain;"></i>`;
887
+ default:
888
+ return "";
889
+ }
890
+ }
891
+ }, Dn = (n) => {
892
+ const t = (i, o) => {
893
+ !i || (o ? i.classList.add("humany-tabbing") : i.classList.remove("humany-tabbing"));
894
+ }, e = (i) => {
895
+ i.key === "Tab" ? t(n, !0) : i.key === "Enter" && document.activeElement && document.activeElement.classList.contains("humany-trigger") || t(n, !1);
896
+ }, s = (i) => {
897
+ document.activeElement && document.activeElement.classList.contains("humany-trigger") && document.activeElement.classList.contains("humany-tabbing") || t(n, !1);
898
+ };
899
+ return document.addEventListener("keydown", e), document.addEventListener("click", s), () => {
900
+ document.removeEventListener("keydown", e), document.removeEventListener("click", s);
901
+ };
902
+ };
903
+ function Pn(n, t) {
904
+ const { symbol: e, widgetName: s, label: i = "", ariaLabel: o = "", tooltip: r = "" } = t;
905
+ n.classList.add("humany-trigger"), n.classList.add(`humany_${s}`), i.length && n.classList.add("humany-has-text"), o.length && !n.getAttribute("aria-label") && n.setAttribute("aria-label", o), o.length && !n.getAttribute("tabindex") && n.setAttribute("tabindex", "0"), r.length && !n.getAttribute("title") && n.setAttribute("title", r);
906
+ const u = Mn(e) || "";
907
+ return n.innerHTML = `${u}
908
+ <span class="humany-close">
909
+ <svg width="18" height="9" viewBox="0 0 18 9" fill="none" xmlns="http://www.w3.org/2000/svg">
910
+ <path 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" fill="white"/>
911
+ </svg>
912
+ </span>
913
+ <span class="humany-loader">
914
+ <svg viewBox="25 25 50 50">
915
+ <circle
916
+ cx="50"
917
+ cy="50"
918
+ r="20"
919
+ fill="none"
920
+ stroke="#000"
921
+ stroke-width="2"
922
+ stroke-miterlimit="10" />
923
+ </svg>
924
+ </span>
925
+ ${i.length ? `<span>${i}</span>` : ""}`, setTimeout(() => n && n.classList.add("humany-rendered")), Dn(n);
926
+ }
927
+ function Ln(n, t) {
928
+ n instanceof HTMLElement ? (t && n.setAttribute("title", t), n.classList.remove("humany-active"), n.classList.remove("humany-loading")) : n instanceof Array && n.forEach((e) => {
929
+ t && e.setAttribute("title", t), e.classList.remove("humany-active"), e.classList.remove("humany-loading");
930
+ });
931
+ }
932
+ function kn(n) {
933
+ n instanceof HTMLElement ? (n.classList.remove("humany-active"), n.classList.add("humany-loading")) : n instanceof Array && n.forEach((t) => {
934
+ t.classList.remove("humany-active"), t.classList.add("humany-loading");
935
+ });
936
+ }
937
+ function Xt(n, t) {
938
+ n instanceof HTMLElement ? (t && n.setAttribute("title", t), n.classList.add("humany-active"), n.classList.remove("humany-loading")) : n instanceof Array && n.forEach((e) => {
939
+ t && e.setAttribute("title", t), e.classList.add("humany-active"), e.classList.remove("humany-loading");
940
+ });
941
+ }
942
+ var T = /* @__PURE__ */ ((n) => (n.Inline = "inline", n.Link = "link", n.Badge = "badge", n.Unsupported = "unsupported", n))(T || {});
943
+ const Rn = (n, t) => n && t ? "both" : n ? "widgetDOM" : t ? "triggerDOM" : "none", te = (n) => n ? typeof n == "boolean" && n ? "link" : typeof n == "object" && !Array.isArray(n) ? "badge" : "unsupported" : "inline", Tn = (n, t, e, s, i = !1) => {
944
+ var c, d;
945
+ const o = Rn(
946
+ t,
947
+ e
948
+ ), r = te(s), u = {
949
+ widgetDOMElement: t ? t.cloneNode(!0) : void 0,
950
+ triggerDOMElement: e ? e.cloneNode(!0) : void 0
951
+ }, a = {
952
+ triggerType: r,
953
+ cachedOriginals: u,
954
+ widgetDOMElement: document.createElement("div")
955
+ };
956
+ switch (o) {
957
+ case "both": {
958
+ a.widgetDOMElement = t || document.createElement("div"), r !== "inline" && (a.triggerDOMElement = e);
959
+ break;
960
+ }
961
+ case "widgetDOM": {
962
+ if (a.widgetDOMElement = t || document.createElement("div"), r !== "inline") {
963
+ const l = document.body.appendChild(document.createElement("a"));
964
+ r === "link" && (l.innerText = n), a.triggerDOMElement = l;
965
+ }
966
+ break;
967
+ }
968
+ case "triggerDOM": {
969
+ const l = document.createElement("div");
970
+ a.widgetDOMElement = l, r === "inline" ? (l.id = (e == null ? void 0 : e.id) || "", i ? (l.style.display = "none", (c = e == null ? void 0 : e.parentNode) == null || c.appendChild(l), a.callback = () => {
971
+ var h;
972
+ (h = e == null ? void 0 : e.parentNode) == null || h.replaceChild(
973
+ l,
974
+ e
975
+ ), l.style.display = (e == null ? void 0 : e.style.display) || "block";
976
+ }) : (d = e == null ? void 0 : e.parentNode) == null || d.replaceChild(
977
+ l,
978
+ e
979
+ ), a.cachedOriginals.widgetDOMElement = e, a.cachedOriginals.triggerDOMElement = void 0) : (a.widgetDOMElement = document.body.appendChild(l), a.triggerDOMElement = e);
980
+ break;
981
+ }
982
+ case "none": {
983
+ const l = document.body.appendChild(document.createElement("div"));
984
+ if (a.widgetDOMElement = l, r !== "inline") {
985
+ const h = document.body.appendChild(document.createElement("a"));
986
+ r === "link" && (h.innerText = n), a.triggerDOMElement = h;
987
+ }
988
+ break;
989
+ }
990
+ }
991
+ return a;
992
+ }, Hn = "modals";
993
+ class In {
994
+ constructor(t, e) {
995
+ this.options = e, this.unsubscribe = [], this.container = t.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register("triggerDOMElement", this.options.triggerDOMElement);
996
+ const s = this.container.get("$widget");
997
+ this.options.widgetDOMElement.classList.add("humany-widget"), this.options.widgetDOMElement.classList.add(`humany_${s.name}`);
998
+ const i = t.get("widgetDOMElements") || [];
999
+ t.register("widgetDOMElements", [
1000
+ ...i,
1001
+ this.options.widgetDOMElement
1002
+ ]);
1003
+ }
1004
+ render() {
1005
+ const { widgetDOMElement: t, triggerDOMElement: e } = this.options, s = this.container.get("$widget");
1006
+ return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === T.Badge && kn(e), import("./render.0c0b70f9.js").then((i) => i.default(s.name, this.container, t)).then(() => {
1007
+ if (t.setAttribute("data-rendered", "true"), e && this.options.triggerType === T.Badge) {
1008
+ const o = this.options.triggerOptions.openTooltip;
1009
+ Xt(e, o);
1010
+ }
1011
+ Ee(this.container, t);
1012
+ const i = this.container.get("$environment").widgets.all();
1013
+ L(
1014
+ this.container,
1015
+ Hn,
1016
+ A.Session
1017
+ ).then((o) => {
1018
+ o && o.forEach((r) => {
1019
+ i.find(
1020
+ (u) => u.name === r.name && u.state === "activated"
1021
+ ) && s.events.dispatch("widget:modal-opened", r);
1022
+ });
1023
+ });
1024
+ }));
1025
+ }
1026
+ renderBadge(t) {
1027
+ const { triggerDOMElement: e } = this.options;
1028
+ if (!e)
1029
+ return;
1030
+ e.getAttribute("role") || e.setAttribute("role", "button");
1031
+ const { name: s } = this.container.get("$widget"), { label: i, symbol: o, ariaLabel: r, closedTooltip: u, openTooltip: a } = t, c = { closedTooltip: u, openTooltip: a };
1032
+ this.options.triggerOptions = c;
1033
+ const d = Pn(e, {
1034
+ label: i,
1035
+ symbol: o,
1036
+ ariaLabel: r,
1037
+ widgetName: s,
1038
+ tooltip: u
1039
+ });
1040
+ this.unsubscribe.push(d);
1041
+ }
1042
+ dispose() {
1043
+ return import("./unmount.b0816844.js").then((t) => {
1044
+ var i, o, r, u;
1045
+ const { triggerDOMElement: e, widgetDOMElement: s } = this.options;
1046
+ t.default(s), this.options.cachedOriginals.widgetDOMElement && s && ((i = s.parentNode) == null || i.replaceChild(
1047
+ this.options.cachedOriginals.widgetDOMElement,
1048
+ s
1049
+ )), this.options.cachedOriginals.triggerDOMElement && e && ((o = e.parentNode) == null || o.replaceChild(
1050
+ this.options.cachedOriginals.triggerDOMElement,
1051
+ e
1052
+ )), this.unsubscribe.forEach((a) => {
1053
+ a();
1054
+ }), (r = s.parentNode) == null || r.removeChild(s), (u = e == null ? void 0 : e.parentNode) == null || u.removeChild(e);
1055
+ });
1056
+ }
1057
+ }
1058
+ const st = "changesets", Vn = (n) => {
1059
+ const t = { tags: n.tags };
1060
+ return n.context && typeof n.context != "function" && (t.context = n.context), n.properties && typeof n.properties != "function" && (t.properties = n.properties), n.layout && typeof n.layout != "function" && (t.layout = n.layout), t;
1061
+ };
1062
+ class Et {
1063
+ constructor(t, e) {
1064
+ this.container = t, this.storageWriter = e;
1065
+ }
1066
+ static create(t) {
1067
+ return z(t, st, B.Necessary, {
1068
+ medium: A.Local
1069
+ }).then((e) => new Et(t, e));
1070
+ }
1071
+ write(t, e, s, i) {
1072
+ return mt(this)(() => L(
1073
+ this.container,
1074
+ st,
1075
+ A.Local
1076
+ ).then((o = {}) => {
1077
+ const { keys: r = [], items: u = {} } = o, a = r.indexOf(t);
1078
+ return a > -1 && r.splice(a, 1), r.push(t), u[t] = {
1079
+ options: i,
1080
+ attributes: Vn(s),
1081
+ rules: e.rules
1082
+ }, this.storageWriter({ keys: r, items: u });
1083
+ }));
1084
+ }
1085
+ remove(t) {
1086
+ return mt(this)(() => L(
1087
+ this.container,
1088
+ st,
1089
+ A.Local
1090
+ ).then((e = {}) => {
1091
+ const { keys: s = [], items: i = {} } = e, o = s.indexOf(t);
1092
+ if (o > -1)
1093
+ return s.splice(o, 1), delete i[t], this.storageWriter(e);
1094
+ }));
1095
+ }
1096
+ load(t) {
1097
+ return mt(this)(() => L(
1098
+ this.container,
1099
+ st,
1100
+ A.Local
1101
+ ).then((e = {}) => {
1102
+ const { keys: s = [], items: i = {} } = e;
1103
+ s.forEach((o) => {
1104
+ const r = i[o];
1105
+ if (r) {
1106
+ const { rules: u, attributes: a, options: c } = r;
1107
+ t.write({
1108
+ attributes: a,
1109
+ options: c,
1110
+ target: new _e(t, u)
1111
+ });
1112
+ }
1113
+ });
1114
+ }));
1115
+ }
1116
+ }
1117
+ const zn = (n) => {
1118
+ const { container: t } = n;
1119
+ return Et.create(t).then((e) => {
1120
+ const s = t.get("$settings"), i = { localStorage: e }, o = new Kt(n, i), r = Ae(o, s);
1121
+ return n.events.subscribe("widget:state-change", (u, a) => {
1122
+ a.state === Te.Deactivating && r();
1123
+ }), o;
1124
+ });
1125
+ }, Bn = (n) => import("@telia-ace/widget-routing").then(({ RoutingService: t, HistoryMode: e }) => n.get("settings").then((s) => {
1126
+ const {
1127
+ routing: { initialPath: i = "/", mode: o = e.scopedHash, basePath: r },
1128
+ views: u
1129
+ } = s;
1130
+ return new t(n, {
1131
+ initialPath: i,
1132
+ mode: o,
1133
+ routes: Object.keys(u).map((c) => ({
1134
+ name: c,
1135
+ path: u[c].path
1136
+ })),
1137
+ basePath: r
1138
+ });
1139
+ })), jn = (n) => import("@telia-ace/widget-services").then(({ StorageProvider: t }) => new t()), Wn = (n) => import("@telia-ace/widget-core").then(({ ActionResolver: t }) => new t(n)), Un = (n) => import("@telia-ace/widget-core").then(({ ComponentResolver: t }) => new t(n)), Fn = (n) => import("@telia-ace/widget-core").then(({ ComponentPlatform: t, createComponentModel: e }) => zn(n.get("$widget"))), vt = "$settings", it = "open", zt = "activeStickyWidget";
1140
+ class ls extends He {
1141
+ constructor(t) {
1142
+ super(t), this.outlets = /* @__PURE__ */ new Map(), this.activated = void 0, this.subs = [], this.handleBootstrapping = (e) => {
1143
+ const s = {
1144
+ triggerDOMElement: e.sourceDOMElement,
1145
+ withRenderState: "storage"
1146
+ };
1147
+ this.container.get("settings").then((i) => {
1148
+ const { activate: o } = i;
1149
+ (typeof o == "undefined" || o === null || o === !0) && (this.activated = (this.activated || this.widget.activate()).then(
1150
+ () => this.attach(s)
1151
+ ));
1152
+ });
1153
+ }, this.container.registerAsync("storage", () => jn(this.container)), this.container.registerFactory("settings", () => L(
1154
+ this.container,
1155
+ vt,
1156
+ A.Local
1157
+ ).then((e = {}) => f(f({}, this.container.get("$settings")), e))), Re(this, "load", this.handleBootstrapping), this.container.registerAsync(
1158
+ "componentResolver",
1159
+ () => Un(this.container)
1160
+ ), this.container.registerAsync("router", () => Bn(this.container)), this.container.registerAsync("actionResolver", () => Wn(this.container)), this.container.register("matchMedia", window.matchMedia), this.container.registerAsync("components", () => Fn(this.container));
1161
+ }
1162
+ initialize() {
1163
+ const t = this.container.getManyAsync(
1164
+ "actionResolver",
1165
+ "router",
1166
+ "components"
1167
+ );
1168
+ return Promise.all([t, this.container.get("settings")]).then(
1169
+ ([{ actionResolver: e, router: s, components: i }, o]) => {
1170
+ var a;
1171
+ e.subscribe(
1172
+ this.widget.name,
1173
+ (c, d, l) => this.onAction(d, l)
1174
+ );
1175
+ const r = (c) => {
1176
+ i.nodes.query({ type: "view" }).forEach((d) => {
1177
+ i.setSwitch(d, c);
1178
+ });
1179
+ }, u = ((a = s.getInitialRoute()) == null ? void 0 : a.name) || "index";
1180
+ return r(u), this.events.subscribe("widget:data-loaded", (c, { element: d }) => {
1181
+ this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
1182
+ element: d
1183
+ });
1184
+ }), this.events.subscribe(
1185
+ "router:change",
1186
+ (c, { previous: d = { routeData: {} }, next: l = { routeData: {} } }) => {
1187
+ const { routeData: h } = d, { routeData: p } = l, g = Object.keys(o.views).reduce((y, v) => typeof o.views[v].path == "undefined" ? v : y, "");
1188
+ !p.name && g ? r(g) : r(p.name), Mt(h && h.params), Mt(p && p.params), this.container.getAsync("actionResolver").then((y) => {
1189
+ y.action(this.widget.name, "routeChange", {
1190
+ next: p,
1191
+ previous: h
1192
+ });
1193
+ });
1194
+ }
1195
+ ), s.initialize();
1196
+ }
1197
+ );
1198
+ }
1199
+ attach(t = {}) {
1200
+ return this.container.get("settings").then(({ trigger: e }) => {
1201
+ var h, p;
1202
+ const {
1203
+ widgetDOMElement: s,
1204
+ key: i = Ce(),
1205
+ triggerDOMElement: o,
1206
+ withRenderState: r
1207
+ } = t, a = te(e) === T.Inline && ((o == null ? void 0 : o.childElementCount) || 0) > 0, c = Tn(
1208
+ this.widget.name,
1209
+ s,
1210
+ o,
1211
+ e,
1212
+ a
1213
+ );
1214
+ this.outlets.size < 1 && !r && this.setRenderState("unset");
1215
+ const d = () => {
1216
+ const g = () => y.querySelectorAll("[data-loading=true]").length === 0, [y] = this.widget.container.get("widgetDOMElements"), v = (tt, k) => {
1217
+ g() && (c.callback && c.callback(), k.disconnect());
1218
+ }, _ = {
1219
+ attributes: !0,
1220
+ subtree: !0,
1221
+ childList: !0
1222
+ };
1223
+ g() && c.callback && c.callback(), new MutationObserver(v).observe(y, _);
1224
+ };
1225
+ a && this.widget.container.getAsync("dataClient").then(({ events: g }) => {
1226
+ g.subscribe("data-client:fetched", (y, v) => {
1227
+ v.unresolvedQueries === 0 && d();
1228
+ });
1229
+ });
1230
+ const l = this.getOrCreateViewOutlet(i, c);
1231
+ if (this.outlets.set(i, l), this.widget.events.dispatch("widget:attached", {}, { bubbles: !0 }), c.triggerType === T.Badge && e && ((h = c.triggerDOMElement) == null || h.setAttribute("aria-expanded", "false"), l == null || l.renderBadge(e)), c.triggerType !== T.Inline && ((p = c.triggerDOMElement) == null || p.addEventListener("click", (g) => {
1232
+ g.preventDefault(), this.container.get("settings").then(({ trigger: y }) => {
1233
+ l.render().then(() => this.renderState()).then((v) => y && y.action && y.action === "hide" ? v === E.open ? this.hide() : this.open() : v === E.open ? this.close() : this.open());
1234
+ });
1235
+ })), this.outlets.size > 1)
1236
+ return this.renderState().then((g) => {
1237
+ this.triggerStateIfApplicable(g);
1238
+ });
1239
+ if (r)
1240
+ return r === "storage" ? this.renderState().then((g) => {
1241
+ if (c.triggerType === T.Inline) {
1242
+ this.triggerStateIfApplicable("open");
1243
+ return;
1244
+ }
1245
+ this.triggerStateIfApplicable(g);
1246
+ }) : this.triggerStateIfApplicable(r);
1247
+ });
1248
+ }
1249
+ detach(t) {
1250
+ if (t) {
1251
+ if (this.outlets.has(t)) {
1252
+ const e = this.outlets.get(t);
1253
+ e == null || e.dispose(), this.outlets.delete(t);
1254
+ return;
1255
+ }
1256
+ process.env.NODE_ENV !== "production" && console.warn(`detach(): Could not find View Outlet with key ${t}`);
1257
+ return;
1258
+ }
1259
+ this.outlets.forEach((e) => {
1260
+ e.dispose();
1261
+ }), this.outlets.clear();
1262
+ }
1263
+ triggerStateIfApplicable(t) {
1264
+ return this.container.getAsync("router").then((e) => {
1265
+ switch (t) {
1266
+ case "closed":
1267
+ this.close();
1268
+ break;
1269
+ case "open":
1270
+ this.open();
1271
+ break;
1272
+ case "hidden":
1273
+ this.hide(), e.start();
1274
+ break;
1275
+ default:
1276
+ return;
1277
+ }
1278
+ });
1279
+ }
1280
+ getOrCreateViewOutlet(t, e) {
1281
+ return this.outlets.has(t) ? this.outlets.get(t) : new In(this.container, e);
1282
+ }
1283
+ render(t = {}) {
1284
+ if (process.env.NODE_ENV !== "production" && console.warn("widget.render() is deprecated. Use widget.attach() instead."), t.open) {
1285
+ const e = w(f({}, t), {
1286
+ withRenderState: "open"
1287
+ });
1288
+ return this.attach(e);
1289
+ }
1290
+ return this.attach(t);
1291
+ }
1292
+ activate(t) {
1293
+ t != null && t.override && this.setSettings(() => t.override), t != null && t.apiNotificationPriorityBy && this.container.register("apiNotificationPriorityBy", t.apiNotificationPriorityBy);
1294
+ }
1295
+ setSettings(t) {
1296
+ return Promise.all([
1297
+ this.container.get("settings"),
1298
+ z(this.container, vt, B.Necessary, {
1299
+ medium: A.Local
1300
+ })
1301
+ ]).then(([e, s]) => Promise.resolve(t(e)).then((i) => s(i).then(() => {
1302
+ const o = f(f({}, e), i);
1303
+ return this.widget.events.dispatch("widget:settings-updated", o), o;
1304
+ })));
1305
+ }
1306
+ clearSettings() {
1307
+ return z(
1308
+ this.container,
1309
+ vt,
1310
+ B.Necessary,
1311
+ { medium: A.Local }
1312
+ ).then((t) => t()).then(() => this.container.get("settings")).then((t) => {
1313
+ this.widget.events.dispatch("widget:settings-updated", t);
1314
+ });
1315
+ }
1316
+ action({ action: t, value: e }) {
1317
+ return this.container.getAsync("actionResolver").then((s) => {
1318
+ s.action(this.widget.name, t, e);
1319
+ });
1320
+ }
1321
+ renderState() {
1322
+ if (Le(this.container))
1323
+ return Promise.resolve(E.open);
1324
+ const t = () => L(
1325
+ this.container,
1326
+ it,
1327
+ A.Session
1328
+ ).then((s = E.closed) => s), e = () => L(
1329
+ this.container,
1330
+ it,
1331
+ A.Session
1332
+ ).then((s = E.closed) => s);
1333
+ return this.container.getAsync("router").then((s) => s.isSticky() ? e().then((i) => i === E.open ? i : t()) : t());
1334
+ }
1335
+ hide() {
1336
+ return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
1337
+ "hide(): No-op as no view outlets are registered. Invoke the attach() command first."
1338
+ ), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "hide" }).then(() => {
1339
+ this.setTriggerState(!1);
1340
+ }));
1341
+ }
1342
+ open() {
1343
+ return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
1344
+ "open(): No-op as no view outlets are registered. Invoke the attach() command first."
1345
+ ), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "open" }).then(() => (this.widget.events.dispatch("tracking:widget-rendered", {}), this.onOpen())));
1346
+ }
1347
+ close() {
1348
+ return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
1349
+ "close(): No-op as no view outlets are registered. Invoke the attach() command first."
1350
+ ), Promise.resolve()) : this.action({ action: "close" }).then(() => this.onClose());
1351
+ }
1352
+ show() {
1353
+ return process.env.NODE_ENV !== "production" && console.warn(
1354
+ "show(): Command is deprecated and will be removed in the future. Use open() instead."
1355
+ ), this.open();
1356
+ }
1357
+ onAction(t, e) {
1358
+ switch (t) {
1359
+ case "close":
1360
+ case "open":
1361
+ case "hide":
1362
+ const s = t === "open" ? E.open : t === "close" ? E.closed : E.hidden;
1363
+ return this.setRenderState(s).then(() => {
1364
+ this.setTriggerState(s === E.open), s !== E.hidden ? s === E.open ? this.onOpen() : this.onClose() : this.outlets.forEach(
1365
+ (i) => {
1366
+ var o;
1367
+ return (o = i.options.triggerDOMElement) == null ? void 0 : o.setAttribute("aria-expanded", "false");
1368
+ }
1369
+ );
1370
+ });
1371
+ }
1372
+ }
1373
+ setRenderState(t) {
1374
+ const { invoke: e, events: s } = this.container.get("$widget");
1375
+ return Promise.all([
1376
+ z(this.container, it, B.Necessary, {
1377
+ medium: A.Session
1378
+ }),
1379
+ z(this.container, it, B.Necessary, {
1380
+ medium: A.Local,
1381
+ duration: { minutes: 5 }
1382
+ }),
1383
+ this.container.getAsync("router"),
1384
+ e("renderState")
1385
+ ]).then(([i, o, r, u]) => {
1386
+ t === "unset" || !t ? (o(), i()) : (r.isSticky() && o(t), i(t)), s.dispatch("widget:render-state-changed", {
1387
+ previous: u,
1388
+ next: t
1389
+ });
1390
+ });
1391
+ }
1392
+ onOpen() {
1393
+ return this.container.getAsync("router").then((t) => (this.outlets.forEach(
1394
+ (e) => {
1395
+ var s;
1396
+ return (s = e.options.triggerDOMElement) == null ? void 0 : s.setAttribute("aria-expanded", "true");
1397
+ }
1398
+ ), t.start()));
1399
+ }
1400
+ onClose() {
1401
+ const t = this.container.getManyAsync("router", "components");
1402
+ return (() => this.container.get("settings").then((s) => {
1403
+ const { activate: i } = this.container.get("$settings");
1404
+ return s.activate !== i ? this.setSettings(() => Promise.resolve({ activate: i })) : Promise.resolve();
1405
+ }))().then(() => t).then(
1406
+ ({
1407
+ router: s,
1408
+ components: i
1409
+ }) => {
1410
+ const o = i.nodes.visible;
1411
+ return this.outlets.forEach(
1412
+ (r) => {
1413
+ var u;
1414
+ return (u = r.options.triggerDOMElement) == null ? void 0 : u.setAttribute("aria-expanded", "false");
1415
+ }
1416
+ ), o.filter(
1417
+ (r) => r.attributes.properties.animation && r.attributes.properties.animation !== "none"
1418
+ ).length ? new Promise((r) => {
1419
+ setTimeout(() => {
1420
+ r(s);
1421
+ }, 200);
1422
+ }) : Promise.resolve(s);
1423
+ }
1424
+ ).then((s) => s.stop());
1425
+ }
1426
+ setTriggerState(t) {
1427
+ this.outlets.forEach((e) => {
1428
+ const {
1429
+ options: { triggerDOMElement: s, triggerOptions: i }
1430
+ } = e, { openTooltip: o, closedTooltip: r } = i || {};
1431
+ s && (t ? Xt(s, o) : Ln(s, r));
1432
+ });
1433
+ }
1434
+ deactivate() {
1435
+ this.subs.forEach((e) => e());
1436
+ const t = [];
1437
+ return this.outlets.forEach((e) => t.push(e.dispose())), L(
1438
+ this.container,
1439
+ zt,
1440
+ A.Local
1441
+ ).then((e) => e === this.widget.name ? z(
1442
+ this.container,
1443
+ zt,
1444
+ B.Necessary,
1445
+ {
1446
+ medium: A.Local,
1447
+ scope: ke.Implementation
1448
+ }
1449
+ ).then((s) => s()).then(() => Promise.all(t)) : Promise.all(t));
1450
+ }
1451
+ }
1452
+ export {
1453
+ At as C,
1454
+ sn as D,
1455
+ as as N,
1456
+ S as W,
1457
+ ls as a,
1458
+ _t as e,
1459
+ En as n,
1460
+ An as o,
1461
+ cs as r,
1462
+ lt as s,
1463
+ ut as t
1464
+ };
1465
+ //# sourceMappingURL=index.c6989014.js.map