@naersen/tts-rich-text 0.1.0

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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -0
  3. package/dist/components/cx-button/index.d.ts +9 -0
  4. package/dist/components/cx-button/index.vue.d.ts +20 -0
  5. package/dist/components/cx-empty/index.d.ts +2 -0
  6. package/dist/components/cx-empty/index.vue.d.ts +26 -0
  7. package/dist/components/cx-radio-group/index.d.ts +3 -0
  8. package/dist/components/cx-radio-group/index.vue.d.ts +19 -0
  9. package/dist/components/cx-radio-group/type/index.d.ts +25 -0
  10. package/dist/components/cx-spin/index.d.ts +3 -0
  11. package/dist/components/cx-spin/index.vue.d.ts +26 -0
  12. package/dist/components/cx-upload/index.d.ts +3 -0
  13. package/dist/components/cx-upload/index.vue.d.ts +43 -0
  14. package/dist/components/cx-upload/type/index.d.ts +15 -0
  15. package/dist/components/index.d.ts +8 -0
  16. package/dist/components/svg-icon/index.d.ts +44 -0
  17. package/dist/components/svg-icon/index.vue.d.ts +12 -0
  18. package/dist/components/tts-rich-text/components/ai-rewrite-modal.vue.d.ts +10 -0
  19. package/dist/components/tts-rich-text/components/editor-footer.vue.d.ts +2 -0
  20. package/dist/components/tts-rich-text/components/editor-tool-button.vue.d.ts +67 -0
  21. package/dist/components/tts-rich-text/components/editor-toolbar.vue.d.ts +193 -0
  22. package/dist/components/tts-rich-text/components/formula-modal.vue.d.ts +10 -0
  23. package/dist/components/tts-rich-text/components/mark-pinyin-modal.vue.d.ts +8 -0
  24. package/dist/components/tts-rich-text/components/replace-text-modal.vue.d.ts +8 -0
  25. package/dist/components/tts-rich-text/components/selection-menu.vue.d.ts +4 -0
  26. package/dist/components/tts-rich-text/components/tag-node-view.vue.d.ts +92 -0
  27. package/dist/components/tts-rich-text/components/toolbar-popovers/language-popover.vue.d.ts +18 -0
  28. package/dist/components/tts-rich-text/components/toolbar-popovers/number-reading-popover.vue.d.ts +18 -0
  29. package/dist/components/tts-rich-text/components/toolbar-popovers/stop-popover.vue.d.ts +14 -0
  30. package/dist/components/tts-rich-text/components/type/index.d.ts +18 -0
  31. package/dist/components/tts-rich-text/components/upload-modal.vue.d.ts +101 -0
  32. package/dist/components/tts-rich-text/editor/config.d.ts +93 -0
  33. package/dist/components/tts-rich-text/editor/index.d.ts +5 -0
  34. package/dist/components/tts-rich-text/editor/nodes/tag-node.d.ts +13 -0
  35. package/dist/components/tts-rich-text/editor/plugins/tts-character-count.d.ts +17 -0
  36. package/dist/components/tts-rich-text/editor/type.d.ts +8 -0
  37. package/dist/components/tts-rich-text/editor/useEditorToolbar.d.ts +33 -0
  38. package/dist/components/tts-rich-text/editor/useOverflowToolbar.d.ts +13 -0
  39. package/dist/components/tts-rich-text/editor/useRichTextEditor.d.ts +91 -0
  40. package/dist/components/tts-rich-text/editor/useSSETool.d.ts +16 -0
  41. package/dist/components/tts-rich-text/editor/useTestAudioTool.d.ts +4 -0
  42. package/dist/components/tts-rich-text/editor/utils/index.d.ts +3 -0
  43. package/dist/components/tts-rich-text/editor/utils/number-to-text.d.ts +31 -0
  44. package/dist/components/tts-rich-text/editor/utils/sanitize-pasted-text.d.ts +2 -0
  45. package/dist/components/tts-rich-text/editor/utils/split-sentence.d.ts +7 -0
  46. package/dist/components/tts-rich-text/editor/utils/transform-data.d.ts +24 -0
  47. package/dist/components/tts-rich-text/hooks/useGlobalAudioControl.d.ts +4 -0
  48. package/dist/components/tts-rich-text/hooks/useSynthesizeAudioTool.d.ts +248 -0
  49. package/dist/components/tts-rich-text/hooks/useVoiceChangeConfirm.d.ts +6 -0
  50. package/dist/components/tts-rich-text/index.d.ts +9 -0
  51. package/dist/components/tts-rich-text-editor/index.d.ts +1 -0
  52. package/dist/components/tts-rich-text-editor/index.vue.d.ts +57 -0
  53. package/dist/core/config.d.ts +67 -0
  54. package/dist/core/index.d.ts +6 -0
  55. package/dist/core/number-to-text.d.ts +31 -0
  56. package/dist/core/sanitize-pasted-text.d.ts +2 -0
  57. package/dist/core/split-sentence.d.ts +7 -0
  58. package/dist/core/transform-data.d.ts +13 -0
  59. package/dist/core.d.ts +2 -0
  60. package/dist/core.js +509 -0
  61. package/dist/editor/index.d.ts +4 -0
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/useControlValue.d.ts +4 -0
  64. package/dist/hooks/useRenderSlots.d.ts +6 -0
  65. package/dist/index.d.ts +5 -0
  66. package/dist/index.js +31916 -0
  67. package/dist/services/index.d.ts +1 -0
  68. package/dist/style/index.d.ts +0 -0
  69. package/dist/style.css +1 -0
  70. package/dist/type/index.d.ts +102 -0
  71. package/dist/utils/index.d.ts +7 -0
  72. package/package.json +82 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 数字转文字工具类
