@aintela/chat 0.2.20 → 0.2.22

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.
Files changed (32) hide show
  1. package/dist/{auth-CcTgInbY.js → auth-DbmLacBc.js} +2 -2
  2. package/dist/{auth-CcTgInbY.js.map → auth-DbmLacBc.js.map} +1 -1
  3. package/dist/components.js +5407 -5161
  4. package/dist/components.js.map +1 -1
  5. package/dist/hooks.js +5 -4
  6. package/dist/{httpArtifactService-BAR60Gu1.js → httpArtifactService-Dh9LGQ9a.js} +2 -2
  7. package/dist/{httpArtifactService-BAR60Gu1.js.map → httpArtifactService-Dh9LGQ9a.js.map} +1 -1
  8. package/dist/index.js +126 -122
  9. package/dist/{sortable-table-DgQHxWIh.js → promptHighlight-BHSQkdFs.js} +330 -282
  10. package/dist/promptHighlight-BHSQkdFs.js.map +1 -0
  11. package/dist/services.js +1 -1
  12. package/dist/src/components/AiChat/AiChatContext.d.ts +14 -2
  13. package/dist/src/components/AiChat/AiChatTypes.d.ts +28 -0
  14. package/dist/src/components/AiChat/ChatPane/AskUserSheet.d.ts +2 -1
  15. package/dist/src/components/AiChat/ChatPane/parts/AskAuthPart.d.ts +8 -0
  16. package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +6 -1
  17. package/dist/src/components/index.d.ts +1 -1
  18. package/dist/src/components/v2/PromptDateMarkers.d.ts +15 -0
  19. package/dist/src/components/v2/PromptV2.d.ts +18 -0
  20. package/dist/src/components/v2/index.d.ts +2 -0
  21. package/dist/src/hooks/index.d.ts +2 -0
  22. package/dist/src/hooks/usePromptAssist.d.ts +58 -0
  23. package/dist/src/services/httpPromptAssistService.d.ts +58 -0
  24. package/dist/src/utils/index.d.ts +2 -0
  25. package/dist/src/utils/promptHighlight.d.ts +16 -0
  26. package/dist/useContainerWidth-DsNHNR-z.js +187 -0
  27. package/dist/useContainerWidth-DsNHNR-z.js.map +1 -0
  28. package/dist/utils.js +34 -32
  29. package/package.json +1 -1
  30. package/dist/sortable-table-DgQHxWIh.js.map +0 -1
  31. package/dist/useContainerWidth-Df2PmSoC.js +0 -52
  32. package/dist/useContainerWidth-Df2PmSoC.js.map +0 -1
