speechflow 1.4.2 → 1.4.4

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 (115) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/etc/stx.conf +17 -11
  3. package/package.json +7 -4
  4. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.d.ts +13 -0
  5. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +153 -0
  6. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -0
  7. package/speechflow-cli/dst/speechflow-node-a2a-gender.d.ts +20 -0
  8. package/speechflow-cli/dst/speechflow-node-a2a-gender.js +349 -0
  9. package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -0
  10. package/speechflow-cli/dst/speechflow-node-a2a-meter.d.ts +16 -0
  11. package/speechflow-cli/dst/speechflow-node-a2a-meter.js +232 -0
  12. package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -0
  13. package/speechflow-cli/dst/speechflow-node-a2a-mute.d.ts +17 -0
  14. package/speechflow-cli/dst/speechflow-node-a2a-mute.js +117 -0
  15. package/speechflow-cli/dst/speechflow-node-a2a-mute.js.map +1 -0
  16. package/speechflow-cli/dst/speechflow-node-a2a-vad.d.ts +19 -0
  17. package/speechflow-cli/dst/speechflow-node-a2a-vad.js +374 -0
  18. package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -0
  19. package/speechflow-cli/dst/speechflow-node-a2a-wav.d.ts +11 -0
  20. package/speechflow-cli/dst/speechflow-node-a2a-wav.js +211 -0
  21. package/speechflow-cli/dst/speechflow-node-a2a-wav.js.map +1 -0
  22. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.d.ts +19 -0
  23. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +328 -0
  24. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -0
  25. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.d.ts +18 -0
  26. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js +238 -0
  27. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js.map +1 -0
  28. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.d.ts +14 -0
  29. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +155 -0
  30. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -0
  31. package/speechflow-cli/dst/speechflow-node-t2t-deepl.d.ts +15 -0
  32. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js +146 -0
  33. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js.map +1 -0
  34. package/speechflow-cli/dst/speechflow-node-t2t-format.d.ts +11 -0
  35. package/speechflow-cli/dst/speechflow-node-t2t-format.js +82 -0
  36. package/speechflow-cli/dst/speechflow-node-t2t-format.js.map +1 -0
  37. package/speechflow-cli/dst/speechflow-node-t2t-ollama.d.ts +13 -0
  38. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +247 -0
  39. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -0
  40. package/speechflow-cli/dst/speechflow-node-t2t-openai.d.ts +13 -0
  41. package/speechflow-cli/dst/speechflow-node-t2t-openai.js +227 -0
  42. package/speechflow-cli/dst/speechflow-node-t2t-openai.js.map +1 -0
  43. package/speechflow-cli/dst/speechflow-node-t2t-sentence.d.ts +17 -0
  44. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +250 -0
  45. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -0
  46. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.d.ts +13 -0
  47. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +278 -0
  48. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -0
  49. package/speechflow-cli/dst/speechflow-node-t2t-transformers.d.ts +14 -0
  50. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js +265 -0
  51. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js.map +1 -0
  52. package/speechflow-cli/dst/speechflow-node-x2x-filter.d.ts +11 -0
  53. package/speechflow-cli/dst/speechflow-node-x2x-filter.js +121 -0
  54. package/speechflow-cli/dst/speechflow-node-x2x-filter.js.map +1 -0
  55. package/speechflow-cli/dst/speechflow-node-x2x-trace.d.ts +11 -0
  56. package/speechflow-cli/dst/speechflow-node-x2x-trace.js +111 -0
  57. package/speechflow-cli/dst/speechflow-node-x2x-trace.js.map +1 -0
  58. package/speechflow-cli/dst/speechflow-node-xio-device.d.ts +13 -0
  59. package/speechflow-cli/dst/speechflow-node-xio-device.js +230 -0
  60. package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -0
  61. package/speechflow-cli/dst/speechflow-node-xio-file.d.ts +11 -0
  62. package/speechflow-cli/dst/speechflow-node-xio-file.js +216 -0
  63. package/speechflow-cli/dst/speechflow-node-xio-file.js.map +1 -0
  64. package/speechflow-cli/dst/speechflow-node-xio-mqtt.d.ts +13 -0
  65. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js +188 -0
  66. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js.map +1 -0
  67. package/speechflow-cli/dst/speechflow-node-xio-websocket.d.ts +13 -0
  68. package/speechflow-cli/dst/speechflow-node-xio-websocket.js +278 -0
  69. package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -0
  70. package/speechflow-cli/dst/speechflow-node.d.ts +65 -0
  71. package/speechflow-cli/dst/speechflow-node.js +180 -0
  72. package/speechflow-cli/dst/speechflow-node.js.map +1 -0
  73. package/speechflow-cli/dst/speechflow-utils.d.ts +74 -0
  74. package/speechflow-cli/dst/speechflow-utils.js +519 -0
  75. package/speechflow-cli/dst/speechflow-utils.js.map +1 -0
  76. package/speechflow-cli/dst/speechflow.d.ts +7 -0
  77. package/speechflow-cli/dst/speechflow.js +837 -0
  78. package/speechflow-cli/dst/speechflow.js.map +1 -0
  79. package/speechflow-cli/etc/stx.conf +13 -13
  80. package/speechflow-cli/package.json +7 -7
  81. package/speechflow-cli/src/speechflow.ts +5 -5
  82. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.eot +0 -0
  83. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.ttf +0 -0
  84. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.woff +0 -0
  85. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.eot +0 -0
  86. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.ttf +0 -0
  87. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.woff +0 -0
  88. package/speechflow-ui-db/dst/app-font-fa-brands-400.woff2 +0 -0
  89. package/speechflow-ui-db/dst/app-font-fa-regular-400.woff2 +0 -0
  90. package/speechflow-ui-db/dst/app-font-fa-solid-900.woff2 +0 -0
  91. package/speechflow-ui-db/dst/app-font-fa-v4compatibility.woff2 +0 -0
  92. package/speechflow-ui-db/dst/app-icon.svg +26 -0
  93. package/speechflow-ui-db/dst/index.css +5 -0
  94. package/speechflow-ui-db/dst/index.html +24 -0
  95. package/speechflow-ui-db/dst/index.js +616 -0
  96. package/speechflow-ui-db/etc/stx.conf +17 -17
  97. package/speechflow-ui-db/package.json +2 -2
  98. package/speechflow-ui-db/src/app.vue +14 -7
  99. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.eot +0 -0
  100. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.ttf +0 -0
  101. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.woff +0 -0
  102. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.eot +0 -0
  103. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.ttf +0 -0
  104. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.woff +0 -0
  105. package/speechflow-ui-st/dst/app-font-fa-brands-400.woff2 +0 -0
  106. package/speechflow-ui-st/dst/app-font-fa-regular-400.woff2 +0 -0
  107. package/speechflow-ui-st/dst/app-font-fa-solid-900.woff2 +0 -0
  108. package/speechflow-ui-st/dst/app-font-fa-v4compatibility.woff2 +0 -0
  109. package/speechflow-ui-st/dst/app-icon.svg +26 -0
  110. package/speechflow-ui-st/dst/index.css +5 -0
  111. package/speechflow-ui-st/dst/index.html +24 -0
  112. package/speechflow-ui-st/dst/index.js +610 -0
  113. package/speechflow-ui-st/etc/stx.conf +17 -17
  114. package/speechflow-ui-st/package.json +2 -2
  115. /package/{speechflow-cli/etc → etc}/speechflow.yaml +0 -0
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ /*
3
+ ** SpeechFlow - Speech Processing Flow Graph
4
+ ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
+ ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.SpeechFlowChunk = void 0;
12
+ /* standard dependencies */
13
+ const node_events_1 = __importDefault(require("node:events"));
14
+ /* external dependencies */
15
+ const luxon_1 = require("luxon");
16
+ /* the definition of a single payload chunk passed through the SpeechFlow nodes */
17
+ class SpeechFlowChunk {
18
+ timestampStart;
19
+ timestampEnd;
20
+ kind;
21
+ type;
22
+ payload;
23
+ meta;
24
+ constructor(timestampStart, timestampEnd, kind, type, payload, meta = new Map()) {
25
+ this.timestampStart = timestampStart;
26
+ this.timestampEnd = timestampEnd;
27
+ this.kind = kind;
28
+ this.type = type;
29
+ this.payload = payload;
30
+ this.meta = meta;
31
+ }
32
+ clone() {
33
+ let payload;
34
+ if (Buffer.isBuffer(this.payload))
35
+ payload = Buffer.from(this.payload);
36
+ else
37
+ payload = String(this.payload);
38
+ return new SpeechFlowChunk(luxon_1.Duration.fromMillis(this.timestampStart.toMillis()), luxon_1.Duration.fromMillis(this.timestampEnd.toMillis()), this.kind, this.type, payload, new Map(this.meta));
39
+ }
40
+ }
41
+ exports.SpeechFlowChunk = SpeechFlowChunk;
42
+ /* the base class for all SpeechFlow nodes */
43
+ class SpeechFlowNode extends node_events_1.default.EventEmitter {
44
+ id;
45
+ cfg;
46
+ opts;
47
+ args;
48
+ static name;
49
+ /* general constant configuration (for reference) */
50
+ config = {
51
+ audioChannels: 1, /* audio mono channel */
52
+ audioBitDepth: 16, /* audio PCM 16-bit integer */
53
+ audioLittleEndian: true, /* audio PCM little-endian */
54
+ audioSampleRate: 48000, /* audio 48kHz sample rate */
55
+ textEncoding: "utf8", /* UTF-8 text encoding */
56
+ cacheDir: "" /* directory for cache files */
57
+ };
58
+ /* announced information */
59
+ input = "none";
60
+ output = "none";
61
+ params = {};
62
+ stream = null;
63
+ connectionsIn = new Set();
64
+ connectionsOut = new Set();
65
+ timeOpen;
66
+ timeZero = luxon_1.DateTime.fromMillis(0);
67
+ timeZeroOffset = luxon_1.Duration.fromMillis(0);
68
+ /* the default constructor */
69
+ constructor(id, cfg, opts, args) {
70
+ super();
71
+ this.id = id;
72
+ this.cfg = cfg;
73
+ this.opts = opts;
74
+ this.args = args;
75
+ for (const key of Object.keys(cfg)) {
76
+ const idx = key;
77
+ if (this.config[idx] !== undefined)
78
+ this.config[idx] = cfg[key];
79
+ }
80
+ }
81
+ /* set base/zero time for relative timestamp calculations */
82
+ setTimeZero(time) {
83
+ this.timeZero = time;
84
+ if (this.timeOpen === undefined)
85
+ this.timeOpen = this.timeZero;
86
+ this.timeZeroOffset = this.timeZero.diff(this.timeOpen);
87
+ }
88
+ /* receive external request */
89
+ async receiveRequest(args) {
90
+ /* no-op */
91
+ }
92
+ /* send external response */
93
+ sendResponse(args) {
94
+ this.emit("send-response", args);
95
+ }
96
+ dashboardInfo(type, id, kind, value) {
97
+ this.emit("dashboard-info", { type, id, kind, value });
98
+ }
99
+ /* INTERNAL: utility function: create "params" attribute from constructor of sub-classes */
100
+ configure(spec) {
101
+ for (const name of Object.keys(spec)) {
102
+ if (this.opts[name] !== undefined) {
103
+ /* named parameter */
104
+ if (typeof this.opts[name] !== spec[name].type)
105
+ throw new Error(`invalid type of named parameter "${name}" ` +
106
+ `(has to be ${spec[name].type})`);
107
+ if ("match" in spec[name]
108
+ && ((spec[name].match instanceof RegExp
109
+ && this.opts[name].match(spec[name].match) === null)
110
+ || (typeof spec[name].match === "function"
111
+ && !spec[name].match(this.opts[name]))))
112
+ throw new Error(`invalid value "${this.opts[name]}" of named parameter "${name}"`);
113
+ this.params[name] = this.opts[name];
114
+ }
115
+ else if (this.opts[name] === undefined
116
+ && "pos" in spec[name]
117
+ && typeof spec[name].pos === "number"
118
+ && spec[name].pos < this.args.length) {
119
+ /* positional argument */
120
+ if (typeof this.args[spec[name].pos] !== spec[name].type)
121
+ throw new Error(`invalid type of positional parameter "${name}" ` +
122
+ `(has to be ${spec[name].type})`);
123
+ if ("match" in spec[name]
124
+ && this.args[spec[name].pos].match(spec[name].match) === null)
125
+ throw new Error(`invalid value of positional parameter "${name}" ` +
126
+ `(has to match ${spec[name].match})`);
127
+ if ("match" in spec[name]
128
+ && ((spec[name].match instanceof RegExp
129
+ && this.args[spec[name].pos].match(spec[name].match) === null)
130
+ || (typeof spec[name].match === "function"
131
+ && !spec[name].match(this.args[spec[name].pos]))))
132
+ throw new Error(`invalid value "${this.opts[name]}" of positional parameter "${name}"`);
133
+ this.params[name] = this.args[spec[name].pos];
134
+ }
135
+ else if ("val" in spec[name] && spec[name].val !== undefined)
136
+ /* default argument */
137
+ this.params[name] = spec[name].val;
138
+ else
139
+ throw new Error(`required parameter "${name}" not given`);
140
+ }
141
+ for (const name of Object.keys(this.opts)) {
142
+ if (spec[name] === undefined)
143
+ throw new Error(`named parameter "${name}" not known`);
144
+ }
145
+ for (let i = 0; i < this.args.length; i++) {
146
+ let found = false;
147
+ for (const name of Object.keys(spec))
148
+ if (spec[name].pos === i)
149
+ found = true;
150
+ if (!found)
151
+ throw new Error(`positional parameter #${i} ("${this.args[i]}") ` +
152
+ "not mappable to any known argument");
153
+ }
154
+ }
155
+ /* connect node to another one */
156
+ connect(other) {
157
+ this.connectionsOut.add(other);
158
+ other.connectionsIn.add(this);
159
+ }
160
+ /* disconnect node from another one */
161
+ disconnect(other) {
162
+ if (!this.connectionsOut.has(other))
163
+ throw new Error("invalid node: not connected to this node");
164
+ this.connectionsOut.delete(other);
165
+ other.connectionsIn.delete(this);
166
+ }
167
+ /* internal log function */
168
+ log(level, msg, data) {
169
+ this.emit("log", level, msg, data);
170
+ }
171
+ /* default implementation for status operation */
172
+ async status() {
173
+ return {};
174
+ }
175
+ /* default implementation for open/close operations */
176
+ async open() { }
177
+ async close() { }
178
+ }
179
+ exports.default = SpeechFlowNode;
180
+ //# sourceMappingURL=speechflow-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speechflow-node.js","sourceRoot":"","sources":["../src/speechflow-node.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAGhC,6BAA6B;AAC7B,iCAA0C;AAE1C,oFAAoF;AACpF,MAAa,eAAe;IAEb;IACA;IACA;IACA;IACA;IACA;IANX,YACW,cAAwB,EACxB,YAAwB,EACxB,IAAwC,EACxC,IAAgC,EAChC,OAA+B,EAC/B,OAAkB,IAAI,GAAG,EAAe;QALxC,mBAAc,GAAd,cAAc,CAAU;QACxB,iBAAY,GAAZ,YAAY,CAAY;QACxB,SAAI,GAAJ,IAAI,CAAoC;QACxC,SAAI,GAAJ,IAAI,CAA4B;QAChC,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAoC;IAChD,CAAC;IACJ,KAAK;QACD,IAAI,OAAwB,CAAA;QAC5B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;YAC7B,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OA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QAC7B,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QAC/D,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACjC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,6BAA6B;IAC7B,GAAG,CAAE,KAAa,EAAE,GAAW,EAAE,IAAU;QACvC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAC,MAAM;QACR,OAAO,EAAE,CAAA;IACb,CAAC;IAED,wDAAwD;IACxD,KAAK,CAAC,IAAI,KAAM,CAAC;IACjB,KAAK,CAAC,KAAK,KAAK,CAAC;CACpB;AApJD,iCAoJC"}
@@ -0,0 +1,74 @@
1
+ import Stream from "node:stream";
2
+ import { EventEmitter } from "node:events";
3
+ import { DateTime, Duration } from "luxon";
4
+ import { SpeechFlowChunk } from "./speechflow-node";
5
+ export declare function audioBufferDuration(buffer: Buffer, sampleRate?: number, bitDepth?: number, channels?: number, littleEndian?: boolean): number;
6
+ export declare function audioArrayDuration(arr: Float32Array, sampleRate?: number, channels?: number): number;
7
+ export declare function convertBufToF32(buf: Buffer, littleEndian?: boolean): Float32Array<ArrayBuffer>;
8
+ export declare function convertF32ToBuf(arr: Float32Array): Buffer<ArrayBuffer>;
9
+ export declare function createTransformStreamForWritableSide(): Stream.Transform;
10
+ export declare function createTransformStreamForReadableSide(type: "text" | "audio", getTimeZero: () => DateTime): Stream.Transform;
11
+ export declare function ensureStreamChunk(type: "audio" | "text", chunk: SpeechFlowChunk | Buffer | string): string | SpeechFlowChunk | Buffer<ArrayBufferLike>;
12
+ export declare function streamChunkEncode(chunk: SpeechFlowChunk): Uint8Array<ArrayBufferLike>;
13
+ export declare function streamChunkDecode(_data: Uint8Array): SpeechFlowChunk;
14
+ export declare class SingleQueue<T> extends EventEmitter {
15
+ private queue;
16
+ write(item: T): void;
17
+ read(): Promise<T>;
18
+ }
19
+ export declare class DoubleQueue<T0, T1> extends EventEmitter {
20
+ private queue0;
21
+ private queue1;
22
+ private notify;
23
+ write0(item: T0): void;
24
+ write1(item: T1): void;
25
+ read(): Promise<[T0, T1]>;
26
+ }
27
+ export type QueueElement = {
28
+ type: string;
29
+ };
30
+ export declare class QueuePointer<T extends QueueElement> extends EventEmitter {
31
+ private name;
32
+ private queue;
33
+ private index;
34
+ constructor(name: string, queue: Queue<T>);
35
+ maxPosition(): number;
36
+ position(index?: number): number;
37
+ walk(num: number): void;
38
+ walkForwardUntil(type: T["type"]): void;
39
+ walkBackwardUntil(type: T["type"]): void;
40
+ searchForward(type: T["type"]): number;
41
+ searchBackward(type: T["type"]): number;
42
+ peek(position?: number): T;
43
+ read(): T;
44
+ slice(size?: number): T[];
45
+ touch(): void;
46
+ append(element: T): void;
47
+ insert(element: T): void;
48
+ delete(): void;
49
+ }
50
+ export declare class Queue<T extends QueueElement> extends EventEmitter {
51
+ elements: T[];
52
+ private pointers;
53
+ constructor();
54
+ pointerUse(name: string): QueuePointer<T>;
55
+ pointerDelete(name: string): void;
56
+ trim(): void;
57
+ }
58
+ export declare class StreamWrapper extends Stream.Transform {
59
+ private foreignStream;
60
+ private onData;
61
+ private onError;
62
+ private onEnd;
63
+ constructor(foreignStream: any, options?: Stream.TransformOptions);
64
+ _transform(chunk: any, encoding: BufferEncoding, callback: Stream.TransformCallback): void;
65
+ _flush(callback: Stream.TransformCallback): void;
66
+ _destroy(error: Error | null, callback: Stream.TransformCallback): void;
67
+ }
68
+ export declare class TimeStore<T> extends EventEmitter {
69
+ private tree;
70
+ store(start: Duration, end: Duration, item: T): void;
71
+ fetch(start: Duration, end: Duration): T[];
72
+ prune(_before: Duration): void;
73
+ clear(): void;
74
+ }