3
+ */
4
+ /**
5
+ * 基数读法:逐字转换
6
+ * 示例: 123 -> "一二三"
7
+ * @param numStr 数字字符串
8
+ */
9
+ export declare function toCardinal(numStr: string): string;
10
+ /**
11
+ * 电话号读法:逐位用电话专用读音
12
+ * 示例: 13800138000 -> "幺三八洞洞幺三八洞洞洞"
13
+ * @param numStr 数字字符串
14
+ */
15
+ export declare function toPhoneReading(numStr: string): string;
16
+ /**
17
+ * 位数读法 / 口语读法:按中文习惯读取
18
+ * 示例: 123 -> "一百二十三", 10000 -> "一万"
19
+ * @param numStr 数字字符串
20
+ */
21
+ export declare function toPositional(numStr: string): string;
22
+ /**
23
+ * 口语读法:目前逻辑与位数读法一致
24
+ * 如果需要区分(例如口语中更倾向于省略某些“零”),可以在此处修改逻辑
25
+ * @param numStr 数字字符串
26
+ */
27
+ export declare function toColloquial(numStr: string): string;
28
+ export declare const NumberToTextTools: {
29
+ label: string;
30
+ func: typeof toCardinal;
31
+ }[];
@@ -0,0 +1,2 @@
1
+ export declare const sanitizePastedText: (text: string) => string;
2
+ export declare const sanitizePastedHtml: (html: string) => string;
@@ -0,0 +1,7 @@
1
+ export interface SentenceSplitOptions {
2
+ minSegmentLength?: number;
3
+ maxSegmentLength?: number;
4
+ rebalanceRatio?: number;
5
+ }
6
+ export declare const getVisualLength: (text: string) => number;
7
+ export declare const splitTextToSentences: (text: string, options?: SentenceSplitOptions) => string[];
@@ -0,0 +1,13 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+ import { TtsInputData, TtsPlayment } from '../type';
3
+ interface SentenceResult {
4
+ text: string;
5
+ protectedRanges?: Array<{
6
+ start: number;
7
+ end: number;
8
+ }>;
9
+ playments: TtsPlayment[];
10
+ }
11
+ export declare const transformParagraph: (paragraphNode: JSONContent) => SentenceResult;
12
+ export declare const convertToTtsFormat: (data: JSONContent) => TtsInputData;
13
+ export {};
package/dist/core.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './core/index'
2
+ export {}
package/dist/core.js ADDED
@@ -0,0 +1,509 @@
1
+ const f = {
2
+ DELETE_NODE: "deleteNode",
3
+ CONVERT_TO_TEXT: "convertToText"
4
+ }, h = {
5
+ stop: {
6
+ label: "停顿",
7
+ type: "stop",
8
+ deleteMode: f.DELETE_NODE
9
+ },
10
+ customStop: {
11
+ label: "长停顿",
12
+ type: "customStop",
13
+ deleteMode: f.DELETE_NODE
14
+ },
15
+ continue: {
16
+ label: "连续",
17
+ type: "continue",
18
+ deleteMode: f.CONVERT_TO_TEXT
19
+ },
20
+ pinyin: {
21
+ label: "拼音标注",
22
+ type: "pinyin",
23
+ deleteMode: f.CONVERT_TO_TEXT
24
+ },
25
+ replace: {
26
+ label: "替换",
27
+ type: "replace",
28
+ deleteMode: f.CONVERT_TO_TEXT
29
+ },
30
+ language: {
31
+ label: "语种标记",
32
+ type: "language",
33
+ deleteMode: f.CONVERT_TO_TEXT
34
+ },
35
+ number: {
36
+ label: "数字读法",
37
+ type: "number"
38
+ },
39
+ formula: {
40
+ label: "读公式",
41
+ type: "formula"
42
+ },
43
+ aiRewrite: {
44
+ label: "AI 改写",
45
+ type: "aiRewrite"
46
+ },
47
+ upload: {
48
+ label: "上传文稿",
49
+ type: "upload"
50
+ }
51
+ }, _ = [
52
+ { value: "zh", label: "中文" },
53
+ { value: "en", label: "英语" },
54
+ { value: "jp", label: "日语" },
55
+ { value: "kr", label: "韩语" },
56
+ { value: "de", label: "德语" },
57
+ { value: "fr", label: "法语" },
58
+ { value: "es", label: "西班牙语" },
59
+ { value: "it", label: "意大利语" },
60
+ { value: "pt", label: "葡萄牙语" },
61
+ { value: "ru", label: "俄语" }
62
+ ], le = [
63
+ { label: "停顿 0.5 秒", value: 0.5 },
64
+ { label: "停顿 1 秒", value: 1 }
65
+ ], S = Object.keys(h), d = {
66
+ tools: S,
67
+ languages: _,
68
+ maxPinyinLength: 4,
69
+ maxNumberLength: 16,
70
+ enablePreview: !0
71
+ }, C = {
72
+ 1: {
73
+ tools: [
74
+ "customStop",
75
+ "pinyin",
76
+ "replace",
77
+ "language",
78
+ "number",
79
+ "formula",
80
+ "aiRewrite",
81
+ "upload"
82
+ ],
83
+ languages: _.filter(
84
+ (e) => ["zh", "en"].includes(e.value)
85
+ )
86
+ },
87
+ 2: d
88
+ }, ae = (e, o = {}) => {
89
+ const t = C[e] ?? d;
90
+ return {
91
+ ...d,
92
+ ...t,
93
+ ...o,
94
+ tools: o.tools ?? t.tools ?? d.tools,
95
+ languages: o.languages ?? t.languages ?? d.languages
96
+ };
97
+ }, ie = () => ({
98
+ type: "doc",
99
+ content: [
100
+ {
101
+ type: "paragraph",
102
+ content: []
103
+ }
104
+ ]
105
+ }), I = {
106
+ 0: "零",
107
+ 1: "一",
108
+ 2: "二",
109
+ 3: "三",
110
+ 4: "四",
111
+ 5: "五",
112
+ 6: "六",
113
+ 7: "七",
114
+ 8: "八",
115
+ 9: "九"
116
+ }, v = {
117
+ 0: "洞",
118
+ 1: "幺",
119
+ 2: "二",
120
+ 3: "三",
121
+ 4: "四",
122
+ 5: "五",
123
+ 6: "六",
124
+ 7: "七",
125
+ 8: "八",
126
+ 9: "九"
127
+ }, A = ["", "十", "百", "千"], D = ["", "万", "亿", "万亿"];
128
+ function w(e) {
129
+ return e ? e.split("").map((o) => I[o] || o).join("") : "";
130
+ }
131
+ function ce(e) {
132
+ return e ? e.split("").map((o) => v[o] || o).join("") : "";
133
+ }
134
+ function V(e) {
135
+ const o = e.length;
136
+ let t = "", n = !1;
137
+ for (let s = 0; s < o; s++) {
138
+ const i = e[s], r = o - 1 - s;
139
+ i === "0" ? !n && t !== "" && (n = !0) : (n && (t += "零", n = !1), t += I[i] + A[r]);
140
+ }
141
+ return t.startsWith("一十") && t.length === 2 && (t = t.substring(1)), t;
142
+ }
143
+ function F(e) {
144
+ if (!e) return "";
145
+ if (e === "0" || (e = e.replace(/^0+/, "") || "0", e === "0")) return "零";
146
+ let o = "";
147
+ const t = e.length, n = [];
148
+ for (let s = t; s > 0; s -= 4) {
149
+ const i = Math.max(0, s - 4);
150
+ n.unshift(e.substring(i, s));
151
+ }
152
+ for (let s = 0; s < n.length; s++) {
153
+ const i = n[s], r = V(i);
154
+ if (r !== "") {
155
+ const l = n.length - 1 - s;
156
+ o += r + D[l];
157
+ }
158
+ }
159
+ return o;
160
+ }
161
+ function $(e) {
162
+ return F(e);
163
+ }
164
+ const ue = [
165
+ { label: "基数读法", func: w },
166
+ // { label: '位数读法', func: toPhoneReading },
167
+ { label: "位数读法", func: F },
168
+ { label: "口语读法", func: $ }
169
+ ], B = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFE00-\uFE0F\uFEFF\uFFFD\uE000-\uF8FF]/g, j = /[\t\f\v\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g, L = {
170
+ "‘": "'",
171
+ "’": "'",
172
+ "‚": "'",
173
+ "‛": "'",
174
+ "“": '"',
175
+ "”": '"',
176
+ "„": '"',
177
+ "‟": '"',
178
+ "…": "......",
179
+ "‥": "......",
180
+ "–": "-",
181
+ "—": "-",
182
+ "―": "-",
183
+ "−": "-",
184
+ "﹣": "-",
185
+ "-": "-",
186
+ "·": " ",
187
+ "•": " ",
188
+ "●": " ",
189
+ "○": " ",
190
+ "■": " ",
191
+ "□": " ",
192
+ "。": "。",
193
+ "。": "。",
194
+ "︒": "。",
195
+ "﹐": ",",
196
+ "、": "、",
197
+ "︓": ":",
198
+ "︔": ";",
199
+ "︕": "!",
200
+ "︖": "?"
201
+ }, U = new RegExp(
202
+ `[${Object.keys(L).join("")}]`,
203
+ "g"
204
+ ), z = (e) => e.replace(/[\uFF21-\uFF3A\uFF41-\uFF5A\uFF10-\uFF19]/g, (o) => String.fromCharCode(o.charCodeAt(0) - 65248)), H = (e) => z(e).replace(/\r\n?/g, `
205
+ `).replace(/[\u2028\u2029]/g, `
206
+ `).replace(B, "").replace(j, " ").replace(U, (o) => L[o] || "").replace(/ *\n */g, `
207
+ `).replace(/\n{3,}/g, `
208
+
209
+ `), pe = (e) => {
210
+ if (typeof window > "u" || !e)
211
+ return e;
212
+ const t = new DOMParser().parseFromString(e, "text/html"), n = t.createTreeWalker(t.body, NodeFilter.SHOW_TEXT);
213
+ let s = n.nextNode();
214
+ for (; s; )
215
+ s.textContent = H(s.textContent || ""), s = n.nextNode();
216
+ return t.body.innerHTML;
217
+ }, k = {
218
+ minSegmentLength: 32,
219
+ maxSegmentLength: 128,
220
+ rebalanceRatio: 0.4
221
+ }, y = /[一-鿿㐀-䶿豈-﫿 -〿＀-￯]/, X = /[。!?!?\.]/, G = /[;;]/, W = /[,,、::]/, K = /[。!?!?,,、;;::\.]/, O = "", R = "", p = (e) => {
222
+ let o = 0;
223
+ for (const t of e)
224
+ o += y.test(t) ? 2 : 1;
225
+ return o;
226
+ }, Y = (e) => e.replace(/\r/g, "").split(`
227
+ `).map((o) => o.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim(), q = (e) => {
228
+ let o = e, t = "";
229
+ for (; t !== o; )
230
+ t = o, o = o.replace(/(\d),(\d)/g, `$1${O}$2`);
231
+ for (t = ""; t !== o; )
232
+ t = o, o = o.replace(/(\d)\.(\d)/g, `$1${R}$2`);
233
+ return o;
234
+ }, b = (e) => e.split(O).join(",").split(R).join("."), E = (e, o) => {
235
+ let t = 0;
236
+ for (let n = 0; n < e.length; n += 1)
237
+ if (t += y.test(e[n]) ? 2 : 1, t >= o)
238
+ return n + 1;
239
+ return e.length;
240
+ }, x = (e, o, t, n, s) => {
241
+ let i = -1, r = Number.POSITIVE_INFINITY;
242
+ const l = Math.max(1, t), c = Math.min(e.length, n);
243
+ for (let a = l; a <= c; a += 1) {
244
+ if (!s.test(e[a - 1]))
245
+ continue;
246
+ const u = Math.abs(a - o);
247
+ if (u < r && (r = u, i = a), a > o && i >= 0)
248
+ break;
249
+ }
250
+ return i;
251
+ }, P = (e, o, t, n) => {
252
+ let s = -1, i = Number.POSITIVE_INFINITY;
253
+ const r = Math.max(1, t), l = Math.min(e.length, n);
254
+ for (let c = r; c <= l; c += 1) {
255
+ if (e[c - 1] !== " ")
256
+ continue;
257
+ const a = Math.abs(c - o);
258
+ if (a < i && (i = a, s = c), c > o && s >= 0)
259
+ break;
260
+ }
261
+ return s;
262
+ }, J = (e, o) => {
263
+ const t = [];
264
+ let n = e.trim();
265
+ for (; n && p(n) > o; ) {
266
+ const s = p(n), i = Math.min(
267
+ Math.floor(s / 2),
268
+ o
269
+ ), r = E(n, i), l = Math.max(1, Math.floor(r / 3)), c = Math.max(
270
+ r + 1,
271
+ E(n, o)
272
+ );
273
+ let a = x(
274
+ n,
275
+ r,
276
+ l,
277
+ c,
278
+ G
279
+ );
280
+ a < 0 && (a = x(
281
+ n,
282
+ r,
283
+ l,
284
+ c,
285
+ W
286
+ )), a < 0 && (a = P(
287
+ n,
288
+ r,
289
+ l,
290
+ c
291
+ )), (a < 0 || a >= n.length) && (a = r), t.push(n.slice(0, a).trim()), n = n.slice(a).trim();
292
+ }
293
+ return n && t.push(n), t;
294
+ }, Z = (e, o) => {
295
+ if (e.length <= 1)
296
+ return e;
297
+ const t = e[e.length - 1], n = e.reduce((T, m) => T + p(m), 0) / e.length, s = Math.floor(n * o);
298
+ if (p(t) >= s)
299
+ return e;
300
+ const r = `${e[e.length - 2]}${t}`, l = Math.floor(p(r) / 2), c = E(r, l), a = Math.max(1, Math.floor(c / 3));
301
+ let u = x(
302
+ r,
303
+ c,
304
+ a,
305
+ r.length,
306
+ K
307
+ );
308
+ if (u < 0 && (u = P(
309
+ r,
310
+ c,
311
+ a,
312
+ r.length
313
+ )), u <= 0 || u >= r.length)
314
+ return e;
315
+ const g = [...e];
316
+ return g[g.length - 2] = r.slice(0, u).trim(), g[g.length - 1] = r.slice(u).trim(), g.filter(Boolean);
317
+ }, Q = (e, o = {}) => {
318
+ const t = {
319
+ ...k,
320
+ ...o
321
+ }, n = Y(e);
322
+ if (!n)
323
+ return [];
324
+ const s = q(n);
325
+ if (p(s) <= t.minSegmentLength)
326
+ return [b(s)];
327
+ const i = [], r = s.split(new RegExp("(?<=[。!?!?\\.])"));
328
+ let l = "";
329
+ for (const a of r) {
330
+ if (!a)
331
+ continue;
332
+ l += a;
333
+ const u = l[l.length - 1] ?? "";
334
+ p(l) >= t.minSegmentLength && X.test(u) && (i.push(l.trim()), l = "");
335
+ }
336
+ l && (i.length > 0 && p(l) < t.minSegmentLength ? i[i.length - 1] += l : i.push(l.trim()));
337
+ const c = i.flatMap((a) => p(a) <= t.maxSegmentLength ? [a] : J(a, t.maxSegmentLength));
338
+ return Z(
339
+ c,
340
+ t.rebalanceRatio
341
+ ).map(b);
342
+ }, M = (e) => e.type === "text" ? e.text || "" : (e.content || []).map(M).join(""), ee = (e) => {
343
+ const o = e.content || [];
344
+ let t = "";
345
+ const n = [], s = [], i = {
346
+ [h.stop.type]: ({ position: r, actionCode: l }) => {
347
+ n.push({
348
+ action: "insert",
349
+ model: "control",
350
+ payload: "。 ",
351
+ position: r,
352
+ text: "",
353
+ actionCode: l
354
+ });
355
+ },
356
+ [h.customStop.type]: ({ payload: r, position: l, actionCode: c }) => {
357
+ n.push({
358
+ action: "insert",
359
+ model: "control",
360
+ payload: `[stop:${r == null ? void 0 : r.time}]`,
361
+ position: l,
362
+ text: "",
363
+ actionCode: c
364
+ });
365
+ },
366
+ [h.continue.type]: ({ position: r, text: l, actionCode: c }) => {
367
+ n.push({
368
+ action: "replace",
369
+ model: "replace",
370
+ payload: `《${l}》`,
371
+ position: r,
372
+ text: l,
373
+ actionCode: c
374
+ });
375
+ },
376
+ [h.replace.type]: ({ payload: r, position: l, text: c, actionCode: a }) => {
377
+ n.push({
378
+ action: "replace",
379
+ model: "replace",
380
+ payload: `${r == null ? void 0 : r.text}`,
381
+ position: l,
382
+ text: c,
383
+ actionCode: a
384
+ });
385
+ },
386
+ [h.pinyin.type]: ({ payload: r, position: l, text: c, actionCode: a }) => {
387
+ n.push({
388
+ action: "replace",
389
+ model: "pinyin",
390
+ payload: `${r == null ? void 0 : r.text}`,
391
+ position: l,
392
+ text: c,
393
+ actionCode: a
394
+ });
395
+ },
396
+ [h.language.type]: ({ payload: r, position: l, text: c, actionCode: a }) => {
397
+ n.push({
398
+ action: "language",
399
+ model: "language",
400
+ payload: `${r == null ? void 0 : r.code}`,
401
+ position: l,
402
+ text: c,
403
+ actionCode: a
404
+ });
405
+ }
406
+ };
407
+ return o.forEach((r) => {
408
+ var T, m;
409
+ if (r.type === "text") {
410
+ t += r.text || "";
411
+ return;
412
+ }
413
+ if (r.type !== "customTag") return;
414
+ const l = (T = r.attrs) == null ? void 0 : T.categ, c = (m = r.attrs) == null ? void 0 : m.payload, a = t.length, u = M(r), g = i[l];
415
+ u && s.push({
416
+ start: a,
417
+ end: a + u.length
418
+ }), g && g({
419
+ payload: c,
420
+ position: a,
421
+ text: u,
422
+ actionCode: l
423
+ }), t += u;
424
+ }), {
425
+ text: t,
426
+ protectedRanges: s,
427
+ playments: n
428
+ };
429
+ }, N = (e) => e.type === "text" || e.type === "customTag", te = (e) => {
430
+ const o = e.content || [];
431
+ if (e.type === "paragraph") return [e];
432
+ if (e.type === "doc")
433
+ return o.filter((n) => n.type === "paragraph");
434
+ const t = o.filter((n) => n.type === "paragraph");
435
+ return t.length ? t : o.some(N) ? [
436
+ {
437
+ type: "paragraph",
438
+ content: o.filter(N)
439
+ }
440
+ ] : [];
441
+ }, ne = (e, o) => {
442
+ let t = 0;
443
+ return o.map((n) => {
444
+ const s = e.indexOf(n, t), i = s >= 0 ? s : t, r = i + n.length;
445
+ return t = r, {
446
+ text: n,
447
+ start: i,
448
+ end: r
449
+ };
450
+ });
451
+ }, oe = (e, o) => e.reduce((t, n) => {
452
+ if (o.some(
453
+ (i) => n.start > i.start && n.start < i.end
454
+ ) && t.length) {
455
+ const i = t[t.length - 1];
456
+ return i.text += n.text, i.end = n.end, t;
457
+ }
458
+ return t.push({ ...n }), t;
459
+ }, []), re = (e, o, t, n) => e.position >= o && e.position < t ? !0 : !e.text && n && e.position === t, se = (e) => {
460
+ const o = Q(e.text);
461
+ if (o.length <= 1) return [e];
462
+ const t = oe(
463
+ ne(e.text, o),
464
+ e.protectedRanges || []
465
+ );
466
+ return t.map((n, s) => {
467
+ const i = s === t.length - 1, r = e.playments.filter(
468
+ (l) => re(l, n.start, n.end, i)
469
+ ).map((l) => ({
470
+ ...l,
471
+ position: l.position - n.start
472
+ }));
473
+ return {
474
+ text: n.text,
475
+ playments: r
476
+ };
477
+ });
478
+ }, ge = (e) => {
479
+ const o = {
480
+ playments: [],
481
+ sentences: []
482
+ };
483
+ return te(e).forEach((n) => {
484
+ const s = ee(n);
485
+ !s.text && !s.playments.length || se(s).forEach(({ text: i, playments: r }) => {
486
+ o.sentences.push(i), o.playments.push(r);
487
+ });
488
+ }), o;
489
+ };
490
+ export {
491
+ f as DeleteMode,
492
+ _ as LanguageOptions,
493
+ ue as NumberToTextTools,
494
+ le as StopOptions,
495
+ h as ToolConfig,
496
+ S as allToolTypes,
497
+ ge as convertToTtsFormat,
498
+ ie as getInitContent,
499
+ p as getVisualLength,
500
+ ae as resolveTtsEditorFeatures,
501
+ pe as sanitizePastedHtml,
502
+ H as sanitizePastedText,
503
+ Q as splitTextToSentences,
504
+ w as toCardinal,
505
+ $ as toColloquial,
506
+ ce as toPhoneReading,
507
+ F as toPositional,
508
+ ee as transformParagraph
509
+ };
@@ -0,0 +1,4 @@
1
+ export { useEditorContext, useEditorProvider, useRichTextEditor, type UseRichTextEditorOptions } from '../components/tts-rich-text/editor/useRichTextEditor';
2
+ export { createCustomTagNode, CustomTagName } from '../components/tts-rich-text/editor/nodes/tag-node';
3
+ export { createTtsCharacterCount } from '../components/tts-rich-text/editor/plugins/tts-character-count';
4
+ export { useVoiceChangeConfirm } from '../components/tts-rich-text/hooks/useVoiceChangeConfirm';
@@ -0,0 +1,2 @@
1
+ export * from './useControlValue';
2
+ export * from './useRenderSlots';
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ type Fn = (...args: any[]) => any;
3
+ export declare const useControlValue: <T>(modelValue: Ref<T | undefined>, defaultValue: T, onSet?: Fn, onGet?: Fn) => import('vue').WritableComputedRef<any, T>;
4
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const useRenderSlots: (slotNames: string[]) => {
2
+ slots: Readonly<{
3
+ [name: string]: import('vue').Slot<any> | undefined;
4
+ }>;
5
+ renderSlots: import('vue').ComputedRef<string[]>;
6
+ };
@@ -0,0 +1,5 @@
1
+ export * from './components';
2
+ export * from './core';
3
+ export * from './editor';
4
+ export * from './services';
5
+ export * from './type';