@@ -0,0 +1,187 @@
1
+ var ct = Object.defineProperty;
2
+ var k = (c, u) => ct(c, "name", { value: u, configurable: !0 });
3
+ import { useState as T, useRef as a, useCallback as b, useEffect as A } from "react";
4
+ const X = /* @__PURE__ */ k(() => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `s-${Date.now()}-${Math.random()}`, "newSessionId");
5
+ function it(c, u, y = {}) {
6
+ const [o, i] = T(null), [f, d] = T(0), [x, v] = T([]), [P, L] = T([]), [D, H] = T(""), z = a(""), C = a(null), O = a(c);
7
+ O.current = c;
8
+ const U = a(u);
9
+ U.current = u;
10
+ const j = a(y);
11
+ j.current = y;
12
+ const E = a(null), I = a(null), M = a(0), W = a(""), q = a(null), F = a(null), B = a(X()), Y = b(() => i(null), []), Z = b(() => {
13
+ v([]), L([]), H(""), z.current = "", q.current = null, B.current = X();
14
+ }, []), K = b((t) => {
15
+ i(null);
16
+ const e = O.current, l = e.getTextarea();
17
+ if (!l) return;
18
+ const m = l.selectionStart ?? l.value.length, h = l.value.slice(0, m), s = l.value.slice(m), n = h.length > 0 && !/\s$/.test(h);
19
+ if (t.kind === "date") {
20
+ const p = `${n ? " " : ""}${t.insert} `;
21
+ e.setDraft(`${h}${p}${s}`), e.focusCaret(h.length + p.length);
22
+ return;
23
+ }
24
+ if (t.kind === "namedLocation" && t.insert) {
25
+ const p = `@${t.insert.replace(/ /g, " ")}`, S = `${n ? " " : ""}${p} `;
26
+ e.setDraft(`${h}${S}${s}`), e.focusCaret(h.length + S.length);
27
+ return;
28
+ }
29
+ const $ = t.kind === "location" ? "@" : "#", r = `${n ? " " : ""}${$}`;
30
+ e.setDraft(`${h}${r}${s}`), e.focusCaret(h.length + r.length), requestAnimationFrame(() => {
31
+ const p = e.getTextarea();
32
+ p && e.syncTrigger(p);
33
+ });
34
+ }, []), Q = b(async () => {
35
+ var m;
36
+ const t = U.current.resolveDates;
37
+ if (!t) return;
38
+ const e = W.current;
39
+ if (e.trim() === "") {
40
+ q.current = null;
41
+ return;
42
+ }
43
+ if (e === q.current) return;
44
+ q.current = e, (m = F.current) == null || m.abort();
45
+ const l = new AbortController();
46
+ F.current = l;
47
+ try {
48
+ const { dates: h, locations: s } = await t(e, B.current, l.signal);
49
+ if (W.current !== e) return;
50
+ const n = h.filter((r) => r.display).map((r) => ({ text: r.text, display: r.display }));
51
+ L(n), v(s.map((r) => r.text).filter((r) => r.trim().length > 0));
52
+ const $ = n.map((r) => `${r.text}=${r.display}`).join("|");
53
+ n.length > 0 && $ !== z.current && (z.current = $, H(n[n.length - 1].text), C.current != null && window.clearTimeout(C.current), C.current = window.setTimeout(() => H(""), 2e3)), n.length === 0 && (z.current = "");
54
+ } catch {
55
+ }
56
+ }, []), _ = b((t, e, l) => {
57
+ W.current = t;
58
+ const m = U.current.analyze;
59
+ m && !l && (E.current != null && window.clearTimeout(E.current), E.current = window.setTimeout(async () => {
60
+ const h = ++M.current;
61
+ try {
62
+ const s = await m(t, e);
63
+ if (h !== M.current) return;
64
+ const n = O.current, $ = n.getTextarea();
65
+ if (!$ || $.value !== t) return;
66
+ const r = ($.selectionStart ?? e) === t.length, p = n.hasAtQuery, S = n.isPickerOpen(), G = s.suggestions ?? [], J = s.locationExpected && p ? G.filter((g) => g.kind === "location") : [], { enableHashDatePicker: nt = !1, datePresets: rt = ["amanhã", "depois de amanhã", "próxima semana"] } = j.current;
67
+ if (r && !S && (J.length > 0 || s.dateExpected)) {
68
+ const g = [];
69
+ if (s.locationExpected && p) {
70
+ for (const w of J)
71
+ g.push({ key: `loc:${w.value}`, label: `📍 ${w.label}`, kind: "namedLocation", insert: w.value });
72
+ g.push({ key: "loc", label: "📍 Local…", kind: "location" });
73
+ }
74
+ if (s.dateExpected) {
75
+ const w = G.filter((R) => R.kind === "date").map((R) => R.value);
76
+ for (const R of w.length > 0 ? w : rt)
77
+ g.push({ key: `date:${R}`, label: `📅 ${R}`, kind: "date", insert: R });
78
+ nt && g.push({ key: "cal", label: "🗓️ Escolher data…", kind: "calendar" });
79
+ }
80
+ if (g.length > 0) {
81
+ d(0), i(g);
82
+ return;
83
+ }
84
+ }
85
+ if (s.locationExpected && s.locationPartialEmpty && s.locationCount < 2 && p && r && !S && n.currentTriggerChar() !== "@") {
86
+ const g = $.selectionStart ?? t.length, w = t.slice(0, g), R = w.length > 0 && !/\s$/.test(w);
87
+ if (!w.endsWith("@")) {
88
+ const N = R ? " @" : "@";
89
+ i(null), n.setDraft(`${w}${N}${t.slice(g)}`), n.focusCaret(g + N.length), requestAnimationFrame(() => {
90
+ const V = n.getTextarea();
91
+ V && n.syncTrigger(V);
92
+ });
93
+ }
94
+ return;
95
+ }
96
+ i(null);
97
+ } catch {
98
+ }
99
+ }, 200)), I.current != null && window.clearTimeout(I.current), I.current = window.setTimeout(() => {
100
+ Q();
101
+ }, 300);
102
+ }, [Q]), tt = b((t) => {
103
+ var l, m;
104
+ const e = t.trim();
105
+ e && ((m = (l = U.current).commitIntent) == null || m.call(l, e, B.current));
106
+ }, []), et = b((t) => {
107
+ if (!o || o.length === 0) return !1;
108
+ if (t.key === "ArrowDown")
109
+ return t.preventDefault(), d((e) => (e + 1) % o.length), !0;
110
+ if (t.key === "ArrowUp")
111
+ return t.preventDefault(), d((e) => (e - 1 + o.length) % o.length), !0;
112
+ if (t.key === "Enter" || t.key === "Tab") {
113
+ t.preventDefault();
114
+ const e = o[f];
115
+ return e && K(e), !0;
116
+ }
117
+ return t.key === "Escape" ? (t.preventDefault(), i(null), !0) : !1;
118
+ }, [o, f, K]);
119
+ return A(() => () => {
120
+ var t;
121
+ E.current != null && window.clearTimeout(E.current), I.current != null && window.clearTimeout(I.current), C.current != null && window.clearTimeout(C.current), (t = F.current) == null || t.abort();
122
+ }, []), {
123
+ predictions: o,
124
+ predictionHighlight: f,
125
+ setPredictionHighlight: d,
126
+ applyPrediction: K,
127
+ clearPredictions: Y,
128
+ resolvedLocations: x,
129
+ resolvedDates: P,
130
+ forceTooltipText: D,
131
+ scheduleAssist: _,
132
+ commit: tt,
133
+ onKeyDown: et,
134
+ resetSession: Z
135
+ };
136
+ }
137
+ k(it, "usePromptAssist");
138
+ function lt(c, u) {
139
+ const y = a(c), [o, i] = T(null);
140
+ return A(() => {
141
+ y.current = c;
142
+ }, [c]), A(() => {
143
+ function f() {
144
+ y.current();
145
+ }
146
+ if (k(f, "tick"), u !== null) {
147
+ const d = setInterval(f, u);
148
+ return i(d), () => {
149
+ clearInterval(d);
150
+ };
151
+ }
152
+ }, [u]), o;
153
+ }
154
+ k(lt, "useInterval");
155
+ function at(c, u, y = 0) {
156
+ const [o, i] = T(y);
157
+ return A(() => {
158
+ const f = c.current;
159
+ if (!f) return;
160
+ const d = new ResizeObserver((x) => {
161
+ const v = x[0];
162
+ v && i(v.contentRect.width);
163
+ });
164
+ return d.observe(f), i(f.getBoundingClientRect().width), () => d.disconnect();
165
+ }, [c, u]), o;
166
+ }
167
+ k(at, "useContainerWidth");
168
+ function ut(c, u, y = 0, o = 0) {
169
+ const [i, f] = T(y), [d, x] = T(o);
170
+ return A(() => {
171
+ const v = c.current;
172
+ if (!v) return;
173
+ const P = new ResizeObserver((L) => {
174
+ const D = L[0];
175
+ D && (x(D.contentRect.height), f(D.contentRect.width));
176
+ });
177
+ return P.observe(v), f(v.getBoundingClientRect().width), () => P.disconnect();
178
+ }, [c, u]), [i, d];
179
+ }
180
+ k(ut, "useContainerRectangle");
181
+ export {
182
+ at as a,
183
+ lt as b,
184
+ it as c,
185
+ ut as u
186
+ };
187
+ //# sourceMappingURL=useContainerWidth-DsNHNR-z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContainerWidth-DsNHNR-z.js","sources":["../src/hooks/usePromptAssist.ts","../src/hooks/useIntervalHook.ts","../src/hooks/useContainerWidth.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type KeyboardEvent } from 'react';\nimport type { PromptAnalysis, PromptResolution } from '../services/httpPromptAssistService';\n\n/** A dropdown item. `namedLocation` inserts `@Name` directly; `location`/`calendar` insert `@`/`#` and open the picker. */\nexport type PredictionItem = {\n key: string;\n label: string;\n kind: 'location' | 'namedLocation' | 'date' | 'calendar';\n insert?: string;\n};\n\nexport type ResolvedDateItem = { text: string; display: string };\n\n/** The DOM operations the hook needs from its host composer — so the same logic drives PromptV2 and PromptComposer. */\nexport interface PromptAssistAdapter {\n getTextarea: () => HTMLTextAreaElement | null;\n /** Replace the draft value (host owns the React state). */\n setDraft: (next: string) => void;\n /** After a programmatic edit, focus the textarea and place the caret (host defers a frame if needed). */\n focusCaret: (pos: number) => void;\n /** Re-detect the `@`/`#` trigger at the caret and open the matching picker (host's existing flow). */\n syncTrigger: (ta: HTMLTextAreaElement) => void;\n /** Is a location/date picker already open? (suppresses the predictions dropdown / auto-`@`) */\n isPickerOpen: () => boolean;\n /** The trigger char of any open picker, or null — used to avoid re-inserting `@`. */\n currentTriggerChar: () => string | null;\n /** Whether the `@` location fetcher is wired (else no auto-`@` / generic \"Local…\"). */\n hasAtQuery: boolean;\n}\n\nexport interface PromptAssistFetchers {\n analyze?: (text: string, caret: number) => Promise<PromptAnalysis>;\n resolveDates?: (text: string, sessionId?: string, signal?: AbortSignal) => Promise<PromptResolution>;\n commitIntent?: (text: string, sessionId?: string) => void;\n}\n\nexport interface PromptAssistOptions {\n enableHashDatePicker?: boolean;\n datePresets?: string[];\n}\n\nconst newSessionId = () =>\n typeof crypto !== 'undefined' && crypto.randomUUID ? crypto.randomUUID() : `s-${Date.now()}-${Math.random()}`;\n\n/**\n * Headless prompt-assist logic shared by the chat composer (PromptV2) and the home composer (obtapp PromptComposer):\n * the analyze quick pass (auto-`@` + combined predictions dropdown), the resolve slow pass (date resolution +\n * mapped-location chips), commit-on-send learning, and keyboard nav — all with NO rendering/anchoring assumptions.\n * The host provides its DOM ops via {@link PromptAssistAdapter} and renders the returned `predictions` however it wants.\n */\nexport function usePromptAssist(\n adapter: PromptAssistAdapter,\n fetchers: PromptAssistFetchers,\n options: PromptAssistOptions = {},\n) {\n const [predictions, setPredictions] = useState<PredictionItem[] | null>(null);\n const [predictionHighlight, setPredictionHighlight] = useState(0);\n const [resolvedLocations, setResolvedLocations] = useState<string[]>([]);\n const [resolvedDates, setResolvedDates] = useState<ResolvedDateItem[]>([]);\n // The date text whose marker tooltip should auto-open (set on a NEW resolution, cleared after 2s) — identical\n // to PromptV2's behavior so both composers surface a freshly-resolved date the same way.\n const [forceTooltipText, setForceTooltipText] = useState('');\n const lastResolvedKeyRef = useRef('');\n const tooltipTimerRef = useRef<number | null>(null);\n\n // Latest adapter/fetchers/options via refs — the debounced callbacks must not capture stale closures.\n const adapterRef = useRef(adapter); adapterRef.current = adapter;\n const fetchersRef = useRef(fetchers); fetchersRef.current = fetchers;\n const optionsRef = useRef(options); optionsRef.current = options;\n\n const analyzeTimerRef = useRef<number | null>(null);\n const resolveTimerRef = useRef<number | null>(null);\n const analyzeSeqRef = useRef(0);\n const draftRef = useRef('');\n const lastResolveTextRef = useRef<string | null>(null);\n const resolveAbortRef = useRef<AbortController | null>(null);\n const sessionIdRef = useRef<string>(newSessionId());\n\n const clearPredictions = useCallback(() => setPredictions(null), []);\n\n /** Call when the draft empties (send / reseed): clear mapped data and start a fresh learning session. */\n const resetSession = useCallback(() => {\n setResolvedLocations([]);\n setResolvedDates([]);\n setForceTooltipText('');\n lastResolvedKeyRef.current = '';\n lastResolveTextRef.current = null;\n sessionIdRef.current = newSessionId();\n }, []);\n\n const applyPrediction = useCallback((p: PredictionItem) => {\n setPredictions(null);\n const ad = adapterRef.current;\n const ta = ad.getTextarea();\n if (!ta) return;\n const caret = ta.selectionStart ?? ta.value.length;\n const before = ta.value.slice(0, caret);\n const after = ta.value.slice(caret);\n const needsSpace = before.length > 0 && !/\\s$/.test(before);\n\n if (p.kind === 'date') {\n const ins = `${needsSpace ? ' ' : ''}${p.insert} `;\n ad.setDraft(`${before}${ins}${after}`);\n ad.focusCaret(before.length + ins.length);\n return;\n }\n if (p.kind === 'namedLocation' && p.insert) {\n // A specific place → finished \"@\" mention (NBSP-joined so a multi-word name stays one chip / one mention).\n const mention = `@${p.insert.replace(/ /g, String.fromCharCode(0xA0))}`;\n const ins = `${needsSpace ? ' ' : ''}${mention} `;\n ad.setDraft(`${before}${ins}${after}`);\n ad.focusCaret(before.length + ins.length);\n return;\n }\n // Generic location / calendar → insert the trigger char and open the host's picker.\n const chr = p.kind === 'location' ? '@' : '#';\n const ins = `${needsSpace ? ' ' : ''}${chr}`;\n ad.setDraft(`${before}${ins}${after}`);\n ad.focusCaret(before.length + ins.length);\n requestAnimationFrame(() => { const t = ad.getTextarea(); if (t) ad.syncTrigger(t); });\n }, []);\n\n const runResolve = useCallback(async () => {\n const resolve = fetchersRef.current.resolveDates;\n if (!resolve) return;\n const text = draftRef.current;\n if (text.trim() === '') { lastResolveTextRef.current = null; return; }\n if (text === lastResolveTextRef.current) return; // unchanged since last call\n lastResolveTextRef.current = text;\n resolveAbortRef.current?.abort();\n const ac = new AbortController();\n resolveAbortRef.current = ac;\n try {\n const { dates, locations } = await resolve(text, sessionIdRef.current, ac.signal);\n if (draftRef.current !== text) return; // moved on while in flight\n const resolved = dates.filter((d) => d.display).map((d) => ({ text: d.text, display: d.display }));\n setResolvedDates(resolved);\n setResolvedLocations(locations.map((l) => l.text).filter((t) => t.trim().length > 0));\n // Auto-open the newest date's tooltip for 2s (only when the resolution set actually changed).\n const key = resolved.map((r) => `${r.text}=${r.display}`).join('|');\n if (resolved.length > 0 && key !== lastResolvedKeyRef.current) {\n lastResolvedKeyRef.current = key;\n setForceTooltipText(resolved[resolved.length - 1].text);\n if (tooltipTimerRef.current != null) window.clearTimeout(tooltipTimerRef.current);\n tooltipTimerRef.current = window.setTimeout(() => setForceTooltipText(''), 2000);\n }\n if (resolved.length === 0) lastResolvedKeyRef.current = '';\n } catch { /* ignore — includes AbortError from a superseded call */ }\n }, []);\n\n /** Call from the textarea's onChange. Runs the debounced analyze (200ms) + resolve (300ms) passes. */\n const scheduleAssist = useCallback((value: string, caret: number, isDeletion: boolean) => {\n draftRef.current = value;\n const analyze = fetchersRef.current.analyze;\n if (analyze && !isDeletion) {\n if (analyzeTimerRef.current != null) window.clearTimeout(analyzeTimerRef.current);\n analyzeTimerRef.current = window.setTimeout(async () => {\n const seq = ++analyzeSeqRef.current;\n try {\n const a = await analyze(value, caret);\n if (seq !== analyzeSeqRef.current) return;\n const ad = adapterRef.current;\n const live = ad.getTextarea();\n if (!live || live.value !== value) return;\n\n const caretEnd = (live.selectionStart ?? caret) === value.length;\n const canLoc = ad.hasAtQuery;\n const pickerOpen = ad.isPickerOpen();\n const named = a.suggestions ?? [];\n const namedLocs = a.locationExpected && canLoc ? named.filter((s) => s.kind === 'location') : [];\n const { enableHashDatePicker = false, datePresets = ['amanhã', 'depois de amanhã', 'próxima semana'] } = optionsRef.current;\n\n // Dropdown only when it has real value (named locations and/or a date slot); else fall to auto-'@'.\n if (caretEnd && !pickerOpen && (namedLocs.length > 0 || a.dateExpected)) {\n const items: PredictionItem[] = [];\n if (a.locationExpected && canLoc) {\n for (const s of namedLocs)\n items.push({ key: `loc:${s.value}`, label: `📍 ${s.label}`, kind: 'namedLocation', insert: s.value });\n items.push({ key: 'loc', label: '📍 Local…', kind: 'location' });\n }\n if (a.dateExpected) {\n const nd = named.filter((s) => s.kind === 'date').map((s) => s.value);\n for (const d of (nd.length > 0 ? nd : datePresets))\n items.push({ key: `date:${d}`, label: `📅 ${d}`, kind: 'date', insert: d });\n if (enableHashDatePicker) items.push({ key: 'cal', label: '🗓️ Escolher data…', kind: 'calendar' });\n }\n if (items.length > 0) { setPredictionHighlight(0); setPredictions(items); return; }\n }\n\n // Auto-'@': a location slot with no richer dropdown (fresh origin or later slot w/o history).\n if (a.locationExpected && a.locationPartialEmpty && a.locationCount < 2\n && canLoc && caretEnd && !pickerOpen && ad.currentTriggerChar() !== '@') {\n const c = live.selectionStart ?? value.length;\n const before = value.slice(0, c);\n const needsSpace = before.length > 0 && !/\\s$/.test(before);\n if (!before.endsWith('@')) {\n const insert = needsSpace ? ' @' : '@';\n setPredictions(null);\n ad.setDraft(`${before}${insert}${value.slice(c)}`);\n ad.focusCaret(c + insert.length);\n requestAnimationFrame(() => { const t = ad.getTextarea(); if (t) ad.syncTrigger(t); });\n }\n return;\n }\n\n setPredictions(null);\n } catch { /* transient — ignore */ }\n }, 200);\n }\n\n if (resolveTimerRef.current != null) window.clearTimeout(resolveTimerRef.current);\n resolveTimerRef.current = window.setTimeout(() => { void runResolve(); }, 300);\n }, [runResolve]);\n\n /** Call on send with the FINAL text (NBSP-preserving) so the server learns the committed intent. */\n const commit = useCallback((finalText: string) => {\n const t = finalText.trim();\n if (t) fetchersRef.current.commitIntent?.(t, sessionIdRef.current);\n }, []);\n\n /** Wire to the textarea's onKeyDown; returns true if it handled the key (host should then stop). */\n const onKeyDown = useCallback((e: KeyboardEvent<HTMLTextAreaElement>): boolean => {\n if (!predictions || predictions.length === 0) return false;\n if (e.key === 'ArrowDown') { e.preventDefault(); setPredictionHighlight((i) => (i + 1) % predictions.length); return true; }\n if (e.key === 'ArrowUp') { e.preventDefault(); setPredictionHighlight((i) => (i - 1 + predictions.length) % predictions.length); return true; }\n if (e.key === 'Enter' || e.key === 'Tab') { e.preventDefault(); const it = predictions[predictionHighlight]; if (it) applyPrediction(it); return true; }\n if (e.key === 'Escape') { e.preventDefault(); setPredictions(null); return true; }\n return false;\n }, [predictions, predictionHighlight, applyPrediction]);\n\n useEffect(() => () => {\n if (analyzeTimerRef.current != null) window.clearTimeout(analyzeTimerRef.current);\n if (resolveTimerRef.current != null) window.clearTimeout(resolveTimerRef.current);\n if (tooltipTimerRef.current != null) window.clearTimeout(tooltipTimerRef.current);\n resolveAbortRef.current?.abort();\n }, []);\n\n return {\n predictions, predictionHighlight, setPredictionHighlight,\n applyPrediction, clearPredictions,\n resolvedLocations, resolvedDates, forceTooltipText,\n scheduleAssist, commit, onKeyDown, resetSession,\n };\n}\n","import { useEffect, useRef, useState } from \"react\";\n\n// Custom useInterval hook\nfunction useInterval(callback: () => void, delay: number) {\n const savedCallback = useRef(callback);\n const [intervalId, setIntervalId] = useState<NodeJS.Timeout | null>(null)\n\n // Remember the latest callback.\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== null) {\n const id = setInterval(tick, delay);\n setIntervalId(id)\n return () => {\n\n clearInterval(id); // Cleanup function\n }\n }\n }, [delay]);\n\n return intervalId;\n}\n\nexport default useInterval","import { useState, useEffect } from \"react\";\n\nexport function useContainerWidth(ref: React.RefObject<HTMLElement | null>, renderId: string, initialWidth = 0) {\n const [width, setWidth] = useState(initialWidth);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setWidth(entry.contentRect.width);\n });\n\n observer.observe(el);\n setWidth(el.getBoundingClientRect().width);\n\n return () => observer.disconnect();\n }, [ref, renderId]);\n\n return width;\n}\n\nexport function useContainerRectangle(ref: React.RefObject<HTMLElement | null>, renderId: string, initialWidth = 0, initialHeight = 0) {\n const [width, setWidth] = useState(initialWidth);\n const [height, setHeight] = useState(initialHeight);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) {\n setHeight(entry.contentRect.height);\n setWidth(entry.contentRect.width);\n }\n });\n\n observer.observe(el);\n setWidth(el.getBoundingClientRect().width);\n\n return () => observer.disconnect();\n }, [ref, renderId]);\n\n return [width, height];\n}"],"names":["newSessionId","__name","usePromptAssist","adapter","fetchers","options","predictions","setPredictions","useState","predictionHighlight","setPredictionHighlight","resolvedLocations","setResolvedLocations","resolvedDates","setResolvedDates","forceTooltipText","setForceTooltipText","lastResolvedKeyRef","useRef","tooltipTimerRef","adapterRef","fetchersRef","optionsRef","analyzeTimerRef","resolveTimerRef","analyzeSeqRef","draftRef","lastResolveTextRef","resolveAbortRef","sessionIdRef","clearPredictions","useCallback","resetSession","applyPrediction","p","ad","ta","caret","before","after","needsSpace","ins","mention","chr","t","runResolve","resolve","text","_a","ac","dates","locations","resolved","d","l","key","scheduleAssist","value","isDeletion","analyze","seq","a","live","caretEnd","canLoc","pickerOpen","named","namedLocs","s","enableHashDatePicker","datePresets","items","nd","c","insert","commit","finalText","_b","onKeyDown","e","i","it","useEffect","useInterval","callback","delay","savedCallback","intervalId","setIntervalId","tick","id","useContainerWidth","ref","renderId","initialWidth","width","setWidth","el","observer","entries","entry","useContainerRectangle","initialHeight","height","setHeight"],"mappings":";;;AAyCA,MAAMA,IAAe,gBAAAC,EAAA,MACjB,OAAO,SAAW,OAAe,OAAO,aAAa,OAAO,WAAA,IAAe,KAAK,KAAK,IAAA,CAAK,IAAI,KAAK,QAAQ,IAD1F;AASd,SAASC,GACZC,GACAC,GACAC,IAA+B,CAAA,GACjC;AACE,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAkC,IAAI,GACtE,CAACC,GAAqBC,CAAsB,IAAIF,EAAS,CAAC,GAC1D,CAACG,GAAmBC,CAAoB,IAAIJ,EAAmB,CAAA,CAAE,GACjE,CAACK,GAAeC,CAAgB,IAAIN,EAA6B,CAAA,CAAE,GAGnE,CAACO,GAAkBC,CAAmB,IAAIR,EAAS,EAAE,GACrDS,IAAqBC,EAAO,EAAE,GAC9BC,IAAkBD,EAAsB,IAAI,GAG5CE,IAAaF,EAAOf,CAAO;AAAG,EAAAiB,EAAW,UAAUjB;AACzD,QAAMkB,IAAcH,EAAOd,CAAQ;AAAG,EAAAiB,EAAY,UAAUjB;AAC5D,QAAMkB,IAAaJ,EAAOb,CAAO;AAAG,EAAAiB,EAAW,UAAUjB;AAEzD,QAAMkB,IAAkBL,EAAsB,IAAI,GAC5CM,IAAkBN,EAAsB,IAAI,GAC5CO,IAAgBP,EAAO,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e,GAAG;AAC5G,QAAM,CAACC,GAAOC,CAAQ,IAAIxF,EAASsF,CAAY;AAE/C,SAAAZ,EAAU,MAAM;AACZ,UAAMe,IAAKL,EAAI;AACf,QAAI,CAACK,EAAI;AAET,UAAMC,IAAW,IAAI,eAAe,CAACC,MAAY;AAC7C,YAAMC,IAAQD,EAAQ,CAAC;AACvB,MAAIC,KAAOJ,EAASI,EAAM,YAAY,KAAK;AAAA,IAC/C,CAAC;AAED,WAAAF,EAAS,QAAQD,CAAE,GACnBD,EAASC,EAAG,sBAAA,EAAwB,KAAK,GAElC,MAAMC,EAAS,WAAA;AAAA,EAC1B,GAAG,CAACN,GAAKC,CAAQ,CAAC,GAEXE;AACX;AAnBgB9F,EAAA0F,IAAA;AAqBT,SAASU,GAAsBT,GAA0CC,GAAkBC,IAAe,GAAGQ,IAAgB,GAAG;AACnI,QAAM,CAACP,GAAOC,CAAQ,IAAIxF,EAASsF,CAAY,GACzC,CAACS,GAAQC,CAAS,IAAIhG,EAAS8F,CAAa;AAElD,SAAApB,EAAU,MAAM;AACZ,UAAMe,IAAKL,EAAI;AACf,QAAI,CAACK,EAAI;AAET,UAAMC,IAAW,IAAI,eAAe,CAACC,MAAY;AAC7C,YAAMC,IAAQD,EAAQ,CAAC;AACvB,MAAIC,MACAI,EAAUJ,EAAM,YAAY,MAAM,GAClCJ,EAASI,EAAM,YAAY,KAAK;AAAA,IAExC,CAAC;AAED,WAAAF,EAAS,QAAQD,CAAE,GACnBD,EAASC,EAAG,sBAAA,EAAwB,KAAK,GAElC,MAAMC,EAAS,WAAA;AAAA,EAC1B,GAAG,CAACN,GAAKC,CAAQ,CAAC,GAEX,CAACE,GAAOQ,CAAM;AACzB;AAvBgBtG,EAAAoG,IAAA;"}
package/dist/utils.js CHANGED
@@ -1,49 +1,51 @@
1
- import { A as e, D as r, l as t, n as i, o, q as n, r as c, s as d, t as A, u as l } from "./environmentUtils-BaKw5_VD.js";
2
- import { A as U, a as g, b as E, G as m, d as p, c as S, e as B, f as v, g as L, h as N, i as D, j as _, k as f, l as C, m as b, n as x, o as O, p as h, q as G, r as V, s as T, t as u, u as F, v as R } from "./auth-CcTgInbY.js";
3
- import { S as k, c as y, e as M, a as q, i as P, p as j, b as w, s as H, g as J } from "./sortable-table-DgQHxWIh.js";
1
+ import { A as e, D as t, l as r, n as i, o, q as n, r as c, s as d, t as l, u as A } from "./environmentUtils-BaKw5_VD.js";
2
+ import { A as g, a as U, b as E, G as p, d as m, c as S, e as B, f as L, g as h, h as v, i as N, j as D, k as _, l as f, m as C, n as b, o as x, p as O, q as G, r as V, s as F, t as T, u as k, v as u } from "./auth-DbmLacBc.js";
3
+ import { S as W, c as y, a as M, e as q, b as H, i as P, p as j, d as w, s as z, h as J, t as K } from "./promptHighlight-BHSQkdFs.js";
4
4
  export {
5
- U as ALLOWED_DOMAINS,
6
- g as ALLOWED_EMAILS,
5
+ g as ALLOWED_DOMAINS,
6
+ U as ALLOWED_EMAILS,
7
7
  e as ANALYTICS_AGENT_NAME,
8
8
  E as AUTH_CONFIG,
9
- r as DEV_SERVER_CONFIG,
10
- m as GOOGLE_CLIENT_ID,
11
- k as SortableTable,
12
- y as chunkArray,
13
- p as dateReviver,
9
+ t as DEV_SERVER_CONFIG,
10
+ p as GOOGLE_CLIENT_ID,
11
+ W as SortableTable,
12
+ y as chipLocations,
13
+ M as chunkArray,
14
+ m as dateReviver,
14
15
  S as decodeBase64,
15
16
  B as decodeUri,
16
- v as decodeUriFromPython,
17
- L as encodeBase64,
18
- N as encodeUri,
19
- M as extractInteractionId,
20
- q as extractLinkAction,
21
- D as getAgentBaseUrl,
22
- t as getAgentServerBaseUrl,
23
- _ as getArtifactsBaseUrl,
24
- f as getDotNetBaseUrl,
17
+ L as decodeUriFromPython,
18
+ h as encodeBase64,
19
+ v as encodeUri,
20
+ q as extractInteractionId,
21
+ H as extractLinkAction,
22
+ N as getAgentBaseUrl,
23
+ r as getAgentServerBaseUrl,
24
+ D as getArtifactsBaseUrl,
25
+ _ as getDotNetBaseUrl,
25
26
  i as getEnvVar,
26
27
  o as getEnvironmentInfo,
27
- C as getIconByName,
28
+ f as getIconByName,
28
29
  n as getRandomUUID,
29
30
  c as getServerBaseUrl,
30
31
  d as getServerClientBaseUrl,
31
- b as iconCategories,
32
- x as isBase64Encoded,
33
- A as isServer,
34
- O as isUriEncoded,
32
+ C as iconCategories,
33
+ b as isBase64Encoded,
34
+ l as isServer,
35
+ x as isUriEncoded,
35
36
  P as isValidInteractionId,
36
- h as isValidUri,
37
+ O as isValidUri,
37
38
  G as materialIcons,
38
39
  j as parseAndValidateArtifactUrl,
39
40
  V as parseArtifactFromJson,
40
41
  w as parseKnownNumbers,
41
- T as parseUriParams,
42
- l as resolveApiUrl,
43
- u as searchIcons,
44
- F as setEbiContextData,
45
- R as setEbiContextSessionId,
46
- H as splitBigLinesWithSpaces,
47
- J as startsWithInteractionId
42
+ F as parseUriParams,
43
+ A as resolveApiUrl,
44
+ T as searchIcons,
45
+ k as setEbiContextData,
46
+ u as setEbiContextSessionId,
47
+ z as splitBigLinesWithSpaces,
48
+ J as startsWithInteractionId,
49
+ K as tokenizeForHighlight
48
50
  };
