@cxyhhhhh/openclaw-qqbot 2.0.0-dev.202607081544 → 2.0.0-dev.202607081617

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/dist/index.cjs CHANGED
@@ -6,9 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esm = (fn, res) => function __init() {
10
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
- };
12
9
  var __commonJS = (cb, mod) => function __require() {
13
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
11
  };
@@ -4736,764 +4733,6 @@ var require_main = __commonJS({
4736
4733
  }
4737
4734
  });
4738
4735
 
4739
- // node_modules/silk-wasm/lib/index.mjs
4740
- var lib_exports = {};
4741
- __export(lib_exports, {
4742
- decode: () => decode,
4743
- encode: () => encode,
4744
- getDuration: () => getDuration,
4745
- getWavFileInfo: () => getWavFileInfo2,
4746
- isSilk: () => isSilk,
4747
- isWav: () => isWav
4748
- });
4749
- function isWavFile(fileData) {
4750
- try {
4751
- let chunks = unpackWavFileChunks(fileData), fmt = decodeFormatChunk(chunks.get("fmt")), data = chunks.get("data");
4752
- return getWavFileType(fmt), verifyDataChunkLength(data, fmt), true;
4753
- } catch {
4754
- return false;
4755
- }
4756
- }
4757
- function decodeWavFile(fileData) {
4758
- let chunks = unpackWavFileChunks(fileData), fmt = decodeFormatChunk(chunks.get("fmt")), data = chunks.get("data"), wavFileType = getWavFileType(fmt), audioEncoding = wavFileTypeAudioEncodings[wavFileType], wavFileTypeName = audioEncodingNames[audioEncoding] + fmt.bitsPerSample;
4759
- return verifyDataChunkLength(data, fmt), { channelData: decodeDataChunk(data, fmt, wavFileType), sampleRate: fmt.sampleRate, numberOfChannels: fmt.numberOfChannels, audioEncoding, bitsPerSample: fmt.bitsPerSample, wavFileTypeName };
4760
- }
4761
- function unpackWavFileChunks(fileData) {
4762
- let dataView;
4763
- fileData instanceof ArrayBuffer ? dataView = new DataView(fileData) : dataView = new DataView(fileData.buffer, fileData.byteOffset, fileData.byteLength);
4764
- let fileLength = dataView.byteLength;
4765
- if (fileLength < 20) throw new Error("WAV file is too short.");
4766
- if (getString(dataView, 0, 4) != "RIFF") throw new Error("Not a valid WAV file (no RIFF header).");
4767
- let mainChunkLength = dataView.getUint32(4, true);
4768
- if (8 + mainChunkLength != fileLength) throw new Error(`Main chunk length of WAV file (${8 + mainChunkLength}) does not match file size (${fileLength}).`);
4769
- if (getString(dataView, 8, 4) != "WAVE") throw new Error("RIFF file is not a WAV file.");
4770
- let chunks = /* @__PURE__ */ new Map(), fileOffset = 12;
4771
- for (; fileOffset < fileLength; ) {
4772
- if (fileOffset + 8 > fileLength) throw new Error(`Incomplete chunk prefix in WAV file at offset ${fileOffset}.`);
4773
- let chunkId = getString(dataView, fileOffset, 4).trim(), chunkLength = dataView.getUint32(fileOffset + 4, true);
4774
- if (fileOffset + 8 + chunkLength > fileLength) throw new Error(`Incomplete chunk data in WAV file at offset ${fileOffset}.`);
4775
- let chunkData = new DataView(dataView.buffer, dataView.byteOffset + fileOffset + 8, chunkLength);
4776
- chunks.set(chunkId, chunkData);
4777
- let padLength = chunkLength % 2;
4778
- fileOffset += 8 + chunkLength + padLength;
4779
- }
4780
- return chunks;
4781
- }
4782
- function getString(dataView, offset, length) {
4783
- let a = new Uint8Array(dataView.buffer, dataView.byteOffset + offset, length);
4784
- return String.fromCharCode.apply(null, a);
4785
- }
4786
- function getInt24(dataView, offset) {
4787
- let b0 = dataView.getInt8(offset + 2) * 65536, b12 = dataView.getUint16(offset, true);
4788
- return b0 + b12;
4789
- }
4790
- function decodeFormatChunk(dataView) {
4791
- if (!dataView) throw new Error("No format chunk found in WAV file.");
4792
- if (dataView.byteLength < 16) throw new Error("Format chunk of WAV file is too short.");
4793
- let fmt = {};
4794
- return fmt.formatCode = dataView.getUint16(0, true), fmt.numberOfChannels = dataView.getUint16(2, true), fmt.sampleRate = dataView.getUint32(4, true), fmt.bytesPerSec = dataView.getUint32(8, true), fmt.bytesPerFrame = dataView.getUint16(12, true), fmt.bitsPerSample = dataView.getUint16(14, true), fmt;
4795
- }
4796
- function getWavFileType(fmt) {
4797
- if (fmt.numberOfChannels < 1 || fmt.numberOfChannels > 999) throw new Error("Invalid number of channels in WAV file.");
4798
- let bytesPerSample = Math.ceil(fmt.bitsPerSample / 8), expectedBytesPerFrame = fmt.numberOfChannels * bytesPerSample;
4799
- if (fmt.formatCode == 1 && fmt.bitsPerSample >= 1 && fmt.bitsPerSample <= 8 && fmt.bytesPerFrame == expectedBytesPerFrame) return 0;
4800
- if (fmt.formatCode == 1 && fmt.bitsPerSample >= 9 && fmt.bitsPerSample <= 16 && fmt.bytesPerFrame == expectedBytesPerFrame) return 1;
4801
- if (fmt.formatCode == 1 && fmt.bitsPerSample >= 17 && fmt.bitsPerSample <= 24 && fmt.bytesPerFrame == expectedBytesPerFrame) return 2;
4802
- if (fmt.formatCode == 3 && fmt.bitsPerSample == 32 && fmt.bytesPerFrame == expectedBytesPerFrame) return 3;
4803
- throw new Error(`Unsupported WAV file type, formatCode=${fmt.formatCode}, bitsPerSample=${fmt.bitsPerSample}, bytesPerFrame=${fmt.bytesPerFrame}, numberOfChannels=${fmt.numberOfChannels}.`);
4804
- }
4805
- function decodeDataChunk(data, fmt, wavFileType) {
4806
- switch (wavFileType) {
4807
- case 0:
4808
- return decodeDataChunk_uint8(data, fmt);
4809
- case 1:
4810
- return decodeDataChunk_int16(data, fmt);
4811
- case 2:
4812
- return decodeDataChunk_int24(data, fmt);
4813
- case 3:
4814
- return decodeDataChunk_float32(data, fmt);
4815
- default:
4816
- throw new Error("No decoder.");
4817
- }
4818
- }
4819
- function decodeDataChunk_int16(data, fmt) {
4820
- let channelData = allocateChannelDataArrays(data.byteLength, fmt), numberOfChannels = fmt.numberOfChannels, numberOfFrames = channelData[0].length, offs = 0;
4821
- for (let frameNo = 0; frameNo < numberOfFrames; frameNo++) for (let channelNo = 0; channelNo < numberOfChannels; channelNo++) {
4822
- let sampleValueFloat = data.getInt16(offs, true) / 32768;
4823
- channelData[channelNo][frameNo] = sampleValueFloat, offs += 2;
4824
- }
4825
- return channelData;
4826
- }
4827
- function decodeDataChunk_uint8(data, fmt) {
4828
- let channelData = allocateChannelDataArrays(data.byteLength, fmt), numberOfChannels = fmt.numberOfChannels, numberOfFrames = channelData[0].length, offs = 0;
4829
- for (let frameNo = 0; frameNo < numberOfFrames; frameNo++) for (let channelNo = 0; channelNo < numberOfChannels; channelNo++) {
4830
- let sampleValueFloat = (data.getUint8(offs) - 128) / 128;
4831
- channelData[channelNo][frameNo] = sampleValueFloat, offs += 1;
4832
- }
4833
- return channelData;
4834
- }
4835
- function decodeDataChunk_int24(data, fmt) {
4836
- let channelData = allocateChannelDataArrays(data.byteLength, fmt), numberOfChannels = fmt.numberOfChannels, numberOfFrames = channelData[0].length, offs = 0;
4837
- for (let frameNo = 0; frameNo < numberOfFrames; frameNo++) for (let channelNo = 0; channelNo < numberOfChannels; channelNo++) {
4838
- let sampleValueFloat = getInt24(data, offs) / 8388608;
4839
- channelData[channelNo][frameNo] = sampleValueFloat, offs += 3;
4840
- }
4841
- return channelData;
4842
- }
4843
- function decodeDataChunk_float32(data, fmt) {
4844
- let channelData = allocateChannelDataArrays(data.byteLength, fmt), numberOfChannels = fmt.numberOfChannels, numberOfFrames = channelData[0].length, offs = 0;
4845
- for (let frameNo = 0; frameNo < numberOfFrames; frameNo++) for (let channelNo = 0; channelNo < numberOfChannels; channelNo++) {
4846
- let sampleValueFloat = data.getFloat32(offs, true);
4847
- channelData[channelNo][frameNo] = sampleValueFloat, offs += 4;
4848
- }
4849
- return channelData;
4850
- }
4851
- function allocateChannelDataArrays(dataLength, fmt) {
4852
- let numberOfFrames = Math.floor(dataLength / fmt.bytesPerFrame), channelData = new Array(fmt.numberOfChannels);
4853
- for (let channelNo = 0; channelNo < fmt.numberOfChannels; channelNo++) channelData[channelNo] = new Float32Array(numberOfFrames);
4854
- return channelData;
4855
- }
4856
- function verifyDataChunkLength(data, fmt) {
4857
- if (!data) throw new Error("No data chunk found in WAV file.");
4858
- if (data.byteLength % fmt.bytesPerFrame != 0) throw new Error("WAV file data chunk length is not a multiple of frame size.");
4859
- }
4860
- function getWavFileInfo(fileData) {
4861
- let chunks = unpackWavFileChunks(fileData), chunkInfo = getChunkInfo(chunks), fmt = decodeFormatChunk(chunks.get("fmt"));
4862
- return { chunkInfo, fmt };
4863
- }
4864
- function getChunkInfo(chunks) {
4865
- let chunkInfo = [];
4866
- for (let e of chunks) {
4867
- let ci = {};
4868
- ci.chunkId = e[0], ci.dataOffset = e[1].byteOffset, ci.dataLength = e[1].byteLength, chunkInfo.push(ci);
4869
- }
4870
- return chunkInfo.sort((e1, e2) => e1.dataOffset - e2.dataOffset), chunkInfo;
4871
- }
4872
- function ensureMonoPcm(channelData) {
4873
- let { length: numberOfChannels } = channelData;
4874
- if (numberOfChannels === 1) return channelData[0];
4875
- let monoData = new Float32Array(channelData[0].length);
4876
- for (let i = 0; i < monoData.length; i++) {
4877
- let sum = 0;
4878
- for (let j = 0; j < numberOfChannels; j++) sum += channelData[j][i];
4879
- monoData[i] = sum / numberOfChannels;
4880
- }
4881
- return monoData;
4882
- }
4883
- function ensureS16lePcm(input) {
4884
- let int16Array = new Int16Array(input.length);
4885
- for (let offset = 0; offset < input.length; offset++) {
4886
- let x = ~~(input[offset] * 32768);
4887
- int16Array[offset] = x > 32767 ? 32767 : x;
4888
- }
4889
- return int16Array.buffer;
4890
- }
4891
- function toUTF8String(input, start = 0, end = input.byteLength) {
4892
- return new TextDecoder().decode(input.slice(start, end));
4893
- }
4894
- function binaryFromSource(source) {
4895
- return ArrayBuffer.isView(source) ? source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength) : source;
4896
- }
4897
- async function encode(input, sampleRate) {
4898
- let instance = await silk_default(), buffer = binaryFromSource(input);
4899
- if (!buffer?.byteLength) throw new Error("input data length is 0");
4900
- if (isWavFile(input)) {
4901
- let { channelData, sampleRate: wavSampleRate } = decodeWavFile(input);
4902
- sampleRate ||= wavSampleRate, buffer = ensureS16lePcm(ensureMonoPcm(channelData));
4903
- }
4904
- let data = new Uint8Array(), duration = instance.silk_encode(buffer, sampleRate, (output) => {
4905
- data = output.slice();
4906
- });
4907
- if (duration === 0) throw new Error("silk encoding failure");
4908
- return { data, duration };
4909
- }
4910
- async function decode(input, sampleRate) {
4911
- let instance = await silk_default(), buffer = binaryFromSource(input);
4912
- if (!buffer?.byteLength) throw new Error("input data length is 0");
4913
- let data = new Uint8Array(), duration = instance.silk_decode(buffer, sampleRate, (output) => {
4914
- output.length > 0 && (data = output.slice());
4915
- });
4916
- if (duration === 0) throw new Error("silk decoding failure");
4917
- return { data, duration };
4918
- }
4919
- function getDuration(data, frameMs = 20) {
4920
- let buffer = binaryFromSource(data), view = new DataView(buffer), byteLength = view.byteLength, offset = view.getUint8(0) === 2 ? 10 : 9, blocks = 0;
4921
- for (; offset < byteLength; ) {
4922
- let size = view.getUint16(offset, true);
4923
- blocks += 1, offset += size + 2;
4924
- }
4925
- return blocks * frameMs;
4926
- }
4927
- function isWav(data) {
4928
- return isWavFile(data);
4929
- }
4930
- function getWavFileInfo2(data) {
4931
- return getWavFileInfo(data);
4932
- }
4933
- function isSilk(data) {
4934
- let buffer = binaryFromSource(data);
4935
- return buffer.byteLength < 7 ? false : toUTF8String(buffer, 0, 7).includes("#!SILK");
4936
- }
4937
- var import_meta, Module, silk_default, audioEncodingNames, wavFileTypeAudioEncodings;
4938
- var init_lib = __esm({
4939
- "node_modules/silk-wasm/lib/index.mjs"() {
4940
- "use strict";
4941
- import_meta = {};
4942
- Module = async function(moduleArg = {}) {
4943
- var moduleRtn, g2 = moduleArg, aa, q, ba = new Promise((a, b2) => {
4944
- aa = a, q = b2;
4945
- }), ca = typeof window == "object", da = typeof WorkerGlobalScope < "u", t = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer";
4946
- if (t) {
4947
- let { createRequire: a } = await import("module");
4948
- var require2 = a(import_meta.url);
4949
- }
4950
- var u2 = (a, b2) => {
4951
- throw b2;
4952
- }, ea = import_meta.url, v = "", fa, w2;
4953
- if (t) {
4954
- var fs20 = require2("fs"), ha = require2("path");
4955
- ea.startsWith("file:") && (v = ha.dirname(require2("url").fileURLToPath(ea)) + "/"), w2 = (a) => (a = y2(a) ? new URL(a) : a, fs20.readFileSync(a)), fa = async (a) => (a = y2(a) ? new URL(a) : a, fs20.readFileSync(a, void 0)), process.argv.slice(2), u2 = (a, b2) => {
4956
- throw process.exitCode = a, b2;
4957
- };
4958
- } else if (ca || da) {
4959
- try {
4960
- v = new URL(".", ea).href;
4961
- } catch {
4962
- }
4963
- da && (w2 = (a) => {
4964
- var b2 = new XMLHttpRequest();
4965
- return b2.open("GET", a, false), b2.responseType = "arraybuffer", b2.send(null), new Uint8Array(b2.response);
4966
- }), fa = async (a) => {
4967
- if (y2(a)) return new Promise((d3, c) => {
4968
- var e = new XMLHttpRequest();
4969
- e.open("GET", a, true), e.responseType = "arraybuffer", e.onload = () => {
4970
- e.status == 200 || e.status == 0 && e.response ? d3(e.response) : c(e.status);
4971
- }, e.onerror = c, e.send(null);
4972
- });
4973
- var b2 = await fetch(a, { credentials: "same-origin" });
4974
- if (b2.ok) return b2.arrayBuffer();
4975
- throw Error(b2.status + " : " + b2.url);
4976
- };
4977
- }
4978
- console.log.bind(console);
4979
- var A = console.error.bind(console), C2, D, E3 = false, ia, ja, F2, G, H, I, J, ka, la, ma, na, y2 = (a) => a.startsWith("file://");
4980
- function pa() {
4981
- var a = D.buffer;
4982
- ja = new Int8Array(a), G = new Int16Array(a), F2 = new Uint8Array(a), H = new Uint16Array(a), I = new Int32Array(a), J = new Uint32Array(a), ka = new Float32Array(a), na = new Float64Array(a), la = new BigInt64Array(a), ma = new BigUint64Array(a);
4983
- }
4984
- var K = 0, L = null;
4985
- function qa(a) {
4986
- throw g2.onAbort?.(a), a = "Aborted(" + a + ")", A(a), E3 = true, a = new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info."), q(a), a;
4987
- }
4988
- var ra;
4989
- async function sa(a) {
4990
- if (!C2) try {
4991
- var b2 = await fa(a);
4992
- return new Uint8Array(b2);
4993
- } catch {
4994
- }
4995
- if (a == ra && C2) a = new Uint8Array(C2);
4996
- else if (w2) a = w2(a);
4997
- else throw "both async and sync fetching of the wasm failed";
4998
- return a;
4999
- }
5000
- async function ta(a, b2) {
5001
- try {
5002
- var d3 = await sa(a);
5003
- return await WebAssembly.instantiate(d3, b2);
5004
- } catch (c) {
5005
- A(`failed to asynchronously prepare wasm: ${c}`), qa(c);
5006
- }
5007
- }
5008
- async function ua(a) {
5009
- var b2 = ra;
5010
- if (!C2 && typeof WebAssembly.instantiateStreaming == "function" && !y2(b2) && !t) try {
5011
- var d3 = fetch(b2, { credentials: "same-origin" });
5012
- return await WebAssembly.instantiateStreaming(d3, a);
5013
- } catch (c) {
5014
- A(`wasm streaming compile failed: ${c}`), A("falling back to ArrayBuffer instantiation");
5015
- }
5016
- return ta(b2, a);
5017
- }
5018
- class va {
5019
- name = "ExitStatus";
5020
- constructor(a) {
5021
- this.message = `Program terminated with exit(${a})`, this.status = a;
5022
- }
5023
- }
5024
- var wa = (a) => {
5025
- for (; 0 < a.length; ) a.shift()(g2);
5026
- }, xa = [], ya = [], za = () => {
5027
- var a = g2.preRun.shift();
5028
- ya.push(a);
5029
- }, O = true;
5030
- class Aa {
5031
- constructor(a) {
5032
- this.I = a - 24;
5033
- }
5034
- }
5035
- var Ba = 0, Ca = 0, Da, P = (a) => {
5036
- for (var b2 = ""; F2[a]; ) b2 += Da[F2[a++]];
5037
- return b2;
5038
- }, Q = {}, R = {}, S = {}, T = g2.BindingError = class extends Error {
5039
- constructor(a) {
5040
- super(a), this.name = "BindingError";
5041
- }
5042
- }, Ea = (a) => {
5043
- throw new T(a);
5044
- };
5045
- function Fa(a, b2, d3 = {}) {
5046
- var c = b2.name;
5047
- if (!a) throw new T(`type "${c}" must have a positive integer typeid pointer`);
5048
- if (R.hasOwnProperty(a)) {
5049
- if (d3.K) return;
5050
- throw new T(`Cannot register type '${c}' twice`);
5051
- }
5052
- R[a] = b2, delete S[a], Q.hasOwnProperty(a) && (b2 = Q[a], delete Q[a], b2.forEach((e) => e()));
5053
- }
5054
- function U(a, b2, d3 = {}) {
5055
- return Fa(a, b2, d3);
5056
- }
5057
- var Ga = (a, b2, d3) => {
5058
- switch (b2) {
5059
- case 1:
5060
- return d3 ? (c) => ja[c] : (c) => F2[c];
5061
- case 2:
5062
- return d3 ? (c) => G[c >> 1] : (c) => H[c >> 1];
5063
- case 4:
5064
- return d3 ? (c) => I[c >> 2] : (c) => J[c >> 2];
5065
- case 8:
5066
- return d3 ? (c) => la[c >> 3] : (c) => ma[c >> 3];
5067
- default:
5068
- throw new TypeError(`invalid integer width (${b2}): ${a}`);
5069
- }
5070
- }, Ha = [], V = [], Ia = (a) => {
5071
- 9 < a && --V[a + 1] === 0 && (V[a] = void 0, Ha.push(a));
5072
- }, Ja = (a) => {
5073
- if (!a) throw new T(`Cannot use deleted val. handle = ${a}`);
5074
- return V[a];
5075
- }, Ka = (a) => {
5076
- switch (a) {
5077
- case void 0:
5078
- return 2;
5079
- case null:
5080
- return 4;
5081
- case true:
5082
- return 6;
5083
- case false:
5084
- return 8;
5085
- default:
5086
- let b2 = Ha.pop() || V.length;
5087
- return V[b2] = a, V[b2 + 1] = 1, b2;
5088
- }
5089
- };
5090
- function La(a) {
5091
- return this.fromWireType(J[a >> 2]);
5092
- }
5093
- var Ma = { name: "emscripten::val", fromWireType: (a) => {
5094
- var b2 = Ja(a);
5095
- return Ia(a), b2;
5096
- }, toWireType: (a, b2) => Ka(b2), H: 8, readValueFromPointer: La, G: null }, Na = (a, b2) => {
5097
- switch (b2) {
5098
- case 4:
5099
- return function(d3) {
5100
- return this.fromWireType(ka[d3 >> 2]);
5101
- };
5102
- case 8:
5103
- return function(d3) {
5104
- return this.fromWireType(na[d3 >> 3]);
5105
- };
5106
- default:
5107
- throw new TypeError(`invalid float width (${b2}): ${a}`);
5108
- }
5109
- }, Oa = (a) => {
5110
- for (; a.length; ) {
5111
- var b2 = a.pop();
5112
- a.pop()(b2);
5113
- }
5114
- };
5115
- function Pa(a) {
5116
- for (var b2 = 1; b2 < a.length; ++b2) if (a[b2] !== null && a[b2].G === void 0) return true;
5117
- return false;
5118
- }
5119
- var Sa = (a, b2) => {
5120
- if (g2[a].F === void 0) {
5121
- var d3 = g2[a];
5122
- g2[a] = function(...c) {
5123
- if (!g2[a].F.hasOwnProperty(c.length)) throw new T(`Function '${b2}' called with an invalid number of arguments (${c.length}) - expects one of (${g2[a].F})!`);
5124
- return g2[a].F[c.length].apply(this, c);
5125
- }, g2[a].F = [], g2[a].F[d3.J] = d3;
5126
- }
5127
- }, Ta = (a, b2, d3) => {
5128
- if (g2.hasOwnProperty(a)) {
5129
- if (d3 === void 0 || g2[a].F !== void 0 && g2[a].F[d3] !== void 0) throw new T(`Cannot register public name '${a}' twice`);
5130
- if (Sa(a, a), g2[a].F.hasOwnProperty(d3)) throw new T(`Cannot register multiple overloads of a function with the same number of arguments (${d3})!`);
5131
- g2[a].F[d3] = b2;
5132
- } else g2[a] = b2, g2[a].J = d3;
5133
- }, Ua = (a, b2) => {
5134
- for (var d3 = [], c = 0; c < a; c++) d3.push(J[b2 + 4 * c >> 2]);
5135
- return d3;
5136
- }, Va = g2.InternalError = class extends Error {
5137
- constructor(a) {
5138
- super(a), this.name = "InternalError";
5139
- }
5140
- }, Wa = [], Xa, Ya = (a, b2) => {
5141
- a = P(a);
5142
- var d3;
5143
- if ((d3 = Wa[b2]) || (Wa[b2] = d3 = Xa.get(b2)), typeof d3 != "function") throw new T(`unknown function pointer with signature ${a}: ${b2}`);
5144
- return d3;
5145
- };
5146
- class Za extends Error {
5147
- }
5148
- for (var ab = (a) => {
5149
- a = $a(a);
5150
- var b2 = P(a);
5151
- return W(a), b2;
5152
- }, bb = (a, b2) => {
5153
- function d3(f) {
5154
- e[f] || R[f] || (S[f] ? S[f].forEach(d3) : (c.push(f), e[f] = true));
5155
- }
5156
- var c = [], e = {};
5157
- throw b2.forEach(d3), new Za(`${a}: ` + c.map(ab).join([", "]));
5158
- }, cb = (a, b2) => {
5159
- function d3(h2) {
5160
- if (h2 = b2(h2), h2.length !== c.length) throw new Va("Mismatched type converter count");
5161
- for (var l3 = 0; l3 < c.length; ++l3) U(c[l3], h2[l3]);
5162
- }
5163
- var c = [];
5164
- c.forEach((h2) => S[h2] = a);
5165
- var e = Array(a.length), f = [], m3 = 0;
5166
- a.forEach((h2, l3) => {
5167
- R.hasOwnProperty(h2) ? e[l3] = R[h2] : (f.push(h2), Q.hasOwnProperty(h2) || (Q[h2] = []), Q[h2].push(() => {
5168
- e[l3] = R[h2], ++m3, m3 === f.length && d3(e);
5169
- }));
5170
- }), f.length === 0 && d3(e);
5171
- }, db = (a) => {
5172
- a = a.trim();
5173
- let b2 = a.indexOf("(");
5174
- return b2 === -1 ? a : a.slice(0, b2);
5175
- }, eb = typeof TextDecoder < "u" ? new TextDecoder() : void 0, fb = (a = 0, b2 = NaN) => {
5176
- var d3 = F2, c = a + b2;
5177
- for (b2 = a; d3[b2] && !(b2 >= c); ) ++b2;
5178
- if (16 < b2 - a && d3.buffer && eb) return eb.decode(d3.subarray(a, b2));
5179
- for (c = ""; a < b2; ) {
5180
- var e = d3[a++];
5181
- if (e & 128) {
5182
- var f = d3[a++] & 63;
5183
- if ((e & 224) == 192) c += String.fromCharCode((e & 31) << 6 | f);
5184
- else {
5185
- var m3 = d3[a++] & 63;
5186
- e = (e & 240) == 224 ? (e & 15) << 12 | f << 6 | m3 : (e & 7) << 18 | f << 12 | m3 << 6 | d3[a++] & 63, 65536 > e ? c += String.fromCharCode(e) : (e -= 65536, c += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023));
5187
- }
5188
- } else c += String.fromCharCode(e);
5189
- }
5190
- return c;
5191
- }, gb = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, hb = (a, b2) => {
5192
- for (var d3 = a >> 1, c = d3 + b2 / 2; !(d3 >= c) && H[d3]; ) ++d3;
5193
- if (d3 <<= 1, 32 < d3 - a && gb) return gb.decode(F2.subarray(a, d3));
5194
- for (d3 = "", c = 0; !(c >= b2 / 2); ++c) {
5195
- var e = G[a + 2 * c >> 1];
5196
- if (e == 0) break;
5197
- d3 += String.fromCharCode(e);
5198
- }
5199
- return d3;
5200
- }, ib = (a, b2, d3) => {
5201
- if (d3 ??= 2147483647, 2 > d3) return 0;
5202
- d3 -= 2;
5203
- var c = b2;
5204
- d3 = d3 < 2 * a.length ? d3 / 2 : a.length;
5205
- for (var e = 0; e < d3; ++e) G[b2 >> 1] = a.charCodeAt(e), b2 += 2;
5206
- return G[b2 >> 1] = 0, b2 - c;
5207
- }, jb = (a) => 2 * a.length, kb = (a, b2) => {
5208
- for (var d3 = 0, c = ""; !(d3 >= b2 / 4); ) {
5209
- var e = I[a + 4 * d3 >> 2];
5210
- if (e == 0) break;
5211
- ++d3, 65536 <= e ? (e -= 65536, c += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023)) : c += String.fromCharCode(e);
5212
- }
5213
- return c;
5214
- }, lb = (a, b2, d3) => {
5215
- if (d3 ??= 2147483647, 4 > d3) return 0;
5216
- var c = b2;
5217
- d3 = c + d3 - 4;
5218
- for (var e = 0; e < a.length; ++e) {
5219
- var f = a.charCodeAt(e);
5220
- if (55296 <= f && 57343 >= f) {
5221
- var m3 = a.charCodeAt(++e);
5222
- f = 65536 + ((f & 1023) << 10) | m3 & 1023;
5223
- }
5224
- if (I[b2 >> 2] = f, b2 += 4, b2 + 4 > d3) break;
5225
- }
5226
- return I[b2 >> 2] = 0, b2 - c;
5227
- }, mb = (a) => {
5228
- for (var b2 = 0, d3 = 0; d3 < a.length; ++d3) {
5229
- var c = a.charCodeAt(d3);
5230
- 55296 <= c && 57343 >= c && ++d3, b2 += 4;
5231
- }
5232
- return b2;
5233
- }, nb = 0, ob = [], pb = (a) => {
5234
- var b2 = ob.length;
5235
- return ob.push(a), b2;
5236
- }, qb = (a, b2) => {
5237
- var d3 = R[a];
5238
- if (d3 === void 0) throw a = `${b2} has unknown type ${ab(a)}`, new T(a);
5239
- return d3;
5240
- }, rb = (a, b2) => {
5241
- for (var d3 = Array(a), c = 0; c < a; ++c) d3[c] = qb(J[b2 + 4 * c >> 2], `parameter ${c}`);
5242
- return d3;
5243
- }, sb = (a, b2, d3) => {
5244
- var c = [];
5245
- return a = a.toWireType(c, d3), c.length && (J[b2 >> 2] = Ka(c)), a;
5246
- }, X = {}, tb = (a) => {
5247
- ia = a, O || 0 < nb || (g2.onExit?.(a), E3 = true), u2(a, new va(a));
5248
- }, ub = (a) => {
5249
- if (!E3) try {
5250
- if (a(), !(O || 0 < nb)) try {
5251
- ia = a = ia, tb(a);
5252
- } catch (b2) {
5253
- b2 instanceof va || b2 == "unwind" || u2(1, b2);
5254
- }
5255
- } catch (b2) {
5256
- b2 instanceof va || b2 == "unwind" || u2(1, b2);
5257
- }
5258
- }, vb = Array(256), Y = 0; 256 > Y; ++Y) vb[Y] = String.fromCharCode(Y);
5259
- Da = vb, V.push(0, 1, void 0, 1, null, 1, true, 1, false, 1), g2.count_emval_handles = () => V.length / 2 - 5 - Ha.length, g2.noExitRuntime && (O = g2.noExitRuntime), g2.printErr && (A = g2.printErr), g2.wasmBinary && (C2 = g2.wasmBinary);
5260
- var Ab = { u: (a, b2, d3) => {
5261
- var c = new Aa(a);
5262
- throw J[c.I + 16 >> 2] = 0, J[c.I + 4 >> 2] = b2, J[c.I + 8 >> 2] = d3, Ba = a, Ca++, Ba;
5263
- }, v: () => qa(""), l: (a, b2, d3) => {
5264
- b2 = P(b2), U(a, { name: b2, fromWireType: (c) => c, toWireType: function(c, e) {
5265
- if (typeof e != "bigint" && typeof e != "number") throw e === null ? e = "null" : (c = typeof e, e = c === "object" || c === "array" || c === "function" ? e.toString() : "" + e), new TypeError(`Cannot convert "${e}" to ${this.name}`);
5266
- return typeof e == "number" && (e = BigInt(e)), e;
5267
- }, H: 8, readValueFromPointer: Ga(b2, d3, b2.indexOf("u") == -1), G: null });
5268
- }, o: (a, b2, d3, c) => {
5269
- b2 = P(b2), U(a, { name: b2, fromWireType: function(e) {
5270
- return !!e;
5271
- }, toWireType: function(e, f) {
5272
- return f ? d3 : c;
5273
- }, H: 8, readValueFromPointer: function(e) {
5274
- return this.fromWireType(F2[e]);
5275
- }, G: null });
5276
- }, m: (a) => U(a, Ma), k: (a, b2, d3) => {
5277
- b2 = P(b2), U(a, { name: b2, fromWireType: (c) => c, toWireType: (c, e) => e, H: 8, readValueFromPointer: Na(b2, d3), G: null });
5278
- }, c: (a, b2, d3, c, e, f, m3) => {
5279
- var h2 = Ua(b2, d3);
5280
- a = P(a), a = db(a), e = Ya(c, e), Ta(a, function() {
5281
- bb(`Cannot call ${a} due to unbound types`, h2);
5282
- }, b2 - 1), cb(h2, (l3) => {
5283
- var k = [l3[0], null].concat(l3.slice(1));
5284
- l3 = a;
5285
- var p2 = a, z = e, n = k.length;
5286
- if (2 > n) throw new T("argTypes array size mismatch! Must at least get return value and 'this' types!");
5287
- var B = k[1] !== null && false, M = Pa(k), Qa = k[0].name !== "void";
5288
- z = [p2, Ea, z, f, Oa, k[0], k[1]];
5289
- for (var x = 0; x < n - 2; ++x) z.push(k[x + 2]);
5290
- if (!M) for (x = B ? 1 : 2; x < k.length; ++x) k[x].G !== null && z.push(k[x].G);
5291
- M = Pa(k), x = k.length - 2;
5292
- var r = [], N = ["fn"];
5293
- for (B && N.push("thisWired"), n = 0; n < x; ++n) r.push(`arg${n}`), N.push(`arg${n}Wired`);
5294
- r = r.join(","), N = N.join(","), r = `return function (${r}) {
5295
- `, M && (r += `var destructors = [];
5296
- `);
5297
- var Ra = M ? "destructors" : "null", oa = "humanName throwBindingError invoker fn runDestructors retType classParam".split(" ");
5298
- for (B && (r += `var thisWired = classParam['toWireType'](${Ra}, this);
5299
- `), n = 0; n < x; ++n) r += `var arg${n}Wired = argType${n}['toWireType'](${Ra}, arg${n});
5300
- `, oa.push(`argType${n}`);
5301
- if (r += (Qa || m3 ? "var rv = " : "") + `invoker(${N});
5302
- `, M) r += `runDestructors(destructors);
5303
- `;
5304
- else for (n = B ? 1 : 2; n < k.length; ++n) B = n === 1 ? "thisWired" : "arg" + (n - 2) + "Wired", k[n].G !== null && (r += `${B}_dtor(${B});
5305
- `, oa.push(`${B}_dtor`));
5306
- Qa && (r += `var ret = retType['fromWireType'](rv);
5307
- return ret;
5308
- `);
5309
- let [yb, zb] = [oa, r + `}
5310
- `];
5311
- if (k = new _F(...yb, zb)(...z), p2 = Object.defineProperty(k, "name", { value: p2 }), k = b2 - 1, !g2.hasOwnProperty(l3)) throw new Va("Replacing nonexistent public symbol");
5312
- return g2[l3].F !== void 0 && k !== void 0 ? g2[l3].F[k] = p2 : (g2[l3] = p2, g2[l3].J = k), [];
5313
- });
5314
- }, b: (a, b2, d3, c, e) => {
5315
- if (b2 = P(b2), e === -1 && (e = 4294967295), e = (h2) => h2, c === 0) {
5316
- var f = 32 - 8 * d3;
5317
- e = (h2) => h2 << f >>> f;
5318
- }
5319
- var m3 = b2.includes("unsigned") ? function(h2, l3) {
5320
- return l3 >>> 0;
5321
- } : function(h2, l3) {
5322
- return l3;
5323
- };
5324
- U(a, { name: b2, fromWireType: e, toWireType: m3, H: 8, readValueFromPointer: Ga(b2, d3, c !== 0), G: null });
5325
- }, a: (a, b2, d3) => {
5326
- function c(f) {
5327
- return new e(ja.buffer, J[f + 4 >> 2], J[f >> 2]);
5328
- }
5329
- var e = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array][b2];
5330
- d3 = P(d3), U(a, { name: d3, fromWireType: c, H: 8, readValueFromPointer: c }, { K: true });
5331
- }, n: (a, b2) => {
5332
- b2 = P(b2), U(a, { name: b2, fromWireType: function(d3) {
5333
- for (var c = J[d3 >> 2], e = d3 + 4, f, m3 = e, h2 = 0; h2 <= c; ++h2) {
5334
- var l3 = e + h2;
5335
- (h2 == c || F2[l3] == 0) && (m3 = m3 ? fb(m3, l3 - m3) : "", f === void 0 ? f = m3 : (f += "\0", f += m3), m3 = l3 + 1);
5336
- }
5337
- return W(d3), f;
5338
- }, toWireType: function(d3, c) {
5339
- c instanceof ArrayBuffer && (c = new Uint8Array(c));
5340
- var e, f = typeof c == "string";
5341
- if (!(f || ArrayBuffer.isView(c) && c.BYTES_PER_ELEMENT == 1)) throw new T("Cannot pass non-string to std::string");
5342
- var m3;
5343
- if (f) for (e = m3 = 0; e < c.length; ++e) {
5344
- var h2 = c.charCodeAt(e);
5345
- 127 >= h2 ? m3++ : 2047 >= h2 ? m3 += 2 : 55296 <= h2 && 57343 >= h2 ? (m3 += 4, ++e) : m3 += 3;
5346
- }
5347
- else m3 = c.length;
5348
- if (e = m3, m3 = wb(4 + e + 1), h2 = m3 + 4, J[m3 >> 2] = e, f) {
5349
- if (f = h2, h2 = e + 1, e = F2, 0 < h2) {
5350
- h2 = f + h2 - 1;
5351
- for (var l3 = 0; l3 < c.length; ++l3) {
5352
- var k = c.charCodeAt(l3);
5353
- if (55296 <= k && 57343 >= k) {
5354
- var p2 = c.charCodeAt(++l3);
5355
- k = 65536 + ((k & 1023) << 10) | p2 & 1023;
5356
- }
5357
- if (127 >= k) {
5358
- if (f >= h2) break;
5359
- e[f++] = k;
5360
- } else {
5361
- if (2047 >= k) {
5362
- if (f + 1 >= h2) break;
5363
- e[f++] = 192 | k >> 6;
5364
- } else {
5365
- if (65535 >= k) {
5366
- if (f + 2 >= h2) break;
5367
- e[f++] = 224 | k >> 12;
5368
- } else {
5369
- if (f + 3 >= h2) break;
5370
- e[f++] = 240 | k >> 18, e[f++] = 128 | k >> 12 & 63;
5371
- }
5372
- e[f++] = 128 | k >> 6 & 63;
5373
- }
5374
- e[f++] = 128 | k & 63;
5375
- }
5376
- }
5377
- e[f] = 0;
5378
- }
5379
- } else F2.set(c, h2);
5380
- return d3 !== null && d3.push(W, m3), m3;
5381
- }, H: 8, readValueFromPointer: La, G(d3) {
5382
- W(d3);
5383
- } });
5384
- }, e: (a, b2, d3) => {
5385
- if (d3 = P(d3), b2 === 2) var c = hb, e = ib, f = jb, m3 = (h2) => H[h2 >> 1];
5386
- else b2 === 4 && (c = kb, e = lb, f = mb, m3 = (h2) => J[h2 >> 2]);
5387
- U(a, { name: d3, fromWireType: (h2) => {
5388
- for (var l3 = J[h2 >> 2], k, p2 = h2 + 4, z = 0; z <= l3; ++z) {
5389
- var n = h2 + 4 + z * b2;
5390
- (z == l3 || m3(n) == 0) && (p2 = c(p2, n - p2), k === void 0 ? k = p2 : (k += "\0", k += p2), p2 = n + b2);
5391
- }
5392
- return W(h2), k;
5393
- }, toWireType: (h2, l3) => {
5394
- if (typeof l3 != "string") throw new T(`Cannot pass non-string to C++ string type ${d3}`);
5395
- var k = f(l3), p2 = wb(4 + k + b2);
5396
- return J[p2 >> 2] = k / b2, e(l3, p2 + 4, k + b2), h2 !== null && h2.push(W, p2), p2;
5397
- }, H: 8, readValueFromPointer: La, G(h2) {
5398
- W(h2);
5399
- } });
5400
- }, f: (a) => {
5401
- U(a, Ma);
5402
- }, p: (a, b2) => {
5403
- b2 = P(b2), U(a, { L: true, name: b2, H: 0, fromWireType: () => {
5404
- }, toWireType: () => {
5405
- } });
5406
- }, s: () => {
5407
- O = false, nb = 0;
5408
- }, i: (a, b2, d3, c) => (a = ob[a], b2 = Ja(b2), a(null, b2, d3, c)), d: Ia, h: (a, b2, d3) => {
5409
- b2 = rb(a, b2);
5410
- var c = b2.shift();
5411
- a--;
5412
- var e = `return function (obj, func, destructorsRef, args) {
5413
- `, f = 0, m3 = [];
5414
- d3 === 0 && m3.push("obj");
5415
- for (var h2 = ["retType"], l3 = [c], k = 0; k < a; ++k) m3.push(`arg${k}`), h2.push(`argType${k}`), l3.push(b2[k]), e += ` var arg${k} = argType${k}.readValueFromPointer(args${f ? "+" + f : ""});
5416
- `, f += b2[k].H;
5417
- return e += ` var rv = ${d3 === 1 ? "new func" : "func.call"}(${m3.join(", ")});
5418
- `, c.L || (h2.push("emval_returnValue"), l3.push(sb), e += ` return emval_returnValue(retType, destructorsRef, rv);
5419
- `), a = new _F(...h2, e + `};
5420
- `)(...l3), d3 = `methodCaller<(${b2.map((p2) => p2.name).join(", ")}) => ${c.name}>`, pb(Object.defineProperty(a, "name", { value: d3 }));
5421
- }, q: (a) => {
5422
- 9 < a && (V[a + 1] += 1);
5423
- }, g: (a) => {
5424
- var b2 = Ja(a);
5425
- Oa(b2), Ia(a);
5426
- }, j: (a, b2) => (a = qb(a, "_emval_take_value"), a = a.readValueFromPointer(b2), Ka(a)), t: (a, b2) => {
5427
- if (X[a] && (clearTimeout(X[a].id), delete X[a]), !b2) return 0;
5428
- var d3 = setTimeout(() => {
5429
- delete X[a], ub(() => xb(a, performance.now()));
5430
- }, b2);
5431
- return X[a] = { id: d3, M: b2 }, 0;
5432
- }, w: (a) => {
5433
- var b2 = F2.length;
5434
- if (a >>>= 0, 2147483648 < a) return false;
5435
- for (var d3 = 1; 4 >= d3; d3 *= 2) {
5436
- var c = b2 * (1 + 0.2 / d3);
5437
- c = Math.min(c, a + 100663296);
5438
- a: {
5439
- c = (Math.min(2147483648, 65536 * Math.ceil(Math.max(a, c) / 65536)) - D.buffer.byteLength + 65535) / 65536 | 0;
5440
- try {
5441
- D.grow(c), pa();
5442
- var e = 1;
5443
- break a;
5444
- } catch {
5445
- }
5446
- e = void 0;
5447
- }
5448
- if (e) return true;
5449
- }
5450
- return false;
5451
- }, r: tb }, Z = await (async function() {
5452
- function a(c) {
5453
- return Z = c.exports, D = Z.x, pa(), Xa = Z.D, K--, g2.monitorRunDependencies?.(K), K == 0 && L && (c = L, L = null, c()), Z;
5454
- }
5455
- K++, g2.monitorRunDependencies?.(K);
5456
- var b2 = { a: Ab };
5457
- if (g2.instantiateWasm) return new Promise((c) => {
5458
- g2.instantiateWasm(b2, (e, f) => {
5459
- c(a(e, f));
5460
- });
5461
- });
5462
- ra ??= g2.locateFile ? g2.locateFile ? g2.locateFile("silk.wasm", v) : v + "silk.wasm" : new URL("silk.wasm", import_meta.url).href;
5463
- try {
5464
- var d3 = await ua(b2);
5465
- return a(d3.instance);
5466
- } catch (c) {
5467
- return q(c), Promise.reject(c);
5468
- }
5469
- })(), $a = Z.z, wb = Z.A, W = Z.B, xb = Z.C;
5470
- function Bb() {
5471
- function a() {
5472
- if (g2.calledRun = true, !E3) {
5473
- if (Z.y(), aa(g2), g2.onRuntimeInitialized?.(), g2.postRun) for (typeof g2.postRun == "function" && (g2.postRun = [g2.postRun]); g2.postRun.length; ) {
5474
- var b2 = g2.postRun.shift();
5475
- xa.push(b2);
5476
- }
5477
- wa(xa);
5478
- }
5479
- }
5480
- if (0 < K) L = Bb;
5481
- else {
5482
- if (g2.preRun) for (typeof g2.preRun == "function" && (g2.preRun = [g2.preRun]); g2.preRun.length; ) za();
5483
- wa(ya), 0 < K ? L = Bb : g2.setStatus ? (g2.setStatus("Running..."), setTimeout(() => {
5484
- setTimeout(() => g2.setStatus(""), 1), a();
5485
- }, 1)) : a();
5486
- }
5487
- }
5488
- if (g2.preInit) for (typeof g2.preInit == "function" && (g2.preInit = [g2.preInit]); 0 < g2.preInit.length; ) g2.preInit.shift()();
5489
- return Bb(), moduleRtn = ba, moduleRtn;
5490
- };
5491
- silk_default = Module;
5492
- audioEncodingNames = ["int", "float"];
5493
- wavFileTypeAudioEncodings = [0, 0, 0, 1];
5494
- }
5495
- });
5496
-
5497
4736
  // index.ts
5498
4737
  var index_exports = {};
5499
4738
  __export(index_exports, {
@@ -11947,7 +11186,7 @@ function loadSilkWasm() {
11947
11186
  }
11948
11187
  _silkWasmPromise = (async () => {
11949
11188
  try {
11950
- const mod = await Promise.resolve().then(() => (init_lib(), lib_exports));
11189
+ const mod = await import("silk-wasm");
11951
11190
  return mod;
11952
11191
  } catch {
11953
11192
  return null;