woolball-client
Version:
Client-side library for Woolball enabling secure browser resource sharing for distributed AI task processing
1,424 lines (1,418 loc) • 26.9 MB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x3) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x3, {
get: (a3, b4) => (typeof require !== "undefined" ? require : a3)[b4]
}) : x3)(function(x3) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x3 + '" is not supported');
});
var __esm = (fn3, res) => function __init() {
return fn3 && (res = (0, fn3[__getOwnPropNames(fn3)[0]])(fn3 = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to2, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to2, key) && key !== except)
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to2;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// dist/utils/browser/compatibility.js
var require_compatibility = __commonJS({
"dist/utils/browser/compatibility.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrowserCompatibilityError = void 0;
exports.isChromeExtension = isChromeExtension;
exports.isSupportedBrowser = isSupportedBrowser;
exports.verifyBrowserCompatibility = verifyBrowserCompatibility;
exports.initBrowserCompatibility = initBrowserCompatibility;
var BrowserCompatibilityError = class extends Error {
constructor(message) {
super(message);
this.name = "BrowserCompatibilityError";
}
};
exports.BrowserCompatibilityError = BrowserCompatibilityError;
function isChromeExtension() {
try {
return typeof window !== "undefined" && typeof window.chrome !== "undefined" && window.chrome.runtime !== void 0 && window.chrome.runtime.id !== void 0;
} catch (e3) {
return false;
}
}
function isSupportedBrowser() {
try {
if (isChromeExtension()) {
return true;
}
if (typeof window === "undefined" || !window.navigator) {
return false;
}
const hasWebGPU = "gpu" in navigator;
const hasWasm = typeof WebAssembly !== "undefined";
return hasWebGPU || hasWasm;
} catch (e3) {
return false;
}
}
function verifyBrowserCompatibility() {
try {
if (isChromeExtension()) {
return;
}
if (!isSupportedBrowser()) {
throw new BrowserCompatibilityError("browser-node requires a browser with WebGPU or WebAssembly support. Please use Chrome, Edge, Safari, or another modern browser.");
}
} catch (e3) {
if (e3 instanceof BrowserCompatibilityError) {
throw e3;
}
console.warn("Skipping browser compatibility check in service worker environment");
}
}
function initBrowserCompatibility() {
try {
if (typeof window !== "undefined" && true) {
verifyBrowserCompatibility();
}
} catch (e3) {
console.warn("Skipping browser compatibility initialization in service worker environment");
}
}
}
});
// dist/utils/browser/index.js
var require_browser = __commonJS({
"dist/utils/browser/index.js"(exports) {
"use strict";
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o4, m4, k5, k22) {
if (k22 === void 0) k22 = k5;
var desc = Object.getOwnPropertyDescriptor(m4, k5);
if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() {
return m4[k5];
} };
}
Object.defineProperty(o4, k22, desc);
} : function(o4, m4, k5, k22) {
if (k22 === void 0) k22 = k5;
o4[k22] = m4[k5];
});
var __exportStar = exports && exports.__exportStar || function(m4, exports2) {
for (var p5 in m4) if (p5 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p5)) __createBinding(exports2, m4, p5);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require_compatibility(), exports);
}
});
// dist/utils/websocket/index.js
var require_websocket = __commonJS({
"dist/utils/websocket/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
}
});
// dist/utils/index.js
var require_utils = __commonJS({
"dist/utils/index.js"(exports) {
"use strict";
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o4, m4, k5, k22) {
if (k22 === void 0) k22 = k5;
var desc = Object.getOwnPropertyDescriptor(m4, k5);
if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() {
return m4[k5];
} };
}
Object.defineProperty(o4, k22, desc);
} : function(o4, m4, k5, k22) {
if (k22 === void 0) k22 = k5;
o4[k22] = m4[k5];
});
var __exportStar = exports && exports.__exportStar || function(m4, exports2) {
for (var p5 in m4) if (p5 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p5)) __createBinding(exports2, m4, p5);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require_browser(), exports);
__exportStar(require_websocket(), exports);
}
});
// node_modules/web-worker/src/browser/index.js
var browser_exports = {};
__export(browser_exports, {
default: () => browser_default
});
var browser_default;
var init_browser = __esm({
"node_modules/web-worker/src/browser/index.js"() {
browser_default = typeof Worker !== "undefined" ? Worker : void 0;
}
});
// node_modules/wavefile/dist/wavefile.js
var require_wavefile = __commonJS({
"node_modules/wavefile/dist/wavefile.js"(exports, module) {
try {
if (!Uint8Array.prototype.slice) Object.defineProperty(Uint8Array.prototype, "slice", { value: function(begin, end) {
return new Uint8Array(Array.prototype.slice.call(this, begin, end));
} });
} catch (err) {
}
var ka3 = "function" == typeof Object.create ? Object.create : function(n4) {
function m4() {
}
m4.prototype = n4;
return new m4();
};
var D3;
if ("function" == typeof Object.setPrototypeOf) D3 = Object.setPrototypeOf;
else {
a: {
la2 = { D: true }, N4 = {};
try {
N4.__proto__ = la2;
K3 = N4.D;
break a;
} catch (n4) {
}
K3 = false;
}
D3 = K3 ? function(n4, m4) {
n4.__proto__ = m4;
if (n4.__proto__ !== m4) throw new TypeError(n4 + " is not extensible");
return n4;
} : null;
}
var K3;
var la2;
var N4;
var O3 = D3;
function P4(n4, m4) {
n4.prototype = ka3(m4.prototype);
n4.prototype.constructor = n4;
if (O3) O3(n4, m4);
else for (var l3 in m4) if ("prototype" != l3) if (Object.defineProperties) {
var p5 = Object.getOwnPropertyDescriptor(m4, l3);
p5 && Object.defineProperty(n4, l3, p5);
} else n4[l3] = m4[l3];
}
var ma2 = "function" == typeof Object.defineProperties ? Object.defineProperty : function(n4, m4, l3) {
n4 != Array.prototype && n4 != Object.prototype && (n4[m4] = l3.value);
};
var na2 = "undefined" != typeof window && window === exports ? exports : "undefined" != typeof window && null != window ? window : exports;
function Q4(n4, m4) {
if (m4) {
for (var l3 = na2, p5 = n4.split("."), y4 = 0; y4 < p5.length - 1; y4++) {
var v4 = p5[y4];
v4 in l3 || (l3[v4] = {});
l3 = l3[v4];
}
p5 = p5[p5.length - 1];
y4 = l3[p5];
v4 = m4(y4);
v4 != y4 && null != v4 && ma2(l3, p5, { configurable: true, writable: true, value: v4 });
}
}
Q4("Object.is", function(n4) {
return n4 ? n4 : function(m4, l3) {
return m4 === l3 ? 0 !== m4 || 1 / m4 === 1 / l3 : m4 !== m4 && l3 !== l3;
};
});
Q4("Array.prototype.includes", function(n4) {
return n4 ? n4 : function(m4, l3) {
var p5 = this;
p5 instanceof String && (p5 = String(p5));
var y4 = p5.length, v4 = l3 || 0;
for (0 > v4 && (v4 = Math.max(v4 + y4, 0)); v4 < y4; v4++) {
var w4 = p5[v4];
if (w4 === m4 || Object.is(w4, m4)) return true;
}
return false;
};
});
Q4("String.prototype.codePointAt", function(n4) {
return n4 ? n4 : function(m4) {
if (null == this) throw new TypeError("The 'this' value for String.prototype.codePointAt must not be null or undefined");
var l3 = this.length;
m4 = Number(m4) || 0;
if (0 <= m4 && m4 < l3) {
m4 |= 0;
var p5 = this.charCodeAt(m4);
if (55296 > p5 || 56319 < p5 || m4 + 1 === l3) return p5;
m4 = this.charCodeAt(m4 + 1);
return 56320 > m4 || 57343 < m4 ? p5 : 1024 * (p5 - 55296) + m4 + 9216;
}
};
});
var oa2 = "function" == typeof Object.assign ? Object.assign : function(n4, m4) {
for (var l3 = 1; l3 < arguments.length; l3++) {
var p5 = arguments[l3];
if (p5) for (var y4 in p5) Object.prototype.hasOwnProperty.call(p5, y4) && (n4[y4] = p5[y4]);
}
return n4;
};
Q4("Object.assign", function(n4) {
return n4 || oa2;
});
var V4 = exports;
function W3(n4) {
function m4(a3) {
var b4 = l3.call(this) || this;
a3 && b4.fromBuffer(a3);
return b4;
}
function l3() {
return w4.apply(this, arguments) || this;
}
function p5(a3, b4, c4) {
for (var d4 = [], e3 = 0; e3 < a3; e3++) d4.push(this.b({ pa: b4, oa: c4, Q: 0.5 / Math.sin(Math.PI / (2 * a3) * (e3 + 0.5)) }));
this.a = [];
for (a3 = 0; a3 < d4.length; a3++) this.a[a3] = { Ka: d4[a3].A[0], La: d4[a3].A[1], Ma: d4[a3].A[2], Ha: d4[a3].D[0], Ia: d4[a3].D[1], k: d4[a3].k, z: [0, 0] };
}
function y4(a3, b4, c4) {
c4 = 2 * Math.PI * c4 / b4;
b4 = 0;
this.a = [];
for (var d4 = 0; d4 <= a3; d4++) 0 === d4 - a3 / 2 ? this.a[d4] = c4 : (this.a[d4] = Math.sin(c4 * (d4 - a3 / 2)) / (d4 - a3 / 2), this.a[d4] *= 0.54 - 0.46 * Math.cos(2 * Math.PI * d4 / a3)), b4 += this.a[d4];
for (c4 = 0; c4 <= a3; c4++) this.a[c4] /= b4;
this.z = this.b();
}
function v4(a3, b4, c4) {
this.C = a3;
this.l = (a3 - 1) / b4;
this.M = this.I;
"point" === c4.method ? this.M = this.H : "linear" === c4.method ? this.M = this.G : "cubic" === c4.method && (this.M = this.B);
this.J = 1 - Math.max(0, Math.min(1, c4.tension || 0));
this.v = c4.sincFilterSize || 1;
this.F = pa2(c4.sincWindow || qa3);
}
function w4() {
return C3.apply(this, arguments) || this;
}
function C3() {
return t4.apply(this, arguments) || this;
}
function t4() {
var a3 = q3.call(this) || this;
a3.bitDepth = "0";
a3.f = { h: 0, o: false };
a3.G = { 4: 17, 8: 1, "8a": 6, "8m": 7, 16: 1, 24: 1, 32: 1, "32f": 3, 64: 3 };
return a3;
}
function q3() {
return u5.apply(this, arguments) || this;
}
function u5() {
var a3 = B3.call(this) || this;
a3.Z.push("RF64");
a3.fmt = { chunkId: "", chunkSize: 0, audioFormat: 0, numChannels: 0, sampleRate: 0, byteRate: 0, blockAlign: 0, bitsPerSample: 0, cbSize: 0, validBitsPerSample: 0, dwChannelMask: 0, subformat: [] };
a3.fact = { chunkId: "", chunkSize: 0, dwSampleLength: 0 };
a3.cue = { chunkId: "", chunkSize: 0, dwCuePoints: 0, points: [] };
a3.smpl = {
chunkId: "",
chunkSize: 0,
dwManufacturer: 0,
dwProduct: 0,
dwSamplePeriod: 0,
dwMIDIUnityNote: 0,
dwMIDIPitchFraction: 0,
dwSMPTEFormat: 0,
dwSMPTEOffset: 0,
dwNumSampleLoops: 0,
dwSamplerData: 0,
loops: []
};
a3.bext = { chunkId: "", chunkSize: 0, description: "", originator: "", originatorReference: "", originationDate: "", originationTime: "", timeReference: [0, 0], version: 0, UMID: "", loudnessValue: 0, loudnessRange: 0, maxTruePeakLevel: 0, maxMomentaryLoudness: 0, maxShortTermLoudness: 0, reserved: "", codingHistory: "" };
a3.iXML = { chunkId: "", chunkSize: 0, value: "" };
a3.ds64 = {
chunkId: "",
chunkSize: 0,
riffSizeHigh: 0,
riffSizeLow: 0,
dataSizeHigh: 0,
dataSizeLow: 0,
originationTime: 0,
sampleCountHigh: 0,
sampleCountLow: 0
};
a3.data = { chunkId: "", chunkSize: 0, samples: new Uint8Array(0) };
a3.LIST = [];
a3.junk = { chunkId: "", chunkSize: 0, chunkData: [] };
a3._PMX = { chunkId: "", chunkSize: 0, value: "" };
a3.g = { h: 16, o: false, O: false, R: false };
return a3;
}
function B3() {
this.container = "";
this.chunkSize = 0;
this.format = "";
this.Y = null;
this.c = 0;
this.a = { h: 32, o: false };
this.Z = ["RIFF", "RIFX"];
}
function H3(a3, b4) {
this.offset = Math.ceil((a3 + b4) / 8);
this.b = a3;
this.c = b4;
this.a = (1 << a3 - 1) - 1;
this.f = Math.pow(2, this.a + 1);
this.g = a3 + b4;
this.j = Math.pow(2, -(8 * this.offset - 1 - a3));
}
function F5(a3, b4) {
this.h = a3;
this.offset = Math.ceil(a3 / 8);
this.max = Math.pow(2, a3) - 1;
this.min = 0;
this.S = this.a;
if (void 0 === b4 ? 0 : b4) this.max = Math.pow(2, a3) / 2 - 1, this.min = -this.max - 1, this.S = this.f;
}
function ra2(a3) {
for (var b4 = new Uint8Array(256), c4 = 0; 64 > c4; c4++) b4["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(c4)] = c4;
c4 = 0.75 * a3.length;
"=" === a3[a3.length - 1] && (c4--, "=" === a3[a3.length - 2] && c4--);
c4 = new Uint8Array(c4);
for (var d4 = 0, e3 = 0; d4 < a3.length; d4 += 4) {
var f4 = b4[a3.charCodeAt(d4)], g4 = b4[a3.charCodeAt(d4 + 1)], k5 = b4[a3.charCodeAt(d4 + 2)], r3 = b4[a3.charCodeAt(d4 + 3)];
c4[e3++] = f4 << 2 | g4 >> 4;
c4[e3++] = (g4 & 15) << 4 | k5 >> 2;
c4[e3++] = (k5 & 3) << 6 | r3 & 63;
}
return c4;
}
function sa2(a3, b4) {
return a3 = 0 < a3 ? parseInt(a3 / b4.ea * b4.ca, 10) : parseInt(a3 / b4.fa * b4.da, 10);
}
function ta2(a3, b4) {
return parseInt(0 < a3 ? a3 * b4.ca : a3 * b4.da, 10);
}
function ua2(a3, b4) {
return 0 < a3 ? a3 / b4.ea : a3 / b4.fa;
}
function va2(a3, b4) {
function c4(d4) {
return d4;
}
a3 != b4 && (c4 = ["32f", "64"].includes(a3) ? ta2 : ["32f", "64"].includes(b4) ? ua2 : sa2);
return c4;
}
function X3(a3) {
if ("32f" != a3 && "64" != a3 && ("8" > parseInt(a3, 10) || "53" < parseInt(a3, 10))) throw Error("Invalid bit depth.");
}
function Y3(a3, b4, c4) {
if ("8" == a3) {
a3 = c4 ? -128 : 128;
c4 = 0;
for (var d4 = b4.length; c4 < d4; c4++) b4[c4] = b4[c4] += a3;
}
}
function wa2(a3) {
for (var b4 = { index: 0, i: 0, step: 7 }, c4 = new Uint8Array(a3.length), d4 = [], e3 = 0, f4 = 0, g4 = 0, k5 = a3.length; g4 < k5; g4++) 0 == g4 % 505 && 0 != g4 && (c4.set(xa2(d4, b4), e3), e3 += 256, d4 = [], f4++), d4.push(a3[g4]);
a3 = a3.length / 2;
a3 % 2 && a3++;
return c4.slice(0, a3 + 512 + 4 * f4);
}
function ya2(a3, b4) {
b4 = void 0 === b4 ? 256 : b4;
for (var c4 = { index: 0, i: 0, step: 7 }, d4 = new Int16Array(2 * a3.length), e3 = [], f4 = 0, g4 = 0, k5 = a3.length; g4 < k5; g4++) {
if (0 == g4 % b4 && 0 != g4) {
var r3 = c4, z4 = e3[1] << 8 | e3[0];
r3.i = 32768 < z4 ? z4 - 65536 : z4;
r3.index = e3[2];
r3.step = R3[r3.index];
z4 = [r3.i, r3.i];
for (var I3 = 4, za3 = e3.length; I3 < za3; I3++) {
var Z3 = e3[I3], aa2 = Z3 >> 4;
z4.push(ba2(aa2 << 4 ^ Z3, r3));
z4.push(ba2(aa2, r3));
}
e3 = z4;
d4.set(e3, f4);
f4 += e3.length;
e3 = [];
}
e3.push(a3[g4]);
}
return d4;
}
function xa2(a3, b4) {
var c4 = a3[0];
S3(c4, b4);
var d4 = [];
d4.push(c4 & 255);
d4.push(c4 >> 8 & 255);
d4.push(b4.index);
d4.push(0);
c4 = 3;
for (var e3 = a3.length; c4 < e3; c4 += 2) {
var f4 = S3(a3[c4], b4), g4 = S3(a3[c4 + 1], b4);
d4.push(g4 << 4 | f4);
}
return d4;
}
function S3(a3, b4) {
var c4 = a3 - b4.i;
if (0 <= c4) var d4 = 0;
else d4 = 8, c4 = -c4;
var e3 = R3[b4.index], f4 = e3 >> 3;
c4 > e3 && (d4 |= 4, c4 -= e3, f4 += e3);
e3 >>= 1;
c4 > e3 && (d4 |= 2, c4 -= e3, f4 += e3);
e3 >>= 1;
c4 > e3 && (d4 |= 1, f4 += e3);
c4 = d4;
b4.i = c4 & 8 ? b4.i - f4 : b4.i + f4;
-32768 > b4.i ? b4.i = -32768 : 32767 < b4.i && (b4.i = 32767);
b4.index += ca2[c4 & 7];
0 > b4.index ? b4.index = 0 : 88 < b4.index && (b4.index = 88);
return d4;
}
function ba2(a3, b4) {
var c4 = 0;
a3 & 4 && (c4 += b4.step);
a3 & 2 && (c4 += b4.step >> 1);
a3 & 1 && (c4 += b4.step >> 2);
c4 += b4.step >> 3;
a3 & 8 && (c4 = -c4);
b4.i += c4;
32767 < b4.i ? b4.i = 32767 : -32767 > b4.i && (b4.i = -32767);
b4.index += ca2[a3];
0 > b4.index ? b4.index = 0 : 88 < b4.index && (b4.index = 88);
b4.step = R3[b4.index];
return b4.i;
}
function Aa2(a3) {
for (var b4 = new Uint8Array(a3.length), c4 = 0, d4 = a3.length; c4 < d4; c4++) {
var e3 = c4;
var f4 = a3[c4];
f4 = -32768 == f4 ? -32767 : f4;
var g4 = ~f4 >> 8 & 128;
g4 || (f4 *= -1);
32635 < f4 && (f4 = 32635);
if (256 <= f4) {
var k5 = Ba3[f4 >> 8 & 127];
f4 = k5 << 4 | f4 >> k5 + 3 & 15;
} else f4 >>= 4;
b4[e3] = f4 ^ g4 ^ 85;
}
return b4;
}
function Ca3(a3) {
for (var b4 = new Int16Array(a3.length), c4 = 0, d4 = a3.length; c4 < d4; c4++) {
var e3 = c4, f4 = a3[c4], g4 = 0;
f4 ^= 85;
0 !== (f4 & 128) && (f4 &= -129, g4 = -1);
var k5 = ((f4 & 240) >> 4) + 4;
f4 = 4 != k5 ? 1 << k5 | (f4 & 15) << k5 - 4 | 1 << k5 - 5 : f4 << 1 | 1;
b4[e3] = -8 * (0 === g4 ? f4 : -f4);
}
return b4;
}
function Da3(a3) {
for (var b4 = new Uint8Array(a3.length), c4 = 0, d4 = a3.length; c4 < d4; c4++) {
var e3 = c4, f4 = a3[c4];
var g4 = f4 >> 8 & 128;
0 != g4 && (f4 = -f4);
f4 += 132;
32635 < f4 && (f4 = 32635);
var k5 = Ea2[f4 >> 7 & 255];
b4[e3] = ~(g4 | k5 << 4 | f4 >> k5 + 3 & 15);
}
return b4;
}
function Fa3(a3) {
for (var b4 = new Int16Array(a3.length), c4 = 0, d4 = a3.length; c4 < d4; c4++) {
var e3 = c4, f4 = a3[c4];
f4 = ~f4;
var g4 = f4 >> 4 & 7;
g4 = Ga3[g4] + ((f4 & 15) << g4 + 3);
0 != (f4 & 128) && (g4 = -g4);
b4[e3] = g4;
}
return b4;
}
function da2(a3, b4, c4, d4) {
d4 = void 0 === d4 ? a3.length : d4;
for (c4 = void 0 === c4 ? 0 : c4; c4 < d4; c4 += b4) {
var e3 = a3, f4 = b4, g4 = c4;
f4--;
for (var k5 = 0; k5 < f4; k5++) {
var r3 = e3[g4 + k5];
e3[g4 + k5] = e3[g4 + f4];
e3[g4 + f4] = r3;
f4--;
}
}
}
function T3(a3, b4, c4) {
c4 = void 0 === c4 ? 0 : c4;
for (var d4 = 0, e3 = a3.length; d4 < e3; ) {
var f4 = a3.codePointAt(d4);
if (128 > f4) b4[c4] = f4, c4++;
else {
var g4 = 0, k5 = 0;
2047 >= f4 ? (g4 = 1, k5 = 192) : 65535 >= f4 ? (g4 = 2, k5 = 224) : 1114111 >= f4 && (g4 = 3, k5 = 240, d4++);
b4[c4] = (f4 >> 6 * g4) + k5;
for (c4++; 0 < g4; ) b4[c4] = 128 | f4 >> 6 * (g4 - 1) & 63, c4++, g4--;
}
d4++;
}
return c4;
}
function U4(a3) {
var b4 = Math.floor(a3);
a3 -= b4;
return 0.5 > a3 ? b4 : 0.5 < a3 ? b4 + 1 : b4 % 2 ? b4 + 1 : b4;
}
function G4(a3, b4, c4) {
c4 = void 0 === c4 ? a3.length : c4;
var d4 = void 0 === b4 ? 0 : b4;
c4 = void 0 === c4 ? a3.length : c4;
b4 = "";
for (d4 = void 0 === d4 ? 0 : d4; d4 < c4; ) {
var e3 = 128, f4 = 191, g4 = false, k5 = a3[d4++];
if (0 <= k5 && 127 >= k5) b4 += String.fromCharCode(k5);
else {
var r3 = 0;
194 <= k5 && 223 >= k5 ? r3 = 1 : 224 <= k5 && 239 >= k5 ? (r3 = 2, 224 === a3[d4] && (e3 = 160), 237 === a3[d4] && (f4 = 159)) : 240 <= k5 && 244 >= k5 ? (r3 = 3, 240 === a3[d4] && (e3 = 144), 244 === a3[d4] && (f4 = 143)) : g4 = true;
k5 &= (1 << 8 - r3 - 1) - 1;
for (var z4 = 0; z4 < r3; z4++) {
if (a3[d4] < e3 || a3[d4] > f4) g4 = true;
k5 = k5 << 6 | a3[d4] & 63;
d4++;
}
g4 ? b4 += String.fromCharCode(65533) : 65535 >= k5 ? b4 += String.fromCharCode(k5) : (k5 -= 65536, b4 += String.fromCharCode((k5 >> 10 & 1023) + 55296, (k5 & 1023) + 56320));
}
}
return b4;
}
function x3(a3) {
var b4 = [];
T3(a3, b4);
return b4;
}
function L3(a3, b4, c4, d4) {
d4 = void 0 === d4 ? 0 : d4;
b4 = b4 || {};
for (var e3 = ea2(b4.h, b4.R, b4.O), f4 = Math.ceil(b4.h / 8), g4 = 0, k5 = d4, r3 = a3.length; g4 < r3; g4++) d4 = e3.ga(c4, a3[g4], d4);
b4.o && da2(c4, f4, k5, d4);
return d4;
}
function E3(a3, b4, c4, d4, e3) {
d4 = void 0 === d4 ? 0 : d4;
e3 = void 0 === e3 ? a3.length : e3;
b4 = b4 || {};
var f4 = ea2(b4.h, b4.R, b4.O);
e3 -= (e3 - d4) % f4.offset;
b4.o ? (a3 = new Uint8Array(a3), b4.o && da2(a3, f4.offset, d4, e3), fa2(a3, c4, d4, e3, f4)) : fa2(a3, c4, d4, e3, f4);
}
function h4(a3, b4) {
var c4 = [];
L3([a3], b4, c4, 0);
return c4;
}
function M5(a3, b4, c4) {
c4 = void 0 === c4 ? 0 : c4;
var d4 = [];
E3(a3, b4, d4, c4, c4 + Math.ceil(b4.h / 8));
return d4[0];
}
function fa2(a3, b4, c4, d4, e3) {
for (var f4 = e3.offset, g4 = 0; c4 < d4; c4 += f4, g4++) b4[g4] = e3.S(a3, c4);
}
function ea2(a3, b4, c4) {
return b4 && 32 == a3 ? new H3(
8,
23
) : b4 && 64 == a3 ? new H3(11, 52) : new F5(a3, c4);
}
function A4(a3, b4) {
for (var c4 = x3(a3), d4 = c4.length; d4 < b4; d4++) c4.push(0);
return c4;
}
function qa3(a3) {
return Math.exp(-a3 / 2 * a3 / 2);
}
function pa2(a3) {
return function(b4) {
return (0 === b4 ? 1 : Math.sin(Math.PI * b4) / (Math.PI * b4)) * a3(b4);
};
}
function ha2(a3, b4, c4, d4) {
d4 = (void 0 === d4 ? null : d4) || {};
var e3 = new Float64Array(a3.length * ((c4 - b4) / b4 + 1));
d4.method = d4.method || "cubic";
var f4 = new v4(a3.length, e3.length, { method: d4.method, tension: d4.tension || 0, sincFilterSize: d4.sincFilterSize || 6, sincWindow: d4.sincWindow || void 0, clip: d4.clip || "mirror" });
void 0 === d4.LPF && (d4.LPF = Ha3[d4.method]);
if (d4.LPF) {
d4.LPFType = d4.LPFType || "IIR";
var g4 = Ia2[d4.LPFType];
if (c4 > b4) {
b4 = new g4(d4.LPForder || ia2[d4.LPFType], c4, b4 / 2);
c4 = 0;
for (d4 = e3.length; c4 < d4; c4++) e3[c4] = b4.filter(f4.M(c4, a3));
b4.reset();
for (a3 = e3.length - 1; 0 <= a3; a3--) e3[a3] = b4.filter(e3[a3]);
} else {
b4 = new g4(d4.LPForder || ia2[d4.LPFType], b4, c4 / 2);
c4 = 0;
for (d4 = a3.length; c4 < d4; c4++) a3[c4] = b4.filter(a3[c4]);
b4.reset();
for (c4 = a3.length - 1; 0 <= c4; c4--) a3[c4] = b4.filter(a3[c4]);
ja3(a3, e3, f4);
}
} else ja3(a3, e3, f4);
return e3;
}
function ja3(a3, b4, c4) {
for (var d4 = 0, e3 = b4.length; d4 < e3; d4++) b4[d4] = c4.M(
d4,
a3
);
}
function J4(a3, b4) {
var c4 = a3 / b4;
c4 % 2 && c4++;
return c4;
}
var ca2 = [-1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8], R3 = [7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767], Ba3 = [
1,
1,
2,
2,
3,
3,
3,
3,
4,
4,
4,
4,
4,
4,
4,
4,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7
], Ea2 = [
0,
0,
1,
1,
2,
2,
2,
2,
3,
3,
3,
3,
3,
3,
3,
3,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7
], Ga3 = [0, 132, 396, 924, 1980, 4092, 8316, 16764];
F5.prototype.ga = function(a3, b4, c4) {
c4 = void 0 === c4 ? 0 : c4;
b4 = this.b(Math.round(b4));
for (var d4 = 0, e3 = this.offset; d4 < e3; d4++) a3[c4] = Math.floor(b4 / Math.pow(2, 8 * d4)) & 255, c4++;
return c4;
};
F5.prototype.a = function(a3, b4) {
b4 = void 0 === b4 ? 0 : b4;
for (var c4 = 0, d4 = 0; d4 < this.offset; d4++) c4 += a3[b4 + d4] * Math.pow(256, d4);
return c4;
};
F5.prototype.f = function(a3, b4) {
return this.c(this.a(a3, void 0 === b4 ? 0 : b4));
};
F5.prototype.b = function(a3) {
return a3 > this.max ? this.max : a3 < this.min ? this.min : a3;
};
F5.prototype.c = function(a3) {
a3 > this.max && (a3 -= 2 * this.max + 2);
return a3;
};
H3.prototype.ga = function(a3, b4, c4) {
Math.abs(b4) > this.f - 2 * this.g && (b4 = 0 > b4 ? -Infinity : Infinity);
var d4 = 0 > ((b4 = +b4) || 1 / b4) ? 1 : 0 > b4 ? 1 : 0;
b4 = Math.abs(b4);
var e3 = Math.min(Math.floor(Math.log(b4) / Math.LN2), 1023), f4 = U4(b4 / Math.pow(2, e3) * Math.pow(2, this.c));
b4 !== b4 ? (f4 = Math.pow(2, this.c - 1), e3 = (1 << this.b) - 1) : 0 !== b4 && (b4 >= Math.pow(2, 1 - this.a) ? (2 <= f4 / Math.pow(2, this.c) && (e3 += 1, f4 = 1), e3 > this.a ? (e3 = (1 << this.b) - 1, f4 = 0) : (e3 += this.a, f4 = U4(f4) - Math.pow(2, this.c))) : (f4 = U4(b4 / Math.pow(2, 1 - this.a - this.c)), e3 = 0));
return this.l(a3, c4, d4, e3, f4);
};
H3.prototype.S = function(a3, b4) {
for (var c4 = (1 << this.b) - 1, d4 = "", e3 = this.offset - 1; 0 <= e3; e3--) {
var f4 = a3[e3 + b4].toString(2);
d4 += "00000000".substring(f4.length) + f4;
}
e3 = "1" == d4.charAt(0) ? -1 : 1;
d4 = d4.substring(1);
f4 = parseInt(d4.substring(0, this.b), 2);
d4 = d4.substring(this.b);
if (f4 == c4) return 0 !== parseInt(d4, 2) ? NaN : Infinity * e3;
0 === f4 ? (f4 += 1, c4 = parseInt(d4, 2)) : c4 = parseInt("1" + d4, 2);
return e3 * c4 * this.j * Math.pow(2, f4 - this.a);
};
H3.prototype.l = function(a3, b4, c4, d4, e3) {
var f4 = [];
f4.push(c4);
for (c4 = this.b; 0 < c4; --c4) f4[c4] = d4 % 2 ? 1 : 0, d4 = Math.floor(d4 / 2);
d4 = f4.length;
for (c4 = this.c; 0 < c4; --c4) f4[d4 + c4] = e3 % 2 ? 1 : 0, e3 = Math.floor(e3 / 2);
e3 = f4.join("");
f4 = this.offset + b4 - 1;
for (d4 = b4; f4 >= b4; ) a3[f4] = parseInt(e3.substring(0, 8), 2), e3 = e3.substring(8), f4--, d4++;
return d4;
};
B3.prototype.va = function(a3) {
this.c = 0;
this.container = this.u(a3, 4);
if (-1 === this.Z.indexOf(this.container)) throw Error("Not a supported format.");
this.a.o = "RIFX" === this.container;
this.chunkSize = this.b(a3);
this.format = this.u(a3, 4);
this.Y = { chunkId: this.container, chunkSize: this.chunkSize, format: this.format, subChunks: this.V(a3) };
};
B3.prototype.s = function(a3, b4) {
b4 = void 0 === b4 ? false : b4;
for (var c4 = this.Y.subChunks, d4 = [], e3 = 0; e3 < c4.length; e3++) if (c4[e3].chunkId == a3) if (b4) d4.push(c4[e3]);
else return c4[e3];
return "LIST" == a3 ? d4.length ? d4 : null : null;
};
B3.prototype.u = function(a3, b4) {
var c4 = G4(a3, this.c, this.c + b4);
this.c += b4;
return c4;
};
B3.prototype.b = function(a3) {
a3 = M5(a3, this.a, this.c);
this.c += 4;
return a3;
};
B3.prototype.V = function(a3) {
for (var b4 = [], c4 = this.c; c4 <= a3.length - 8; ) b4.push(this.$a(a3, c4)), c4 += 8 + b4[b4.length - 1].chunkSize, c4 = c4 % 2 ? c4 + 1 : c4;
return b4;
};
B3.prototype.$a = function(a3, b4) {
var c4 = { chunkId: this.Ea(a3, b4), chunkSize: this.Fa(a3, b4) };
"LIST" == c4.chunkId ? (c4.format = G4(a3, b4 + 8, b4 + 12), this.c += 4, c4.subChunks = this.V(a3)) : (this.c = b4 + 8 + (c4.chunkSize % 2 ? c4.chunkSize + 1 : c4.chunkSize), c4.chunkData = { start: b4 + 8, end: this.c });
return c4;
};
B3.prototype.Ea = function(a3, b4) {
this.c += 4;
return G4(a3, b4, b4 + 4);
};
B3.prototype.Fa = function(a3, b4) {
this.c += 4;
return M5(
a3,
this.a,
b4 + 4
);
};
P4(u5, B3);
u5.prototype.fromBuffer = function(a3, b4) {
b4 = void 0 === b4 ? true : b4;
this.U();
this.va(a3);
this.g.o = this.a.o;
if ("WAVE" != this.format) throw Error('Could not find the "WAVE" format identifier');
this.hb(a3);
this.jb(a3);
this.ib(a3);
this.eb(a3);
this.qa(a3);
this.fb(a3);
this.ma(a3);
this.gb(a3, b4);
this.lb(a3);
this.ia(a3);
this.na(a3);
};
u5.prototype.U = function() {
var a3 = new u5();
Object.assign(this.fmt, a3.fmt);
Object.assign(this.fact, a3.fact);
Object.assign(this.cue, a3.cue);
Object.assign(this.smpl, a3.smpl);
Object.assign(this.bext, a3.bext);
Object.assign(this.iXML, a3.iXML);
Object.assign(this.ds64, a3.ds64);
Object.assign(this.data, a3.data);
this.LIST = [];
Object.assign(this.junk, a3.junk);
Object.assign(this._PMX, a3._PMX);
};
u5.prototype.jb = function(a3) {
var b4 = this.s("fmt ");
if (b4) this.c = b4.chunkData.start, this.fmt.chunkId = b4.chunkId, this.fmt.chunkSize = b4.chunkSize, this.fmt.audioFormat = this.j(a3), this.fmt.numChannels = this.j(a3), this.fmt.sampleRate = this.b(a3), this.fmt.byteRate = this.b(a3), this.fmt.blockAlign = this.j(a3), this.fmt.bitsPerSample = this.j(a3), this.kb(a3);
else throw Error('Could not find the "fmt " chunk');
};
u5.prototype.kb = function(a3) {
16 < this.fmt.chunkSize && (this.fmt.cbSize = this.j(a3), 18 < this.fmt.chunkSize && (this.fmt.validBitsPerSample = this.j(a3), 20 < this.fmt.chunkSize && (this.fmt.dwChannelMask = this.b(a3), this.fmt.subformat = [this.b(a3), this.b(a3), this.b(a3), this.b(a3)])));
};
u5.prototype.ib = function(a3) {
var b4 = this.s("fact");
b4 && (this.c = b4.chunkData.start, this.fact.chunkId = b4.chunkId, this.fact.chunkSize = b4.chunkSize, this.fact.dwSampleLength = this.b(a3));
};
u5.prototype.fb = function(a3) {
var b4 = this.s("cue ");
if (b4) for (this.c = b4.chunkData.start, this.cue.chunkId = b4.chunkId, this.cue.chunkSize = b4.chunkSize, this.cue.dwCuePoints = this.b(a3), b4 = 0; b4 < this.cue.dwCuePoints; b4++) this.cue.points.push({ dwName: this.b(a3), dwPosition: this.b(a3), fccChunk: this.u(a3, 4), dwChunkStart: this.b(a3), dwBlockStart: this.b(a3), dwSampleOffset: this.b(a3) });
};
u5.prototype.ma = function(a3) {
var b4 = this.s("smpl");
if (b4) for (this.c = b4.chunkData.start, this.smpl.chunkId = b4.chunkId, this.smpl.chunkSize = b4.chunkSize, this.smpl.dwManufacturer = this.b(a3), this.smpl.dwProduct = this.b(a3), this.smpl.dwSamplePeriod = this.b(a3), this.smpl.dwMIDIUnityNote = this.b(a3), this.smpl.dwMIDIPitchFraction = this.b(a3), this.smpl.dwSMPTEFormat = this.b(a3), this.smpl.dwSMPTEOffset = this.b(a3), this.smpl.dwNumSampleLoops = this.b(a3), this.smpl.dwSamplerData = this.b(a3), b4 = 0; b4 < this.smpl.dwNumSampleLoops; b4++) this.smpl.loops.push({ dwName: this.b(a3), dwType: this.b(a3), dwStart: this.b(a3), dwEnd: this.b(a3), dwFraction: this.b(a3), dwPlayCount: this.b(a3) });
};
u5.prototype.gb = function(a3, b4) {
var c4 = this.s("data");
if (c4) this.data.chunkId = "data", this.data.chunkSize = c4.chunkSize, b4 && (this.data.samples = a3.slice(c4.chunkData.start, c4.chunkData.end));
else throw Error('Could not find the "data" chunk');
};
u5.prototype.eb = function(a3) {
var b4 = this.s("bext");
b4 && (this.c = b4.chunkData.start, this.bext.chunkId = b4.chunkId, this.bext.chunkSize = b4.chunkSize, this.bext.description = this.u(a3, 256), this.bext.originator = this.u(a3, 32), this.bext.originatorReference = this.u(a3, 32), this.bext.originationDate = this.u(a3, 10), this.bext.originationTime = this.u(
a3,
8
), this.bext.timeReference = [this.b(a3), this.b(a3)], this.bext.version = this.j(a3), this.bext.UMID = this.u(a3, 64), this.bext.loudnessValue = this.j(a3), this.bext.loudnessRange = this.j(a3), this.bext.maxTruePeakLevel = this.j(a3), this.bext.maxMomentaryLoudness = this.j(a3), this.bext.maxShortTermLoudness = this.j(a3), this.bext.reserved = this.u(a3, 180), this.bext.codingHistory = this.u(a3, this.bext.chunkSize - 602));
};
u5.prototype.qa = function(a3) {
var b4 = this.s("iXML");
b4 && (this.c = b4.chunkData.start, this.iXML.chunkId = b4.chunkId, this.iXML.chunkSize = b4.chunkSize, this.iXML.value = G4(a3, this.c, this.c + this.iXML.chunkSize));
};
u5.prototype.hb = function(a3) {
var b4 = this.s("ds64");
if (b4) this.c = b4.chunkData.start, this.ds64.chunkId = b4.chunkId, this.ds64.chunkSize = b4.chunkSize, this.ds64.riffSizeHigh = this.b(a3), this.ds64.riffSizeLow = this.b(a3), this.ds64.dataSizeHigh = this.b(a3), this.ds64.dataSizeLow = this.b(a3), this.ds64.originationTime = this.b(a3), this.ds64.sampleCountHigh = this.b(a3), this.ds64.sampleCountLow = this.b(a3);
else if ("RF64" == this.container) throw Error('Could not find the "ds64" chunk');
};
u5.prototype.ia = function(a3) {
var b4 = this.s("LIST", true);
if (null !== b4) for (var c4 = 0; c4 < b4.length; c4++) {
var d4 = b4[c4];
this.LIST.push({ chunkId: d4.chunkId, chunkSize: d4.chunkSize, format: d4.format, subChunks: [] });
for (var e3 = 0; e3 < d4.subChunks.length; e3++) this.ka(d4.subChunks[e3], d4.format, a3);
}
};
u5.prototype.ka = function(a3, b4, c4) {
"adtl" == b4 ? -1 < ["labl", "note", "ltxt"].indexOf(a3.chunkId) && this.la(c4, a3) : "INFO" == b4 && this.ja(c4, a3);
};
u5.prototype.la = function(a3, b4) {
this.c = b4.chunkData.start;
var c4 = { chunkId: b4.chunkId, chunkSize: b4.chunkSize, dwName: this.b(a3) };
"ltxt" == b4.chunkId ? (c4.dwSampleLength = this.b(a3), c4.dwPurposeID = this.b(a3), c4.dwCountry = this.j(a3), c4.dwLanguage = this.j(a3), c4.dwDialect = this.j(a3), c4.dwCodePage = this.j(a3), c4.value = "") : c4.value = this.X(a3, this.c);
this.LIST[this.LIST.length - 1].subChunks.push(c4);
};
u5.prototype.ja = function(a3, b4) {
this.c = b4.chunkData.start;
this.LIST[this.LIST.length - 1].subChunks.push({ chunkId: b4.chunkId, chunkSize: b4.chunkSize, value: this.X(a3, this.c) });
};
u5.prototype.lb = function(a3) {
var b4 = this.s("junk");
b4 && (this.junk = {
chunkId: b4.chunkId,
chunkSize: b4.chunkSize,
chunkData: [].slice.call(a3.slice(b4.chunkData.start, b4.chunkData.end))
});
};
u5.prototype.na = function(a3) {
var b4 = this.s("_PMX");
b4 && (this.c = b4.chunkData.start, this._PMX.chunkId = b4.chunkId, this._PMX.chunkSize = b4.chunkSize, this._PMX.value = G4(a3, this.c, this.c + this._PMX.chunkSize));
};
u5.prototype.X = function(a3, b4) {
for (var c4 = b4 = void 0 === b4 ? 0 : b4; c4 < a3.length && (this.c++, 0 !== a3[c4]); c4++) ;
return G4(a3, b4, this.c - 1);
};
u5.prototype.j = function(a3) {
a3 = M5(a3, this.g, this.c);
this.c += 2;
return a3;
};
P4(q3, u5);
q3.prototype.toBuffer = function() {
this.g.o = "RIFX" === this.container;
this.a.o = this.g.o;
for (var a3 = [this.Sa(), this.Oa(), this.Da(), this.bb(), this.Qa(), this.Pa(), x3(this.data.chunkId), h4(this.data.samples.length, this.a), this.data.samples, this.Ga(), this.Ya(), this.Ta(), this.ab()], b4 = 0, c4 = 0; c4 < a3.length; c4++) b4 += a3[c4].length;
c4 = new Uint8Array(b4 + 12);
var d4 = T3(this.container, c4, 0);
d4 = L3([b4 + 4], this.a, c4, void 0 === d4 ? 0 : d4);
d4 = T3(this.format, c4, void 0 === d4 ? 0 : d4);
for (b4 = 0; b4 < a3.length; b4++) c4.set(a3[b4], d4), d4 += a3[b4].length;
return c4;
};
q3.prototype.Da = function() {
var a3 = [];
this.Ca();
this.bext.chunkId && (this.bext.chunkSize = 602 + this.bext.codingHistory.length, a3 = a3.concat(x3(this.bext.chunkId), h4(602 + this.bext.codingHistory.length, this.a), A4(this.bext.description, 256), A4(this.bext.originator, 32), A4(this.bext.originatorReference, 32), A4(this.bext.originationDate, 10), A4(this.bext.originationTime, 8), h4(this.bext.timeReference[0], this.a), h4(this.bext.timeReference[1], this.a), h4(this.bext.version, this.g), A4(this.bext.UMID, 64), h4(this.bext.loudnessValue, this.g), h4(this.bext.loudnessRange, this.g), h4(
this.bext.maxTruePeakLevel,
this.g
), h4(this.bext.maxMomentaryLoudness, this.g), h4(this.bext.maxShortTermLoudness, this.g), A4(this.bext.reserved, 180), A4(this.bext.codingHistory, this.bext.codingHistory.length)));
this.l(a3);
return a3;
};
q3.prototype.Ca = function() {
for (var a3 in this.bext) if (this.bext.hasOwnProperty(a3) && this.bext[a3] && "timeReference" != a3) {
this.bext.chunkId = "bext";
break;
}
if (this.bext.timeReference[0] || this.bext.timeReference[1]) this.bext.chunkId = "bext";
};
q3.prototype.bb = function() {
var a3 = [];
if (this.iXML.chunkId) {
var b4 = x3(this.iXML.value);
this.iXML.chunkSize = b4.length;
a3 = a3.concat(x3(this.iXML.chunkId), h4(this.iXML.chunkSize, this.a), b4);
}
this.l(a3);
return a3;
};
q3.prototype.Oa = function() {
var a3 = [];
this.ds64.chunkId && (a3 = a3.concat(x3(this.ds64.chunkId), h4(this.ds64.chunkSize, this.a), h4(this.ds64.riffSizeHigh, this.a), h4(this.ds64.riffSizeLow, this.a), h4(this.ds64.dataSizeHigh, this.a), h4(this.ds64.dataSizeLow, this.a), h4(this.ds64.originationTime, this.a), h4(this.ds64.sampleCountHigh, this.a), h4(this.ds64.sampleCountLow, this.a)));
this.l(a3);
return a3;
};
q3.prototype.Ga = function() {
var a3 = [];
if (this.cue.chunkId) {
var b4 = this.Ja();
a3 = a3.concat(x3(this.cue.chunkId), h4(b4.length + 4, this.a), h4(this.cue.dwCuePoints, this.a), b4);
}
this.l(a3);
return a3;
};
q3.prototype.Ja = function() {
for (var a3 = [], b4 = 0; b4 < this.cue.dwCuePoints; b4++) a3 = a3.concat(h4(this.cue.points[b4].dwName, this.a), h4(this.cue.points[b4].dwPosition, this.a), x3(this.cue.points[b4].fccChunk), h4(this.cue.points[b4].dwChunkStart, this.a), h4(this.cue.points[b4].dwBlockStart, this.a), h4(this.cue.points[b4].dwSampleOffset, this.a));
return a3;
};
q3.prototype.Ya = function() {
var a3 = [];
if (this.smpl.chunkId) {
var b4 = this.Za();
a3 = a3.concat(x3(this.smpl.chunkId), h4(b4.length + 36, this.a), h4(this.smpl.dwManufacturer, this.a), h4(this.smpl.dwProduct, this.a), h4(this.smpl.dwSamplePeriod, this.a), h4(this.smpl.dwMIDIUnityNote, this.a), h4(this.smpl.dwMIDIPitchFraction, this.a), h4(this.smpl.dwSMPTEFormat, this.a), h4(this.smpl.dwSMPTEOffset, this.a), h4(this.smpl.dwNumSampleLoops, this.a), h4(this.smpl.dwSamplerData, this.a), b4);
}
this.l(a3);
return a3;
};
q3.prototype.Za = function() {
for (var a3 = [], b4 = 0; b4 < this.smpl.dwNumSampleLoops; b4++) a3 = a3.concat(h4(this.smpl.loops[b4].dwName, this.a), h4(this.smpl.loops[b4].dwType, this.a), h4(this.smpl.loops[b4].dwStart, this.a), h4(this.smpl.loops[b4].dwEnd, this.a), h4(this.smpl.loops[b4].dwFraction, this.a), h4(this.smpl.loops[b4].dwPlayCount, this.a));
return a3;
};
q3.prototype.Pa = function() {
var a3 = [];
this.fact.chunkId && (a3 = a3.concat(x3(this.fact.chunkId), h4(this.fact.chunkSize, this.a), h4(this.fact.dwSampleLength, this.a)));
this.l(a3);
return a3;
};
q3.prototype.Qa = function() {
var a3 = [];
if (this.fmt.chunkId) return a3 = a3.concat(
x3(this.fmt.chunkId),
h4(this.fmt.chunkSize, this.a),
h4(this.fmt.audioFormat, this.g),
h4(this.fmt.numChannels, this.g),
h4(this.fmt.sampleRate, this.a),
h4(this.fmt.byteRate, this.a),
h4(this.fmt.blockAlign, this.g),
h4(this.fmt.bitsPerSample, this.g),
this.Ra()
), this.l(a3), a3;
throw Error('Could not find the "fmt " chunk');
};
q3.prototype.Ra = function() {
var a3 = [];
16 < this.fmt.chunkSize && (a3 = a3.concat(h4(this.fmt.cbSize, this.g)));
18 < this.fmt.chunkSize && (a3 = a3.concat(h4(this.fmt.validBitsPerSample, this.g)));
20 < this.fmt.chunkSize && (a3 = a3.concat(h4(
this.fmt.dwChannelMask,
this.a
)));
24 < this.fmt.chunkSize && (a3 = a3.concat(h4(this.fmt.subformat[0], this.a), h4(this.fmt.subformat[1], this.a), h4(this.fmt.subformat[2], this.a), h4(this.fmt.subformat[3], this.a)));
return a3;
};
q3.prototype.Ta = function() {
for (var a3 = [], b4 = 0; b4 < this.LIST.length; b4++) {
var c4 = this.Va(this.LIST[b4].subChunks, this.LIST[b4].format);
a3 = a3.concat(x3(this.LIST[b4].chunkId), h4(c4.length + 4, this.a), x3(this.LIST[b4].format), c4);
}
this.l(a3);
return a3;
};
q3.prototype.Va = function(a3, b4) {
for (var c4 = [], d4 = 0, e3 = a3.length; d4 < e3; d4++) "INFO" == b4 ? c4 = c4.concat(this.Ua(a3[d4])) : "adtl" == b4 && (c4 = c4.concat(this.Wa(a3[d4]))), this.l(c4);
return c4;
};
q3.prototype.Ua = function(a3) {
var b4 = [], c4 = A4(a3.value, a3.value.length);
b4 = b4.concat(x3(a3.chunkId), h4(c4.length + 1, this.a), c4)