49
51
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aintela/chat",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"file":"sortable-table-DgQHxWIh.js","sources":["../src/utils/urlParser.ts","../src/utils/stringUtils.ts","../src/utils/interactionIdChecker.ts","../src/utils/sortable-table.js"],"sourcesContent":["export const parseAndValidateArtifactUrl = (url: string): string | null => {\n if (url[0] == \"#\")\n return null;\n\n const urlParts = url.split(\"/\");\n let lastPart = urlParts[urlParts.length - 1];\n if (lastPart == \"\" && urlParts.length > 1)\n lastPart = urlParts[urlParts.length - 2];\n if (lastPart == \"\")\n return null;\n\n const removedUrlParams = lastPart.split(\"?\")[0];\n const removedUrlHash = removedUrlParams.startsWith(\"#\") ? removedUrlParams : removedUrlParams.split(\"#\")[0];\n const stripExtension = removedUrlHash;\n return stripExtension;\n}\n\n/*\nlink can be:\n#openartifact:qual-é-o-valor-total-de-tarifas-em-maio?\n#openartifact:e97c89936040425cba07d42a4e89c2bb_valor_medio_por_num_passageiros.png\n#openartifact:http://localhost:8000/static/artifacts/e97c89936040425cba07d42a4e89c2bb_valor_medio_por_num_passageiros.png\n\ncontent can be:\nQual é o valor total de tarifas em maio?\n*/\n// export const extractLinkAction = (link: string, content: string | null): { artifactId: string | null, question: string | null } => {\n\n// const parts = link.split(\"-\");\n// if (parts[0] && parts[0] == \"#openartifact\") {\n// const artifactId = decodeURIComponent(parts.slice(1).join(\"-\"));\n// if (artifactId == \"\") {\n// return { artifactId: null, question: null };\n// }\n// else {\n// return { artifactId: artifactId, question: null };\n// }\n// }\n// else if (link[0] !== \"#\") {\n// return { artifactId: null, question: null };\n// }\n// else {\n// if (!content) {\n// const extractedArtifactId = parseAndValidateArtifactUrl(link);\n// if (extractedArtifactId) {\n// return { artifactId: extractedArtifactId, question: null };\n// }\n// else if (isValidUri(link)) { //to not transform a mal formed full URL into a question\n// return { artifactId: null, question: null };\n// }\n// }\n// }\n// content = content == \"\" ? null : content;\n// if (link || content) {\n// return { artifactId: null, question: content ?? link };\n// }\n// else {\n// console.warn(\"Unknown link format: \", link, content);\n// return { artifactId: null, question: null };\n// }\n// }\n\nexport type LinkAction = 'Export' | 'Question' | 'OpenDashboard' | 'URL'\n\nexport const extractLinkAction = (link: string, sessionId: string, content: string | null): { action: LinkAction, url: string | null, question: string | null, parameter: string | null } => {\n let action: LinkAction = 'URL';\n let question: string | null = null;\n let url: string | null = null;\n let parameter: string | null = null;\n if (link[0] == '#') {\n const firstDash = link.indexOf(\"-\");\n const firstPart = link.slice(1, firstDash);\n parameter = link.slice(firstDash + 1);\n switch (firstPart.toLowerCase()) {\n case \"opendashboard\":\n action = 'OpenDashboard'\n break;\n case \"ask\":\n action = 'Question'\n question = content\n break;\n }\n }\n else {\n if (link.indexOf(\"http\") > -1) {\n action = 'URL'\n url = link\n }\n else {\n link = link.replaceAll(\"exported/\", `exported/${sessionId}/`)\n action = 'Export'\n }\n }\n\n return { action, url, question, parameter }\n}","export const chunkArray = (char: string[], size: number): string[][] =>\n Array.from({ length: Math.ceil(char.length / size) }, (_v, i) =>\n char.slice(i * size, i * size + size)\n );\n\nexport const splitBigLinesWithSpaces = (content: string): string => {\n // If content already contains newlines or is short, return as-is\n content = content.replaceAll(\"\\\\n\", \"\\n\");\n\n const limit = 90;\n\n const whiteSpaceBreak = content.split(\" \");\n const allWords: string[] = []\n let hadOne = false;\n for (const word of whiteSpaceBreak) {\n if (word.length > limit) {\n hadOne = true;\n const charArray = [...word];\n const chunkedText = chunkArray(charArray, limit);\n const chunkedWord = chunkedText.map(chunk => chunk.join(\"\")).join(\"\\n\");\n allWords.push(chunkedWord);\n }\n else {\n allWords.push(word);\n }\n }\n\n return hadOne ? allWords.join(\" \") : content;\n}\n\nexport function parseRawNumber(text: string): number {\n let number = parseFloat(text);\n if (!isNaN(number)) {\n text = text.replaceAll(/[,\\.]/g, '');\n return parseInt(text);\n }\n\n var finalNumber = \"\"\n for (const char of text) {\n if (char.match(/[0-9]/)) {\n finalNumber += char;\n }\n }\n\n const ratio = finalNumber.length / text.length;\n number = parseInt(finalNumber);\n if (!isNaN(number) && ratio > 0.5) {\n return number;\n }\n\n return NaN;\n}\n\nexport function parseKnownNumbers(text?: string): { prefix?: string, suffix?: string, number?: number } {\n if (!text) return { prefix: undefined, suffix: undefined, number: undefined };\n\n const knownChars = /[$%(\\w?\\$)]/gi;\n const currencySymbol = /[a-z]?\\$/gi;\n\n let prefix = \"\";\n let suffix = \"\";\n\n if (text.match(knownChars)) {\n if (text.indexOf(\"%\") > -1) {\n suffix = \" %\"\n }\n const match = text.match(currencySymbol)\n if (match) {\n prefix = match[0] + \" \";\n }\n }\n\n let number = parseFloat(text);\n\n if (!isNaN(number)) {\n text = text.replaceAll(\".\", '').replaceAll(\",\", \".\");\n return { prefix, suffix, number: parseFloat(text) };\n }\n\n var finalNumber = \"\"\n for (const char of text) {\n if (char.match(/[0-9.,]/)) {\n let replacedChar = char;\n if (replacedChar == '.')\n replacedChar = \"\"\n else if (replacedChar == \",\")\n replacedChar = \".\"\n finalNumber += replacedChar;\n }\n }\n\n number = parseFloat(finalNumber);\n if (!isNaN(number)) {\n return { prefix, suffix, number: number };\n }\n\n return { prefix: undefined, suffix: undefined, number: undefined };;\n}","/**\n * Utility function to check if a string starts with an interaction ID (UUID)\n * Supports both formats:\n * - With dashes: ebd067ef-0dbd-49b3-8eff-c54b2a9ff314\n * - Without dashes: 62ec037ae42c439192c64dd112136583\n */\n\n/**\n * Regular expression for UUID with dashes (standard format)\n * Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\nconst UUID_WITH_DASHES_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;\n\n/**\n * Regular expression for UUID without dashes (compact format)\n * Format: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (32 hex characters)\n */\nconst UUID_WITHOUT_DASHES_REGEX = /^[0-9a-f]{32}/i;\n\n/**\n * Check if a string starts with an interaction ID (UUID)\n * @param str - The string to check\n * @returns true if the string starts with a valid UUID, false otherwise\n */\nexport function startsWithInteractionId(str: string): boolean {\n if (!str || typeof str !== 'string') {\n return false;\n }\n\n const interactionId = extractInteractionId(str);\n\n return interactionId === null ? false : str.startsWith(interactionId);\n}\n\n/**\n * Extract the interaction ID from the beginning of a string\n * @param str - The string to extract from\n * @returns The interaction ID if found, null otherwise\n */\nexport function extractInteractionId(str: string): string | null {\n if (!str || typeof str !== 'string') {\n return null;\n }\n\n // Try to match UUID with dashes first\n const withDashesMatch = str.match(UUID_WITH_DASHES_REGEX);\n if (withDashesMatch) {\n return withDashesMatch[0];\n }\n\n // Try to match UUID without dashes\n const withoutDashesMatch = str.match(UUID_WITHOUT_DASHES_REGEX);\n if (withoutDashesMatch) {\n return withoutDashesMatch[0];\n }\n\n return null;\n}\n\nexport function prettiffyFileName(fileName: string) {\n const prettyName = fileName.replaceAll(\"_\", \" \").replaceAll(\"-\", \" \");\n const userRemoved = prettyName.replaceAll(\"user:\", \"\");\n const withNoExtension = userRemoved.replace(/\\.[^/.]+$/, \"\");\n const withNoInteractionId = extractNameFromStringWithInteractionId(withNoExtension).trim();\n if (withNoInteractionId.length > 1)\n return withNoInteractionId[0].toUpperCase() + withNoInteractionId.slice(1);\n else\n return withNoInteractionId;\n}\n\nexport function prettiffyPythonFunctionName(functionName: string) {\n if (functionName.length == 0)\n return functionName;\n\n const prettyName = functionName.replaceAll(\"_\", \" \").replaceAll(\"-\", \" \");\n const withFirstCapitalLetter = prettyName[0].toUpperCase() + prettyName.slice(1);\n\n return withFirstCapitalLetter;\n}\n\nexport function extractNameFromStringWithInteractionId(str: string): string {\n // Try to match UUID with dashes first and remove it\n const withDashesMatch = str.match(UUID_WITH_DASHES_REGEX);\n if (withDashesMatch) {\n return str.replace(withDashesMatch[0], \"\");\n }\n\n // Try to match UUID without dashes\n const withoutDashesMatch = str.match(UUID_WITHOUT_DASHES_REGEX);\n if (withoutDashesMatch) {\n return str.replace(withoutDashesMatch[0], \"\");\n }\n\n return str;\n}\n\n/**\n * Check if a string is a valid interaction ID (UUID) on its own\n * @param str - The string to check\n * @returns true if the string is a valid UUID, false otherwise\n */\nexport function isValidInteractionId(str: string): boolean {\n if (!str || typeof str !== 'string') {\n return false;\n }\n\n // Check if it's exactly a UUID with dashes\n if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(str)) {\n return true;\n }\n\n // Check if it's exactly a UUID without dashes\n if (/^[0-9a-f]{32}$/i.test(str)) {\n return true;\n }\n\n return false;\n}\n","/**\n * SortableTable - A pure JavaScript library for making tables sortable\n * \n * Features:\n * - Automatically scans document for tables\n * - Supports tables with or without thead elements (converts first row to header if needed)\n * - Adds Material UI icons to column headers\n * - Supports text, number, and date sorting\n * - Visual feedback for sort direction\n * - Preserves existing table styling\n */\n\nconst initializedTables = new Set(); // Track which tables have been initialized\n\nimport { parseRawNumber } from './stringUtils';\n\nclass SortableTable {\n constructor(options = {}) {\n this.options = {\n // CSS class for sortable headers\n sortableClass: 'sortable-header',\n // CSS class for active sort\n activeSortClass: 'active-sort',\n // CSS class for ascending sort\n ascendingClass: 'sort-asc',\n // CSS class for descending sort\n descendingClass: 'sort-desc',\n // Icon for unsorted state\n unsortedIcon: 'unfold_more',\n // Icon for ascending sort\n ascendingIcon: 'keyboard_arrow_up',\n // Icon for descending sort\n descendingIcon: 'keyboard_arrow_down',\n // Whether to sort on first click (true) or cycle through states (false)\n sortOnFirstClick: true,\n // Custom sort functions for specific columns\n customSorters: {},\n // Columns to exclude from sorting (0-based index)\n excludeColumns: [],\n // Whether to preserve existing icons in headers\n preserveExistingIcons: false,\n // Enable column resizing\n enableResizing: true,\n // Enable column reordering\n enableReordering: true,\n // CSS class for resizable columns\n resizableClass: 'resizable-column',\n // CSS class for draggable columns\n draggableClass: 'draggable-column',\n // CSS class for drag placeholder\n dragPlaceholderClass: 'drag-placeholder',\n // CSS class for drag over state\n dragOverClass: 'drag-over',\n theme: {\n palette: {\n primary: {\n main: '#999',\n },\n background: {\n default: '#fff',\n paper: '#555',\n },\n text: {\n primary: \"#000\",\n secondary: \"#999\",\n disabled: \"#BBB\",\n },\n surface: {\n panel: \"#999\",\n raised: \"#999\",\n hover: \"#444\",\n },\n divider: \"#999\",\n border: {\n default: \"#999\",\n soft: \"#BBB\",\n },\n },\n shape: {\n borderRadius: 7,\n radiusSm: 1,\n radiusLg: 10,\n },\n },\n ...options\n };\n\n this.tables = [];\n this.sortStates = new Map(); // Track sort state for each table\n this.originalColumnOrder = new Map(); // Track original column order\n this.isDragging = false;\n this.dragSource = null;\n this.dragTarget = null;\n this.charWidth = 0;\n }\n\n /**\n * Initialize the library - scan document for tables and make them sortable\n * @param {HTMLElement} container - Optional container element to limit search scope\n */\n init(container = null) {\n if (this.charWidth == 0)\n this.charWidth = this.getCharWidth(this.options.theme.typography.fontFamily, this.options.theme.typography.fontMono)\n\n this.scanTables(container);\n this.makeTablesSortable();\n this.addStyles();\n }\n\n /**\n * Scan for tables in the document or within a specific container\n * @param {HTMLElement} container - Optional container element to limit search scope\n */\n scanTables(container = null) {\n const searchScope = container || document;\n const tables = searchScope.querySelectorAll('table');\n this.tables = Array.from(tables);\n }\n\n /**\n * Make all found tables sortable\n */\n makeTablesSortable() {\n this.tables.forEach((table, tableIndex) => {\n this.makeTableSortable(table, tableIndex);\n });\n }\n\n /**\n * Make a specific table sortable\n */\n makeTableSortable(table, tableIndex) {\n let thead = table.querySelector('thead');\n let headerRow = null;\n let headers = [];\n\n // Check if table has a proper thead\n if (thead) {\n headerRow = thead.querySelector('tr');\n if (headerRow) {\n headers = headerRow.querySelectorAll('th');\n }\n }\n\n if (headers.length === 0) {\n console.warn('Table has no sortable columns, skipping');\n return;\n }\n // First-time-only arrival animation. ChatPane's effect\n // destroys + re-inits the SortableTable on every `messages`\n // update, so a CSS animation tied to `.sortable-table`\n // alone would replay on each new chunk and feel jittery.\n // The DOM attribute persists across destroy/init cycles\n // (destroy() doesn't touch table attributes), so it cleanly\n // marks \"this table has already arrived once.\"\n const isFirstSortableMount = !table.hasAttribute('data-sortable-arrived');\n // Add sortable-table class for styling\n table.classList.add('sortable-table');\n if (isFirstSortableMount) {\n table.setAttribute('data-sortable-arrived', 'true');\n table.classList.add('sortable-table-arriving');\n // Drop the trigger class after the animation finishes so\n // it can't fire again if the table is somehow re-added to\n // a different DOM position.\n setTimeout(() => {\n table.classList.remove('sortable-table-arriving');\n }, 400);\n }\n\n // Calculate intelligent table width based on header text length\n //const calculatedWidth = this.calculateTableWidth(table);\n // table.style.width = 'auto';\n // table.style.minWidth = '80%';\n //table.style.tableLayout = 'fixed'; // Use fixed layout to respect manual widths\n\n // Cell styles are now handled by CSS only\n\n // Initialize sort state for this table\n this.sortStates.set(tableIndex, {\n currentColumn: -1,\n direction: 'none'\n });\n\n // Capture the table's pre-transform width once so calculateTableWidth\n // can use it as a floor. Persisted as a data attribute (like\n // data-sortable-arrived) so it survives ChatPane's destroy/init\n // cycle — re-reading on every mount would pick up the inline\n // width left behind by the previous calculation, not the\n // natural width the user originally saw.\n if (!table.hasAttribute('data-original-width')) {\n table.setAttribute('data-original-width', table.getBoundingClientRect().width);\n }\n\n this.applyTableStyles(table);\n\n // Store original column order\n this.originalColumnOrder.set(tableIndex, Array.from(headers).map((_, index) => index));\n\n // Make each header sortable\n headers.forEach((header, columnIndex) => {\n if (this.options.excludeColumns.includes(columnIndex)) {\n return;\n }\n\n this.makeHeaderSortable(header, table, tableIndex, columnIndex);\n });\n\n // Replace exponential values in all cells with full numbers\n this.replaceExponentialValues(table);\n\n // Mark this table as initialized\n initializedTables.add(table);\n }\n\n /**\n * Replace exponential values in table cells with full numbers\n * @param {HTMLElement} table - The table to process\n */\n replaceExponentialValues(table) {\n const tbody = table.querySelector('tbody');\n if (!tbody) return;\n\n const rows = tbody.querySelectorAll('tr');\n rows.forEach(row => {\n const cells = row.querySelectorAll('td, th');\n cells.forEach(cell => {\n const text = cell.textContent.trim();\n const exponentialMatch = text.match(/^([\\d,]+\\.?\\d*)[eE][+-]?(\\d+)$/);\n\n if (exponentialMatch) {\n const base = parseFloat(exponentialMatch[1].replace(/,/g, ''));\n const exponent = parseInt(exponentialMatch[2]);\n const fullNumber = base * Math.pow(10, exponent);\n\n // Format the number with commas for readability\n const formattedNumber = this.formatNumber(fullNumber);\n cell.textContent = formattedNumber;\n }\n });\n });\n }\n\n /**\n * Format a number with commas for readability\n * @param {number} num - The number to format\n * @returns {string} The formatted number\n */\n formatNumber(num) {\n if (num === 0) return '0';\n\n // Handle very large or very small numbers\n if (Math.abs(num) >= 1e12) {\n return (num / 1e12).toFixed(2) + 'T';\n } else if (Math.abs(num) >= 1e9) {\n return (num / 1e9).toFixed(2) + 'B';\n } else if (Math.abs(num) >= 1e6) {\n return (num / 1e6).toFixed(2) + 'M';\n } else if (Math.abs(num) >= 1e3) {\n return (num / 1e3).toFixed(2) + 'K';\n } else if (Math.abs(num) < 0.01 && num !== 0) {\n return num.toExponential(2);\n } else {\n return num.toLocaleString();\n }\n }\n\n /**\n * Convert the first row to a header row\n * @param {HTMLElement} firstRow - The first row to convert\n * @param {HTMLElement} thead - The thead element to append to\n * @param {HTMLElement} tbody - The tbody element to remove from\n * @returns {HTMLElement} The converted header row\n */\n convertRowToHeader(firstRow, thead, tbody) {\n try {\n // Clone the row\n const headerRow = firstRow.cloneNode(true);\n\n // Convert all td elements to th elements\n const cells = headerRow.querySelectorAll('td');\n cells.forEach(td => {\n const th = document.createElement('th');\n\n // Copy all attributes\n Array.from(td.attributes).forEach(attr => {\n th.setAttribute(attr.name, attr.value);\n });\n\n // Copy content\n th.innerHTML = td.innerHTML;\n\n // Copy styles\n th.style.cssText = td.style.cssText;\n\n // Replace td with th\n td.parentNode.replaceChild(th, td);\n });\n\n // Remove the original first row from tbody\n if (tbody && tbody.contains(firstRow)) {\n tbody.removeChild(firstRow);\n } else if (firstRow.parentNode) {\n firstRow.parentNode.removeChild(firstRow);\n }\n\n // Add the header row to thead\n thead.appendChild(headerRow);\n\n return headerRow;\n\n } catch (error) {\n console.error('Error converting row to header:', error);\n return null;\n }\n }\n\n /**\n * Make a specific header sortable\n */\n makeHeaderSortable(header, table, tableIndex, columnIndex) {\n // Add sortable class\n header.classList.add(this.options.sortableClass);\n\n // Add cursor pointer\n header.style.cursor = 'pointer';\n\n // Add sort icon if not preserving existing icons\n if (!this.options.preserveExistingIcons || !header.querySelector('.material-icons')) {\n this.addSortIcon(header);\n }\n\n // Add resizing functionality\n if (this.options.enableResizing) {\n this.addResizing(header, table, tableIndex, columnIndex);\n }\n\n // Add drag and drop functionality\n if (this.options.enableReordering) {\n this.addDragAndDrop(header, table, tableIndex, columnIndex);\n // Note: We rely on header drop targets only for better reliability\n }\n\n const clickListener = (e) => {\n e.preventDefault();\n this.sortTable(table, tableIndex, columnIndex);\n }\n\n const mouseEnterListener = (e) => {\n if (!header.classList.contains(this.options.activeSortClass)) {\n header.style.background = this.options.theme.palette.surface.hover;\n }\n }\n\n const mouseLeaveListener = (e) => {\n if (!header.classList.contains(this.options.activeSortClass)) {\n header.style.background = '';\n }\n }\n\n header.removeEventListener('click', clickListener);\n const resp = header.addEventListener('click', clickListener);\n header.removeEventListener('mouseenter', mouseEnterListener);\n header.addEventListener('mouseenter', mouseEnterListener);\n header.removeEventListener('mouseleave', mouseLeaveListener);\n header.addEventListener('mouseleave', mouseLeaveListener);\n }\n\n /**\n * Add sort icon to header\n */\n addSortIcon(header) {\n if (header.querySelector('.sortable-table-icon')) {\n return;\n }\n\n const icon = document.createElement('i');\n icon.id = 'sortable-table-icon';\n icon.className = 'material-icons';\n icon.textContent = this.options.unsortedIcon;\n icon.style.marginRight = '2px';\n icon.style.fontSize = '12px';\n icon.style.verticalAlign = 'middle';\n // Start invisible, then animate to the resting opacity on a\n // later frame so the existing `.sortable-header .material-icons\n // { transition: opacity 0.2s ease }` rule fades in instead of\n // popping in alongside the rest of the table transformation.\n // Double-rAF guarantees the browser paints the 0 state first;\n // a single rAF can be coalesced into the insertion frame in\n // some engines and skip the transition.\n icon.style.opacity = '0';\n\n const existingIcon = header.querySelector('.material-icons');\n if (!existingIcon) {\n header.insertBefore(icon, header.firstChild);\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n icon.style.opacity = '0.6';\n });\n });\n }\n }\n\n /**\n * Sort table by column\n */\n sortTable(table, tableIndex, columnIndex) {\n const tbody = table.querySelector('tbody');\n if (!tbody) {\n console.warn('Table has no tbody element');\n return;\n }\n\n const rows = Array.from(tbody.querySelectorAll('tr'));\n if (rows.length === 0) {\n console.warn('Table has no data rows');\n return;\n }\n\n const sortState = this.sortStates.get(tableIndex);\n const header = table.querySelector(`thead tr th:nth-child(${columnIndex + 1})`);\n\n // Determine sort direction\n let newDirection;\n if (this.options.sortOnFirstClick) {\n newDirection = sortState.currentColumn === columnIndex && sortState.direction === 'asc' ? 'desc' : 'asc';\n } else {\n if (sortState.currentColumn !== columnIndex) {\n newDirection = 'asc';\n } else {\n newDirection = sortState.direction === 'none' ? 'asc' :\n sortState.direction === 'asc' ? 'desc' : 'none';\n }\n }\n\n // Update sort state\n sortState.currentColumn = columnIndex;\n sortState.direction = newDirection;\n this.sortStates.set(tableIndex, sortState);\n\n // Update visual indicators\n this.updateSortIndicators(table, tableIndex, columnIndex, newDirection);\n\n // If direction is 'none', restore original order\n if (newDirection === 'none') {\n this.restoreOriginalOrder(table, rows);\n return;\n }\n\n // Sort the rows\n const sortedRows = this.sortRows(rows, columnIndex, newDirection);\n\n // Re-append sorted rows\n sortedRows.forEach(row => tbody.appendChild(row));\n }\n\n /**\n * Sort rows based on column data\n */\n sortRows(rows, columnIndex, direction) {\n return rows.sort((a, b) => {\n const cellA = a.cells[columnIndex];\n const cellB = b.cells[columnIndex];\n\n if (!cellA || !cellB) return 0;\n\n const valueA = this.extractValue(cellA);\n const valueB = this.extractValue(cellB);\n\n // Use custom sorter if available\n if (this.options.customSorters[columnIndex]) {\n return this.options.customSorters[columnIndex](valueA, valueB, direction);\n }\n\n // Default sorting logic\n const comparison = this.compareValues(valueA, valueB);\n return direction === 'asc' ? comparison : -comparison;\n });\n }\n\n /**\n * Extract sortable value from cell\n */\n extractValue(cell) {\n let text = cell.textContent.trim();\n\n let number = parseRawNumber(text);\n if (!isNaN(number)) {\n console.log(number);\n return number;\n }\n\n // Remove all material icons and common symbols from the text\n text = text.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\n // Handle N/A, N/D, ND, blank and variants as -1\n const naVariants = /^(N\\/A|N\\/D|ND|N\\/A|n\\/a|n\\/d|nd|N\\/A|N\\/D|ND|\\s*)$/i;\n if (naVariants.test(text)) {\n return -1;\n }\n\n // Try to parse as percentage\n const percentageMatch = text.match(/^([\\d,]+\\.?\\d*)\\s*%$/);\n if (percentageMatch) {\n return parseFloat(percentageMatch[1].replace(/,/g, ''));\n }\n\n // Try to parse as exponential notation (scientific notation)\n const exponentialMatch = text.match(/^([\\d,]+\\.?\\d*)[eE][+-]?(\\d+)$/);\n if (exponentialMatch) {\n const base = parseFloat(exponentialMatch[1].replace(/,/g, ''));\n const exponent = parseInt(exponentialMatch[2]);\n return base * Math.pow(10, exponent);\n }\n\n // Try to parse as number\n const numberMatch = text.match(/^[\\d,]+\\.?\\d*[KMB]?$/);\n if (numberMatch) {\n return this.parseNumber(text);\n }\n\n // Try to parse as currency\n const currencyMatch = text.match(/^R\\$\\s*([\\d,]+\\.?\\d*)$/);\n if (currencyMatch) {\n return this.parseNumber(currencyMatch[1]);\n }\n\n // Try to parse as date\n const date = new Date(text);\n if (!isNaN(date.getTime())) {\n return date.getTime();\n }\n\n // Return as string (case-insensitive)\n return text.toLowerCase();\n }\n\n /**\n * Compare two values for sorting\n */\n compareValues(a, b) {\n // Handle null/undefined values\n if (a == null && b == null) return 0;\n if (a == null) return -1;\n if (b == null) return 1;\n\n // Handle different types\n if (typeof a !== typeof b) {\n return String(a).localeCompare(String(b));\n }\n\n // Handle numbers\n if (typeof a === 'number') {\n return a - b;\n }\n\n // Handle dates\n if (a instanceof Date) {\n return a.getTime() - b.getTime();\n }\n\n // Handle strings\n return a.localeCompare(b);\n }\n\n /**\n * Update visual indicators for sort state\n */\n updateSortIndicators(table, tableIndex, columnIndex, direction) {\n const headers = table.querySelectorAll('thead tr th');\n\n // Reset all headers\n headers.forEach((header, index) => {\n header.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);\n const icon = header.querySelector('.material-icons');\n if (icon) {\n icon.textContent = this.options.unsortedIcon;\n icon.style.opacity = '0.6';\n }\n });\n\n // Update active header\n if (direction !== 'none') {\n const activeHeader = headers[columnIndex];\n activeHeader.classList.add(this.options.activeSortClass);\n\n const icon = activeHeader.querySelector('.material-icons');\n if (icon) {\n if (direction === 'asc') {\n activeHeader.classList.add(this.options.ascendingClass);\n icon.textContent = this.options.ascendingIcon;\n } else {\n activeHeader.classList.add(this.options.descendingClass);\n icon.textContent = this.options.descendingIcon;\n }\n icon.style.opacity = '1';\n }\n }\n }\n\n /**\n * Restore original order (when sort direction is 'none')\n */\n restoreOriginalOrder(table, rows) {\n // This is a simplified implementation\n // In a real scenario, you might want to store the original order\n const tbody = table.querySelector('tbody');\n rows.forEach(row => tbody.appendChild(row));\n }\n\n /**\n * Add resizing functionality to a header\n */\n addResizing(header, table, tableIndex, columnIndex) {\n header.classList.add(this.options.resizableClass);\n header.style.position = 'relative';\n\n\n if (header.querySelector('.resize-handle')) {\n return;\n }\n\n const resizeHandle = document.createElement('div');\n resizeHandle.className = 'resize-handle';\n resizeHandle.style.cssText = `\n position: absolute;\n top: 0;\n right: 0;\n width: 4px;\n height: 100%;\n background: transparent;\n cursor: col-resize;\n z-index: 10;\n `;\n\n header.appendChild(resizeHandle);\n\n let isResizing = false;\n let startX = 0;\n let startWidth = 0;\n\n resizeHandle.addEventListener('mousedown', (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation(); // Prevent sort from triggering\n isResizing = true;\n startX = e.clientX;\n startWidth = header.offsetWidth;\n\n // Add visual feedback\n header.style.borderRight = '2px solid var(--primary-main, #2196F3)';\n header.style.background = 'var(--background-active, rgba(255, 255, 255, 0.1))';\n\n document.addEventListener('mousemove', handleResize);\n document.addEventListener('mouseup', stopResize);\n document.body.style.cursor = 'col-resize';\n document.body.style.userSelect = 'none';\n });\n\n const handleResize = (e) => {\n if (!isResizing) return;\n const newWidth = startWidth + (e.clientX - startX);\n if (newWidth > 30) { // Minimum width\n header.style.width = newWidth + 'px';\n\n // Set the same width on all cells in this column\n const columnIndex = Array.from(header.parentNode.children).indexOf(header);\n const tbody = table.querySelector('tbody');\n if (tbody) {\n const rows = tbody.querySelectorAll('tr');\n rows.forEach(row => {\n const cell = row.children[columnIndex];\n if (cell) {\n cell.style.width = newWidth + 'px';\n }\n });\n }\n\n // Update table width if column width increased\n this.updateTableWidth(table);\n }\n };\n\n const stopResize = () => {\n isResizing = false;\n\n // Remove visual feedback\n header.style.borderRight = '';\n header.style.background = '';\n\n document.removeEventListener('mousemove', handleResize);\n document.removeEventListener('mouseup', stopResize);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n };\n }\n\n /**\n * Add drag and drop functionality to a header\n */\n addDragAndDrop(header, table, tableIndex, columnIndex) {\n if (header.querySelector('.drag-handle')) {\n return;\n }\n\n header.classList.add(this.options.draggableClass);\n header.draggable = true;\n\n const thead = table.querySelector('thead tr');\n\n header.addEventListener('dragstart', (e) => {\n this.isDragging = true;\n // Store the current DOM position, not the original column index\n const currentPosition = Array.from(thead.children).indexOf(header);\n this.dragSource = { table, tableIndex, columnIndex: currentPosition };\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/html', header.outerHTML);\n const headerContent = header.outerHTML;\n header.style.opacity = '0.5';\n\n // Create a custom drag image\n this.createCustomDragImage(e, header, headerContent);\n });\n\n header.addEventListener('dragend', (e) => {\n this.isDragging = false;\n this.dragSource = null;\n header.style.opacity = '';\n // Remove all column highlights\n this.clearAllColumnHighlights(table);\n });\n\n header.addEventListener('dragover', (e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n });\n\n header.addEventListener('dragenter', (e) => {\n e.preventDefault();\n if (this.dragSource && this.dragSource.tableIndex === tableIndex) {\n const currentColumnIndex = Array.from(thead.children).indexOf(header);\n if (this.dragSource.columnIndex !== currentColumnIndex) {\n // Add visual feedback to the entire column\n this.highlightColumn(table, currentColumnIndex, true);\n }\n }\n });\n\n header.addEventListener('dragleave', (e) => {\n // Only remove highlight if we're leaving the entire column\n if (!header.contains(e.relatedTarget)) {\n const currentColumnIndex = Array.from(thead.children).indexOf(header);\n this.highlightColumn(table, currentColumnIndex, false);\n }\n });\n\n header.addEventListener('drop', (e) => {\n e.preventDefault();\n\n if (this.dragSource && this.dragSource.tableIndex === tableIndex) {\n const currentColumnIndex = Array.from(thead.children).indexOf(header);\n if (this.dragSource.columnIndex !== currentColumnIndex) {\n this.reorderColumns(table, tableIndex, this.dragSource.columnIndex, currentColumnIndex);\n }\n }\n\n // Remove all column highlights\n this.clearAllColumnHighlights(table);\n });\n }\n\n /**\n * Create a custom drag image for better UX\n */\n createCustomDragImage(e, header, headerContent) {\n // Create a temporary element for the drag image\n const dragImage = document.createElement('div');\n dragImage.style.cssText = `\n position: absolute;\n top: -1000px;\n left: -1000px;\n background: var(--background-elevated, #333);\n border: 2px solid var(--primary-main, #2196F3);\n border-radius: 4px;\n padding: 8px 12px;\n font-size: 12px;\n font-weight: bold;\n color: var(--text-primary, #fff);\n white-space: nowrap;\n max-width: 150px;\n min-width: 60px;\n overflow: hidden;\n text-overflow: ellipsis;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n z-index: 10000;\n pointer-events: none;\n min-height: 50px;\n display: flex;\n align-items: center;\n `;\n\n // Get the header text without icons and create a compact representation\n const headerText = headerContent;\n dragImage.innerHTML = `\n <div style=\"display: flex; align-items: center; gap: 5px; align-content: center;color:white;\">\n <span style=\"overflow: hidden; text-overflow: ellipsis\">${headerText}</span>\n <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>\n </div> \n `;\n\n // Add to document temporarily\n document.body.appendChild(dragImage);\n\n // Set as drag image with centered offset\n e.dataTransfer.setDragImage(dragImage, 50, 12);\n\n // Clean up after a short delay\n setTimeout(() => {\n if (document.body.contains(dragImage)) {\n document.body.removeChild(dragImage);\n }\n }, 100);\n }\n\n\n\n /**\n * Highlight an entire column during drag operations\n */\n highlightColumn(table, columnIndex, highlight) {\n const thead = table.querySelector('thead tr');\n const tbody = table.querySelector('tbody');\n\n if (!thead || !tbody) return;\n\n const header = thead.children[columnIndex];\n if (!header) return;\n\n if (highlight) {\n header.classList.add(this.options.dragOverClass);\n // Highlight all cells in this column\n const rows = tbody.children;\n for (let i = 0; i < rows.length; i++) {\n const cell = rows[i].children[columnIndex];\n if (cell) {\n cell.classList.add(this.options.dragOverClass);\n }\n }\n } else {\n header.classList.remove(this.options.dragOverClass);\n // Remove highlight from all cells in this column\n const rows = tbody.children;\n for (let i = 0; i < rows.length; i++) {\n const cell = rows[i].children[columnIndex];\n if (cell) {\n cell.classList.remove(this.options.dragOverClass);\n }\n }\n }\n }\n\n /**\n * Clear all column highlights\n */\n clearAllColumnHighlights(table) {\n const thead = table.querySelector('thead tr');\n const tbody = table.querySelector('tbody');\n\n if (!thead || !tbody) return;\n\n // Clear header highlights\n const headers = thead.children;\n for (let i = 0; i < headers.length; i++) {\n headers[i].classList.remove(this.options.dragOverClass);\n }\n\n // Clear cell highlights\n const rows = tbody.children;\n for (let i = 0; i < rows.length; i++) {\n const cells = rows[i].children;\n for (let j = 0; j < cells.length; j++) {\n cells[j].classList.remove(this.options.dragOverClass);\n }\n }\n }\n\n /**\n * Reorder columns in a table\n */\n reorderColumns(table, tableIndex, fromIndex, toIndex) {\n const thead = table.querySelector('thead tr');\n const tbody = table.querySelector('tbody');\n\n if (!thead || !tbody) return;\n\n const headers = Array.from(thead.children);\n const rows = Array.from(tbody.children);\n\n // Validate indices\n if (fromIndex < 0 || fromIndex >= headers.length || toIndex < 0 || toIndex >= headers.length) {\n console.warn('Invalid column indices for reordering');\n return;\n }\n\n // Don't do anything if dropping on the same position\n if (fromIndex === toIndex) {\n return;\n }\n\n // Move the header element directly in the DOM\n const headerToMove = headers[fromIndex];\n const targetHeader = headers[toIndex];\n\n if (fromIndex < toIndex) {\n // Moving right: insert after target\n thead.insertBefore(headerToMove, targetHeader.nextSibling);\n } else {\n // Moving left: insert before target\n thead.insertBefore(headerToMove, targetHeader);\n }\n\n // Move cells in each row\n rows.forEach((row, rowIndex) => {\n const cells = Array.from(row.children);\n const cellToMove = cells[fromIndex];\n const targetCell = cells[toIndex];\n\n if (fromIndex < toIndex) {\n // Moving right: insert after target\n row.insertBefore(cellToMove, targetCell.nextSibling);\n } else {\n // Moving left: insert before target\n row.insertBefore(cellToMove, targetCell);\n }\n });\n\n // Update column order tracking\n const currentOrder = this.originalColumnOrder.get(tableIndex);\n if (currentOrder) {\n const newOrder = [...currentOrder];\n const columnToMove = newOrder[fromIndex];\n newOrder.splice(fromIndex, 1);\n newOrder.splice(toIndex, 0, columnToMove);\n this.originalColumnOrder.set(tableIndex, newOrder);\n }\n\n // Reapply inline styles after reordering\n this.applyTableStyles(table);\n\n // Refresh drag and drop listeners for the reordered columns\n this.refreshDragAndDropListeners(table, tableIndex);\n }\n\n /**\n * Refresh drag and drop listeners after column reordering\n */\n refreshDragAndDropListeners(table, tableIndex) {\n const thead = table.querySelector('thead tr');\n if (!thead) return;\n\n const headers = Array.from(thead.children);\n\n // Remove existing listeners by cloning headers and re-adding all functionality\n headers.forEach((header, columnIndex) => {\n if (header.classList.contains(this.options.draggableClass)) {\n // Clear any drag-related inline styles before cloning\n header.style.opacity = '';\n header.style.background = '';\n header.style.borderRight = '';\n\n const newHeader = header.cloneNode(true);\n header.parentNode.replaceChild(newHeader, header);\n\n // Re-add all functionality (sorting, resizing, drag and drop)\n this.makeHeaderSortable(newHeader, table, tableIndex, columnIndex);\n }\n });\n }\n\n /**\n * Update table width based on current column widths\n */\n updateTableWidth(table) {\n const headers = table.querySelectorAll('th');\n let totalWidth = 0;\n\n headers.forEach(header => {\n const width = header.style.width;\n if (width) {\n const widthValue = parseInt(width.replace('px', ''));\n totalWidth += widthValue;\n } else {\n // Fallback to estimated width if no explicit width set\n const text = header.textContent.replace(/[📊🔍]/g, '').trim();\n totalWidth += text.length;\n }\n });\n\n // Convert to percentage\n table.style.width = `${totalWidth}px`;\n }\n\n /**\n * Calculate intelligent table width based on header text length\n */\n calculateTableWidth(table) {\n const originalWidthAttr = table.getAttribute('data-original-width');\n const originalWidth = originalWidthAttr ? parseFloat(originalWidthAttr) : 0;\n const headers = table.querySelectorAll('th');\n let totalWidth = 0;\n\n const parentWidth = table.parentElement.clientWidth\n\n const headersWidth = [];\n headers.forEach(header => {\n // Get text content without icons\n const text = header.textContent.replace(/[📊🔍]/g, '').trim();\n\n let estimatedWidth = text.length * this.charWidth + 15;\n\n headersWidth.push(estimatedWidth);\n\n totalWidth += estimatedWidth;\n });\n\n const rows = table.querySelectorAll('tr');\n\n const containerWidth = table.parentElement?.getBoundingClientRect().width ?? totalWidth;\n\n var maxRowWidth = 0;\n for (const row of rows) {\n const cells = row.querySelectorAll('td');\n\n cells.forEach((cell, index) => {\n // Get text content without icons\n const text = cell.textContent;\n\n const cellWidth = text.length * this.charWidth + 15;\n if (cellWidth > headersWidth[index] && index < headersWidth.length)\n headersWidth[index] = cellWidth;\n });\n };\n\n maxRowWidth = headersWidth.reduce((prev, current) => prev += current, 0);\n\n headers.forEach((header, index) => {\n if (maxRowWidth > containerWidth) {\n const factor = headersWidth[index] / maxRowWidth;\n header.style.width = `${containerWidth * factor}px`\n }\n else {\n header.style.width = `${headersWidth[index]}px`\n }\n });\n\n // Convert to percentage or pixel value\n let finalWidth = 0\n if (maxRowWidth > containerWidth) {\n finalWidth = `100%`\n }\n else {\n // If the calculated width would shrink the table below its\n // pre-transform rendered width, preserve the original.\n const effectiveWidth = Math.max(maxRowWidth, originalWidth);\n finalWidth = `${effectiveWidth}px`;\n }\n\n return finalWidth;\n }\n\n /**\n * Apply inline styles to ensure text clipping and horizontal scroll work\n */\n applyTableStyles(table) {\n // Force table styles\n const calculatedWidth = this.calculateTableWidth(table);\n // The \"fits comfortably\" branch of calculateTableWidth used\n // to force width: 100%, which made every chat table stretch\n // edge-to-edge regardless of content. Instead, let the table\n // be content-fit (auto) but floor it at 60% of the container\n // so very narrow tables don't look orphaned next to the\n // chat gutter, and cap it at 100% so wider data still fits.\n // The overflow branch still uses the calculated pixel width\n // because it's already wider than the container would allow.\n table.style.width = calculatedWidth;\n table.style.maxWidth = '100%';\n // if (calculatedWidth === '100%') {\n // table.style.width = 'auto';\n // table.style.minWidth = '60%';\n // table.style.maxWidth = '100%';\n // } else {\n // table.style.width = `${calculatedWidth}`;\n // table.style.minWidth = 'auto';\n // table.style.maxWidth = 'auto';\n // }\n // table.style.tableLayout = 'fixed'; // Use fixed layout to respect manual widths\n }\n\n getCharWidth(char, font, mono) {\n // Create a temporary canvas element\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n\n // Set the font (e.g., \"16px Arial\")\n context.fontFamily = font;\n context.fontMono = mono;\n\n // Measure the specific character\n const metrics = context.measureText(\"A \");\n return metrics.width; // Returns width in pixels\n }\n\n /**\n * Add CSS styles for sortable tables\n */\n addStyles() {\n if (document.getElementById('sortable-table-styles')) {\n return; // Styles already added\n }\n\n const style = document.createElement('style');\n style.id = 'sortable-table-styles';\n style.textContent = ` \n .${this.options.sortableClass} {\n position: relative;\n user-select: none;\n transition: background-color 0.2s ease;\n }\n \n .${this.options.sortableClass}:hover {\n background-color: ${this.options.theme.palette.surface.hover} !important;\n }\n \n .${this.options.activeSortClass} {\n background-color: ${this.options.theme.palette.surface.raised} !important;\n font-weight: bold;\n }\n \n .${this.options.ascendingClass} {\n border-bottom: 2px solid var(${this.options.theme.palette.primary.main}, #3a3a3a);\n }\n \n .${this.options.descendingClass} {\n border-bottom: 2px solid var(${this.options.theme.palette.primary.main}, #3a3a3a);\n }\n \n .${this.options.sortableClass} .material-icons {\n transition: opacity 0.2s ease, transform 0.2s ease;\n }\n \n .${this.options.activeSortClass} .material-icons {\n color: var(${this.options.theme.palette.primary.main}, #3a3a3a);\n }\n \n .${this.options.resizableClass} .resize-handle:hover {\n background-color: var(${this.options.theme.palette.primary.light}, #64B5F6);\n }\n \n .${this.options.draggableClass} {\n cursor: move;\n position: relative;\n }\n \n .${this.options.draggableClass}::before {\n content: '';\n position: absolute;\n top: 0;\n left: -5px;\n right: -5px;\n bottom: 0;\n z-index: 1;\n pointer-events: none;\n }\n \n .${this.options.dragOverClass} {\n background-color: rgba(128, 128, 128, 0.2) !important;\n border: 2px dashed rgba(128, 128, 128, 0.8);\n }\n \n .${this.options.draggableClass}:hover {\n background-color: var(${this.options.theme.palette.surface.raised}, rgba(100, 181, 246, 0.1)) !important;\n }\n\n .sortable-table tbody td {\n width: auto\n } \n\n .sortable-table {\n background-color: 'inherit';\n /* Cross-fade bg/row stripes when the .sortable-table\n * class flip lands on a freshly-streamed markdown\n * table. Width is NOT animated: column widths set\n * by calculateTableWidth can be narrower than the\n * content currently fills, so animating them down\n * causes mid-transition cell wrap. Snap widths,\n * animate only colours. */\n transition: background-color 280ms ease-out;\n }\n\n .sortable-table th {\n transition: background-color 280ms ease-out;\n }\n\n /* Zebra striping for table rows */\n .sortable-table tbody tr:nth-child(odd) {\n background-color: ${this.options.theme.palette.background.defalt};\n color: ${this.options.theme.palette.text.primary};\n }\n\n .sortable-table tbody tr:nth-child(even) {\n background-color: ${this.options.theme.palette.background.defalt};\n color: ${this.options.theme.palette.text.primary};\n }\n\n /* One-shot arrival animation. Applied via a transient\n * class (added by makeTableSortable on first mount only)\n * so it does NOT re-fire on every destroy/init cycle.\n * scaleX with origin top-left gives the \"right edge\n * grows outward\" feel the user asked for; the 0.96\n * start is subtle enough that text compression isn't\n * obvious. */\n @keyframes sortable-table-arrive {\n from {\n opacity: 0.35;\n transform: scaleX(0.96);\n transform-origin: top left;\n }\n to {\n opacity: 1;\n transform: scaleX(1);\n }\n }\n\n .sortable-table-arriving {\n animation: sortable-table-arrive 320ms cubic-bezier(0.16, 1, 0.3, 1) both;\n }\n \n /* Ensure hover effects work with zebra striping */\n .sortable-table tbody tr:hover {\n background-color: ${this.options.theme.palette.surface.hover} !important;\n }\n \n /* Fix table-container overflow issue */\n .table-container {\n overflow: auto !important;\n overflow-x: auto !important;\n overflow-y: auto !important;\n }\n `;\n\n const existingStyle = document.getElementById('sortable-table-styles');\n if (!existingStyle) {\n document.head.appendChild(style);\n }\n }\n\n /**\n * Destroy the sortable functionality\n */\n destroy() {\n this.tables.forEach(table => {\n const headers = table.querySelectorAll(`.${this.options.sortableClass}`);\n headers.forEach(header => {\n header.classList.remove(\n this.options.sortableClass,\n this.options.activeSortClass,\n this.options.ascendingClass,\n this.options.descendingClass\n );\n header.style.cursor = '';\n header.style.background = '';\n\n // Remove event listeners by cloning the element\n const newHeader = header.cloneNode(true);\n header.parentNode.replaceChild(newHeader, header);\n });\n });\n\n // Remove styles\n const styleElement = document.getElementById('sortable-table-styles');\n if (styleElement) {\n styleElement.remove();\n }\n\n this.tables = [];\n this.sortStates.clear();\n initializedTables.clear();\n }\n\n /**\n * Refresh the library (useful after DOM changes)\n */\n refresh() {\n this.destroy();\n this.init();\n }\n}\n\n// // Create global instance but don't auto-initialize\n// Guard the global assignment so this module is import-safe outside the\n// browser (Node/SSR/tests). Importing it for the class export alone — as the\n// session-replay decode path does transitively — must not throw on `window`.\nif (typeof window !== 'undefined') {\n window.SortableTable = SortableTable;\n}\n\n// Export for module systems\nexport default SortableTable;\n"],"names":["parseAndValidateArtifactUrl","__name","url","urlParts","lastPart","removedUrlParams","extractLinkAction","link","sessionId","content","action","question","parameter","firstDash","firstPart","chunkArray","char","size","_v","i","splitBigLinesWithSpaces","limit","whiteSpaceBreak","allWords","hadOne","word","charArray","chunkedWord","chunk","parseRawNumber","text","number","finalNumber","ratio","parseKnownNumbers","knownChars","currencySymbol","prefix","suffix","match","replacedChar","UUID_WITH_DASHES_REGEX","UUID_WITHOUT_DASHES_REGEX","startsWithInteractionId","str","interactionId","extractInteractionId","withDashesMatch","withoutDashesMatch","prettiffyFileName","fileName","withNoExtension","withNoInteractionId","extractNameFromStringWithInteractionId","prettiffyPythonFunctionName","functionName","prettyName","isValidInteractionId","initializedTables","_SortableTable","options","container","tables","table","tableIndex","thead","headerRow","headers","isFirstSortableMount","_","index","header","columnIndex","tbody","row","cell","exponentialMatch","base","exponent","fullNumber","formattedNumber","num","firstRow","td","th","attr","error","clickListener","e","mouseEnterListener","mouseLeaveListener","icon","rows","sortState","newDirection","direction","a","b","cellA","cellB","valueA","valueB","comparison","percentageMatch","currencyMatch","date","activeHeader","resizeHandle","isResizing","startX","startWidth","handleResize","stopResize","newWidth","currentPosition","headerContent","currentColumnIndex","dragImage","headerText","highlight","cells","j","fromIndex","toIndex","headerToMove","targetHeader","rowIndex","cellToMove","targetCell","currentOrder","newOrder","columnToMove","newHeader","totalWidth","width","widthValue","_a","originalWidthAttr","originalWidth","headersWidth","estimatedWidth","containerWidth","maxRowWidth","cellWidth","prev","current","factor","finalWidth","calculatedWidth","font","mono","context","style","styleElement","SortableTable"],"mappings":";;AAAO,MAAMA,IAA8B,gBAAAC,EAAA,CAACC,MAA+B;AACvE,MAAIA,EAAI,CAAC,KAAK;AACV,WAAO;AAEX,QAAMC,IAAWD,EAAI,MAAM,GAAG;AAC9B,MAAIE,IAAWD,EAASA,EAAS,SAAS,CAAC;AAG3C,MAFIC,KAAY,MAAMD,EAAS,SAAS,MACpCC,IAAWD,EAASA,EAAS,SAAS,CAAC,IACvCC,KAAY;AACZ,WAAO;AAEX,QAAMC,IAAmBD,EAAS,MAAM,GAAG,EAAE,CAAC;AAG9C,SAFuBC,EAAiB,WAAW,GAAG,IAAIA,IAAmBA,EAAiB,MAAM,GAAG,EAAE,CAAC;AAG9G,GAf2C,gCAgE9BC,IAAoB,gBAAAL,EAAA,CAACM,GAAcC,GAAmBC,MAA0H;AACzL,MAAIC,IAAqB,OACrBC,IAA0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AgB+F;"}
@@ -1,52 +0,0 @@
1
- var R = Object.defineProperty;
2
- var u = (t, e) => R(t, "name", { value: e, configurable: !0 });
3
- import { useRef as g, useState as d, useEffect as h } from "react";
4
- function I(t, e) {
5
- const s = g(t), [o, i] = d(null);
6
- return h(() => {
7
- s.current = t;
8
- }, [t]), h(() => {
9
- function n() {
10
- s.current();
11
- }
12
- if (u(n, "tick"), e !== null) {
13
- const r = setInterval(n, e);
14
- return i(r), () => {
15
- clearInterval(r);
16
- };
17
- }
18
- }, [e]), o;
19
- }
20
- u(I, "useInterval");
21
- function C(t, e, s = 0) {
22
- const [o, i] = d(s);
23
- return h(() => {
24
- const n = t.current;
25
- if (!n) return;
26
- const r = new ResizeObserver((v) => {
27
- const c = v[0];
28
- c && i(c.contentRect.width);
29
- });
30
- return r.observe(n), i(n.getBoundingClientRect().width), () => r.disconnect();
31
- }, [t, e]), o;
32
- }
33
- u(C, "useContainerWidth");
34
- function W(t, e, s = 0, o = 0) {
35
- const [i, n] = d(s), [r, v] = d(o);
36
- return h(() => {
37
- const c = t.current;
38
- if (!c) return;
39
- const f = new ResizeObserver((l) => {
40
- const a = l[0];
41
- a && (v(a.contentRect.height), n(a.contentRect.width));
42
- });
43
- return f.observe(c), n(c.getBoundingClientRect().width), () => f.disconnect();
44
- }, [t, e]), [i, r];
45
- }
46
- u(W, "useContainerRectangle");
47
- export {
48
- C as a,
49
- I as b,
50
- W as u
51
- };
52
- //# sourceMappingURL=useContainerWidth-Df2PmSoC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useContainerWidth-Df2PmSoC.js","sources":["../src/hooks/useIntervalHook.ts","../src/hooks/useContainerWidth.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\n// Custom useInterval hook\nfunction useInterval(callback: () => void, delay: number) {\n const savedCallback = useRef(callback);\n const [intervalId, setIntervalId] = useState<NodeJS.Timeout | null>(null)\n\n // Remember the latest callback.\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== null) {\n const id = setInterval(tick, delay);\n setIntervalId(id)\n return () => {\n\n clearInterval(id); // Cleanup function\n }\n }\n }, [delay]);\n\n return intervalId;\n}\n\nexport default useInterval","import { useState, useEffect } from \"react\";\n\nexport function useContainerWidth(ref: React.RefObject<HTMLElement | null>, renderId: string, initialWidth = 0) {\n const [width, setWidth] = useState(initialWidth);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setWidth(entry.contentRect.width);\n });\n\n observer.observe(el);\n setWidth(el.getBoundingClientRect().width);\n\n return () => observer.disconnect();\n }, [ref, renderId]);\n\n return width;\n}\n\nexport function useContainerRectangle(ref: React.RefObject<HTMLElement | null>, renderId: string, initialWidth = 0, initialHeight = 0) {\n const [width, setWidth] = useState(initialWidth);\n const [height, setHeight] = useState(initialHeight);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) {\n setHeight(entry.contentRect.height);\n setWidth(entry.contentRect.width);\n }\n });\n\n observer.observe(el);\n setWidth(el.getBoundingClientRect().width);\n\n return () => observer.disconnect();\n }, [ref, renderId]);\n\n return [width, height];\n}"],"names":["useInterval","callback","delay","savedCallback","useRef","intervalId","setIntervalId","useState","useEffect","tick","__name","id","useContainerWidth","ref","renderId","initialWidth","width","setWidth","el","observer","entries","entry","useContainerRectangle","initialHeight","height","setHeight"],"mappings":";;;AAGA,SAASA,EAAYC,GAAsBC,GAAe;AACtD,QAAMC,IAAgBC,EAAOH,CAAQ,GAC/B,CAACI,GAAYC,CAAa,IAAIC,EAAgC,IAAI;AAGxE,SAAAC,EAAU,MAAM;AACZ,IAAAL,EAAc,UAAUF;AAAA,EAC5B,GAAG,CAACA,CAAQ,CAAC,GAGbO,EAAU,MAAM;AACZ,aAASC,IAAO;AACZ,MAAAN,EA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