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