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B,GAAI,EACJ,OAAQ,MAEZ,GACC,CACD,IAAK,4BACL,MAAO,SAAmC,GACxC,KAAK,KAAK,YAAY,CACpB,MAAO,CACL,MAAO,MACP,QAAS,mEAEX,GAAI,GAER,GACC,CACD,IAAK,QACL,MAAO,SAAe,GACpB,EAAY,YAAY,IACxB,EAAY,QACZ,KAAK,aAAe,KACpB,KAAK,OAAS,SAChB,IAEJ,CAtHiD,CAsHlC,EAAiB,wBAChC,EAA8B,qBAAuB,GAErD,kBAAkB,mCAAoC,EAEzD","file":"/npm/recorder-audio-worklet-processor@5.0.40/build/es5/bundle.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/recorder-audio-worklet-processor@5.0.40/build/es5/bundle.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function (global, factory) {\n    typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('@babel/runtime/helpers/slicedToArray'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('@babel/runtime/helpers/inherits'), require('@babel/runtime/helpers/wrapNativeSuper')) :\n    typeof define === 'function' && define.amd ? define(['@babel/runtime/helpers/slicedToArray', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', '@babel/runtime/helpers/inherits', '@babel/runtime/helpers/wrapNativeSuper'], factory) :\n    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global._slicedToArray, global._classCallCheck, global._createClass, global._possibleConstructorReturn, global._getPrototypeOf, global._inherits, global._wrapNativeSuper));\n})(this, (function (_slicedToArray, _classCallCheck, _createClass, _possibleConstructorReturn, _getPrototypeOf, _inherits, _wrapNativeSuper) { 'use strict';\n\n    function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\n    function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\n    var RecorderAudioWorkletProcessor = /*#__PURE__*/function (_AudioWorkletProcesso) {\n      function RecorderAudioWorkletProcessor() {\n        var _this;\n        _classCallCheck(this, RecorderAudioWorkletProcessor);\n        _this = _callSuper(this, RecorderAudioWorkletProcessor);\n        _this._encoderPort = null;\n        _this._numberOfChannels = 0;\n        _this._state = 'inactive';\n        _this.port.onmessage = function (_ref) {\n          var data = _ref.data;\n          if (data.method === 'pause') {\n            if (_this._state === 'active' || _this._state === 'recording') {\n              _this._state = 'paused';\n              _this._sendAcknowledgement(data.id);\n            } else {\n              _this._sendUnexpectedStateError(data.id);\n            }\n          } else if (data.method === 'record') {\n            if (_this._state === 'inactive') {\n              _this._encoderPort = data.params.encoderPort;\n              _this._state = 'active';\n              _this._sendAcknowledgement(data.id);\n            } else {\n              _this._sendUnexpectedStateError(data.id);\n            }\n          } else if (data.method === 'resume') {\n            if (_this._state === 'paused') {\n              _this._state = 'active';\n              _this._sendAcknowledgement(data.id);\n            } else {\n              _this._sendUnexpectedStateError(data.id);\n            }\n          } else if (data.method === 'stop') {\n            if ((_this._state === 'active' || _this._state === 'paused' || _this._state === 'recording') && _this._encoderPort !== null) {\n              _this._stop(_this._encoderPort);\n              _this._sendAcknowledgement(data.id);\n            } else {\n              _this._sendUnexpectedStateError(data.id);\n            }\n          } else if (typeof data.id === 'number') {\n            _this.port.postMessage({\n              error: {\n                code: -32601,\n                message: 'The requested method is not supported.'\n              },\n              id: data.id\n            });\n          }\n        };\n        return _this;\n      }\n      _inherits(RecorderAudioWorkletProcessor, _AudioWorkletProcesso);\n      return _createClass(RecorderAudioWorkletProcessor, [{\n        key: \"process\",\n        value: function process(_ref2) {\n          var _ref3 = _slicedToArray(_ref2, 1),\n            input = _ref3[0];\n          if (this._state === 'inactive' || this._state === 'paused') {\n            return true;\n          }\n          if (this._state === 'active') {\n            if (input === undefined) {\n              throw new Error('No channelData was received for the first input.');\n            }\n            if (input.length === 0) {\n              return true;\n            }\n            this._state = 'recording';\n          }\n          if (this._state === 'recording' && this._encoderPort !== null) {\n            if (input === undefined) {\n              throw new Error('No channelData was received for the first input.');\n            }\n            if (input.length === 0) {\n              this._encoderPort.postMessage(Array.from({\n                length: this._numberOfChannels\n              }, function () {\n                return 128;\n              }));\n            } else {\n              this._encoderPort.postMessage(input, input.map(function (_ref4) {\n                var buffer = _ref4.buffer;\n                return buffer;\n              }));\n              this._numberOfChannels = input.length;\n            }\n            return true;\n          }\n          return false;\n        }\n      }, {\n        key: \"_sendAcknowledgement\",\n        value: function _sendAcknowledgement(id) {\n          this.port.postMessage({\n            id: id,\n            result: null\n          });\n        }\n      }, {\n        key: \"_sendUnexpectedStateError\",\n        value: function _sendUnexpectedStateError(id) {\n          this.port.postMessage({\n            error: {\n              code: -32603,\n              message: 'The internal state does not allow to process the given message.'\n            },\n            id: id\n          });\n        }\n      }, {\n        key: \"_stop\",\n        value: function _stop(encoderPort) {\n          encoderPort.postMessage([]);\n          encoderPort.close();\n          this._encoderPort = null;\n          this._state = 'stopped';\n        }\n      }]);\n    }(/*#__PURE__*/_wrapNativeSuper(AudioWorkletProcessor));\n    RecorderAudioWorkletProcessor.parameterDescriptors = [];\n\n    registerProcessor('recorder-audio-worklet-processor', RecorderAudioWorkletProcessor);\n\n}));\n"]}