@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.
Files changed (52) hide show
  1. package/dist/shared/assistant/index.d.ts +1 -0
  2. package/dist/shared/assistant/index.d.ts.map +1 -1
  3. package/dist/shared/assistant/prewarm.d.ts +71 -0
  4. package/dist/shared/assistant/prewarm.d.ts.map +1 -1
  5. package/dist/shared/assistant/prewarm.js +49 -2
  6. package/dist/shared/assistant/speech/speechFeed.d.ts +63 -0
  7. package/dist/shared/assistant/speech/speechFeed.d.ts.map +1 -0
  8. package/dist/shared/assistant/speech/speechFeed.js +40 -0
  9. package/dist/shared/assistant/turnTimeline.d.ts +22 -2
  10. package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
  11. package/dist/shared/assistant/turnTimeline.js +18 -1
  12. package/dist/shared/assistant/turnTimingReport.d.ts.map +1 -1
  13. package/dist/shared/assistant/turnTimingReport.js +5 -4
  14. package/dist/shared/assistant/ui/AssistantAvatar.d.ts +0 -21
  15. package/dist/shared/assistant/ui/AssistantAvatar.d.ts.map +1 -1
  16. package/dist/shared/assistant/ui/AssistantAvatar.js +13 -7
  17. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  18. package/dist/shared/assistant/ui/AssistantChatArea.js +981 -931
  19. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +8 -0
  20. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
  21. package/dist/shared/assistant/ui/AssistantMessageItem.js +60 -58
  22. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
  23. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +198 -169
  24. package/dist/shared/assistant/ui/composer/AssistantComposer.js +117 -117
  25. package/dist/shared/assistant/ui/composer/AssistantVoiceButton.d.ts +8 -0
  26. package/dist/shared/assistant/ui/composer/AssistantVoiceButton.d.ts.map +1 -1
  27. package/dist/shared/assistant/ui/composer/AssistantVoiceButton.js +21 -16
  28. package/dist/shared/assistant/ui/useVoiceSession.d.ts +1 -4
  29. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  30. package/dist/shared/assistant/ui/useVoiceSession.js +171 -156
  31. package/dist/shared/assistant/ui/voice/AssistantVoiceOrb.d.ts.map +1 -1
  32. package/dist/shared/assistant/ui/voice/AssistantVoiceOrb.js +16 -15
  33. package/dist/shared/assistant/ui/voice/VoiceCaption.d.ts.map +1 -1
  34. package/dist/shared/assistant/ui/voice/VoiceCaption.js +1 -1
  35. package/dist/shared/assistant/ui/voice/VoiceMiniController.d.ts.map +1 -1
  36. package/dist/shared/assistant/ui/voice/VoiceMiniController.js +35 -30
  37. package/dist/shared/assistant/ui/voice/VoiceStage.d.ts.map +1 -1
  38. package/dist/shared/assistant/ui/voice/VoiceStage.js +38 -37
  39. package/dist/shared/assistant/ui/voice/VoiceWaveform.d.ts +6 -0
  40. package/dist/shared/assistant/ui/voice/VoiceWaveform.d.ts.map +1 -1
  41. package/dist/shared/assistant/ui/voice/VoiceWaveform.js +40 -36
  42. package/dist/shared/assistant/voice/speakableText.d.ts +16 -1
  43. package/dist/shared/assistant/voice/speakableText.d.ts.map +1 -1
  44. package/dist/shared/assistant/voice/speakableText.js +116 -102
  45. package/dist/shared/assistant/voice/speechPlayback.d.ts +37 -19
  46. package/dist/shared/assistant/voice/speechPlayback.d.ts.map +1 -1
  47. package/dist/shared/assistant/voice/speechPlayback.js +11 -1
  48. package/dist/shared/assistant/voice/voiceSession.d.ts +12 -0
  49. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  50. package/dist/shared/assistant/voice/voiceSession.js +6 -0
  51. package/dist/shared-assistant.js +151 -150
  52. 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 { VoiceCaption as i } from "./VoiceCaption.js";
