@aintela/chat 0.4.31 → 0.4.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +2898 -2879
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +3 -2
- package/dist/index.js +86 -84
- package/dist/index.js.map +1 -1
- package/dist/{predictionRows-Cn0gzEx3.js → predictionRows-CZORCShm.js} +326 -380
- package/dist/predictionRows-CZORCShm.js.map +1 -0
- package/dist/promptTriggers-xwMJ5gRj.js +90 -0
- package/dist/promptTriggers-xwMJ5gRj.js.map +1 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/useStickyHighlight.d.ts +15 -0
- package/dist/src/hooks/useStickyHighlight.test.d.ts +1 -0
- package/dist/src/utils/atMentions.d.ts +29 -1
- package/dist/useContainerWidth-hY7QntU9.js +409 -0
- package/dist/useContainerWidth-hY7QntU9.js.map +1 -0
- package/dist/utils.js +37 -36
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/predictionRows-Cn0gzEx3.js.map +0 -1
- package/dist/useContainerWidth-C33sJaCi.js +0 -383
- package/dist/useContainerWidth-C33sJaCi.js.map +0 -1
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (
|
|
4
|
-
var
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
8
|
-
const a =
|
|
9
|
-
switch (
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var O = (n, e, t) => e in n ? N(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var d = (n, e) => N(n, "name", { value: e, configurable: !0 });
|
|
4
|
+
var W = (n, e, t) => O(n, typeof e != "symbol" ? e + "" : e, t);
|
|
5
|
+
const R = /^[a-z][a-z0-9+.-]*:\/\//i, U = /* @__PURE__ */ d((n, e, t) => {
|
|
6
|
+
let o = "URL", r = null, i = null, s = null;
|
|
7
|
+
if (n[0] == "#") {
|
|
8
|
+
const a = n.indexOf("-"), l = n.slice(1, a);
|
|
9
|
+
switch (s = n.slice(a + 1), l.toLowerCase()) {
|
|
10
10
|
case "opendashboard":
|
|
11
|
-
|
|
11
|
+
o = "OpenDashboard";
|
|
12
12
|
break;
|
|
13
13
|
case "ask":
|
|
14
|
-
|
|
14
|
+
o = "Question", r = t;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
|
-
} else
|
|
18
|
-
return { action:
|
|
19
|
-
}, "extractLinkAction"),
|
|
20
|
-
{ length: Math.ceil(
|
|
21
|
-
(t,
|
|
22
|
-
), "chunkArray"),
|
|
23
|
-
|
|
17
|
+
} else R.test(n) ? (o = "URL", i = n) : n[0] === "/" ? (o = "Navigate", i = n) : (n = n.replaceAll("exported/", `exported/${e}/`), o = "Export");
|
|
18
|
+
return { action: o, url: i, question: r, parameter: s };
|
|
19
|
+
}, "extractLinkAction"), H = /* @__PURE__ */ d((n, e) => Array.from(
|
|
20
|
+
{ length: Math.ceil(n.length / e) },
|
|
21
|
+
(t, o) => n.slice(o * e, o * e + e)
|
|
22
|
+
), "chunkArray"), X = /* @__PURE__ */ d((n) => {
|
|
23
|
+
n = n.replaceAll("\\n", `
|
|
24
24
|
`);
|
|
25
|
-
const e = 90, t =
|
|
26
|
-
let
|
|
25
|
+
const e = 90, t = n.split(" "), o = [];
|
|
26
|
+
let r = !1;
|
|
27
27
|
for (const i of t)
|
|
28
28
|
if (i.length > e) {
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
r = !0;
|
|
30
|
+
const s = [...i], l = H(s, e).map((c) => c.join("")).join(`
|
|
31
31
|
`);
|
|
32
|
-
|
|
32
|
+
o.push(l);
|
|
33
33
|
} else
|
|
34
|
-
|
|
35
|
-
return
|
|
34
|
+
o.push(i);
|
|
35
|
+
return r ? o.join(" ") : n;
|
|
36
36
|
}, "splitBigLinesWithSpaces");
|
|
37
|
-
function
|
|
38
|
-
let e = parseFloat(
|
|
37
|
+
function z(n) {
|
|
38
|
+
let e = parseFloat(n);
|
|
39
39
|
if (!isNaN(e))
|
|
40
|
-
return
|
|
40
|
+
return n = n.replaceAll(/[,\.]/g, ""), parseInt(n);
|
|
41
41
|
var t = "";
|
|
42
|
-
for (const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
return e = parseInt(t), !isNaN(e) &&
|
|
42
|
+
for (const r of n)
|
|
43
|
+
r.match(/[0-9]/) && (t += r);
|
|
44
|
+
const o = t.length / n.length;
|
|
45
|
+
return e = parseInt(t), !isNaN(e) && o > 0.5 ? e : NaN;
|
|
46
46
|
}
|
|
47
|
-
d(
|
|
48
|
-
const
|
|
49
|
-
function
|
|
50
|
-
if (!
|
|
47
|
+
d(z, "parseRawNumber");
|
|
48
|
+
const _ = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, F = /^[0-9a-f]{32}/i;
|
|
49
|
+
function G(n) {
|
|
50
|
+
if (!n || typeof n != "string")
|
|
51
51
|
return !1;
|
|
52
|
-
const e =
|
|
53
|
-
return e === null ? !1 :
|
|
52
|
+
const e = B(n);
|
|
53
|
+
return e === null ? !1 : n.startsWith(e);
|
|
54
54
|
}
|
|
55
|
-
d(
|
|
56
|
-
function
|
|
57
|
-
if (!
|
|
55
|
+
d(G, "startsWithInteractionId");
|
|
56
|
+
function B(n) {
|
|
57
|
+
if (!n || typeof n != "string")
|
|
58
58
|
return null;
|
|
59
|
-
const e =
|
|
59
|
+
const e = n.match(_);
|
|
60
60
|
if (e)
|
|
61
61
|
return e[0];
|
|
62
|
-
const t =
|
|
62
|
+
const t = n.match(F);
|
|
63
63
|
return t ? t[0] : null;
|
|
64
64
|
}
|
|
65
|
-
d(
|
|
66
|
-
function
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
-
const e =
|
|
65
|
+
d(B, "extractInteractionId");
|
|
66
|
+
function j(n) {
|
|
67
|
+
if (n.length == 0)
|
|
68
|
+
return n;
|
|
69
|
+
const e = n.replaceAll("_", " ").replaceAll("-", " ");
|
|
70
70
|
return e[0].toUpperCase() + e.slice(1);
|
|
71
71
|
}
|
|
72
|
-
d(
|
|
73
|
-
function
|
|
74
|
-
return !
|
|
72
|
+
d(j, "prettiffyPythonFunctionName");
|
|
73
|
+
function K(n) {
|
|
74
|
+
return !n || typeof n != "string" ? !1 : !!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n) || /^[0-9a-f]{32}$/i.test(n));
|
|
75
75
|
}
|
|
76
|
-
d(
|
|
77
|
-
const
|
|
76
|
+
d(K, "isValidInteractionId");
|
|
77
|
+
const $ = /* @__PURE__ */ new Set(), C = class C {
|
|
78
78
|
constructor(e = {}) {
|
|
79
79
|
this.options = {
|
|
80
80
|
// CSS class for sortable headers
|
|
@@ -157,8 +157,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
157
157
|
* @param {HTMLElement} container - Optional container element to limit search scope
|
|
158
158
|
*/
|
|
159
159
|
scanTables(e = null) {
|
|
160
|
-
const
|
|
161
|
-
this.tables = Array.from(
|
|
160
|
+
const o = (e || document).querySelectorAll("table");
|
|
161
|
+
this.tables = Array.from(o);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Make all found tables sortable
|
|
@@ -172,20 +172,20 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
172
172
|
* Make a specific table sortable
|
|
173
173
|
*/
|
|
174
174
|
makeTableSortable(e, t) {
|
|
175
|
-
let
|
|
176
|
-
if (
|
|
175
|
+
let o = e.querySelector("thead"), r = null, i = [];
|
|
176
|
+
if (o && (r = o.querySelector("tr"), r && (i = r.querySelectorAll("th"))), i.length === 0) {
|
|
177
177
|
console.warn("Table has no sortable columns, skipping");
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
e.classList.add("sortable-table"),
|
|
180
|
+
const s = !e.hasAttribute("data-sortable-arrived");
|
|
181
|
+
e.classList.add("sortable-table"), s && (e.setAttribute("data-sortable-arrived", "true"), e.classList.add("sortable-table-arriving"), setTimeout(() => {
|
|
182
182
|
e.classList.remove("sortable-table-arriving");
|
|
183
183
|
}, 400)), this.sortStates.set(t, {
|
|
184
184
|
currentColumn: -1,
|
|
185
185
|
direction: "none"
|
|
186
186
|
}), e.hasAttribute("data-original-width") || e.setAttribute("data-original-width", e.getBoundingClientRect().width), this.applyTableStyles(e), this.originalColumnOrder.set(t, Array.from(i).map((a, l) => l)), i.forEach((a, l) => {
|
|
187
187
|
this.options.excludeColumns.includes(l) || this.makeHeaderSortable(a, e, t, l);
|
|
188
|
-
}), this.replaceExponentialValues(e),
|
|
188
|
+
}), this.replaceExponentialValues(e), $.add(e);
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* Replace exponential values in table cells with full numbers
|
|
@@ -194,12 +194,12 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
194
194
|
replaceExponentialValues(e) {
|
|
195
195
|
const t = e.querySelector("tbody");
|
|
196
196
|
if (!t) return;
|
|
197
|
-
t.querySelectorAll("tr").forEach((
|
|
198
|
-
|
|
199
|
-
const l =
|
|
197
|
+
t.querySelectorAll("tr").forEach((r) => {
|
|
198
|
+
r.querySelectorAll("td, th").forEach((s) => {
|
|
199
|
+
const l = s.textContent.trim().match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
|
|
200
200
|
if (l) {
|
|
201
201
|
const c = parseFloat(l[1].replace(/,/g, "")), u = parseInt(l[2]), p = c * Math.pow(10, u), h = this.formatNumber(p);
|
|
202
|
-
|
|
202
|
+
s.textContent = h;
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
});
|
|
@@ -219,32 +219,32 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
219
219
|
* @param {HTMLElement} tbody - The tbody element to remove from
|
|
220
220
|
* @returns {HTMLElement} The converted header row
|
|
221
221
|
*/
|
|
222
|
-
convertRowToHeader(e, t,
|
|
222
|
+
convertRowToHeader(e, t, o) {
|
|
223
223
|
try {
|
|
224
|
-
const
|
|
225
|
-
return
|
|
224
|
+
const r = e.cloneNode(!0);
|
|
225
|
+
return r.querySelectorAll("td").forEach((s) => {
|
|
226
226
|
const a = document.createElement("th");
|
|
227
|
-
Array.from(
|
|
227
|
+
Array.from(s.attributes).forEach((l) => {
|
|
228
228
|
a.setAttribute(l.name, l.value);
|
|
229
|
-
}), a.innerHTML =
|
|
230
|
-
}),
|
|
231
|
-
} catch (
|
|
232
|
-
return console.error("Error converting row to header:",
|
|
229
|
+
}), a.innerHTML = s.innerHTML, a.style.cssText = s.style.cssText, s.parentNode.replaceChild(a, s);
|
|
230
|
+
}), o && o.contains(e) ? o.removeChild(e) : e.parentNode && e.parentNode.removeChild(e), t.appendChild(r), r;
|
|
231
|
+
} catch (r) {
|
|
232
|
+
return console.error("Error converting row to header:", r), null;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
236
236
|
* Make a specific header sortable
|
|
237
237
|
*/
|
|
238
|
-
makeHeaderSortable(e, t,
|
|
239
|
-
e.classList.add(this.options.sortableClass), e.style.cursor = "pointer", (!this.options.preserveExistingIcons || !e.querySelector(".material-icons")) && this.addSortIcon(e), this.options.enableResizing && this.addResizing(e, t,
|
|
238
|
+
makeHeaderSortable(e, t, o, r) {
|
|
239
|
+
e.classList.add(this.options.sortableClass), e.style.cursor = "pointer", (!this.options.preserveExistingIcons || !e.querySelector(".material-icons")) && this.addSortIcon(e), this.options.enableResizing && this.addResizing(e, t, o, r), this.options.enableReordering && this.addDragAndDrop(e, t, o, r);
|
|
240
240
|
const i = /* @__PURE__ */ d((l) => {
|
|
241
|
-
l.preventDefault(), this.sortTable(t,
|
|
242
|
-
}, "clickListener"),
|
|
241
|
+
l.preventDefault(), this.sortTable(t, o, r);
|
|
242
|
+
}, "clickListener"), s = /* @__PURE__ */ d((l) => {
|
|
243
243
|
e.classList.contains(this.options.activeSortClass) || (e.style.background = this.options.theme.palette.surface.hover);
|
|
244
244
|
}, "mouseEnterListener"), a = /* @__PURE__ */ d((l) => {
|
|
245
245
|
e.classList.contains(this.options.activeSortClass) || (e.style.background = "");
|
|
246
246
|
}, "mouseLeaveListener");
|
|
247
|
-
e.removeEventListener("click", i), e.addEventListener("click", i), e.removeEventListener("mouseenter",
|
|
247
|
+
e.removeEventListener("click", i), e.addEventListener("click", i), e.removeEventListener("mouseenter", s), e.addEventListener("mouseenter", s), e.removeEventListener("mouseleave", a), e.addEventListener("mouseleave", a);
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
250
250
|
* Add sort icon to header
|
|
@@ -262,55 +262,55 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
262
262
|
/**
|
|
263
263
|
* Sort table by column
|
|
264
264
|
*/
|
|
265
|
-
sortTable(e, t,
|
|
266
|
-
const
|
|
267
|
-
if (!
|
|
265
|
+
sortTable(e, t, o) {
|
|
266
|
+
const r = e.querySelector("tbody");
|
|
267
|
+
if (!r) {
|
|
268
268
|
console.warn("Table has no tbody element");
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
|
-
const i = Array.from(
|
|
271
|
+
const i = Array.from(r.querySelectorAll("tr"));
|
|
272
272
|
if (i.length === 0) {
|
|
273
273
|
console.warn("Table has no data rows");
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
const
|
|
277
|
-
e.querySelector(`thead tr th:nth-child(${
|
|
276
|
+
const s = this.sortStates.get(t);
|
|
277
|
+
e.querySelector(`thead tr th:nth-child(${o + 1})`);
|
|
278
278
|
let a;
|
|
279
|
-
if (this.options.sortOnFirstClick ? a =
|
|
279
|
+
if (this.options.sortOnFirstClick ? a = s.currentColumn === o && s.direction === "asc" ? "desc" : "asc" : s.currentColumn !== o ? a = "asc" : a = s.direction === "none" ? "asc" : s.direction === "asc" ? "desc" : "none", s.currentColumn = o, s.direction = a, this.sortStates.set(t, s), this.updateSortIndicators(e, t, o, a), a === "none") {
|
|
280
280
|
this.restoreOriginalOrder(e, i);
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
|
-
this.sortRows(i,
|
|
283
|
+
this.sortRows(i, o, a).forEach((c) => r.appendChild(c));
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
286
286
|
* Sort rows based on column data
|
|
287
287
|
*/
|
|
288
|
-
sortRows(e, t,
|
|
289
|
-
return e.sort((
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
const l = this.extractValue(
|
|
288
|
+
sortRows(e, t, o) {
|
|
289
|
+
return e.sort((r, i) => {
|
|
290
|
+
const s = r.cells[t], a = i.cells[t];
|
|
291
|
+
if (!s || !a) return 0;
|
|
292
|
+
const l = this.extractValue(s), c = this.extractValue(a);
|
|
293
293
|
if (this.options.customSorters[t])
|
|
294
|
-
return this.options.customSorters[t](l, c,
|
|
294
|
+
return this.options.customSorters[t](l, c, o);
|
|
295
295
|
const u = this.compareValues(l, c);
|
|
296
|
-
return
|
|
296
|
+
return o === "asc" ? u : -u;
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
300
|
* Extract sortable value from cell
|
|
301
301
|
*/
|
|
302
302
|
extractValue(e) {
|
|
303
|
-
let t = e.textContent.trim(),
|
|
304
|
-
if (!isNaN(
|
|
305
|
-
return console.log(
|
|
303
|
+
let t = e.textContent.trim(), o = z(t);
|
|
304
|
+
if (!isNaN(o))
|
|
305
|
+
return console.log(o), o;
|
|
306
306
|
if (t = t.replace(/arrow_upward|arrow_downward|remove|keyboard_arrow_up|keyboard_arrow_down|unfold_more|expand_more|expand_less|trending_up|trending_down|↗|↘|↑|↓|→|←/g, "").trim(), /^(N\/A|N\/D|ND|N\/A|n\/a|n\/d|nd|N\/A|N\/D|ND|\s*)$/i.test(t))
|
|
307
307
|
return -1;
|
|
308
308
|
const i = t.match(/^([\d,]+\.?\d*)\s*%$/);
|
|
309
309
|
if (i)
|
|
310
310
|
return parseFloat(i[1].replace(/,/g, ""));
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
313
|
-
const u = parseFloat(
|
|
311
|
+
const s = t.match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
|
|
312
|
+
if (s) {
|
|
313
|
+
const u = parseFloat(s[1].replace(/,/g, "")), p = parseInt(s[2]);
|
|
314
314
|
return u * Math.pow(10, p);
|
|
315
315
|
}
|
|
316
316
|
if (t.match(/^[\d,]+\.?\d*[KMB]?$/))
|
|
@@ -330,30 +330,30 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
330
330
|
/**
|
|
331
331
|
* Update visual indicators for sort state
|
|
332
332
|
*/
|
|
333
|
-
updateSortIndicators(e, t,
|
|
333
|
+
updateSortIndicators(e, t, o, r) {
|
|
334
334
|
const i = e.querySelectorAll("thead tr th");
|
|
335
|
-
if (i.forEach((
|
|
336
|
-
|
|
337
|
-
const l =
|
|
335
|
+
if (i.forEach((s, a) => {
|
|
336
|
+
s.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);
|
|
337
|
+
const l = s.querySelector(".material-icons");
|
|
338
338
|
l && (l.textContent = this.options.unsortedIcon, l.style.opacity = "0.6");
|
|
339
|
-
}),
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
const a =
|
|
343
|
-
a && (
|
|
339
|
+
}), r !== "none") {
|
|
340
|
+
const s = i[o];
|
|
341
|
+
s.classList.add(this.options.activeSortClass);
|
|
342
|
+
const a = s.querySelector(".material-icons");
|
|
343
|
+
a && (r === "asc" ? (s.classList.add(this.options.ascendingClass), a.textContent = this.options.ascendingIcon) : (s.classList.add(this.options.descendingClass), a.textContent = this.options.descendingIcon), a.style.opacity = "1");
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
/**
|
|
347
347
|
* Restore original order (when sort direction is 'none')
|
|
348
348
|
*/
|
|
349
349
|
restoreOriginalOrder(e, t) {
|
|
350
|
-
const
|
|
351
|
-
t.forEach((
|
|
350
|
+
const o = e.querySelector("tbody");
|
|
351
|
+
t.forEach((r) => o.appendChild(r));
|
|
352
352
|
}
|
|
353
353
|
/**
|
|
354
354
|
* Add resizing functionality to a header
|
|
355
355
|
*/
|
|
356
|
-
addResizing(e, t,
|
|
356
|
+
addResizing(e, t, o, r) {
|
|
357
357
|
if (e.classList.add(this.options.resizableClass), e.style.position = "relative", e.querySelector(".resize-handle"))
|
|
358
358
|
return;
|
|
359
359
|
const i = document.createElement("div");
|
|
@@ -367,57 +367,57 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
367
367
|
cursor: col-resize;
|
|
368
368
|
z-index: 10;
|
|
369
369
|
`, e.appendChild(i);
|
|
370
|
-
let
|
|
370
|
+
let s = !1, a = 0, l = 0;
|
|
371
371
|
i.addEventListener("mousedown", (p) => {
|
|
372
|
-
p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(),
|
|
372
|
+
p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(), s = !0, a = p.clientX, l = e.offsetWidth, e.style.borderRight = "2px solid var(--primary-main, #2196F3)", e.style.background = "var(--background-active, rgba(255, 255, 255, 0.1))", document.addEventListener("mousemove", c), document.addEventListener("mouseup", u), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
373
373
|
});
|
|
374
374
|
const c = /* @__PURE__ */ d((p) => {
|
|
375
|
-
if (!
|
|
375
|
+
if (!s) return;
|
|
376
376
|
const h = l + (p.clientX - a);
|
|
377
377
|
if (h > 30) {
|
|
378
378
|
e.style.width = h + "px";
|
|
379
|
-
const f = Array.from(e.parentNode.children).indexOf(e),
|
|
380
|
-
|
|
381
|
-
const b =
|
|
379
|
+
const f = Array.from(e.parentNode.children).indexOf(e), m = t.querySelector("tbody");
|
|
380
|
+
m && m.querySelectorAll("tr").forEach((v) => {
|
|
381
|
+
const b = v.children[f];
|
|
382
382
|
b && (b.style.width = h + "px");
|
|
383
383
|
}), this.updateTableWidth(t);
|
|
384
384
|
}
|
|
385
385
|
}, "handleResize"), u = /* @__PURE__ */ d(() => {
|
|
386
|
-
|
|
386
|
+
s = !1, e.style.borderRight = "", e.style.background = "", document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
387
387
|
}, "stopResize");
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
390
390
|
* Add drag and drop functionality to a header
|
|
391
391
|
*/
|
|
392
|
-
addDragAndDrop(e, t,
|
|
392
|
+
addDragAndDrop(e, t, o, r) {
|
|
393
393
|
if (e.querySelector(".drag-handle"))
|
|
394
394
|
return;
|
|
395
395
|
e.classList.add(this.options.draggableClass), e.draggable = !0;
|
|
396
396
|
const i = t.querySelector("thead tr");
|
|
397
|
-
e.addEventListener("dragstart", (
|
|
397
|
+
e.addEventListener("dragstart", (s) => {
|
|
398
398
|
this.isDragging = !0;
|
|
399
399
|
const a = Array.from(i.children).indexOf(e);
|
|
400
|
-
this.dragSource = { table: t, tableIndex:
|
|
400
|
+
this.dragSource = { table: t, tableIndex: o, columnIndex: a }, s.dataTransfer.effectAllowed = "move", s.dataTransfer.setData("text/html", e.outerHTML);
|
|
401
401
|
const l = e.outerHTML;
|
|
402
|
-
e.style.opacity = "0.5", this.createCustomDragImage(
|
|
403
|
-
}), e.addEventListener("dragend", (
|
|
402
|
+
e.style.opacity = "0.5", this.createCustomDragImage(s, e, l);
|
|
403
|
+
}), e.addEventListener("dragend", (s) => {
|
|
404
404
|
this.isDragging = !1, this.dragSource = null, e.style.opacity = "", this.clearAllColumnHighlights(t);
|
|
405
|
-
}), e.addEventListener("dragover", (
|
|
406
|
-
|
|
407
|
-
}), e.addEventListener("dragenter", (
|
|
408
|
-
if (
|
|
405
|
+
}), e.addEventListener("dragover", (s) => {
|
|
406
|
+
s.preventDefault(), s.dataTransfer.dropEffect = "move";
|
|
407
|
+
}), e.addEventListener("dragenter", (s) => {
|
|
408
|
+
if (s.preventDefault(), this.dragSource && this.dragSource.tableIndex === o) {
|
|
409
409
|
const a = Array.from(i.children).indexOf(e);
|
|
410
410
|
this.dragSource.columnIndex !== a && this.highlightColumn(t, a, !0);
|
|
411
411
|
}
|
|
412
|
-
}), e.addEventListener("dragleave", (
|
|
413
|
-
if (!e.contains(
|
|
412
|
+
}), e.addEventListener("dragleave", (s) => {
|
|
413
|
+
if (!e.contains(s.relatedTarget)) {
|
|
414
414
|
const a = Array.from(i.children).indexOf(e);
|
|
415
415
|
this.highlightColumn(t, a, !1);
|
|
416
416
|
}
|
|
417
|
-
}), e.addEventListener("drop", (
|
|
418
|
-
if (
|
|
417
|
+
}), e.addEventListener("drop", (s) => {
|
|
418
|
+
if (s.preventDefault(), this.dragSource && this.dragSource.tableIndex === o) {
|
|
419
419
|
const a = Array.from(i.children).indexOf(e);
|
|
420
|
-
this.dragSource.columnIndex !== a && this.reorderColumns(t,
|
|
420
|
+
this.dragSource.columnIndex !== a && this.reorderColumns(t, o, this.dragSource.columnIndex, a);
|
|
421
421
|
}
|
|
422
422
|
this.clearAllColumnHighlights(t);
|
|
423
423
|
});
|
|
@@ -425,9 +425,9 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
425
425
|
/**
|
|
426
426
|
* Create a custom drag image for better UX
|
|
427
427
|
*/
|
|
428
|
-
createCustomDragImage(e, t,
|
|
429
|
-
const
|
|
430
|
-
|
|
428
|
+
createCustomDragImage(e, t, o) {
|
|
429
|
+
const r = document.createElement("div");
|
|
430
|
+
r.style.cssText = `
|
|
431
431
|
position: absolute;
|
|
432
432
|
top: -1000px;
|
|
433
433
|
left: -1000px;
|
|
@@ -450,33 +450,33 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
450
450
|
display: flex;
|
|
451
451
|
align-items: center;
|
|
452
452
|
`;
|
|
453
|
-
const i =
|
|
454
|
-
|
|
453
|
+
const i = o;
|
|
454
|
+
r.innerHTML = `
|
|
455
455
|
<div style="display: flex; align-items: center; gap: 5px; align-content: center;color:white;">
|
|
456
456
|
<span style="overflow: hidden; text-overflow: ellipsis">${i}</span>
|
|
457
457
|
<svg style="fill: grey; font-size: 10px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20" ><defs><path id="a" d="M0 0h24v24H0V0z"/></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" d="M9.01 14H2v2h7.01v3L13 15l-3.99-4v3zm5.98-1v-3H22V8h-7.01V5L11 9l3.99 4z"/></svg>
|
|
458
458
|
</div>
|
|
459
|
-
`, document.body.appendChild(
|
|
460
|
-
document.body.contains(
|
|
459
|
+
`, document.body.appendChild(r), e.dataTransfer.setDragImage(r, 50, 12), setTimeout(() => {
|
|
460
|
+
document.body.contains(r) && document.body.removeChild(r);
|
|
461
461
|
}, 100);
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
464
|
* Highlight an entire column during drag operations
|
|
465
465
|
*/
|
|
466
|
-
highlightColumn(e, t,
|
|
467
|
-
const
|
|
468
|
-
if (!
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
471
|
-
if (
|
|
472
|
-
|
|
466
|
+
highlightColumn(e, t, o) {
|
|
467
|
+
const r = e.querySelector("thead tr"), i = e.querySelector("tbody");
|
|
468
|
+
if (!r || !i) return;
|
|
469
|
+
const s = r.children[t];
|
|
470
|
+
if (s)
|
|
471
|
+
if (o) {
|
|
472
|
+
s.classList.add(this.options.dragOverClass);
|
|
473
473
|
const a = i.children;
|
|
474
474
|
for (let l = 0; l < a.length; l++) {
|
|
475
475
|
const c = a[l].children[t];
|
|
476
476
|
c && c.classList.add(this.options.dragOverClass);
|
|
477
477
|
}
|
|
478
478
|
} else {
|
|
479
|
-
|
|
479
|
+
s.classList.remove(this.options.dragOverClass);
|
|
480
480
|
const a = i.children;
|
|
481
481
|
for (let l = 0; l < a.length; l++) {
|
|
482
482
|
const c = a[l].children[t];
|
|
@@ -488,14 +488,14 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
488
488
|
* Clear all column highlights
|
|
489
489
|
*/
|
|
490
490
|
clearAllColumnHighlights(e) {
|
|
491
|
-
const t = e.querySelector("thead tr"),
|
|
492
|
-
if (!t || !
|
|
493
|
-
const
|
|
494
|
-
for (let
|
|
495
|
-
|
|
496
|
-
const i =
|
|
497
|
-
for (let
|
|
498
|
-
const a = i[
|
|
491
|
+
const t = e.querySelector("thead tr"), o = e.querySelector("tbody");
|
|
492
|
+
if (!t || !o) return;
|
|
493
|
+
const r = t.children;
|
|
494
|
+
for (let s = 0; s < r.length; s++)
|
|
495
|
+
r[s].classList.remove(this.options.dragOverClass);
|
|
496
|
+
const i = o.children;
|
|
497
|
+
for (let s = 0; s < i.length; s++) {
|
|
498
|
+
const a = i[s].children;
|
|
499
499
|
for (let l = 0; l < a.length; l++)
|
|
500
500
|
a[l].classList.remove(this.options.dragOverClass);
|
|
501
501
|
}
|
|
@@ -503,25 +503,25 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
503
503
|
/**
|
|
504
504
|
* Reorder columns in a table
|
|
505
505
|
*/
|
|
506
|
-
reorderColumns(e, t,
|
|
507
|
-
const i = e.querySelector("thead tr"),
|
|
508
|
-
if (!i || !
|
|
509
|
-
const a = Array.from(i.children), l = Array.from(
|
|
510
|
-
if (
|
|
506
|
+
reorderColumns(e, t, o, r) {
|
|
507
|
+
const i = e.querySelector("thead tr"), s = e.querySelector("tbody");
|
|
508
|
+
if (!i || !s) return;
|
|
509
|
+
const a = Array.from(i.children), l = Array.from(s.children);
|
|
510
|
+
if (o < 0 || o >= a.length || r < 0 || r >= a.length) {
|
|
511
511
|
console.warn("Invalid column indices for reordering");
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
|
-
if (
|
|
514
|
+
if (o === r)
|
|
515
515
|
return;
|
|
516
|
-
const c = a[
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
|
|
516
|
+
const c = a[o], u = a[r];
|
|
517
|
+
o < r ? i.insertBefore(c, u.nextSibling) : i.insertBefore(c, u), l.forEach((h, f) => {
|
|
518
|
+
const m = Array.from(h.children), y = m[o], v = m[r];
|
|
519
|
+
o < r ? h.insertBefore(y, v.nextSibling) : h.insertBefore(y, v);
|
|
520
520
|
});
|
|
521
521
|
const p = this.originalColumnOrder.get(t);
|
|
522
522
|
if (p) {
|
|
523
|
-
const h = [...p], f = h[
|
|
524
|
-
h.splice(
|
|
523
|
+
const h = [...p], f = h[o];
|
|
524
|
+
h.splice(o, 1), h.splice(r, 0, f), this.originalColumnOrder.set(t, h);
|
|
525
525
|
}
|
|
526
526
|
this.applyTableStyles(e), this.refreshDragAndDropListeners(e, t);
|
|
527
527
|
}
|
|
@@ -529,13 +529,13 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
529
529
|
* Refresh drag and drop listeners after column reordering
|
|
530
530
|
*/
|
|
531
531
|
refreshDragAndDropListeners(e, t) {
|
|
532
|
-
const
|
|
533
|
-
if (!
|
|
534
|
-
Array.from(
|
|
532
|
+
const o = e.querySelector("thead tr");
|
|
533
|
+
if (!o) return;
|
|
534
|
+
Array.from(o.children).forEach((i, s) => {
|
|
535
535
|
if (i.classList.contains(this.options.draggableClass)) {
|
|
536
536
|
i.style.opacity = "", i.style.background = "", i.style.borderRight = "";
|
|
537
537
|
const a = i.cloneNode(!0);
|
|
538
|
-
i.parentNode.replaceChild(a, i), this.makeHeaderSortable(a, e, t,
|
|
538
|
+
i.parentNode.replaceChild(a, i), this.makeHeaderSortable(a, e, t, s);
|
|
539
539
|
}
|
|
540
540
|
});
|
|
541
541
|
}
|
|
@@ -544,47 +544,47 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
544
544
|
*/
|
|
545
545
|
updateTableWidth(e) {
|
|
546
546
|
const t = e.querySelectorAll("th");
|
|
547
|
-
let
|
|
548
|
-
t.forEach((
|
|
549
|
-
const i =
|
|
547
|
+
let o = 0;
|
|
548
|
+
t.forEach((r) => {
|
|
549
|
+
const i = r.style.width;
|
|
550
550
|
if (i) {
|
|
551
|
-
const
|
|
552
|
-
|
|
551
|
+
const s = parseInt(i.replace("px", ""));
|
|
552
|
+
o += s;
|
|
553
553
|
} else {
|
|
554
|
-
const
|
|
555
|
-
|
|
554
|
+
const s = r.textContent.replace(/[📊🔍]/g, "").trim();
|
|
555
|
+
o += s.length;
|
|
556
556
|
}
|
|
557
|
-
}), e.style.width = `${
|
|
557
|
+
}), e.style.width = `${o}px`;
|
|
558
558
|
}
|
|
559
559
|
/**
|
|
560
560
|
* Calculate intelligent table width based on header text length
|
|
561
561
|
*/
|
|
562
562
|
calculateTableWidth(e) {
|
|
563
563
|
var p;
|
|
564
|
-
const t = e.getAttribute("data-original-width"),
|
|
564
|
+
const t = e.getAttribute("data-original-width"), o = t ? parseFloat(t) : 0, r = e.querySelectorAll("th");
|
|
565
565
|
let i = 0;
|
|
566
566
|
e.parentElement.clientWidth;
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
let
|
|
570
|
-
|
|
567
|
+
const s = [];
|
|
568
|
+
r.forEach((h) => {
|
|
569
|
+
let m = h.textContent.replace(/[📊🔍]/g, "").trim().length * this.charWidth + 15;
|
|
570
|
+
s.push(m), i += m;
|
|
571
571
|
});
|
|
572
572
|
const a = e.querySelectorAll("tr"), l = ((p = e.parentElement) == null ? void 0 : p.getBoundingClientRect().width) ?? i;
|
|
573
573
|
var c = 0;
|
|
574
574
|
for (const h of a)
|
|
575
|
-
h.querySelectorAll("td").forEach((
|
|
576
|
-
const b =
|
|
577
|
-
b >
|
|
575
|
+
h.querySelectorAll("td").forEach((m, y) => {
|
|
576
|
+
const b = m.textContent.length * this.charWidth + 15;
|
|
577
|
+
b > s[y] && y < s.length && (s[y] = b);
|
|
578
578
|
});
|
|
579
|
-
c =
|
|
579
|
+
c = s.reduce((h, f) => h += f, 0), r.forEach((h, f) => {
|
|
580
580
|
if (c > l) {
|
|
581
|
-
const
|
|
582
|
-
h.style.width = `${l *
|
|
581
|
+
const m = s[f] / c;
|
|
582
|
+
h.style.width = `${l * m}px`;
|
|
583
583
|
} else
|
|
584
|
-
h.style.width = `${
|
|
584
|
+
h.style.width = `${s[f]}px`;
|
|
585
585
|
});
|
|
586
586
|
let u = 0;
|
|
587
|
-
return c > l ? u = "100%" : u = `${Math.max(c,
|
|
587
|
+
return c > l ? u = "100%" : u = `${Math.max(c, o)}px`, u;
|
|
588
588
|
}
|
|
589
589
|
/**
|
|
590
590
|
* Apply inline styles to ensure text clipping and horizontal scroll work
|
|
@@ -596,8 +596,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
596
596
|
// Signature matches the single call site — `init()` passes (fontFamily,
|
|
597
597
|
// fontMono), which used to land on a leading `char` parameter nothing read.
|
|
598
598
|
getCharWidth(e, t) {
|
|
599
|
-
const
|
|
600
|
-
return
|
|
599
|
+
const o = document.createElement("canvas").getContext("2d");
|
|
600
|
+
return o ? (o.fontFamily = e, o.fontMono = t, o.measureText("A ").width) : C.DEFAULT_CHAR_WIDTH;
|
|
601
601
|
}
|
|
602
602
|
/**
|
|
603
603
|
* Add CSS styles for sortable tables
|
|
@@ -739,19 +739,19 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
739
739
|
*/
|
|
740
740
|
destroy() {
|
|
741
741
|
this.tables.forEach((t) => {
|
|
742
|
-
t.querySelectorAll(`.${this.options.sortableClass}`).forEach((
|
|
743
|
-
|
|
742
|
+
t.querySelectorAll(`.${this.options.sortableClass}`).forEach((r) => {
|
|
743
|
+
r.classList.remove(
|
|
744
744
|
this.options.sortableClass,
|
|
745
745
|
this.options.activeSortClass,
|
|
746
746
|
this.options.ascendingClass,
|
|
747
747
|
this.options.descendingClass
|
|
748
|
-
),
|
|
749
|
-
const i =
|
|
750
|
-
|
|
748
|
+
), r.style.cursor = "", r.style.background = "";
|
|
749
|
+
const i = r.cloneNode(!0);
|
|
750
|
+
r.parentNode.replaceChild(i, r);
|
|
751
751
|
});
|
|
752
752
|
});
|
|
753
753
|
const e = document.getElementById("sortable-table-styles");
|
|
754
|
-
e && e.remove(), this.tables = [], this.sortStates.clear(),
|
|
754
|
+
e && e.remove(), this.tables = [], this.sortStates.clear(), $.clear();
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* Refresh the library (useful after DOM changes)
|
|
@@ -760,202 +760,154 @@ const L = /* @__PURE__ */ new Set(), v = class v {
|
|
|
760
760
|
this.destroy(), this.init();
|
|
761
761
|
}
|
|
762
762
|
};
|
|
763
|
-
d(
|
|
764
|
-
|
|
765
|
-
let
|
|
766
|
-
typeof window < "u" && (window.SortableTable =
|
|
767
|
-
const
|
|
768
|
-
let
|
|
769
|
-
const
|
|
770
|
-
const
|
|
771
|
-
return
|
|
763
|
+
d(C, "SortableTable"), /** Fallback advance width, in px, for one character of the body font. */
|
|
764
|
+
W(C, "DEFAULT_CHAR_WIDTH", 8);
|
|
765
|
+
let A = C;
|
|
766
|
+
typeof window < "u" && (window.SortableTable = A);
|
|
767
|
+
const q = /* @__PURE__ */ new Set(["/", "@", "#"]), I = /* @__PURE__ */ d((n) => n === "/" ? "slash" : n === "@" ? "at" : "hash", "triggerTypeFor"), T = /[ \t\r\n\f\v]/, V = /\[[^\]\n]+\]/g, M = /* @__PURE__ */ d((n, e, t) => {
|
|
768
|
+
let o = 0;
|
|
769
|
+
const r = /* @__PURE__ */ d((i) => {
|
|
770
|
+
const s = i === 0 ? e : n[i - 1];
|
|
771
|
+
return s === void 0 || T.test(s);
|
|
772
772
|
}, "boundaryBefore");
|
|
773
|
-
for (;
|
|
774
|
-
const i = o
|
|
775
|
-
if (
|
|
776
|
-
let
|
|
777
|
-
for (;
|
|
778
|
-
t.push({ type:
|
|
773
|
+
for (; o < n.length; ) {
|
|
774
|
+
const i = n[o];
|
|
775
|
+
if (r(o) && q.has(i)) {
|
|
776
|
+
let s = o + 1;
|
|
777
|
+
for (; s < n.length && !T.test(n[s]); ) s += 1;
|
|
778
|
+
t.push({ type: I(i), text: n.slice(o, s) }), o = s;
|
|
779
779
|
} else {
|
|
780
|
-
let
|
|
781
|
-
for (;
|
|
782
|
-
const a =
|
|
783
|
-
if (
|
|
784
|
-
|
|
780
|
+
let s = o + 1;
|
|
781
|
+
for (; s < n.length; ) {
|
|
782
|
+
const a = n[s];
|
|
783
|
+
if (q.has(a) && T.test(n[s - 1])) break;
|
|
784
|
+
s += 1;
|
|
785
785
|
}
|
|
786
|
-
t.push({ type: "plain", text:
|
|
786
|
+
t.push({ type: "plain", text: n.slice(o, s) }), o = s;
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
}, "tokenizeSegment"),
|
|
790
|
-
if (!
|
|
791
|
-
const e = [], t = new RegExp(
|
|
792
|
-
let
|
|
793
|
-
for (let
|
|
794
|
-
|
|
795
|
-
return
|
|
796
|
-
}, "tokenizeForHighlight"),
|
|
797
|
-
const t = e.filter((
|
|
798
|
-
if (t.length === 0) return
|
|
799
|
-
const
|
|
800
|
-
for (const
|
|
801
|
-
if (
|
|
802
|
-
|
|
789
|
+
}, "tokenizeSegment"), Z = /* @__PURE__ */ d((n) => {
|
|
790
|
+
if (!n) return [];
|
|
791
|
+
const e = [], t = new RegExp(V.source, "g");
|
|
792
|
+
let o = 0;
|
|
793
|
+
for (let r = t.exec(n); r; r = t.exec(n))
|
|
794
|
+
r.index > o && M(n.slice(o, r.index), o === 0 ? void 0 : n[o - 1], e), e.push({ type: "placeholder", text: r[0] }), o = r.index + r[0].length;
|
|
795
|
+
return o < n.length && M(n.slice(o), o === 0 ? void 0 : n[o - 1], e), e;
|
|
796
|
+
}, "tokenizeForHighlight"), J = /* @__PURE__ */ d((n, e) => {
|
|
797
|
+
const t = e.filter((r) => r.trim().length > 0).sort((r, i) => i.length - r.length);
|
|
798
|
+
if (t.length === 0) return n;
|
|
799
|
+
const o = [];
|
|
800
|
+
for (const r of n) {
|
|
801
|
+
if (r.type !== "plain") {
|
|
802
|
+
o.push(r);
|
|
803
803
|
continue;
|
|
804
804
|
}
|
|
805
|
-
let i =
|
|
805
|
+
let i = r.text;
|
|
806
806
|
for (; i.length > 0; ) {
|
|
807
|
-
let
|
|
807
|
+
let s = -1, a = 0;
|
|
808
808
|
for (const l of t) {
|
|
809
809
|
const c = i.indexOf(l);
|
|
810
|
-
c >= 0 && (
|
|
810
|
+
c >= 0 && (s === -1 || c < s) && (s = c, a = l.length);
|
|
811
811
|
}
|
|
812
|
-
if (
|
|
813
|
-
|
|
812
|
+
if (s === -1) {
|
|
813
|
+
o.push({ type: "plain", text: i });
|
|
814
814
|
break;
|
|
815
815
|
}
|
|
816
|
-
|
|
816
|
+
s > 0 && o.push({ type: "plain", text: i.slice(0, s) }), o.push({ type: "at", text: i.slice(s, s + a) }), i = i.slice(s + a);
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
|
-
return
|
|
819
|
+
return o;
|
|
820
820
|
}, "chipLocations");
|
|
821
|
-
function
|
|
822
|
-
const
|
|
821
|
+
function Y(n, e, t = e, o = 600) {
|
|
822
|
+
const r = n.value;
|
|
823
823
|
let i = !1;
|
|
824
|
-
const
|
|
825
|
-
i || (i = !0, document.removeEventListener("selectionchange", l),
|
|
824
|
+
const s = /* @__PURE__ */ d(() => {
|
|
825
|
+
i || (i = !0, document.removeEventListener("selectionchange", l), n.removeEventListener("keydown", s), n.removeEventListener("input", s), n.removeEventListener("pointerdown", s), window.clearTimeout(c), window.clearInterval(u));
|
|
826
826
|
}, "stop"), a = /* @__PURE__ */ d(() => {
|
|
827
|
-
if (
|
|
828
|
-
|
|
827
|
+
if (n.value !== r) {
|
|
828
|
+
s();
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
|
-
|
|
831
|
+
n.selectionStart === e && n.selectionEnd === t || n.setSelectionRange(e, t);
|
|
832
832
|
}, "apply"), l = /* @__PURE__ */ d(() => {
|
|
833
|
-
document.activeElement ===
|
|
833
|
+
document.activeElement === n && a();
|
|
834
834
|
}, "onSelectionChange");
|
|
835
835
|
a();
|
|
836
|
-
const c = window.setTimeout(
|
|
837
|
-
return document.addEventListener("selectionchange", l),
|
|
836
|
+
const c = window.setTimeout(s, o), u = window.setInterval(a, 50);
|
|
837
|
+
return document.addEventListener("selectionchange", l), n.addEventListener("keydown", s), n.addEventListener("input", s), n.addEventListener("pointerdown", s), s;
|
|
838
838
|
}
|
|
839
|
-
d(
|
|
840
|
-
function
|
|
839
|
+
d(Y, "placeCaret");
|
|
840
|
+
function Q(n = {}) {
|
|
841
841
|
if (typeof document > "u") return;
|
|
842
842
|
const e = /* @__PURE__ */ d((i) => {
|
|
843
|
-
i.stopPropagation(), i.preventDefault(),
|
|
843
|
+
i.stopPropagation(), i.preventDefault(), o();
|
|
844
844
|
}, "onClick"), t = /* @__PURE__ */ d((i) => {
|
|
845
845
|
i.stopPropagation(), i.preventDefault(), document.removeEventListener("mousedown", t, !0);
|
|
846
|
-
}, "onMouseDown"),
|
|
847
|
-
document.removeEventListener("click", e, !0), document.removeEventListener("mousedown", t, !0), document.removeEventListener("pointerdown",
|
|
848
|
-
}, "cleanup"),
|
|
849
|
-
document.addEventListener("click", e, !0),
|
|
846
|
+
}, "onMouseDown"), o = /* @__PURE__ */ d(() => {
|
|
847
|
+
document.removeEventListener("click", e, !0), document.removeEventListener("mousedown", t, !0), document.removeEventListener("pointerdown", o, !0), window.clearTimeout(r);
|
|
848
|
+
}, "cleanup"), r = window.setTimeout(o, 500);
|
|
849
|
+
document.addEventListener("click", e, !0), n.mousedown && (document.addEventListener("mousedown", t, !0), document.addEventListener("pointerdown", o, !0));
|
|
850
850
|
}
|
|
851
|
-
d(
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
for (let s = e - 1; s >= 0; s -= 1) {
|
|
856
|
-
const n = o[s];
|
|
857
|
-
if (n === "/" || n === "@" || n === "#")
|
|
858
|
-
return !(s === 0 || /\s/.test(o[s - 1])) || n !== "@" && t > 0 ? null : {
|
|
859
|
-
trigger: n,
|
|
860
|
-
query: o.slice(s + 1, e),
|
|
861
|
-
startIdx: s,
|
|
862
|
-
endIdx: e
|
|
863
|
-
};
|
|
864
|
-
if (n === " ") return null;
|
|
865
|
-
if (n === " " || n === " ") {
|
|
866
|
-
if (t += 1, t > H) return null;
|
|
867
|
-
continue;
|
|
868
|
-
}
|
|
869
|
-
if (/\s/.test(n)) return null;
|
|
870
|
-
}
|
|
871
|
-
return null;
|
|
872
|
-
}
|
|
873
|
-
d(Z, "detectTrigger");
|
|
874
|
-
const _ = /\[[^\]\n]+\]/g;
|
|
875
|
-
function w(o, e = 0) {
|
|
876
|
-
const t = new RegExp(_.source, "g");
|
|
877
|
-
t.lastIndex = e;
|
|
878
|
-
const s = t.exec(o);
|
|
879
|
-
if (!s) return null;
|
|
880
|
-
const n = s[0].slice(1, -1), i = n[0], r = i === "@" || i === "#" || i === "/";
|
|
881
|
-
return {
|
|
882
|
-
trigger: r ? i : null,
|
|
883
|
-
label: (r ? n.slice(1) : n).trim(),
|
|
884
|
-
startIdx: s.index,
|
|
885
|
-
endIdx: s.index + s[0].length
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
d(w, "findPlaceholder");
|
|
889
|
-
function J(o, e) {
|
|
890
|
-
for (let t = 0; ; ) {
|
|
891
|
-
const s = w(o, t);
|
|
892
|
-
if (!s || s.startIdx > e) return null;
|
|
893
|
-
if (e <= s.endIdx) return s;
|
|
894
|
-
t = s.endIdx;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
d(J, "placeholderAt");
|
|
898
|
-
function k(o, e) {
|
|
899
|
-
if (e.trigger) {
|
|
900
|
-
const t = o.slice(0, e.startIdx) + e.trigger + o.slice(e.endIdx), s = e.startIdx + 1;
|
|
901
|
-
return { next: t, selectionStart: s, selectionEnd: s, reopenTrigger: !0, placeholderLabel: e.label };
|
|
902
|
-
}
|
|
903
|
-
return { next: o, selectionStart: e.startIdx, selectionEnd: e.endIdx, reopenTrigger: !1, placeholderLabel: e.label };
|
|
904
|
-
}
|
|
905
|
-
d(k, "activatePlaceholder");
|
|
906
|
-
function Y(o, e) {
|
|
907
|
-
const t = w(o, e) ?? w(o, 0);
|
|
908
|
-
return t ? k(o, t) : null;
|
|
909
|
-
}
|
|
910
|
-
d(Y, "advanceToPlaceholder");
|
|
911
|
-
function Q(o, e, t) {
|
|
912
|
-
const s = o.slice(0, e.startIdx), n = o.slice(e.endIdx), i = w(t);
|
|
913
|
-
if (i) {
|
|
914
|
-
const c = k(t, i);
|
|
915
|
-
return {
|
|
916
|
-
next: `${s}${c.next}${n}`,
|
|
917
|
-
selectionStart: s.length + c.selectionStart,
|
|
918
|
-
selectionEnd: s.length + c.selectionEnd,
|
|
919
|
-
reopenTrigger: c.reopenTrigger,
|
|
920
|
-
placeholderLabel: c.placeholderLabel
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
const r = t[t.length - 1];
|
|
924
|
-
if (r === "@" || r === "#" || r === "/") {
|
|
925
|
-
const c = s.length + t.length;
|
|
926
|
-
return { next: `${s}${t}${n}`, selectionStart: c, selectionEnd: c, reopenTrigger: !0 };
|
|
927
|
-
}
|
|
928
|
-
const a = `${t} `, l = s.length + a.length;
|
|
929
|
-
return { next: `${s}${a}${n}`, selectionStart: l, selectionEnd: l, reopenTrigger: !1 };
|
|
930
|
-
}
|
|
931
|
-
d(Q, "applyTriggerInsertion");
|
|
932
|
-
async function ee(o, { onAtQuery: e, onAtPersonQuery: t }, {
|
|
933
|
-
personConfidence: s = 0,
|
|
934
|
-
locationConfidence: n = 0,
|
|
851
|
+
d(Q, "swallowNextClick");
|
|
852
|
+
async function ee(n, { onAtQuery: e, onAtPersonQuery: t }, {
|
|
853
|
+
personConfidence: o = 0,
|
|
854
|
+
locationConfidence: r = 0,
|
|
935
855
|
personFirstThreshold: i = 0.5,
|
|
936
|
-
vertical:
|
|
856
|
+
vertical: s = "air",
|
|
937
857
|
hotelConfidence: a = 0,
|
|
938
|
-
hotelNameConfidence: l = 0
|
|
858
|
+
hotelNameConfidence: l = 0,
|
|
859
|
+
signal: c,
|
|
860
|
+
onUpdate: u,
|
|
861
|
+
byPriority: p = !1
|
|
939
862
|
} = {}) {
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
863
|
+
const h = o >= i && o >= r;
|
|
864
|
+
let f = [], m = [], y = !e, v = !t, b = null;
|
|
865
|
+
const S = /* @__PURE__ */ d((g, E) => {
|
|
866
|
+
const L = E.map((w) => w.kind ? w : { ...w, kind: "person" });
|
|
867
|
+
if (e && t) {
|
|
868
|
+
const w = L.map((x) => ({ ...x, group: "person" })), D = g.map((x) => ({ ...x, group: x.kind === "hotel" ? "hotel" : "location" }));
|
|
869
|
+
return h ? [...w, ...D] : [...D, ...w];
|
|
870
|
+
}
|
|
871
|
+
return [...L, ...g];
|
|
872
|
+
}, "merge"), k = /* @__PURE__ */ d(() => {
|
|
873
|
+
if (!u || c != null && c.aborted) return;
|
|
874
|
+
if (!p) {
|
|
875
|
+
u(S(f, m));
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const g = h ? S(v ? f : [], m) : S(f, y ? m : []);
|
|
879
|
+
if (g.length === 0 && !(y && v)) return;
|
|
880
|
+
const E = g.map((L) => L.id).join(`
|
|
881
|
+
`);
|
|
882
|
+
E !== b && (b = E, u(g));
|
|
883
|
+
}, "publish");
|
|
884
|
+
return await Promise.all([
|
|
885
|
+
e ? e(n, {
|
|
886
|
+
vertical: s,
|
|
887
|
+
hotelConfidence: a,
|
|
888
|
+
hotelNameConfidence: l,
|
|
889
|
+
signal: c,
|
|
890
|
+
byPriority: p,
|
|
891
|
+
onPartial: /* @__PURE__ */ d((g) => {
|
|
892
|
+
f = g, k();
|
|
893
|
+
}, "onPartial")
|
|
894
|
+
}).catch(() => f).then((g) => {
|
|
895
|
+
f = g, y = !0, k();
|
|
896
|
+
}) : void 0,
|
|
897
|
+
t ? t(n, { leading: h, signal: c }).catch(() => []).then((g) => {
|
|
898
|
+
m = g, v = !0, k();
|
|
899
|
+
}) : void 0
|
|
900
|
+
]), S(f, m);
|
|
949
901
|
}
|
|
950
902
|
d(ee, "fetchAtMentions");
|
|
951
|
-
function te(
|
|
952
|
-
var
|
|
953
|
-
const t = (
|
|
954
|
-
return t !== void 0 && (e === 0 || ((
|
|
903
|
+
function te(n, e) {
|
|
904
|
+
var o, r;
|
|
905
|
+
const t = (o = n[e]) == null ? void 0 : o.group;
|
|
906
|
+
return t !== void 0 && (e === 0 || ((r = n[e - 1]) == null ? void 0 : r.group) !== t);
|
|
955
907
|
}
|
|
956
908
|
d(te, "isSectionStart");
|
|
957
|
-
function se(
|
|
958
|
-
return (
|
|
909
|
+
function se(n) {
|
|
910
|
+
return (n ?? []).map((e) => ({
|
|
959
911
|
id: e.key,
|
|
960
912
|
label: e.label,
|
|
961
913
|
value: e.insert ?? e.label,
|
|
@@ -969,26 +921,20 @@ function se(o) {
|
|
|
969
921
|
}
|
|
970
922
|
d(se, "toPredictionRows");
|
|
971
923
|
export {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
V as n,
|
|
987
|
-
P as o,
|
|
988
|
-
j as p,
|
|
989
|
-
K as q,
|
|
990
|
-
X as r,
|
|
991
|
-
F as s,
|
|
924
|
+
A as S,
|
|
925
|
+
H as a,
|
|
926
|
+
U as b,
|
|
927
|
+
J as c,
|
|
928
|
+
K as d,
|
|
929
|
+
B as e,
|
|
930
|
+
ee as f,
|
|
931
|
+
j as g,
|
|
932
|
+
G as h,
|
|
933
|
+
te as i,
|
|
934
|
+
Q as j,
|
|
935
|
+
Z as k,
|
|
936
|
+
Y as p,
|
|
937
|
+
X as s,
|
|
992
938
|
se as t
|
|
993
939
|
};
|
|
994
|
-
//# sourceMappingURL=predictionRows-
|
|
940
|
+
//# sourceMappingURL=predictionRows-CZORCShm.js.map
|