{"version":3,"sources":["webpack:///../WCC.UI/App/components/audioRecorder/audioRecorder.html?19b7","webpack:///../WCC.UI/App/components/audioRecorder/audioRecorder.scss?e988","webpack:///../WCC.UI/App/components/audioRecorder/audioRecorder.ts","webpack:///../WCC.UI/App/helpers/audio.ts","webpack:///../WCC.UI/App/managers/opus.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/audioRecorder/audioRecorder.scss","webpack:///../WCC.UI/node_modules/detect-browser/index.js","webpack:///../WCC.UI/node_modules/event-target-shim/dist/event-target-shim.js","webpack:///../WCC.UI/App/components/audioRecorder/audioRecorder.html","webpack:///../WCC.UI/node_modules/opus-media-recorder/OggOpusEncoder.wasm","webpack:///../WCC.UI/node_modules/opus-media-recorder/OpusMediaRecorder.js","webpack:///../WCC.UI/node_modules/opus-media-recorder/WebMOpusEncoder.wasm","webpack:///../WCC.UI/node_modules/opus-media-recorder/encoderWorker.js"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","AudioRecorderVM","constructor","config","info","effects","recoder","OpusMediaRecorderManager","recording","ko","observable","labels","audio","isRecording","isFinalizing","toggleRecording","this","isStateChangeBlocked","toggle","reset","async","activeRecording","undefined","finalize","recordingDuration","pluck","_recording$endedOn","moment","endedOn","settings","now","diff","startedOn","duration","DateHelpers","formatSeconds","isBusy","pureComputed","register","subscribe","onStateChange","subscribeNotNull","onRecorded","blob","name","Date","applyBindingsToNode","element","startRecording","ex","system","handleError","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","convertWAVToMP3","lamejs","audioData","arrayBuffer","wav","WavHeader","readHeader","DataView","samples","Int16Array","dataOffset","dataLen","channels","sampleRate","buffer","mp3enc","Mp3Encoder","remaining","length","mono","subarray","mp3buf","encodeBuffer","push","Int8Array","d","flush","Blob","type","encodeMono","MediaRecorder","require","EncoderWorker","OggOpusWasm","WebMOpusWasm","mimeType","workerOptions","encoderWorkerFactory","OggOpusEncoderWasmPath","WebMOpusEncoderWasmPath","OpusMediaRecording","recorder","start","result","Promise","resolve","reject","addEventListener","e","data","stop","stream","getTracks","forEach","navigator","mediaDevices","getUserMedia","SystemHelpers","html","getTemplatesAndResources","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___","__spreadArrays","s","il","arguments","r","Array","k","a","j","jl","Object","defineProperty","value","BrowserInfo","version","os","NodeInfo","process","platform","BotInfo","bot","userAgentRules","operatingSystemRules","parseUserAgent","ua","matchedRule","reduce","matched","_a","browser","regex","uaMatch","exec","match","versionParts","split","slice","count","output","ii","createVersionParts","join","detectOS","test","getNodeVersion","detect","userAgent","privateData","WeakMap","wrappers","pd","event","retv","get","console","assert","Event","eventTarget","set","eventPhase","currentTarget","canceled","stopped","passiveListener","timeStamp","enumerable","keys","key","defineRedirectDescriptor","configurable","defineCallDescriptor","apply","getWrapper","proto","prototype","wrapper","BaseEvent","CustomEvent","call","create","writable","isFunc","getOwnPropertyDescriptor","defineWrapper","getPrototypeOf","isStopped","setPassiveListener","stopPropagation","stopImmediatePropagation","Boolean","bubbles","cancelable","preventDefault","warn","composed","window","setPrototypeOf","listenersMap","isObject","x","getListeners","listeners","TypeError","defineEventAttribute","eventTargetPrototype","eventName","listenerType","listener","next","prev","delete","newNode","passive","once","defineEventAttributeDescriptor","defineCustomEventTarget","eventNames","CustomEventTarget","EventTarget","isArray","types","Map","optionsIsObj","capture","wrappedEvent","wrapEvent","err","error","handleEvent","setEventPhase","setCurrentTarget","defaultPrevented","AudioContext","global","webkitAudioContext","OpusMediaRecorder","audioBitsPerSecond","videoBitsPerSecond","bitsPerSecond","super","_stream","_state","_mimeType","_audioBitsPerSecond","workerState","isTypeSupported","_parseType","subtype","_wasmPath","Error","workerDir","currentScript","src","self","location","href","substr","lastIndexOf","encoderWorker","URL","createObjectURL","_workerFactory","_","Worker","_spawnWorker","worker","onmessage","_onmessageFromWorker","onerror","_onerrorFromWorker","_postMessageToWorker","wasmPath","command","message","postMessage","channelCount","source","connect","processor","context","destination","eventToPush","dispatchEvent","channelBuffers","buffers","state","disconnect","terminate","filename","lineno","errorToPush","timeslice","elapsedTime","onaudioprocess","inputBuffer","playbackTime","numberOfChannels","getChannelData","Number","MAX_SAFE_INTEGER","tracks","getAudioTracks","getSettings","createMediaStreamSource","createScriptProcessor","_enableAudioProcessCallback","close","codec","original","transfer","Worker_fn"],"mappings":"+IAAA,UAAO,CACC,+GACA,wDAIC,KAJyC,EAAF,SAAYA,EAASC,GAGzD,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,4ECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,0JAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI1BF,EAAOG,QAAUR,EAAQS,QAAU,I,o2BCDnC,IAAqBC,EAArB,MAcIC,YACwCC,EACFC,EACNC,GAhBxB,KAAAC,QAAU,IAAIC,IACd,KAAAC,UAAYC,EAAGC,aAEvB,KAAAC,OAASA,EAET,KAAAC,MAAQH,EAAGC,aACX,KAAAG,YAAcJ,EAAGC,YAAW,GAC5B,KAAAI,aAAeL,EAAGC,YAAW,GA+B7B,KAAAK,gBAAkB,KACTC,KAAKC,wBACND,KAAKH,YAAYK,UAGzB,KAAAC,MAAQC,UACJ,IACI,MAAMC,EAAkBL,KAAKR,YAENc,MAAnBD,SACMA,EAAgBE,WAE5B,QACEP,KAAKJ,WAAMU,GACXN,KAAKR,eAAUc,GACfN,KAAKH,aAAY,KAnCrB,MAAMW,EAAoBR,KAAKR,UAAUiB,MAAMjB,IAAS,IAAAkB,EAAA,OAAIC,EAA0B,QAApBD,EAAClB,EAAUoB,iBAAS,IAAAF,IAAIG,EAASC,OAAOC,KAAKvB,EAAUwB,YAAa,OACtIhB,KAAKQ,kBAAoBA,EAAkBC,MA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,SACA,SACA5N,QAAQpE,GAAQuL,EAAqBgC,EAAkB7D,UAAW1J,IAKhE6G,GAA4B,SAAjBA,EAAQ7G,OAEfgS,EAAW7C,OAAOzF,UAAUoG,YAChCX,OAAOzF,UAAUoG,YAAc,SAAUD,EAASoC,EAAW,MAC3DD,EAASzI,MAAMnL,KAAM,CAACyR,MAK5B7S,EAAOG,QAAUoQ,I,yJCpjBjB,OAAe,cAA0B,gD,4ICA1B,SAAS2E,IACtB,OAAO,IAAI/C,OAAO,IAA0B,gDAD9C","file":"142.064ce1e93330a915d105.js","sourcesContent":["define([\n \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./audioRecorder.html\", \n \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./audioRecorder.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { wccModules } from 'enums/wccModules';\r\nimport { DateHelpers } from 'helpers/date';\r\nimport { BlobWrapper } from 'interfaces/blobWrapper';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Subscribable } from 'knockout';\r\nimport OpusMediaRecorderManager, { OpusMediaRecording } from 'managers/opus';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport './audioRecorder.html';\r\nimport './audioRecorder.scss';\r\n\r\nconst mininumRecordingDuration = 2;\r\n\r\nexport interface AudioRecorderVMConfig {\r\n onRecorded?: Action<[BlobWrapper]>\r\n}\r\n\r\n@injectable()\r\nexport default class AudioRecorderVM {\r\n private recoder = new OpusMediaRecorderManager();\r\n private recording = ko.observable();\r\n\r\n labels = labels;\r\n\r\n audio = ko.observable();\r\n isRecording = ko.observable(false);\r\n isFinalizing = ko.observable(false);\r\n \r\n recordingDuration: Subscribable\r\n isStateChangeBlocked: Subscribable\r\n isBusy: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) config: AudioRecorderVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.effects) effects: EffectsContainer\r\n ) {\r\n const recordingDuration = this.recording.pluck(recording => moment(recording.endedOn() ?? settings.now()).diff(recording.startedOn(), 's'));\r\n this.recordingDuration = recordingDuration.pluck(duration => DateHelpers.formatSeconds(duration), '00:00');\r\n this.isStateChangeBlocked = recordingDuration.pluck(duration => duration < mininumRecordingDuration, false);\r\n\r\n this.isBusy = ko.pureComputed(() => this.isFinalizing());\r\n\r\n effects.register([\r\n this.isRecording.subscribe(isRecording => this.onStateChange(isRecording)),\r\n this.audio.subscribeNotNull(audio => config.onRecorded?.({ blob: audio, name: `audio-recording-${Date.now()}.mp3` })),\r\n\r\n () => this.reset()\r\n ]);\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'css': {\r\n 'audio-recorder': true\r\n }\r\n });\r\n }\r\n\r\n toggleRecording = () => {\r\n if (!this.isStateChangeBlocked())\r\n this.isRecording.toggle();\r\n }\r\n\r\n reset = async () => {\r\n try {\r\n const activeRecording = this.recording();\r\n\r\n if (activeRecording != undefined) {\r\n await activeRecording.finalize();\r\n }\r\n } finally {\r\n this.audio(undefined);\r\n this.recording(undefined);\r\n this.isRecording(false);\r\n }\r\n }\r\n\r\n private async onStateChange(isRecording: boolean) {\r\n if (isRecording) {\r\n this.recording(await this.recoder.startRecording());\r\n } else {\r\n const recording = this.recording();\r\n\r\n if (recording != undefined) {\r\n try {\r\n this.isFinalizing(true);\r\n\r\n this.audio(await recording.finalize()); \r\n } catch (ex) {\r\n this.audio(undefined);\r\n system.handleError(ex);\r\n } finally {\r\n this.recording(undefined);\r\n this.isFinalizing(false); \r\n }\r\n }\r\n }\r\n }\r\n}","export async function convertWAVToMP3(blob: Blob) {\r\n const lamejs = await import('lamejs');\r\n const audioData = await blob.arrayBuffer();\r\n const wav = lamejs.WavHeader.readHeader(new DataView(audioData));\r\n const samples = new Int16Array(audioData, wav.dataOffset, wav.dataLen / 2);\r\n\r\n return await encodeMono(wav.channels, wav.sampleRate, samples);\r\n}\r\n\r\nasync function encodeMono(channels: number, sampleRate: number, samples: Int16Array) {\r\n const lamejs = await import('lamejs');\r\n\r\n const buffer = [];\r\n const mp3enc = new lamejs.Mp3Encoder(channels, sampleRate, 128);\r\n const maxSamples = 1152;\r\n\r\n let remaining = samples.length;\r\n\r\n for (var i = 0; remaining >= maxSamples; i += maxSamples) {\r\n const mono = samples.subarray(i, i + maxSamples);\r\n const mp3buf = mp3enc.encodeBuffer(mono);\r\n\r\n if (mp3buf.length > 0)\r\n buffer.push(new Int8Array(mp3buf));\r\n\r\n remaining -= maxSamples;\r\n }\r\n\r\n const d = mp3enc.flush();\r\n\r\n if (d.length > 0)\r\n buffer.push(new Int8Array(d));\r\n\r\n return new Blob(buffer, { type: 'audio/mp3' });\r\n}","import { convertWAVToMP3 } from 'helpers/audio';\r\n\r\nconst MediaRecorder = require('opus-media-recorder');\r\nconst EncoderWorker = require('worker-loader!opus-media-recorder/encoderWorker.js').default;\r\nconst OggOpusWasm = require('opus-media-recorder/OggOpusEncoder.wasm').default;\r\nconst WebMOpusWasm = require('opus-media-recorder/WebMOpusEncoder.wasm').default;\r\n\r\nconst options = { mimeType: 'audio/wav' }\r\n\r\nconst workerOptions = {\r\n encoderWorkerFactory: () => new EncoderWorker(),\r\n OggOpusEncoderWasmPath: OggOpusWasm,\r\n WebMOpusEncoderWasmPath: WebMOpusWasm\r\n};\r\n\r\nexport class OpusMediaRecording {\r\n private isRecording = true;\r\n\r\n startedOn = ko.observable(new Date());\r\n endedOn = ko.observable();\r\n\r\n result: Promise\r\n\r\n constructor(private recorder: MediaRecorder) {\r\n recorder.start();\r\n\r\n this.result = new Promise((resolve, reject) => {\r\n recorder.addEventListener('dataavailable', async e => {\r\n try {\r\n resolve(convertWAVToMP3(e.data));\r\n } catch (ex) {\r\n reject(ex);\r\n }\r\n });\r\n });\r\n }\r\n\r\n finalize() {\r\n if (this.isRecording) {\r\n this.isRecording = false;\r\n\r\n this.recorder.stop();\r\n this.endedOn(new Date());\r\n\r\n this.recorder.stream.getTracks().forEach(i => i.stop());\r\n }\r\n\r\n return this.result;\r\n }\r\n}\r\n\r\nexport default class OpusMediaRecorderManager {\r\n constructor() { }\r\n\r\n async startRecording() {\r\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\r\n const recorder = new MediaRecorder(stream, options, workerOptions);\r\n\r\n return new OpusMediaRecording(recorder);\r\n }\r\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".audio-recorder{display:block;width:600px;max-width:100vw;padding:15px;background-color:#f8f8f7;border:1px solid #c6c6c6;border-radius:4px}.audio-recorder__hint{margin-bottom:20px;padding:10px 0 10px 15px;border-left:4px solid #5ca2dd}.audio-recorder__controls{text-align:center}.audio-recorder__control{display:inline-flex;align-items:center;padding:15px;background-color:#5ca2dd;border-radius:30px;height:54px;min-width:120px;cursor:pointer}.audio-recorder__control__icon{position:relative;display:inline-flex;justify-content:center;align-items:center;width:46px;height:46px;margin:-10px 10px -10px -10px;background-color:#f8f8f7;border:1px solid #c6c6c6;border-radius:100%;font-size:24px;color:#5ca2dd}.audio-recorder__control__icon__content{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.audio-recorder__control__title{font-weight:bold;color:#f8f8f7}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","\"use strict\";\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BrowserInfo = /** @class */ (function () {\n function BrowserInfo(name, version, os) {\n this.name = name;\n this.version = version;\n this.os = os;\n }\n return BrowserInfo;\n}());\nexports.BrowserInfo = BrowserInfo;\nvar NodeInfo = /** @class */ (function () {\n function NodeInfo(version) {\n this.version = version;\n this.name = 'node';\n this.os = process.platform;\n }\n return NodeInfo;\n}());\nexports.NodeInfo = NodeInfo;\nvar BotInfo = /** @class */ (function () {\n function BotInfo() {\n this.bot = true; // NOTE: deprecated test name instead\n this.name = 'bot';\n this.version = null;\n this.os = null;\n }\n return BotInfo;\n}());\nexports.BotInfo = BotInfo;\n// tslint:disable-next-line:max-line-length\nvar SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;\nvar SEARCHBOT_OS_REGEX = /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\\/Teoma)|(ia_archiver)/;\nvar REQUIRED_VERSION_PARTS = 3;\nvar userAgentRules = [\n ['aol', /AOLShield\\/([0-9\\._]+)/],\n ['edge', /Edge\\/([0-9\\._]+)/],\n ['edge-ios', /EdgiOS\\/([0-9\\._]+)/],\n ['yandexbrowser', /YaBrowser\\/([0-9\\._]+)/],\n ['vivaldi', /Vivaldi\\/([0-9\\.]+)/],\n ['kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/],\n ['samsung', /SamsungBrowser\\/([0-9\\.]+)/],\n ['silk', /\\bSilk\\/([0-9._-]+)\\b/],\n ['miui', /MiuiBrowser\\/([0-9\\.]+)$/],\n ['beaker', /BeakerBrowser\\/([0-9\\.]+)/],\n ['edge-chromium', /Edg\\/([0-9\\.]+)/],\n [\n 'chromium-webview',\n /(?!Chrom.*OPR)wv\\).*Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/,\n ],\n ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/],\n ['phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/],\n ['crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/],\n ['firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/],\n ['fxios', /FxiOS\\/([0-9\\.]+)/],\n ['opera-mini', /Opera Mini.*Version\\/([0-9\\.]+)/],\n ['opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/],\n ['opera', /OPR\\/([0-9\\.]+)(:?\\s|$)/],\n ['ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/],\n ['ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/],\n ['ie', /MSIE\\s(7\\.0)/],\n ['bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/],\n ['android', /Android\\s([0-9\\.]+)/],\n ['ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/],\n ['safari', /Version\\/([0-9\\._]+).*Safari/],\n ['facebook', /FBAV\\/([0-9\\.]+)/],\n ['instagram', /Instagram\\s([0-9\\.]+)/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Mobile/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Gecko\\)$/],\n ['searchbot', SEARCHBOX_UA_REGEX],\n];\nvar operatingSystemRules = [\n ['iOS', /iP(hone|od|ad)/],\n ['Android OS', /Android/],\n ['BlackBerry OS', /BlackBerry|BB10/],\n ['Windows Mobile', /IEMobile/],\n ['Amazon OS', /Kindle/],\n ['Windows 3.11', /Win16/],\n ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],\n ['Windows 98', /(Windows 98)|(Win98)/],\n ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],\n ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],\n ['Windows Server 2003', /(Windows NT 5.2)/],\n ['Windows Vista', /(Windows NT 6.0)/],\n ['Windows 7', /(Windows NT 6.1)/],\n ['Windows 8', /(Windows NT 6.2)/],\n ['Windows 8.1', /(Windows NT 6.3)/],\n ['Windows 10', /(Windows NT 10.0)/],\n ['Windows ME', /Windows ME/],\n ['Open BSD', /OpenBSD/],\n ['Sun OS', /SunOS/],\n ['Chrome OS', /CrOS/],\n ['Linux', /(Linux)|(X11)/],\n ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],\n ['QNX', /QNX/],\n ['BeOS', /BeOS/],\n ['OS/2', /OS\\/2/],\n ['Search Bot', SEARCHBOT_OS_REGEX],\n];\nfunction detect(userAgent) {\n if (!!userAgent) {\n return parseUserAgent(userAgent);\n }\n if (typeof navigator !== 'undefined') {\n return parseUserAgent(navigator.userAgent);\n }\n return getNodeVersion();\n}\nexports.detect = detect;\nfunction parseUserAgent(ua) {\n // opted for using reduce here rather than Array#first with a regex.test call\n // this is primarily because using the reduce we only perform the regex\n // execution once rather than once for the test and for the exec again below\n // probably something that needs to be benchmarked though\n var matchedRule = ua !== '' &&\n userAgentRules.reduce(function (matched, _a) {\n var browser = _a[0], regex = _a[1];\n if (matched) {\n return matched;\n }\n var uaMatch = regex.exec(ua);\n return !!uaMatch && [browser, uaMatch];\n }, false);\n if (!matchedRule) {\n return null;\n }\n var name = matchedRule[0], match = matchedRule[1];\n if (name === 'searchbot') {\n return new BotInfo();\n }\n var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);\n if (versionParts) {\n if (versionParts.length < REQUIRED_VERSION_PARTS) {\n versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length));\n }\n }\n else {\n versionParts = [];\n }\n return new BrowserInfo(name, versionParts.join('.'), detectOS(ua));\n}\nexports.parseUserAgent = parseUserAgent;\nfunction detectOS(ua) {\n for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {\n var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];\n var match = regex.test(ua);\n if (match) {\n return os;\n }\n }\n return null;\n}\nexports.detectOS = detectOS;\nfunction getNodeVersion() {\n var isNode = typeof process !== 'undefined' && process.version;\n return isNode ? new NodeInfo(process.version.slice(1)) : null;\n}\nexports.getNodeVersion = getNodeVersion;\nfunction createVersionParts(count) {\n var output = [];\n for (var ii = 0; ii < count; ii++) {\n output.push('0');\n }\n return output;\n}\n","/**\n * @author Toru Nagashima \n * @copyright 2015 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\n'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap}\n * @private\n */\nconst privateData = new WeakMap();\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap}\n * @private\n */\nconst wrappers = new WeakMap();\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event);\n console.assert(retv != null, \"'this' is expected an Event object, but got\", event);\n return retv\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n });\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true });\n\n // Define accessors\n const keys = Object.keys(event);\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key));\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget;\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this);\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation();\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation();\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n const data = pd(this);\n if (data.passiveListener != null) {\n console.warn(\"Event#preventDefault() was called from a passive listener:\", data.passiveListener);\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true;\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault();\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", { value: Event, configurable: true, writable: true });\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype);\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event);\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value;\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event;\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto);\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event);\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n });\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n const isFunc = (typeof descriptor.value === \"function\");\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)\n );\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto);\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);\n wrappers.set(proto, wrapper);\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nfunction wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event));\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the stopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nfunction isStopped(event) {\n return pd(event).stopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nfunction setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase;\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nfunction setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget;\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nfunction setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener;\n}\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap>}\n * @private\n */\nconst listenersMap = new WeakMap();\n\n// Listener types\nconst CAPTURE = 1;\nconst BUBBLE = 2;\nconst ATTRIBUTE = 3;\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget);\n if (listeners == null) {\n throw new TypeError(\"'this' is expected an EventTarget object, but got another value.\")\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this);\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next;\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null; // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this);\n\n // Traverse to the tail while removing old value.\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next;\n }\n else if (node.next !== null) {\n listeners.set(eventName, node.next);\n }\n else {\n listeners.delete(eventName);\n }\n }\n else {\n prev = node;\n }\n\n node = node.next;\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n };\n if (prev === null) {\n listeners.set(eventName, newNode);\n }\n else {\n prev.next = newNode;\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(eventTargetPrototype, `on${eventName}`, defineEventAttributeDescriptor(eventName));\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this);\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: { value: CustomEventTarget, configurable: true, writable: true },\n });\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map());\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length);\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i];\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {boolean} `true` if the listener was added actually.\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return false\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this);\n const optionsIsObj = isObject(options);\n const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);\n const listenerType = (capture ? CAPTURE : BUBBLE);\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n };\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName);\n if (node === undefined) {\n listeners.set(eventName, newNode);\n return true\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null;\n while (node != null) {\n if (node.listener === listener && node.listenerType === listenerType) {\n // Should ignore duplication.\n return false\n }\n prev = node;\n node = node.next;\n }\n\n // Add it.\n prev.next = newNode;\n return true\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {boolean} `true` if the listener was removed actually.\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return false\n }\n\n const listeners = getListeners(this);\n const capture = isObject(options) ? Boolean(options.capture) : Boolean(options);\n const listenerType = (capture ? CAPTURE : BUBBLE);\n\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listener === listener && node.listenerType === listenerType) {\n if (prev !== null) {\n prev.next = node.next;\n }\n else if (node.next !== null) {\n listeners.set(eventName, node.next);\n }\n else {\n listeners.delete(eventName);\n }\n return true\n }\n\n prev = node;\n node = node.next;\n }\n\n return false\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) { //eslint-disable-line complexity\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError(\"\\\"event.type\\\" should be a string.\")\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this);\n const eventName = event.type;\n let node = listeners.get(eventName);\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event);\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null;\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next;\n }\n else if (node.next !== null) {\n listeners.set(eventName, node.next);\n }\n else {\n listeners.delete(eventName);\n }\n }\n else {\n prev = node;\n }\n\n // Call this listener\n setPassiveListener(wrappedEvent, (node.passive ? node.listener : null));\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent);\n }\n catch (err) {\n /*eslint-disable no-console */\n if (typeof console !== \"undefined\" && typeof console.error === \"function\") {\n console.error(err);\n }\n /*eslint-enable no-console */\n }\n }\n else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === \"function\") {\n node.listener.handleEvent(wrappedEvent);\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next;\n }\n setPassiveListener(wrappedEvent, null);\n setEventPhase(wrappedEvent, 0);\n setCurrentTarget(wrappedEvent, null);\n\n return !wrappedEvent.defaultPrevented\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", { value: EventTarget, configurable: true, writable: true });\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (typeof window !== \"undefined\" && typeof window.EventTarget !== \"undefined\") {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);\n}\n\nexports.defineEventAttribute = defineEventAttribute;\nexports.EventTarget = EventTarget;\nexports.default = EventTarget;\n\nmodule.exports = EventTarget\nmodule.exports.EventTarget = module.exports[\"default\"] = EventTarget\nmodule.exports.defineEventAttribute = defineEventAttribute\n//# sourceMappingURL=event-target-shim.js.map\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;","export default __webpack_public_path__ + \"assets/03ef6fb6d47a03caa37d3a87900fabeb.wasm\";","const { EventTarget, defineEventAttribute } = require('event-target-shim');\nconst { detect } = require('detect-browser');\nconst browser = detect();\n\nconst AudioContext = global.AudioContext || global.webkitAudioContext;\nconst BUFFER_SIZE = 4096;\n\n/**\n * Reference: https://w3c.github.io/mediacapture-record/#mediarecorder-api\n * @extends EventTarget\n */\nclass OpusMediaRecorder extends EventTarget {\n /**\n * A function that returns the encoder web worker\n * @name workerFactory\n * @function\n * @returns {worker} An instance of ./encoderWorker.js web worker.\n */\n\n /**\n *\n * @param {MediaStream} stream - The MediaStream to be recorded. This will\n * be the value of the stream attribute.\n * @param {MediaRecorderOptions} [options] - A dictionary of options to for\n * the UA instructing how the recording will take part.\n * options.mimeType, if present, will become the value of mimeType\n * attribute.\n * @param {Object} [workerOptions] This is a NON-STANDARD options to\n * configure how to import the web worker .wasm compiled binaries\n * used for encoding.\n * @param {workerFactory} [workerOptions.encoderWorkerFactory] A factory\n * function that create a web worker instance of ./encoderWorker.js\n * and returns it. function(){return new Worker('./encoderWorker.umd.js')}\n * is used by default. This is NON-STANDARD.\n * @param {string} [workerOptions.OggOpusEncoderWasmPath]\n * Path of ./OggOpusEncoder.wasm which is used for OGG Opus encoding\n * by the encoder worker. This is NON-STANDARD.\n * @param {string} [workerOptions.WebMOpusEncoderWasmPath]\n * Path of ./WebMOpusEncoder.wasm which is used for WebM Opus encoding\n * by the encoder worker. This is NON-STANDARD.\n */\n constructor (stream, options = {}, workerOptions = {}) {\n const { mimeType, audioBitsPerSecond, videoBitsPerSecond, bitsPerSecond } = options; // eslint-disable-line\n // NON-STANDARD options\n const { encoderWorkerFactory, OggOpusEncoderWasmPath, WebMOpusEncoderWasmPath } = workerOptions;\n\n super();\n // Attributes for the specification conformance. These have their own getters.\n this._stream = stream;\n this._state = 'inactive';\n this._mimeType = mimeType || '';\n this._audioBitsPerSecond = audioBitsPerSecond || bitsPerSecond;\n /** @type {'inactive'|'readyToInit'|'encoding'|'closed'} */\n this.workerState = 'inactive';\n\n // Parse MIME Type\n if (!OpusMediaRecorder.isTypeSupported(this._mimeType)) {\n throw new TypeError('invalid arguments, a MIME Type is not supported');\n }\n switch (OpusMediaRecorder._parseType(this._mimeType).subtype) {\n case 'wave':\n case 'wav':\n this._mimeType = 'audio/wave';\n break;\n\n case 'webm':\n this._mimeType = 'audio/webm';\n break;\n\n case 'ogg':\n this._mimeType = 'audio/ogg';\n break;\n\n default:\n // Select a type depending on OS.\n switch (browser && browser.name) {\n case 'chrome':\n this._mimeType = 'audio/webm';\n break;\n\n case 'firefox':\n this._mimeType = 'audio/ogg';\n break;\n\n case 'edge':\n this._mimeType = 'audio/webm';\n break;\n\n case 'ios':\n case 'safari':\n this._mimeType = 'audio/wave';\n break;\n\n default:\n this._mimeType = 'audio/webm';\n }\n }\n switch (this._mimeType) {\n case 'audio/wave':\n this._wasmPath = ''; // wasm is not used\n break;\n\n case 'audio/webm':\n this._wasmPath = WebMOpusEncoderWasmPath || '';\n break;\n\n case 'audio/ogg':\n this._wasmPath = OggOpusEncoderWasmPath || '';\n break;\n\n default:\n throw new Error(`Internal Error: Unexpected MIME Type: ${this._mimeType}`);\n }\n\n // Get current directory for worker\n let workerDir = '';\n if (document.currentScript) {\n workerDir = document.currentScript.src;\n } else if (self.location) {\n workerDir = self.location.href;\n }\n workerDir = workerDir.substr(0, workerDir.lastIndexOf('/')) +\n '/encoderWorker.umd.js';\n // If worker function is imported via