@absolutejs/voice 0.0.22-beta.464 → 0.0.22-beta.466

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.
@@ -244,329 +244,6 @@ var serverMessageToAction = (message) => {
244
244
  }
245
245
  };
246
246
 
247
- // node_modules/@absolutejs/media/dist/index.js
248
- var {mkdir, writeFile} = (() => ({}));
249
-
250
- // node:path
251
- function assertPath(path) {
252
- if (typeof path !== "string")
253
- throw TypeError("Path must be a string. Received " + JSON.stringify(path));
254
- }
255
- function normalizeStringPosix(path, allowAboveRoot) {
256
- var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
257
- for (var i = 0;i <= path.length; ++i) {
258
- if (i < path.length)
259
- code = path.charCodeAt(i);
260
- else if (code === 47)
261
- break;
262
- else
263
- code = 47;
264
- if (code === 47) {
265
- if (lastSlash === i - 1 || dots === 1)
266
- ;
267
- else if (lastSlash !== i - 1 && dots === 2) {
268
- if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
269
- if (res.length > 2) {
270
- var lastSlashIndex = res.lastIndexOf("/");
271
- if (lastSlashIndex !== res.length - 1) {
272
- if (lastSlashIndex === -1)
273
- res = "", lastSegmentLength = 0;
274
- else
275
- res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
276
- lastSlash = i, dots = 0;
277
- continue;
278
- }
279
- } else if (res.length === 2 || res.length === 1) {
280
- res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
281
- continue;
282
- }
283
- }
284
- if (allowAboveRoot) {
285
- if (res.length > 0)
286
- res += "/..";
287
- else
288
- res = "..";
289
- lastSegmentLength = 2;
290
- }
291
- } else {
292
- if (res.length > 0)
293
- res += "/" + path.slice(lastSlash + 1, i);
294
- else
295
- res = path.slice(lastSlash + 1, i);
296
- lastSegmentLength = i - lastSlash - 1;
297
- }
298
- lastSlash = i, dots = 0;
299
- } else if (code === 46 && dots !== -1)
300
- ++dots;
301
- else
302
- dots = -1;
303
- }
304
- return res;
305
- }
306
- function _format(sep, pathObject) {
307
- var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
308
- if (!dir)
309
- return base;
310
- if (dir === pathObject.root)
311
- return dir + base;
312
- return dir + sep + base;
313
- }
314
- function resolve() {
315
- var resolvedPath = "", resolvedAbsolute = false, cwd;
316
- for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
317
- var path;
318
- if (i >= 0)
319
- path = arguments[i];
320
- else {
321
- if (cwd === undefined)
322
- cwd = process.cwd();
323
- path = cwd;
324
- }
325
- if (assertPath(path), path.length === 0)
326
- continue;
327
- resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
328
- }
329
- if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
330
- if (resolvedPath.length > 0)
331
- return "/" + resolvedPath;
332
- else
333
- return "/";
334
- else if (resolvedPath.length > 0)
335
- return resolvedPath;
336
- else
337
- return ".";
338
- }
339
- function normalize(path) {
340
- if (assertPath(path), path.length === 0)
341
- return ".";
342
- var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
343
- if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
344
- path = ".";
345
- if (path.length > 0 && trailingSeparator)
346
- path += "/";
347
- if (isAbsolute)
348
- return "/" + path;
349
- return path;
350
- }
351
- function isAbsolute(path) {
352
- return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
353
- }
354
- function join() {
355
- if (arguments.length === 0)
356
- return ".";
357
- var joined;
358
- for (var i = 0;i < arguments.length; ++i) {
359
- var arg = arguments[i];
360
- if (assertPath(arg), arg.length > 0)
361
- if (joined === undefined)
362
- joined = arg;
363
- else
364
- joined += "/" + arg;
365
- }
366
- if (joined === undefined)
367
- return ".";
368
- return normalize(joined);
369
- }
370
- function relative(from, to) {
371
- if (assertPath(from), assertPath(to), from === to)
372
- return "";
373
- if (from = resolve(from), to = resolve(to), from === to)
374
- return "";
375
- var fromStart = 1;
376
- for (;fromStart < from.length; ++fromStart)
377
- if (from.charCodeAt(fromStart) !== 47)
378
- break;
379
- var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
380
- for (;toStart < to.length; ++toStart)
381
- if (to.charCodeAt(toStart) !== 47)
382
- break;
383
- var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
384
- for (;i <= length; ++i) {
385
- if (i === length) {
386
- if (toLen > length) {
387
- if (to.charCodeAt(toStart + i) === 47)
388
- return to.slice(toStart + i + 1);
389
- else if (i === 0)
390
- return to.slice(toStart + i);
391
- } else if (fromLen > length) {
392
- if (from.charCodeAt(fromStart + i) === 47)
393
- lastCommonSep = i;
394
- else if (i === 0)
395
- lastCommonSep = 0;
396
- }
397
- break;
398
- }
399
- var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
400
- if (fromCode !== toCode)
401
- break;
402
- else if (fromCode === 47)
403
- lastCommonSep = i;
404
- }
405
- var out = "";
406
- for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
407
- if (i === fromEnd || from.charCodeAt(i) === 47)
408
- if (out.length === 0)
409
- out += "..";
410
- else
411
- out += "/..";
412
- if (out.length > 0)
413
- return out + to.slice(toStart + lastCommonSep);
414
- else {
415
- if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
416
- ++toStart;
417
- return to.slice(toStart);
418
- }
419
- }
420
- function _makeLong(path) {
421
- return path;
422
- }
423
- function dirname(path) {
424
- if (assertPath(path), path.length === 0)
425
- return ".";
426
- var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
427
- for (var i = path.length - 1;i >= 1; --i)
428
- if (code = path.charCodeAt(i), code === 47) {
429
- if (!matchedSlash) {
430
- end = i;
431
- break;
432
- }
433
- } else
434
- matchedSlash = false;
435
- if (end === -1)
436
- return hasRoot ? "/" : ".";
437
- if (hasRoot && end === 1)
438
- return "//";
439
- return path.slice(0, end);
440
- }
441
- function basename(path, ext) {
442
- if (ext !== undefined && typeof ext !== "string")
443
- throw TypeError('"ext" argument must be a string');
444
- assertPath(path);
445
- var start = 0, end = -1, matchedSlash = true, i;
446
- if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
447
- if (ext.length === path.length && ext === path)
448
- return "";
449
- var extIdx = ext.length - 1, firstNonSlashEnd = -1;
450
- for (i = path.length - 1;i >= 0; --i) {
451
- var code = path.charCodeAt(i);
452
- if (code === 47) {
453
- if (!matchedSlash) {
454
- start = i + 1;
455
- break;
456
- }
457
- } else {
458
- if (firstNonSlashEnd === -1)
459
- matchedSlash = false, firstNonSlashEnd = i + 1;
460
- if (extIdx >= 0)
461
- if (code === ext.charCodeAt(extIdx)) {
462
- if (--extIdx === -1)
463
- end = i;
464
- } else
465
- extIdx = -1, end = firstNonSlashEnd;
466
- }
467
- }
468
- if (start === end)
469
- end = firstNonSlashEnd;
470
- else if (end === -1)
471
- end = path.length;
472
- return path.slice(start, end);
473
- } else {
474
- for (i = path.length - 1;i >= 0; --i)
475
- if (path.charCodeAt(i) === 47) {
476
- if (!matchedSlash) {
477
- start = i + 1;
478
- break;
479
- }
480
- } else if (end === -1)
481
- matchedSlash = false, end = i + 1;
482
- if (end === -1)
483
- return "";
484
- return path.slice(start, end);
485
- }
486
- }
487
- function extname(path) {
488
- assertPath(path);
489
- var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
490
- for (var i = path.length - 1;i >= 0; --i) {
491
- var code = path.charCodeAt(i);
492
- if (code === 47) {
493
- if (!matchedSlash) {
494
- startPart = i + 1;
495
- break;
496
- }
497
- continue;
498
- }
499
- if (end === -1)
500
- matchedSlash = false, end = i + 1;
501
- if (code === 46) {
502
- if (startDot === -1)
503
- startDot = i;
504
- else if (preDotState !== 1)
505
- preDotState = 1;
506
- } else if (startDot !== -1)
507
- preDotState = -1;
508
- }
509
- if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
510
- return "";
511
- return path.slice(startDot, end);
512
- }
513
- function format(pathObject) {
514
- if (pathObject === null || typeof pathObject !== "object")
515
- throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
516
- return _format("/", pathObject);
517
- }
518
- function parse(path) {
519
- assertPath(path);
520
- var ret = { root: "", dir: "", base: "", ext: "", name: "" };
521
- if (path.length === 0)
522
- return ret;
523
- var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
524
- if (isAbsolute2)
525
- ret.root = "/", start = 1;
526
- else
527
- start = 0;
528
- var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
529
- for (;i >= start; --i) {
530
- if (code = path.charCodeAt(i), code === 47) {
531
- if (!matchedSlash) {
532
- startPart = i + 1;
533
- break;
534
- }
535
- continue;
536
- }
537
- if (end === -1)
538
- matchedSlash = false, end = i + 1;
539
- if (code === 46) {
540
- if (startDot === -1)
541
- startDot = i;
542
- else if (preDotState !== 1)
543
- preDotState = 1;
544
- } else if (startDot !== -1)
545
- preDotState = -1;
546
- }
547
- if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
548
- if (end !== -1)
549
- if (startPart === 0 && isAbsolute2)
550
- ret.base = ret.name = path.slice(1, end);
551
- else
552
- ret.base = ret.name = path.slice(startPart, end);
553
- } else {
554
- if (startPart === 0 && isAbsolute2)
555
- ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
556
- else
557
- ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
558
- ret.ext = path.slice(startDot, end);
559
- }
560
- if (startPart > 0)
561
- ret.dir = path.slice(0, startPart - 1);
562
- else if (isAbsolute2)
563
- ret.dir = "/";
564
- return ret;
565
- }
566
- var sep = "/";
567
- var delimiter = ":";
568
- var posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse, sep, delimiter, win32: null, posix: null });
569
-
570
247
  // node_modules/@absolutejs/media/dist/index.js
