@burdenoff/fe-libs 2026.1002.2 → 2026.1003.2
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/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/prewarm.d.ts +71 -0
- package/dist/shared/assistant/prewarm.d.ts.map +1 -1
- package/dist/shared/assistant/prewarm.js +49 -2
- package/dist/shared/assistant/speech/speechFeed.d.ts +63 -0
- package/dist/shared/assistant/speech/speechFeed.d.ts.map +1 -0
- package/dist/shared/assistant/speech/speechFeed.js +40 -0
- package/dist/shared/assistant/turnTimeline.d.ts +22 -2
- package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
- package/dist/shared/assistant/turnTimeline.js +18 -1
- package/dist/shared/assistant/turnTimingReport.d.ts.map +1 -1
- package/dist/shared/assistant/turnTimingReport.js +5 -4
- package/dist/shared/assistant/ui/AssistantAvatar.d.ts +0 -21
- package/dist/shared/assistant/ui/AssistantAvatar.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantAvatar.js +13 -7
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +981 -931
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +8 -0
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.js +60 -58
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +198 -169
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +117 -117
- package/dist/shared/assistant/ui/composer/AssistantVoiceButton.d.ts +8 -0
- package/dist/shared/assistant/ui/composer/AssistantVoiceButton.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantVoiceButton.js +21 -16
- package/dist/shared/assistant/ui/useVoiceSession.d.ts +1 -4
- package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useVoiceSession.js +171 -156
- package/dist/shared/assistant/ui/voice/AssistantVoiceOrb.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceOrb.js +16 -15
- package/dist/shared/assistant/ui/voice/VoiceCaption.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceCaption.js +1 -1
- package/dist/shared/assistant/ui/voice/VoiceMiniController.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceMiniController.js +35 -30
- package/dist/shared/assistant/ui/voice/VoiceStage.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceStage.js +38 -37
- package/dist/shared/assistant/ui/voice/VoiceWaveform.d.ts +6 -0
- package/dist/shared/assistant/ui/voice/VoiceWaveform.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceWaveform.js +40 -36
- package/dist/shared/assistant/voice/speakableText.d.ts +16 -1
- package/dist/shared/assistant/voice/speakableText.d.ts.map +1 -1
- package/dist/shared/assistant/voice/speakableText.js +116 -102
- package/dist/shared/assistant/voice/speechPlayback.d.ts +37 -19
- package/dist/shared/assistant/voice/speechPlayback.d.ts.map +1 -1
- package/dist/shared/assistant/voice/speechPlayback.js +11 -1
- package/dist/shared/assistant/voice/voiceSession.d.ts +12 -0
- package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/voice/voiceSession.js +6 -0
- package/dist/shared-assistant.js +151 -150
- package/package.json +1 -1
|
@@ -1,60 +1,61 @@
|
|
|
1
1
|
import { showsAssistantCaption as e, showsUserCaption as t, waveformIsActive as n, waveformIsSettled as r } from "../../voice/voiceStageState.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { isAwaitingFirstChunk as i } from "../../voice/speechPlayback.js";
|
|
3
|
+
import { VoiceCaption as a } from "./VoiceCaption.js";
|
|
4
|
+
import { VoiceWaveform as o } from "./VoiceWaveform.js";
|
|
5
|
+
import { VoiceStatusText as s } from "./VoiceStatusText.js";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
7
|
//#region src/shared/assistant/ui/voice/VoiceStage.tsx
|
|
7
|
-
var
|
|
8
|
-
let b = e(
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
var d = ({ state: d, userCaption: f, assistantCaption: p, expanded: m, statusText: h, statusSuffix: g, rotateStatus: _, control: v, errorText: y = null, spokenChunks: b = null }) => {
|
|
9
|
+
let x = e(d) && i(b), S = e(d) ? p : t(d) ? f : null;
|
|
10
|
+
return /* @__PURE__ */ u("div", {
|
|
10
11
|
className: [
|
|
11
12
|
"flex min-h-0 w-full flex-1 flex-col items-center",
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
m ? "px-8" : "px-14",
|
|
14
|
+
m ? "justify-start pt-[16vh]" : "justify-center"
|
|
14
15
|
].join(" "),
|
|
15
16
|
"data-testid": "assistant-voice-stage",
|
|
16
|
-
"data-state":
|
|
17
|
+
"data-state": d,
|
|
17
18
|
children: [
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ l(s, {
|
|
19
20
|
className: [
|
|
20
21
|
"text-center text-text-muted",
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
m ? "text-base" : "text-sm",
|
|
23
|
+
m ? "mb-3" : "mb-2"
|
|
23
24
|
].join(" "),
|
|
24
|
-
status:
|
|
25
|
-
suffix:
|
|
26
|
-
rotating:
|
|
25
|
+
status: h,
|
|
26
|
+
suffix: g,
|
|
27
|
+
rotating: _
|
|
27
28
|
}),
|
|
28
|
-
|
|
29
|
-
className: `max-w-md text-center text-status-warning ${
|
|
29
|
+
d === "mic-error" ? /* @__PURE__ */ l("p", {
|
|
30
|
+
className: `max-w-md text-center text-status-warning ${m ? "text-lg" : "text-sm"}`,
|
|
30
31
|
role: "alert",
|
|
31
32
|
"data-testid": "assistant-voice-stage-error",
|
|
32
|
-
children:
|
|
33
|
-
}) : /* @__PURE__ */
|
|
34
|
-
className:
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
active: n(
|
|
37
|
-
settled: r(
|
|
38
|
-
tone:
|
|
39
|
-
expanded:
|
|
33
|
+
children: y
|
|
34
|
+
}) : /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
|
|
35
|
+
className: m ? "mb-10" : "mb-5",
|
|
36
|
+
children: /* @__PURE__ */ l(o, {
|
|
37
|
+
active: n(d),
|
|
38
|
+
settled: r(d),
|
|
39
|
+
tone: d === "speaking" ? "speaking" : "listening",
|
|
40
|
+
expanded: m
|
|
40
41
|
})
|
|
41
|
-
}),
|
|
42
|
-
className:
|
|
42
|
+
}), S ? /* @__PURE__ */ l("div", {
|
|
43
|
+
className: [m ? "mb-12 max-h-[46vh] w-full overflow-y-auto" : "mb-6 max-h-[38vh] w-full overflow-y-auto", x ? m ? "min-h-[4.875rem]" : "min-h-12" : ""].join(" "),
|
|
43
44
|
"data-caption-scroll": "",
|
|
44
|
-
children: /* @__PURE__ */
|
|
45
|
-
text:
|
|
46
|
-
role: e(
|
|
47
|
-
spokenChunks:
|
|
48
|
-
expanded:
|
|
45
|
+
children: /* @__PURE__ */ l(a, {
|
|
46
|
+
text: S,
|
|
47
|
+
role: e(d) ? "assistant" : "user",
|
|
48
|
+
spokenChunks: b,
|
|
49
|
+
expanded: m,
|
|
49
50
|
testId: "assistant-voice-caption"
|
|
50
51
|
})
|
|
51
|
-
}) : /* @__PURE__ */
|
|
52
|
-
className:
|
|
52
|
+
}) : /* @__PURE__ */ l("div", {
|
|
53
|
+
className: m ? "mb-12 h-[4.875rem]" : "mb-6 h-12",
|
|
53
54
|
"aria-hidden": "true"
|
|
54
55
|
})] }),
|
|
55
|
-
|
|
56
|
+
v
|
|
56
57
|
]
|
|
57
58
|
});
|
|
58
59
|
};
|
|
59
60
|
//#endregion
|
|
60
|
-
export {
|
|
61
|
+
export { d as VoiceStage };
|
|
@@ -14,6 +14,12 @@ import { FC } from 'react';
|
|
|
14
14
|
*
|
|
15
15
|
* When a real VAD stream lands (it is needed for automatic barge-in anyway),
|
|
16
16
|
* this component gets amplitude as a prop and the animation becomes truthful.
|
|
17
|
+
*
|
|
18
|
+
* ★★ The bars hold still under EITHER reduced-motion signal (BOFF-8566). The
|
|
19
|
+
* pulse class is not emitted at all: `motion-safe:` reads only the device media
|
|
20
|
+
* query, so the app's own Reduce motion setting (`<html data-reduce-motion>`)
|
|
21
|
+
* never reached it. The bar HEIGHTS still carry the state (tall and varied when
|
|
22
|
+
* active, flat when not), so nothing is lost but the throb.
|
|
17
23
|
*/
|
|
18
24
|
interface Props {
|
|
19
25
|
/** Bars animate while true; a flat line while false. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceWaveform.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/voice/VoiceWaveform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"VoiceWaveform.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/voice/VoiceWaveform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,UAAU,KAAK;IACb,wDAAwD;IACxD,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4EAA4E;IAC5E,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAID,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,KAAK,CA0CnC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePrefersReducedMotion as e } from "../usePrefersReducedMotion.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
3
|
//#region src/shared/assistant/ui/voice/VoiceWaveform.tsx
|
|
3
|
-
var
|
|
4
|
+
var n = [
|
|
4
5
|
0,
|
|
5
6
|
1,
|
|
6
7
|
2,
|
|
@@ -8,38 +9,41 @@ var t = [
|
|
|
8
9
|
4,
|
|
9
10
|
5,
|
|
10
11
|
6
|
|
11
|
-
],
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
12
|
+
], r = ({ active: r, tone: i, settled: a = !1, expanded: o = !1 }) => {
|
|
13
|
+
let s = e();
|
|
14
|
+
return /* @__PURE__ */ t("div", {
|
|
15
|
+
className: `flex items-end justify-center ${o ? "h-8 gap-1.5" : "h-5 gap-1"}`,
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
"data-testid": "assistant-voice-waveform",
|
|
18
|
+
children: n.map((e) => /* @__PURE__ */ t("span", {
|
|
19
|
+
className: [
|
|
20
|
+
"inline-block rounded-full transition-[height,opacity] duration-300",
|
|
21
|
+
o ? "w-1.5" : "w-1",
|
|
22
|
+
i === "speaking" ? "bg-brand-primary" : "bg-text-muted",
|
|
23
|
+
r ? a ? s ? "opacity-70" : "motion-safe:animate-pulse [animation-duration:2.4s] opacity-70" : s ? "" : "motion-safe:animate-pulse" : "opacity-40"
|
|
24
|
+
].join(" "),
|
|
25
|
+
style: {
|
|
26
|
+
height: r ? `${(a ? [
|
|
27
|
+
25,
|
|
28
|
+
40,
|
|
29
|
+
55,
|
|
30
|
+
45,
|
|
31
|
+
55,
|
|
32
|
+
35,
|
|
33
|
+
22
|
|
34
|
+
] : [
|
|
35
|
+
40,
|
|
36
|
+
70,
|
|
37
|
+
100,
|
|
38
|
+
85,
|
|
39
|
+
100,
|
|
40
|
+
60,
|
|
41
|
+
35
|
|
42
|
+
])[e]}%` : "20%",
|
|
43
|
+
animationDelay: `${e * 90}ms`
|
|
44
|
+
}
|
|
45
|
+
}, e))
|
|
46
|
+
});
|
|
47
|
+
};
|
|
44
48
|
//#endregion
|
|
45
|
-
export {
|
|
49
|
+
export { r as VoiceWaveform };
|
|
@@ -80,6 +80,19 @@ export declare const SPEECH_CHUNK_CHARS = 180;
|
|
|
80
80
|
* is ~7–10 seconds, the same target the Latin limit is aiming at.
|
|
81
81
|
*/
|
|
82
82
|
export declare const SPEECH_CHUNK_CJK_CHARS = 40;
|
|
83
|
+
/**
|
|
84
|
+
* Ceiling for the FIRST chunk of a voice-session reply spoken from the speech
|
|
85
|
+
* feed (BOFF-8062, speed design C1), in characters.
|
|
86
|
+
*
|
|
87
|
+
* Nothing is heard until chunk 0 has made a full round trip to the TTS proxy,
|
|
88
|
+
* and that trip scales with the text. The design's range is about 100-120
|
|
89
|
+
* characters; 110 is its midpoint, taken as the default because the alpha TTS
|
|
90
|
+
* latency sweep (V-C1) is not part of this change. Applies ONLY to replies
|
|
91
|
+
* spoken from the feed — never to panel announcements, readbacks or the
|
|
92
|
+
* Listen button, so their chunking (and the local-command RT4 check) is
|
|
93
|
+
* unchanged.
|
|
94
|
+
*/
|
|
95
|
+
export declare const SPEECH_FIRST_CHUNK_MAX_CHARS = 110;
|
|
83
96
|
export interface SpeakableOptions {
|
|
84
97
|
labels?: Partial<SpeakableLabels>;
|
|
85
98
|
maxChars?: number;
|
|
@@ -117,5 +130,7 @@ export declare function containsCjk(text: string): boolean;
|
|
|
117
130
|
* listener expects) rather than an arbitrary character offset. A CJK sentence
|
|
118
131
|
* gets the tighter CJK ceiling, because a character there is a whole syllable.
|
|
119
132
|
*/
|
|
120
|
-
export declare function chunkForSpeech(text: string, maxChars?: number, cjkMaxChars?: number
|
|
133
|
+
export declare function chunkForSpeech(text: string, maxChars?: number, cjkMaxChars?: number, options?: {
|
|
134
|
+
firstChunkMaxChars?: number;
|
|
135
|
+
}): string[];
|
|
121
136
|
//# sourceMappingURL=speakableText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speakableText.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/speakableText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,eAStC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AA6CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBpD;AAkBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAO,EAAE,GAAG,SAAQ,GAAG,MAAM,CAE9E;AAkLD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAiJxF;AAiMD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAkFD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA2B,EACrC,WAAW,GAAE,MAA+B,
|
|
1
|
+
{"version":3,"file":"speakableText.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/speakableText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,eAStC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAKhD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AA6CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBpD;AAkBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAO,EAAE,GAAG,SAAQ,GAAG,MAAM,CAE9E;AAkLD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAiJxF;AAiMD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAkFD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA2B,EACrC,WAAW,GAAE,MAA+B,EAC5C,OAAO,GAAE;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5C,MAAM,EAAE,CAyEV"}
|
|
@@ -8,15 +8,15 @@ var e = {
|
|
|
8
8
|
nestedItem: "Sub-item {{ordinal}}",
|
|
9
9
|
emailAt: "at",
|
|
10
10
|
emailDot: "dot"
|
|
11
|
-
}, t = 3, n = 8e3, r = 180, i = 40, a = /^\s{0,3}(?:`{3,}|~{3,})/,
|
|
12
|
-
function
|
|
11
|
+
}, t = 3, n = 8e3, r = 180, i = 40, a = 110, o = 40, s = /^\s{0,3}(?:`{3,}|~{3,})/, c = /^\s{0,3}#{1,6}\s+(.*)$/, l = /^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/, u = /^\s{0,3}(?:>\s?)+/, d = /^(\s*)(?:[-*+]|(\d{1,9})[.)])\s+/, f = /^\[[ xX]\]\s*/, p = /[.!?…⋯:;。!?;.।॥۔؟؛]$/, m = /^\s{0,3}=+\s*$/, h = /^(?: {4}|\t)/;
|
|
12
|
+
function g(e, t) {
|
|
13
13
|
return Object.entries(t).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), e);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _(e) {
|
|
16
16
|
let t = e.trim();
|
|
17
17
|
return t.includes("|") && t.includes("-") && /^[\s:|-]+$/.test(t);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function v(e) {
|
|
20
20
|
let t = e.trim().replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
|
|
21
21
|
for (let e = 0; e < t.length; e += 1) {
|
|
22
22
|
let i = t[e];
|
|
@@ -32,7 +32,7 @@ function g(e) {
|
|
|
32
32
|
}
|
|
33
33
|
return n.push(r), n.map((e) => e.trim());
|
|
34
34
|
}
|
|
35
|
-
var
|
|
35
|
+
var y = {
|
|
36
36
|
"&": " and ",
|
|
37
37
|
"<": " less than ",
|
|
38
38
|
">": " greater than ",
|
|
@@ -40,89 +40,89 @@ var _ = {
|
|
|
40
40
|
"'": "'",
|
|
41
41
|
"'": "'",
|
|
42
42
|
" ": " "
|
|
43
|
-
},
|
|
44
|
-
function
|
|
43
|
+
}, b = "[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+", x = RegExp(`<(?:mailto:)?(${b})>`, "g"), S = RegExp(`\\bmailto:(${b})`, "g"), C = new RegExp(b, "g");
|
|
44
|
+
function w(e, t = "at", n = "dot") {
|
|
45
45
|
return e.replace(/@/g, ` ${t} `).replace(/\./g, ` ${n} `).replace(/\s+/g, " ").trim();
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
function
|
|
49
|
-
let n = e.replace(
|
|
50
|
-
n = n.replace(/!\[([^\]]*)\]\([^)]*\)/g, (e, n) => n.trim() || ` ${t.image} `), n = n.replace(/\[([^\]]*)\]\([^)]*\)/g, (e, n) => n.trim() || ` ${t.link} `), n = n.replace(/\[([^\]]*)\]\[[^\]]*\]/g, (e, n) => n.trim() || ` ${t.link} `), n = n.replace(/<https?:\/\/[^>\s]+>/g, ` ${t.link} `), n = n.replace(/\bhttps?:\/\/\S+/g, ` ${t.link} `), n = n.replace(
|
|
51
|
-
for (let [e, t] of Object.entries(
|
|
52
|
-
return n = n.replace(/(\*\*\*|___)(\S(?:[\s\S]*?\S)?)\1/g, "$2"), n = n.replace(/(\*\*|__)(\S(?:[\s\S]*?\S)?)\1/g, "$2"), n = n.replace(/~~(\S(?:[\s\S]*?\S)?)~~/g, "$1"), n = n.replace(/(^|[\s([{"'])\*(\S(?:[\s\S]*?\S)?)\*(?=$|[\s)\]}"'.,!?;:])/g, "$1$2"), n = n.replace(/(^|[\s([{"'])_(\S(?:[\s\S]*?\S)?)_(?=$|[\s)\]}"'.,!?;:])/g, "$1$2"), n = n.replace(/[\p{Extended_Pictographic}\uFE0F\u200D]/gu, " "), n = n.replace(/[•·▪▫◦‣⁃∙●○■□▶▸►➤➜→←↑↓⇒⇔★☆⭐✦✧✓✔✗✘✕✖]/gu, " "), n = n.replace(/(\d)?\s*[—–―]\s*(\d)?/g, (e, t, n) => t !== void 0 && n !== void 0 ? e : `${t ?? ""}, ${n ?? ""}`), n = n.replace(/\*{2,}/g, ""), n.replace(/\s+/g, " ").replace(/\s+([.,!?;:)\]}])/g, "$1").replace(/([([{])\s+/g, "$1").trim().replace(
|
|
47
|
+
var T = 57600, E = /[\ue121-\ue17e]/g, D = "", O = /\ue180/g, k = /[\ue100-\ue1ff]/g;
|
|
48
|
+
function A(e, t) {
|
|
49
|
+
let n = e.replace(k, "").replace(/\\[!-/:-@[-`{-~]|(`+)[^`]*?\1(?!`)/g, (e, t) => t ? e.replace(/\\/g, D) : e).replace(/\\([!-/:-@[-`{-~])/g, (e, t) => String.fromCharCode(T + t.charCodeAt(0)));
|
|
50
|
+
n = n.replace(/!\[([^\]]*)\]\([^)]*\)/g, (e, n) => n.trim() || ` ${t.image} `), n = n.replace(/\[([^\]]*)\]\([^)]*\)/g, (e, n) => n.trim() || ` ${t.link} `), n = n.replace(/\[([^\]]*)\]\[[^\]]*\]/g, (e, n) => n.trim() || ` ${t.link} `), n = n.replace(/<https?:\/\/[^>\s]+>/g, ` ${t.link} `), n = n.replace(/\bhttps?:\/\/\S+/g, ` ${t.link} `), n = n.replace(x, (e, n) => ` ${w(n, t.emailAt, t.emailDot)} `), n = n.replace(S, (e, n) => ` ${w(n, t.emailAt, t.emailDot)} `), n = n.replace(C, (e) => ` ${w(e, t.emailAt, t.emailDot)} `), n = n.replace(/`+([^`]*)`+/g, (e, t) => t), n = n.replace(/<\/?[a-zA-Z][^>]*>/g, " ");
|
|
51
|
+
for (let [e, t] of Object.entries(y)) n = n.split(e).join(t);
|
|
52
|
+
return n = n.replace(/(\*\*\*|___)(\S(?:[\s\S]*?\S)?)\1/g, "$2"), n = n.replace(/(\*\*|__)(\S(?:[\s\S]*?\S)?)\1/g, "$2"), n = n.replace(/~~(\S(?:[\s\S]*?\S)?)~~/g, "$1"), n = n.replace(/(^|[\s([{"'])\*(\S(?:[\s\S]*?\S)?)\*(?=$|[\s)\]}"'.,!?;:])/g, "$1$2"), n = n.replace(/(^|[\s([{"'])_(\S(?:[\s\S]*?\S)?)_(?=$|[\s)\]}"'.,!?;:])/g, "$1$2"), n = n.replace(/[\p{Extended_Pictographic}\uFE0F\u200D]/gu, " "), n = n.replace(/[•·▪▫◦‣⁃∙●○■□▶▸►➤➜→←↑↓⇒⇔★☆⭐✦✧✓✔✗✘✕✖]/gu, " "), n = n.replace(/(\d)?\s*[—–―]\s*(\d)?/g, (e, t, n) => t !== void 0 && n !== void 0 ? e : `${t ?? ""}, ${n ?? ""}`), n = n.replace(/\*{2,}/g, ""), n.replace(/\s+/g, " ").replace(/\s+([.,!?;:)\]}])/g, "$1").replace(/([([{])\s+/g, "$1").trim().replace(E, (e) => String.fromCharCode(e.charCodeAt(0) - T)).replace(O, "\\");
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function j(e) {
|
|
55
55
|
let t = e.trim();
|
|
56
|
-
return t ?
|
|
56
|
+
return t ? p.test(t) ? t : `${t}.` : "";
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function M(e, t, n) {
|
|
59
59
|
if (e.length <= t) return e;
|
|
60
60
|
let r = e.slice(0, t), i = Math.max(r.lastIndexOf(". "), r.lastIndexOf("\n")), a = r.lastIndexOf(" "), o = i > t * .5 ? i + 1 : a > 0 ? a : t;
|
|
61
61
|
return `${r.slice(0, o).trim()}\n${n}`;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function N(e) {
|
|
64
64
|
let t = 0;
|
|
65
65
|
for (let n of e) t += n === " " ? 4 : 1;
|
|
66
66
|
return t;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function P(e, t) {
|
|
69
69
|
let n = e[e.length - 1];
|
|
70
70
|
if (!n?.ordinal) return "";
|
|
71
71
|
if (e.length === 1) return `${n.ordinal}. `;
|
|
72
72
|
let r = e.map((e) => e.ordinal);
|
|
73
|
-
return r.every((e) => !!e) ? `${r.join(".")}. ` : `${
|
|
73
|
+
return r.every((e) => !!e) ? `${r.join(".")}. ` : `${g(t.nestedItem, { ordinal: n.ordinal })}. `;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function F(t, n = {}) {
|
|
76
76
|
let r = {
|
|
77
77
|
...e,
|
|
78
78
|
...n.labels
|
|
79
|
-
}, i = n.maxChars ?? 8e3,
|
|
79
|
+
}, i = n.maxChars ?? 8e3, a = n.maxSpokenTableRows ?? 3;
|
|
80
80
|
if (!t) return "";
|
|
81
|
-
let
|
|
82
|
-
for (; b <
|
|
83
|
-
let e =
|
|
84
|
-
if (
|
|
85
|
-
for (b += 1; b <
|
|
86
|
-
b += 1,
|
|
81
|
+
let o = t.replace(/\r\n?/g, "\n").split("\n"), p = [], y = [], b = 0;
|
|
82
|
+
for (; b < o.length;) {
|
|
83
|
+
let e = o[b].replace(u, ""), t = b === 0 || !o[b - 1].replace(u, "").trim();
|
|
84
|
+
if (s.test(e)) {
|
|
85
|
+
for (b += 1; b < o.length && !s.test(o[b].replace(u, ""));) b += 1;
|
|
86
|
+
b += 1, p.push(j(r.codeBlock));
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
|
-
if (t && y.length === 0 && e.trim() &&
|
|
90
|
-
for (b += 1; b <
|
|
91
|
-
let e =
|
|
92
|
-
if (e.trim() &&
|
|
89
|
+
if (t && y.length === 0 && e.trim() && h.test(e)) {
|
|
90
|
+
for (b += 1; b < o.length;) {
|
|
91
|
+
let e = o[b].replace(u, "");
|
|
92
|
+
if (e.trim() && h.test(e)) {
|
|
93
93
|
b += 1;
|
|
94
94
|
continue;
|
|
95
95
|
}
|
|
96
96
|
if (e.trim()) break;
|
|
97
97
|
let t = b;
|
|
98
|
-
for (; t <
|
|
99
|
-
let n = t <
|
|
100
|
-
if (!n.trim() || !
|
|
98
|
+
for (; t < o.length && !o[t].replace(u, "").trim();) t += 1;
|
|
99
|
+
let n = t < o.length ? o[t].replace(u, "") : "";
|
|
100
|
+
if (!n.trim() || !h.test(n)) break;
|
|
101
101
|
b = t;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
p.push(j(r.codeBlock));
|
|
104
104
|
continue;
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
106
|
+
if (l.test(e)) {
|
|
107
107
|
b += 1;
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
|
-
if (
|
|
110
|
+
if (m.test(e)) {
|
|
111
111
|
b += 1;
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
|
-
let n = b + 1 <
|
|
115
|
-
if (e.includes("|") &&
|
|
114
|
+
let n = b + 1 < o.length ? o[b + 1].replace(u, "") : "";
|
|
115
|
+
if (e.includes("|") && _(n)) {
|
|
116
116
|
y.length = 0;
|
|
117
|
-
let t =
|
|
117
|
+
let t = v(e).map((e) => A(e, r));
|
|
118
118
|
b += 2;
|
|
119
119
|
let n = [];
|
|
120
|
-
for (; b <
|
|
121
|
-
let e =
|
|
120
|
+
for (; b < o.length;) {
|
|
121
|
+
let e = o[b].replace(u, "");
|
|
122
122
|
if (!e.includes("|") || !e.trim()) break;
|
|
123
|
-
n.push(
|
|
123
|
+
n.push(v(e).map((e) => A(e, r))), b += 1;
|
|
124
124
|
}
|
|
125
|
-
if (n.length >
|
|
125
|
+
if (n.length > a) p.push(j(g(r.largeTable, {
|
|
126
126
|
rows: n.length,
|
|
127
127
|
columns: t.length
|
|
128
128
|
})));
|
|
@@ -132,44 +132,44 @@ function N(t, n = {}) {
|
|
|
132
132
|
let r = t[n];
|
|
133
133
|
return r ? `${r}: ${e}` : e;
|
|
134
134
|
}).filter(Boolean);
|
|
135
|
-
n.length &&
|
|
135
|
+
n.length && p.push(j(n.join(", ")));
|
|
136
136
|
}
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
139
|
if (b += 1, !e.trim()) continue;
|
|
140
|
-
let i =
|
|
140
|
+
let i = c.exec(e);
|
|
141
141
|
if (i) {
|
|
142
142
|
y.length = 0;
|
|
143
|
-
let e =
|
|
144
|
-
e &&
|
|
143
|
+
let e = A(i[1].replace(/\s+#+\s*$/, ""), r);
|
|
144
|
+
e && p.push(j(e));
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
|
-
let x =
|
|
147
|
+
let x = d.exec(e), S = e, C = "";
|
|
148
148
|
if (x) {
|
|
149
|
-
S = e.slice(x[0].length).replace(
|
|
150
|
-
let t =
|
|
149
|
+
S = e.slice(x[0].length).replace(f, "");
|
|
150
|
+
let t = N(x[1]);
|
|
151
151
|
for (; y.length > 0 && y[y.length - 1].indent >= t;) y.pop();
|
|
152
152
|
y.push({
|
|
153
153
|
indent: t,
|
|
154
154
|
ordinal: x[2] ?? null
|
|
155
|
-
}), C =
|
|
155
|
+
}), C = P(y, r);
|
|
156
156
|
} else /^\s/.test(e) || (y.length = 0);
|
|
157
|
-
if (!x &&
|
|
157
|
+
if (!x && m.test(n)) {
|
|
158
158
|
y.length = 0, b += 1;
|
|
159
|
-
let t =
|
|
160
|
-
t &&
|
|
159
|
+
let t = A(e, r);
|
|
160
|
+
t && p.push(j(t));
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
let w =
|
|
164
|
-
w &&
|
|
163
|
+
let w = A(S, r);
|
|
164
|
+
w && p.push(j(`${C}${w}`));
|
|
165
165
|
}
|
|
166
|
-
return
|
|
166
|
+
return M(p.join("\n").replace(/\n{2,}/g, "\n").trim(), i, j(r.truncated));
|
|
167
167
|
}
|
|
168
|
-
var
|
|
168
|
+
var I = new Set([
|
|
169
169
|
".",
|
|
170
170
|
"!",
|
|
171
171
|
"?"
|
|
172
|
-
]),
|
|
172
|
+
]), L = new Set([
|
|
173
173
|
"。",
|
|
174
174
|
"!",
|
|
175
175
|
"?",
|
|
@@ -183,7 +183,7 @@ var P = new Set([
|
|
|
183
183
|
"۔",
|
|
184
184
|
"؟",
|
|
185
185
|
"؛"
|
|
186
|
-
]),
|
|
186
|
+
]), R = new Set([
|
|
187
187
|
"\"",
|
|
188
188
|
"'",
|
|
189
189
|
")",
|
|
@@ -198,25 +198,25 @@ var P = new Set([
|
|
|
198
198
|
"』",
|
|
199
199
|
"】",
|
|
200
200
|
")"
|
|
201
|
-
]),
|
|
201
|
+
]), z = new Set(/* @__PURE__ */ "i.e,e.g,etc,approx,vs,cf,viz,al,est,dept,fig,figs,ref,min,max,avg,qty,temp,mr,mrs,ms,dr,prof,sr,jr,st,inc,ltd,co,corp,univ,ca,kg,mg,gm,ha,cm,mm,km,ml,lb,oz,sq,hrs,wk,yr,mo,vol,pp".split(",")), B = new Set([
|
|
202
202
|
"no",
|
|
203
203
|
"nos",
|
|
204
204
|
"p",
|
|
205
205
|
"ch",
|
|
206
206
|
"sec",
|
|
207
207
|
"art"
|
|
208
|
-
]),
|
|
209
|
-
function
|
|
210
|
-
for (let r = t; r < n; r += 1) if (
|
|
208
|
+
]), V = /^\d+(?:\.\d+)*$/, H = /^[A-Za-z]$/;
|
|
209
|
+
function U(e, t, n) {
|
|
210
|
+
for (let r = t; r < n; r += 1) if (L.has(e[r])) return !0;
|
|
211
211
|
if (n < e.length && !/\s/.test(e[n])) return !1;
|
|
212
212
|
if (e[t] !== ".") return !0;
|
|
213
213
|
let r = e.slice(0, t), i = /(\S+)$/.exec(r)?.[1] ?? "";
|
|
214
214
|
if (!i) return !0;
|
|
215
|
-
if (
|
|
215
|
+
if (V.test(i) && !r.slice(0, r.length - i.length).trim()) return !1;
|
|
216
216
|
let a = i.toLowerCase();
|
|
217
|
-
return
|
|
217
|
+
return H.test(i) || z.has(a) ? !1 : B.has(a) ? !/^\s*\d/.test(e.slice(n)) : !0;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function W(e) {
|
|
220
220
|
let t = [];
|
|
221
221
|
for (let n of e.split("\n")) {
|
|
222
222
|
let e = n.trim();
|
|
@@ -224,14 +224,14 @@ function H(e) {
|
|
|
224
224
|
let r = 0, i = 0;
|
|
225
225
|
for (; i < e.length;) {
|
|
226
226
|
let n = e[i];
|
|
227
|
-
if (!
|
|
227
|
+
if (!I.has(n) && !L.has(n)) {
|
|
228
228
|
i += 1;
|
|
229
229
|
continue;
|
|
230
230
|
}
|
|
231
231
|
let a = i;
|
|
232
|
-
for (; a < e.length && (
|
|
233
|
-
for (; a < e.length &&
|
|
234
|
-
if (
|
|
232
|
+
for (; a < e.length && (I.has(e[a]) || L.has(e[a]));) a += 1;
|
|
233
|
+
for (; a < e.length && R.has(e[a]);) a += 1;
|
|
234
|
+
if (U(e, i, a)) {
|
|
235
235
|
let n = e.slice(r, a).trim();
|
|
236
236
|
n && t.push(n), r = a;
|
|
237
237
|
}
|
|
@@ -242,40 +242,40 @@ function H(e) {
|
|
|
242
242
|
}
|
|
243
243
|
return t;
|
|
244
244
|
}
|
|
245
|
-
var
|
|
246
|
-
function
|
|
247
|
-
return
|
|
245
|
+
var G = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff66-\uff9f]/, K = /[\u3000-\u303f\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff01-\uff9f]/, q = /[、,,;;::。!?!?]/, J = /[A-Za-z0-9][A-Za-z0-9._,:%/+-]*[A-Za-z0-9%]|[\s\S]/gu;
|
|
246
|
+
function Y(e) {
|
|
247
|
+
return G.test(e);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function X(e, t) {
|
|
250
250
|
let n = `${e.slice(-1)}${t.slice(0, 1)}`;
|
|
251
|
-
return
|
|
251
|
+
return K.test(n) ? `${e}${t}` : `${e} ${t}`;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function Z(e, t) {
|
|
254
254
|
let n = t.trim();
|
|
255
255
|
n && e.push(n);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Q(e, t) {
|
|
258
258
|
let n = [], r = "", i = -1;
|
|
259
|
-
for (let a of e.match(
|
|
259
|
+
for (let a of e.match(J) ?? []) {
|
|
260
260
|
if (r.length + a.length > t && r.trim()) {
|
|
261
261
|
if (i > 0 && i < r.length && i >= t * .4) {
|
|
262
|
-
|
|
262
|
+
Z(n, r.slice(0, i));
|
|
263
263
|
let e = r.slice(i);
|
|
264
|
-
e.trim().length + a.length > t ? (
|
|
265
|
-
} else
|
|
264
|
+
e.trim().length + a.length > t ? (Z(n, e), r = "") : r = e;
|
|
265
|
+
} else Z(n, r), r = "";
|
|
266
266
|
i = -1;
|
|
267
267
|
}
|
|
268
268
|
if (a.length > t) {
|
|
269
|
-
|
|
269
|
+
Z(n, r), r = "", i = -1;
|
|
270
270
|
for (let e = 0; e < a.length; e += t) n.push(a.slice(e, e + t));
|
|
271
271
|
continue;
|
|
272
272
|
}
|
|
273
|
-
r += a,
|
|
273
|
+
r += a, q.test(a) && (i = r.length);
|
|
274
274
|
}
|
|
275
|
-
return
|
|
275
|
+
return Z(n, r), n;
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
if (
|
|
277
|
+
function $(e, t) {
|
|
278
|
+
if (Y(e)) return Q(e, t);
|
|
279
279
|
let n = [], r = "";
|
|
280
280
|
for (let i of e.split(/\s+/)) {
|
|
281
281
|
if (i.length > t) {
|
|
@@ -287,29 +287,43 @@ function Z(e, t) {
|
|
|
287
287
|
}
|
|
288
288
|
return r && n.push(r), n;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
let
|
|
292
|
-
for (let t of
|
|
293
|
-
let e =
|
|
290
|
+
function ee(e, t = 180, n = 40, r = {}) {
|
|
291
|
+
let i = Math.max(1, t), a = Math.max(1, Math.min(n, i)), o = [], s = "", c = i;
|
|
292
|
+
for (let t of W(e)) {
|
|
293
|
+
let e = Y(t) ? a : i;
|
|
294
294
|
if (t.length > e) {
|
|
295
|
-
|
|
295
|
+
s &&= (o.push(s), ""), o.push(...$(t, e)), c = i;
|
|
296
296
|
continue;
|
|
297
297
|
}
|
|
298
|
-
if (!
|
|
299
|
-
|
|
298
|
+
if (!s) {
|
|
299
|
+
s = t, c = e;
|
|
300
300
|
continue;
|
|
301
301
|
}
|
|
302
|
-
let n =
|
|
303
|
-
n.length <=
|
|
302
|
+
let n = X(s, t), r = Math.min(c, e);
|
|
303
|
+
n.length <= r ? (s = n, c = r) : (o.push(s), s = t, c = e);
|
|
304
304
|
}
|
|
305
|
-
if (
|
|
306
|
-
let e =
|
|
305
|
+
if (s && o.push(s), o.length > 1) {
|
|
306
|
+
let e = W(o[0]);
|
|
307
307
|
if (e.length > 1) {
|
|
308
308
|
let [t, ...n] = e;
|
|
309
|
-
|
|
309
|
+
o.splice(0, 1, t, n.reduce((e, t) => X(e, t)));
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
if (r.firstChunkMaxChars !== void 0 && o.length > 0) {
|
|
313
|
+
let [e, t] = te(o[0], r.firstChunkMaxChars);
|
|
314
|
+
t && o.splice(0, 1, e, t);
|
|
315
|
+
}
|
|
316
|
+
return o;
|
|
317
|
+
}
|
|
318
|
+
function te(e, t) {
|
|
319
|
+
if (e.length <= t || Y(e)) return [e, null];
|
|
320
|
+
for (let n = Math.min(t, e.length - 1); n >= o; --n) {
|
|
321
|
+
let t = e[n - 1], r = e[n];
|
|
322
|
+
if (!("—–".includes(t) || ",;:".includes(t) && /\s/.test(r))) continue;
|
|
323
|
+
let i = e.slice(0, n).trimEnd(), a = e.slice(n).trimStart();
|
|
324
|
+
if (i && a) return [i, a];
|
|
325
|
+
}
|
|
326
|
+
return [e, null];
|
|
313
327
|
}
|
|
314
328
|
//#endregion
|
|
315
|
-
export { e as DEFAULT_SPEAKABLE_LABELS, n as MAX_SPEAKABLE_CHARS, t as MAX_SPOKEN_TABLE_ROWS, r as SPEECH_CHUNK_CHARS, i as SPEECH_CHUNK_CJK_CHARS,
|
|
329
|
+
export { e as DEFAULT_SPEAKABLE_LABELS, n as MAX_SPEAKABLE_CHARS, t as MAX_SPOKEN_TABLE_ROWS, r as SPEECH_CHUNK_CHARS, i as SPEECH_CHUNK_CJK_CHARS, a as SPEECH_FIRST_CHUNK_MAX_CHARS, ee as chunkForSpeech, Y as containsCjk, w as speakableEmail, v as splitTableRow, F as toSpeakableText };
|