@telia-ace/knowledge-widget-types-grid 1.0.54 → 1.1.1-rc.2

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,792 @@
1
+ var Rt = Object.defineProperty;
2
+ var Mt = (r, t, e) => t in r ? Rt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var k = (r, t, e) => (Mt(r, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { G as Tt, H as Ct, I as U, J as Dt, K as nt, _ as It, M as Y, N as Z, O as ut, P as At, Q as $t, T as _t, k as ft, j as Bt, c as Nt, U as dt, V as rt, X as it, Y as Ut, L as Ft, Z as st, $ as Q, a0 as lt, a1 as et, a2 as jt, r as Wt, a3 as Kt, a4 as z, a5 as J, a6 as Vt } from "./index-4a7683d6.mjs";
5
+ import { a7 as ke, a8 as Re } from "./index-4a7683d6.mjs";
6
+ import { c as Yt } from "./create-params-4e652cc7.mjs";
7
+ import "react/jsx-runtime";
8
+ import "@emotion/styled";
9
+ import "@emotion/react";
10
+ import "react";
11
+ import "react-transition-group";
12
+ import "react-dom";
13
+ import "react-router-dom";
14
+ import "react-router";
15
+ var zt = function(r, t, e, n, s, a, c, p) {
16
+ if (process.env.NODE_ENV !== "production" && t === void 0)
17
+ throw new Error("invariant requires an error message argument");
18
+ if (!r) {
19
+ var h;
20
+ if (t === void 0)
21
+ h = new Error(
22
+ "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
23
+ );
24
+ else {
25
+ var d = [e, n, s, a, c, p], S = 0;
26
+ h = new Error(
27
+ t.replace(/%s/g, function() {
28
+ return d[S++];
29
+ })
30
+ ), h.name = "Invariant Violation";
31
+ }
32
+ throw h.framesToPop = 1, h;
33
+ }
34
+ }, qt = zt;
35
+ const Gt = /* @__PURE__ */ Tt(qt);
36
+ var Qt = function(t) {
37
+ return t.charAt(0) === "/" ? t : "/" + t;
38
+ }, Ot = function(t, e) {
39
+ return new RegExp("^" + e + "(\\/|\\?|#|$)", "i").test(t);
40
+ }, Jt = function(t, e) {
41
+ return Ot(t, e) ? t.substr(e.length) : t;
42
+ }, Xt = function(t) {
43
+ return t.charAt(t.length - 1) === "/" ? t.slice(0, -1) : t;
44
+ }, Zt = function(t) {
45
+ var e = t || "/", n = "", s = "", a = e.indexOf("#");
46
+ a !== -1 && (s = e.substr(a), e = e.substr(0, a));
47
+ var c = e.indexOf("?");
48
+ return c !== -1 && (n = e.substr(c), e = e.substr(0, c)), {
49
+ pathname: e,
50
+ search: n === "?" ? "" : n,
51
+ hash: s === "#" ? "" : s
52
+ };
53
+ }, Et = function(t) {
54
+ var e = t.pathname, n = t.search, s = t.hash, a = e || "/";
55
+ return n && n !== "?" && (a += n.charAt(0) === "?" ? n : "?" + n), s && s !== "#" && (a += s.charAt(0) === "#" ? s : "#" + s), a;
56
+ }, te = Object.assign || function(r) {
57
+ for (var t = 1; t < arguments.length; t++) {
58
+ var e = arguments[t];
59
+ for (var n in e)
60
+ Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
61
+ }
62
+ return r;
63
+ }, q = function(t, e, n, s) {
64
+ var a = void 0;
65
+ typeof t == "string" ? (a = Zt(t), a.state = e) : (a = te({}, t), a.pathname === void 0 && (a.pathname = ""), a.search ? a.search.charAt(0) !== "?" && (a.search = "?" + a.search) : a.search = "", a.hash ? a.hash.charAt(0) !== "#" && (a.hash = "#" + a.hash) : a.hash = "", e !== void 0 && a.state === void 0 && (a.state = e));
66
+ try {
67
+ a.pathname = decodeURI(a.pathname);
68
+ } catch (c) {
69
+ throw c instanceof URIError ? new URIError('Pathname "' + a.pathname + '" could not be decoded. This is likely caused by an invalid percent-encoding.') : c;
70
+ }
71
+ return n && (a.key = n), s ? a.pathname ? a.pathname.charAt(0) !== "/" && (a.pathname = Ct(a.pathname, s.pathname)) : a.pathname = s.pathname : a.pathname || (a.pathname = "/"), a;
72
+ }, kt = function() {
73
+ var t = null, e = function(h) {
74
+ return U(t == null, "A history supports only one prompt at a time"), t = h, function() {
75
+ t === h && (t = null);
76
+ };
77
+ }, n = function(h, d, S, v) {
78
+ if (t != null) {
79
+ var C = typeof t == "function" ? t(h, d) : t;
80
+ typeof C == "string" ? typeof S == "function" ? S(C, v) : (U(!1, "A history needs a getUserConfirmation function in order to use a prompt message"), v(!0)) : v(C !== !1);
81
+ } else
82
+ v(!0);
83
+ }, s = [], a = function(h) {
84
+ var d = !0, S = function() {
85
+ d && h.apply(void 0, arguments);
86
+ };
87
+ return s.push(S), function() {
88
+ d = !1, s = s.filter(function(v) {
89
+ return v !== S;
90
+ });
91
+ };
92
+ }, c = function() {
93
+ for (var h = arguments.length, d = Array(h), S = 0; S < h; S++)
94
+ d[S] = arguments[S];
95
+ s.forEach(function(v) {
96
+ return v.apply(void 0, d);
97
+ });
98
+ };
99
+ return {
100
+ setPrompt: e,
101
+ confirmTransitionTo: n,
102
+ appendListener: a,
103
+ notifyListeners: c
104
+ };
105
+ }, ee = !!(typeof window < "u" && window.document && window.document.createElement), pt = function(t, e, n) {
106
+ return t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent("on" + e, n);
107
+ }, gt = function(t, e, n) {
108
+ return t.removeEventListener ? t.removeEventListener(e, n, !1) : t.detachEvent("on" + e, n);
109
+ }, ne = function(t, e) {
110
+ return e(window.confirm(t));
111
+ }, ae = function() {
112
+ var t = window.navigator.userAgent;
113
+ return (t.indexOf("Android 2.") !== -1 || t.indexOf("Android 4.0") !== -1) && t.indexOf("Mobile Safari") !== -1 && t.indexOf("Chrome") === -1 && t.indexOf("Windows Phone") === -1 ? !1 : window.history && "pushState" in window.history;
114
+ }, re = function() {
115
+ return window.navigator.userAgent.indexOf("Trident") === -1;
116
+ }, ie = function(t) {
117
+ return t.state === void 0 && navigator.userAgent.indexOf("CriOS") === -1;
118
+ }, mt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
119
+ return typeof r;
120
+ } : function(r) {
121
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
122
+ }, se = Object.assign || function(r) {
123
+ for (var t = 1; t < arguments.length; t++) {
124
+ var e = arguments[t];
125
+ for (var n in e)
126
+ Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
127
+ }
128
+ return r;
129
+ }, vt = "popstate", yt = "hashchange", wt = function() {
130
+ try {
131
+ return window.history.state || {};
132
+ } catch {
133
+ return {};
134
+ }
135
+ }, oe = function() {
136
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
137
+ Gt(ee, "Browser history needs a DOM");
138
+ var e = window.history, n = ae(), s = !re(), a = t.forceRefresh, c = a === void 0 ? !1 : a, p = t.getUserConfirmation, h = p === void 0 ? ne : p, d = t.keyLength, S = d === void 0 ? 6 : d, v = t.basename ? Xt(Qt(t.basename)) : "", C = function(i) {
139
+ var l = i || {}, y = l.key, g = l.state, H = window.location, P = H.pathname, M = H.search, N = H.hash, T = P + M + N;
140
+ return U(!v || Ot(T, v), 'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "' + T + '" to begin with "' + v + '".'), v && (T = Jt(T, v)), q(T, g, y);
141
+ }, F = function() {
142
+ return Math.random().toString(36).substr(2, S);
143
+ }, D = kt(), B = function(i) {
144
+ se(f, i), f.length = e.length, D.notifyListeners(f.location, f.action);
145
+ }, R = function(i) {
146
+ ie(i) || W(C(i.state));
147
+ }, A = function() {
148
+ W(C(wt()));
149
+ }, j = !1, W = function(i) {
150
+ if (j)
151
+ j = !1, B();
152
+ else {
153
+ var l = "POP";
154
+ D.confirmTransitionTo(i, l, h, function(y) {
155
+ y ? B({ action: l, location: i }) : X(i);
156
+ });
157
+ }
158
+ }, X = function(i) {
159
+ var l = f.location, y = I.indexOf(l.key);
160
+ y === -1 && (y = 0);
161
+ var g = I.indexOf(i.key);
162
+ g === -1 && (g = 0);
163
+ var H = y - g;
164
+ H && (j = !0, b(H));
165
+ }, G = C(wt()), I = [G.key], m = function(i) {
166
+ return v + Et(i);
167
+ }, x = function(i, l) {
168
+ U(!((typeof i > "u" ? "undefined" : mt(i)) === "object" && i.state !== void 0 && l !== void 0), "You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");
169
+ var y = "PUSH", g = q(i, l, F(), f.location);
170
+ D.confirmTransitionTo(g, y, h, function(H) {
171
+ if (H) {
172
+ var P = m(g), M = g.key, N = g.state;
173
+ if (n)
174
+ if (e.pushState({ key: M, state: N }, null, P), c)
175
+ window.location.href = P;
176
+ else {
177
+ var T = I.indexOf(f.location.key), tt = I.slice(0, T === -1 ? 0 : T + 1);
178
+ tt.push(g.key), I = tt, B({ action: y, location: g });
179
+ }
180
+ else
181
+ U(N === void 0, "Browser history cannot push state in browsers that do not support HTML5 history"), window.location.href = P;
182
+ }
183
+ });
184
+ }, w = function(i, l) {
185
+ U(!((typeof i > "u" ? "undefined" : mt(i)) === "object" && i.state !== void 0 && l !== void 0), "You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");
186
+ var y = "REPLACE", g = q(i, l, F(), f.location);
187
+ D.confirmTransitionTo(g, y, h, function(H) {
188
+ if (H) {
189
+ var P = m(g), M = g.key, N = g.state;
190
+ if (n)
191
+ if (e.replaceState({ key: M, state: N }, null, P), c)
192
+ window.location.replace(P);
193
+ else {
194
+ var T = I.indexOf(f.location.key);
195
+ T !== -1 && (I[T] = g.key), B({ action: y, location: g });
196
+ }
197
+ else
198
+ U(N === void 0, "Browser history cannot replace state in browsers that do not support HTML5 history"), window.location.replace(P);
199
+ }
200
+ });
201
+ }, b = function(i) {
202
+ e.go(i);
203
+ }, E = function() {
204
+ return b(-1);
205
+ }, L = function() {
206
+ return b(1);
207
+ }, $ = 0, V = function(i) {
208
+ $ += i, $ === 1 ? (pt(window, vt, R), s && pt(window, yt, A)) : $ === 0 && (gt(window, vt, R), s && gt(window, yt, A));
209
+ }, _ = !1, O = function() {
210
+ var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, l = D.setPrompt(i);
211
+ return _ || (V(1), _ = !0), function() {
212
+ return _ && (_ = !1, V(-1)), l();
213
+ };
214
+ }, u = function(i) {
215
+ var l = D.appendListener(i);
216
+ return V(1), function() {
217
+ V(-1), l();
218
+ };
219
+ }, f = {
220
+ length: e.length,
221
+ action: "POP",
222
+ location: G,
223
+ createHref: m,
224
+ push: x,
225
+ replace: w,
226
+ go: b,
227
+ goBack: E,
228
+ goForward: L,
229
+ block: O,
230
+ listen: u
231
+ };
232
+ return f;
233
+ }, Pt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
234
+ return typeof r;
235
+ } : function(r) {
236
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
237
+ }, ce = Object.assign || function(r) {
238
+ for (var t = 1; t < arguments.length; t++) {
239
+ var e = arguments[t];
240
+ for (var n in e)
241
+ Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
242
+ }
243
+ return r;
244
+ }, St = function(t, e, n) {
245
+ return Math.min(Math.max(t, e), n);
246
+ }, he = function() {
247
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = t.getUserConfirmation, n = t.initialEntries, s = n === void 0 ? ["/"] : n, a = t.initialIndex, c = a === void 0 ? 0 : a, p = t.keyLength, h = p === void 0 ? 6 : p, d = kt(), S = function(w) {
248
+ ce(m, w), m.length = m.entries.length, d.notifyListeners(m.location, m.action);
249
+ }, v = function() {
250
+ return Math.random().toString(36).substr(2, h);
251
+ }, C = St(c, 0, s.length - 1), F = s.map(function(x) {
252
+ return typeof x == "string" ? q(x, void 0, v()) : q(x, void 0, x.key || v());
253
+ }), D = Et, B = function(w, b) {
254
+ U(!((typeof w > "u" ? "undefined" : Pt(w)) === "object" && w.state !== void 0 && b !== void 0), "You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");
255
+ var E = "PUSH", L = q(w, b, v(), m.location);
256
+ d.confirmTransitionTo(L, E, e, function($) {
257
+ if ($) {
258
+ var V = m.index, _ = V + 1, O = m.entries.slice(0);
259
+ O.length > _ ? O.splice(_, O.length - _, L) : O.push(L), S({
260
+ action: E,
261
+ location: L,
262
+ index: _,
263
+ entries: O
264
+ });
265
+ }
266
+ });
267
+ }, R = function(w, b) {
268
+ U(!((typeof w > "u" ? "undefined" : Pt(w)) === "object" && w.state !== void 0 && b !== void 0), "You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");
269
+ var E = "REPLACE", L = q(w, b, v(), m.location);
270
+ d.confirmTransitionTo(L, E, e, function($) {
271
+ $ && (m.entries[m.index] = L, S({ action: E, location: L }));
272
+ });
273
+ }, A = function(w) {
274
+ var b = St(m.index + w, 0, m.entries.length - 1), E = "POP", L = m.entries[b];
275
+ d.confirmTransitionTo(L, E, e, function($) {
276
+ $ ? S({
277
+ action: E,
278
+ location: L,
279
+ index: b
280
+ }) : S();
281
+ });
282
+ }, j = function() {
283
+ return A(-1);
284
+ }, W = function() {
285
+ return A(1);
286
+ }, X = function(w) {
287
+ var b = m.index + w;
288
+ return b >= 0 && b < m.entries.length;
289
+ }, G = function() {
290
+ var w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
291
+ return d.setPrompt(w);
292
+ }, I = function(w) {
293
+ return d.appendListener(w);
294
+ }, m = {
295
+ length: F.length,
296
+ action: "POP",
297
+ location: F[C],
298
+ index: C,
299
+ entries: F,
300
+ createHref: D,
301
+ push: B,
302
+ replace: R,
303
+ go: A,
304
+ goBack: j,
305
+ goForward: W,
306
+ canGo: X,
307
+ block: G,
308
+ listen: I
309
+ };
310
+ return m;
311
+ };
312
+ const bt = "hashchange", ue = {
313
+ hashbang: {
314
+ encodePath: (r) => r.charAt(0) === "!" ? r : "!/" + ut(r),
315
+ decodePath: (r) => r.charAt(0) === "!" ? r.substr(1) : r
316
+ },
317
+ noslash: {
318
+ encodePath: ut,
319
+ decodePath: nt
320
+ },
321
+ slash: {
322
+ encodePath: nt,
323
+ decodePath: nt
324
+ }
325
+ }, K = () => {
326
+ const r = window.location.href, t = r.indexOf("#");
327
+ return t === -1 ? "" : r.substring(t + 1);
328
+ }, xt = (r) => window.location.hash = r, Lt = (r) => {
329
+ const t = window.location.href.indexOf("#");
330
+ window.location.replace(
331
+ window.location.href.slice(0, t >= 0 ? t : 0) + "#" + r
332
+ );
333
+ }, at = (r = "") => {
334
+ const t = r.replace(";", "?"), e = [
335
+ { from: /\;+/gi, to: "&" },
336
+ { from: /:+/gi, to: "=" }
337
+ ];
338
+ let n = t;
339
+ return e.forEach(({ to: s, from: a }) => {
340
+ n = n.replace(a, s);
341
+ }), n;
342
+ }, fe = (r = {}) => {
343
+ const t = window.history, { getUserConfirmation: e = At, hashType: n = "slash" } = r, s = r.basename ? Dt(nt(r.basename)) : "", { encodePath: a } = ue[n], c = () => {
344
+ const u = K(), f = S(u);
345
+ return Z(f, at);
346
+ }, p = r.transitionManager || It(), h = (u) => {
347
+ Object.assign(O, u), O.length = t.length, p.notifyListeners(
348
+ O.location,
349
+ O.action,
350
+ r.widgetName
351
+ );
352
+ };
353
+ let d = !1;
354
+ const S = (u) => {
355
+ const f = (l) => {
356
+ function y(g, H) {
357
+ const P = {};
358
+ let M;
359
+ for (; M = H.exec(g); )
360
+ P[M[1]] = M[2];
361
+ return P;
362
+ }
363
+ return y(l, /([^#?&=]+)=([^&#]*)(?!.*?\#)/gi) || null;
364
+ }, o = "humany-" + r.widgetName;
365
+ return f(u)[o];
366
+ }, v = () => {
367
+ const u = c(), f = O.location;
368
+ !d && $t(f, u) || C(u);
369
+ }, C = (u) => {
370
+ if (d)
371
+ d = !1, h();
372
+ else {
373
+ const f = "POP";
374
+ p.confirmTransitionTo(
375
+ u,
376
+ f,
377
+ e,
378
+ (o) => {
379
+ o ? h({ action: f, location: u }) : F(u);
380
+ }
381
+ );
382
+ }
383
+ }, F = (u) => {
384
+ const f = O.location;
385
+ let o = R.lastIndexOf(Y(f));
386
+ o === -1 && (o = 0);
387
+ let i = R.lastIndexOf(Y(u));
388
+ i === -1 && (i = 0);
389
+ const l = o - i;
390
+ l && (d = !0, m(l));
391
+ }, D = K(), B = a(D);
392
+ D !== B && Lt(B);
393
+ let R = [];
394
+ const A = c();
395
+ A.pathname !== null && R.push(Y(A));
396
+ const j = (u = "") => {
397
+ const f = [
398
+ { from: /\?+/gi, to: ";" },
399
+ { from: /\&amp;+/gi, to: ";" },
400
+ { from: /\&+/gi, to: ";" },
401
+ { from: /=+/gi, to: ":" }
402
+ ];
403
+ let o = u;
404
+ return f.forEach(({ to: i, from: l }) => {
405
+ o = o.replace(l, i);
406
+ }), o;
407
+ }, W = (u, f, o) => {
408
+ let i = "", l = !1;
409
+ return u.split("&").forEach((g) => {
410
+ const H = g.split("="), P = H[0], M = H[1];
411
+ if (P === f) {
412
+ if (l = !0, o === null)
413
+ return;
414
+ i.length > 0 && (i += "&"), typeof o < "u" ? i += P + "=" + o : i += P;
415
+ } else
416
+ P && (i.length > 0 && (i += "&"), i += P + "=" + M);
417
+ }), !l && o !== null && (i.length > 0 && (i += "&"), typeof o < "u" ? i += f + "=" + o : i += f), i;
418
+ }, X = (u) => {
419
+ const f = u.pathname, o = j(u.search), i = f + (o ? `;${o}` : ""), y = `humany-${r.widgetName}`, g = K();
420
+ return `#${W(g, y, i).replace(
421
+ ";;",
422
+ ";"
423
+ )}`;
424
+ }, G = (u, f) => {
425
+ const o = "PUSH", i = Z(u, at), l = i.pathname, y = j(i.search), g = l + (y ? `${y}` : ""), P = `humany-${r.widgetName}`, M = K(), N = W(M, P, g);
426
+ p.confirmTransitionTo(
427
+ i,
428
+ o,
429
+ e,
430
+ (T) => {
431
+ if (!T)
432
+ return;
433
+ const tt = Y(i), ot = a(N);
434
+ if (K() !== ot) {
435
+ xt(ot);
436
+ const ct = R.lastIndexOf(Y(O.location)), ht = R.slice(
437
+ 0,
438
+ ct === -1 ? 0 : ct + 1
439
+ );
440
+ ht.push(tt), R = ht, h({ action: o, location: i });
441
+ } else
442
+ h();
443
+ }
444
+ );
445
+ }, I = (u, f) => {
446
+ const o = "REPLACE", i = Z(u, at);
447
+ p.confirmTransitionTo(
448
+ i,
449
+ o,
450
+ e,
451
+ (l) => {
452
+ if (!l)
453
+ return;
454
+ const y = Y(i), g = a(s + y);
455
+ K() !== g && Lt(g);
456
+ const P = R.indexOf(Y(O.location));
457
+ P !== -1 && (R[P] = y), h({ action: o, location: i });
458
+ }
459
+ );
460
+ }, m = (u) => {
461
+ t.go(u);
462
+ }, x = () => m(-1), w = () => m(1);
463
+ let b = 0;
464
+ const E = (u) => {
465
+ b += u, b === 1 ? window.addEventListener(bt, v) : b === 0 && window.removeEventListener(bt, v);
466
+ };
467
+ let L = !1;
468
+ const O = {
469
+ createHref: X,
470
+ createLocation: Z,
471
+ push: G,
472
+ replace: I,
473
+ go: m,
474
+ goBack: x,
475
+ goForward: w,
476
+ block: (u = !1) => {
477
+ const f = p.setPrompt(u);
478
+ return L || (E(1), L = !0), () => (L && (L = !1, E(-1)), f());
479
+ },
480
+ listen: (u) => {
481
+ const f = p.appendListener(u);
482
+ return E(1), () => {
483
+ E(-1), f();
484
+ };
485
+ },
486
+ stop: () => {
487
+ const u = K(), f = W(
488
+ u,
489
+ `humany-${r.widgetName}`,
490
+ null
491
+ ), o = a(f);
492
+ xt(o);
493
+ },
494
+ length: t.length,
495
+ action: "POP",
496
+ location: A
497
+ };
498
+ return O;
499
+ }, de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
500
+ __proto__: null,
501
+ decodeSearch: at,
502
+ default: fe,
503
+ getHashPath: K
504
+ }, Symbol.toStringTag, { value: "Module" })), Ht = "routeData";
505
+ class He {
506
+ constructor(t, e) {
507
+ k(this, "settings");
508
+ k(this, "routes");
509
+ k(this, "steps", []);
510
+ k(this, "location");
511
+ k(this, "history");
512
+ k(this, "widget");
513
+ k(this, "match");
514
+ k(this, "currentRoute");
515
+ k(this, "historyListenSubscription", () => {
516
+ });
517
+ k(this, "initialized");
518
+ k(this, "sticky", !1);
519
+ k(this, "storageWriter", null);
520
+ k(this, "storageMedium");
521
+ this.container = t, this.widget = t.get("$widget");
522
+ const { routes: n, ...s } = e;
523
+ this.settings = { ...s, ...t.get("routingSettings") }, this.sticky = _t(this.settings), this.storageMedium = this.sticky ? ft.Local : ft.Session, Bt(t, Ht, Nt.Necessary, {
524
+ medium: this.storageMedium
525
+ }).then((a) => this.storageWriter = a), this.routes = n;
526
+ }
527
+ initialize() {
528
+ return this.initialized = this.initialized || this.createHistory().then((t) => {
529
+ this.history = t, this.location = t.location, this.historyListenSubscription = t.listen(
530
+ (e, n, s) => this.handleLocationChange(e, s)
531
+ );
532
+ });
533
+ }
534
+ setMatch(t) {
535
+ if (this.match = t, this.location) {
536
+ const e = this.getRouteData(), n = {
537
+ routeData: e,
538
+ location: this.location
539
+ }, s = this.steps[0], a = e.name === (s == null ? void 0 : s.routeData.name), c = dt(
540
+ e.params,
541
+ (s == null ? void 0 : s.routeData.params) || {}
542
+ );
543
+ (!a || !c) && (this.widget.events.dispatch("router:change", { next: n, previous: s }), this.steps.unshift(n), this.storageWriter && this.storageWriter(n.routeData), this.widget.events.dispatch("router:changed", {
544
+ previous: s,
545
+ current: n
546
+ }));
547
+ }
548
+ }
549
+ onRouteChange(t) {
550
+ return this.widget.events.subscribe("router:change", t);
551
+ }
552
+ isSticky() {
553
+ return this.sticky;
554
+ }
555
+ /**
556
+ * Generate a formatted path from string
557
+ * @param routeName Name of route to generate path for
558
+ * @param params Optional: route params
559
+ */
560
+ generate(t, e = {}) {
561
+ const n = rt(t, this.routes);
562
+ if (!n || !this.history)
563
+ throw `No route found for ${t}`;
564
+ const s = it(e, n.path);
565
+ if (!s)
566
+ throw `Unable to generate path for "${t}".`;
567
+ const a = Z(s, this.settings.decodeSearch);
568
+ let c = this.history.createHref(a);
569
+ const { mode: p, basePath: h } = this.settings;
570
+ return p === "browser" && h && (c = c.replace(h, "")), c.charAt(0) !== "/" && (c = `/${c}`), c;
571
+ }
572
+ /**
573
+ * Navigate to path
574
+ * @param routeName Route to navigate to
575
+ * @param params Optional: route params
576
+ */
577
+ navigate(t, e = {}) {
578
+ const n = rt(t, this.routes);
579
+ if (!n || !this.history)
580
+ return;
581
+ const s = it(e, n.path);
582
+ if (!s)
583
+ return;
584
+ const a = this.getRouteData(), c = a && a.name === t && Ut(a.params, e);
585
+ if (this.steps[0] && c)
586
+ return;
587
+ const { decodeSearch: h } = this.settings, d = h ? h(s) : s;
588
+ this.widget.events.dispatch("router:navigate", {
589
+ decodedPath: d
590
+ }), d.charAt(0) !== "/" ? this.history.push(`/${d}`) : this.history.push(d);
591
+ }
592
+ /**
593
+ * Return true or false depending
594
+ * on whether it is possible to navigate backwards
595
+ */
596
+ hasBack() {
597
+ if (this.steps.length > 1)
598
+ return !0;
599
+ const t = this.getRouteData(this.settings.initialPath), e = this.getRouteData(), n = e.name === t.name, s = dt(e.params, t.params);
600
+ return !n || !s;
601
+ }
602
+ /**
603
+ * Navigate to previous route
604
+ */
605
+ goBack(t = 1) {
606
+ if (this.steps.length < 2) {
607
+ const e = this.getRouteData(this.settings.initialPath);
608
+ e && e.name && (this.navigate(e.name, e.params), this.steps = []);
609
+ } else {
610
+ const e = t >= this.steps.length ? this.steps.length - 1 : t, { routeData: n } = this.steps[e];
611
+ this.steps = [...this.steps.slice(e + 1)], this.navigate(n.name, Yt(n.params));
612
+ }
613
+ }
614
+ /**
615
+ * Navigate to next route
616
+ */
617
+ goForward() {
618
+ this.history && this.history.goForward();
619
+ }
620
+ /**
621
+ * Get the current location
622
+ */
623
+ current() {
624
+ return this.location;
625
+ }
626
+ /**
627
+ * Get the initial route. If the defined initial route does not exist,
628
+ * return the first defined route
629
+ */
630
+ getInitialRoute() {
631
+ const { name: t } = this.getRouteData(this.settings.initialPath), e = this.routes.find((n) => n.name === t);
632
+ return e || (this.routes.length > 0 ? this.routes[0] : (process.env.NODE_ENV !== "production" && Ft.warn("Unable to get initial route as no routes are defined."), null));
633
+ }
634
+ getRouteData(t) {
635
+ const e = st(this.container);
636
+ if (t) {
637
+ const n = Q(t, this.routes);
638
+ return n ? {
639
+ params: lt(
640
+ et(t, n.path)
641
+ ),
642
+ name: n.name
643
+ } : e || {
644
+ name: "",
645
+ params: {}
646
+ };
647
+ }
648
+ if (this.location) {
649
+ const { pathname: n, search: s } = this.location;
650
+ if (this.currentRoute = this.currentRoute || Q(n, this.routes), this.currentRoute) {
651
+ const { path: a, name: c } = this.currentRoute;
652
+ this.match || (this.match = {
653
+ params: et(n, a),
654
+ isExact: !0,
655
+ path: a,
656
+ url: n
657
+ });
658
+ const p = lt({
659
+ ...this.match.params,
660
+ ...s.length > 0 && jt(s)
661
+ });
662
+ return {
663
+ name: c,
664
+ params: p
665
+ };
666
+ }
667
+ }
668
+ return e || {
669
+ name: "",
670
+ params: {}
671
+ };
672
+ }
673
+ dispose() {
674
+ return this.historyListenSubscription(), this.stop();
675
+ }
676
+ /**
677
+ * Setup and load the initial route based on router configuration
678
+ */
679
+ setupInitialRoute() {
680
+ return Wt(
681
+ this.container,
682
+ Ht,
683
+ this.storageMedium
684
+ ).then((t) => {
685
+ if (!this.location || !this.history)
686
+ return;
687
+ const { initialPath: e, mode: n } = this.settings;
688
+ switch ((() => {
689
+ const a = Kt(this.container);
690
+ return n === z.browser || a ? J.path : n === z.memory && t ? J.storage : J.initialPath;
691
+ })()) {
692
+ case J.initialPath: {
693
+ const a = this.getRouteData(e);
694
+ return a && a.name ? this.navigate(a.name, a.params) : void 0;
695
+ }
696
+ case J.path: {
697
+ const { pathname: a } = this.location;
698
+ if (this.currentRoute = Q(a, this.routes), this.currentRoute) {
699
+ const { path: p } = this.currentRoute;
700
+ return this.setMatch({
701
+ params: et(a, p),
702
+ isExact: !0,
703
+ path: p,
704
+ url: a
705
+ });
706
+ }
707
+ const c = st(this.container);
708
+ return c ? this.setMatch({
709
+ params: {},
710
+ isExact: !0,
711
+ path: c.name,
712
+ url: a
713
+ }) : void 0;
714
+ }
715
+ case J.storage: {
716
+ const { pathname: a } = this.location;
717
+ this.currentRoute = Q(a, this.routes);
718
+ const { name: c = "", params: p = {} } = t || {}, h = rt(c, this.routes);
719
+ if (h) {
720
+ const d = it(p, h.path);
721
+ if (d)
722
+ return this.history.push(d), this.location = { ...this.location, pathname: d }, this.currentRoute = Q(d, this.routes), this.setMatch({
723
+ params: p,
724
+ isExact: !0,
725
+ path: h.path,
726
+ url: d
727
+ });
728
+ }
729
+ return;
730
+ }
731
+ }
732
+ });
733
+ }
734
+ start() {
735
+ return this.setupInitialRoute();
736
+ }
737
+ stop() {
738
+ return this.history && (this.settings.mode === z.scopedHash && this.history.stop(), this.steps = [], this.storageWriter) ? this.storageWriter() : Promise.resolve();
739
+ }
740
+ handleLocationChange(t, e) {
741
+ const { pathname: n } = t, { mode: s } = this.settings;
742
+ if (n.indexOf("?") > -1 || n.indexOf(";") > -1 || s === z.scopedHash && e !== this.widget.name)
743
+ return;
744
+ this.location = t, this.currentRoute = Q(n, this.routes);
745
+ const a = st(this.container);
746
+ if (this.currentRoute) {
747
+ const { path: c } = this.currentRoute;
748
+ this.setMatch({
749
+ params: et(n, c),
750
+ isExact: !0,
751
+ path: c,
752
+ url: n
753
+ });
754
+ } else
755
+ a && this.setMatch({
756
+ params: {},
757
+ isExact: !0,
758
+ path: a.name,
759
+ url: n
760
+ });
761
+ }
762
+ createHistory() {
763
+ return new Promise((t) => {
764
+ const { mode: e, basePath: n } = this.settings;
765
+ if (e === z.scopedHash) {
766
+ const s = this.widget.name, a = Vt(this.container);
767
+ return Promise.resolve().then(() => de).then((c) => {
768
+ const p = c.default({
769
+ widgetName: s,
770
+ transitionManager: a,
771
+ hashType: "noslash"
772
+ });
773
+ return t(p);
774
+ });
775
+ }
776
+ if (e === z.memory)
777
+ return t(he());
778
+ if (e === z.browser)
779
+ return t(oe({ basename: n }));
780
+ throw "RoutingService: History could not be created.";
781
+ });
782
+ }
783
+ }
784
+ export {
785
+ z as HistoryMode,
786
+ He as RoutingService,
787
+ fe as createHashHistory,
788
+ ke as getScopedHashDOMLocation,
789
+ Re as getSpecificWidgetPath,
790
+ et as matchParams,
791
+ Kt as onWidgetUrl
792
+ };