571
248
  var pushIssue = (issues, severity, code, message) => {
572
249
  issues.push({ code, message, severity });
@@ -1841,15 +1518,15 @@ var getAudioContextCtor = () => {
1841
1518
  return window.AudioContext ?? window.webkitAudioContext;
1842
1519
  };
1843
1520
  var decodePCM16LEChunk = (audioContext, chunk) => {
1844
- const format2 = chunk.format;
1845
- if (format2.container !== "raw" || format2.encoding !== "pcm_s16le") {
1846
- throw new Error(`Unsupported assistant audio format: ${format2.container}/${format2.encoding}`);
1521
+ const format = chunk.format;
1522
+ if (format.container !== "raw" || format.encoding !== "pcm_s16le") {
1523
+ throw new Error(`Unsupported assistant audio format: ${format.container}/${format.encoding}`);
1847
1524
  }
1848
1525
  const bytes = chunk.chunk;
1849
- const channels = Math.max(1, format2.channels);
1526
+ const channels = Math.max(1, format.channels);
1850
1527
  const sampleCount = Math.floor(bytes.byteLength / 2);
1851
1528
  const frameCount = Math.max(1, Math.floor(sampleCount / channels));
1852
- const audioBuffer = audioContext.createBuffer(channels, frameCount, format2.sampleRateHz);
1529
+ const audioBuffer = audioContext.createBuffer(channels, frameCount, format.sampleRateHz);
1853
1530
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
1854
1531
  for (let channelIndex = 0;channelIndex < channels; channelIndex += 1) {
1855
1532
  const channelData = audioBuffer.getChannelData(channelIndex);
@@ -2092,8 +1769,8 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2092
1769
  return;
2093
1770
  }
2094
1771
  if (!interruptPromise) {
2095
- interruptPromise = new Promise((resolve2) => {
2096
- resolveInterruptPromise = resolve2;
1772
+ interruptPromise = new Promise((resolve) => {
1773
+ resolveInterruptPromise = resolve;
2097
1774
  });
2098
1775
  }
2099
1776
  clearInterruptTimer();