@burdenoff/fe-libs 2026.910.4 → 2026.910.6

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 (31) hide show
  1. package/dist/shared/assistant/index.d.ts +2 -0
  2. package/dist/shared/assistant/index.d.ts.map +1 -1
  3. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +11 -0
  4. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  5. package/dist/shared/assistant/ui/AIAssistantPanel.js +50 -46
  6. package/dist/shared/assistant/ui/AssistantChatArea.js +358 -358
  7. package/dist/shared/assistant/ui/AssistantConversationList.js +16 -16
  8. package/dist/shared/assistant/ui/AssistantLanguageMenu.js +6 -6
  9. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +21 -7
  10. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
  11. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +47 -37
  12. package/dist/shared/assistant/ui/AssistantMessageItem.js +16 -16
  13. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +5 -5
  14. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +151 -151
  15. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.d.ts.map +1 -1
  16. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.js +50 -47
  17. package/dist/shared/assistant/ui/composer/AssistantComposer.js +6 -6
  18. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts +7 -0
  19. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts.map +1 -0
  20. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +52 -0
  21. package/dist/shared/assistant/ui/composer/AssistantLanguageSelector.js +4 -4
  22. package/dist/shared/assistant/ui/composer/connectSource.d.ts +8 -0
  23. package/dist/shared/assistant/ui/composer/connectSource.d.ts.map +1 -0
  24. package/dist/shared/assistant/ui/composer/connectSource.js +12 -0
  25. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +48 -48
  26. package/dist/shared/assistant/ui/voice/VoiceConversationView.js +8 -8
  27. package/dist/shared/components/assistantWidget/MessageContent.d.ts +11 -3
  28. package/dist/shared/components/assistantWidget/MessageContent.d.ts.map +1 -1
  29. package/dist/shared/components/assistantWidget/MessageContent.js +26 -27
  30. package/dist/shared-assistant.js +95 -93
  31. package/package.json +2 -2
@@ -0,0 +1,52 @@
1
+ import { useAssistantTr as e } from "../../i18n.js";
2
+ import { assistantRoutePath as t, classifyAssistantHref as n, useAssistantNavigate as r } from "../AssistantMarkdownRenderer.js";
3
+ import { useAssistantConnectSource as i } from "./connectSource.js";
4
+ import { useCallback as a } from "react";
5
+ import { Link2 as o } from "lucide-react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ //#region src/shared/assistant/ui/composer/AssistantConnectSourceItem.tsx
8
+ function l(e, t) {
9
+ let n = (e ?? "").trim();
10
+ if (!n) return !1;
11
+ let r = t;
12
+ if (!r) try {
13
+ r = typeof window > "u" ? void 0 : window.location.origin;
14
+ } catch {
15
+ r = void 0;
16
+ }
17
+ if (!r) return !1;
18
+ try {
19
+ let { protocol: e } = new URL(n, r);
20
+ return e === "https:" || e === "http:";
21
+ } catch {
22
+ return !1;
23
+ }
24
+ }
25
+ var u = ({ onActivate: u }) => {
26
+ let d = e(), f = i(), p = r(), m = n(f), h = m === "internal" ? t(f) : null, g = m === "external" && l(f), _ = a((e) => {
27
+ e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (u?.(), !(!p || !h) && (e.preventDefault(), p(h)));
28
+ }, [
29
+ p,
30
+ h,
31
+ u
32
+ ]);
33
+ if (!f || m === "blocked" || !h && !g) return null;
34
+ let v = d("composer.connectSource", "Connect a source");
35
+ return /* @__PURE__ */ c("a", {
36
+ href: f,
37
+ role: "menuitem",
38
+ onClick: _,
39
+ ...g ? {
40
+ target: "_blank",
41
+ rel: "noopener noreferrer"
42
+ } : {},
43
+ className: "flex w-full items-center gap-2.5 border-t border-border-subtle px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken",
44
+ "data-testid": "assistant-connect-source",
45
+ children: [/* @__PURE__ */ s(o, {
46
+ className: "size-4 flex-shrink-0 text-text-secondary",
47
+ "aria-hidden": "true"
48
+ }), v]
49
+ });
50
+ };
51
+ //#endregion
52
+ export { u as AssistantConnectSourceItem };
@@ -1,10 +1,10 @@
1
- import { ASSISTANT_LANGUAGES as e } from "../../voice/languages.js";
2
- import { useAssistantTr as t } from "../../i18n.js";
1
+ import { useAssistantTr as e } from "../../i18n.js";
2
+ import { ASSISTANT_LANGUAGES as t } from "../../voice/languages.js";
3
3
  import { Languages as n } from "lucide-react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  //#region src/shared/assistant/ui/composer/AssistantLanguageSelector.tsx
