@graphen.ai/aiia-sdk 1.0.19 → 1.1.0-beta.15

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/LICENSE CHANGED
@@ -24,21 +24,23 @@ SOFTWARE.
24
24
 
25
25
  This project uses the following third-party packages and complies with their respective licenses:
26
26
 
27
+ - @mediapipe/tasks-vision (Apache License 2.0)
28
+ - @nut-tree-fork/nut-js (Apache License 2.0)
27
29
  - axios (MIT License)
28
- - lodash (MIT License)
30
+ - lodash-es (MIT License)
31
+ - mathjs (Apache License 2.0)
32
+ - moment (MIT License)
33
+ - node-osc (Apache License 2.0)
29
34
  - rxjs (Apache License 2.0)
30
35
  - socket.io (MIT License)
31
36
  - socket.io-client (MIT License)
37
+ - systeminformation (MIT License)
32
38
  - ws (MIT License)
33
- - moment (MIT License)
34
39
 
35
40
  Development dependencies:
36
- - @microsoft/api-extractor (MIT License)
37
- - @rollup/* (MIT License)
38
- - @types/* (MIT License)
39
- - rollup (MIT License)
40
- - rollup-plugin-obfuscator (MIT License)
41
- - tslib (MIT License)
41
+
42
+ - @types/lodash-es (MIT License)
43
+ - tsup (MIT License)
42
44
  - typescript (Apache License 2.0)
43
45
 
44
46
  Please refer to each package's official documentation for full license details.
package/NOTICE CHANGED
@@ -21,6 +21,62 @@ Licensed under the Apache License, Version 2.0 (the "License");
21
21
  you may not use this file except in compliance with the License.
22
22
  You may obtain a copy of the License at
23
23
 
24
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
25
+ Unless required by applicable law or agreed to in writing, software
26
+ distributed under the License is distributed on an "AS IS" BASIS,
27
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ See the License for the specific language governing permissions and
29
+ limitations under the License.
30
+
31
+ @mediapipe/tasks-vision
32
+ Copyright 2023 The MediaPipe Authors.
33
+
34
+ Licensed under the Apache License, Version 2.0 (the "License");
35
+ you may not use this file except in compliance with the License.
36
+ You may obtain a copy of the License at
37
+
38
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
39
+ Unless required by applicable law or agreed to in writing, software
40
+ distributed under the License is distributed on an "AS IS" BASIS,
41
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42
+ See the License for the specific language governing permissions and
43
+ limitations under the License.
44
+
45
+ @nut-tree-fork/nut-js
46
+ Copyright 2024 dry Software UG (haftungsbeschränkt)
47
+
48
+ Licensed under the Apache License, Version 2.0 (the "License");
49
+ you may not use this file except in compliance with the License.
50
+ You may obtain a copy of the License at
51
+
52
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
53
+ Unless required by applicable law or agreed to in writing, software
54
+ distributed under the License is distributed on an "AS IS" BASIS,
55
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
+ See the License for the specific language governing permissions and
57
+ limitations under the License.
58
+
59
+ mathjs
60
+ Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
61
+
62
+ Licensed under the Apache License, Version 2.0 (the "License");
63
+ you may not use this file except in compliance with the License.
64
+ You may obtain a copy of the License at
65
+
66
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
67
+ Unless required by applicable law or agreed to in writing, software
68
+ distributed under the License is distributed on an "AS IS" BASIS,
69
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
70
+ See the License for the specific language governing permissions and
71
+ limitations under the License.
72
+
73
+ node-osc
74
+ Copyright (C) 2012-2024 Myles Borins
75
+
76
+ Licensed under the Apache License, Version 2.0 (the "License");
77
+ you may not use this file except in compliance with the License.
78
+ You may obtain a copy of the License at
79
+
24
80
  [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
25
81
  Unless required by applicable law or agreed to in writing, software
26
82
  distributed under the License is distributed on an "AS IS" BASIS,
package/README.md CHANGED
@@ -34,7 +34,7 @@ sdk.start()
34
34
  ```typescript
35
35
  import { aiiaCore } from '@graphen.ai/aiia-sdk/node';
36
36
 
37
- const core = aiiaCore({ license: "<Your Token>" });
37
+ const core = aiiaCore({ group_id: "<Your Token>" });
38
38
  ```
39
39
 
40
40
  ## 錯誤碼(Error Codes)
@@ -0,0 +1,366 @@
1
+ import { BoundingBox, Landmark } from '@mediapipe/tasks-vision';
2
+ import { Server } from 'http';
3
+ import { Server as Server$1 } from 'https';
4
+ import { Http2SecureServer, Http2Server } from 'http2';
5
+ import * as node_http2 from 'node:http2';
6
+ import * as node_https from 'node:https';
7
+ import * as node_http from 'node:http';
8
+
9
+ interface Result extends BoundingBox {
10
+ area: number;
11
+ score: number;
12
+ clientWidth: number;
13
+ clientHeight: number;
14
+ }
15
+ type AnalysisResult = Result | null;
16
+ type Vec2 = {
17
+ x: number;
18
+ y: number;
19
+ };
20
+
21
+ interface AiiaProjectItem {
22
+ id: string;
23
+ name: string;
24
+ }
25
+ type LoggerLevel = "info" | "error" | "warn" | "debug" | "fatal" | "code";
26
+ type Webserver = Server<any, any> | Server$1<any, any> | Http2SecureServer<any, any, any, any> | Http2Server<any, any, any, any>;
27
+ interface CommonOptions {
28
+ /**
29
+ * [zh]
30
+ * 顯示訊息(一般、錯誤、警告),預設 true
31
+ *
32
+ * [en]
33
+ * Switch message(info, error, warn) display, default: true
34
+ */
35
+ debug?: boolean | "all" | "none" | LoggerLevel[];
36
+ }
37
+ interface NodeInitOptions extends CommonOptions {
38
+ /**
39
+ * [zh]
40
+ * 簡易的機台資訊備註,於管理系統查看
41
+ *
42
+ * [en]
43
+ * Simple machine/device information notes, viewable in the management system.
44
+ */
45
+ note?: string;
46
+ /**
47
+ * [zh]
48
+ * 設定機台名稱,於管理系統查看
49
+ *
50
+ * [en]
51
+ * Setting machine/device name, viewable in the management system.
52
+ */
53
+ device_name?: string;
54
+ /**
55
+ * [zh]
56
+ * 請從 Aiia platform 取得授權
57
+ *
58
+ * [en]
59
+ * Please go to Aiia platform and get group id
60
+ */
61
+ group_id?: string;
62
+ /**
63
+ * [zh]
64
+ * 擴充 "socket.io" 到網頁伺服器
65
+ *
66
+ * [en]
67
+ * Extending "socket.io" to your web server
68
+ */
69
+ webserver?: Webserver;
70
+ /**
71
+ * [zh]
72
+ * 伺服器 port
73
+ *
74
+ * [en]
75
+ * Server port
76
+ *
77
+ * process.env.PORT > port > 3000(default port)
78
+ */
79
+ port?: number;
80
+ /**
81
+ * [zh]
82
+ * 指定的環境,預設值: production
83
+ *
84
+ * [en]
85
+ * Specific Env, default: production
86
+ */
87
+ env?: "developement" | "production";
88
+ /**
89
+ * [zh]
90
+ * 指定雲端位置(會覆蓋 `env` 設定)
91
+ *
92
+ * [en]
93
+ * Specify cloud location(override `env` settings)
94
+ */
95
+ cloudEndPoint?: string;
96
+ /**
97
+ * [zh]
98
+ * 啟動眼球追蹤
99
+ *
100
+ * [en]
101
+ * Start eye tracking
102
+ */
103
+ eyeTrackEnable?: boolean;
104
+ /**
105
+ * [zh]
106
+ * 眼球追蹤補正,請根據 Camera 裝置的物理位置添加補正值。
107
+ *
108
+ * [en]
109
+ * Eye tracking correction, please add correction value according to the physical position of the camera device.
110
+ */
111
+ correction?: {
112
+ x_axis_px?: number;
113
+ y_axis_px?: number;
114
+ };
115
+ /**
116
+ * [zh]
117
+ * 是否連接 Avatar 服務? (預設 true)
118
+ *
119
+ * [en]
120
+ * Connect to Avatar service? (Default: true)
121
+ */
122
+ avatartService?: boolean;
123
+ }
124
+ interface BrowserInitOptions extends CommonOptions {
125
+ /**
126
+ * [zh]
127
+ * 專案名稱 或是 專案編號(ID)
128
+ *
129
+ * [en]
130
+ * Project name/ID
131
+ */
132
+ project?: string | Partial<AiiaProjectItem>;
133
+ /**
134
+ * [zh]
135
+ * 瀏覽器連線指定 Websocket url
136
+ *
137
+ * [en]
138
+ * specific websocket url for Browser use
139
+ */
140
+ ws_url?: string;
141
+ /**
142
+ * [zh]
143
+ * 分析音訊的模組網址
144
+ *
145
+ * [en]
146
+ * Module URL for analyzing audio
147
+ */
148
+ worklet_url?: string;
149
+ /**
150
+ * [zh]
151
+ * 授權的媒體裝置,請包含麥克風及鏡頭/攝影機權限
152
+ *
153
+ * 若不打算使用,請傳入`null`,將會避免自動請求權限。
154
+ *
155
+ * [en]
156
+ * Authorized media devices, please include microphone and lens/camera permissions.
157
+ *
158
+ * If you do not intend to use this, please pass `null` to avoid automatically requesting permissions.
159
+ *
160
+ * https://developer.mozilla.org/en-US/docs/Web/API/MediaStream
161
+ */
162
+ mediaStream?: MediaStream | null;
163
+ /**
164
+ * [zh]
165
+ * 檢測聲音的區塊大小(秒),預設 0.3 秒
166
+ *
167
+ * [en]
168
+ * Detecting the chunk size of the sound(unit is second), default 0.3 second.
169
+ */
170
+ chunkTimeInSeconds?: number;
171
+ /**
172
+ * [zh]
173
+ * 指定音訊輸出的採樣率(提供給LLM分析)。不推薦更動
174
+ *
175
+ * [en]
176
+ * Specify the sampling rate of audio output (provided for LLM analysis). Changing is not recommended.
177
+ */
178
+ llmSampleRate?: number;
179
+ /**
180
+ * [zh]
181
+ * 攝影機辨識設定
182
+ *
183
+ * @property perSecond: 每秒檢測幾次, 預設: 每秒 3 次
184
+ *
185
+ * @property confidence: 人臉辨識分數(0 ~ 100), 預設: 80
186
+ *
187
+ * [en]
188
+ * Camera Identification Settings
189
+ *
190
+ * @property perSecond: Detection times per second, default: 3 times per second
191
+ *
192
+ * @property confidence: Face recognition score(0 ~ 100), default: 80
193
+ */
194
+ cameraDetection?: {
195
+ perSecond?: number;
196
+ confidence?: number;
197
+ };
198
+ /**
199
+ * [zh]
200
+ * 清除字幕,可指定時間(毫秒),預設 5000 毫秒後清除
201
+ *
202
+ * [en]
203
+ * Clear subtitles, you can specify the time (milliseconds), the default is to clear after 5000 milliseconds.
204
+ */
205
+ autoClearUserSubtitle?: number;
206
+ /**
207
+ * [zh]
208
+ * 清除字幕,可指定時間(毫秒),預設 音訊結束時 清除
209
+ *
210
+ * [en]
211
+ * Clear subtitles, you can specify the time (milliseconds), the default Clear when audio ends.
212
+ */
213
+ autoClearAiiaSubtitle?: number;
214
+ }
215
+ type InitOptions = NodeInitOptions & BrowserInitOptions;
216
+
217
+ type LayoutID = string | number;
218
+ interface LAYOUT {
219
+ signal: "layout";
220
+ content: {
221
+ type: "mount";
222
+ id: LayoutID;
223
+ panel: string;
224
+ props?: Record<string, unknown>;
225
+ zIndex?: number;
226
+ } | {
227
+ type: "update";
228
+ id: LayoutID;
229
+ props?: Record<string, unknown>;
230
+ zIndex?: number;
231
+ } | {
232
+ type: "unmount";
233
+ id: LayoutID;
234
+ };
235
+ }
236
+ interface MovementToUE {
237
+ signal: "osc";
238
+ content: {
239
+ host: string;
240
+ port: number;
241
+ message: [string, ...(string | number)[]];
242
+ };
243
+ }
244
+ interface SendMessage_MiniGame {
245
+ request: "minigame";
246
+ userCtrl?: boolean;
247
+ content: {
248
+ type: "start" | "open" | "next" | "answer" | "rank";
249
+ quizId?: string;
250
+ ansId?: string;
251
+ };
252
+ }
253
+ interface SendMessage_Layout {
254
+ request: "layout";
255
+ userCtrl?: boolean;
256
+ content: {
257
+ type: "duplicate_id" | "miss_panel_name" | "id_not_find" | "props_error";
258
+ } & Record<string, string | string[]>;
259
+ }
260
+ interface SendMessage_Audio_Init {
261
+ request: "audio";
262
+ userCtrl?: boolean;
263
+ command: "sampleRate";
264
+ content: number;
265
+ }
266
+ interface SendMessage_Audio_PCM {
267
+ request: "audio";
268
+ userCtrl?: boolean;
269
+ command: "pcm";
270
+ content: number[];
271
+ }
272
+ type SendMessage_Audio = SendMessage_Audio_Init | SendMessage_Audio_PCM;
273
+ interface SendMessage_Face {
274
+ request: "face_detect";
275
+ content: boolean;
276
+ }
277
+ type LandmarkResult = Landmark[][];
278
+ interface SendMessage_Pose {
279
+ request: "pose_detect";
280
+ content: LandmarkResult;
281
+ }
282
+ type SendMessage = {
283
+ request: "reset";
284
+ } | {
285
+ request: "skip";
286
+ } | SendMessage_Layout | SendMessage_MiniGame | SendMessage_Audio | SendMessage_Face | SendMessage_Pose;
287
+
288
+ interface AiiaProjectItemWithAvatar extends AiiaProjectItem {
289
+ avatar: {
290
+ name: string;
291
+ url: string;
292
+ };
293
+ }
294
+ declare enum MonitorDeviceState {
295
+ 未響應 = 1,// 瀏覽器未在時間內回應狀態
296
+ 等待授權 = 2,
297
+ 已被拒絕 = 3,
298
+ VAD模組載入失敗 = 4,
299
+ 可正常使用 = 5,
300
+ 缺失該裝置 = 6,
301
+ 沒有服務 = 7
302
+ }
303
+ declare enum UnrealState {
304
+ 非預期的狀態 = 1,
305
+ 未授權控制 = 2,
306
+ 未啟動 = 3,// Unreal 未啟動
307
+ 無服務 = 4,// Unreal 已啟動,但服務未就緒
308
+ 可使用 = 5
309
+ }
310
+ interface MonitorResult {
311
+ mic: MonitorDeviceState;
312
+ camera: MonitorDeviceState;
313
+ }
314
+ interface MSG_TO_SERVER {
315
+ uuid: string;
316
+ cloud: SendMessage;
317
+ debug: null;
318
+ face: AnalysisResult;
319
+ pose: LandmarkResult;
320
+ monitor: MonitorResult;
321
+ audio: number | number[];
322
+ version: null;
323
+ }
324
+
325
+ declare class AiiaConfig {
326
+ private config;
327
+ get webserver(): (node_http.Server<any, any> | node_https.Server<any, any> | node_http2.Http2SecureServer<any, any, any, any> | node_http2.Http2Server<any, any, any, any>) | undefined;
328
+ get environment(): string;
329
+ get license(): string;
330
+ get note(): string | undefined;
331
+ get deviceName(): string | undefined;
332
+ get port(): number;
333
+ get ws_url(): string;
334
+ get worklet_url(): string;
335
+ get project(): {
336
+ specific: boolean;
337
+ } & Partial<AiiaProjectItem>;
338
+ get endPoint(): {
339
+ api: string;
340
+ socket: string;
341
+ };
342
+ get debug(): boolean | "all" | "none" | LoggerLevel[];
343
+ get mediaStream(): MediaStream | null | undefined;
344
+ get chunkTimeInSeconds(): number;
345
+ get llmSampleRate(): number;
346
+ get detection(): {
347
+ perSecond: number;
348
+ confidence: number;
349
+ };
350
+ get autoClearSubtitle(): {
351
+ userDelayTime: number;
352
+ aiiaDelayTime: number;
353
+ };
354
+ get eyeTrackEnable(): boolean;
355
+ get eyeTrackCorrection(): {
356
+ x_axis_px: number;
357
+ y_axis_px: number;
358
+ };
359
+ get avatartService(): boolean;
360
+ constructor(config: InitOptions);
361
+ private safeRead;
362
+ }
363
+
364
+ declare const VERSION: string;
365
+
366
+ export { AiiaConfig as A, type BrowserInitOptions as B, type LandmarkResult as L, type MSG_TO_SERVER as M, type NodeInitOptions as N, UnrealState as U, VERSION as V, type LAYOUT as a, type AiiaProjectItemWithAvatar as b, type Vec2 as c, type MovementToUE as d, MonitorDeviceState as e, type AiiaProjectItem as f };
@@ -1,2 +1,26 @@
1
- /** @license AiiaVad Released: 2025-12-22 */
2
- !function(){"use strict";function t(){const e=["2042184YXZFHw","18HKUeef","getInt16","sampleRate","getUserMedia","all","mediaDevices","length","6CKzhxj","random","forEach","allowed","getFloat32","12612ogqlIj","unknow","push","33nkEXkn","ceil","getChannelData","7ULJFed","1695580sHXvby","1116670wEZoGR","createBuffer","1060134UEcgVr","816816yfbxWw","min","195trdMIC","26893gTuhVI","rejected","buffer"];return(t=function(){return e})()}var e;function n(e,n){e-=254;return t()[e]}!function(t){const e=n,s=t();for(;;)try{if(169651===parseInt(e(256))/1*(parseInt(e(267))/2)+-parseInt(e(255))/3*(-parseInt(e(272))/4)+-parseInt(e(280))/5+-parseInt(e(282))/6*(-parseInt(e(278))/7)+parseInt(e(283))/8+parseInt(e(260))/9*(parseInt(e(279))/10)+-parseInt(e(275))/11*(parseInt(e(259))/12))break;s.push(s.shift())}catch(t){s.push(s.shift())}}(t),function(t){const e=n;t[t.unknow=0]=e(273),t[t[e(270)]=1]=e(270),t[t[e(257)]=2]=e(257)}(e||(e={}));const s=r;function r(t,e){t-=108;return o()[t]}function o(){const t=["postMessage","originalSampleRate","length","152yJRvsQ","3159219oWLtCy","process","push","ceil","reduce","155dxigFX","inputBuffer","inputBufferLength","port","76827AzHvIr","135TrVqEA","set","431410GMyazI","aiia-vad","341364jdyVRP","processorOptions","20946596xEQngT","193422eYUopB","processChunkSize","outputSampleRate","assign","1XUywph","903232YTAXNm"];return(o=function(){return t})()}!function(t){const e=r,n=t();for(;;)try{if(547637===-parseInt(e(132))/1*(-parseInt(e(125))/2)+parseInt(e(120))/3*(parseInt(e(110))/4)+parseInt(e(116))/5*(parseInt(e(128))/6)+-parseInt(e(111))/7+parseInt(e(133))/8+parseInt(e(121))/9*(parseInt(e(123))/10)+-parseInt(e(127))/11)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(o);class a extends AudioWorkletProcessor{[s(117)];[s(118)];processChunkSize;[s(130)];[s(108)];constructor(t){const e=s;super(),this[e(117)]=[],this[e(118)]=0;const{outputSampleRate:n,chunkTimeInSeconds:o}=Object[e(131)]({outputSampleRate:16e3,chunkTimeInSeconds:1},t?.[e(126)]);this.originalSampleRate=sampleRate,this[e(130)]=n,this[e(129)]=function(t,e,n=1){const s=e*n,o=t/e;return Math[r(114)](s*o)}(this[e(108)],this[e(130)],o)}[s(112)](t,e,o){const a=s,i=t[0][0];if(!i)return!0;const u=new Float32Array(i);if(this[a(117)][a(113)](u),this[a(118)]+=i[a(109)],this[a(118)]>=this.processChunkSize){const t=function(t){const e=r,n=t[e(115)]((t,n)=>t+n[e(109)],0),s=new Float32Array(n);let o=0;for(const n of t)s[e(122)](n,o),o+=n.length;return s}(this[a(117)]);this.inputBuffer=[],this[a(118)]=0;const e=function(t,e,s){const r=n;if(e===s)return t;const o=s/e,a=Math[r(276)](t[r(266)]*o),i=new Float32Array(a);for(let e=0;e<a;e++){const n=e/o,s=Math.floor(n),a=n-s,u=t[s],c=t[Math.min(s+1,t[r(266)]-1)];i[e]=u+(c-u)*a}return i}(t,this[a(108)],this.outputSampleRate);this[a(119)][a(134)]({float32:e,outputSampleRate:this[a(130)]},[e.buffer])}return!0}}registerProcessor(s(124),a)}();
1
+ (function(){'use strict';/**
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Graphen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ *
24
+ * UPDATA DATE: 2026/6/9
25
+ */
26
+ var A=Object.defineProperty;var y=(e,r,t)=>r in e?A(e,r,{enumerable:true,configurable:true,writable:true,value:t}):e[r]=t;var u=(e,r,t)=>y(e,typeof r!="symbol"?r+"":r,t);function h(e,r,t){if(r===t)return e;let n=t/r,a=e.length,o=Math.ceil(a*n),s=new Float32Array(o),c=1/n,i=0;for(let f=0;f<o;f++){let l=i|0,g=i-l,p=e[l],d=l+1<a?e[l+1]:p;s[f]=p+(d-p)*g,i+=c;}return s}function x(e){let r=e.reduce((a,o)=>a+o.length,0),t=new Float32Array(r),n=0;for(let a of e)t.set(a,n),n+=a.length;return t}function M(e,r,t=1){let n=r*t,a=e/r;return Math.ceil(n*a)}var m=class extends AudioWorkletProcessor{constructor(t){super();u(this,"inputBuffer");u(this,"inputBufferLength");u(this,"processChunkSize");u(this,"outputSampleRate");u(this,"originalSampleRate");this.inputBuffer=[],this.inputBufferLength=0;let{outputSampleRate:n,chunkTimeInSeconds:a}=Object.assign({outputSampleRate:16e3,chunkTimeInSeconds:1},t==null?void 0:t.processorOptions);this.originalSampleRate=sampleRate,this.outputSampleRate=n,this.processChunkSize=M(this.originalSampleRate,this.outputSampleRate,a);}process(t,n,a){let o=t[0][0];if(!o)return true;let s=new Float32Array(o);if(this.inputBuffer.push(s),this.inputBufferLength+=o.length,this.inputBufferLength>=this.processChunkSize){let c=x(this.inputBuffer);this.inputBuffer=[],this.inputBufferLength=0;let i=h(c,this.originalSampleRate,this.outputSampleRate);this.port.postMessage({float32:i,outputSampleRate:this.outputSampleRate},[i.buffer]);}return true}};registerProcessor("aiia-vad",m);})();