@arbor-education/ask-arbor-chat-panel 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -30
- package/dist/index.cjs +21 -21
- package/dist/index.d.ts +21 -2
- package/dist/index.js +898 -851
- package/dist/style.css +1 -1
- package/dist-iife/ask-arbor-slideover.js +975 -0
- package/dist-iife/ask-arbor-widget.js +975 -0
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
var Sr = Object.defineProperty;
|
|
2
|
+
var wr = (e, t, r) => t in e ? Sr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var Ln = (e, t, r) => wr(e, typeof t != "symbol" ? t + "" : t, r);
|
|
1
4
|
import { jsxs as S, jsx as i, Fragment as we } from "react/jsx-runtime";
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { useRef as x, useMemo as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
5
|
+
import { Icon as Ot, Tag as Nr, Button as kr, Tabs as nn, Table as Rr, Slideover as Ir } from "@arbor-education/design-system.components";
|
|
6
|
+
import { useRef as x, useMemo as tr, useEffect as V, useState as M, useContext as Cr, createContext as vr, forwardRef as Tn, createElement as pn, useImperativeHandle as Or, useLayoutEffect as nr, useCallback as $t } from "react";
|
|
7
|
+
import { createPortal as rr } from "react-dom";
|
|
8
|
+
function Lr(e) {
|
|
6
9
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
10
|
}
|
|
8
|
-
var
|
|
11
|
+
var or = { exports: {} };
|
|
9
12
|
/*!
|
|
10
13
|
Copyright (c) 2018 Jed Watson.
|
|
11
14
|
Licensed under the MIT License (MIT), see
|
|
@@ -13,7 +16,7 @@ var tr = { exports: {} };
|
|
|
13
16
|
*/
|
|
14
17
|
(function(e) {
|
|
15
18
|
(function() {
|
|
16
|
-
var
|
|
19
|
+
var t = {}.hasOwnProperty;
|
|
17
20
|
function r() {
|
|
18
21
|
for (var s = "", u = 0; u < arguments.length; u++) {
|
|
19
22
|
var m = arguments[u];
|
|
@@ -32,7 +35,7 @@ var tr = { exports: {} };
|
|
|
32
35
|
return s.toString();
|
|
33
36
|
var u = "";
|
|
34
37
|
for (var m in s)
|
|
35
|
-
|
|
38
|
+
t.call(s, m) && s[m] && (u = l(u, m));
|
|
36
39
|
return u;
|
|
37
40
|
}
|
|
38
41
|
function l(s, u) {
|
|
@@ -40,65 +43,65 @@ var tr = { exports: {} };
|
|
|
40
43
|
}
|
|
41
44
|
e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
|
|
42
45
|
})();
|
|
43
|
-
})(
|
|
44
|
-
var
|
|
45
|
-
const _e = /* @__PURE__ */
|
|
46
|
-
function
|
|
47
|
-
var l = this, s = x(null), u = x(0), m = x(0), h = x(null),
|
|
46
|
+
})(or);
|
|
47
|
+
var Dr = or.exports;
|
|
48
|
+
const _e = /* @__PURE__ */ Lr(Dr);
|
|
49
|
+
function Mr(e, t, r, a) {
|
|
50
|
+
var l = this, s = x(null), u = x(0), m = x(0), h = x(null), f = x([]), T = x(), A = x(), _ = x(e), E = x(!0), k = x(), D = x();
|
|
48
51
|
_.current = e;
|
|
49
|
-
var
|
|
52
|
+
var N = typeof window < "u", w = !t && t !== 0 && N;
|
|
50
53
|
if (typeof e != "function") throw new TypeError("Expected a function");
|
|
51
|
-
|
|
52
|
-
var H = !!(r = r || {}).leading, pe = !("trailing" in r) || !!r.trailing, z = !!r.flushOnExit && pe, K = "maxWait" in r, U = "debounceOnServer" in r && !!r.debounceOnServer, q = K ? Math.max(+r.maxWait || 0,
|
|
53
|
-
var J = function(
|
|
54
|
-
var W =
|
|
55
|
-
return
|
|
56
|
-
}, G = function(
|
|
57
|
-
|
|
58
|
-
}, de = function(
|
|
54
|
+
t = +t || 0;
|
|
55
|
+
var H = !!(r = r || {}).leading, pe = !("trailing" in r) || !!r.trailing, z = !!r.flushOnExit && pe, K = "maxWait" in r, U = "debounceOnServer" in r && !!r.debounceOnServer, q = K ? Math.max(+r.maxWait || 0, t) : null, me = tr(function() {
|
|
56
|
+
var J = function(L) {
|
|
57
|
+
var W = f.current, he = T.current;
|
|
58
|
+
return f.current = T.current = null, u.current = L, m.current = m.current || L, A.current = _.current.apply(he, W);
|
|
59
|
+
}, G = function(L, W) {
|
|
60
|
+
w && cancelAnimationFrame(h.current), h.current = w ? requestAnimationFrame(L) : setTimeout(L, W);
|
|
61
|
+
}, de = function(L) {
|
|
59
62
|
if (!E.current) return !1;
|
|
60
|
-
var W =
|
|
61
|
-
return !s.current || W >=
|
|
62
|
-
}, b = function(
|
|
63
|
-
return h.current = null, pe &&
|
|
64
|
-
},
|
|
63
|
+
var W = L - s.current;
|
|
64
|
+
return !s.current || W >= t || W < 0 || K && L - u.current >= q;
|
|
65
|
+
}, b = function(L) {
|
|
66
|
+
return h.current = null, pe && f.current ? J(L) : (f.current = T.current = null, A.current);
|
|
67
|
+
}, O = function L() {
|
|
65
68
|
var W = Date.now();
|
|
66
69
|
if (H && m.current === u.current && B(), de(W)) return b(W);
|
|
67
70
|
if (E.current) {
|
|
68
|
-
var he =
|
|
69
|
-
G(
|
|
71
|
+
var he = t - (W - s.current), Le = K ? Math.min(he, q - (W - u.current)) : he;
|
|
72
|
+
G(L, Le);
|
|
70
73
|
}
|
|
71
74
|
}, B = function() {
|
|
72
75
|
}, re = function() {
|
|
73
|
-
if (
|
|
74
|
-
var
|
|
75
|
-
if (
|
|
76
|
+
if (N || U) {
|
|
77
|
+
var L, W = Date.now(), he = de(W);
|
|
78
|
+
if (f.current = [].slice.call(arguments), T.current = l, s.current = W, z && !k.current && (k.current = function() {
|
|
76
79
|
var Le;
|
|
77
|
-
((Le = globalThis.document) == null ? void 0 : Le.visibilityState) === "hidden" &&
|
|
78
|
-
}, (
|
|
79
|
-
if (!h.current && E.current) return u.current = s.current, G(
|
|
80
|
-
if (K) return G(
|
|
80
|
+
((Le = globalThis.document) == null ? void 0 : Le.visibilityState) === "hidden" && D.current.flush();
|
|
81
|
+
}, (L = globalThis.document) == null || L.addEventListener == null || L.addEventListener("visibilitychange", k.current)), he) {
|
|
82
|
+
if (!h.current && E.current) return u.current = s.current, G(O, t), H ? J(s.current) : A.current;
|
|
83
|
+
if (K) return G(O, t), J(s.current);
|
|
81
84
|
}
|
|
82
|
-
return h.current || G(
|
|
85
|
+
return h.current || G(O, t), A.current;
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
88
|
return re.cancel = function() {
|
|
86
|
-
var
|
|
87
|
-
|
|
89
|
+
var L = h.current;
|
|
90
|
+
L && (w ? cancelAnimationFrame(h.current) : clearTimeout(h.current)), u.current = 0, f.current = s.current = T.current = h.current = null;
|
|
88
91
|
}, re.isPending = function() {
|
|
89
92
|
return !!h.current;
|
|
90
93
|
}, re.flush = function() {
|
|
91
94
|
return h.current ? b(Date.now()) : A.current;
|
|
92
95
|
}, re;
|
|
93
|
-
}, [H, K,
|
|
94
|
-
return
|
|
96
|
+
}, [H, K, t, q, pe, z, w, N, U, a]);
|
|
97
|
+
return D.current = me, V(function() {
|
|
95
98
|
return E.current = !0, function() {
|
|
96
99
|
var J;
|
|
97
|
-
z &&
|
|
100
|
+
z && D.current.flush(), k.current && ((J = globalThis.document) == null || J.removeEventListener == null || J.removeEventListener("visibilitychange", k.current), k.current = null), E.current = !1;
|
|
98
101
|
};
|
|
99
102
|
}, [z]), me;
|
|
100
103
|
}
|
|
101
|
-
const
|
|
104
|
+
const xr = () => /* @__PURE__ */ S(
|
|
102
105
|
"svg",
|
|
103
106
|
{
|
|
104
107
|
width: "32",
|
|
@@ -131,13 +134,13 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
131
134
|
)
|
|
132
135
|
]
|
|
133
136
|
}
|
|
134
|
-
),
|
|
137
|
+
), Pr = "Enter", Ur = " ", Dn = ({
|
|
135
138
|
category: e,
|
|
136
|
-
isExpanded:
|
|
139
|
+
isExpanded: t,
|
|
137
140
|
onHeaderClick: r
|
|
138
141
|
}) => {
|
|
139
142
|
const a = `ask-arbor-prompt-library__body-${e.id}`, l = (s) => {
|
|
140
|
-
(s.key ===
|
|
143
|
+
(s.key === Pr || s.key === Ur) && (s.preventDefault(), r(e.id));
|
|
141
144
|
};
|
|
142
145
|
return /* @__PURE__ */ i(
|
|
143
146
|
"div",
|
|
@@ -146,7 +149,7 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
146
149
|
"ask-arbor-prompt-library__category",
|
|
147
150
|
`ask-arbor-prompt-library__category--${e.theme}`,
|
|
148
151
|
{
|
|
149
|
-
"ask-arbor-prompt-library__category--expanded":
|
|
152
|
+
"ask-arbor-prompt-library__category--expanded": t
|
|
150
153
|
}
|
|
151
154
|
),
|
|
152
155
|
children: /* @__PURE__ */ S(
|
|
@@ -157,12 +160,12 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
157
160
|
onKeyDown: l,
|
|
158
161
|
role: "button",
|
|
159
162
|
tabIndex: 0,
|
|
160
|
-
"aria-expanded":
|
|
163
|
+
"aria-expanded": t,
|
|
161
164
|
"aria-controls": a,
|
|
162
|
-
"aria-label": `${e.title}, ${
|
|
165
|
+
"aria-label": `${e.title}, ${t ? "collapse" : "expand"} to ${t ? "hide" : "show"} prompts`,
|
|
163
166
|
children: [
|
|
164
167
|
/* @__PURE__ */ i("div", { className: "ask-arbor-prompt-library__icon-circle", children: /* @__PURE__ */ i(
|
|
165
|
-
|
|
168
|
+
Ot,
|
|
166
169
|
{
|
|
167
170
|
name: e.icon,
|
|
168
171
|
size: 12,
|
|
@@ -171,11 +174,11 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
171
174
|
) }),
|
|
172
175
|
/* @__PURE__ */ i("div", { className: "ask-arbor-prompt-library__header-text", children: /* @__PURE__ */ i("h4", { className: "ask-arbor-prompt-library__title", children: e.title }) }),
|
|
173
176
|
/* @__PURE__ */ i(
|
|
174
|
-
|
|
177
|
+
Ot,
|
|
175
178
|
{
|
|
176
|
-
name:
|
|
179
|
+
name: t ? "chevron-up" : "chevron-down",
|
|
177
180
|
size: 16,
|
|
178
|
-
screenReaderText:
|
|
181
|
+
screenReaderText: t ? "Collapse section" : "Expand section",
|
|
179
182
|
className: "ask-arbor-prompt-library__chevron"
|
|
180
183
|
}
|
|
181
184
|
),
|
|
@@ -185,9 +188,9 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
185
188
|
)
|
|
186
189
|
}
|
|
187
190
|
);
|
|
188
|
-
},
|
|
191
|
+
}, Fr = ({
|
|
189
192
|
onSelectPrompt: e,
|
|
190
|
-
onPromptHover:
|
|
193
|
+
onPromptHover: t,
|
|
191
194
|
categories: r
|
|
192
195
|
}) => {
|
|
193
196
|
const [a, l] = M(
|
|
@@ -198,13 +201,13 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
198
201
|
);
|
|
199
202
|
}, u = (_, E) => {
|
|
200
203
|
_.stopPropagation(), e(E);
|
|
201
|
-
}, m = a != null ? r.findIndex((_) => _.id === a) : -1, h = m >= 0 ? r[m] : null,
|
|
204
|
+
}, m = a != null ? r.findIndex((_) => _.id === a) : -1, h = m >= 0 ? r[m] : null, f = (_) => /* @__PURE__ */ i(
|
|
202
205
|
"div",
|
|
203
206
|
{
|
|
204
207
|
className: "ask-arbor-prompt-library__grid-item ask-arbor-prompt-library__grid-item--full-width",
|
|
205
208
|
children: /* @__PURE__ */ S("div", { className: "ask-arbor-prompt-library__expanded-block", children: [
|
|
206
209
|
/* @__PURE__ */ i(
|
|
207
|
-
|
|
210
|
+
Dn,
|
|
208
211
|
{
|
|
209
212
|
category: _,
|
|
210
213
|
isExpanded: !0,
|
|
@@ -223,19 +226,19 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
223
226
|
{
|
|
224
227
|
className: "ask-arbor-prompt-library__prompt-group",
|
|
225
228
|
children: [
|
|
226
|
-
/* @__PURE__ */ i(
|
|
227
|
-
/* @__PURE__ */ i("div", { className: "ask-arbor-prompt-library__prompts", children: E.prompts.map((k,
|
|
229
|
+
/* @__PURE__ */ i(Nr, { color: _.theme, children: E.tag }),
|
|
230
|
+
/* @__PURE__ */ i("div", { className: "ask-arbor-prompt-library__prompts", children: E.prompts.map((k, D) => /* @__PURE__ */ S(
|
|
228
231
|
"button",
|
|
229
232
|
{
|
|
230
233
|
type: "button",
|
|
231
234
|
className: "ask-arbor-prompt-library__prompt-row",
|
|
232
|
-
onClick: (
|
|
233
|
-
onMouseEnter: () =>
|
|
234
|
-
onMouseLeave: () =>
|
|
235
|
+
onClick: (N) => u(N, k),
|
|
236
|
+
onMouseEnter: () => t == null ? void 0 : t(k),
|
|
237
|
+
onMouseLeave: () => t == null ? void 0 : t(null),
|
|
235
238
|
children: [
|
|
236
239
|
/* @__PURE__ */ i("span", { className: "ask-arbor-prompt-library__prompt-text", children: k }),
|
|
237
240
|
/* @__PURE__ */ i(
|
|
238
|
-
|
|
241
|
+
Ot,
|
|
239
242
|
{
|
|
240
243
|
name: "chevron-right",
|
|
241
244
|
size: 12,
|
|
@@ -244,7 +247,7 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
244
247
|
)
|
|
245
248
|
]
|
|
246
249
|
},
|
|
247
|
-
`${E.tag}-${
|
|
250
|
+
`${E.tag}-${D}`
|
|
248
251
|
)) })
|
|
249
252
|
]
|
|
250
253
|
},
|
|
@@ -256,7 +259,7 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
256
259
|
},
|
|
257
260
|
_.id
|
|
258
261
|
), T = (_) => /* @__PURE__ */ i("div", { className: "ask-arbor-prompt-library__grid-item", children: /* @__PURE__ */ i(
|
|
259
|
-
|
|
262
|
+
Dn,
|
|
260
263
|
{
|
|
261
264
|
category: _,
|
|
262
265
|
isExpanded: !1,
|
|
@@ -264,7 +267,7 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
264
267
|
}
|
|
265
268
|
) }, _.id), A = m >= 0 ? [
|
|
266
269
|
...r.slice(0, m).map(T),
|
|
267
|
-
|
|
270
|
+
f(h),
|
|
268
271
|
...r.slice(m + 1).map(T)
|
|
269
272
|
] : r.map(T);
|
|
270
273
|
return /* @__PURE__ */ i(
|
|
@@ -282,23 +285,23 @@ const Cr = () => /* @__PURE__ */ S(
|
|
|
282
285
|
* This source code is licensed under the ISC license.
|
|
283
286
|
* See the LICENSE file in the root directory of this source tree.
|
|
284
287
|
*/
|
|
285
|
-
const
|
|
288
|
+
const ar = (...e) => e.filter((t, r, a) => !!t && t.trim() !== "" && a.indexOf(t) === r).join(" ").trim();
|
|
286
289
|
/**
|
|
287
290
|
* @license lucide-react v1.21.0 - ISC
|
|
288
291
|
*
|
|
289
292
|
* This source code is licensed under the ISC license.
|
|
290
293
|
* See the LICENSE file in the root directory of this source tree.
|
|
291
294
|
*/
|
|
292
|
-
const
|
|
295
|
+
const Hr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
293
296
|
/**
|
|
294
297
|
* @license lucide-react v1.21.0 - ISC
|
|
295
298
|
*
|
|
296
299
|
* This source code is licensed under the ISC license.
|
|
297
300
|
* See the LICENSE file in the root directory of this source tree.
|
|
298
301
|
*/
|
|
299
|
-
const
|
|
302
|
+
const zr = (e) => e.replace(
|
|
300
303
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
301
|
-
(
|
|
304
|
+
(t, r, a) => a ? a.toUpperCase() : r.toLowerCase()
|
|
302
305
|
);
|
|
303
306
|
/**
|
|
304
307
|
* @license lucide-react v1.21.0 - ISC
|
|
@@ -306,9 +309,9 @@ const Mr = (e) => e.replace(
|
|
|
306
309
|
* This source code is licensed under the ISC license.
|
|
307
310
|
* See the LICENSE file in the root directory of this source tree.
|
|
308
311
|
*/
|
|
309
|
-
const
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
+
const Mn = (e) => {
|
|
313
|
+
const t = zr(e);
|
|
314
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
312
315
|
};
|
|
313
316
|
/**
|
|
314
317
|
* @license lucide-react v1.21.0 - ISC
|
|
@@ -333,35 +336,35 @@ var rn = {
|
|
|
333
336
|
* This source code is licensed under the ISC license.
|
|
334
337
|
* See the LICENSE file in the root directory of this source tree.
|
|
335
338
|
*/
|
|
336
|
-
const
|
|
337
|
-
for (const
|
|
338
|
-
if (
|
|
339
|
+
const Gr = (e) => {
|
|
340
|
+
for (const t in e)
|
|
341
|
+
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
339
342
|
return !0;
|
|
340
343
|
return !1;
|
|
341
|
-
},
|
|
342
|
-
({ color: e, size:
|
|
344
|
+
}, Br = vr({}), Wr = () => Cr(Br), $r = Tn(
|
|
345
|
+
({ color: e, size: t, strokeWidth: r, absoluteStrokeWidth: a, className: l = "", children: s, iconNode: u, ...m }, h) => {
|
|
343
346
|
const {
|
|
344
|
-
size:
|
|
347
|
+
size: f = 24,
|
|
345
348
|
strokeWidth: T = 2,
|
|
346
349
|
absoluteStrokeWidth: A = !1,
|
|
347
350
|
color: _ = "currentColor",
|
|
348
351
|
className: E = ""
|
|
349
|
-
} =
|
|
352
|
+
} = Wr() ?? {}, k = a ?? A ? Number(r ?? T) * 24 / Number(t ?? f) : r ?? T;
|
|
350
353
|
return pn(
|
|
351
354
|
"svg",
|
|
352
355
|
{
|
|
353
356
|
ref: h,
|
|
354
357
|
...rn,
|
|
355
|
-
width:
|
|
356
|
-
height:
|
|
358
|
+
width: t ?? f ?? rn.width,
|
|
359
|
+
height: t ?? f ?? rn.height,
|
|
357
360
|
stroke: e ?? _,
|
|
358
361
|
strokeWidth: k,
|
|
359
|
-
className:
|
|
360
|
-
...!s && !
|
|
362
|
+
className: ar("lucide", E, l),
|
|
363
|
+
...!s && !Gr(m) && { "aria-hidden": "true" },
|
|
361
364
|
...m
|
|
362
365
|
},
|
|
363
366
|
[
|
|
364
|
-
...u.map(([
|
|
367
|
+
...u.map(([D, N]) => pn(D, N)),
|
|
365
368
|
...Array.isArray(s) ? s : [s]
|
|
366
369
|
]
|
|
367
370
|
);
|
|
@@ -373,20 +376,20 @@ const xr = (e) => {
|
|
|
373
376
|
* This source code is licensed under the ISC license.
|
|
374
377
|
* See the LICENSE file in the root directory of this source tree.
|
|
375
378
|
*/
|
|
376
|
-
const Oe = (e,
|
|
379
|
+
const Oe = (e, t) => {
|
|
377
380
|
const r = Tn(
|
|
378
|
-
({ className: a, ...l }, s) => pn(
|
|
381
|
+
({ className: a, ...l }, s) => pn($r, {
|
|
379
382
|
ref: s,
|
|
380
|
-
iconNode:
|
|
381
|
-
className:
|
|
382
|
-
`lucide-${
|
|
383
|
+
iconNode: t,
|
|
384
|
+
className: ar(
|
|
385
|
+
`lucide-${Hr(Mn(e))}`,
|
|
383
386
|
`lucide-${e}`,
|
|
384
387
|
a
|
|
385
388
|
),
|
|
386
389
|
...l
|
|
387
390
|
})
|
|
388
391
|
);
|
|
389
|
-
return r.displayName =
|
|
392
|
+
return r.displayName = Mn(e), r;
|
|
390
393
|
};
|
|
391
394
|
/**
|
|
392
395
|
* @license lucide-react v1.21.0 - ISC
|
|
@@ -394,76 +397,76 @@ const Oe = (e, n) => {
|
|
|
394
397
|
* This source code is licensed under the ISC license.
|
|
395
398
|
* See the LICENSE file in the root directory of this source tree.
|
|
396
399
|
*/
|
|
397
|
-
const
|
|
400
|
+
const Yr = [
|
|
398
401
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
399
402
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
400
|
-
],
|
|
403
|
+
], jr = Oe("arrow-right", Yr);
|
|
401
404
|
/**
|
|
402
405
|
* @license lucide-react v1.21.0 - ISC
|
|
403
406
|
*
|
|
404
407
|
* This source code is licensed under the ISC license.
|
|
405
408
|
* See the LICENSE file in the root directory of this source tree.
|
|
406
409
|
*/
|
|
407
|
-
const
|
|
410
|
+
const Kr = [
|
|
408
411
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
409
412
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
410
413
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
411
|
-
],
|
|
414
|
+
], Vr = Oe("circle-alert", Kr);
|
|
412
415
|
/**
|
|
413
416
|
* @license lucide-react v1.21.0 - ISC
|
|
414
417
|
*
|
|
415
418
|
* This source code is licensed under the ISC license.
|
|
416
419
|
* See the LICENSE file in the root directory of this source tree.
|
|
417
420
|
*/
|
|
418
|
-
const
|
|
421
|
+
const qr = [
|
|
419
422
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
420
423
|
["path", { d: "M16 16s-1.5-2-4-2-4 2-4 2", key: "epbg0q" }],
|
|
421
424
|
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
422
425
|
["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
|
|
423
|
-
],
|
|
426
|
+
], Xr = Oe("frown", qr);
|
|
424
427
|
/**
|
|
425
428
|
* @license lucide-react v1.21.0 - ISC
|
|
426
429
|
*
|
|
427
430
|
* This source code is licensed under the ISC license.
|
|
428
431
|
* See the LICENSE file in the root directory of this source tree.
|
|
429
432
|
*/
|
|
430
|
-
const
|
|
433
|
+
const Zr = [
|
|
431
434
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
432
435
|
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
433
436
|
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
434
|
-
],
|
|
437
|
+
], Jr = Oe("info", Zr);
|
|
435
438
|
/**
|
|
436
439
|
* @license lucide-react v1.21.0 - ISC
|
|
437
440
|
*
|
|
438
441
|
* This source code is licensed under the ISC license.
|
|
439
442
|
* See the LICENSE file in the root directory of this source tree.
|
|
440
443
|
*/
|
|
441
|
-
const
|
|
444
|
+
const Qr = [
|
|
442
445
|
["path", { d: "M12 19v3", key: "npa21l" }],
|
|
443
446
|
["path", { d: "M15 9.34V5a3 3 0 0 0-5.68-1.33", key: "1gzdoj" }],
|
|
444
447
|
["path", { d: "M16.95 16.95A7 7 0 0 1 5 12v-2", key: "cqa7eg" }],
|
|
445
448
|
["path", { d: "M18.89 13.23A7 7 0 0 0 19 12v-2", key: "16hl24" }],
|
|
446
449
|
["path", { d: "m2 2 20 20", key: "1ooewy" }],
|
|
447
450
|
["path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12", key: "r2i35w" }]
|
|
448
|
-
],
|
|
451
|
+
], eo = Oe("mic-off", Qr);
|
|
449
452
|
/**
|
|
450
453
|
* @license lucide-react v1.21.0 - ISC
|
|
451
454
|
*
|
|
452
455
|
* This source code is licensed under the ISC license.
|
|
453
456
|
* See the LICENSE file in the root directory of this source tree.
|
|
454
457
|
*/
|
|
455
|
-
const
|
|
458
|
+
const to = [
|
|
456
459
|
["path", { d: "M12 19v3", key: "npa21l" }],
|
|
457
460
|
["path", { d: "M19 10v2a7 7 0 0 1-14 0v-2", key: "1vc78b" }],
|
|
458
461
|
["rect", { x: "9", y: "2", width: "6", height: "13", rx: "3", key: "s6n7sd" }]
|
|
459
|
-
],
|
|
462
|
+
], no = Oe("mic", to);
|
|
460
463
|
/**
|
|
461
464
|
* @license lucide-react v1.21.0 - ISC
|
|
462
465
|
*
|
|
463
466
|
* This source code is licensed under the ISC license.
|
|
464
467
|
* See the LICENSE file in the root directory of this source tree.
|
|
465
468
|
*/
|
|
466
|
-
const
|
|
469
|
+
const ro = [
|
|
467
470
|
[
|
|
468
471
|
"path",
|
|
469
472
|
{
|
|
@@ -472,26 +475,26 @@ const Zr = [
|
|
|
472
475
|
}
|
|
473
476
|
],
|
|
474
477
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
475
|
-
],
|
|
478
|
+
], oo = Oe("settings", ro);
|
|
476
479
|
/**
|
|
477
480
|
* @license lucide-react v1.21.0 - ISC
|
|
478
481
|
*
|
|
479
482
|
* This source code is licensed under the ISC license.
|
|
480
483
|
* See the LICENSE file in the root directory of this source tree.
|
|
481
484
|
*/
|
|
482
|
-
const
|
|
485
|
+
const ao = [
|
|
483
486
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
484
487
|
["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
|
|
485
488
|
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
486
489
|
["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
|
|
487
|
-
],
|
|
490
|
+
], so = Oe("smile", ao);
|
|
488
491
|
/**
|
|
489
492
|
* @license lucide-react v1.21.0 - ISC
|
|
490
493
|
*
|
|
491
494
|
* This source code is licensed under the ISC license.
|
|
492
495
|
* See the LICENSE file in the root directory of this source tree.
|
|
493
496
|
*/
|
|
494
|
-
const
|
|
497
|
+
const io = [
|
|
495
498
|
[
|
|
496
499
|
"path",
|
|
497
500
|
{
|
|
@@ -501,27 +504,27 @@ const to = [
|
|
|
501
504
|
],
|
|
502
505
|
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
503
506
|
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
504
|
-
],
|
|
507
|
+
], co = Oe("triangle-alert", io);
|
|
505
508
|
/**
|
|
506
509
|
* @license lucide-react v1.21.0 - ISC
|
|
507
510
|
*
|
|
508
511
|
* This source code is licensed under the ISC license.
|
|
509
512
|
* See the LICENSE file in the root directory of this source tree.
|
|
510
513
|
*/
|
|
511
|
-
const
|
|
514
|
+
const lo = [
|
|
512
515
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
513
516
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
514
|
-
],
|
|
515
|
-
function
|
|
516
|
-
if (
|
|
517
|
-
|
|
517
|
+
], uo = Oe("x", lo);
|
|
518
|
+
function fo(e, t) {
|
|
519
|
+
if (t) {
|
|
520
|
+
t(e);
|
|
518
521
|
return;
|
|
519
522
|
}
|
|
520
523
|
/^https?:\/\//.test(e) ? window.open(e, "_blank", "noopener,noreferrer") : window.location.href = e;
|
|
521
524
|
}
|
|
522
|
-
const
|
|
525
|
+
const sr = ({
|
|
523
526
|
isOpen: e,
|
|
524
|
-
onClose:
|
|
527
|
+
onClose: t,
|
|
525
528
|
anchorRef: r,
|
|
526
529
|
items: a,
|
|
527
530
|
onNavigate: l,
|
|
@@ -530,15 +533,15 @@ const rr = ({
|
|
|
530
533
|
const u = x(null);
|
|
531
534
|
return V(() => {
|
|
532
535
|
if (!e) return;
|
|
533
|
-
const m = (
|
|
534
|
-
u.current && !u.current.contains(
|
|
535
|
-
}, h = (
|
|
536
|
-
|
|
536
|
+
const m = (f) => {
|
|
537
|
+
u.current && !u.current.contains(f.target) && r.current && !r.current.contains(f.target) && t();
|
|
538
|
+
}, h = (f) => {
|
|
539
|
+
f.key === "Escape" && t();
|
|
537
540
|
};
|
|
538
541
|
return document.addEventListener("mousedown", m), document.addEventListener("keydown", h), () => {
|
|
539
542
|
document.removeEventListener("mousedown", m), document.removeEventListener("keydown", h);
|
|
540
543
|
};
|
|
541
|
-
}, [e,
|
|
544
|
+
}, [e, t, r]), e ? /* @__PURE__ */ i(
|
|
542
545
|
"div",
|
|
543
546
|
{
|
|
544
547
|
ref: u,
|
|
@@ -551,8 +554,8 @@ const rr = ({
|
|
|
551
554
|
href: m.url,
|
|
552
555
|
className: "ask-arbor-settings__item",
|
|
553
556
|
role: "menuitem",
|
|
554
|
-
onClick: (
|
|
555
|
-
|
|
557
|
+
onClick: (f) => {
|
|
558
|
+
f.preventDefault(), t(), fo(m.url, l);
|
|
556
559
|
},
|
|
557
560
|
children: [
|
|
558
561
|
m.icon,
|
|
@@ -564,15 +567,15 @@ const rr = ({
|
|
|
564
567
|
}
|
|
565
568
|
) : null;
|
|
566
569
|
};
|
|
567
|
-
|
|
568
|
-
function
|
|
569
|
-
const
|
|
570
|
-
return `${
|
|
570
|
+
sr.displayName = "AskArborSettings";
|
|
571
|
+
function po(e) {
|
|
572
|
+
const t = Math.floor(e / 60), r = e % 60;
|
|
573
|
+
return `${t}:${r.toString().padStart(2, "0")}`;
|
|
571
574
|
}
|
|
572
|
-
const
|
|
575
|
+
const ir = Tn(
|
|
573
576
|
({
|
|
574
577
|
value: e,
|
|
575
|
-
onChange:
|
|
578
|
+
onChange: t,
|
|
576
579
|
onKeyDown: r,
|
|
577
580
|
placeholder: a = "Explain what you need in your own words...",
|
|
578
581
|
onSubmit: l,
|
|
@@ -580,15 +583,15 @@ const or = Tn(
|
|
|
580
583
|
onMicClick: u,
|
|
581
584
|
onStopClick: m,
|
|
582
585
|
menuContent: h,
|
|
583
|
-
onNavigate:
|
|
586
|
+
onNavigate: f,
|
|
584
587
|
isProcessing: T = !1,
|
|
585
588
|
speechEngaged: A = !1,
|
|
586
589
|
showMicButton: _ = !0,
|
|
587
590
|
ariaLabel: E = "Chat panel input",
|
|
588
591
|
disclaimerText: k = "Ask Arbor can occasionally be wrong. Please check any important information.",
|
|
589
|
-
showDisclaimer:
|
|
590
|
-
},
|
|
591
|
-
const
|
|
592
|
+
showDisclaimer: D = !1
|
|
593
|
+
}, N) => {
|
|
594
|
+
const w = x(null), H = x(null), [pe, z] = M(0), [K, U] = M(!1);
|
|
592
595
|
V(() => {
|
|
593
596
|
if (!A) {
|
|
594
597
|
z(0);
|
|
@@ -599,12 +602,12 @@ const or = Tn(
|
|
|
599
602
|
z((de) => de + 1);
|
|
600
603
|
}, 1e3);
|
|
601
604
|
return () => clearInterval(G);
|
|
602
|
-
}, [A]),
|
|
603
|
-
const q = !T && !A && e.trim().length > 0, me = A, J =
|
|
605
|
+
}, [A]), Or(N, () => w.current);
|
|
606
|
+
const q = !T && !A && e.trim().length > 0, me = A, J = tr(
|
|
604
607
|
() => (h ?? []).map((G) => ({
|
|
605
608
|
label: G.label,
|
|
606
609
|
icon: /* @__PURE__ */ i(
|
|
607
|
-
|
|
610
|
+
Ot,
|
|
608
611
|
{
|
|
609
612
|
name: G.icon,
|
|
610
613
|
size: 12
|
|
@@ -619,10 +622,10 @@ const or = Tn(
|
|
|
619
622
|
/* @__PURE__ */ i("div", { className: "ask-arbor-input__input-row", children: /* @__PURE__ */ i(
|
|
620
623
|
"textarea",
|
|
621
624
|
{
|
|
622
|
-
ref:
|
|
625
|
+
ref: w,
|
|
623
626
|
className: "ask-arbor-input__textarea",
|
|
624
627
|
value: e,
|
|
625
|
-
onChange: (G) =>
|
|
628
|
+
onChange: (G) => t(G.target.value),
|
|
626
629
|
onKeyDown: r,
|
|
627
630
|
placeholder: A ? "" : a,
|
|
628
631
|
"aria-label": E,
|
|
@@ -633,7 +636,7 @@ const or = Tn(
|
|
|
633
636
|
}
|
|
634
637
|
) }),
|
|
635
638
|
/* @__PURE__ */ i("div", { className: "ask-arbor-input__bottom-actions", children: /* @__PURE__ */ S("div", { className: "ask-arbor-input__actions-right", children: [
|
|
636
|
-
A && /* @__PURE__ */ i("span", { className: "ask-arbor-input__timer", children:
|
|
639
|
+
A && /* @__PURE__ */ i("span", { className: "ask-arbor-input__timer", children: po(pe) }),
|
|
637
640
|
J.length > 0 && /* @__PURE__ */ S("div", { className: "ask-arbor-input__settings-wrap", children: [
|
|
638
641
|
/* @__PURE__ */ i(
|
|
639
642
|
"button",
|
|
@@ -656,7 +659,7 @@ const or = Tn(
|
|
|
656
659
|
"aria-expanded": K,
|
|
657
660
|
"aria-haspopup": "menu",
|
|
658
661
|
children: /* @__PURE__ */ i(
|
|
659
|
-
|
|
662
|
+
oo,
|
|
660
663
|
{
|
|
661
664
|
size: 12,
|
|
662
665
|
stroke: "#000000"
|
|
@@ -665,13 +668,13 @@ const or = Tn(
|
|
|
665
668
|
}
|
|
666
669
|
),
|
|
667
670
|
/* @__PURE__ */ i(
|
|
668
|
-
|
|
671
|
+
sr,
|
|
669
672
|
{
|
|
670
673
|
isOpen: K,
|
|
671
674
|
onClose: () => U(!1),
|
|
672
675
|
anchorRef: H,
|
|
673
676
|
items: J,
|
|
674
|
-
onNavigate:
|
|
677
|
+
onNavigate: f
|
|
675
678
|
}
|
|
676
679
|
)
|
|
677
680
|
] }),
|
|
@@ -686,7 +689,7 @@ const or = Tn(
|
|
|
686
689
|
onClick: u,
|
|
687
690
|
"aria-label": "speak with agent",
|
|
688
691
|
disabled: A || T,
|
|
689
|
-
children: /* @__PURE__ */ i(
|
|
692
|
+
children: /* @__PURE__ */ i(no, { size: 12, stroke: "#3C3735" })
|
|
690
693
|
}
|
|
691
694
|
),
|
|
692
695
|
me && m ? /* @__PURE__ */ S(
|
|
@@ -697,7 +700,7 @@ const or = Tn(
|
|
|
697
700
|
onClick: m,
|
|
698
701
|
"aria-label": "Stop",
|
|
699
702
|
children: [
|
|
700
|
-
/* @__PURE__ */ i(
|
|
703
|
+
/* @__PURE__ */ i(eo, { size: 12, stroke: "#FFFFFF" }),
|
|
701
704
|
"Stop"
|
|
702
705
|
]
|
|
703
706
|
}
|
|
@@ -710,7 +713,7 @@ const or = Tn(
|
|
|
710
713
|
disabled: !q,
|
|
711
714
|
"aria-label": "submit message",
|
|
712
715
|
children: /* @__PURE__ */ i(
|
|
713
|
-
|
|
716
|
+
jr,
|
|
714
717
|
{
|
|
715
718
|
size: 12,
|
|
716
719
|
stroke: "#FFFFFF",
|
|
@@ -721,23 +724,23 @@ const or = Tn(
|
|
|
721
724
|
)
|
|
722
725
|
] }) })
|
|
723
726
|
] }),
|
|
724
|
-
|
|
727
|
+
D && /* @__PURE__ */ i("p", { className: "ask-arbor-input__disclaimer", children: k })
|
|
725
728
|
] });
|
|
726
729
|
}
|
|
727
730
|
);
|
|
728
|
-
|
|
729
|
-
const
|
|
731
|
+
ir.displayName = "AskArborInput";
|
|
732
|
+
const Lt = "AGENT", _t = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on = "up", xn = "down", Pn = 10, mo = ({
|
|
730
733
|
message: e,
|
|
731
|
-
onRate:
|
|
734
|
+
onRate: t,
|
|
732
735
|
upRatingPopupUrl: r,
|
|
733
736
|
downRatingPopupUrl: a,
|
|
734
737
|
onRatingPopupOpen: l
|
|
735
738
|
}) => {
|
|
736
|
-
const [s, u] = M(null), m = (
|
|
737
|
-
const T =
|
|
739
|
+
const [s, u] = M(null), m = (f) => {
|
|
740
|
+
const T = f === on ? r : a;
|
|
738
741
|
T != null && T.trim() && (l ? l(T.trim()) : window.open(T.trim(), "_blank", "noopener,noreferrer"));
|
|
739
|
-
}, h = (
|
|
740
|
-
u(
|
|
742
|
+
}, h = (f) => {
|
|
743
|
+
u(f), t(f), m(f);
|
|
741
744
|
};
|
|
742
745
|
return /* @__PURE__ */ S("div", { className: "chat-message__feedback", children: [
|
|
743
746
|
/* @__PURE__ */ i("span", { className: "chat-message__feedback-question", children: "How did Ask Arbor do?" }),
|
|
@@ -758,9 +761,9 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
758
761
|
onClick: () => h(on),
|
|
759
762
|
children: [
|
|
760
763
|
/* @__PURE__ */ i(
|
|
761
|
-
|
|
764
|
+
so,
|
|
762
765
|
{
|
|
763
|
-
size:
|
|
766
|
+
size: Pn,
|
|
764
767
|
strokeWidth: 1.5,
|
|
765
768
|
className: "chat-message__feedback-button-icon",
|
|
766
769
|
"aria-hidden": !0
|
|
@@ -780,15 +783,15 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
780
783
|
"chat-message__feedback-button",
|
|
781
784
|
"chat-message__feedback-button--down",
|
|
782
785
|
{
|
|
783
|
-
"chat-message__feedback-button--selected": s ===
|
|
786
|
+
"chat-message__feedback-button--selected": s === xn
|
|
784
787
|
}
|
|
785
788
|
),
|
|
786
|
-
onClick: () => h(
|
|
789
|
+
onClick: () => h(xn),
|
|
787
790
|
children: [
|
|
788
791
|
/* @__PURE__ */ i(
|
|
789
|
-
|
|
792
|
+
Xr,
|
|
790
793
|
{
|
|
791
|
-
size:
|
|
794
|
+
size: Pn,
|
|
792
795
|
strokeWidth: 1.5,
|
|
793
796
|
className: "chat-message__feedback-button-icon",
|
|
794
797
|
"aria-hidden": !0
|
|
@@ -800,9 +803,9 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
800
803
|
)
|
|
801
804
|
] })
|
|
802
805
|
] });
|
|
803
|
-
},
|
|
806
|
+
}, ho = kr, _o = ({ prompt: e, onClick: t }) => /* @__PURE__ */ i(ho, { type: "button", variant: "secondary", size: "S", onClick: () => t(e), children: e }), go = ({
|
|
804
807
|
id: e,
|
|
805
|
-
text:
|
|
808
|
+
text: t,
|
|
806
809
|
type: r,
|
|
807
810
|
onRate: a,
|
|
808
811
|
ratingPopupUrls: l = {},
|
|
@@ -810,25 +813,25 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
810
813
|
showRating: u = !1,
|
|
811
814
|
followUpPrompts: m,
|
|
812
815
|
onFollowUpPromptClick: h,
|
|
813
|
-
processCanvasReferences:
|
|
816
|
+
processCanvasReferences: f,
|
|
814
817
|
isFallbackMessage: T,
|
|
815
818
|
onRatingPopupOpen: A,
|
|
816
819
|
children: _
|
|
817
820
|
}) => {
|
|
818
|
-
const E = r ===
|
|
821
|
+
const E = r === Lt, k = /* @__PURE__ */ S(we, { children: [
|
|
819
822
|
/* @__PURE__ */ S(
|
|
820
823
|
"div",
|
|
821
824
|
{
|
|
822
825
|
className: _e("chat-message", {
|
|
823
|
-
"chat-message--user": r ===
|
|
824
|
-
"chat-message--agent": r ===
|
|
826
|
+
"chat-message--user": r === _t,
|
|
827
|
+
"chat-message--agent": r === Lt,
|
|
825
828
|
"chat-message--info": r === mn,
|
|
826
829
|
"chat-message--error": r === ve,
|
|
827
830
|
"chat-message--warning": r === Kt
|
|
828
831
|
}),
|
|
829
832
|
children: [
|
|
830
833
|
r === mn && /* @__PURE__ */ i(
|
|
831
|
-
|
|
834
|
+
Jr,
|
|
832
835
|
{
|
|
833
836
|
className: "chat-message__icon",
|
|
834
837
|
"aria-label": "Information",
|
|
@@ -836,7 +839,7 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
836
839
|
}
|
|
837
840
|
),
|
|
838
841
|
r === Kt && /* @__PURE__ */ i(
|
|
839
|
-
|
|
842
|
+
co,
|
|
840
843
|
{
|
|
841
844
|
className: "chat-message__icon",
|
|
842
845
|
"aria-label": "Warning",
|
|
@@ -844,7 +847,7 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
844
847
|
}
|
|
845
848
|
),
|
|
846
849
|
r === ve && /* @__PURE__ */ i(
|
|
847
|
-
|
|
850
|
+
Vr,
|
|
848
851
|
{
|
|
849
852
|
className: "chat-message__icon",
|
|
850
853
|
"aria-label": "Error",
|
|
@@ -855,7 +858,7 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
855
858
|
"span",
|
|
856
859
|
{
|
|
857
860
|
dangerouslySetInnerHTML: {
|
|
858
|
-
__html:
|
|
861
|
+
__html: f(t)
|
|
859
862
|
}
|
|
860
863
|
}
|
|
861
864
|
)
|
|
@@ -864,32 +867,28 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
864
867
|
),
|
|
865
868
|
E && /* @__PURE__ */ S("div", { className: "chat-message__footer-actions", children: [
|
|
866
869
|
/* @__PURE__ */ i("div", { className: "chat-message__footer-icons", children: u && a && s && /* @__PURE__ */ i(
|
|
867
|
-
|
|
870
|
+
mo,
|
|
868
871
|
{
|
|
869
872
|
upRatingPopupUrl: l.up,
|
|
870
873
|
downRatingPopupUrl: l.down,
|
|
871
|
-
message: { id: e, type: r, text:
|
|
872
|
-
onRate: (
|
|
874
|
+
message: { id: e, type: r, text: t },
|
|
875
|
+
onRate: (D) => a(D, e),
|
|
873
876
|
onRatingPopupOpen: A
|
|
874
877
|
}
|
|
875
878
|
) }),
|
|
876
879
|
/* @__PURE__ */ i("div", { className: "chat-message__follow-up-prompts", children: m && m.length > 0 && !T && /* @__PURE__ */ i("ul", { className: "chat-message__follow-up-prompts-list", children: m.map(
|
|
877
|
-
(
|
|
880
|
+
(D, N) => /* @__PURE__ */ i(
|
|
878
881
|
"li",
|
|
879
882
|
{
|
|
880
883
|
children: /* @__PURE__ */ i(
|
|
881
|
-
|
|
884
|
+
_o,
|
|
882
885
|
{
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
onClick: () => h == null ? void 0 : h(
|
|
886
|
-
O
|
|
887
|
-
),
|
|
888
|
-
children: O
|
|
886
|
+
prompt: D,
|
|
887
|
+
onClick: (w) => h == null ? void 0 : h(w)
|
|
889
888
|
}
|
|
890
889
|
)
|
|
891
890
|
},
|
|
892
|
-
`follow-up-prompt-${
|
|
891
|
+
`follow-up-prompt-${N}`
|
|
893
892
|
)
|
|
894
893
|
) }) })
|
|
895
894
|
] })
|
|
@@ -898,25 +897,25 @@ const jt = "AGENT", ht = "USER", mn = "INFO", Kt = "WARNING", ve = "ERROR", on =
|
|
|
898
897
|
"li",
|
|
899
898
|
{
|
|
900
899
|
className: _e("chat-message-container", {
|
|
901
|
-
"chat-message-container--user": r ===
|
|
900
|
+
"chat-message-container--user": r === _t,
|
|
902
901
|
"chat-message-container--agent": E
|
|
903
902
|
}),
|
|
904
903
|
children: E ? /* @__PURE__ */ i("div", { className: "chat-message-container__content", children: k }) : k
|
|
905
904
|
}
|
|
906
905
|
);
|
|
907
|
-
},
|
|
908
|
-
function
|
|
909
|
-
let e = document.getElementById(
|
|
910
|
-
return e || (e = document.createElement("div"), e.id =
|
|
906
|
+
}, bo = "Not authorised. Your session could have expired or is invalid. Please refresh the page and try again.", yo = "You do not have permission to use this feature. Please contact your administrator if you need access.", To = "The chat service could not be found. Please check your configuration and try again.", Eo = "It looks like this request took too long to complete. Please try again.", Ao = "Whoops! Too many requests. Please wait a moment and try again.", So = "The chat service is temporarily unavailable. Please try again later.", wo = "Unable to reach the chat service. Please check your connection and try again.", cr = "Something went wrong. Please try again later.", No = "Something went wrong while trying to get a new agent message. Please try again later.", Un = "keyboard-shortcut-menu-portal";
|
|
907
|
+
function ko() {
|
|
908
|
+
let e = document.getElementById(Un);
|
|
909
|
+
return e || (e = document.createElement("div"), e.id = Un, e.style.cssText = "position:fixed;left:0;top:0;z-index:19950;pointer-events:none;", document.body.appendChild(e)), e;
|
|
911
910
|
}
|
|
912
911
|
const Vt = 200;
|
|
913
|
-
function
|
|
914
|
-
const
|
|
912
|
+
function Ro(e) {
|
|
913
|
+
const t = window.innerHeight, r = e.top + e.height > t - Vt, a = e.top < Vt;
|
|
915
914
|
return r ? "above" : a ? "below" : "above";
|
|
916
915
|
}
|
|
917
|
-
function
|
|
918
|
-
const
|
|
919
|
-
return
|
|
916
|
+
function Io(e) {
|
|
917
|
+
const t = Ro(e), r = 8;
|
|
918
|
+
return t === "below" ? {
|
|
920
919
|
left: e.left,
|
|
921
920
|
width: e.width,
|
|
922
921
|
top: e.bottom + r,
|
|
@@ -928,26 +927,26 @@ function To(e) {
|
|
|
928
927
|
placement: "above"
|
|
929
928
|
};
|
|
930
929
|
}
|
|
931
|
-
function
|
|
932
|
-
if (
|
|
933
|
-
|
|
930
|
+
function Fn(e, t) {
|
|
931
|
+
if (t) {
|
|
932
|
+
t(e);
|
|
934
933
|
return;
|
|
935
934
|
}
|
|
936
935
|
/^https?:\/\//.test(e) ? window.open(e, "_blank", "noopener,noreferrer") : window.location.href = e;
|
|
937
936
|
}
|
|
938
|
-
const
|
|
937
|
+
const Co = ({
|
|
939
938
|
anchorRef: e,
|
|
940
|
-
...
|
|
939
|
+
...t
|
|
941
940
|
}) => {
|
|
942
941
|
const [r, a] = M(
|
|
943
942
|
null
|
|
944
943
|
);
|
|
945
|
-
if (
|
|
944
|
+
if (nr(() => {
|
|
946
945
|
const s = () => {
|
|
947
|
-
const
|
|
948
|
-
if (!
|
|
949
|
-
const T =
|
|
950
|
-
a(
|
|
946
|
+
const f = e.current;
|
|
947
|
+
if (!f) return;
|
|
948
|
+
const T = f.getBoundingClientRect();
|
|
949
|
+
a(Io(T));
|
|
951
950
|
};
|
|
952
951
|
s();
|
|
953
952
|
const u = requestAnimationFrame(() => s()), m = () => s(), h = () => s();
|
|
@@ -961,79 +960,79 @@ const Eo = ({
|
|
|
961
960
|
width: r.width,
|
|
962
961
|
pointerEvents: "auto"
|
|
963
962
|
};
|
|
964
|
-
return r.placement === "below" ? l.top = r.top : l.bottom = r.bottom,
|
|
965
|
-
/* @__PURE__ */ i(
|
|
966
|
-
|
|
963
|
+
return r.placement === "below" ? l.top = r.top : l.bottom = r.bottom, rr(
|
|
964
|
+
/* @__PURE__ */ i(lr, { ...t, portalStyle: l }),
|
|
965
|
+
ko()
|
|
967
966
|
);
|
|
968
|
-
},
|
|
967
|
+
}, lr = (e) => {
|
|
969
968
|
const {
|
|
970
|
-
menuItems:
|
|
969
|
+
menuItems: t = [],
|
|
971
970
|
onSelectItem: r,
|
|
972
971
|
onClose: a,
|
|
973
972
|
hideReferenceFromList: l = !1,
|
|
974
973
|
anchorRef: s,
|
|
975
974
|
portalStyle: u,
|
|
976
975
|
onNavigate: m
|
|
977
|
-
} = e, [h,
|
|
976
|
+
} = e, [h, f] = M(0), [T, A] = M(""), [_, E] = M(t), k = x(null), D = x(null), N = x(null), [w, H] = M(!1), [pe, z] = M(!1), K = u ? u.top != null : w, U = u ? !0 : pe;
|
|
978
977
|
V(() => {
|
|
979
|
-
|
|
978
|
+
f(0), A("");
|
|
980
979
|
}, []), V(() => {
|
|
981
980
|
u && setTimeout(() => {
|
|
982
981
|
var b;
|
|
983
|
-
return (b =
|
|
982
|
+
return (b = N.current) == null ? void 0 : b.focus();
|
|
984
983
|
}, 0);
|
|
985
984
|
}, [u]), V(() => {
|
|
986
985
|
if (u || s || !k.current) return;
|
|
987
|
-
const b = k.current.getBoundingClientRect(),
|
|
988
|
-
H(re ? !1 : !!
|
|
986
|
+
const b = k.current.getBoundingClientRect(), O = window.innerHeight, B = b.top, re = B + b.height > O - Vt, L = B < Vt;
|
|
987
|
+
H(re ? !1 : !!L), z(!0), setTimeout(() => {
|
|
989
988
|
var W;
|
|
990
|
-
return (W =
|
|
989
|
+
return (W = N.current) == null ? void 0 : W.focus();
|
|
991
990
|
}, 0);
|
|
992
991
|
}, [s]), V(() => {
|
|
993
|
-
if (
|
|
994
|
-
const b =
|
|
992
|
+
if (D.current) {
|
|
993
|
+
const b = D.current.querySelector(
|
|
995
994
|
".keyboard-shortcut-menu__items"
|
|
996
|
-
),
|
|
995
|
+
), O = b == null ? void 0 : b.querySelector(
|
|
997
996
|
".keyboard-shortcut-menu__item--selected"
|
|
998
997
|
);
|
|
999
|
-
|
|
998
|
+
O && O.scrollIntoView({
|
|
1000
999
|
behavior: "smooth",
|
|
1001
1000
|
block: "nearest"
|
|
1002
1001
|
});
|
|
1003
1002
|
}
|
|
1004
1003
|
}, [h]), V(() => {
|
|
1005
1004
|
E(
|
|
1006
|
-
T ?
|
|
1005
|
+
T ? t.filter(
|
|
1007
1006
|
(b) => b.reference.toLowerCase().includes(T.toLowerCase()) || b.description.toLowerCase().includes(T.toLowerCase())
|
|
1008
|
-
) :
|
|
1007
|
+
) : t
|
|
1009
1008
|
);
|
|
1010
|
-
}, [T,
|
|
1009
|
+
}, [T, t]);
|
|
1011
1010
|
const q = (b) => {
|
|
1012
|
-
var
|
|
1013
|
-
r && _[b] && !_[b].link && r(_[b]), a && !((
|
|
1011
|
+
var O;
|
|
1012
|
+
r && _[b] && !_[b].link && r(_[b]), a && !((O = _[b]) != null && O.link) && a();
|
|
1014
1013
|
};
|
|
1015
1014
|
V(() => {
|
|
1016
1015
|
const b = (B) => {
|
|
1017
1016
|
B.key === "Escape" && a && (B.preventDefault(), a());
|
|
1018
|
-
},
|
|
1017
|
+
}, O = (B) => {
|
|
1019
1018
|
k.current && !k.current.contains(B.target) && a && a();
|
|
1020
1019
|
};
|
|
1021
|
-
return document.addEventListener("keydown", b), document.addEventListener("mousedown",
|
|
1022
|
-
document.removeEventListener("keydown", b), document.removeEventListener("mousedown",
|
|
1020
|
+
return document.addEventListener("keydown", b), document.addEventListener("mousedown", O), () => {
|
|
1021
|
+
document.removeEventListener("keydown", b), document.removeEventListener("mousedown", O);
|
|
1023
1022
|
};
|
|
1024
1023
|
}, [a]);
|
|
1025
1024
|
const me = (b) => {
|
|
1026
1025
|
switch (b.key) {
|
|
1027
1026
|
case "ArrowDown":
|
|
1028
|
-
b.preventDefault(),
|
|
1029
|
-
(
|
|
1027
|
+
b.preventDefault(), f(
|
|
1028
|
+
(O) => O < _.length - 1 ? O + 1 : O
|
|
1030
1029
|
);
|
|
1031
1030
|
break;
|
|
1032
1031
|
case "ArrowUp":
|
|
1033
|
-
b.preventDefault(),
|
|
1032
|
+
b.preventDefault(), f((O) => O > 0 ? O - 1 : 0);
|
|
1034
1033
|
break;
|
|
1035
1034
|
case "Enter":
|
|
1036
|
-
b.preventDefault(), _[h] && (_[h].link ?
|
|
1035
|
+
b.preventDefault(), _[h] && (_[h].link ? Fn(
|
|
1037
1036
|
_[h].link.replace(
|
|
1038
1037
|
/\/\?/g,
|
|
1039
1038
|
""
|
|
@@ -1046,10 +1045,10 @@ const Eo = ({
|
|
|
1046
1045
|
break;
|
|
1047
1046
|
}
|
|
1048
1047
|
}, J = (b) => {
|
|
1049
|
-
A(b),
|
|
1050
|
-
}, G = (b,
|
|
1051
|
-
const B =
|
|
1052
|
-
/* @__PURE__ */ i(
|
|
1048
|
+
A(b), f(0);
|
|
1049
|
+
}, G = (b, O) => {
|
|
1050
|
+
const B = O === h, re = b.icon ? /* @__PURE__ */ S(we, { children: [
|
|
1051
|
+
/* @__PURE__ */ i(Ot, { name: b.icon, size: 12 }),
|
|
1053
1052
|
/* @__PURE__ */ i("span", { className: "keyboard-shortcut-menu__item-description keyboard-shortcut-menu__item-main", children: b.description })
|
|
1054
1053
|
] }) : /* @__PURE__ */ i(we, { children: l ? /* @__PURE__ */ i(
|
|
1055
1054
|
"span",
|
|
@@ -1063,11 +1062,11 @@ const Eo = ({
|
|
|
1063
1062
|
/* @__PURE__ */ i("span", { className: "keyboard-shortcut-menu__item-description keyboard-shortcut-menu__item-secondary", children: b.description })
|
|
1064
1063
|
] }) });
|
|
1065
1064
|
if (b.link) {
|
|
1066
|
-
const
|
|
1065
|
+
const L = b.link.replace(/\/\?/g, "");
|
|
1067
1066
|
return /* @__PURE__ */ i("li", { role: "menuitem", children: /* @__PURE__ */ i(
|
|
1068
1067
|
"a",
|
|
1069
1068
|
{
|
|
1070
|
-
href:
|
|
1069
|
+
href: L,
|
|
1071
1070
|
className: _e(
|
|
1072
1071
|
"keyboard-shortcut-menu__item-main keyboard-shortcut-menu__item",
|
|
1073
1072
|
{
|
|
@@ -1076,7 +1075,7 @@ const Eo = ({
|
|
|
1076
1075
|
}
|
|
1077
1076
|
),
|
|
1078
1077
|
onClick: (W) => {
|
|
1079
|
-
W.preventDefault(),
|
|
1078
|
+
W.preventDefault(), Fn(L, m), a == null || a();
|
|
1080
1079
|
},
|
|
1081
1080
|
children: re
|
|
1082
1081
|
}
|
|
@@ -1110,7 +1109,7 @@ const Eo = ({
|
|
|
1110
1109
|
"aria-label": "Keyboard shortcut menu",
|
|
1111
1110
|
"data-testid": "keyboard-shortcut-menu",
|
|
1112
1111
|
ref: k,
|
|
1113
|
-
children: /* @__PURE__ */ S("div", { className: "keyboard-shortcut-menu__content", ref:
|
|
1112
|
+
children: /* @__PURE__ */ S("div", { className: "keyboard-shortcut-menu__content", ref: D, children: [
|
|
1114
1113
|
/* @__PURE__ */ S("div", { className: "keyboard-shortcut-menu__header", children: [
|
|
1115
1114
|
/* @__PURE__ */ i("div", { className: "keyboard-shortcut-menu__search", children: /* @__PURE__ */ i(
|
|
1116
1115
|
"input",
|
|
@@ -1120,7 +1119,7 @@ const Eo = ({
|
|
|
1120
1119
|
onChange: (b) => J(b.target.value),
|
|
1121
1120
|
placeholder: "Search...",
|
|
1122
1121
|
autoFocus: !0,
|
|
1123
|
-
ref:
|
|
1122
|
+
ref: N
|
|
1124
1123
|
}
|
|
1125
1124
|
) }),
|
|
1126
1125
|
a && /* @__PURE__ */ i(
|
|
@@ -1131,7 +1130,7 @@ const Eo = ({
|
|
|
1131
1130
|
onClick: a,
|
|
1132
1131
|
"aria-label": "Close menu",
|
|
1133
1132
|
children: /* @__PURE__ */ i(
|
|
1134
|
-
|
|
1133
|
+
uo,
|
|
1135
1134
|
{
|
|
1136
1135
|
size: 12,
|
|
1137
1136
|
className: "keyboard-shortcut-menu__close-icon"
|
|
@@ -1154,7 +1153,7 @@ const Eo = ({
|
|
|
1154
1153
|
children: "No results found"
|
|
1155
1154
|
}
|
|
1156
1155
|
) : _.map(
|
|
1157
|
-
(b,
|
|
1156
|
+
(b, O) => G(b, O)
|
|
1158
1157
|
)
|
|
1159
1158
|
}
|
|
1160
1159
|
)
|
|
@@ -1162,10 +1161,10 @@ const Eo = ({
|
|
|
1162
1161
|
}
|
|
1163
1162
|
);
|
|
1164
1163
|
return s && !u ? /* @__PURE__ */ i(
|
|
1165
|
-
|
|
1164
|
+
Co,
|
|
1166
1165
|
{
|
|
1167
1166
|
anchorRef: s,
|
|
1168
|
-
menuItems:
|
|
1167
|
+
menuItems: t,
|
|
1169
1168
|
onSelectItem: r,
|
|
1170
1169
|
onClose: a,
|
|
1171
1170
|
hideReferenceFromList: e.hideReferenceFromList,
|
|
@@ -1173,7 +1172,7 @@ const Eo = ({
|
|
|
1173
1172
|
onNavigate: m
|
|
1174
1173
|
}
|
|
1175
1174
|
) : u ? /* @__PURE__ */ i("div", { style: u, children: de }) : de;
|
|
1176
|
-
},
|
|
1175
|
+
}, Hn = ({ className: e }) => /* @__PURE__ */ i(
|
|
1177
1176
|
"div",
|
|
1178
1177
|
{
|
|
1179
1178
|
className: _e("loading-spinner", e),
|
|
@@ -1210,7 +1209,7 @@ const Eo = ({
|
|
|
1210
1209
|
)
|
|
1211
1210
|
] })
|
|
1212
1211
|
}
|
|
1213
|
-
),
|
|
1212
|
+
), vo = 4e3, Oo = 500, Lo = 8e3, an = [
|
|
1214
1213
|
"I'm working on it…",
|
|
1215
1214
|
"Generating insights…",
|
|
1216
1215
|
"Piecing things together…",
|
|
@@ -1258,47 +1257,47 @@ const Eo = ({
|
|
|
1258
1257
|
"Analysing your query…",
|
|
1259
1258
|
"Analysing results…",
|
|
1260
1259
|
"Working through the details…"
|
|
1261
|
-
],
|
|
1260
|
+
], Do = ({
|
|
1262
1261
|
loadingPhrase: e,
|
|
1263
|
-
showSpinnerAsIcon:
|
|
1262
|
+
showSpinnerAsIcon: t = !0,
|
|
1264
1263
|
showNotifyLaterButton: r = !1,
|
|
1265
1264
|
onNotifyLater: a,
|
|
1266
1265
|
onNotificationRegisteredGotIt: l
|
|
1267
1266
|
}) => {
|
|
1268
1267
|
const s = () => Math.floor(Math.random() * an.length), u = x(null), [m, h] = M(
|
|
1269
1268
|
e || an[s()]
|
|
1270
|
-
), [
|
|
1269
|
+
), [f, T] = M("fade-in"), [A, _] = M(!1), [E, k] = M(!1);
|
|
1271
1270
|
V(() => {
|
|
1272
1271
|
r || k(!1);
|
|
1273
1272
|
}, [r]), V(() => {
|
|
1274
1273
|
if (!r || !a)
|
|
1275
1274
|
return;
|
|
1276
|
-
const
|
|
1275
|
+
const w = setTimeout(() => {
|
|
1277
1276
|
_(!0);
|
|
1278
|
-
},
|
|
1277
|
+
}, Lo);
|
|
1279
1278
|
return () => {
|
|
1280
|
-
clearTimeout(
|
|
1279
|
+
clearTimeout(w);
|
|
1281
1280
|
};
|
|
1282
1281
|
}, [r, a]);
|
|
1283
|
-
const
|
|
1282
|
+
const D = async () => {
|
|
1284
1283
|
if (!a)
|
|
1285
1284
|
return;
|
|
1286
1285
|
await a() && k(!0);
|
|
1287
|
-
},
|
|
1286
|
+
}, N = () => {
|
|
1288
1287
|
k(!1), l == null || l();
|
|
1289
1288
|
};
|
|
1290
1289
|
return V(() => {
|
|
1291
|
-
let
|
|
1292
|
-
return e ? (h(e), T("fade-in")) :
|
|
1290
|
+
let w = null;
|
|
1291
|
+
return e ? (h(e), T("fade-in")) : w = setInterval(() => {
|
|
1293
1292
|
T("fade-out"), setTimeout(() => {
|
|
1294
1293
|
let H;
|
|
1295
1294
|
do
|
|
1296
1295
|
H = s();
|
|
1297
1296
|
while (H === u.current);
|
|
1298
1297
|
u.current = H, h(an[H]), T("fade-in");
|
|
1299
|
-
},
|
|
1300
|
-
},
|
|
1301
|
-
|
|
1298
|
+
}, Oo);
|
|
1299
|
+
}, vo), () => {
|
|
1300
|
+
w && clearInterval(w);
|
|
1302
1301
|
};
|
|
1303
1302
|
}, [e]), /* @__PURE__ */ S(
|
|
1304
1303
|
"li",
|
|
@@ -1308,8 +1307,8 @@ const Eo = ({
|
|
|
1308
1307
|
"data-testid": "loading-widget",
|
|
1309
1308
|
children: [
|
|
1310
1309
|
/* @__PURE__ */ S("div", { className: "chat-panel__loading-content", children: [
|
|
1311
|
-
|
|
1312
|
-
/* @__PURE__ */ i("span", { className: `chat-panel__loading-phrase ${
|
|
1310
|
+
t ? /* @__PURE__ */ i(Hn, { className: "chat-panel__loading-spinner" }) : /* @__PURE__ */ i("span", { className: "chat-panel__loading-spinner-container", children: /* @__PURE__ */ i(Hn, { className: "chat-panel__loading-spinner" }) }),
|
|
1311
|
+
/* @__PURE__ */ i("span", { className: `chat-panel__loading-phrase ${f}`, children: m })
|
|
1313
1312
|
] }),
|
|
1314
1313
|
r && a && A && /* @__PURE__ */ i("div", { className: "chat-panel__notify-later", children: E ? /* @__PURE__ */ S(we, { children: [
|
|
1315
1314
|
/* @__PURE__ */ i("p", { className: "chat-panel__notify-later-message", children: "We'll notify you in the notifications panel on the left of your MIS." }),
|
|
@@ -1318,7 +1317,7 @@ const Eo = ({
|
|
|
1318
1317
|
{
|
|
1319
1318
|
type: "button",
|
|
1320
1319
|
className: "chat-panel__notify-later-btn",
|
|
1321
|
-
onClick:
|
|
1320
|
+
onClick: N,
|
|
1322
1321
|
"aria-label": "Got it",
|
|
1323
1322
|
children: "Got it"
|
|
1324
1323
|
}
|
|
@@ -1330,7 +1329,7 @@ const Eo = ({
|
|
|
1330
1329
|
{
|
|
1331
1330
|
type: "button",
|
|
1332
1331
|
className: "chat-panel__notify-later-btn",
|
|
1333
|
-
onClick:
|
|
1332
|
+
onClick: D,
|
|
1334
1333
|
"aria-label": "Let me know when it's done",
|
|
1335
1334
|
children: "Let me know when it's done"
|
|
1336
1335
|
}
|
|
@@ -1340,193 +1339,193 @@ const Eo = ({
|
|
|
1340
1339
|
}
|
|
1341
1340
|
);
|
|
1342
1341
|
};
|
|
1343
|
-
function
|
|
1342
|
+
function Mo(e) {
|
|
1344
1343
|
V(e, []);
|
|
1345
1344
|
}
|
|
1346
|
-
function
|
|
1345
|
+
function xo() {
|
|
1347
1346
|
const e = x(!1);
|
|
1348
1347
|
return V(() => (e.current = !0, () => {
|
|
1349
1348
|
e.current = !1;
|
|
1350
1349
|
}), []), e;
|
|
1351
1350
|
}
|
|
1352
|
-
function
|
|
1351
|
+
function Po() {
|
|
1353
1352
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
1354
1353
|
}
|
|
1355
|
-
function
|
|
1354
|
+
function Uo(e, t = 0) {
|
|
1356
1355
|
if (typeof e == "number" && e > 0) return e;
|
|
1357
1356
|
if (typeof e == "string") {
|
|
1358
1357
|
const r = parseInt(e, 10);
|
|
1359
1358
|
if (!isNaN(r) && r > 0) return r;
|
|
1360
1359
|
}
|
|
1361
|
-
return
|
|
1360
|
+
return t;
|
|
1362
1361
|
}
|
|
1363
|
-
const
|
|
1364
|
-
function
|
|
1365
|
-
return e.replace(
|
|
1362
|
+
const Fo = /\*\*(.+?)\*\*/g;
|
|
1363
|
+
function Ho(e) {
|
|
1364
|
+
return e.replace(Fo, "<strong>$1</strong>");
|
|
1366
1365
|
}
|
|
1367
1366
|
/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */
|
|
1368
|
-
function
|
|
1369
|
-
(
|
|
1370
|
-
for (var r = 0, a = Array(
|
|
1367
|
+
function zn(e, t) {
|
|
1368
|
+
(t == null || t > e.length) && (t = e.length);
|
|
1369
|
+
for (var r = 0, a = Array(t); r < t; r++) a[r] = e[r];
|
|
1371
1370
|
return a;
|
|
1372
1371
|
}
|
|
1373
|
-
function
|
|
1372
|
+
function zo(e) {
|
|
1374
1373
|
if (Array.isArray(e)) return e;
|
|
1375
1374
|
}
|
|
1376
|
-
function
|
|
1375
|
+
function Go(e, t) {
|
|
1377
1376
|
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1378
1377
|
if (r != null) {
|
|
1379
|
-
var a, l, s, u, m = [], h = !0,
|
|
1378
|
+
var a, l, s, u, m = [], h = !0, f = !1;
|
|
1380
1379
|
try {
|
|
1381
|
-
if (s = (r = r.call(e)).next,
|
|
1380
|
+
if (s = (r = r.call(e)).next, t !== 0) for (; !(h = (a = s.call(r)).done) && (m.push(a.value), m.length !== t); h = !0) ;
|
|
1382
1381
|
} catch (T) {
|
|
1383
|
-
|
|
1382
|
+
f = !0, l = T;
|
|
1384
1383
|
} finally {
|
|
1385
1384
|
try {
|
|
1386
1385
|
if (!h && r.return != null && (u = r.return(), Object(u) !== u)) return;
|
|
1387
1386
|
} finally {
|
|
1388
|
-
if (
|
|
1387
|
+
if (f) throw l;
|
|
1389
1388
|
}
|
|
1390
1389
|
}
|
|
1391
1390
|
return m;
|
|
1392
1391
|
}
|
|
1393
1392
|
}
|
|
1394
|
-
function
|
|
1393
|
+
function Bo() {
|
|
1395
1394
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1396
1395
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1397
1396
|
}
|
|
1398
|
-
function
|
|
1399
|
-
return
|
|
1397
|
+
function Wo(e, t) {
|
|
1398
|
+
return zo(e) || Go(e, t) || $o(e, t) || Bo();
|
|
1400
1399
|
}
|
|
1401
|
-
function
|
|
1400
|
+
function $o(e, t) {
|
|
1402
1401
|
if (e) {
|
|
1403
|
-
if (typeof e == "string") return
|
|
1402
|
+
if (typeof e == "string") return zn(e, t);
|
|
1404
1403
|
var r = {}.toString.call(e).slice(8, -1);
|
|
1405
|
-
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
1404
|
+
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? zn(e, t) : void 0;
|
|
1406
1405
|
}
|
|
1407
1406
|
}
|
|
1408
|
-
const
|
|
1409
|
-
let se = Object.freeze, ie = Object.seal,
|
|
1410
|
-
se || (se = function(
|
|
1411
|
-
return
|
|
1407
|
+
const ur = Object.entries, Gn = Object.setPrototypeOf, Yo = Object.isFrozen, jo = Object.getPrototypeOf, Ko = Object.getOwnPropertyDescriptor;
|
|
1408
|
+
let se = Object.freeze, ie = Object.seal, ht = Object.create, dr = typeof Reflect < "u" && Reflect, hn = dr.apply, _n = dr.construct;
|
|
1409
|
+
se || (se = function(t) {
|
|
1410
|
+
return t;
|
|
1412
1411
|
});
|
|
1413
|
-
ie || (ie = function(
|
|
1414
|
-
return
|
|
1412
|
+
ie || (ie = function(t) {
|
|
1413
|
+
return t;
|
|
1415
1414
|
});
|
|
1416
|
-
hn || (hn = function(
|
|
1415
|
+
hn || (hn = function(t, r) {
|
|
1417
1416
|
for (var a = arguments.length, l = new Array(a > 2 ? a - 2 : 0), s = 2; s < a; s++)
|
|
1418
1417
|
l[s - 2] = arguments[s];
|
|
1419
|
-
return
|
|
1418
|
+
return t.apply(r, l);
|
|
1420
1419
|
});
|
|
1421
|
-
_n || (_n = function(
|
|
1420
|
+
_n || (_n = function(t) {
|
|
1422
1421
|
for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
|
|
1423
1422
|
a[l - 1] = arguments[l];
|
|
1424
|
-
return new
|
|
1423
|
+
return new t(...a);
|
|
1425
1424
|
});
|
|
1426
|
-
const
|
|
1425
|
+
const kt = Z(Array.prototype.forEach), Vo = Z(Array.prototype.lastIndexOf), Bn = Z(Array.prototype.pop), mt = Z(Array.prototype.push), qo = Z(Array.prototype.splice), Be = Array.isArray, vt = Z(String.prototype.toLowerCase), sn = Z(String.prototype.toString), Wn = Z(String.prototype.match), Rt = Z(String.prototype.replace), $n = Z(String.prototype.indexOf), Xo = Z(String.prototype.trim), Zo = Z(Number.prototype.toString), Jo = Z(Boolean.prototype.toString), Yn = typeof BigInt > "u" ? null : Z(BigInt.prototype.toString), jn = typeof Symbol > "u" ? null : Z(Symbol.prototype.toString), ne = Z(Object.prototype.hasOwnProperty), It = Z(Object.prototype.toString), ae = Z(RegExp.prototype.test), Qe = Qo(TypeError);
|
|
1427
1426
|
function Z(e) {
|
|
1428
|
-
return function(
|
|
1429
|
-
|
|
1427
|
+
return function(t) {
|
|
1428
|
+
t instanceof RegExp && (t.lastIndex = 0);
|
|
1430
1429
|
for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
|
|
1431
1430
|
a[l - 1] = arguments[l];
|
|
1432
|
-
return hn(e,
|
|
1431
|
+
return hn(e, t, a);
|
|
1433
1432
|
};
|
|
1434
1433
|
}
|
|
1435
|
-
function
|
|
1434
|
+
function Qo(e) {
|
|
1436
1435
|
return function() {
|
|
1437
|
-
for (var
|
|
1436
|
+
for (var t = arguments.length, r = new Array(t), a = 0; a < t; a++)
|
|
1438
1437
|
r[a] = arguments[a];
|
|
1439
1438
|
return _n(e, r);
|
|
1440
1439
|
};
|
|
1441
1440
|
}
|
|
1442
|
-
function C(e,
|
|
1443
|
-
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
1444
|
-
if (
|
|
1441
|
+
function C(e, t) {
|
|
1442
|
+
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : vt;
|
|
1443
|
+
if (Gn && Gn(e, null), !Be(t))
|
|
1445
1444
|
return e;
|
|
1446
|
-
let a =
|
|
1445
|
+
let a = t.length;
|
|
1447
1446
|
for (; a--; ) {
|
|
1448
|
-
let l =
|
|
1447
|
+
let l = t[a];
|
|
1449
1448
|
if (typeof l == "string") {
|
|
1450
1449
|
const s = r(l);
|
|
1451
|
-
s !== l && (
|
|
1450
|
+
s !== l && (Yo(t) || (t[a] = s), l = s);
|
|
1452
1451
|
}
|
|
1453
1452
|
e[l] = !0;
|
|
1454
1453
|
}
|
|
1455
1454
|
return e;
|
|
1456
1455
|
}
|
|
1457
|
-
function
|
|
1458
|
-
for (let
|
|
1459
|
-
ne(e,
|
|
1456
|
+
function ea(e) {
|
|
1457
|
+
for (let t = 0; t < e.length; t++)
|
|
1458
|
+
ne(e, t) || (e[t] = null);
|
|
1460
1459
|
return e;
|
|
1461
1460
|
}
|
|
1462
1461
|
function ue(e) {
|
|
1463
|
-
const
|
|
1464
|
-
for (const a of
|
|
1465
|
-
var r =
|
|
1462
|
+
const t = ht(null);
|
|
1463
|
+
for (const a of ur(e)) {
|
|
1464
|
+
var r = Wo(a, 2);
|
|
1466
1465
|
const l = r[0], s = r[1];
|
|
1467
|
-
ne(e, l) && (Be(s) ?
|
|
1466
|
+
ne(e, l) && (Be(s) ? t[l] = ea(s) : s && typeof s == "object" && s.constructor === Object ? t[l] = ue(s) : t[l] = s);
|
|
1468
1467
|
}
|
|
1469
|
-
return
|
|
1468
|
+
return t;
|
|
1470
1469
|
}
|
|
1471
|
-
function
|
|
1470
|
+
function ta(e) {
|
|
1472
1471
|
switch (typeof e) {
|
|
1473
1472
|
case "string":
|
|
1474
1473
|
return e;
|
|
1475
1474
|
case "number":
|
|
1476
|
-
return
|
|
1475
|
+
return Zo(e);
|
|
1477
1476
|
case "boolean":
|
|
1478
|
-
return
|
|
1477
|
+
return Jo(e);
|
|
1479
1478
|
case "bigint":
|
|
1480
|
-
return
|
|
1479
|
+
return Yn ? Yn(e) : "0";
|
|
1481
1480
|
case "symbol":
|
|
1482
|
-
return
|
|
1481
|
+
return jn ? jn(e) : "Symbol()";
|
|
1483
1482
|
case "undefined":
|
|
1484
|
-
return
|
|
1483
|
+
return It(e);
|
|
1485
1484
|
case "function":
|
|
1486
1485
|
case "object": {
|
|
1487
1486
|
if (e === null)
|
|
1488
|
-
return
|
|
1489
|
-
const
|
|
1487
|
+
return It(e);
|
|
1488
|
+
const t = e, r = Ce(t, "toString");
|
|
1490
1489
|
if (typeof r == "function") {
|
|
1491
|
-
const a = r(
|
|
1492
|
-
return typeof a == "string" ? a :
|
|
1490
|
+
const a = r(t);
|
|
1491
|
+
return typeof a == "string" ? a : It(a);
|
|
1493
1492
|
}
|
|
1494
|
-
return
|
|
1493
|
+
return It(e);
|
|
1495
1494
|
}
|
|
1496
1495
|
default:
|
|
1497
|
-
return
|
|
1496
|
+
return It(e);
|
|
1498
1497
|
}
|
|
1499
1498
|
}
|
|
1500
|
-
function Ce(e,
|
|
1499
|
+
function Ce(e, t) {
|
|
1501
1500
|
for (; e !== null; ) {
|
|
1502
|
-
const a =
|
|
1501
|
+
const a = Ko(e, t);
|
|
1503
1502
|
if (a) {
|
|
1504
1503
|
if (a.get)
|
|
1505
1504
|
return Z(a.get);
|
|
1506
1505
|
if (typeof a.value == "function")
|
|
1507
1506
|
return Z(a.value);
|
|
1508
1507
|
}
|
|
1509
|
-
e =
|
|
1508
|
+
e = jo(e);
|
|
1510
1509
|
}
|
|
1511
1510
|
function r() {
|
|
1512
1511
|
return null;
|
|
1513
1512
|
}
|
|
1514
1513
|
return r;
|
|
1515
1514
|
}
|
|
1516
|
-
function
|
|
1515
|
+
function na(e) {
|
|
1517
1516
|
try {
|
|
1518
1517
|
return ae(e, ""), !0;
|
|
1519
1518
|
} catch {
|
|
1520
1519
|
return !1;
|
|
1521
1520
|
}
|
|
1522
1521
|
}
|
|
1523
|
-
const
|
|
1522
|
+
const Kn = se(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), cn = se(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), ln = se(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ra = se(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), un = se(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), oa = se(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Vn = se(["#text"]), qn = se(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]), dn = se(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Xn = se(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Yt = se(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), aa = ie(/{{[\w\W]*|^[\w\W]*}}/g), sa = ie(/<%[\w\W]*|^[\w\W]*%>/g), ia = ie(/\${[\w\W]*/g), ca = ie(/^data-[\-\w.\u00B7-\uFFFF]+$/), la = ie(/^aria-[\-\w]+$/), Zn = ie(
|
|
1524
1523
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
1525
1524
|
// eslint-disable-line no-useless-escape
|
|
1526
|
-
),
|
|
1525
|
+
), ua = ie(/^(?:\w+script|data):/i), da = ie(
|
|
1527
1526
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
1528
1527
|
// eslint-disable-line no-control-regex
|
|
1529
|
-
),
|
|
1528
|
+
), fa = ie(/^html$/i), pa = ie(/^[a-z][.\w]*(-[.\w]+)+$/i), Jn = ie(/<[/\w!]/g), ma = ie(/<[/\w]/g), ha = ie(/<\/no(script|embed|frames)/i), _a = ie(/\/>/i), Ie = {
|
|
1530
1529
|
element: 1,
|
|
1531
1530
|
attribute: 2,
|
|
1532
1531
|
text: 3,
|
|
@@ -1542,17 +1541,17 @@ const jn = se(["a", "abbr", "acronym", "address", "area", "article", "aside", "a
|
|
|
1542
1541
|
documentFragment: 11,
|
|
1543
1542
|
notation: 12
|
|
1544
1543
|
// Deprecated
|
|
1545
|
-
},
|
|
1544
|
+
}, ga = function() {
|
|
1546
1545
|
return typeof window > "u" ? null : window;
|
|
1547
|
-
},
|
|
1548
|
-
if (typeof
|
|
1546
|
+
}, ba = function(t, r) {
|
|
1547
|
+
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
1549
1548
|
return null;
|
|
1550
1549
|
let a = null;
|
|
1551
1550
|
const l = "data-tt-policy-suffix";
|
|
1552
1551
|
r && r.hasAttribute(l) && (a = r.getAttribute(l));
|
|
1553
1552
|
const s = "dompurify" + (a ? "#" + a : "");
|
|
1554
1553
|
try {
|
|
1555
|
-
return
|
|
1554
|
+
return t.createPolicy(s, {
|
|
1556
1555
|
createHTML(u) {
|
|
1557
1556
|
return u;
|
|
1558
1557
|
},
|
|
@@ -1563,7 +1562,7 @@ const jn = se(["a", "abbr", "acronym", "address", "area", "article", "aside", "a
|
|
|
1563
1562
|
} catch {
|
|
1564
1563
|
return console.warn("TrustedTypes policy " + s + " could not be created."), null;
|
|
1565
1564
|
}
|
|
1566
|
-
},
|
|
1565
|
+
}, Qn = function() {
|
|
1567
1566
|
return {
|
|
1568
1567
|
afterSanitizeAttributes: [],
|
|
1569
1568
|
afterSanitizeElements: [],
|
|
@@ -1575,53 +1574,53 @@ const jn = se(["a", "abbr", "acronym", "address", "area", "article", "aside", "a
|
|
|
1575
1574
|
uponSanitizeElement: [],
|
|
1576
1575
|
uponSanitizeShadowNode: []
|
|
1577
1576
|
};
|
|
1578
|
-
}, Ge = function(
|
|
1579
|
-
return ne(
|
|
1577
|
+
}, Ge = function(t, r, a, l) {
|
|
1578
|
+
return ne(t, r) && Be(t[r]) ? C(l.base ? ue(l.base) : {}, t[r], l.transform) : a;
|
|
1580
1579
|
};
|
|
1581
|
-
function
|
|
1582
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
1583
|
-
const
|
|
1584
|
-
if (
|
|
1585
|
-
return
|
|
1580
|
+
function fr() {
|
|
1581
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ga();
|
|
1582
|
+
const t = (p) => fr(p);
|
|
1583
|
+
if (t.version = "3.4.11", t.removed = [], !e || !e.document || e.document.nodeType !== Ie.document || !e.Element)
|
|
1584
|
+
return t.isSupported = !1, t;
|
|
1586
1585
|
let r = e.document;
|
|
1587
1586
|
const a = r, l = a.currentScript;
|
|
1588
1587
|
e.DocumentFragment;
|
|
1589
|
-
const s = e.HTMLTemplateElement, u = e.Node, m = e.Element, h = e.NodeFilter,
|
|
1590
|
-
|
|
1591
|
-
const T = e.DOMParser, A = e.trustedTypes, _ = m.prototype, E = Ce(_, "cloneNode"), k = Ce(_, "remove"),
|
|
1588
|
+
const s = e.HTMLTemplateElement, u = e.Node, m = e.Element, h = e.NodeFilter, f = e.NamedNodeMap;
|
|
1589
|
+
f === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
1590
|
+
const T = e.DOMParser, A = e.trustedTypes, _ = m.prototype, E = Ce(_, "cloneNode"), k = Ce(_, "remove"), D = Ce(_, "nextSibling"), N = Ce(_, "childNodes"), w = Ce(_, "parentNode"), H = Ce(_, "shadowRoot"), pe = Ce(_, "attributes"), z = u && u.prototype ? Ce(u.prototype, "nodeType") : null, K = u && u.prototype ? Ce(u.prototype, "nodeName") : null;
|
|
1592
1591
|
if (typeof s == "function") {
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1592
|
+
const p = r.createElement("template");
|
|
1593
|
+
p.content && p.content.ownerDocument && (r = p.content.ownerDocument);
|
|
1595
1594
|
}
|
|
1596
1595
|
let U, q = "", me, J = !1, G = 0;
|
|
1597
1596
|
const de = function() {
|
|
1598
1597
|
if (G > 0)
|
|
1599
1598
|
throw Qe('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
|
|
1600
|
-
}, b = function(
|
|
1599
|
+
}, b = function(n) {
|
|
1601
1600
|
de(), G++;
|
|
1602
1601
|
try {
|
|
1603
|
-
return U.createHTML(
|
|
1602
|
+
return U.createHTML(n);
|
|
1604
1603
|
} finally {
|
|
1605
1604
|
G--;
|
|
1606
1605
|
}
|
|
1607
|
-
},
|
|
1606
|
+
}, O = function(n) {
|
|
1608
1607
|
de(), G++;
|
|
1609
1608
|
try {
|
|
1610
|
-
return U.createScriptURL(
|
|
1609
|
+
return U.createScriptURL(n);
|
|
1611
1610
|
} finally {
|
|
1612
1611
|
G--;
|
|
1613
1612
|
}
|
|
1614
1613
|
}, B = function() {
|
|
1615
|
-
return J || (me =
|
|
1616
|
-
}, re = r,
|
|
1617
|
-
let F =
|
|
1618
|
-
|
|
1619
|
-
const oe =
|
|
1620
|
-
let Pe =
|
|
1621
|
-
const
|
|
1614
|
+
return J || (me = ba(A, l), J = !0), me;
|
|
1615
|
+
}, re = r, L = re.implementation, W = re.createNodeIterator, he = re.createDocumentFragment, Le = re.getElementsByTagName, xe = a.importNode;
|
|
1616
|
+
let F = Qn();
|
|
1617
|
+
t.isSupported = typeof ur == "function" && typeof w == "function" && L && L.createHTMLDocument !== void 0;
|
|
1618
|
+
const oe = aa, gt = sa, Q = ia, bt = ca, qt = la, et = ua, tt = da, We = pa;
|
|
1619
|
+
let Pe = Zn, P = null;
|
|
1620
|
+
const nt = C({}, [...Kn, ...cn, ...ln, ...un, ...Vn]);
|
|
1622
1621
|
let Y = null;
|
|
1623
|
-
const
|
|
1624
|
-
let $ = Object.seal(
|
|
1622
|
+
const rt = C({}, [...qn, ...dn, ...Xn, ...Yt]);
|
|
1623
|
+
let $ = Object.seal(ht(null, {
|
|
1625
1624
|
tagNameCheck: {
|
|
1626
1625
|
writable: !0,
|
|
1627
1626
|
configurable: !1,
|
|
@@ -1640,8 +1639,8 @@ function lr() {
|
|
|
1640
1639
|
enumerable: !0,
|
|
1641
1640
|
value: !1
|
|
1642
1641
|
}
|
|
1643
|
-
})), Ne = null,
|
|
1644
|
-
const Ee = Object.seal(
|
|
1642
|
+
})), Ne = null, yt = null;
|
|
1643
|
+
const Ee = Object.seal(ht(null, {
|
|
1645
1644
|
tagCheck: {
|
|
1646
1645
|
writable: !0,
|
|
1647
1646
|
configurable: !1,
|
|
@@ -1655,9 +1654,9 @@ function lr() {
|
|
|
1655
1654
|
value: null
|
|
1656
1655
|
}
|
|
1657
1656
|
}));
|
|
1658
|
-
let
|
|
1659
|
-
const
|
|
1660
|
-
let
|
|
1657
|
+
let Dt = !0, $e = !0, ot = !1, Ue = !0, Ae = !1, Ye = !0, ke = !1, at = !1, je = null, Fe = null, st = !1, De = !1, Ke = !1, it = !1, Tt = !0, Ve = !1;
|
|
1658
|
+
const ct = "user-content-";
|
|
1659
|
+
let Et = !0, lt = !1, He = {}, ge = null;
|
|
1661
1660
|
const qe = C({}, [
|
|
1662
1661
|
"annotation-xml",
|
|
1663
1662
|
"audio",
|
|
@@ -1695,120 +1694,120 @@ function lr() {
|
|
|
1695
1694
|
"video",
|
|
1696
1695
|
"xmp"
|
|
1697
1696
|
]);
|
|
1698
|
-
let
|
|
1697
|
+
let Mt = null;
|
|
1699
1698
|
const Xe = C({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
1700
|
-
let
|
|
1701
|
-
const
|
|
1702
|
-
let be = ee,
|
|
1703
|
-
const Xt = C({}, [Re,
|
|
1704
|
-
let At = C({}, xt);
|
|
1705
|
-
const Pt = se(["annotation-xml"]);
|
|
1699
|
+
let At = null;
|
|
1700
|
+
const xt = C({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Re = "http://www.w3.org/1998/Math/MathML", ut = "http://www.w3.org/2000/svg", ee = "http://www.w3.org/1999/xhtml";
|
|
1701
|
+
let be = ee, dt = !1, ft = null;
|
|
1702
|
+
const Xt = C({}, [Re, ut, ee], sn), Pt = se(["mi", "mo", "mn", "ms", "mtext"]);
|
|
1706
1703
|
let St = C({}, Pt);
|
|
1704
|
+
const Ut = se(["annotation-xml"]);
|
|
1705
|
+
let wt = C({}, Ut);
|
|
1707
1706
|
const Zt = C({}, ["title", "style", "font", "a", "script"]);
|
|
1708
1707
|
let Ze = null;
|
|
1709
|
-
const Jt = ["application/xhtml+xml", "text/html"],
|
|
1708
|
+
const Jt = ["application/xhtml+xml", "text/html"], Ft = "text/html";
|
|
1710
1709
|
let j = null, c = null;
|
|
1711
|
-
const y = r.createElement("form"), I = function(
|
|
1712
|
-
return
|
|
1710
|
+
const y = r.createElement("form"), I = function(n) {
|
|
1711
|
+
return n instanceof RegExp || n instanceof Function;
|
|
1713
1712
|
}, ce = function() {
|
|
1714
|
-
let
|
|
1715
|
-
if (c && c ===
|
|
1713
|
+
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1714
|
+
if (c && c === n)
|
|
1716
1715
|
return;
|
|
1717
|
-
(!
|
|
1718
|
-
Jt.indexOf(
|
|
1716
|
+
(!n || typeof n != "object") && (n = {}), n = ue(n), Ze = // eslint-disable-next-line unicorn/prefer-includes
|
|
1717
|
+
Jt.indexOf(n.PARSER_MEDIA_TYPE) === -1 ? Ft : n.PARSER_MEDIA_TYPE, j = Ze === "application/xhtml+xml" ? sn : vt, P = Ge(n, "ALLOWED_TAGS", nt, {
|
|
1719
1718
|
transform: j
|
|
1720
|
-
}), Y = Ge(
|
|
1719
|
+
}), Y = Ge(n, "ALLOWED_ATTR", rt, {
|
|
1721
1720
|
transform: j
|
|
1722
|
-
}),
|
|
1721
|
+
}), ft = Ge(n, "ALLOWED_NAMESPACES", Xt, {
|
|
1723
1722
|
transform: sn
|
|
1724
|
-
}),
|
|
1723
|
+
}), At = Ge(n, "ADD_URI_SAFE_ATTR", xt, {
|
|
1725
1724
|
transform: j,
|
|
1726
|
-
base:
|
|
1727
|
-
}),
|
|
1725
|
+
base: xt
|
|
1726
|
+
}), Mt = Ge(n, "ADD_DATA_URI_TAGS", Xe, {
|
|
1728
1727
|
transform: j,
|
|
1729
1728
|
base: Xe
|
|
1730
|
-
}), ge = Ge(
|
|
1729
|
+
}), ge = Ge(n, "FORBID_CONTENTS", qe, {
|
|
1731
1730
|
transform: j
|
|
1732
|
-
}), Ne = Ge(
|
|
1731
|
+
}), Ne = Ge(n, "FORBID_TAGS", ue({}), {
|
|
1733
1732
|
transform: j
|
|
1734
|
-
}),
|
|
1733
|
+
}), yt = Ge(n, "FORBID_ATTR", ue({}), {
|
|
1735
1734
|
transform: j
|
|
1736
|
-
}), He = ne(
|
|
1737
|
-
const o = ne(
|
|
1738
|
-
if ($ =
|
|
1739
|
-
if (typeof
|
|
1735
|
+
}), He = ne(n, "USE_PROFILES") ? n.USE_PROFILES && typeof n.USE_PROFILES == "object" ? ue(n.USE_PROFILES) : n.USE_PROFILES : !1, Dt = n.ALLOW_ARIA_ATTR !== !1, $e = n.ALLOW_DATA_ATTR !== !1, ot = n.ALLOW_UNKNOWN_PROTOCOLS || !1, Ue = n.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ae = n.SAFE_FOR_TEMPLATES || !1, Ye = n.SAFE_FOR_XML !== !1, ke = n.WHOLE_DOCUMENT || !1, De = n.RETURN_DOM || !1, Ke = n.RETURN_DOM_FRAGMENT || !1, it = n.RETURN_TRUSTED_TYPE || !1, st = n.FORCE_BODY || !1, Tt = n.SANITIZE_DOM !== !1, Ve = n.SANITIZE_NAMED_PROPS || !1, Et = n.KEEP_CONTENT !== !1, lt = n.IN_PLACE || !1, Pe = na(n.ALLOWED_URI_REGEXP) ? n.ALLOWED_URI_REGEXP : Zn, be = typeof n.NAMESPACE == "string" ? n.NAMESPACE : ee, St = ne(n, "MATHML_TEXT_INTEGRATION_POINTS") && n.MATHML_TEXT_INTEGRATION_POINTS && typeof n.MATHML_TEXT_INTEGRATION_POINTS == "object" ? ue(n.MATHML_TEXT_INTEGRATION_POINTS) : C({}, Pt), wt = ne(n, "HTML_INTEGRATION_POINTS") && n.HTML_INTEGRATION_POINTS && typeof n.HTML_INTEGRATION_POINTS == "object" ? ue(n.HTML_INTEGRATION_POINTS) : C({}, Ut);
|
|
1736
|
+
const o = ne(n, "CUSTOM_ELEMENT_HANDLING") && n.CUSTOM_ELEMENT_HANDLING && typeof n.CUSTOM_ELEMENT_HANDLING == "object" ? ue(n.CUSTOM_ELEMENT_HANDLING) : ht(null);
|
|
1737
|
+
if ($ = ht(null), ne(o, "tagNameCheck") && I(o.tagNameCheck) && ($.tagNameCheck = o.tagNameCheck), ne(o, "attributeNameCheck") && I(o.attributeNameCheck) && ($.attributeNameCheck = o.attributeNameCheck), ne(o, "allowCustomizedBuiltInElements") && typeof o.allowCustomizedBuiltInElements == "boolean" && ($.allowCustomizedBuiltInElements = o.allowCustomizedBuiltInElements), ie($), Ae && ($e = !1), Ke && (De = !0), He && (P = C({}, Vn), Y = ht(null), He.html === !0 && (C(P, Kn), C(Y, qn)), He.svg === !0 && (C(P, cn), C(Y, dn), C(Y, Yt)), He.svgFilters === !0 && (C(P, ln), C(Y, dn), C(Y, Yt)), He.mathMl === !0 && (C(P, un), C(Y, Xn), C(Y, Yt))), Ee.tagCheck = null, Ee.attributeCheck = null, ne(n, "ADD_TAGS") && (typeof n.ADD_TAGS == "function" ? Ee.tagCheck = n.ADD_TAGS : Be(n.ADD_TAGS) && (P === nt && (P = ue(P)), C(P, n.ADD_TAGS, j))), ne(n, "ADD_ATTR") && (typeof n.ADD_ATTR == "function" ? Ee.attributeCheck = n.ADD_ATTR : Be(n.ADD_ATTR) && (Y === rt && (Y = ue(Y)), C(Y, n.ADD_ATTR, j))), ne(n, "ADD_URI_SAFE_ATTR") && Be(n.ADD_URI_SAFE_ATTR) && C(At, n.ADD_URI_SAFE_ATTR, j), ne(n, "FORBID_CONTENTS") && Be(n.FORBID_CONTENTS) && (ge === qe && (ge = ue(ge)), C(ge, n.FORBID_CONTENTS, j)), ne(n, "ADD_FORBID_CONTENTS") && Be(n.ADD_FORBID_CONTENTS) && (ge === qe && (ge = ue(ge)), C(ge, n.ADD_FORBID_CONTENTS, j)), Et && (P["#text"] = !0), ke && C(P, ["html", "head", "body"]), P.table && (C(P, ["tbody"]), delete Ne.tbody), n.TRUSTED_TYPES_POLICY) {
|
|
1738
|
+
if (typeof n.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
1740
1739
|
throw Qe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
1741
|
-
if (typeof
|
|
1740
|
+
if (typeof n.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
1742
1741
|
throw Qe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
1743
1742
|
const d = U;
|
|
1744
|
-
U =
|
|
1743
|
+
U = n.TRUSTED_TYPES_POLICY;
|
|
1745
1744
|
try {
|
|
1746
1745
|
q = b("");
|
|
1747
1746
|
} catch (g) {
|
|
1748
1747
|
throw U = d, g;
|
|
1749
1748
|
}
|
|
1750
|
-
} else
|
|
1751
|
-
se && se(
|
|
1752
|
-
}, ye = C({}, [...cn, ...ln, ...
|
|
1753
|
-
return o.namespaceURI === ee ?
|
|
1754
|
-
}, Sn = function(
|
|
1755
|
-
return o.namespaceURI === ee ?
|
|
1756
|
-
}, wn = function(
|
|
1757
|
-
return o.namespaceURI ===
|
|
1758
|
-
},
|
|
1759
|
-
let o =
|
|
1749
|
+
} else n.TRUSTED_TYPES_POLICY === null ? (U = void 0, q = "") : (U === void 0 && (U = B()), U && typeof q == "string" && (q = b("")));
|
|
1750
|
+
se && se(n), c = n;
|
|
1751
|
+
}, ye = C({}, [...cn, ...ln, ...ra]), fe = C({}, [...un, ...oa]), Ht = function(n, o, d) {
|
|
1752
|
+
return o.namespaceURI === ee ? n === "svg" : o.namespaceURI === Re ? n === "svg" && (d === "annotation-xml" || St[d]) : !!ye[n];
|
|
1753
|
+
}, Sn = function(n, o, d) {
|
|
1754
|
+
return o.namespaceURI === ee ? n === "math" : o.namespaceURI === ut ? n === "math" && wt[d] : !!fe[n];
|
|
1755
|
+
}, wn = function(n, o, d) {
|
|
1756
|
+
return o.namespaceURI === ut && !wt[d] || o.namespaceURI === Re && !St[d] ? !1 : !fe[n] && (Zt[n] || !ye[n]);
|
|
1757
|
+
}, zt = function(n) {
|
|
1758
|
+
let o = w(n);
|
|
1760
1759
|
(!o || !o.tagName) && (o = {
|
|
1761
1760
|
namespaceURI: be,
|
|
1762
1761
|
tagName: "template"
|
|
1763
1762
|
});
|
|
1764
|
-
const d =
|
|
1765
|
-
return
|
|
1766
|
-
}, ze = function(
|
|
1767
|
-
|
|
1768
|
-
element:
|
|
1763
|
+
const d = vt(n.tagName), g = vt(o.tagName);
|
|
1764
|
+
return ft[n.namespaceURI] ? n.namespaceURI === ut ? Ht(d, o, g) : n.namespaceURI === Re ? Sn(d, o, g) : n.namespaceURI === ee ? wn(d, o, g) : !!(Ze === "application/xhtml+xml" && ft[n.namespaceURI]) : !1;
|
|
1765
|
+
}, ze = function(n) {
|
|
1766
|
+
mt(t.removed, {
|
|
1767
|
+
element: n
|
|
1769
1768
|
});
|
|
1770
1769
|
try {
|
|
1771
|
-
|
|
1770
|
+
w(n).removeChild(n);
|
|
1772
1771
|
} catch {
|
|
1773
|
-
if (k(
|
|
1772
|
+
if (k(n), !w(n))
|
|
1774
1773
|
throw Qe("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
1775
1774
|
}
|
|
1776
|
-
}, Nn = function(
|
|
1777
|
-
const o =
|
|
1775
|
+
}, Nn = function(n) {
|
|
1776
|
+
const o = N(n);
|
|
1778
1777
|
if (o) {
|
|
1779
1778
|
const g = [];
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
}),
|
|
1779
|
+
kt(o, (R) => {
|
|
1780
|
+
mt(g, R);
|
|
1781
|
+
}), kt(g, (R) => {
|
|
1783
1782
|
try {
|
|
1784
1783
|
k(R);
|
|
1785
1784
|
} catch {
|
|
1786
1785
|
}
|
|
1787
1786
|
});
|
|
1788
1787
|
}
|
|
1789
|
-
const d = pe(
|
|
1788
|
+
const d = pe(n);
|
|
1790
1789
|
if (d)
|
|
1791
1790
|
for (let g = d.length - 1; g >= 0; --g) {
|
|
1792
1791
|
const R = d[g], v = R && R.name;
|
|
1793
1792
|
if (typeof v == "string")
|
|
1794
1793
|
try {
|
|
1795
|
-
|
|
1794
|
+
n.removeAttribute(v);
|
|
1796
1795
|
} catch {
|
|
1797
1796
|
}
|
|
1798
1797
|
}
|
|
1799
|
-
}, Je = function(
|
|
1798
|
+
}, Je = function(n, o) {
|
|
1800
1799
|
try {
|
|
1801
|
-
|
|
1802
|
-
attribute: o.getAttributeNode(
|
|
1800
|
+
mt(t.removed, {
|
|
1801
|
+
attribute: o.getAttributeNode(n),
|
|
1803
1802
|
from: o
|
|
1804
1803
|
});
|
|
1805
1804
|
} catch {
|
|
1806
|
-
|
|
1805
|
+
mt(t.removed, {
|
|
1807
1806
|
attribute: null,
|
|
1808
1807
|
from: o
|
|
1809
1808
|
});
|
|
1810
1809
|
}
|
|
1811
|
-
if (o.removeAttribute(
|
|
1810
|
+
if (o.removeAttribute(n), n === "is")
|
|
1812
1811
|
if (De || Ke)
|
|
1813
1812
|
try {
|
|
1814
1813
|
ze(o);
|
|
@@ -1816,96 +1815,96 @@ function lr() {
|
|
|
1816
1815
|
}
|
|
1817
1816
|
else
|
|
1818
1817
|
try {
|
|
1819
|
-
o.setAttribute(
|
|
1818
|
+
o.setAttribute(n, "");
|
|
1820
1819
|
} catch {
|
|
1821
1820
|
}
|
|
1822
|
-
},
|
|
1823
|
-
const o = pe(
|
|
1821
|
+
}, _r = function(n) {
|
|
1822
|
+
const o = pe(n);
|
|
1824
1823
|
if (o)
|
|
1825
1824
|
for (let d = o.length - 1; d >= 0; --d) {
|
|
1826
1825
|
const g = o[d], R = g && g.name;
|
|
1827
1826
|
if (!(typeof R != "string" || Y[j(R)]))
|
|
1828
1827
|
try {
|
|
1829
|
-
|
|
1828
|
+
n.removeAttribute(R);
|
|
1830
1829
|
} catch {
|
|
1831
1830
|
}
|
|
1832
1831
|
}
|
|
1833
|
-
},
|
|
1834
|
-
const o = [
|
|
1832
|
+
}, gr = function(n) {
|
|
1833
|
+
const o = [n];
|
|
1835
1834
|
for (; o.length > 0; ) {
|
|
1836
1835
|
const d = o.pop();
|
|
1837
|
-
(z ? z(d) : d.nodeType) === Ie.element &&
|
|
1838
|
-
const R =
|
|
1836
|
+
(z ? z(d) : d.nodeType) === Ie.element && _r(d);
|
|
1837
|
+
const R = N(d);
|
|
1839
1838
|
if (R)
|
|
1840
1839
|
for (let v = R.length - 1; v >= 0; --v)
|
|
1841
1840
|
o.push(R[v]);
|
|
1842
1841
|
}
|
|
1843
|
-
}, kn = function(
|
|
1842
|
+
}, kn = function(n) {
|
|
1844
1843
|
let o = null, d = null;
|
|
1845
|
-
if (
|
|
1846
|
-
|
|
1844
|
+
if (st)
|
|
1845
|
+
n = "<remove></remove>" + n;
|
|
1847
1846
|
else {
|
|
1848
|
-
const v =
|
|
1847
|
+
const v = Wn(n, /^[\r\n\t ]+/);
|
|
1849
1848
|
d = v && v[0];
|
|
1850
1849
|
}
|
|
1851
|
-
Ze === "application/xhtml+xml" && be === ee && (
|
|
1852
|
-
const g = U ? b(
|
|
1850
|
+
Ze === "application/xhtml+xml" && be === ee && (n = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + n + "</body></html>");
|
|
1851
|
+
const g = U ? b(n) : n;
|
|
1853
1852
|
if (be === ee)
|
|
1854
1853
|
try {
|
|
1855
1854
|
o = new T().parseFromString(g, Ze);
|
|
1856
1855
|
} catch {
|
|
1857
1856
|
}
|
|
1858
1857
|
if (!o || !o.documentElement) {
|
|
1859
|
-
o =
|
|
1858
|
+
o = L.createDocument(be, "template", null);
|
|
1860
1859
|
try {
|
|
1861
|
-
o.documentElement.innerHTML =
|
|
1860
|
+
o.documentElement.innerHTML = dt ? q : g;
|
|
1862
1861
|
} catch {
|
|
1863
1862
|
}
|
|
1864
1863
|
}
|
|
1865
1864
|
const R = o.body || o.documentElement;
|
|
1866
|
-
return
|
|
1867
|
-
}, Rn = function(
|
|
1865
|
+
return n && d && R.insertBefore(r.createTextNode(d), R.childNodes[0] || null), be === ee ? Le.call(o, ke ? "html" : "body")[0] : ke ? o.documentElement : R;
|
|
1866
|
+
}, Rn = function(n) {
|
|
1868
1867
|
return W.call(
|
|
1869
|
-
|
|
1870
|
-
|
|
1868
|
+
n.ownerDocument || n,
|
|
1869
|
+
n,
|
|
1871
1870
|
// eslint-disable-next-line no-bitwise
|
|
1872
1871
|
h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT | h.SHOW_PROCESSING_INSTRUCTION | h.SHOW_CDATA_SECTION,
|
|
1873
1872
|
null
|
|
1874
1873
|
);
|
|
1875
|
-
},
|
|
1876
|
-
return
|
|
1877
|
-
}, Qt = function(
|
|
1874
|
+
}, Gt = function(n) {
|
|
1875
|
+
return n = Rt(n, oe, " "), n = Rt(n, gt, " "), n = Rt(n, Q, " "), n;
|
|
1876
|
+
}, Qt = function(n) {
|
|
1878
1877
|
var o;
|
|
1879
|
-
|
|
1878
|
+
n.normalize();
|
|
1880
1879
|
const d = W.call(
|
|
1881
|
-
|
|
1882
|
-
|
|
1880
|
+
n.ownerDocument || n,
|
|
1881
|
+
n,
|
|
1883
1882
|
// eslint-disable-next-line no-bitwise
|
|
1884
1883
|
h.SHOW_TEXT | h.SHOW_COMMENT | h.SHOW_CDATA_SECTION | h.SHOW_PROCESSING_INSTRUCTION,
|
|
1885
1884
|
null
|
|
1886
1885
|
);
|
|
1887
1886
|
let g = d.nextNode();
|
|
1888
1887
|
for (; g; )
|
|
1889
|
-
g.data =
|
|
1890
|
-
const R = (o =
|
|
1891
|
-
R &&
|
|
1892
|
-
|
|
1888
|
+
g.data = Gt(g.data), g = d.nextNode();
|
|
1889
|
+
const R = (o = n.querySelectorAll) === null || o === void 0 ? void 0 : o.call(n, "template");
|
|
1890
|
+
R && kt(R, (v) => {
|
|
1891
|
+
pt(v.content) && Qt(v.content);
|
|
1893
1892
|
});
|
|
1894
|
-
},
|
|
1895
|
-
const o = K ? K(
|
|
1896
|
-
return typeof o != "string" || j(o) !== "form" ? !1 : typeof
|
|
1893
|
+
}, Bt = function(n) {
|
|
1894
|
+
const o = K ? K(n) : null;
|
|
1895
|
+
return typeof o != "string" || j(o) !== "form" ? !1 : typeof n.nodeName != "string" || typeof n.textContent != "string" || typeof n.removeChild != "function" || // Realm-safe NamedNodeMap detection: equality against the cached
|
|
1897
1896
|
// prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
|
|
1898
1897
|
// makes the direct read diverge from the cached read; a clean form
|
|
1899
1898
|
// (same-realm OR foreign-realm) has both reads pointing at the same
|
|
1900
1899
|
// canonical NamedNodeMap.
|
|
1901
|
-
|
|
1900
|
+
n.attributes !== pe(n) || typeof n.removeAttribute != "function" || typeof n.setAttribute != "function" || typeof n.namespaceURI != "string" || typeof n.insertBefore != "function" || typeof n.hasChildNodes != "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
|
|
1902
1901
|
// returns the integer 1 for any Element regardless of realm; direct
|
|
1903
1902
|
// read on a clobbered form (e.g. <input name="nodeType">) returns
|
|
1904
1903
|
// the named child element. Cheap addition — nodeType is read from
|
|
1905
1904
|
// an internal slot, no serialization cost — and removes a residual
|
|
1906
1905
|
// clobbering surface used by several mXSS / PI / comment branches
|
|
1907
1906
|
// in _sanitizeElements that compare currentNode.nodeType directly.
|
|
1908
|
-
|
|
1907
|
+
n.nodeType !== z(n) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
|
|
1909
1908
|
// "childNodes" shadows the prototype getter. Direct reads of
|
|
1910
1909
|
// form.childNodes from a clobbered form return the named child
|
|
1911
1910
|
// instead of the real NodeList, so any walk that reads it directly
|
|
@@ -1916,76 +1915,76 @@ function lr() {
|
|
|
1916
1915
|
// select, etc.) regardless of whether the named child happens to
|
|
1917
1916
|
// carry a numeric .length, which a typeof-based probe would miss
|
|
1918
1917
|
// (e.g. HTMLSelectElement.length is a defined unsigned-long).
|
|
1919
|
-
|
|
1920
|
-
},
|
|
1921
|
-
if (!z || typeof
|
|
1918
|
+
n.childNodes !== N(n);
|
|
1919
|
+
}, pt = function(n) {
|
|
1920
|
+
if (!z || typeof n != "object" || n === null)
|
|
1922
1921
|
return !1;
|
|
1923
1922
|
try {
|
|
1924
|
-
return z(
|
|
1923
|
+
return z(n) === Ie.documentFragment;
|
|
1925
1924
|
} catch {
|
|
1926
1925
|
return !1;
|
|
1927
1926
|
}
|
|
1928
|
-
},
|
|
1929
|
-
if (!z || typeof
|
|
1927
|
+
}, Nt = function(n) {
|
|
1928
|
+
if (!z || typeof n != "object" || n === null)
|
|
1930
1929
|
return !1;
|
|
1931
1930
|
try {
|
|
1932
|
-
return typeof z(
|
|
1931
|
+
return typeof z(n) == "number";
|
|
1933
1932
|
} catch {
|
|
1934
1933
|
return !1;
|
|
1935
1934
|
}
|
|
1936
1935
|
};
|
|
1937
|
-
function Me(
|
|
1938
|
-
|
|
1939
|
-
d.call(
|
|
1936
|
+
function Me(p, n, o) {
|
|
1937
|
+
p.length !== 0 && kt(p, (d) => {
|
|
1938
|
+
d.call(t, n, o, c);
|
|
1940
1939
|
});
|
|
1941
1940
|
}
|
|
1942
|
-
const
|
|
1943
|
-
return !!(Ye &&
|
|
1944
|
-
},
|
|
1941
|
+
const br = function(n, o) {
|
|
1942
|
+
return !!(Ye && n.hasChildNodes() && !Nt(n.firstElementChild) && ae(Jn, n.textContent) && ae(Jn, n.innerHTML) || Ye && n.namespaceURI === ee && o === "style" && Nt(n.firstElementChild) || n.nodeType === Ie.processingInstruction || Ye && n.nodeType === Ie.comment && ae(ma, n.data));
|
|
1943
|
+
}, yr = function(n, o) {
|
|
1945
1944
|
if (!Ne[o] && vn(o) && ($.tagNameCheck instanceof RegExp && ae($.tagNameCheck, o) || $.tagNameCheck instanceof Function && $.tagNameCheck(o)))
|
|
1946
1945
|
return !1;
|
|
1947
|
-
if (
|
|
1948
|
-
const d =
|
|
1946
|
+
if (Et && !ge[o]) {
|
|
1947
|
+
const d = w(n), g = N(n);
|
|
1949
1948
|
if (g && d) {
|
|
1950
1949
|
const R = g.length;
|
|
1951
1950
|
for (let v = R - 1; v >= 0; --v) {
|
|
1952
|
-
const te =
|
|
1953
|
-
d.insertBefore(te,
|
|
1951
|
+
const te = lt ? g[v] : E(g[v], !0);
|
|
1952
|
+
d.insertBefore(te, D(n));
|
|
1954
1953
|
}
|
|
1955
1954
|
}
|
|
1956
1955
|
}
|
|
1957
|
-
return ze(
|
|
1958
|
-
}, In = function(
|
|
1959
|
-
if (Me(F.beforeSanitizeElements,
|
|
1960
|
-
return ze(
|
|
1961
|
-
const o = j(K ? K(
|
|
1962
|
-
if (Me(F.uponSanitizeElement,
|
|
1956
|
+
return ze(n), !0;
|
|
1957
|
+
}, In = function(n) {
|
|
1958
|
+
if (Me(F.beforeSanitizeElements, n, null), Bt(n))
|
|
1959
|
+
return ze(n), !0;
|
|
1960
|
+
const o = j(K ? K(n) : n.nodeName);
|
|
1961
|
+
if (Me(F.uponSanitizeElement, n, {
|
|
1963
1962
|
tagName: o,
|
|
1964
1963
|
allowedTags: P
|
|
1965
|
-
}),
|
|
1966
|
-
return ze(
|
|
1964
|
+
}), br(n, o))
|
|
1965
|
+
return ze(n), !0;
|
|
1967
1966
|
if (Ne[o] || !(Ee.tagCheck instanceof Function && Ee.tagCheck(o)) && !P[o])
|
|
1968
|
-
return
|
|
1969
|
-
if ((z ? z(
|
|
1970
|
-
return ze(
|
|
1971
|
-
if (Ae &&
|
|
1972
|
-
const g =
|
|
1973
|
-
|
|
1974
|
-
element:
|
|
1975
|
-
}),
|
|
1967
|
+
return yr(n, o);
|
|
1968
|
+
if ((z ? z(n) : n.nodeType) === Ie.element && !zt(n) || (o === "noscript" || o === "noembed" || o === "noframes") && ae(ha, n.innerHTML))
|
|
1969
|
+
return ze(n), !0;
|
|
1970
|
+
if (Ae && n.nodeType === Ie.text) {
|
|
1971
|
+
const g = Gt(n.textContent);
|
|
1972
|
+
n.textContent !== g && (mt(t.removed, {
|
|
1973
|
+
element: n.cloneNode()
|
|
1974
|
+
}), n.textContent = g);
|
|
1976
1975
|
}
|
|
1977
|
-
return Me(F.afterSanitizeElements,
|
|
1978
|
-
}, Cn = function(
|
|
1979
|
-
if (
|
|
1976
|
+
return Me(F.afterSanitizeElements, n, null), !1;
|
|
1977
|
+
}, Cn = function(n, o, d) {
|
|
1978
|
+
if (yt[o] || Tt && (o === "id" || o === "name") && (d in r || d in y))
|
|
1980
1979
|
return !1;
|
|
1981
|
-
const g = Y[o] || Ee.attributeCheck instanceof Function && Ee.attributeCheck(o,
|
|
1982
|
-
if (!($e && ae(
|
|
1983
|
-
if (!(
|
|
1980
|
+
const g = Y[o] || Ee.attributeCheck instanceof Function && Ee.attributeCheck(o, n);
|
|
1981
|
+
if (!($e && ae(bt, o))) {
|
|
1982
|
+
if (!(Dt && ae(qt, o))) {
|
|
1984
1983
|
if (g) {
|
|
1985
|
-
if (!
|
|
1986
|
-
if (!ae(Pe,
|
|
1987
|
-
if (!((o === "src" || o === "xlink:href" || o === "href") &&
|
|
1988
|
-
if (!(
|
|
1984
|
+
if (!At[o]) {
|
|
1985
|
+
if (!ae(Pe, Rt(d, tt, ""))) {
|
|
1986
|
+
if (!((o === "src" || o === "xlink:href" || o === "href") && n !== "script" && $n(d, "data:") === 0 && Mt[n])) {
|
|
1987
|
+
if (!(ot && !ae(et, Rt(d, tt, "")))) {
|
|
1989
1988
|
if (d)
|
|
1990
1989
|
return !1;
|
|
1991
1990
|
}
|
|
@@ -1996,34 +1995,34 @@ function lr() {
|
|
|
1996
1995
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1997
1996
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1998
1997
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1999
|
-
!(vn(
|
|
1998
|
+
!(vn(n) && ($.tagNameCheck instanceof RegExp && ae($.tagNameCheck, n) || $.tagNameCheck instanceof Function && $.tagNameCheck(n)) && ($.attributeNameCheck instanceof RegExp && ae($.attributeNameCheck, o) || $.attributeNameCheck instanceof Function && $.attributeNameCheck(o, n)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
2000
1999
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
2001
2000
|
o === "is" && $.allowCustomizedBuiltInElements && ($.tagNameCheck instanceof RegExp && ae($.tagNameCheck, d) || $.tagNameCheck instanceof Function && $.tagNameCheck(d)))
|
|
2002
2001
|
) return !1;
|
|
2003
2002
|
}
|
|
2004
2003
|
}
|
|
2005
2004
|
return !0;
|
|
2006
|
-
},
|
|
2007
|
-
return !
|
|
2008
|
-
},
|
|
2005
|
+
}, Tr = C({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), vn = function(n) {
|
|
2006
|
+
return !Tr[vt(n)] && ae(We, n);
|
|
2007
|
+
}, Er = function(n, o, d, g) {
|
|
2009
2008
|
if (U && typeof A == "object" && typeof A.getAttributeType == "function" && !d)
|
|
2010
|
-
switch (A.getAttributeType(
|
|
2009
|
+
switch (A.getAttributeType(n, o)) {
|
|
2011
2010
|
case "TrustedHTML":
|
|
2012
2011
|
return b(g);
|
|
2013
2012
|
case "TrustedScriptURL":
|
|
2014
|
-
return
|
|
2013
|
+
return O(g);
|
|
2015
2014
|
}
|
|
2016
2015
|
return g;
|
|
2017
|
-
},
|
|
2016
|
+
}, Ar = function(n, o, d, g) {
|
|
2018
2017
|
try {
|
|
2019
|
-
d ?
|
|
2018
|
+
d ? n.setAttributeNS(d, o, g) : n.setAttribute(o, g), Bt(n) ? ze(n) : Bn(t.removed);
|
|
2020
2019
|
} catch {
|
|
2021
|
-
Je(o,
|
|
2020
|
+
Je(o, n);
|
|
2022
2021
|
}
|
|
2023
|
-
}, On = function(
|
|
2024
|
-
Me(F.beforeSanitizeAttributes,
|
|
2025
|
-
const o =
|
|
2026
|
-
if (!o ||
|
|
2022
|
+
}, On = function(n) {
|
|
2023
|
+
Me(F.beforeSanitizeAttributes, n, null);
|
|
2024
|
+
const o = n.attributes;
|
|
2025
|
+
if (!o || Bt(n))
|
|
2027
2026
|
return;
|
|
2028
2027
|
const d = {
|
|
2029
2028
|
attrName: "",
|
|
@@ -2033,56 +2032,56 @@ function lr() {
|
|
|
2033
2032
|
forceKeepAttr: void 0
|
|
2034
2033
|
};
|
|
2035
2034
|
let g = o.length;
|
|
2036
|
-
const R = j(
|
|
2035
|
+
const R = j(n.nodeName);
|
|
2037
2036
|
for (; g--; ) {
|
|
2038
2037
|
const v = o[g], te = v.name, X = v.namespaceURI, Te = v.value, Se = j(te), tn = Te;
|
|
2039
|
-
let le = te === "value" ? tn :
|
|
2040
|
-
if (d.attrName = Se, d.attrValue = le, d.keepAttr = !0, d.forceKeepAttr = void 0, Me(F.uponSanitizeAttribute,
|
|
2041
|
-
Je(te,
|
|
2038
|
+
let le = te === "value" ? tn : Xo(tn);
|
|
2039
|
+
if (d.attrName = Se, d.attrValue = le, d.keepAttr = !0, d.forceKeepAttr = void 0, Me(F.uponSanitizeAttribute, n, d), le = d.attrValue, Ve && (Se === "id" || Se === "name") && $n(le, ct) !== 0 && (Je(te, n), le = ct + le), Ye && ae(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, le)) {
|
|
2040
|
+
Je(te, n);
|
|
2042
2041
|
continue;
|
|
2043
2042
|
}
|
|
2044
|
-
if (Se === "attributename" &&
|
|
2045
|
-
Je(te,
|
|
2043
|
+
if (Se === "attributename" && Wn(le, "href")) {
|
|
2044
|
+
Je(te, n);
|
|
2046
2045
|
continue;
|
|
2047
2046
|
}
|
|
2048
2047
|
if (!d.forceKeepAttr) {
|
|
2049
2048
|
if (!d.keepAttr) {
|
|
2050
|
-
Je(te,
|
|
2049
|
+
Je(te, n);
|
|
2051
2050
|
continue;
|
|
2052
2051
|
}
|
|
2053
|
-
if (!Ue && ae(
|
|
2054
|
-
Je(te,
|
|
2052
|
+
if (!Ue && ae(_a, le)) {
|
|
2053
|
+
Je(te, n);
|
|
2055
2054
|
continue;
|
|
2056
2055
|
}
|
|
2057
|
-
if (Ae && (le =
|
|
2058
|
-
Je(te,
|
|
2056
|
+
if (Ae && (le = Gt(le)), !Cn(R, Se, le)) {
|
|
2057
|
+
Je(te, n);
|
|
2059
2058
|
continue;
|
|
2060
2059
|
}
|
|
2061
|
-
le =
|
|
2060
|
+
le = Er(R, Se, X, le), le !== tn && Ar(n, te, X, le);
|
|
2062
2061
|
}
|
|
2063
2062
|
}
|
|
2064
|
-
Me(F.afterSanitizeAttributes,
|
|
2065
|
-
},
|
|
2063
|
+
Me(F.afterSanitizeAttributes, n, null);
|
|
2064
|
+
}, Wt = function(n) {
|
|
2066
2065
|
let o = null;
|
|
2067
|
-
const d = Rn(
|
|
2068
|
-
for (Me(F.beforeSanitizeShadowDOM,
|
|
2069
|
-
if (Me(F.uponSanitizeShadowNode, o, null), In(o), On(o),
|
|
2066
|
+
const d = Rn(n);
|
|
2067
|
+
for (Me(F.beforeSanitizeShadowDOM, n, null); o = d.nextNode(); )
|
|
2068
|
+
if (Me(F.uponSanitizeShadowNode, o, null), In(o), On(o), pt(o.content) && Wt(o.content), (z ? z(o) : o.nodeType) === Ie.element) {
|
|
2070
2069
|
const R = H(o);
|
|
2071
|
-
|
|
2070
|
+
pt(R) && (en(R), Wt(R));
|
|
2072
2071
|
}
|
|
2073
|
-
Me(F.afterSanitizeShadowDOM,
|
|
2074
|
-
}, en = function(
|
|
2072
|
+
Me(F.afterSanitizeShadowDOM, n, null);
|
|
2073
|
+
}, en = function(n) {
|
|
2075
2074
|
const o = [{
|
|
2076
|
-
node:
|
|
2075
|
+
node: n,
|
|
2077
2076
|
shadow: null
|
|
2078
2077
|
}];
|
|
2079
2078
|
for (; o.length > 0; ) {
|
|
2080
2079
|
const d = o.pop();
|
|
2081
2080
|
if (d.shadow) {
|
|
2082
|
-
|
|
2081
|
+
Wt(d.shadow);
|
|
2083
2082
|
continue;
|
|
2084
2083
|
}
|
|
2085
|
-
const g = d.node, v = (z ? z(g) : g.nodeType) === Ie.element, te =
|
|
2084
|
+
const g = d.node, v = (z ? z(g) : g.nodeType) === Ie.element, te = N(g);
|
|
2086
2085
|
if (te)
|
|
2087
2086
|
for (let X = te.length - 1; X >= 0; --X)
|
|
2088
2087
|
o.push({
|
|
@@ -2093,7 +2092,7 @@ function lr() {
|
|
|
2093
2092
|
const X = K ? K(g) : null;
|
|
2094
2093
|
if (typeof X == "string" && j(X) === "template") {
|
|
2095
2094
|
const Te = g.content;
|
|
2096
|
-
|
|
2095
|
+
pt(Te) && o.push({
|
|
2097
2096
|
node: Te,
|
|
2098
2097
|
shadow: null
|
|
2099
2098
|
});
|
|
@@ -2101,7 +2100,7 @@ function lr() {
|
|
|
2101
2100
|
}
|
|
2102
2101
|
if (v) {
|
|
2103
2102
|
const X = H(g);
|
|
2104
|
-
|
|
2103
|
+
pt(X) && o.push({
|
|
2105
2104
|
node: null,
|
|
2106
2105
|
shadow: X
|
|
2107
2106
|
}, {
|
|
@@ -2111,49 +2110,49 @@ function lr() {
|
|
|
2111
2110
|
}
|
|
2112
2111
|
}
|
|
2113
2112
|
};
|
|
2114
|
-
return
|
|
2115
|
-
let
|
|
2116
|
-
if (
|
|
2113
|
+
return t.sanitize = function(p) {
|
|
2114
|
+
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = null, d = null, g = null, R = null;
|
|
2115
|
+
if (dt = !p, dt && (p = "<!-->"), typeof p != "string" && !Nt(p) && (p = ta(p), typeof p != "string"))
|
|
2117
2116
|
throw Qe("dirty is not a string, aborting");
|
|
2118
|
-
if (!
|
|
2119
|
-
return
|
|
2120
|
-
|
|
2121
|
-
const v =
|
|
2117
|
+
if (!t.isSupported)
|
|
2118
|
+
return p;
|
|
2119
|
+
at ? (P = je, Y = Fe) : ce(n), (F.uponSanitizeElement.length > 0 || F.uponSanitizeAttribute.length > 0) && (P = ue(P)), F.uponSanitizeAttribute.length > 0 && (Y = ue(Y)), t.removed = [];
|
|
2120
|
+
const v = lt && typeof p != "string" && Nt(p);
|
|
2122
2121
|
if (v) {
|
|
2123
|
-
const Te = K ? K(
|
|
2122
|
+
const Te = K ? K(p) : p.nodeName;
|
|
2124
2123
|
if (typeof Te == "string") {
|
|
2125
2124
|
const Se = j(Te);
|
|
2126
2125
|
if (!P[Se] || Ne[Se])
|
|
2127
2126
|
throw Qe("root node is forbidden and cannot be sanitized in-place");
|
|
2128
2127
|
}
|
|
2129
|
-
if (
|
|
2128
|
+
if (Bt(p))
|
|
2130
2129
|
throw Qe("root node is clobbered and cannot be sanitized in-place");
|
|
2131
2130
|
try {
|
|
2132
|
-
en(
|
|
2131
|
+
en(p);
|
|
2133
2132
|
} catch (Se) {
|
|
2134
|
-
throw Nn(
|
|
2133
|
+
throw Nn(p), Se;
|
|
2135
2134
|
}
|
|
2136
|
-
} else if (
|
|
2137
|
-
o = kn("<!---->"), d = o.ownerDocument.importNode(
|
|
2135
|
+
} else if (Nt(p))
|
|
2136
|
+
o = kn("<!---->"), d = o.ownerDocument.importNode(p, !0), d.nodeType === Ie.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? o = d : o.appendChild(d), en(d);
|
|
2138
2137
|
else {
|
|
2139
2138
|
if (!De && !Ae && !ke && // eslint-disable-next-line unicorn/prefer-includes
|
|
2140
|
-
|
|
2141
|
-
return U &&
|
|
2142
|
-
if (o = kn(
|
|
2143
|
-
return De ? null :
|
|
2139
|
+
p.indexOf("<") === -1)
|
|
2140
|
+
return U && it ? b(p) : p;
|
|
2141
|
+
if (o = kn(p), !o)
|
|
2142
|
+
return De ? null : it ? q : "";
|
|
2144
2143
|
}
|
|
2145
|
-
o &&
|
|
2146
|
-
const te = Rn(v ?
|
|
2144
|
+
o && st && ze(o.firstChild);
|
|
2145
|
+
const te = Rn(v ? p : o);
|
|
2147
2146
|
try {
|
|
2148
2147
|
for (; g = te.nextNode(); )
|
|
2149
|
-
In(g), On(g),
|
|
2148
|
+
In(g), On(g), pt(g.content) && Wt(g.content);
|
|
2150
2149
|
} catch (Te) {
|
|
2151
|
-
throw v && Nn(
|
|
2150
|
+
throw v && Nn(p), Te;
|
|
2152
2151
|
}
|
|
2153
2152
|
if (v)
|
|
2154
|
-
return
|
|
2155
|
-
Te.element &&
|
|
2156
|
-
}), Ae && Qt(
|
|
2153
|
+
return kt(t.removed, (Te) => {
|
|
2154
|
+
Te.element && gr(Te.element);
|
|
2155
|
+
}), Ae && Qt(p), p;
|
|
2157
2156
|
if (De) {
|
|
2158
2157
|
if (Ae && Qt(o), Ke)
|
|
2159
2158
|
for (R = he.call(o.ownerDocument); o.firstChild; )
|
|
@@ -2163,35 +2162,35 @@ function lr() {
|
|
|
2163
2162
|
return (Y.shadowroot || Y.shadowrootmode) && (R = xe.call(a, R, !0)), R;
|
|
2164
2163
|
}
|
|
2165
2164
|
let X = ke ? o.outerHTML : o.innerHTML;
|
|
2166
|
-
return ke && P["!doctype"] && o.ownerDocument && o.ownerDocument.doctype && o.ownerDocument.doctype.name && ae(
|
|
2167
|
-
` + X), Ae && (X =
|
|
2168
|
-
},
|
|
2169
|
-
let
|
|
2170
|
-
ce(
|
|
2171
|
-
},
|
|
2172
|
-
c = null,
|
|
2173
|
-
},
|
|
2165
|
+
return ke && P["!doctype"] && o.ownerDocument && o.ownerDocument.doctype && o.ownerDocument.doctype.name && ae(fa, o.ownerDocument.doctype.name) && (X = "<!DOCTYPE " + o.ownerDocument.doctype.name + `>
|
|
2166
|
+
` + X), Ae && (X = Gt(X)), U && it ? b(X) : X;
|
|
2167
|
+
}, t.setConfig = function() {
|
|
2168
|
+
let p = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2169
|
+
ce(p), at = !0, je = P, Fe = Y;
|
|
2170
|
+
}, t.clearConfig = function() {
|
|
2171
|
+
c = null, at = !1, je = null, Fe = null, U = me, q = "";
|
|
2172
|
+
}, t.isValidAttribute = function(p, n, o) {
|
|
2174
2173
|
c || ce({});
|
|
2175
|
-
const d = j(
|
|
2174
|
+
const d = j(p), g = j(n);
|
|
2176
2175
|
return Cn(d, g, o);
|
|
2177
|
-
},
|
|
2178
|
-
typeof
|
|
2179
|
-
},
|
|
2180
|
-
if (ne(F,
|
|
2181
|
-
if (
|
|
2182
|
-
const o =
|
|
2183
|
-
return o === -1 ? void 0 :
|
|
2176
|
+
}, t.addHook = function(p, n) {
|
|
2177
|
+
typeof n == "function" && ne(F, p) && mt(F[p], n);
|
|
2178
|
+
}, t.removeHook = function(p, n) {
|
|
2179
|
+
if (ne(F, p)) {
|
|
2180
|
+
if (n !== void 0) {
|
|
2181
|
+
const o = Vo(F[p], n);
|
|
2182
|
+
return o === -1 ? void 0 : qo(F[p], o, 1)[0];
|
|
2184
2183
|
}
|
|
2185
|
-
return
|
|
2184
|
+
return Bn(F[p]);
|
|
2186
2185
|
}
|
|
2187
|
-
},
|
|
2188
|
-
ne(F,
|
|
2189
|
-
},
|
|
2190
|
-
F =
|
|
2191
|
-
},
|
|
2186
|
+
}, t.removeHooks = function(p) {
|
|
2187
|
+
ne(F, p) && (F[p] = []);
|
|
2188
|
+
}, t.removeAllHooks = function() {
|
|
2189
|
+
F = Qn();
|
|
2190
|
+
}, t;
|
|
2192
2191
|
}
|
|
2193
|
-
var
|
|
2194
|
-
const
|
|
2192
|
+
var jt = fr();
|
|
2193
|
+
const ya = [
|
|
2195
2194
|
"a",
|
|
2196
2195
|
"b",
|
|
2197
2196
|
"br",
|
|
@@ -2207,26 +2206,26 @@ const da = [
|
|
|
2207
2206
|
"u",
|
|
2208
2207
|
"ul"
|
|
2209
2208
|
];
|
|
2210
|
-
function
|
|
2209
|
+
function Ta(e) {
|
|
2211
2210
|
e.hasAttribute("href") && (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"));
|
|
2212
2211
|
}
|
|
2213
|
-
function
|
|
2214
|
-
|
|
2215
|
-
const
|
|
2216
|
-
ALLOWED_TAGS: [...
|
|
2212
|
+
function Ea(e) {
|
|
2213
|
+
jt.addHook("afterSanitizeAttributes", Ta);
|
|
2214
|
+
const t = jt.sanitize(e, {
|
|
2215
|
+
ALLOWED_TAGS: [...ya]
|
|
2217
2216
|
});
|
|
2218
|
-
return
|
|
2217
|
+
return jt.removeHook("afterSanitizeAttributes"), t;
|
|
2219
2218
|
}
|
|
2220
|
-
function
|
|
2221
|
-
return
|
|
2219
|
+
function Aa(e) {
|
|
2220
|
+
return jt.sanitize(e, { ALLOWED_TAGS: [] });
|
|
2222
2221
|
}
|
|
2223
2222
|
class En extends Error {
|
|
2224
|
-
constructor(
|
|
2225
|
-
super(`HTTP ${
|
|
2223
|
+
constructor(t, r) {
|
|
2224
|
+
super(`HTTP ${t}: ${r}`), this.name = "HttpError", this.status = t, this.statusText = r;
|
|
2226
2225
|
}
|
|
2227
2226
|
}
|
|
2228
|
-
async function
|
|
2229
|
-
const { authorizationToken: l, headers: s, ...u } = a, m = await fetch(
|
|
2227
|
+
async function pr(e, t, r, a = {}) {
|
|
2228
|
+
const { authorizationToken: l, headers: s, ...u } = a, m = await fetch(t, {
|
|
2230
2229
|
method: e,
|
|
2231
2230
|
headers: {
|
|
2232
2231
|
"Content-Type": "application/json",
|
|
@@ -2240,23 +2239,23 @@ async function ur(e, n, r, a = {}) {
|
|
|
2240
2239
|
throw new En(m.status, m.statusText);
|
|
2241
2240
|
return m.json();
|
|
2242
2241
|
}
|
|
2243
|
-
const
|
|
2242
|
+
const mr = (e, t, r, a) => pr("GET", e, void 0, { signal: r, authorizationToken: a }), An = (e, t, r = {}) => pr("POST", e, t, r);
|
|
2244
2243
|
function gn(e) {
|
|
2245
2244
|
if (e === "") return "";
|
|
2246
2245
|
try {
|
|
2247
|
-
const
|
|
2248
|
-
return typeof
|
|
2246
|
+
const t = JSON.parse(e);
|
|
2247
|
+
return typeof t == "string" ? t : String(t ?? "");
|
|
2249
2248
|
} catch {
|
|
2250
2249
|
return e;
|
|
2251
2250
|
}
|
|
2252
2251
|
}
|
|
2253
|
-
function
|
|
2252
|
+
function Sa(e) {
|
|
2254
2253
|
return e.includes("/chat/agent-completions");
|
|
2255
2254
|
}
|
|
2256
|
-
function
|
|
2255
|
+
function hr(e) {
|
|
2257
2256
|
return /\/conversations(?:\/|$)/.test(e.replace(/\?.*$/, ""));
|
|
2258
2257
|
}
|
|
2259
|
-
const
|
|
2258
|
+
const Ct = {
|
|
2260
2259
|
model: "gpt-4o-mini",
|
|
2261
2260
|
agentName: "Group_Ask_Arbor_Agent",
|
|
2262
2261
|
systemPrompt: "You are a helpful AI assistant for Arbor Education group MIS users.",
|
|
@@ -2268,18 +2267,18 @@ const It = {
|
|
|
2268
2267
|
{ server: "statsapi", tools: ["*"] },
|
|
2269
2268
|
{ server: "arbormis", tools: ["create_pdf", "academic_date_range_finder"] }
|
|
2270
2269
|
]
|
|
2271
|
-
}, bn = "user",
|
|
2272
|
-
function
|
|
2270
|
+
}, bn = "user", wa = "assistant", Na = "system";
|
|
2271
|
+
function ka({
|
|
2273
2272
|
chatId: e,
|
|
2274
|
-
userMessage:
|
|
2273
|
+
userMessage: t,
|
|
2275
2274
|
chatHistory: r = [],
|
|
2276
2275
|
config: a = {}
|
|
2277
2276
|
}) {
|
|
2278
|
-
const l = a.model ??
|
|
2279
|
-
messages:
|
|
2280
|
-
{ role:
|
|
2281
|
-
{ role: bn, content:
|
|
2282
|
-
] : [{ role: bn, content:
|
|
2277
|
+
const l = a.model ?? Ct.model, s = a.agentName ?? Ct.agentName, u = a.systemPrompt ?? Ct.systemPrompt, m = a.modelKwargs ?? Ct.modelKwargs, h = a.mcps ?? [...Ct.mcps], f = !e && r.length === 0, A = {
|
|
2278
|
+
messages: f ? [
|
|
2279
|
+
{ role: Na, content: u },
|
|
2280
|
+
{ role: bn, content: t }
|
|
2281
|
+
] : [{ role: bn, content: t }],
|
|
2283
2282
|
model: l,
|
|
2284
2283
|
model_kwargs: m,
|
|
2285
2284
|
mcps: h,
|
|
@@ -2289,12 +2288,12 @@ function ba({
|
|
|
2289
2288
|
},
|
|
2290
2289
|
moderation_enabled: !0
|
|
2291
2290
|
};
|
|
2292
|
-
return e && (A.chat_id = e),
|
|
2291
|
+
return e && (A.chat_id = e), f && (A.auto_title = !1), A;
|
|
2293
2292
|
}
|
|
2294
|
-
function
|
|
2295
|
-
const
|
|
2296
|
-
if (!
|
|
2297
|
-
const r =
|
|
2293
|
+
function Ra(e) {
|
|
2294
|
+
const t = e.trim();
|
|
2295
|
+
if (!t.startsWith("data:")) return null;
|
|
2296
|
+
const r = t.slice(5).trim();
|
|
2298
2297
|
if (!r) return null;
|
|
2299
2298
|
try {
|
|
2300
2299
|
return JSON.parse(r);
|
|
@@ -2302,10 +2301,10 @@ function ya(e) {
|
|
|
2302
2301
|
return null;
|
|
2303
2302
|
}
|
|
2304
2303
|
}
|
|
2305
|
-
async function
|
|
2306
|
-
var
|
|
2304
|
+
async function Ia(e) {
|
|
2305
|
+
var f, T, A;
|
|
2307
2306
|
if ((e.headers.get("content-type") ?? "").includes("application/json")) {
|
|
2308
|
-
const E = (
|
|
2307
|
+
const E = (f = (await e.json()).items) == null ? void 0 : f[0];
|
|
2309
2308
|
return E ? {
|
|
2310
2309
|
text: E.text ?? E.content ?? "",
|
|
2311
2310
|
chatId: E.chatId,
|
|
@@ -2323,35 +2322,35 @@ async function Ta(e) {
|
|
|
2323
2322
|
const k = l.split(`
|
|
2324
2323
|
`);
|
|
2325
2324
|
l = k.pop() ?? "";
|
|
2326
|
-
for (const
|
|
2327
|
-
const
|
|
2328
|
-
if (
|
|
2325
|
+
for (const D of k) {
|
|
2326
|
+
const N = D.trim();
|
|
2327
|
+
if (N === "event: error") {
|
|
2329
2328
|
h = !0;
|
|
2330
2329
|
continue;
|
|
2331
2330
|
}
|
|
2332
|
-
const
|
|
2333
|
-
if (!
|
|
2334
|
-
if (
|
|
2331
|
+
const w = Ra(N);
|
|
2332
|
+
if (!w) continue;
|
|
2333
|
+
if (w.error || h)
|
|
2335
2334
|
throw new Error(
|
|
2336
|
-
|
|
2335
|
+
w.message_text ?? (typeof w.message == "string" ? w.message : "Agent completion stream failed")
|
|
2337
2336
|
);
|
|
2338
|
-
h = !1,
|
|
2339
|
-
const H = (A =
|
|
2340
|
-
H && (s =
|
|
2337
|
+
h = !1, w.chat_id && (u = w.chat_id), w.event_id && (m = w.event_id), w.client_message_id && (m = w.client_message_id);
|
|
2338
|
+
const H = (A = w.message) == null ? void 0 : A.content;
|
|
2339
|
+
H && (s = w.is_final ? H : s + H);
|
|
2341
2340
|
}
|
|
2342
2341
|
}
|
|
2343
2342
|
return s ? { text: s, chatId: u, messageId: m } : null;
|
|
2344
2343
|
}
|
|
2345
|
-
async function
|
|
2344
|
+
async function Ca({
|
|
2346
2345
|
chatUrl: e,
|
|
2347
|
-
chatId:
|
|
2346
|
+
chatId: t,
|
|
2348
2347
|
userMessage: r,
|
|
2349
2348
|
chatHistory: a,
|
|
2350
2349
|
authorizationToken: l,
|
|
2351
2350
|
config: s
|
|
2352
2351
|
}) {
|
|
2353
|
-
const u =
|
|
2354
|
-
chatId:
|
|
2352
|
+
const u = ka({
|
|
2353
|
+
chatId: t,
|
|
2355
2354
|
userMessage: r,
|
|
2356
2355
|
chatHistory: a,
|
|
2357
2356
|
config: s
|
|
@@ -2367,58 +2366,58 @@ async function Ea({
|
|
|
2367
2366
|
});
|
|
2368
2367
|
if (!m.ok)
|
|
2369
2368
|
throw new En(m.status, m.statusText);
|
|
2370
|
-
return
|
|
2369
|
+
return Ia(m);
|
|
2371
2370
|
}
|
|
2372
|
-
function
|
|
2371
|
+
function va(e) {
|
|
2373
2372
|
switch (e) {
|
|
2374
2373
|
case 401:
|
|
2375
2374
|
return {
|
|
2376
|
-
text:
|
|
2375
|
+
text: bo,
|
|
2377
2376
|
type: ve
|
|
2378
2377
|
};
|
|
2379
2378
|
case 403:
|
|
2380
2379
|
return {
|
|
2381
|
-
text:
|
|
2380
|
+
text: yo,
|
|
2382
2381
|
type: ve
|
|
2383
2382
|
};
|
|
2384
2383
|
case 404:
|
|
2385
2384
|
return {
|
|
2386
|
-
text:
|
|
2385
|
+
text: To,
|
|
2387
2386
|
type: ve
|
|
2388
2387
|
};
|
|
2389
2388
|
case 408:
|
|
2390
2389
|
case 504:
|
|
2391
2390
|
return {
|
|
2392
|
-
text:
|
|
2391
|
+
text: Eo,
|
|
2393
2392
|
type: Kt
|
|
2394
2393
|
};
|
|
2395
2394
|
case 429:
|
|
2396
2395
|
return {
|
|
2397
|
-
text:
|
|
2396
|
+
text: Ao,
|
|
2398
2397
|
type: Kt
|
|
2399
2398
|
};
|
|
2400
2399
|
default:
|
|
2401
2400
|
return e >= 500 ? {
|
|
2402
|
-
text:
|
|
2401
|
+
text: So,
|
|
2403
2402
|
type: ve
|
|
2404
2403
|
} : {
|
|
2405
|
-
text:
|
|
2404
|
+
text: cr,
|
|
2406
2405
|
type: ve
|
|
2407
2406
|
};
|
|
2408
2407
|
}
|
|
2409
2408
|
}
|
|
2410
|
-
function
|
|
2411
|
-
return e instanceof En ?
|
|
2412
|
-
text:
|
|
2409
|
+
function Oa(e) {
|
|
2410
|
+
return e instanceof En ? va(e.status) : e instanceof TypeError ? {
|
|
2411
|
+
text: wo,
|
|
2413
2412
|
type: ve
|
|
2414
2413
|
} : {
|
|
2415
|
-
text:
|
|
2414
|
+
text: cr,
|
|
2416
2415
|
type: ve
|
|
2417
2416
|
};
|
|
2418
2417
|
}
|
|
2419
|
-
const
|
|
2418
|
+
const La = 55e3, yn = "fallback", Da = async ({
|
|
2420
2419
|
chatId: e = void 0,
|
|
2421
|
-
chatUrl:
|
|
2420
|
+
chatUrl: t,
|
|
2422
2421
|
userMessage: r,
|
|
2423
2422
|
userInputDeviceLastUsed: a,
|
|
2424
2423
|
chatHistory: l,
|
|
@@ -2428,20 +2427,20 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2428
2427
|
}) => {
|
|
2429
2428
|
let h;
|
|
2430
2429
|
try {
|
|
2431
|
-
if (
|
|
2432
|
-
const
|
|
2433
|
-
chatUrl:
|
|
2430
|
+
if (Sa(t)) {
|
|
2431
|
+
const N = await Ca({
|
|
2432
|
+
chatUrl: t,
|
|
2434
2433
|
chatId: e,
|
|
2435
2434
|
userMessage: r,
|
|
2436
2435
|
chatHistory: l,
|
|
2437
2436
|
authorizationToken: u,
|
|
2438
2437
|
config: m
|
|
2439
2438
|
});
|
|
2440
|
-
return
|
|
2441
|
-
text:
|
|
2442
|
-
id:
|
|
2443
|
-
...
|
|
2444
|
-
type:
|
|
2439
|
+
return N ? {
|
|
2440
|
+
text: N.text,
|
|
2441
|
+
id: N.messageId,
|
|
2442
|
+
...N.chatId != null && { chatId: N.chatId },
|
|
2443
|
+
type: Lt
|
|
2445
2444
|
} : null;
|
|
2446
2445
|
}
|
|
2447
2446
|
const _ = {
|
|
@@ -2451,12 +2450,12 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2451
2450
|
chatHistory: l,
|
|
2452
2451
|
canvasHistory: s
|
|
2453
2452
|
}, E = new AbortController(), k = An(
|
|
2454
|
-
|
|
2453
|
+
t,
|
|
2455
2454
|
_,
|
|
2456
2455
|
{ authorizationToken: u, signal: E.signal }
|
|
2457
|
-
),
|
|
2458
|
-
(
|
|
2459
|
-
E.abort(),
|
|
2456
|
+
), D = new Promise(
|
|
2457
|
+
(N) => setTimeout(() => {
|
|
2458
|
+
E.abort(), N({
|
|
2460
2459
|
items: [
|
|
2461
2460
|
{
|
|
2462
2461
|
id: yn,
|
|
@@ -2465,38 +2464,39 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2465
2464
|
}
|
|
2466
2465
|
]
|
|
2467
2466
|
});
|
|
2468
|
-
},
|
|
2467
|
+
}, La)
|
|
2469
2468
|
);
|
|
2470
|
-
h = await Promise.race([k,
|
|
2469
|
+
h = await Promise.race([k, D]);
|
|
2471
2470
|
} catch (_) {
|
|
2472
2471
|
console.error("Error in getNewAgentMessage", _);
|
|
2473
|
-
const { text: E, type: k } =
|
|
2472
|
+
const { text: E, type: k } = Oa(_);
|
|
2474
2473
|
return {
|
|
2475
2474
|
text: E,
|
|
2476
2475
|
type: k,
|
|
2477
2476
|
id: crypto.randomUUID()
|
|
2478
2477
|
};
|
|
2479
2478
|
}
|
|
2480
|
-
const
|
|
2481
|
-
if (!
|
|
2482
|
-
const T =
|
|
2483
|
-
typeof
|
|
2479
|
+
const f = h.items[0];
|
|
2480
|
+
if (!f) return null;
|
|
2481
|
+
const T = f.text != null && f.text !== "" ? f.text : gn(
|
|
2482
|
+
typeof f.content == "string" ? f.content : ""
|
|
2484
2483
|
);
|
|
2485
2484
|
return {
|
|
2486
2485
|
text: typeof T == "string" ? T : "",
|
|
2487
|
-
id:
|
|
2488
|
-
...
|
|
2489
|
-
...
|
|
2490
|
-
...
|
|
2491
|
-
...
|
|
2492
|
-
type:
|
|
2493
|
-
...
|
|
2486
|
+
id: f.id,
|
|
2487
|
+
...f.chatId != null && { chatId: f.chatId },
|
|
2488
|
+
...f.timedOut != null && { timedOut: f.timedOut },
|
|
2489
|
+
...f.deferred != null && { deferred: f.deferred },
|
|
2490
|
+
...f.hardStopped != null && { hardStopped: f.hardStopped },
|
|
2491
|
+
type: f.type,
|
|
2492
|
+
...f.element != null && { element: f.element },
|
|
2493
|
+
...f.followUpPrompts != null && { followUpPrompts: f.followUpPrompts }
|
|
2494
2494
|
};
|
|
2495
|
-
},
|
|
2495
|
+
}, Ma = (e) => new Date(e).toLocaleDateString("en-GB", {
|
|
2496
2496
|
day: "numeric",
|
|
2497
2497
|
month: "short",
|
|
2498
2498
|
year: "numeric"
|
|
2499
|
-
}),
|
|
2499
|
+
}), xa = [
|
|
2500
2500
|
{
|
|
2501
2501
|
field: "title",
|
|
2502
2502
|
headerName: "Conversation",
|
|
@@ -2506,28 +2506,38 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2506
2506
|
field: "updatedAt",
|
|
2507
2507
|
headerName: "Last Conversation",
|
|
2508
2508
|
width: 140,
|
|
2509
|
-
valueFormatter: ({ value: e }) =>
|
|
2509
|
+
valueFormatter: ({ value: e }) => Ma(e)
|
|
2510
2510
|
}
|
|
2511
|
-
],
|
|
2511
|
+
], Pa = {
|
|
2512
2512
|
sortable: !1,
|
|
2513
2513
|
filter: !1,
|
|
2514
2514
|
resizable: !1,
|
|
2515
2515
|
editable: !1,
|
|
2516
2516
|
suppressHeaderMenuButton: !0
|
|
2517
|
-
},
|
|
2518
|
-
|
|
2517
|
+
}, Ua = (e) => {
|
|
2518
|
+
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
2519
|
+
const r = e[t];
|
|
2520
|
+
if (r.type === Lt)
|
|
2521
|
+
return r.followUpPrompts ?? null;
|
|
2522
|
+
}
|
|
2523
|
+
return null;
|
|
2524
|
+
}, Fa = (e, t, r) => {
|
|
2525
|
+
if (r)
|
|
2526
|
+
return e !== null && e.length > 0 ? e : e === null ? null : t.followUpPrompts;
|
|
2527
|
+
}, fn = "NONE", Ha = "KEYBOARD", za = "VOICE", Ga = "MIXED", Ba = 2e4, Wa = 15, $a = (e, t) => new Promise((r) => {
|
|
2528
|
+
if (t != null && t.aborted) {
|
|
2519
2529
|
r(!1);
|
|
2520
2530
|
return;
|
|
2521
2531
|
}
|
|
2522
2532
|
const a = setTimeout(() => {
|
|
2523
|
-
|
|
2533
|
+
t == null || t.removeEventListener("abort", l), r(!0);
|
|
2524
2534
|
}, e), l = () => {
|
|
2525
2535
|
clearTimeout(a), r(!1);
|
|
2526
2536
|
};
|
|
2527
|
-
|
|
2528
|
-
}),
|
|
2537
|
+
t == null || t.addEventListener("abort", l);
|
|
2538
|
+
}), Ya = ({
|
|
2529
2539
|
title: e,
|
|
2530
|
-
connector:
|
|
2540
|
+
connector: t,
|
|
2531
2541
|
newChatUrl: r,
|
|
2532
2542
|
lockConversation: a = !1,
|
|
2533
2543
|
messageLimit: l,
|
|
@@ -2535,15 +2545,15 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2535
2545
|
speechEnabled: u = !0,
|
|
2536
2546
|
speechLanguage: m = "en-GB",
|
|
2537
2547
|
speechSubmissionDelay: h = 1e3,
|
|
2538
|
-
chatHistory:
|
|
2548
|
+
chatHistory: f,
|
|
2539
2549
|
canvasHistory: T,
|
|
2540
2550
|
refreshAgentMessages: A,
|
|
2541
2551
|
startQuery: _,
|
|
2542
2552
|
slashMenuItems: E,
|
|
2543
2553
|
menuContent: k,
|
|
2544
|
-
samplePrompts:
|
|
2545
|
-
dailyPrompt:
|
|
2546
|
-
prompts:
|
|
2554
|
+
samplePrompts: D,
|
|
2555
|
+
dailyPrompt: N,
|
|
2556
|
+
prompts: w,
|
|
2547
2557
|
promptLibrary: H,
|
|
2548
2558
|
placeholder: pe = "Explain what you need in your own words...",
|
|
2549
2559
|
introHeading: z = "Get instant answers from your MIS",
|
|
@@ -2555,21 +2565,21 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2555
2565
|
}) => {
|
|
2556
2566
|
const G = (() => {
|
|
2557
2567
|
if (H && H.length > 0) return H;
|
|
2558
|
-
if (!
|
|
2568
|
+
if (!w || w.trim() === "") return [];
|
|
2559
2569
|
try {
|
|
2560
|
-
const c = JSON.parse(
|
|
2570
|
+
const c = JSON.parse(w);
|
|
2561
2571
|
return Array.isArray(c) && c.length > 0 ? c : [];
|
|
2562
2572
|
} catch {
|
|
2563
2573
|
return [];
|
|
2564
2574
|
}
|
|
2565
2575
|
})(), de = x(!1), b = (c) => {
|
|
2566
2576
|
de.current = c;
|
|
2567
|
-
},
|
|
2577
|
+
}, O = xo(), B = x(null), re = x(null), L = x(null), W = x(null), he = x(null), Le = x(null), [xe, F] = M(
|
|
2568
2578
|
() => s ? "" : _ ?? ""
|
|
2569
|
-
), [oe,
|
|
2570
|
-
(!de.current || c.id === "DEEP_THINKING_MESSAGE") &&
|
|
2571
|
-
}, [We, Pe] = M(!1), [P,
|
|
2572
|
-
|
|
2579
|
+
), [oe, gt] = M(s), [Q, bt] = M([]), [qt, et] = M([]), tt = (c) => {
|
|
2580
|
+
(!de.current || c.id === "DEEP_THINKING_MESSAGE") && bt((y) => [...y, c]);
|
|
2581
|
+
}, [We, Pe] = M(!1), [P, nt] = M(!1), [Y, rt] = M(!1), $ = x(!1), Ne = x(null), yt = x(!1), [Ee, Dt] = M(!1), [$e, ot] = M(fn), [Ue, Ae] = M(!1), [Ye, ke] = M(!0), [at, je] = M(!1), [Fe, st] = M("getting-started"), [De, Ke] = M([]), [it, Tt] = M(!1), Ve = Uo(l, 0), ct = Ve > 0 && Q.length >= Ve, Et = We || P;
|
|
2582
|
+
Mo(() => {
|
|
2573
2583
|
if (!!(_ != null && _.trim()) && !s || J == null && !_) return;
|
|
2574
2584
|
const y = setTimeout(() => {
|
|
2575
2585
|
var I;
|
|
@@ -2577,7 +2587,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2577
2587
|
}, J ?? 0);
|
|
2578
2588
|
return () => clearTimeout(y);
|
|
2579
2589
|
});
|
|
2580
|
-
const [
|
|
2590
|
+
const [lt, He] = M(!1), ge = !window.webkitSpeechRecognition && !window.SpeechRecognition, qe = typeof navigator < "u" && navigator.userAgent.toLowerCase().includes("firefox"), Mt = async () => {
|
|
2581
2591
|
let c = !1;
|
|
2582
2592
|
if (navigator.permissions)
|
|
2583
2593
|
try {
|
|
@@ -2591,57 +2601,57 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2591
2601
|
};
|
|
2592
2602
|
V(() => {
|
|
2593
2603
|
(async () => {
|
|
2594
|
-
const y = await
|
|
2604
|
+
const y = await Mt();
|
|
2595
2605
|
He(y);
|
|
2596
2606
|
})();
|
|
2597
2607
|
}, [u, Ue]), V(() => {
|
|
2598
|
-
|
|
2599
|
-
}, [
|
|
2608
|
+
f && f.length > 0 && (bt(f), et(Ua(f)));
|
|
2609
|
+
}, [f]);
|
|
2600
2610
|
const Xe = async (c = oe) => {
|
|
2601
|
-
if (!
|
|
2602
|
-
|
|
2603
|
-
const y = await
|
|
2604
|
-
if (
|
|
2611
|
+
if (!t.canLoadHistory || !c) return;
|
|
2612
|
+
nt(!0);
|
|
2613
|
+
const y = await t.loadHistory(c);
|
|
2614
|
+
if (O.current) {
|
|
2605
2615
|
if (JSON.stringify(y) === JSON.stringify(Q) || !y) {
|
|
2606
|
-
|
|
2616
|
+
nt(!1);
|
|
2607
2617
|
return;
|
|
2608
2618
|
}
|
|
2609
|
-
return y.chatItems.length > 0 &&
|
|
2619
|
+
return y.chatItems.length > 0 && bt(y.chatItems), et(y.followUpPrompts), nt(!1), Dt(!0), y;
|
|
2610
2620
|
}
|
|
2611
2621
|
};
|
|
2612
2622
|
V(() => {
|
|
2613
2623
|
A && !de.current && Xe();
|
|
2614
2624
|
}, [A]), V(() => {
|
|
2615
|
-
|
|
2616
|
-
}, [s,
|
|
2617
|
-
|
|
2618
|
-
top:
|
|
2625
|
+
O.current && t.canLoadHistory && s && (Ee || Xe(s));
|
|
2626
|
+
}, [s, t.canLoadHistory, Ee]), nr(() => {
|
|
2627
|
+
L.current && L.current.scrollTo({
|
|
2628
|
+
top: L.current.scrollHeight,
|
|
2619
2629
|
behavior: "smooth"
|
|
2620
2630
|
});
|
|
2621
2631
|
}, [Q]);
|
|
2622
|
-
const
|
|
2623
|
-
const y =
|
|
2632
|
+
const At = (c) => {
|
|
2633
|
+
const y = Ho(c), I = /\['Canvas_Element_ID'\s*:\s*'([^']+)',\s*'Title'\s*:\s*'([^']+)'\]/g;
|
|
2624
2634
|
return y.replace(
|
|
2625
2635
|
I,
|
|
2626
2636
|
(ce, ye, fe) => `<span class="chat-panel__message-tag">@${fe}</span>`
|
|
2627
2637
|
);
|
|
2628
|
-
},
|
|
2638
|
+
}, xt = async ({
|
|
2629
2639
|
maxAttempts: c = 6,
|
|
2630
2640
|
chatIdToFetch: y,
|
|
2631
2641
|
signal: I
|
|
2632
2642
|
} = {}) => {
|
|
2633
|
-
const ce = new Set(Q.map(({ id:
|
|
2643
|
+
const ce = new Set(Q.map(({ id: Ht }) => Ht));
|
|
2634
2644
|
let ye = 0, fe;
|
|
2635
2645
|
for (; ye < c; ) {
|
|
2636
|
-
if (I != null && I.aborted || !await
|
|
2646
|
+
if (I != null && I.aborted || !await $a(Ba, I) || (fe = await Xe(y), I != null && I.aborted)) return;
|
|
2637
2647
|
if (((fe == null ? void 0 : fe.chatItems) || []).some(
|
|
2638
|
-
(
|
|
2648
|
+
(zt) => zt.type !== _t && !ce.has(zt.id)
|
|
2639
2649
|
)) break;
|
|
2640
2650
|
ye++;
|
|
2641
2651
|
}
|
|
2642
2652
|
if (Number.isFinite(c) && ye >= c) {
|
|
2643
|
-
|
|
2644
|
-
text:
|
|
2653
|
+
tt({
|
|
2654
|
+
text: No,
|
|
2645
2655
|
id: yn,
|
|
2646
2656
|
type: ve
|
|
2647
2657
|
});
|
|
@@ -2653,9 +2663,9 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2653
2663
|
var c;
|
|
2654
2664
|
(c = B.current) == null || c.focus();
|
|
2655
2665
|
}, 0);
|
|
2656
|
-
},
|
|
2657
|
-
|
|
2658
|
-
const y = await
|
|
2666
|
+
}, ut = async (c) => {
|
|
2667
|
+
et(null), Pe(!0);
|
|
2668
|
+
const y = await t.sendMessage({
|
|
2659
2669
|
chatId: oe,
|
|
2660
2670
|
userMessage: c,
|
|
2661
2671
|
userInputDeviceLastUsed: $e,
|
|
@@ -2667,52 +2677,52 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2667
2677
|
return;
|
|
2668
2678
|
}
|
|
2669
2679
|
if (y.deferred === !0) {
|
|
2670
|
-
y.chatId &&
|
|
2680
|
+
y.chatId && gt(y.chatId);
|
|
2671
2681
|
const I = y.chatId || oe;
|
|
2672
2682
|
Ne.current = new AbortController();
|
|
2673
2683
|
try {
|
|
2674
|
-
await
|
|
2675
|
-
maxAttempts:
|
|
2684
|
+
await xt({
|
|
2685
|
+
maxAttempts: Wa,
|
|
2676
2686
|
chatIdToFetch: I,
|
|
2677
2687
|
signal: Ne.current.signal
|
|
2678
2688
|
});
|
|
2679
2689
|
} finally {
|
|
2680
2690
|
Ne.current = null;
|
|
2681
2691
|
}
|
|
2682
|
-
|
|
2692
|
+
O.current && (Pe(!1), Re());
|
|
2683
2693
|
return;
|
|
2684
2694
|
}
|
|
2685
2695
|
if (y.hardStopped === !0) {
|
|
2686
|
-
!$.current &&
|
|
2696
|
+
!$.current && t.canSendNotification && oe && await t.sendNotification({ chatId: oe }) && ($.current = !0), O.current && (rt(!0), Pe(!1), Re());
|
|
2687
2697
|
return;
|
|
2688
2698
|
}
|
|
2689
|
-
|
|
2690
|
-
text:
|
|
2699
|
+
tt({
|
|
2700
|
+
text: Ea(y.text),
|
|
2691
2701
|
type: y.type,
|
|
2692
2702
|
id: y.id,
|
|
2693
2703
|
...y.element != null && { element: y.element }
|
|
2694
|
-
}), y.chatId &&
|
|
2704
|
+
}), y.chatId && gt(y.chatId), et(y.followUpPrompts ?? null), Pe(!1), Re();
|
|
2695
2705
|
}, ee = async ({
|
|
2696
2706
|
prompt: c = null,
|
|
2697
2707
|
allowDoubleMessage: y = !1
|
|
2698
2708
|
} = {}) => {
|
|
2699
2709
|
var ye;
|
|
2700
2710
|
let I = null;
|
|
2701
|
-
if (c != null && c.trim() !== "" && (I = c.trim()), I === null && (I =
|
|
2702
|
-
const ce = Q.slice().reverse().find((fe) => fe.type ===
|
|
2711
|
+
if (c != null && c.trim() !== "" && (I = c.trim()), I === null && (I = Aa(xe).trim()), !I || We || P) return;
|
|
2712
|
+
const ce = Q.slice().reverse().find((fe) => fe.type === _t);
|
|
2703
2713
|
if (!y && ce && ce.text === I) {
|
|
2704
2714
|
console.warn("Duplicate message detected, not adding:", I);
|
|
2705
2715
|
return;
|
|
2706
2716
|
}
|
|
2707
|
-
(ye = Le.current) == null || ye.cancel(), be(),
|
|
2708
|
-
type:
|
|
2717
|
+
(ye = Le.current) == null || ye.cancel(), be(), rt(!1), $.current = !1, tt({
|
|
2718
|
+
type: _t,
|
|
2709
2719
|
text: I,
|
|
2710
|
-
id:
|
|
2711
|
-
}), F(""), Re(), b(!1), await
|
|
2720
|
+
id: Po()
|
|
2721
|
+
}), F(""), Re(), b(!1), await ut(I), ot(fn);
|
|
2712
2722
|
};
|
|
2713
2723
|
V(() => {
|
|
2714
|
-
if (
|
|
2715
|
-
|
|
2724
|
+
if (yt.current || !(_ != null && _.trim()) || s) return;
|
|
2725
|
+
yt.current = !0;
|
|
2716
2726
|
const c = setTimeout(() => {
|
|
2717
2727
|
ee({ prompt: _ });
|
|
2718
2728
|
}, J ?? 0);
|
|
@@ -2720,34 +2730,34 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2720
2730
|
}, []);
|
|
2721
2731
|
const be = () => {
|
|
2722
2732
|
he.current && (he.current.stop(), he.current = null), Ae(!1), W.current && (clearTimeout(W.current), W.current = null);
|
|
2723
|
-
},
|
|
2733
|
+
}, dt = Mr((c) => {
|
|
2724
2734
|
be(), c.trim().length > 0 && Ye && ee();
|
|
2725
2735
|
}, h);
|
|
2726
|
-
Le.current =
|
|
2727
|
-
const
|
|
2736
|
+
Le.current = dt;
|
|
2737
|
+
const ft = (c) => {
|
|
2728
2738
|
if ($e === fn) {
|
|
2729
|
-
|
|
2739
|
+
ot(c);
|
|
2730
2740
|
return;
|
|
2731
2741
|
}
|
|
2732
2742
|
if ($e !== c) {
|
|
2733
|
-
|
|
2743
|
+
ot(Ga);
|
|
2734
2744
|
return;
|
|
2735
2745
|
}
|
|
2736
2746
|
}, Xt = () => {
|
|
2737
2747
|
if (We || P) return;
|
|
2738
|
-
|
|
2748
|
+
ft(za), ke(!0);
|
|
2739
2749
|
const c = new window.webkitSpeechRecognition();
|
|
2740
2750
|
he.current = c, c.continuous = !0, c.interimResults = !0, c.lang = m, c.start(), c.onstart = () => {
|
|
2741
2751
|
Ae(!0);
|
|
2742
2752
|
}, c.onresult = (y) => {
|
|
2743
2753
|
const I = Array.from(y.results).map((ce) => ce[0]).map((ce) => ce.transcript).join("");
|
|
2744
|
-
I !== xe && F(I),
|
|
2754
|
+
I !== xe && F(I), dt(I);
|
|
2745
2755
|
}, c.onerror = () => {
|
|
2746
2756
|
be();
|
|
2747
2757
|
};
|
|
2748
|
-
},
|
|
2758
|
+
}, Pt = () => {
|
|
2749
2759
|
Ue ? be() : Xt();
|
|
2750
|
-
},
|
|
2760
|
+
}, St = !P && !We && xe.trim().length > 0;
|
|
2751
2761
|
V(
|
|
2752
2762
|
() => () => {
|
|
2753
2763
|
var c;
|
|
@@ -2755,19 +2765,19 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2755
2765
|
},
|
|
2756
2766
|
[]
|
|
2757
2767
|
), V(() => {
|
|
2758
|
-
if (!
|
|
2768
|
+
if (!t.canListInteractions) return;
|
|
2759
2769
|
let c = !1;
|
|
2760
|
-
return
|
|
2770
|
+
return Tt(!0), t.listInteractions().then((y) => {
|
|
2761
2771
|
c || Ke(y ?? []);
|
|
2762
2772
|
}).catch(() => {
|
|
2763
2773
|
c || Ke([]);
|
|
2764
2774
|
}).finally(() => {
|
|
2765
|
-
c ||
|
|
2775
|
+
c || Tt(!1);
|
|
2766
2776
|
}), () => {
|
|
2767
2777
|
c = !0;
|
|
2768
2778
|
};
|
|
2769
|
-
}, [
|
|
2770
|
-
const
|
|
2779
|
+
}, [t]);
|
|
2780
|
+
const Ut = () => E != null && E.length ? E.map((c) => {
|
|
2771
2781
|
let y = c.url;
|
|
2772
2782
|
return oe && y.includes("/chat-id/") && (y.match(/\/chat-id\/[^/]+$/) || (y = `${y}${oe}`)), {
|
|
2773
2783
|
reference: c.label,
|
|
@@ -2775,24 +2785,24 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2775
2785
|
link: y,
|
|
2776
2786
|
icon: c.icon
|
|
2777
2787
|
};
|
|
2778
|
-
}) : [],
|
|
2779
|
-
c.key !== "Enter" && (
|
|
2788
|
+
}) : [], wt = (c) => {
|
|
2789
|
+
c.key !== "Enter" && (ft(Ha), Ue && ke(!1), c.key === "/" && xe.length === 0 && (E != null && E.length) && (je(!0), c.preventDefault())), c.key === "Enter" && !c.shiftKey && (c.preventDefault(), St && ee({ allowDoubleMessage: !0 })), c.key === "Escape" && at && je(!1);
|
|
2780
2790
|
}, Zt = () => {
|
|
2781
2791
|
je(!1), setTimeout(() => {
|
|
2782
2792
|
var c;
|
|
2783
2793
|
(c = B.current) == null || c.focus();
|
|
2784
2794
|
}, 0);
|
|
2785
|
-
}, Ze =
|
|
2795
|
+
}, Ze = $t((c) => {
|
|
2786
2796
|
F(c), setTimeout(() => {
|
|
2787
2797
|
B.current && (B.current.focus(), B.current.selectionStart = B.current.value.length, B.current.selectionEnd = B.current.value.length);
|
|
2788
2798
|
}, 0);
|
|
2789
|
-
}, []), Jt =
|
|
2790
|
-
|
|
2791
|
-
}, [U]), j =
|
|
2799
|
+
}, []), Jt = $t(async () => !t.canSendNotification || !oe ? !1 : t.sendNotification({ chatId: oe }), [oe, t]), Ft = $t(() => {
|
|
2800
|
+
rt(!1), U == null || U();
|
|
2801
|
+
}, [U]), j = $t(
|
|
2792
2802
|
(c, y) => {
|
|
2793
|
-
oe &&
|
|
2803
|
+
oe && t.rateMessage({ rating: c, messageId: y, chatId: oe });
|
|
2794
2804
|
},
|
|
2795
|
-
[oe,
|
|
2805
|
+
[oe, t]
|
|
2796
2806
|
);
|
|
2797
2807
|
return /* @__PURE__ */ S("section", { "aria-label": e ? `Chat Panel: ${e}` : "Chat Panel", className: "chat-panel", children: [
|
|
2798
2808
|
r && Q.length > 0 && /* @__PURE__ */ i("section", { className: "chat-panel__active-chat-header", children: /* @__PURE__ */ i(
|
|
@@ -2806,7 +2816,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2806
2816
|
children: "New"
|
|
2807
2817
|
}
|
|
2808
2818
|
) }),
|
|
2809
|
-
(Q.length > 0 || !a && !
|
|
2819
|
+
(Q.length > 0 || !a && !ct) && /* @__PURE__ */ S(
|
|
2810
2820
|
"div",
|
|
2811
2821
|
{
|
|
2812
2822
|
className: _e("chat-panel__body", {
|
|
@@ -2814,34 +2824,38 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2814
2824
|
}),
|
|
2815
2825
|
children: [
|
|
2816
2826
|
Q.length > 0 && /* @__PURE__ */ S("div", { className: "chat-panel__message-list-wrapper", children: [
|
|
2817
|
-
/* @__PURE__ */ S("ul", { className: "chat-panel-message-list", ref:
|
|
2827
|
+
/* @__PURE__ */ S("ul", { className: "chat-panel-message-list", ref: L, children: [
|
|
2818
2828
|
Q.map((c, y) => {
|
|
2819
|
-
const I = y === Q.length - 1, ce =
|
|
2829
|
+
const I = y === Q.length - 1, ce = Fa(
|
|
2830
|
+
qt,
|
|
2831
|
+
c,
|
|
2832
|
+
I
|
|
2833
|
+
), ye = c.id === yn, fe = I;
|
|
2820
2834
|
return /* @__PURE__ */ i(
|
|
2821
|
-
|
|
2835
|
+
go,
|
|
2822
2836
|
{
|
|
2823
2837
|
id: c.id,
|
|
2824
2838
|
type: c.type,
|
|
2825
2839
|
text: c.text,
|
|
2826
2840
|
chatId: oe,
|
|
2827
|
-
onRate:
|
|
2828
|
-
ratingPopupUrls:
|
|
2841
|
+
onRate: t.canRate ? j : void 0,
|
|
2842
|
+
ratingPopupUrls: t.ratingPopupUrls,
|
|
2829
2843
|
showRating: fe,
|
|
2830
2844
|
followUpPrompts: ce,
|
|
2831
2845
|
onFollowUpPromptClick: Ze,
|
|
2832
|
-
processCanvasReferences:
|
|
2846
|
+
processCanvasReferences: At,
|
|
2833
2847
|
isFallbackMessage: ye,
|
|
2834
2848
|
onRatingPopupOpen: me
|
|
2835
2849
|
},
|
|
2836
2850
|
`${c.id}_${y}`
|
|
2837
2851
|
);
|
|
2838
2852
|
}),
|
|
2839
|
-
|
|
2840
|
-
|
|
2853
|
+
Et && /* @__PURE__ */ i(
|
|
2854
|
+
Do,
|
|
2841
2855
|
{
|
|
2842
|
-
showNotifyLaterButton:
|
|
2856
|
+
showNotifyLaterButton: t.canSendNotification && !!oe,
|
|
2843
2857
|
onNotifyLater: Jt,
|
|
2844
|
-
onNotificationRegisteredGotIt:
|
|
2858
|
+
onNotificationRegisteredGotIt: Ft
|
|
2845
2859
|
}
|
|
2846
2860
|
),
|
|
2847
2861
|
Y && /* @__PURE__ */ i(
|
|
@@ -2856,7 +2870,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2856
2870
|
{
|
|
2857
2871
|
type: "button",
|
|
2858
2872
|
className: "chat-panel__notify-later-btn",
|
|
2859
|
-
onClick:
|
|
2873
|
+
onClick: Ft,
|
|
2860
2874
|
"aria-label": "Got it",
|
|
2861
2875
|
children: "Got it"
|
|
2862
2876
|
}
|
|
@@ -2872,44 +2886,44 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2872
2886
|
Ve
|
|
2873
2887
|
] })
|
|
2874
2888
|
] }),
|
|
2875
|
-
!a && !
|
|
2889
|
+
!a && !ct && /* @__PURE__ */ S(we, { children: [
|
|
2876
2890
|
Q.length === 0 && !P && /* @__PURE__ */ S("div", { className: "chat-panel__chat-intro", children: [
|
|
2877
2891
|
/* @__PURE__ */ S("div", { className: "chat-panel__chat-intro-frame", children: [
|
|
2878
|
-
/* @__PURE__ */ i("span", { className: "chat-panel__chat-intro-icon", children: /* @__PURE__ */ i(
|
|
2892
|
+
/* @__PURE__ */ i("span", { className: "chat-panel__chat-intro-icon", children: /* @__PURE__ */ i(xr, {}) }),
|
|
2879
2893
|
/* @__PURE__ */ i("h3", { className: "chat-panel__chat-intro-heading", children: z })
|
|
2880
2894
|
] }),
|
|
2881
2895
|
/* @__PURE__ */ i("p", { className: "chat-panel__chat-intro-body", children: K })
|
|
2882
2896
|
] }),
|
|
2883
2897
|
/* @__PURE__ */ i("div", { className: "chat-panel__input-container", children: /* @__PURE__ */ S("div", { className: "chat-panel__input-wrapper", ref: re, children: [
|
|
2884
|
-
|
|
2885
|
-
|
|
2898
|
+
at && /* @__PURE__ */ i(
|
|
2899
|
+
lr,
|
|
2886
2900
|
{
|
|
2887
2901
|
anchorRef: re,
|
|
2888
|
-
menuItems:
|
|
2902
|
+
menuItems: Ut(),
|
|
2889
2903
|
onClose: Zt,
|
|
2890
2904
|
onNavigate: q
|
|
2891
2905
|
}
|
|
2892
2906
|
),
|
|
2893
2907
|
/* @__PURE__ */ i(
|
|
2894
|
-
|
|
2908
|
+
ir,
|
|
2895
2909
|
{
|
|
2896
2910
|
ref: B,
|
|
2897
2911
|
value: xe,
|
|
2898
2912
|
onChange: F,
|
|
2899
|
-
onKeyDown:
|
|
2913
|
+
onKeyDown: wt,
|
|
2900
2914
|
placeholder: pe,
|
|
2901
2915
|
onSubmit: () => {
|
|
2902
2916
|
xe.trim() && ee({
|
|
2903
2917
|
allowDoubleMessage: !0
|
|
2904
2918
|
});
|
|
2905
2919
|
},
|
|
2906
|
-
onMicClick:
|
|
2920
|
+
onMicClick: Pt,
|
|
2907
2921
|
onStopClick: () => {
|
|
2908
2922
|
Ue && be();
|
|
2909
2923
|
},
|
|
2910
2924
|
isProcessing: We,
|
|
2911
2925
|
speechEngaged: Ue,
|
|
2912
|
-
showMicButton: !
|
|
2926
|
+
showMicButton: !lt && u && !qe,
|
|
2913
2927
|
ariaLabel: "Chat panel input",
|
|
2914
2928
|
menuContent: k,
|
|
2915
2929
|
onNavigate: q,
|
|
@@ -2922,7 +2936,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2922
2936
|
}
|
|
2923
2937
|
),
|
|
2924
2938
|
Q.length === 0 && /* @__PURE__ */ S(we, { children: [
|
|
2925
|
-
|
|
2939
|
+
lt && /* @__PURE__ */ i("div", { className: "chat-panel__speech-disabled-wrapper", children: qe ? /* @__PURE__ */ S(we, { children: [
|
|
2926
2940
|
" ",
|
|
2927
2941
|
"Speech isn't supported in Firefox. To enable speech, please use Google Chrome."
|
|
2928
2942
|
] }) : /* @__PURE__ */ i(we, { children: " To use speech, please allow Arbor to use your microphone." }) }),
|
|
@@ -2932,7 +2946,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2932
2946
|
{
|
|
2933
2947
|
active: Fe === "getting-started",
|
|
2934
2948
|
tabElementProps: {
|
|
2935
|
-
onClick: () =>
|
|
2949
|
+
onClick: () => st("getting-started")
|
|
2936
2950
|
},
|
|
2937
2951
|
children: "Getting started"
|
|
2938
2952
|
}
|
|
@@ -2942,7 +2956,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2942
2956
|
{
|
|
2943
2957
|
active: Fe === "recent",
|
|
2944
2958
|
tabElementProps: {
|
|
2945
|
-
onClick: () =>
|
|
2959
|
+
onClick: () => st("recent")
|
|
2946
2960
|
},
|
|
2947
2961
|
children: "Recent"
|
|
2948
2962
|
}
|
|
@@ -2951,7 +2965,7 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2951
2965
|
/* @__PURE__ */ S("div", { className: "chat-panel__tab-content", children: [
|
|
2952
2966
|
Fe === "getting-started" && /* @__PURE__ */ S(we, { children: [
|
|
2953
2967
|
G.length > 0 && /* @__PURE__ */ i("div", { className: "chat-panel__sample-prompt-container", children: /* @__PURE__ */ i(
|
|
2954
|
-
|
|
2968
|
+
Fr,
|
|
2955
2969
|
{
|
|
2956
2970
|
onSelectPrompt: (c) => {
|
|
2957
2971
|
ee({
|
|
@@ -2965,8 +2979,8 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2965
2979
|
categories: G
|
|
2966
2980
|
}
|
|
2967
2981
|
) }),
|
|
2968
|
-
(
|
|
2969
|
-
|
|
2982
|
+
(D && D.length > 0 && G.length === 0 || !!(N != null && N.trim())) && /* @__PURE__ */ S("div", { className: "chat-panel__sample-prompt-container", children: [
|
|
2983
|
+
D == null ? void 0 : D.map((c, y) => /* @__PURE__ */ i(
|
|
2970
2984
|
"button",
|
|
2971
2985
|
{
|
|
2972
2986
|
type: "button",
|
|
@@ -2979,13 +2993,13 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2979
2993
|
},
|
|
2980
2994
|
`sample-${y}`
|
|
2981
2995
|
)),
|
|
2982
|
-
|
|
2996
|
+
N && /* @__PURE__ */ i(
|
|
2983
2997
|
"button",
|
|
2984
2998
|
{
|
|
2985
2999
|
type: "button",
|
|
2986
3000
|
className: "chat-panel__daily-prompt",
|
|
2987
3001
|
onClick: () => ee({
|
|
2988
|
-
prompt:
|
|
3002
|
+
prompt: N,
|
|
2989
3003
|
allowDoubleMessage: !0
|
|
2990
3004
|
}),
|
|
2991
3005
|
children: /* @__PURE__ */ S("span", { children: [
|
|
@@ -2993,70 +3007,100 @@ const wa = 55e3, yn = "fallback", Na = async ({
|
|
|
2993
3007
|
" ",
|
|
2994
3008
|
/* @__PURE__ */ i("strong", { children: "Daily Prompt:" }),
|
|
2995
3009
|
/* @__PURE__ */ i("br", {}),
|
|
2996
|
-
|
|
3010
|
+
N
|
|
2997
3011
|
] })
|
|
2998
3012
|
},
|
|
2999
3013
|
"daily-prompt"
|
|
3000
3014
|
)
|
|
3001
3015
|
] })
|
|
3002
3016
|
] }),
|
|
3003
|
-
Fe === "recent" && /* @__PURE__ */ i("div", { className: "chat-panel__tab-panel--recent", children:
|
|
3004
|
-
|
|
3017
|
+
Fe === "recent" && /* @__PURE__ */ i("div", { className: "chat-panel__tab-panel--recent", children: it ? /* @__PURE__ */ i("div", { className: "chat-panel__ai-interactions-loading", children: "Loading..." }) : De.length === 0 ? /* @__PURE__ */ i("div", { className: "chat-panel__ai-interactions-empty", children: "No previous chats found." }) : /* @__PURE__ */ i(
|
|
3018
|
+
Rr,
|
|
3005
3019
|
{
|
|
3006
3020
|
wrapperClassName: "chat-panel__ai-interactions-table",
|
|
3007
3021
|
hasSearch: !1,
|
|
3008
3022
|
tableTheme: "tidy",
|
|
3009
3023
|
domLayout: "autoHeight",
|
|
3010
3024
|
rowData: De,
|
|
3011
|
-
columnDefs:
|
|
3012
|
-
defaultColDef:
|
|
3025
|
+
columnDefs: xa,
|
|
3026
|
+
defaultColDef: Pa,
|
|
3013
3027
|
getRowId: ({ data: c }) => c.id,
|
|
3014
3028
|
onRowClicked: ({ data: c }) => {
|
|
3015
|
-
!c || !
|
|
3029
|
+
!c || !t.canLoadHistory || (gt(c.chatId), Xe(c.chatId));
|
|
3016
3030
|
}
|
|
3017
3031
|
}
|
|
3018
3032
|
) })
|
|
3019
3033
|
] })
|
|
3020
3034
|
] }),
|
|
3021
|
-
|
|
3035
|
+
ct && /* @__PURE__ */ i("div", { className: "chat-panel-footer", children: "You've reached the maximum number of messages for this conversation" })
|
|
3022
3036
|
] });
|
|
3023
3037
|
};
|
|
3024
|
-
|
|
3038
|
+
class ja {
|
|
3039
|
+
constructor() {
|
|
3040
|
+
Ln(this, "events");
|
|
3041
|
+
this.events = {};
|
|
3042
|
+
}
|
|
3043
|
+
subscribe(t, r) {
|
|
3044
|
+
const a = crypto.randomUUID();
|
|
3045
|
+
return this.events[t] = this.events[t] ?? {}, this.events[t][a] = r, a;
|
|
3046
|
+
}
|
|
3047
|
+
unsubscribe(t, r) {
|
|
3048
|
+
typeof this.events[t] < "u" && delete this.events[t][r];
|
|
3049
|
+
}
|
|
3050
|
+
publish(t, r) {
|
|
3051
|
+
this.events[t] && Object.keys(this.events[t]).forEach((a) => {
|
|
3052
|
+
const l = this.events[t][a];
|
|
3053
|
+
l == null || l(r);
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
const er = new ja();
|
|
3058
|
+
function as({ isOpen: e, ...t }) {
|
|
3059
|
+
const { onClose: r } = t;
|
|
3060
|
+
return V(() => {
|
|
3061
|
+
const a = er.subscribe("ds-remove-slideover", () => r == null ? void 0 : r());
|
|
3062
|
+
return () => er.unsubscribe("ds-remove-slideover", a);
|
|
3063
|
+
}, [r]), e ? rr(
|
|
3064
|
+
/* @__PURE__ */ i(Ir, { children: /* @__PURE__ */ i("div", { className: "ask-arbor-widget__panel", children: /* @__PURE__ */ i(Ya, { ...t, focusDelay: 200 }) }) }),
|
|
3065
|
+
document.body
|
|
3066
|
+
) : null;
|
|
3067
|
+
}
|
|
3068
|
+
function Ka(e) {
|
|
3025
3069
|
switch (e.toLowerCase()) {
|
|
3026
3070
|
case bn:
|
|
3027
|
-
return
|
|
3028
|
-
case
|
|
3029
|
-
return
|
|
3071
|
+
return _t;
|
|
3072
|
+
case wa:
|
|
3073
|
+
return Lt;
|
|
3030
3074
|
default:
|
|
3031
3075
|
return null;
|
|
3032
3076
|
}
|
|
3033
3077
|
}
|
|
3034
|
-
function
|
|
3035
|
-
const
|
|
3078
|
+
function Va(e) {
|
|
3079
|
+
const t = [];
|
|
3036
3080
|
for (const r of e.messages ?? []) {
|
|
3037
|
-
const a =
|
|
3038
|
-
!a || !r.content ||
|
|
3081
|
+
const a = Ka(r.role);
|
|
3082
|
+
!a || !r.content || t.push({
|
|
3039
3083
|
id: r.message_id,
|
|
3040
3084
|
type: a,
|
|
3041
3085
|
text: r.content
|
|
3042
3086
|
});
|
|
3043
3087
|
}
|
|
3044
|
-
return { chatItems:
|
|
3088
|
+
return { chatItems: t, followUpPrompts: [] };
|
|
3045
3089
|
}
|
|
3046
|
-
const
|
|
3090
|
+
const qa = async (e, t) => {
|
|
3047
3091
|
try {
|
|
3048
|
-
const r = await
|
|
3049
|
-
if (
|
|
3050
|
-
return
|
|
3092
|
+
const r = await mr(e, void 0, void 0, t);
|
|
3093
|
+
if (hr(e) && Array.isArray(r == null ? void 0 : r.messages))
|
|
3094
|
+
return Va(r);
|
|
3051
3095
|
if (!(r != null && r.items))
|
|
3052
3096
|
return console.error("Invalid response in getHistoricMessages", e, r), { chatItems: [], followUpPrompts: [] };
|
|
3053
3097
|
let a = [], l = [];
|
|
3054
3098
|
return r.items.forEach((s) => {
|
|
3055
3099
|
if ("chatItems" in s)
|
|
3056
3100
|
a = s.chatItems.map(
|
|
3057
|
-
({ id: u, type: m, text: h, content:
|
|
3101
|
+
({ id: u, type: m, text: h, content: f, ...T }) => {
|
|
3058
3102
|
const A = h != null && h !== "" ? h : gn(
|
|
3059
|
-
typeof
|
|
3103
|
+
typeof f == "string" ? f : ""
|
|
3060
3104
|
);
|
|
3061
3105
|
return {
|
|
3062
3106
|
id: u,
|
|
@@ -3082,43 +3126,43 @@ const Ua = async (e, n) => {
|
|
|
3082
3126
|
} catch (r) {
|
|
3083
3127
|
return console.error("Error in getHistoricMessages", r, e), { chatItems: [], followUpPrompts: [] };
|
|
3084
3128
|
}
|
|
3085
|
-
},
|
|
3129
|
+
}, Xa = async ({
|
|
3086
3130
|
rating: e,
|
|
3087
|
-
messageId:
|
|
3131
|
+
messageId: t,
|
|
3088
3132
|
chatId: r,
|
|
3089
3133
|
ratingUrl: a,
|
|
3090
3134
|
authorizationToken: l
|
|
3091
3135
|
}) => {
|
|
3092
3136
|
try {
|
|
3093
|
-
await An(a, { messageId:
|
|
3137
|
+
await An(a, { messageId: t, rating: e, chatId: r }, { authorizationToken: l });
|
|
3094
3138
|
} catch (s) {
|
|
3095
3139
|
console.error("Error rating message", s);
|
|
3096
3140
|
}
|
|
3097
|
-
},
|
|
3141
|
+
}, Za = async ({
|
|
3098
3142
|
chatId: e,
|
|
3099
|
-
notificationCallbackUrl:
|
|
3143
|
+
notificationCallbackUrl: t,
|
|
3100
3144
|
authorizationToken: r
|
|
3101
3145
|
}) => {
|
|
3102
3146
|
try {
|
|
3103
|
-
return await An(
|
|
3147
|
+
return await An(t, { chatId: e }, { authorizationToken: r }), !0;
|
|
3104
3148
|
} catch (a) {
|
|
3105
3149
|
return console.error("Error sending notification", a), !1;
|
|
3106
3150
|
}
|
|
3107
3151
|
};
|
|
3108
|
-
function
|
|
3109
|
-
return (e.conversations ?? []).map((
|
|
3152
|
+
function Ja(e) {
|
|
3153
|
+
return (e.conversations ?? []).map((t) => {
|
|
3110
3154
|
var r, a;
|
|
3111
3155
|
return {
|
|
3112
|
-
id:
|
|
3113
|
-
chatId:
|
|
3114
|
-
title: ((r =
|
|
3115
|
-
updatedAt:
|
|
3156
|
+
id: t.session_id,
|
|
3157
|
+
chatId: t.session_id,
|
|
3158
|
+
title: ((r = t.title) == null ? void 0 : r.trim()) || ((a = t.preview) == null ? void 0 : a.trim()) || "Untitled conversation",
|
|
3159
|
+
updatedAt: t.updated_at ?? t.created_at ?? ""
|
|
3116
3160
|
};
|
|
3117
3161
|
});
|
|
3118
3162
|
}
|
|
3119
|
-
class
|
|
3120
|
-
constructor(
|
|
3121
|
-
this.config =
|
|
3163
|
+
class Qa {
|
|
3164
|
+
constructor(t) {
|
|
3165
|
+
this.config = t;
|
|
3122
3166
|
}
|
|
3123
3167
|
get canRate() {
|
|
3124
3168
|
return !!this.config.ratingUrl;
|
|
@@ -3138,60 +3182,60 @@ class Ga {
|
|
|
3138
3182
|
down: this.config.downRatingPopupUrl
|
|
3139
3183
|
};
|
|
3140
3184
|
}
|
|
3141
|
-
async sendMessage(
|
|
3142
|
-
return
|
|
3185
|
+
async sendMessage(t) {
|
|
3186
|
+
return Da({
|
|
3143
3187
|
chatUrl: this.config.chatUrl,
|
|
3144
3188
|
authorizationToken: this.config.authorizationToken,
|
|
3145
3189
|
agentCompletionsConfig: this.config.agentCompletionsConfig,
|
|
3146
|
-
...
|
|
3190
|
+
...t
|
|
3147
3191
|
});
|
|
3148
3192
|
}
|
|
3149
|
-
async loadHistory(
|
|
3150
|
-
return this.config.historicChatUrl ?
|
|
3151
|
-
`${this.config.historicChatUrl}/${
|
|
3193
|
+
async loadHistory(t) {
|
|
3194
|
+
return this.config.historicChatUrl ? qa(
|
|
3195
|
+
`${this.config.historicChatUrl}/${t}`,
|
|
3152
3196
|
this.config.authorizationToken
|
|
3153
3197
|
) : null;
|
|
3154
3198
|
}
|
|
3155
3199
|
async listInteractions() {
|
|
3156
3200
|
if (!this.config.aiInteractionsUrl) return null;
|
|
3157
3201
|
try {
|
|
3158
|
-
const
|
|
3202
|
+
const t = await mr(
|
|
3159
3203
|
this.config.aiInteractionsUrl,
|
|
3160
3204
|
void 0,
|
|
3161
3205
|
void 0,
|
|
3162
3206
|
this.config.authorizationToken
|
|
3163
3207
|
);
|
|
3164
|
-
return
|
|
3165
|
-
|
|
3166
|
-
) : Array.isArray(
|
|
3208
|
+
return hr(this.config.aiInteractionsUrl) && Array.isArray(t.conversations) ? Ja(
|
|
3209
|
+
t
|
|
3210
|
+
) : Array.isArray(t) ? t : Array.isArray(t.items) ? t.items : [];
|
|
3167
3211
|
} catch {
|
|
3168
3212
|
return null;
|
|
3169
3213
|
}
|
|
3170
3214
|
}
|
|
3171
|
-
async rateMessage(
|
|
3172
|
-
this.config.ratingUrl && await
|
|
3215
|
+
async rateMessage(t) {
|
|
3216
|
+
this.config.ratingUrl && await Xa({
|
|
3173
3217
|
ratingUrl: this.config.ratingUrl,
|
|
3174
3218
|
authorizationToken: this.config.authorizationToken,
|
|
3175
|
-
...
|
|
3219
|
+
...t
|
|
3176
3220
|
});
|
|
3177
3221
|
}
|
|
3178
|
-
async sendNotification(
|
|
3179
|
-
return this.config.notificationCallbackUrl ?
|
|
3222
|
+
async sendNotification(t) {
|
|
3223
|
+
return this.config.notificationCallbackUrl ? Za({
|
|
3180
3224
|
notificationCallbackUrl: this.config.notificationCallbackUrl,
|
|
3181
3225
|
authorizationToken: this.config.authorizationToken,
|
|
3182
|
-
...
|
|
3226
|
+
...t
|
|
3183
3227
|
}) : !1;
|
|
3184
3228
|
}
|
|
3185
3229
|
}
|
|
3186
|
-
const
|
|
3230
|
+
const ss = {
|
|
3187
3231
|
create(e) {
|
|
3188
|
-
const
|
|
3232
|
+
const t = e.model || e.agentName || e.systemPrompt || e.mcps ? {
|
|
3189
3233
|
...e.model && { model: e.model },
|
|
3190
3234
|
...e.agentName && { agentName: e.agentName },
|
|
3191
3235
|
...e.systemPrompt && { systemPrompt: e.systemPrompt },
|
|
3192
3236
|
...e.mcps && { mcps: e.mcps }
|
|
3193
3237
|
} : void 0;
|
|
3194
|
-
return new
|
|
3238
|
+
return new Qa({
|
|
3195
3239
|
chatUrl: e.chatUrl,
|
|
3196
3240
|
authorizationToken: e.authorizationToken ?? void 0,
|
|
3197
3241
|
historicChatUrl: e.historicChatUrl ?? void 0,
|
|
@@ -3200,17 +3244,20 @@ const Ka = {
|
|
|
3200
3244
|
upRatingPopupUrl: e.upRatingPopupUrl ?? void 0,
|
|
3201
3245
|
downRatingPopupUrl: e.downRatingPopupUrl ?? void 0,
|
|
3202
3246
|
notificationCallbackUrl: e.notificationCallbackUrl ?? void 0,
|
|
3203
|
-
agentCompletionsConfig:
|
|
3247
|
+
agentCompletionsConfig: t
|
|
3204
3248
|
});
|
|
3205
3249
|
}
|
|
3206
3250
|
};
|
|
3207
3251
|
export {
|
|
3208
|
-
|
|
3209
|
-
|
|
3252
|
+
ss as AIServiceConnectorFactory,
|
|
3253
|
+
as as AskArborSlideover,
|
|
3254
|
+
Ya as AskArborWidget,
|
|
3255
|
+
Lt as CHAT_RESPONSE_TYPE_AGENT,
|
|
3210
3256
|
ve as CHAT_RESPONSE_TYPE_ERROR,
|
|
3211
3257
|
mn as CHAT_RESPONSE_TYPE_INFO,
|
|
3212
|
-
|
|
3258
|
+
_t as CHAT_RESPONSE_TYPE_USER,
|
|
3213
3259
|
Kt as CHAT_RESPONSE_TYPE_WARNING,
|
|
3214
|
-
|
|
3215
|
-
|
|
3260
|
+
Ya as ChatPanel,
|
|
3261
|
+
_o as FollowUpPromptButton,
|
|
3262
|
+
Qa as HttpAIServiceConnector
|
|
3216
3263
|
};
|