@burdenoff/fe-libs 2026.1004.3 → 2026.1004.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chrome/mobileTabBar/useVisibleNavItems.d.ts +9 -0
- package/dist/chrome/mobileTabBar/useVisibleNavItems.d.ts.map +1 -1
- package/dist/chrome/mobileTabBar/useVisibleNavItems.js +3 -1
- package/dist/shared/assistant/api.d.ts +6 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +5 -3
- package/dist/shared/assistant/i18nManifest.d.ts +13 -0
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +25 -12
- package/dist/shared/assistant/index.d.ts +11 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommandCopy.d.ts +18 -0
- package/dist/shared/assistant/localUiCommandCopy.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommandCopy.js +22 -2
- package/dist/shared/assistant/localUiCommands.d.ts +63 -26
- package/dist/shared/assistant/localUiCommands.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommands.js +128 -59
- package/dist/shared/assistant/store.d.ts +10 -0
- package/dist/shared/assistant/store.d.ts.map +1 -1
- package/dist/shared/assistant/store.js +52 -44
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +1023 -874
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +3 -34
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +83 -119
- package/dist/shared/assistant/ui/AssistantMoreMenu.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMoreMenu.js +58 -56
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +106 -105
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +2 -1
- package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts +20 -0
- package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts.map +1 -0
- package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.js +39 -0
- package/dist/shared/assistant/ui/composer/connectSource.js +2 -1
- package/dist/shared/assistant/ui/useVoiceSession.d.ts +35 -2
- package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useVoiceSession.js +232 -171
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +15 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +121 -101
- package/dist/shared/assistant/uiActions/assistantHref.d.ts +36 -0
- package/dist/shared/assistant/uiActions/assistantHref.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/assistantHref.js +46 -0
- package/dist/shared/assistant/uiActions/deixis.d.ts +29 -0
- package/dist/shared/assistant/uiActions/deixis.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/deixis.js +54 -0
- package/dist/shared/assistant/uiActions/entityRoutes.d.ts +49 -0
- package/dist/shared/assistant/uiActions/entityRoutes.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/entityRoutes.js +53 -0
- package/dist/shared/assistant/uiActions/inAppLinks.d.ts +28 -0
- package/dist/shared/assistant/uiActions/inAppLinks.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/inAppLinks.js +51 -0
- package/dist/shared/assistant/uiActions/linkContext.d.ts +52 -0
- package/dist/shared/assistant/uiActions/linkContext.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/linkContext.js +60 -0
- package/dist/shared/assistant/uiActions/recordNames.d.ts +73 -0
- package/dist/shared/assistant/uiActions/recordNames.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/recordNames.js +75 -0
- package/dist/shared/assistant/uiActions/resolveTarget.d.ts +43 -0
- package/dist/shared/assistant/uiActions/resolveTarget.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/resolveTarget.js +49 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.d.ts +30 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.js +22 -0
- package/dist/shared/assistant/voice/handsFree.d.ts +160 -0
- package/dist/shared/assistant/voice/handsFree.d.ts.map +1 -0
- package/dist/shared/assistant/voice/handsFree.js +104 -0
- package/dist/shared/assistant/voice/supersededTurns.d.ts +29 -0
- package/dist/shared/assistant/voice/supersededTurns.d.ts.map +1 -0
- package/dist/shared/assistant/voice/supersededTurns.js +17 -0
- package/dist/shared/assistant/voice/useVoiceInput.d.ts +7 -0
- package/dist/shared/assistant/voice/useVoiceInput.d.ts.map +1 -1
- package/dist/shared/assistant/voice/useVoiceInput.js +13 -10
- package/dist/shared/assistant/voice/voiceSession.d.ts +64 -20
- package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/voice/voiceSession.js +120 -67
- package/dist/shared/components/assistantWidget/MessageContent.js +4 -3
- package/dist/shared-assistant.js +206 -195
- package/package.json +3 -1
|
@@ -3,44 +3,44 @@ import { useAssistantTr as t } from "../../i18n.js";
|
|
|
3
3
|
import { micIsInterrupt as n, showsAssistantCaption as r, voiceStageState as i } from "../../voice/voiceStageState.js";
|
|
4
4
|
import { VOICE_THINKING_LABEL as a, composeVoiceStatus as o, voiceStatusSuffix as ee } from "../../voice/voiceStatus.js";
|
|
5
5
|
import { spokenSoFar as s } from "../../voice/voiceSession.js";
|
|
6
|
-
import { ASSISTANT_PANEL_ATTR as
|
|
7
|
-
import { AssistantAttachmentButton as
|
|
8
|
-
import { AssistantAttachmentChips as
|
|
9
|
-
import { AssistantVoiceOrb as
|
|
10
|
-
import { VoiceMiniController as
|
|
11
|
-
import { VoiceStage as
|
|
12
|
-
import { VoiceTranscriptDrawer as
|
|
13
|
-
import { escapeBelongsToLayerAbove as
|
|
14
|
-
import { useCallback as
|
|
15
|
-
import { Maximize2 as
|
|
16
|
-
import { jsx as
|
|
6
|
+
import { ASSISTANT_PANEL_ATTR as te, ASSISTANT_VOICE_SESSION_ATTR as ne } from "../panelOverlays.js";
|
|
7
|
+
import { AssistantAttachmentButton as re } from "../composer/AssistantAttachmentButton.js";
|
|
8
|
+
import { AssistantAttachmentChips as ie } from "../composer/AssistantAttachmentChips.js";
|
|
9
|
+
import { AssistantVoiceOrb as ae } from "./AssistantVoiceOrb.js";
|
|
10
|
+
import { VoiceMiniController as oe } from "./VoiceMiniController.js";
|
|
11
|
+
import { VoiceStage as se } from "./VoiceStage.js";
|
|
12
|
+
import { VoiceTranscriptDrawer as ce } from "./VoiceTranscriptDrawer.js";
|
|
13
|
+
import { escapeBelongsToLayerAbove as le, voiceSessionEscapeAction as ue } from "./voiceSessionEscape.js";
|
|
14
|
+
import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
|
|
15
|
+
import { Maximize2 as de, Minimize2 as fe, ScrollText as pe, X as f } from "lucide-react";
|
|
16
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
17
17
|
//#region src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
18
|
-
var
|
|
19
|
-
let k = t(), { muted: A, error: j } =
|
|
20
|
-
U.current =
|
|
21
|
-
let W =
|
|
22
|
-
|
|
23
|
-
}, [A,
|
|
18
|
+
var h = ({ session: h, turns: ge = [], onSaveTranscript: _e, onContinueInChat: ve, notice: g = null, spoken: _, onInterrupt: ye, onToggleMute: v, attachments: y = [], onAttachFiles: b, onRemoveAttachment: be, onRetryAttachment: xe, canAttachMore: Se = !0, preparingAttachments: x = 0, spokenChunks: S = null, onEnd: C, capturing: Ce = !0, interrupting: we = !1, awaitingEndpoint: Te = !1, holding: w = !1, correcting: Ee = !1, onLetMeFinish: T, onImDone: E, proposalChip: D = null, proposalTray: O = null }) => {
|
|
19
|
+
let k = t(), { muted: A, error: j } = h, M = u(null), N = u(null), [P, F] = d("mini"), I = P === "full", L = P === "mini", R = P === "mini" ? "panel" : P === "panel" ? "full" : "mini", [z, B] = d(!1), V = O !== null && !L, H = u(!1), U = u(v);
|
|
20
|
+
U.current = v;
|
|
21
|
+
let W = c(() => {
|
|
22
|
+
h.phase !== "listening" && h.phase !== "thinking" || A || H.current || s(h) || (H.current = !0, U.current());
|
|
23
|
+
}, [A, h]), G = c(() => {
|
|
24
24
|
H.current && (H.current = !1, U.current());
|
|
25
|
-
}, []),
|
|
26
|
-
|
|
25
|
+
}, []), De = W;
|
|
26
|
+
l(() => {
|
|
27
27
|
let e = () => {
|
|
28
28
|
document.visibilityState === "hidden" ? W() : G();
|
|
29
29
|
};
|
|
30
30
|
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
31
|
-
}, [W, G]),
|
|
31
|
+
}, [W, G]), l(() => {
|
|
32
32
|
let e = G;
|
|
33
33
|
return window.addEventListener("focus", e), () => {
|
|
34
34
|
window.removeEventListener("focus", e), H.current = !1;
|
|
35
35
|
};
|
|
36
|
-
}, []),
|
|
36
|
+
}, []), l(() => {
|
|
37
37
|
M.current?.focus();
|
|
38
|
-
}, []), e(N, { fallbackSelector: `[${
|
|
38
|
+
}, []), e(N, { fallbackSelector: `[${te}]` }), l(() => {
|
|
39
39
|
let e = (e) => {
|
|
40
40
|
if (e.key === "Escape") {
|
|
41
|
-
let t =
|
|
41
|
+
let t = ue({
|
|
42
42
|
defaultPrevented: e.defaultPrevented,
|
|
43
|
-
layerAbove:
|
|
43
|
+
layerAbove: le({
|
|
44
44
|
target: e.target,
|
|
45
45
|
session: N.current,
|
|
46
46
|
doc: document
|
|
@@ -48,7 +48,7 @@ var v = ({ session: v, turns: pe = [], onSaveTranscript: me, onContinueInChat: h
|
|
|
48
48
|
transcriptOpen: z
|
|
49
49
|
});
|
|
50
50
|
if (t === "ignore") return;
|
|
51
|
-
e.preventDefault(), t === "close-transcript" ? B(!1) : V ? O?.onClose() :
|
|
51
|
+
e.preventDefault(), t === "close-transcript" ? B(!1) : V ? O?.onClose() : C();
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
if (e.key !== "Tab" || !I) return;
|
|
@@ -59,19 +59,28 @@ var v = ({ session: v, turns: pe = [], onSaveTranscript: me, onContinueInChat: h
|
|
|
59
59
|
};
|
|
60
60
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
61
61
|
}, [
|
|
62
|
-
|
|
62
|
+
C,
|
|
63
63
|
I,
|
|
64
64
|
z,
|
|
65
65
|
V,
|
|
66
66
|
O
|
|
67
67
|
]);
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
let K = g !== null && j === null, q = s(h), J = T && E && h.phase === "listening" && !A && j === null ? {
|
|
69
|
+
letMeFinish: T,
|
|
70
|
+
imDone: E
|
|
71
|
+
} : null, Y = J !== null;
|
|
72
|
+
l(() => {
|
|
73
|
+
if (Y) return;
|
|
74
|
+
let e = document.activeElement;
|
|
75
|
+
(!e || e === document.body) && M.current?.focus();
|
|
76
|
+
}, [Y]);
|
|
77
|
+
let X = i({
|
|
78
|
+
snapshot: h,
|
|
79
|
+
capturing: Ce,
|
|
80
|
+
interrupting: we,
|
|
81
|
+
awaitingEndpoint: Te
|
|
82
|
+
}), Oe = (() => {
|
|
83
|
+
switch (X) {
|
|
75
84
|
case "connecting": return k("voiceSession.connecting", "Starting the microphone…");
|
|
76
85
|
case "endpoint-grace": return k("voiceSession.endpointGrace", "Still listening — take your time");
|
|
77
86
|
case "interrupting": return k("voiceSession.interrupting", "Stopped — go ahead");
|
|
@@ -80,79 +89,90 @@ var v = ({ session: v, turns: pe = [], onSaveTranscript: me, onContinueInChat: h
|
|
|
80
89
|
case "mic-error":
|
|
81
90
|
case "ended": return "";
|
|
82
91
|
case "listening": return A ? k("voiceSession.muted", "Microphone off") : k("voiceSession.listening", "Listening…");
|
|
83
|
-
default: return
|
|
92
|
+
default: return X;
|
|
84
93
|
}
|
|
85
|
-
})(), Z = ee({
|
|
94
|
+
})(), Z = !A && (X === "listening" || X === "endpoint-grace"), Q = Z && w ? k("voiceSession.holding", "Take your time — tap “I’m done” when you finish") : Z && Ee ? k("voiceSession.correcting", "Stopped that answer — listening to your correction") : Oe, $ = ee({
|
|
86
95
|
tr: k,
|
|
87
|
-
stage:
|
|
96
|
+
stage: X,
|
|
88
97
|
muted: A,
|
|
89
|
-
label:
|
|
90
|
-
}),
|
|
91
|
-
return /* @__PURE__ */
|
|
98
|
+
label: Q
|
|
99
|
+
}), ke = o(Q, $), Ae = X === "thinking";
|
|
100
|
+
return /* @__PURE__ */ m("div", {
|
|
92
101
|
ref: N,
|
|
93
102
|
className: `flex flex-col items-center justify-between bg-bg-sunken ${P === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : P === "panel" ? "absolute inset-0 z-20 px-4 py-6" : "absolute inset-x-0 bottom-0 z-20 h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
|
|
94
103
|
role: "dialog",
|
|
95
104
|
"aria-modal": I || void 0,
|
|
96
105
|
"aria-label": k("voiceSession.title", "Voice conversation"),
|
|
97
106
|
"data-testid": "assistant-voice-session",
|
|
98
|
-
[
|
|
107
|
+
[ne]: "",
|
|
99
108
|
children: [
|
|
100
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ m("button", {
|
|
101
110
|
ref: M,
|
|
102
111
|
type: "button",
|
|
103
|
-
onClick:
|
|
112
|
+
onClick: C,
|
|
104
113
|
className: `absolute ${I ? "right-6 top-6 h-14 gap-2 px-5 text-base" : L ? "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`,
|
|
105
114
|
title: k("voiceSession.end", "End the voice conversation"),
|
|
106
115
|
"data-testid": "assistant-voice-end",
|
|
107
|
-
children: [/* @__PURE__ */
|
|
116
|
+
children: [/* @__PURE__ */ p(f, {
|
|
108
117
|
className: I ? "size-6" : L ? "size-4" : "size-5",
|
|
109
118
|
"aria-hidden": "true"
|
|
110
|
-
}), /* @__PURE__ */
|
|
119
|
+
}), /* @__PURE__ */ p("span", {
|
|
111
120
|
className: `truncate whitespace-nowrap font-medium ${L ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
|
|
112
121
|
children: k("voiceSession.endShort", "End")
|
|
113
122
|
})]
|
|
114
123
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
className: `flex flex-col items-center ${L ? "px-3" : `min-h-[1.5rem] ${
|
|
117
|
-
children:
|
|
124
|
+
/* @__PURE__ */ p("div", {
|
|
125
|
+
className: `flex flex-col items-center ${L ? "px-3" : `min-h-[1.5rem] ${K ? I ? "pt-14" : "pt-10" : ""}`}`,
|
|
126
|
+
children: K ? /* @__PURE__ */ p("p", {
|
|
118
127
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
119
128
|
"data-testid": "assistant-voice-notice",
|
|
120
|
-
children:
|
|
129
|
+
children: me(g, k)
|
|
121
130
|
}) : null
|
|
122
131
|
}),
|
|
123
132
|
(() => {
|
|
124
|
-
let e = /* @__PURE__ */
|
|
125
|
-
session:
|
|
133
|
+
let e = /* @__PURE__ */ p(ae, {
|
|
134
|
+
session: h,
|
|
126
135
|
compact: L,
|
|
127
|
-
connecting:
|
|
128
|
-
onPress: n(
|
|
129
|
-
label: n(
|
|
130
|
-
}), t =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
spokenChunks:
|
|
144
|
-
|
|
136
|
+
connecting: X === "connecting",
|
|
137
|
+
onPress: n(X) ? ye : v,
|
|
138
|
+
label: n(X) ? k("voiceSession.interrupt", "Stop the assistant and speak") : A ? k("voiceSession.unmute", "Turn the microphone on") : k("voiceSession.mute", "Turn the microphone off")
|
|
139
|
+
}), t = J ? /* @__PURE__ */ p("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
onClick: w ? J.imDone : J.letMeFinish,
|
|
142
|
+
className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${L ? "h-7 px-3 text-xs" : I ? "h-11 px-6 text-base" : "h-9 px-4 text-sm"} ${w ? "border-transparent bg-action-primary-bg text-action-primary-text hover:opacity-90" : "border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken"}`,
|
|
143
|
+
title: w ? k("voiceSession.imDoneHint", "Send what you said now") : k("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
|
|
144
|
+
"data-testid": "assistant-voice-hold",
|
|
145
|
+
"data-holding": w ? "true" : "false",
|
|
146
|
+
children: w ? k("voiceSession.imDone", "I’m done") : k("voiceSession.letMeFinish", "Let me finish")
|
|
147
|
+
}) : null, i = t ? /* @__PURE__ */ m("div", {
|
|
148
|
+
className: "flex flex-col items-center gap-2",
|
|
149
|
+
children: [e, t]
|
|
150
|
+
}) : e, a = r(X) ? _ : q || null, o = j === null ? null : he(j, k);
|
|
151
|
+
return L ? /* @__PURE__ */ p(oe, {
|
|
152
|
+
spokenChunks: S,
|
|
153
|
+
state: X,
|
|
154
|
+
caption: a,
|
|
155
|
+
statusText: ke,
|
|
156
|
+
statusSuffix: $,
|
|
157
|
+
rotateStatus: Ae,
|
|
158
|
+
errorText: o,
|
|
159
|
+
control: i
|
|
160
|
+
}) : /* @__PURE__ */ p(se, {
|
|
161
|
+
state: X,
|
|
162
|
+
userCaption: q || null,
|
|
163
|
+
spokenChunks: S,
|
|
164
|
+
assistantCaption: _,
|
|
145
165
|
expanded: I,
|
|
146
|
-
statusText:
|
|
147
|
-
statusSuffix:
|
|
148
|
-
rotateStatus:
|
|
149
|
-
errorText:
|
|
150
|
-
control:
|
|
166
|
+
statusText: ke,
|
|
167
|
+
statusSuffix: $,
|
|
168
|
+
rotateStatus: Ae,
|
|
169
|
+
errorText: o,
|
|
170
|
+
control: i
|
|
151
171
|
});
|
|
152
172
|
})(),
|
|
153
|
-
D && !V ? /* @__PURE__ */
|
|
173
|
+
D && !V ? /* @__PURE__ */ p("div", {
|
|
154
174
|
className: L ? "absolute left-20 right-36 top-2 flex justify-center" : `flex w-full justify-center ${I ? "max-w-[calc(100%-12rem)]" : "max-w-[calc(100%-8rem)]"}`,
|
|
155
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ p("button", {
|
|
156
176
|
type: "button",
|
|
157
177
|
onClick: () => {
|
|
158
178
|
F("panel"), D.onOpen();
|
|
@@ -162,72 +182,72 @@ var v = ({ session: v, turns: pe = [], onSaveTranscript: me, onContinueInChat: h
|
|
|
162
182
|
children: D.label
|
|
163
183
|
})
|
|
164
184
|
}) : null,
|
|
165
|
-
O && V ? /* @__PURE__ */
|
|
185
|
+
O && V ? /* @__PURE__ */ m("div", {
|
|
166
186
|
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${I ? "inset-x-6 bottom-24 top-24 mx-auto max-w-xl p-4" : "inset-x-3 bottom-16 top-16 p-3"}`,
|
|
167
187
|
"data-testid": "assistant-voice-proposal-tray",
|
|
168
|
-
children: [/* @__PURE__ */
|
|
188
|
+
children: [/* @__PURE__ */ p("div", {
|
|
169
189
|
className: "flex justify-end",
|
|
170
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ p("button", {
|
|
171
191
|
type: "button",
|
|
172
192
|
onClick: O.onClose,
|
|
173
193
|
className: "flex size-8 items-center justify-center rounded-full 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",
|
|
174
194
|
"aria-label": O.closeLabel,
|
|
175
195
|
"data-testid": "assistant-voice-proposal-tray-close",
|
|
176
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ p(f, {
|
|
177
197
|
className: "size-4",
|
|
178
198
|
"aria-hidden": "true"
|
|
179
199
|
})
|
|
180
200
|
})
|
|
181
201
|
}), O.content]
|
|
182
202
|
}) : null,
|
|
183
|
-
z ? /* @__PURE__ */
|
|
184
|
-
turns:
|
|
203
|
+
z ? /* @__PURE__ */ p(ce, {
|
|
204
|
+
turns: ge,
|
|
185
205
|
onClose: () => B(!1),
|
|
186
|
-
onSave:
|
|
187
|
-
onContinueInChat:
|
|
206
|
+
onSave: _e,
|
|
207
|
+
onContinueInChat: ve
|
|
188
208
|
}) : null,
|
|
189
|
-
|
|
209
|
+
b ? /* @__PURE__ */ p("div", {
|
|
190
210
|
className: `absolute ${I ? "left-6 top-6" : L ? "left-11 top-2" : "left-3 top-3"}`,
|
|
191
|
-
children: /* @__PURE__ */
|
|
211
|
+
children: /* @__PURE__ */ p(re, {
|
|
192
212
|
onFiles: (e) => {
|
|
193
|
-
|
|
213
|
+
b(e), F((e) => e === "mini" ? "panel" : e);
|
|
194
214
|
},
|
|
195
|
-
onPickerOpen:
|
|
215
|
+
onPickerOpen: De,
|
|
196
216
|
direction: "down",
|
|
197
|
-
canAddMore:
|
|
217
|
+
canAddMore: Se
|
|
198
218
|
})
|
|
199
219
|
}) : null,
|
|
200
|
-
(
|
|
220
|
+
(y.length > 0 || x > 0) && !L ? /* @__PURE__ */ p("div", {
|
|
201
221
|
className: `absolute ${I ? "bottom-24 left-24 right-24" : "bottom-16 left-16 right-16"}`,
|
|
202
222
|
"data-testid": "assistant-voice-attachments",
|
|
203
|
-
children: /* @__PURE__ */
|
|
204
|
-
attachments:
|
|
205
|
-
onRemove:
|
|
206
|
-
onRetry:
|
|
207
|
-
preparingCount:
|
|
223
|
+
children: /* @__PURE__ */ p(ie, {
|
|
224
|
+
attachments: y,
|
|
225
|
+
onRemove: be ?? (() => void 0),
|
|
226
|
+
onRetry: xe ?? (() => void 0),
|
|
227
|
+
preparingCount: x
|
|
208
228
|
})
|
|
209
229
|
}) : null,
|
|
210
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ p("button", {
|
|
211
231
|
type: "button",
|
|
212
232
|
onClick: () => B((e) => !e),
|
|
213
233
|
className: `absolute ${I ? "bottom-6 right-6 size-14" : L ? "right-2 top-2 size-8" : "bottom-3 right-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`,
|
|
214
234
|
"aria-pressed": z,
|
|
215
235
|
"aria-label": k("voiceSession.transcriptTitle", "Voice transcript"),
|
|
216
236
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
217
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ p(pe, { className: I ? "size-6" : L ? "size-4" : "size-5" })
|
|
218
238
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ p("button", {
|
|
220
240
|
type: "button",
|
|
221
241
|
onClick: () => F(R),
|
|
222
242
|
className: `absolute ${I ? "bottom-6 left-6 size-14" : L ? "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`,
|
|
223
243
|
"aria-label": R === "panel" ? k("voiceSession.expandPanel", "Show the conversation in the panel") : R === "full" ? k("voiceSession.expand", "Expand the conversation to full screen") : k("voiceSession.collapse", "Shrink to the compact controller"),
|
|
224
244
|
"data-testid": "assistant-voice-expand",
|
|
225
|
-
children: I ? /* @__PURE__ */
|
|
245
|
+
children: I ? /* @__PURE__ */ p(fe, { className: "size-5" }) : /* @__PURE__ */ p(de, { className: L ? "size-4" : "size-5" })
|
|
226
246
|
})
|
|
227
247
|
]
|
|
228
248
|
});
|
|
229
249
|
};
|
|
230
|
-
function
|
|
250
|
+
function me(e, t) {
|
|
231
251
|
switch (e) {
|
|
232
252
|
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
233
253
|
case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
|
|
@@ -236,7 +256,7 @@ function de(e, t) {
|
|
|
236
256
|
default: return e;
|
|
237
257
|
}
|
|
238
258
|
}
|
|
239
|
-
function
|
|
259
|
+
function he(e, t) {
|
|
240
260
|
switch (e) {
|
|
241
261
|
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
242
262
|
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|
|
@@ -245,4 +265,4 @@ function fe(e, t) {
|
|
|
245
265
|
}
|
|
246
266
|
}
|
|
247
267
|
//#endregion
|
|
248
|
-
export {
|
|
268
|
+
export { h as AssistantVoiceSession };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Options } from 'react-markdown';
|
|
2
|
+
/** @internal Exported for unit tests; not part of the module's public surface. */
|
|
3
|
+
export declare function transformAssistantUrl(url: string, key: string, tagName: string): string;
|
|
4
|
+
/** @internal The react-markdown option form of `transformAssistantUrl`. */
|
|
5
|
+
export declare const assistantUrlTransform: Options["urlTransform"];
|
|
6
|
+
/**
|
|
7
|
+
* How a link in an assistant reply should be treated.
|
|
8
|
+
*
|
|
9
|
+
* ★★ `href.startsWith("/")` IS NOT AN INTERNAL TEST. A protocol-relative URL —
|
|
10
|
+
* `//evil.example/path` — has no colon, so react-markdown's `defaultUrlTransform`
|
|
11
|
+
* returns it verbatim and the sanitizer passes it through; the browser then
|
|
12
|
+
* resolves it against the page's SCHEME and lands on another origin. Treating
|
|
13
|
+
* that as internal would hand an attacker-authored destination to the router.
|
|
14
|
+
* So the decision is made by RESOLVING the href and comparing origins.
|
|
15
|
+
*
|
|
16
|
+
* ★ This runs AFTER the sanitizer, so anything with an unsafe scheme has already
|
|
17
|
+
* been reduced to an empty string upstream — `blocked` here is the empty case,
|
|
18
|
+
* not a second scheme allow-list. The scheme policy stays in one place.
|
|
19
|
+
*/
|
|
20
|
+
export type AssistantLinkKind = "internal" | "external" | "fragment" | "blocked";
|
|
21
|
+
export declare function classifyAssistantHref(href: string | null | undefined, baseOrigin?: string): AssistantLinkKind;
|
|
22
|
+
/**
|
|
23
|
+
* The router-ready path for an href already classified as `internal`, or null if
|
|
24
|
+
* it cannot be resolved.
|
|
25
|
+
*
|
|
26
|
+
* ★★ WHY THIS IS NOT THE HREF. An internal link may be written absolutely —
|
|
27
|
+
* `https://app.example.com/fields?q=1#top` is same-origin, so it classifies as
|
|
28
|
+
* internal — and every SPA router reads a `to`/`navigate()` string as a PATH.
|
|
29
|
+
* Handing it the absolute form routes to a literal `/https://app.example.com/...`
|
|
30
|
+
* segment. Resolving here means each product wires one line and cannot get this
|
|
31
|
+
* wrong; the alternative is the same five lines re-derived in every product,
|
|
32
|
+
* with only the ones whose assistant happened to emit an absolute URL finding
|
|
33
|
+
* out they got it wrong.
|
|
34
|
+
*/
|
|
35
|
+
export declare function assistantRoutePath(href: string | null | undefined, baseOrigin?: string): string | null;
|
|
36
|
+
//# sourceMappingURL=assistantHref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistantHref.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/uiActions/assistantHref.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqBnE,kFAAkF;AAClF,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,MAAM,CAOR;AAED,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,cAAc,CAIR,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAqDd,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,UAAU,CAAC,EAAE,MAAM,GAClB,iBAAiB,CAWnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CA+Bf"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isSafeRedirectTarget as e } from "../../graphql/security.js";
|
|
2
|
+
import { defaultUrlTransform as t } from "../../../node_modules/react-markdown/lib/index.js";
|
|
3
|
+
//#region src/shared/assistant/uiActions/assistantHref.ts
|
|
4
|
+
var n = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[A-Za-z0-9+/=\s]+$/;
|
|
5
|
+
function r(e, r, i) {
|
|
6
|
+
return r === "src" && i === "img" && n.test(e) ? e : t(e);
|
|
7
|
+
}
|
|
8
|
+
var i = (e, t, n) => r(e, t, n.tagName);
|
|
9
|
+
function a() {
|
|
10
|
+
try {
|
|
11
|
+
return typeof window > "u" ? null : window.location.origin;
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function o(e, t) {
|
|
17
|
+
try {
|
|
18
|
+
let n = new URL(t);
|
|
19
|
+
if (n.protocol === "https:" || n.protocol === "http:" || !n.host) return !1;
|
|
20
|
+
let r = new URL(e, t);
|
|
21
|
+
return r.protocol === n.protocol && r.host === n.host;
|
|
22
|
+
} catch {
|
|
23
|
+
return !1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function s(t, n) {
|
|
27
|
+
let r = (t ?? "").trim();
|
|
28
|
+
if (!r) return "blocked";
|
|
29
|
+
if (r.startsWith("#")) return "fragment";
|
|
30
|
+
let i = n ?? a();
|
|
31
|
+
return i && (e(r, i) || o(r, i)) ? "internal" : "external";
|
|
32
|
+
}
|
|
33
|
+
function c(e, t) {
|
|
34
|
+
let n = (e ?? "").trim();
|
|
35
|
+
if (!n) return null;
|
|
36
|
+
let r = t ?? a();
|
|
37
|
+
if (!r) return null;
|
|
38
|
+
try {
|
|
39
|
+
let e = new URL(n, r), t = `${e.pathname}${e.search}${e.hash}`;
|
|
40
|
+
return t.startsWith("//") || t.startsWith("/\\") ? null : t;
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { c as assistantRoutePath, i as assistantUrlTransform, s as classifyAssistantHref, r as transformAssistantUrl };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ★ BOFF-8060 (N1b): the English deixis, back and choice grammar of the local
|
|
3
|
+
* navigation commands. PURE; every pattern is matched against the output of
|
|
4
|
+
* `normaliseUtterance` (lower case, no punctuation, courtesy words removed),
|
|
5
|
+
* and against the WHOLE utterance — a miss costs only latency, a false match
|
|
6
|
+
* acts on a sentence that meant something else.
|
|
7
|
+
*
|
|
8
|
+
* ★★ A bare "yes"/"ok" is never here: the sandbox reads a reply as approval of
|
|
9
|
+
* a pending write, and a spoken "yes" never commits one.
|
|
10
|
+
*/
|
|
11
|
+
/** "go back": undoes the assistant's own last navigation (only when runnable). */
|
|
12
|
+
export declare const BACK_GRAMMAR: readonly RegExp[];
|
|
13
|
+
export declare const isBackRequest: (utterance: string) => boolean;
|
|
14
|
+
export declare const isThereRequest: (utterance: string) => boolean;
|
|
15
|
+
export type ChoiceRequest =
|
|
16
|
+
/** 1-based position in the list. */
|
|
17
|
+
{
|
|
18
|
+
kind: "ordinal";
|
|
19
|
+
position: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "last";
|
|
22
|
+
}
|
|
23
|
+
/** "the one in crops": a word of the entry's parent or group. */
|
|
24
|
+
| {
|
|
25
|
+
kind: "context";
|
|
26
|
+
context: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function parseChoice(utterance: string): ChoiceRequest | null;
|
|
29
|
+
//# sourceMappingURL=deixis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deixis.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/uiActions/deixis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kFAAkF;AAClF,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAMzC,CAAC;AAWF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,OACO,CAAC;AAE1D,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,KAAG,OACO,CAAC;AAE3D,MAAM,MAAM,aAAa;AACvB,oCAAoC;AAClC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;AAClB,iEAAiE;GAC/D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoCzC,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAenE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/shared/assistant/uiActions/deixis.ts
|
|
2
|
+
var e = [
|
|
3
|
+
/^go back$/,
|
|
4
|
+
/^(?:take|bring) me back$/,
|
|
5
|
+
/^(?:(?:go|take me) )?back to the (?:previous|last) (?:page|screen)$/,
|
|
6
|
+
/^(?:the )?previous page$/,
|
|
7
|
+
/^go back to where i was$/
|
|
8
|
+
], t = [
|
|
9
|
+
/^(?:take|bring|get) me there$/,
|
|
10
|
+
/^take me to (?:it|that(?: page)?)$/,
|
|
11
|
+
/^(?:go|head|jump) there$/,
|
|
12
|
+
/^open (?:that(?: page| link)?|the link|it)$/,
|
|
13
|
+
/^show me that page$/
|
|
14
|
+
], n = (t) => e.some((e) => e.test(t)), r = (e) => t.some((t) => t.test(e)), i = {
|
|
15
|
+
first: 1,
|
|
16
|
+
"1st": 1,
|
|
17
|
+
second: 2,
|
|
18
|
+
"2nd": 2,
|
|
19
|
+
third: 3,
|
|
20
|
+
"3rd": 3,
|
|
21
|
+
fourth: 4,
|
|
22
|
+
"4th": 4
|
|
23
|
+
}, a = {
|
|
24
|
+
one: 1,
|
|
25
|
+
two: 2,
|
|
26
|
+
three: 3,
|
|
27
|
+
four: 4,
|
|
28
|
+
1: 1,
|
|
29
|
+
2: 2,
|
|
30
|
+
3: 3,
|
|
31
|
+
4: 4
|
|
32
|
+
}, o = "(?:(?:open|go to|take me to) )?", s = RegExp("^(?:(?:the )?(first|second|third|fourth|last|1st|2nd|3rd|4th)(?: one)?|(?:open|go to|take me to) (?:the )?(first|second|third|fourth|last|1st|2nd|3rd|4th) one)$"), c = RegExp(`^${o}(?:the )?(?:number|option) (one|two|three|four|1|2|3|4)$`), l = RegExp(`^${o}the one (?:in|under|from) (?:the )?(.+)$`);
|
|
33
|
+
function u(e) {
|
|
34
|
+
let t = s.exec(e);
|
|
35
|
+
if (t) {
|
|
36
|
+
let e = t[1] ?? t[2] ?? "";
|
|
37
|
+
return e === "last" ? { kind: "last" } : {
|
|
38
|
+
kind: "ordinal",
|
|
39
|
+
position: i[e] ?? 0
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
let n = c.exec(e);
|
|
43
|
+
if (n) return {
|
|
44
|
+
kind: "ordinal",
|
|
45
|
+
position: a[n[1] ?? ""] ?? 0
|
|
46
|
+
};
|
|
47
|
+
let r = l.exec(e);
|
|
48
|
+
return r && (r[1] ?? "").trim() ? {
|
|
49
|
+
kind: "context",
|
|
50
|
+
context: (r[1] ?? "").trim()
|
|
51
|
+
} : null;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { e as BACK_GRAMMAR, n as isBackRequest, r as isThereRequest, u as parseChoice };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ★ BOFF-8060 (N1b, C4b-lite): product-declared ENTITY routes — pages of one
|
|
3
|
+
* record (`/bigconsole/dashboards/:id`) that no sidebar entry names, so
|
|
4
|
+
* "take me there" cannot find them in the navigation. A product declares the
|
|
5
|
+
* templates it owns; the matcher below is the only thing that ever treats a
|
|
6
|
+
* path as one.
|
|
7
|
+
*
|
|
8
|
+
* PURE: no React, no DOM. The default is NO routes, so every product behaves
|
|
9
|
+
* as before until it supplies some.
|
|
10
|
+
*
|
|
11
|
+
* ★★ WHY THE `exclude` LISTS EXIST. A template like `/healthybowl/crops/:id`
|
|
12
|
+
* also matches `/healthybowl/crops/fields`, which is a STATIC page of the
|
|
13
|
+
* router and not a crop. Every param lists the router's static siblings it must
|
|
14
|
+
* never swallow. A router guard test in each app renders every template and
|
|
15
|
+
* every static sibling to prove the two lists agree with the real router.
|
|
16
|
+
*/
|
|
17
|
+
export type EntityParamKind = "id" | "slug" | "int";
|
|
18
|
+
export interface EntityParam {
|
|
19
|
+
kind: EntityParamKind;
|
|
20
|
+
/** Static sibling segments of the router this param must never match (case-insensitive: the router is). */
|
|
21
|
+
exclude?: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export interface AssistantEntityRoute {
|
|
24
|
+
/** Stable id, e.g. `bigconsole-dashboard`. The resolved target is `entity:<id>`. */
|
|
25
|
+
id: string;
|
|
26
|
+
/** A path template: `/bigconsole/dashboards/:id`. A segment starting `:` is a param. */
|
|
27
|
+
pattern: string;
|
|
28
|
+
/** One entry per param in `pattern`. */
|
|
29
|
+
params: Readonly<Record<string, EntityParam>>;
|
|
30
|
+
/**
|
|
31
|
+
* The id of a navigation entry the person must be able to SEE (the whole
|
|
32
|
+
* visible tree, groups included) for this route to resolve. Absent: a
|
|
33
|
+
* product-declared static route, which resolves for everyone who reaches it.
|
|
34
|
+
*/
|
|
35
|
+
visibleWith?: string;
|
|
36
|
+
/** What the page is called in a sentence: `{ key: "entity.dashboard", fallback: "dashboard" }`. */
|
|
37
|
+
noun: {
|
|
38
|
+
key: string;
|
|
39
|
+
fallback: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface EntityMatch {
|
|
43
|
+
route: AssistantEntityRoute;
|
|
44
|
+
params: Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
export declare function matchEntityRoute(path: string, routes: readonly AssistantEntityRoute[]): EntityMatch | null;
|
|
47
|
+
/** Fill a template with params, or null when one is missing or invalid. Used by record adapters. */
|
|
48
|
+
export declare function fillEntityRoute(route: AssistantEntityRoute, params: Readonly<Record<string, string>>): string | null;
|
|
49
|
+
//# sourceMappingURL=entityRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityRoutes.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/uiActions/entityRoutes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,2GAA2G;IAC3G,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,wFAAwF;IACxF,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC9C;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mGAAmG;IACnG,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAoBD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAeD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,oBAAoB,EAAE,GACtC,WAAW,GAAG,IAAI,CA8BpB;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACvC,MAAM,GAAG,IAAI,CAef"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/shared/assistant/uiActions/entityRoutes.ts
|
|
2
|
+
var e = {
|
|
3
|
+
id: /^[A-Za-z0-9_-]{1,128}$/,
|
|
4
|
+
slug: /^[A-Za-z0-9_.-]{1,128}$/,
|
|
5
|
+
int: /^[0-9]{1,9}$/
|
|
6
|
+
};
|
|
7
|
+
function t(t, n) {
|
|
8
|
+
return !(!e[t].test(n) || t === "slug" && (n === "." || n === ".." || n.includes("..")));
|
|
9
|
+
}
|
|
10
|
+
function n(e) {
|
|
11
|
+
if (!e.startsWith("/") || e.startsWith("//") || e.includes("?") || e.includes("#") || /%(?:2f|5c|2e)/i.test(e) || e.includes("\\")) return null;
|
|
12
|
+
let t = (e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e).slice(1).split("/");
|
|
13
|
+
return t.some((e) => e === "") ? null : t;
|
|
14
|
+
}
|
|
15
|
+
function r(e, r) {
|
|
16
|
+
let i = n(e);
|
|
17
|
+
if (i === null) return null;
|
|
18
|
+
for (let e of r) {
|
|
19
|
+
let n = e.pattern.slice(1).split("/");
|
|
20
|
+
if (n.length !== i.length) continue;
|
|
21
|
+
let r = {}, a = !0;
|
|
22
|
+
for (let o = 0; o < n.length && a; o += 1) {
|
|
23
|
+
let s = n[o] ?? "", c = i[o] ?? "";
|
|
24
|
+
if (!s.startsWith(":")) {
|
|
25
|
+
a = s.toLowerCase() === c.toLowerCase();
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
let l = s.slice(1), u = e.params[l];
|
|
29
|
+
a = u !== void 0 && t(u.kind, c) && !(u.exclude ?? []).some((e) => e.toLowerCase() === c.toLowerCase()), a && (r[l] = c);
|
|
30
|
+
}
|
|
31
|
+
if (a) return {
|
|
32
|
+
route: e,
|
|
33
|
+
params: r
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function i(e, t) {
|
|
39
|
+
let n = [];
|
|
40
|
+
for (let r of e.pattern.slice(1).split("/")) {
|
|
41
|
+
if (!r.startsWith(":")) {
|
|
42
|
+
n.push(r);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
let e = t[r.slice(1)];
|
|
46
|
+
if (e === void 0) return null;
|
|
47
|
+
n.push(e);
|
|
48
|
+
}
|
|
49
|
+
let i = `/${n.join("/")}`;
|
|
50
|
+
return r(i, [e]) ? i : null;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { i as fillEntityRoute, r as matchEntityRoute };
|