3
- import { VoiceWaveform as a } from "./VoiceWaveform.js";
4
- import { VoiceStatusText as o } from "./VoiceStatusText.js";
5
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
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 u = ({ state: u, userCaption: d, assistantCaption: f, expanded: p, statusText: m, statusSuffix: h, rotateStatus: g, control: _, errorText: v = null, spokenChunks: y = null }) => {
8
- let b = e(u) ? f : t(u) ? d : null;
9
- return /* @__PURE__ */ l("div", {
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
- p ? "px-8" : "px-14",
13
- p ? "justify-start pt-[16vh]" : "justify-center"
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": u,
17
+ "data-state": d,
17
18
  children: [
18
- /* @__PURE__ */ c(o, {
19
+ /* @__PURE__ */ l(s, {
19
20
  className: [
20
21
  "text-center text-text-muted",
21
- p ? "text-base" : "text-sm",
22
- p ? "mb-3" : "mb-2"
22
+ m ? "text-base" : "text-sm",
23
+ m ? "mb-3" : "mb-2"
23
24
  ].join(" "),
24
- status: m,
25
- suffix: h,
26
- rotating: g
25
+ status: h,
26
+ suffix: g,
27
+ rotating: _
27
28
  }),
28
- u === "mic-error" ? /* @__PURE__ */ c("p", {
29
- className: `max-w-md text-center text-status-warning ${p ? "text-lg" : "text-sm"}`,
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: v
33
- }) : /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
34
- className: p ? "mb-10" : "mb-5",
35
- children: /* @__PURE__ */ c(a, {
36
- active: n(u),
37
- settled: r(u),
38
- tone: u === "speaking" ? "speaking" : "listening",
39
- expanded: p
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
- }), b ? /* @__PURE__ */ c("div", {
42
- className: p ? "mb-12 max-h-[46vh] w-full overflow-y-auto" : "mb-6 max-h-[38vh] w-full overflow-y-auto",
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__ */ c(i, {
45
- text: b,
46
- role: e(u) ? "assistant" : "user",
47
- spokenChunks: y,
48
- expanded: p,
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__ */ c("div", {
52
- className: p ? "mb-12 h-[4.875rem]" : "mb-6 h-12",
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 { u as VoiceStage };
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;AAEhC;;;;;;;;;;;;;;;GAeG;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,CAmCnC,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 { jsx as e } from "react/jsx-runtime";
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 t = [
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
- ], n = ({ active: n, tone: r, settled: i = !1, expanded: a = !1 }) => /* @__PURE__ */ e("div", {
12
- className: `flex items-end justify-center ${a ? "h-8 gap-1.5" : "h-5 gap-1"}`,
13
- "aria-hidden": "true",
14
- "data-testid": "assistant-voice-waveform",
15
- children: t.map((t) => /* @__PURE__ */ e("span", {
16
- className: [
17
- "inline-block rounded-full transition-[height,opacity] duration-300",
18
- a ? "w-1.5" : "w-1",
19
- r === "speaking" ? "bg-brand-primary" : "bg-text-muted",
20
- n ? i ? "motion-safe:animate-pulse [animation-duration:2.4s] opacity-70" : "motion-safe:animate-pulse" : "opacity-40"
21
- ].join(" "),
22
- style: {
23
- height: n ? `${(i ? [
24
- 25,
25
- 40,
26
- 55,
27
- 45,
28
- 55,
29
- 35,
30
- 22
31
- ] : [
32
- 40,
33
- 70,
34
- 100,
35
- 85,
36
- 100,
37
- 60,
38
- 35
39
- ])[t]}%` : "20%",
40
- animationDelay: `${t * 90}ms`
41
- }
42
- }, t))
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 { n as VoiceWaveform };
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): string[];
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,GAC3C,MAAM,EAAE,CAoEV"}
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,})/, o = /^\s{0,3}#{1,6}\s+(.*)$/, s = /^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/, c = /^\s{0,3}(?:>\s?)+/, l = /^(\s*)(?:[-*+]|(\d{1,9})[.)])\s+/, u = /^\[[ xX]\]\s*/, d = /[.!?…⋯:;。!?;.।॥۔؟؛]$/, f = /^\s{0,3}=+\s*$/, p = /^(?: {4}|\t)/;
12
- function m(e, t) {
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 h(e) {
15
+ function _(e) {
16
16
  let t = e.trim();
17
17
  return t.includes("|") && t.includes("-") && /^[\s:|-]+$/.test(t);
18
18
  }
19
- function g(e) {
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
  "&amp;": " and ",
37
37
  "&lt;": " less than ",
38
38
  "&gt;": " greater than ",
@@ -40,89 +40,89 @@ var _ = {
40
40
  "&#39;": "'",
41
41
  "&apos;": "'",
42
42
  "&nbsp;": " "
43
- }, v = "[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+", y = RegExp(`<(?:mailto:)?(${v})>`, "g"), b = RegExp(`\\bmailto:(${v})`, "g"), x = new RegExp(v, "g");
44
- function S(e, t = "at", n = "dot") {
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 C = 57600, w = /[\ue121-\ue17e]/g, T = "", E = /\ue180/g, D = /[\ue100-\ue1ff]/g;
48
- function O(e, t) {
49
- let n = e.replace(D, "").replace(/\\[!-/:-@[-`{-~]|(`+)[^`]*?\1(?!`)/g, (e, t) => t ? e.replace(/\\/g, T) : e).replace(/\\([!-/:-@[-`{-~])/g, (e, t) => String.fromCharCode(C + 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(y, (e, n) => ` ${S(n, t.emailAt, t.emailDot)} `), n = n.replace(b, (e, n) => ` ${S(n, t.emailAt, t.emailDot)} `), n = n.replace(x, (e) => ` ${S(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(_)) 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(w, (e) => String.fromCharCode(e.charCodeAt(0) - C)).replace(E, "\\");
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 k(e) {
54
+ function j(e) {
55
55
  let t = e.trim();
56
- return t ? d.test(t) ? t : `${t}.` : "";
56
+ return t ? p.test(t) ? t : `${t}.` : "";
57
57
  }
58
- function A(e, t, n) {
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 j(e) {
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 M(e, t) {
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(".")}. ` : `${m(t.nestedItem, { ordinal: n.ordinal })}. `;
73
+ return r.every((e) => !!e) ? `${r.join(".")}. ` : `${g(t.nestedItem, { ordinal: n.ordinal })}. `;
74
74
  }
75
- function N(t, n = {}) {
75
+ function F(t, n = {}) {
76
76
  let r = {
77
77
  ...e,
78
78
  ...n.labels
79
- }, i = n.maxChars ?? 8e3, d = n.maxSpokenTableRows ?? 3;
79
+ }, i = n.maxChars ?? 8e3, a = n.maxSpokenTableRows ?? 3;
80
80
  if (!t) return "";
81
- let _ = t.replace(/\r\n?/g, "\n").split("\n"), v = [], y = [], b = 0;
82
- for (; b < _.length;) {
83
- let e = _[b].replace(c, ""), t = b === 0 || !_[b - 1].replace(c, "").trim();
84
- if (a.test(e)) {
85
- for (b += 1; b < _.length && !a.test(_[b].replace(c, ""));) b += 1;
86
- b += 1, v.push(k(r.codeBlock));
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() && p.test(e)) {
90
- for (b += 1; b < _.length;) {
91
- let e = _[b].replace(c, "");
92
- if (e.trim() && p.test(e)) {
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 < _.length && !_[t].replace(c, "").trim();) t += 1;
99
- let n = t < _.length ? _[t].replace(c, "") : "";
100
- if (!n.trim() || !p.test(n)) break;
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
- v.push(k(r.codeBlock));
103
+ p.push(j(r.codeBlock));
104
104
  continue;
105
105
  }
106
- if (s.test(e)) {
106
+ if (l.test(e)) {
107
107
  b += 1;
108
108
  continue;
109
109
  }
110
- if (f.test(e)) {
110
+ if (m.test(e)) {
111
111
  b += 1;
112
112
  continue;
113
113
  }
114
- let n = b + 1 < _.length ? _[b + 1].replace(c, "") : "";
115
- if (e.includes("|") && h(n)) {
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 = g(e).map((e) => O(e, r));
117
+ let t = v(e).map((e) => A(e, r));
118
118
  b += 2;
119
119
  let n = [];
120
- for (; b < _.length;) {
121
- let e = _[b].replace(c, "");
120
+ for (; b < o.length;) {
121
+ let e = o[b].replace(u, "");
122
122
  if (!e.includes("|") || !e.trim()) break;
123
- n.push(g(e).map((e) => O(e, r))), b += 1;
123
+ n.push(v(e).map((e) => A(e, r))), b += 1;
124
124
  }
125
- if (n.length > d) v.push(k(m(r.largeTable, {
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 && v.push(k(n.join(", ")));
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 = o.exec(e);
140
+ let i = c.exec(e);
141
141
  if (i) {
142
142
  y.length = 0;
143
- let e = O(i[1].replace(/\s+#+\s*$/, ""), r);
144
- e && v.push(k(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 = l.exec(e), S = e, C = "";
147
+ let x = d.exec(e), S = e, C = "";
148
148
  if (x) {
149
- S = e.slice(x[0].length).replace(u, "");
150
- let t = j(x[1]);
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 = M(y, r);
155
+ }), C = P(y, r);
156
156
  } else /^\s/.test(e) || (y.length = 0);
157
- if (!x && f.test(n)) {
157
+ if (!x && m.test(n)) {
158
158
  y.length = 0, b += 1;
159
- let t = O(e, r);
160
- t && v.push(k(t));
159
+ let t = A(e, r);
160
+ t && p.push(j(t));
161
161
  continue;
162
162
  }
163
- let w = O(S, r);
164
- w && v.push(k(`${C}${w}`));
163
+ let w = A(S, r);
164
+ w && p.push(j(`${C}${w}`));
165
165
  }
166
- return A(v.join("\n").replace(/\n{2,}/g, "\n").trim(), i, k(r.truncated));
166
+ return M(p.join("\n").replace(/\n{2,}/g, "\n").trim(), i, j(r.truncated));
167
167
  }
168
- var P = new Set([
168
+ var I = new Set([
169
169
  ".",
170
170
  "!",
171
171
  "?"
172
- ]), F = new Set([
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
- ]), I = new Set([
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
- ]), L = 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(",")), R = new Set([
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
- ]), z = /^\d+(?:\.\d+)*$/, B = /^[A-Za-z]$/;
209
- function V(e, t, n) {
210
- for (let r = t; r < n; r += 1) if (F.has(e[r])) return !0;
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 (z.test(i) && !r.slice(0, r.length - i.length).trim()) return !1;
215
+ if (V.test(i) && !r.slice(0, r.length - i.length).trim()) return !1;
216
216
  let a = i.toLowerCase();
217
- return B.test(i) || L.has(a) ? !1 : R.has(a) ? !/^\s*\d/.test(e.slice(n)) : !0;
217
+ return H.test(i) || z.has(a) ? !1 : B.has(a) ? !/^\s*\d/.test(e.slice(n)) : !0;
218
218
  }
219
- function H(e) {
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 (!P.has(n) && !F.has(n)) {
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 && (P.has(e[a]) || F.has(e[a]));) a += 1;
233
- for (; a < e.length && I.has(e[a]);) a += 1;
234
- if (V(e, i, a)) {
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 U = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff66-\uff9f]/, W = /[\u3000-\u303f\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff01-\uff9f]/, G = /[、,,;;::。!?!?]/, K = /[A-Za-z0-9][A-Za-z0-9._,:%/+-]*[A-Za-z0-9%]|[\s\S]/gu;
246
- function q(e) {
247
- return U.test(e);
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 J(e, t) {
249
+ function X(e, t) {
250
250
  let n = `${e.slice(-1)}${t.slice(0, 1)}`;
251
- return W.test(n) ? `${e}${t}` : `${e} ${t}`;
251
+ return K.test(n) ? `${e}${t}` : `${e} ${t}`;
252
252
  }
253
- function Y(e, t) {
253
+ function Z(e, t) {
254
254
  let n = t.trim();
255
255
  n && e.push(n);
256
256
  }
257
- function X(e, t) {
257
+ function Q(e, t) {
258
258
  let n = [], r = "", i = -1;
259
- for (let a of e.match(K) ?? []) {
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
- Y(n, r.slice(0, i));
262
+ Z(n, r.slice(0, i));
263
263
  let e = r.slice(i);
264
- e.trim().length + a.length > t ? (Y(n, e), r = "") : r = e;
265
- } else Y(n, r), r = "";
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
- Y(n, r), r = "", i = -1;
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, G.test(a) && (i = r.length);
273
+ r += a, q.test(a) && (i = r.length);
274
274
  }
275
- return Y(n, r), n;
275
+ return Z(n, r), n;
276
276
  }
277
- function Z(e, t) {
278
- if (q(e)) return X(e, t);
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 Q(e, t = 180, n = 40) {
291
- let r = Math.max(1, t), i = Math.max(1, Math.min(n, r)), a = [], o = "", s = r;
292
- for (let t of H(e)) {
293
- let e = q(t) ? i : r;
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
- o &&= (a.push(o), ""), a.push(...Z(t, e)), s = r;
295
+ s &&= (o.push(s), ""), o.push(...$(t, e)), c = i;
296
296
  continue;
297
297
  }
298
- if (!o) {
299
- o = t, s = e;
298
+ if (!s) {
299
+ s = t, c = e;
300
300
  continue;
301
301
  }
302
- let n = J(o, t), c = Math.min(s, e);
303
- n.length <= c ? (o = n, s = c) : (a.push(o), o = t, s = e);
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 (o && a.push(o), a.length > 1) {
306
- let e = H(a[0]);
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
- a.splice(0, 1, t, n.reduce((e, t) => J(e, t)));
309
+ o.splice(0, 1, t, n.reduce((e, t) => X(e, t)));
310
310
  }
311
311
  }
312
- return a;
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, Q as chunkForSpeech, q as containsCjk, S as speakableEmail, g as splitTableRow, N as toSpeakableText };
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 };