6
6
  var a = ({ current: a, selected: s, onChange: c, disabled: l = !1 }) => {
7
- let u = t(), d = u("voice.languageLabel", "Language you speak to the assistant");
7
+ let u = e(), d = u("voice.languageLabel", "Language you speak to the assistant");
8
8
  return /* @__PURE__ */ i("label", {
9
9
  className: `relative flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] transition-colors focus-within:ring-2 focus-within:ring-border-strong ${l ? "cursor-not-allowed opacity-50" : "cursor-pointer text-text-muted hover:bg-bg-elevated hover:text-text-secondary"}`,
10
10
  title: `${d}: ${a.label}`,
@@ -30,7 +30,7 @@ var a = ({ current: a, selected: s, onChange: c, disabled: l = !1 }) => {
30
30
  children: [/* @__PURE__ */ r("option", {
31
31
  value: o,
32
32
  children: u("voice.languageFollowApp", "Same as interface")
33
- }), e.map((e) => /* @__PURE__ */ r("option", {
33
+ }), t.map((e) => /* @__PURE__ */ r("option", {
34
34
  value: e.code,
35
35
  children: e.label
36
36
  }, e.code))]
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export declare const AssistantConnectSourceProvider: FC<{
3
+ value?: string;
4
+ children: ReactNode;
5
+ }>;
6
+ /** The product's connections href, or null when the product supplied none. */
7
+ export declare function useAssistantConnectSource(): string | null;
8
+ //# sourceMappingURL=connectSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectSource.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/connectSource.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAA6B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3E,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB,CAIA,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAEzD"}
@@ -0,0 +1,12 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ //#region src/shared/assistant/ui/composer/connectSource.tsx
4
+ var r = e(null), i = ({ value: e, children: t }) => /* @__PURE__ */ n(r.Provider, {
5
+ value: e ?? null,
6
+ children: t
7
+ });
8
+ function a() {
9
+ return t(r);
10
+ }
11
+ //#endregion
12
+ export { i as AssistantConnectSourceProvider, a as useAssistantConnectSource };
@@ -1,39 +1,39 @@
1
- import { micIsInterrupt as e, showsAssistantCaption as t, voiceStageState as n } from "../../voice/voiceStageState.js";
2
- import { spokenSoFar as r } from "../../voice/voiceSession.js";
3
- import { useAssistantTr as i } from "../../i18n.js";
1
+ import { useAssistantTr as e } from "../../i18n.js";
2
+ import { micIsInterrupt as t, showsAssistantCaption as n, voiceStageState as r } from "../../voice/voiceStageState.js";
3
+ import { spokenSoFar as i } from "../../voice/voiceSession.js";
4
4
  import { AssistantAttachmentButton as ee } from "../composer/AssistantAttachmentButton.js";
5
5
  import { AssistantAttachmentChips as a } from "../composer/AssistantAttachmentChips.js";
6
- import { AssistantVoiceOrb as te } from "./AssistantVoiceOrb.js";
7
- import { VoiceMiniController as o } from "./VoiceMiniController.js";
8
- import { VoiceStage as s } from "./VoiceStage.js";
9
- import { VoiceTranscriptDrawer as c } from "./VoiceTranscriptDrawer.js";
10
- import { useCallback as l, useEffect as u, useRef as d, useState as f } from "react";
11
- import { Maximize2 as ne, Minimize2 as re, ScrollText as p, X as m } from "lucide-react";
6
+ import { AssistantVoiceOrb as o } from "./AssistantVoiceOrb.js";
7
+ import { VoiceMiniController as s } from "./VoiceMiniController.js";
8
+ import { VoiceStage as c } from "./VoiceStage.js";
9
+ import { VoiceTranscriptDrawer as te } from "./VoiceTranscriptDrawer.js";
10
+ import { useCallback as ne, useEffect as l, useRef as u, useState as d } from "react";
11
+ import { Maximize2 as f, Minimize2 as p, ScrollText as m, X as re } from "lucide-react";
12
12
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
13
13
  //#region src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
14
- var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae, notice: x = null, spoken: S, onInterrupt: oe, onToggleMute: C, attachments: w = [], onAttachFiles: T, onRemoveAttachment: E, onRetryAttachment: D, canAttachMore: O = !0, preparingAttachments: k = 0, spokenChunks: A = null, onEnd: j, capturing: M = !0, interrupting: N = !1, awaitingEndpoint: P = !1 }) => {
15
- let F = i(), { muted: I, error: L } = _, R = d(null), z = d(null), [B, V] = f("mini"), H = B === "full", U = B === "mini", W = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [G, K] = f(!1), q = d(!1), J = d(C);
16
- J.current = C;
17
- let se = l(() => {
18
- I || q.current || r(_) || (q.current = !0, J.current());
14
+ var _ = ({ session: _, turns: b = [], onSaveTranscript: x, onContinueInChat: S, notice: C = null, spoken: w, onInterrupt: T, onToggleMute: E, attachments: D = [], onAttachFiles: O, onRemoveAttachment: k, onRetryAttachment: ie, canAttachMore: ae = !0, preparingAttachments: A = 0, spokenChunks: j = null, onEnd: M, capturing: oe = !0, interrupting: N = !1, awaitingEndpoint: P = !1 }) => {
15
+ let F = e(), { muted: I, error: L } = _, R = u(null), z = u(null), [B, V] = d("mini"), H = B === "full", U = B === "mini", W = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [G, K] = d(!1), q = u(!1), J = u(E);
16
+ J.current = E;
17
+ let se = ne(() => {
18
+ I || q.current || i(_) || (q.current = !0, J.current());
19
19
  }, [I, _]);
20
- u(() => {
20
+ l(() => {
21
21
  let e = () => {
22
22
  q.current && (q.current = !1, J.current());
23
23
  };
24
24
  return window.addEventListener("focus", e), () => {
25
25
  window.removeEventListener("focus", e), q.current = !1;
26
26
  };
27
- }, []), u(() => {
27
+ }, []), l(() => {
28
28
  R.current?.focus();
29
- }, []), u(() => {
29
+ }, []), l(() => {
30
30
  let e = (e) => {
31
31
  if (e.key === "Escape") {
32
32
  if (G) {
33
33
  K(!1);
34
34
  return;
35
35
  }
36
- j();
36
+ M();
37
37
  return;
38
38
  }
39
39
  if (e.key !== "Tab" || !H) return;
@@ -44,13 +44,13 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
44
44
  };
45
45
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
46
46
  }, [
47
- j,
47
+ M,
48
48
  H,
49
49
  G
50
50
  ]);
51
- let Y = x !== null && L === null, X = r(_), Z = n({
51
+ let Y = C !== null && L === null, X = i(_), Z = r({
52
52
  snapshot: _,
53
- capturing: M,
53
+ capturing: oe,
54
54
  interrupting: N,
55
55
  awaitingEndpoint: P
56
56
  }), Q = (() => {
@@ -77,11 +77,11 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
77
77
  /* @__PURE__ */ g("button", {
78
78
  ref: R,
79
79
  type: "button",
80
- onClick: j,
80
+ onClick: M,
81
81
  className: `absolute ${H ? "right-6 top-6 h-14 gap-2 px-5 text-base" : U ? "right-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "right-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
82
82
  title: F("voiceSession.end", "End the voice conversation"),
83
83
  "data-testid": "assistant-voice-end",
84
- children: [/* @__PURE__ */ h(m, {
84
+ children: [/* @__PURE__ */ h(re, {
85
85
  className: H ? "size-6" : U ? "size-4" : "size-5",
86
86
  "aria-hidden": "true"
87
87
  }), /* @__PURE__ */ h("span", {
@@ -94,60 +94,60 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
94
94
  children: Y ? /* @__PURE__ */ h("p", {
95
95
  className: "max-w-xs text-center text-xs text-status-warning",
96
96
  "data-testid": "assistant-voice-notice",
97
- children: v(x, F)
97
+ children: v(C, F)
98
98
  }) : null
99
99
  }),
100
100
  (() => {
101
- let n = /* @__PURE__ */ h(te, {
101
+ let e = /* @__PURE__ */ h(o, {
102
102
  session: _,
103
103
  compact: U,
104
104
  connecting: Z === "connecting",
105
- onPress: e(Z) ? oe : C,
106
- label: e(Z) ? F("voiceSession.interrupt", "Stop the assistant and speak") : I ? F("voiceSession.unmute", "Turn the microphone on") : F("voiceSession.mute", "Turn the microphone off")
107
- }), r = t(Z) ? S : X || null, i = L === null ? null : y(L, F);
108
- return U ? /* @__PURE__ */ h(o, {
109
- spokenChunks: A,
105
+ onPress: t(Z) ? T : E,
106
+ label: t(Z) ? F("voiceSession.interrupt", "Stop the assistant and speak") : I ? F("voiceSession.unmute", "Turn the microphone on") : F("voiceSession.mute", "Turn the microphone off")
107
+ }), r = n(Z) ? w : X || null, i = L === null ? null : y(L, F);
108
+ return U ? /* @__PURE__ */ h(s, {
109
+ spokenChunks: j,
110
110
  state: Z,
111
111
  caption: r,
112
112
  statusText: $,
113
113
  errorText: i,
114
- control: n
115
- }) : /* @__PURE__ */ h(s, {
114
+ control: e
115
+ }) : /* @__PURE__ */ h(c, {
116
116
  state: Z,
117
117
  userCaption: X || null,
118
- spokenChunks: A,
119
- assistantCaption: S,
118
+ spokenChunks: j,
119
+ assistantCaption: w,
120
120
  expanded: H,
121
121
  statusText: $,
122
122
  errorText: i,
123
- control: n
123
+ control: e
124
124
  });
125
125
  })(),
126
- G ? /* @__PURE__ */ h(c, {
126
+ G ? /* @__PURE__ */ h(te, {
127
127
  turns: b,
128
128
  onClose: () => K(!1),
129
- onSave: ie,
130
- onContinueInChat: ae
129
+ onSave: x,
130
+ onContinueInChat: S
131
131
  }) : null,
132
- T ? /* @__PURE__ */ h("div", {
132
+ O ? /* @__PURE__ */ h("div", {
133
133
  className: `absolute ${H ? "left-6 top-6" : U ? "left-11 top-2" : "left-3 top-3"}`,
134
134
  children: /* @__PURE__ */ h(ee, {
135
135
  onFiles: (e) => {
136
- T(e), V((e) => e === "mini" ? "panel" : e);
136
+ O(e), V((e) => e === "mini" ? "panel" : e);
137
137
  },
138
138
  onPickerOpen: se,
139
139
  direction: "down",
140
- canAddMore: O
140
+ canAddMore: ae
141
141
  })
142
142
  }) : null,
143
- (w.length > 0 || k > 0) && !U ? /* @__PURE__ */ h("div", {
143
+ (D.length > 0 || A > 0) && !U ? /* @__PURE__ */ h("div", {
144
144
  className: `absolute ${H ? "bottom-24 left-24 right-24" : "bottom-16 left-16 right-16"}`,
145
145
  "data-testid": "assistant-voice-attachments",
146
146
  children: /* @__PURE__ */ h(a, {
147
- attachments: w,
148
- onRemove: E ?? (() => void 0),
149
- onRetry: D ?? (() => void 0),
150
- preparingCount: k
147
+ attachments: D,
148
+ onRemove: k ?? (() => void 0),
149
+ onRetry: ie ?? (() => void 0),
150
+ preparingCount: A
151
151
  })
152
152
  }) : null,
153
153
  /* @__PURE__ */ h("button", {
@@ -157,7 +157,7 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
157
157
  "aria-pressed": G,
158
158
  "aria-label": F("voiceSession.transcript", "Voice transcript"),
159
159
  "data-testid": "assistant-voice-transcript-toggle",
160
- children: /* @__PURE__ */ h(p, { className: H ? "size-6" : U ? "size-4" : "size-5" })
160
+ children: /* @__PURE__ */ h(m, { className: H ? "size-6" : U ? "size-4" : "size-5" })
161
161
  }),
162
162
  /* @__PURE__ */ h("button", {
163
163
  type: "button",
@@ -165,7 +165,7 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
165
165
  className: `absolute ${H ? "bottom-6 left-6 size-14" : U ? "left-2 top-2 size-8" : "bottom-3 left-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
166
166
  "aria-label": W === "panel" ? F("voiceSession.expandPanel", "Show the conversation in the panel") : W === "full" ? F("voiceSession.expand", "Expand the conversation to full screen") : F("voiceSession.collapse", "Shrink to the compact controller"),
167
167
  "data-testid": "assistant-voice-expand",
168
- children: H ? /* @__PURE__ */ h(re, { className: "size-5" }) : /* @__PURE__ */ h(ne, { className: U ? "size-4" : "size-5" })
168
+ children: H ? /* @__PURE__ */ h(p, { className: "size-5" }) : /* @__PURE__ */ h(f, { className: U ? "size-4" : "size-5" })
169
169
  })
170
170
  ]
171
171
  });
@@ -1,11 +1,11 @@
1
- import { groupConsecutiveBySession as e } from "../../voice/turnVisibility.js";
2
- import { useAssistantTr as t } from "../../i18n.js";
3
- import { AssistantMarkdownRenderer as n } from "../AssistantMarkdownRenderer.js";
1
+ import { useAssistantTr as e } from "../../i18n.js";
2
+ import { AssistantMarkdownRenderer as t } from "../AssistantMarkdownRenderer.js";
3
+ import { groupConsecutiveBySession as n } from "../../voice/turnVisibility.js";
4
4
  import { useMemo as r } from "react";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  //#region src/shared/assistant/ui/voice/VoiceConversationView.tsx
7
7
  var o = ({ turns: o }) => {
8
- let s = t(), c = r(() => e(o, (e) => e.sessionId), [o]);
8
+ let s = e(), c = r(() => n(o, (e) => e.sessionId), [o]);
9
9
  return o.length === 0 ? /* @__PURE__ */ i("div", {
10
10
  className: "flex flex-1 items-center justify-center px-6",
11
11
  children: /* @__PURE__ */ i("p", {
@@ -15,9 +15,9 @@ var o = ({ turns: o }) => {
15
15
  }) : /* @__PURE__ */ i("div", {
16
16
  className: "flex-1 overflow-y-auto px-4 py-4",
17
17
  "data-testid": "assistant-voice-conversation",
18
- children: c.map((e, t) => /* @__PURE__ */ a("section", {
18
+ children: c.map((e, n) => /* @__PURE__ */ a("section", {
19
19
  className: "space-y-4 pb-4",
20
- children: [t > 0 ? /* @__PURE__ */ a("div", {
20
+ children: [n > 0 ? /* @__PURE__ */ a("div", {
21
21
  className: "flex items-center gap-2 pt-2",
22
22
  role: "separator",
23
23
  children: [
@@ -36,9 +36,9 @@ var o = ({ turns: o }) => {
36
36
  })
37
37
  }, e.id) : /* @__PURE__ */ i("div", {
38
38
  className: "text-sm leading-relaxed text-text-secondary",
39
- children: /* @__PURE__ */ i(n, { content: e.text })
39
+ children: /* @__PURE__ */ i(t, { content: e.text })
40
40
  }, e.id))]
41
- }, `${e.sessionId ?? "earlier"}-${t}`))
41
+ }, `${e.sessionId ?? "earlier"}-${n}`))
42
42
  });
43
43
  };
44
44
  //#endregion
@@ -2,10 +2,18 @@ import { FC } from 'react';
2
2
  export interface MessageContentProps {
3
3
  content: string;
4
4
  /**
5
- * Called for in-app (`/…`) links so the host can route without a full page
6
- * reload. When omitted, in-app links fall back to a normal anchor.
5
+ * Called for in-app links so the host can route without a full page reload.
6
+ * When omitted, in-app links fall back to a normal anchor.
7
+ *
8
+ * ★ Receives a router-ready PATH (`/fields?crop=42#yield`), already resolved
9
+ * and proven same-origin — NOT the raw href. It used to receive the href, and
10
+ * an absolute same-origin URL (`https://app.example.com/fields`, which is
11
+ * `internal`) then reached the router as a string it reads as a path, landing
12
+ * on a literal `/https:/app.example.com/fields` segment. Both shells that pass
13
+ * this do `onNavigate={(href) => navigate(href)}`, so a path is what they
14
+ * needed all along.
7
15
  */
8
- onNavigate?: (href: string) => void;
16
+ onNavigate?: (path: string) => void;
9
17
  }
10
18
  export declare const MessageContent: FC<MessageContentProps>;
11
19
  //# sourceMappingURL=MessageContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/MessageContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAW1D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAqDlD,CAAC"}
1
+ {"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/MessageContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAwC1D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA2DlD,CAAC"}
@@ -1,32 +1,31 @@
1
- import { Fragment as e } from "react";
2
- import { Fragment as t, jsx as n } from "react/jsx-runtime";
1
+ import { assistantRoutePath as e, browserShouldHandle as t, classifyAssistantHref as n } from "../../assistant/ui/AssistantMarkdownRenderer.js";
2
+ import { Fragment as r } from "react";
3
+ import { Fragment as i, jsx as a } from "react/jsx-runtime";
3
4
  //#region src/shared/components/assistantWidget/MessageContent.tsx
4
- var r = /\[([^\]]+)\]\(([^)\s]+)\)/g;
5
- function i(e) {
6
- return e.startsWith("/") && !e.startsWith("//") ? !0 : e.startsWith("https://");
5
+ var o = /\[([^\]]+)\]\(([^)\s]+)\)/g;
6
+ function s(e) {
7
+ return e.startsWith("https://");
7
8
  }
8
- var a = ({ content: a, onNavigate: o }) => {
9
- let s = [], c = 0, l = new RegExp(r.source, "g");
10
- for (let t of a.matchAll(l)) {
11
- let [r, l, u] = t, d = t.index ?? 0;
12
- if (d > c && s.push(/* @__PURE__ */ n(e, { children: a.slice(c, d) }, `t${String(c)}`)), l && u && i(u)) {
13
- let e = u.startsWith("/");
14
- s.push(/* @__PURE__ */ n("a", {
15
- href: u,
16
- "data-testid": "assistant-message-link",
17
- ...e ? { onClick: o ? (e) => {
18
- e.preventDefault(), o(u);
19
- } : void 0 } : {
20
- target: "_blank",
21
- rel: "noopener noreferrer"
22
- },
23
- className: "font-medium text-action-primary-bg underline underline-offset-2 hover:opacity-80",
24
- children: l
25
- }, `l${String(d)}`));
26
- } else s.push(/* @__PURE__ */ n(e, { children: l ?? r }, `u${String(d)}`));
27
- c = d + r.length;
9
+ var c = ({ content: c, onNavigate: l }) => {
10
+ let u = [], d = 0, f = new RegExp(o.source, "g");
11
+ for (let i of c.matchAll(f)) {
12
+ let [o, f, p] = i, m = i.index ?? 0;
13
+ m > d && u.push(/* @__PURE__ */ a(r, { children: c.slice(d, m) }, `t${String(d)}`));
14
+ let h = p ? n(p) : "blocked", g = h === "internal" ? e(p) : null, _ = h === "external" && s(p);
15
+ f && p && (g || _) ? u.push(/* @__PURE__ */ a("a", {
16
+ href: g ?? p,
17
+ "data-testid": "assistant-message-link",
18
+ ...g ? { onClick: l ? (e) => {
19
+ t(e) || (e.preventDefault(), l(g));
20
+ } : void 0 } : {
21
+ target: "_blank",
22
+ rel: "noopener noreferrer"
23
+ },
24
+ className: "font-medium text-action-primary-bg underline underline-offset-2 hover:opacity-80",
25
+ children: f
26
+ }, `l${String(m)}`)) : u.push(/* @__PURE__ */ a(r, { children: f ?? o }, `u${String(m)}`)), d = m + o.length;
28
27
  }
29
- return c < a.length && s.push(/* @__PURE__ */ n(e, { children: a.slice(c) }, `t${String(c)}`)), /* @__PURE__ */ n(t, { children: s });
28
+ return d < c.length && u.push(/* @__PURE__ */ a(r, { children: c.slice(d) }, `t${String(d)}`)), /* @__PURE__ */ a(i, { children: u });
30
29
  };
31
30
  //#endregion
32
- export { a as MessageContent };
31
+ export { c as MessageContent };