diff --git a/.eslintrc.json b/.eslintrc.json index 84ec4503..2fe3da86 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,11 @@ { - "extends": "airbnb-base", - "plugins": [ - "import" - ], - "env": { - "browser": true, - "worker": true, - "es6": true - } + "extends": "airbnb-base", + "plugins": [ + "import" + ], + "env": { + "browser": true, + "worker": true, + "es6": true + } } diff --git a/.gitignore b/.gitignore index 5cfed66b..6c1e44f1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ /lib .sass-cache /styles + +#Ide files +.idea/* +.idea diff --git a/README.md b/README.md index 78b6b8e1..953258e0 100644 --- a/README.md +++ b/README.md @@ -282,6 +282,8 @@ An example of using the event emitter to control the playlist can be found in [/ | `mastervolumechange` | `volume` | Set a new master volume `volume` (0-100) | | `select` | `start, end, track:optional` | Seek to the start time or start/end selection optionally with active track `track`. | | `startaudiorendering` | (`wav | buffer`) | Request for a downloadable file or web Audio buffer that represent the current work | +| `speedchange` | `speed` | Change de playback speed. Minimum is 0.5x and maximum is 4x | +| `loopnumber` | `number` | -1 : infinite loop. `number` > 1 : perform `number` loops. 0 : disable loops | #### Events to Listen to @@ -302,6 +304,8 @@ An example of using the event emitter to control the playlist can be found in [/ | `audiosourcesrendered` | _none_ | Tracks are rendered to the playlist | | `finished` | _none_ | Event fired when cursor ( while playing ) reaches the end (maximum duration) | | `audiorenderingfinished` | `type, data` | Return the result of the rendering in the desired format. `type` can be `buffer` or `wav` and can be used to dertermine the `data` type. When `type` is `wav`, data is a `blob` object that represent the wav file. | +| `speedchanged` | `speed` | When speed is changed, return the value applied to tracks. | +| `newloop` | `remaining` |Event fired when one loop finish, and give the number of remaining loops to come | ## Tests diff --git a/dist/waveform-playlist/exclusive-solo.html b/dist/waveform-playlist/exclusive-solo.html index b735a8e9..4563779a 100644 --- a/dist/waveform-playlist/exclusive-solo.html +++ b/dist/waveform-playlist/exclusive-solo.html @@ -42,19 +42,20 @@

Stem Tracks with exclusive solo

-
-
- - - - - +
+
+ + + + + +
-
- +
diff --git a/dist/waveform-playlist/js/emitter.js b/dist/waveform-playlist/js/emitter.js index 87175582..a0d68a77 100644 --- a/dist/waveform-playlist/js/emitter.js +++ b/dist/waveform-playlist/js/emitter.js @@ -1,7 +1,7 @@ /* * This script is provided to give an example how the playlist can be controlled using the event emitter. * This enables projects to create/control the useability of the project. -*/ + */ var ee = playlist.getEventEmitter(); var $container = $("body"); var $timeFormat = $container.find('.time-format'); @@ -30,9 +30,9 @@ function cueFormatters(format) { function clockFormat(seconds, decimals) { var hours, - minutes, - secs, - result; + minutes, + secs, + result; hours = parseInt(seconds / 3600, 10) % 24; minutes = parseInt(seconds / 60, 10) % 60; @@ -46,22 +46,22 @@ function cueFormatters(format) { var formats = { "seconds": function (seconds) { - return seconds.toFixed(0); + return seconds.toFixed(0); }, "thousandths": function (seconds) { - return seconds.toFixed(3); + return seconds.toFixed(3); }, "hh:mm:ss": function (seconds) { - return clockFormat(seconds, 0); + return clockFormat(seconds, 0); }, "hh:mm:ss.u": function (seconds) { - return clockFormat(seconds, 1); + return clockFormat(seconds, 1); }, "hh:mm:ss.uu": function (seconds) { - return clockFormat(seconds, 2); + return clockFormat(seconds, 2); }, "hh:mm:ss.uuu": function (seconds) { - return clockFormat(seconds, 3); + return clockFormat(seconds, 3); } }; @@ -95,9 +95,9 @@ updateTime(audioPos); /* -* Code below sets up events to send messages to the playlist. -*/ -$container.on("click", ".btn-playlist-state-group", function() { + * Code below sets up events to send messages to the playlist. + */ +$container.on("click", ".btn-playlist-state-group", function () { //reset these for now. $('.btn-fade-state-group').addClass('hidden'); $('.btn-select-state-group').addClass('hidden'); @@ -111,95 +111,95 @@ $container.on("click", ".btn-playlist-state-group", function() { } }); -$container.on("click", ".btn-play", function() { +$container.on("click", ".btn-play", function () { ee.emit("play"); }); -$container.on("click", ".btn-pause", function() { +$container.on("click", ".btn-pause", function () { ee.emit("pause"); }); -$container.on("click", ".btn-stop", function() { +$container.on("click", ".btn-stop", function () { ee.emit("stop"); }); -$container.on("click", ".btn-rewind", function() { +$container.on("click", ".btn-rewind", function () { ee.emit("rewind"); }); -$container.on("click", ".btn-fast-forward", function() { +$container.on("click", ".btn-fast-forward", function () { ee.emit("fastforward"); }); -$container.on("click", ".btn-clear", function() { +$container.on("click", ".btn-clear", function () { ee.emit("clear"); }); -$container.on("click", ".btn-record", function() { - ee.emit("record"); +$container.on("click", ".btn-record", function () { + ee.emit("record"); }); //track interaction states -$container.on("click", ".btn-cursor", function() { +$container.on("click", ".btn-cursor", function () { ee.emit("statechange", "cursor"); toggleActive(this); }); -$container.on("click", ".btn-select", function() { +$container.on("click", ".btn-select", function () { ee.emit("statechange", "select"); toggleActive(this); }); -$container.on("click", ".btn-shift", function() { +$container.on("click", ".btn-shift", function () { ee.emit("statechange", "shift"); toggleActive(this); }); -$container.on("click", ".btn-fadein", function() { +$container.on("click", ".btn-fadein", function () { ee.emit("statechange", "fadein"); toggleActive(this); }); -$container.on("click", ".btn-fadeout", function() { +$container.on("click", ".btn-fadeout", function () { ee.emit("statechange", "fadeout"); toggleActive(this); }); //fade types -$container.on("click", ".btn-logarithmic", function() { +$container.on("click", ".btn-logarithmic", function () { ee.emit("fadetype", "logarithmic"); toggleActive(this); }); -$container.on("click", ".btn-linear", function() { +$container.on("click", ".btn-linear", function () { ee.emit("fadetype", "linear"); toggleActive(this); }); -$container.on("click", ".btn-scurve", function() { +$container.on("click", ".btn-scurve", function () { ee.emit("fadetype", "sCurve"); toggleActive(this); }); -$container.on("click", ".btn-exponential", function() { +$container.on("click", ".btn-exponential", function () { ee.emit("fadetype", "exponential"); toggleActive(this); }); //zoom buttons -$container.on("click", ".btn-zoom-in", function() { +$container.on("click", ".btn-zoom-in", function () { ee.emit("zoomin"); }); -$container.on("click", ".btn-zoom-out", function() { +$container.on("click", ".btn-zoom-out", function () { ee.emit("zoomout"); }); -$container.on("click", ".btn-trim-audio", function() { +$container.on("click", ".btn-trim-audio", function () { ee.emit("trim"); }); -$container.on("click", ".btn-info", function() { +$container.on("click", ".btn-info", function () { console.log(playlist.getInfo()); }); @@ -217,21 +217,21 @@ $container.on("change", ".select-seek-style", function (node) { }); //track drop -$container.on("dragenter", ".track-drop", function(e) { +$container.on("dragenter", ".track-drop", function (e) { e.preventDefault(); e.target.classList.add("drag-enter"); }); -$container.on("dragover", ".track-drop", function(e) { +$container.on("dragover", ".track-drop", function (e) { e.preventDefault(); }); -$container.on("dragleave", ".track-drop", function(e) { +$container.on("dragleave", ".track-drop", function (e) { e.preventDefault(); e.target.classList.remove("drag-enter"); }); -$container.on("drop", ".track-drop", function(e) { +$container.on("drop", ".track-drop", function (e) { e.preventDefault(); e.target.classList.remove("drag-enter"); @@ -242,17 +242,33 @@ $container.on("drop", ".track-drop", function(e) { } }); -$container.on("change", ".time-format", function(e) { +$container.on("change", ".time-format", function (e) { format = $timeFormat.val(); updateSelect(startTime, endTime); updateTime(audioPos); }); -$container.on("input change", ".master-gain", function(node){ +$container.on("input change", ".master-gain", function (node) { ee.emit("mastervolumechange", node.target.value); }); +$container.on("input change", ".speed-slider", function (node) { + document.getElementById('speedValue').value = node.target.value; + ee.emit("speedchange", node.target.value); + displaySoundStatus("Playback speed is now " + node.target.value + "x !"); +}); + +$container.on('click', ".set-loop-number", function () { + ee.emit("loopnumber", document.getElementById("loopValue").value); +}); + +$container.on("click", ".btn-speed-change", function () { + var value = document.getElementById('speedValue').value; + ee.emit("speedchange", value); + displaySoundStatus("Playback speed is now " + value + "x !"); +}); + function displaySoundStatus(status) { $(".sound-status").html(status); } @@ -277,32 +293,32 @@ function displayDownloadLink(link) { /* -* Code below receives updates from the playlist. -*/ + * Code below receives updates from the playlist. + */ ee.on("select", updateSelect); ee.on("timeupdate", updateTime); -ee.on("mute", function(track) { +ee.on("mute", function (track) { displaySoundStatus("Mute button pressed for " + track.name); }); -ee.on("solo", function(track) { +ee.on("solo", function (track) { displaySoundStatus("Solo button pressed for " + track.name); }); -ee.on("volumechange", function(volume, track) { +ee.on("volumechange", function (volume, track) { displaySoundStatus(track.name + " now has volume " + volume + "."); }); -ee.on("mastervolumechange", function(volume) { +ee.on("mastervolumechange", function (volume) { displaySoundStatus("Master volume now has volume " + volume + "."); }); var audioStates = ["uninitialized", "loading", "decoding", "finished"]; -ee.on("audiorequeststatechange", function(state, src) { +ee.on("audiorequeststatechange", function (state, src) { var name = src; if (src instanceof File) { @@ -312,7 +328,7 @@ ee.on("audiorequeststatechange", function(state, src) { displayLoadingData("Track " + name + " is in state " + audioStates[state]); }); -ee.on("loadprogress", function(percent, src) { +ee.on("loadprogress", function (percent, src) { var name = src; if (src instanceof File) { @@ -322,16 +338,16 @@ ee.on("loadprogress", function(percent, src) { displayLoadingData("Track " + name + " has loaded " + percent + "%"); }); -ee.on("audiosourcesloaded", function() { +ee.on("audiosourcesloaded", function () { displayLoadingData("Tracks have all finished decoding."); }); -ee.on("audiosourcesrendered", function() { +ee.on("audiosourcesrendered", function () { displayLoadingData("Tracks have been rendered"); }); ee.on('audiorenderingfinished', function (type, data) { - if (type == 'wav'){ + if (type == 'wav') { if (downloadUrl) { window.URL.revokeObjectURL(downloadUrl); } @@ -344,3 +360,14 @@ ee.on('audiorenderingfinished', function (type, data) { ee.on('finished', function () { console.log("The cursor has reached the end of the selection !"); }); + +ee.on('speedchanged', function (speed) { + document.getElementById('speedValue').value = speed; + document.querySelector(".speed-slider").value = speed; + displaySoundStatus("Received speed : " + speed + "x "); +}); + +ee.on('newloop', function (number) { + //document.getElementById("loopValue").value = number; + displaySoundStatus(number + " remaining loop ..."); +}); diff --git a/dist/waveform-playlist/js/exclusivesolo.js b/dist/waveform-playlist/js/exclusivesolo.js index ece8d325..ea681680 100644 --- a/dist/waveform-playlist/js/exclusivesolo.js +++ b/dist/waveform-playlist/js/exclusivesolo.js @@ -32,6 +32,6 @@ playlist.load([ "src": "media/audio/BassDrums30.mp3", "name": "Drums" } -]).then(function() { +]).then(function () { //can do stuff with the playlist. }); diff --git a/dist/waveform-playlist/js/multi-channel.js b/dist/waveform-playlist/js/multi-channel.js index 2bd80b94..fd380507 100644 --- a/dist/waveform-playlist/js/multi-channel.js +++ b/dist/waveform-playlist/js/multi-channel.js @@ -18,6 +18,6 @@ playlist.load([ src: "media/audio/BassDrums30.mp3", name: "Bass & Drums" } -]).then(function() { +]).then(function () { //can do stuff with the playlist. }); diff --git a/dist/waveform-playlist/js/waveform-playlist.var.js b/dist/waveform-playlist/js/waveform-playlist.var.js index 3dae7ab5..0b7987ac 100644 --- a/dist/waveform-playlist/js/waveform-playlist.var.js +++ b/dist/waveform-playlist/js/waveform-playlist.var.js @@ -45,113 +45,113 @@ var WaveformPlaylist = /* 0 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - + "use strict"; + Object.defineProperty(exports, "__esModule", { - value: true + value: true }); exports.init = init; - - exports.default = function () { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var ee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _eventEmitter2.default)(); - - return init(options, ee); - }; - + + exports.default = function () { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var ee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _eventEmitter2.default)(); + + return init(options, ee); + }; + var _lodash = __webpack_require__(1); - + var _lodash2 = _interopRequireDefault(_lodash); - - var _createElement = __webpack_require__(2); - + + var _createElement = __webpack_require__(2); + var _createElement2 = _interopRequireDefault(_createElement); - - var _eventEmitter = __webpack_require__(15); - + + var _eventEmitter = __webpack_require__(15); + var _eventEmitter2 = _interopRequireDefault(_eventEmitter); - - var _Playlist = __webpack_require__(30); - + + var _Playlist = __webpack_require__(30); + var _Playlist2 = _interopRequireDefault(_Playlist); - + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - + function init() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var ee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _eventEmitter2.default)(); - - if (options.container === undefined) { - throw new Error('DOM element container must be given.'); - } - - window.OfflineAudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext; - window.AudioContext = window.AudioContext || window.webkitAudioContext; - - var audioContext = new window.AudioContext(); - - var defaults = { - ac: audioContext, - sampleRate: audioContext.sampleRate, - samplesPerPixel: 4096, - mono: true, - fadeType: 'logarithmic', - exclSolo: false, - timescale: false, - controls: { - show: false, - width: 150 - }, - colors: { - waveOutlineColor: 'white', - timeColor: 'grey', - fadeColor: 'black' - }, - seekStyle: 'line', - waveHeight: 128, - state: 'cursor', - zoomLevels: [512, 1024, 2048, 4096] - }; - - var config = (0, _lodash2.default)(defaults, options); - var zoomIndex = config.zoomLevels.indexOf(config.samplesPerPixel); - - if (zoomIndex === -1) { - throw new Error('initial samplesPerPixel must be included in array zoomLevels'); - } - - var playlist = new _Playlist2.default(); - playlist.setSampleRate(config.sampleRate); - playlist.setSamplesPerPixel(config.samplesPerPixel); - playlist.setAudioContext(config.ac); - playlist.setEventEmitter(ee); - playlist.setUpEventEmitter(); - playlist.setTimeSelection(0, 0); - playlist.setState(config.state); - playlist.setControlOptions(config.controls); - playlist.setWaveHeight(config.waveHeight); - playlist.setColors(config.colors); - playlist.setZoomLevels(config.zoomLevels); - playlist.setZoomIndex(zoomIndex); - playlist.setMono(config.mono); - playlist.setExclSolo(config.exclSolo); - playlist.setShowTimeScale(config.timescale); - playlist.setSeekStyle(config.seekStyle); - - // take care of initial virtual dom rendering. - var tree = playlist.render(); - var rootNode = (0, _createElement2.default)(tree); - - config.container.appendChild(rootNode); - playlist.tree = tree; - playlist.rootNode = rootNode; - - return playlist; + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var ee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _eventEmitter2.default)(); + + if (options.container === undefined) { + throw new Error('DOM element container must be given.'); + } + + window.OfflineAudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext; + window.AudioContext = window.AudioContext || window.webkitAudioContext; + + var audioContext = new window.AudioContext(); + + var defaults = { + ac: audioContext, + sampleRate: audioContext.sampleRate, + samplesPerPixel: 4096, + mono: true, + fadeType: 'logarithmic', + exclSolo: false, + timescale: false, + controls: { + show: false, + width: 150 + }, + colors: { + waveOutlineColor: 'white', + timeColor: 'grey', + fadeColor: 'black' + }, + seekStyle: 'line', + waveHeight: 128, + state: 'cursor', + zoomLevels: [512, 1024, 2048, 4096] + }; + + var config = (0, _lodash2.default)(defaults, options); + var zoomIndex = config.zoomLevels.indexOf(config.samplesPerPixel); + + if (zoomIndex === -1) { + throw new Error('initial samplesPerPixel must be included in array zoomLevels'); + } + + var playlist = new _Playlist2.default(); + playlist.setSampleRate(config.sampleRate); + playlist.setSamplesPerPixel(config.samplesPerPixel); + playlist.setAudioContext(config.ac); + playlist.setEventEmitter(ee); + playlist.setUpEventEmitter(); + playlist.setTimeSelection(0, 0); + playlist.setState(config.state); + playlist.setControlOptions(config.controls); + playlist.setWaveHeight(config.waveHeight); + playlist.setColors(config.colors); + playlist.setZoomLevels(config.zoomLevels); + playlist.setZoomIndex(zoomIndex); + playlist.setMono(config.mono); + playlist.setExclSolo(config.exclSolo); + playlist.setShowTimeScale(config.timescale); + playlist.setSeekStyle(config.seekStyle); + + // take care of initial virtual dom rendering. + var tree = playlist.render(); + var rootNode = (0, _createElement2.default)(tree); + + config.container.appendChild(rootNode); + playlist.tree = tree; + playlist.rootNode = rootNode; + + return playlist; } /***/ }, /* 1 */ -/***/ function(module, exports) { + /***/ function (module, exports) { /** * lodash (Custom Build) @@ -161,124 +161,127 @@ var WaveformPlaylist = * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ - + /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; - + /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - funcTag = '[object Function]', + var argsTag = '[object Arguments]', + funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; - + /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function (arg) { + return func(transform(arg)); + }; + } + /** Used for built-in method references. */ var objectProto = Object.prototype; - + /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; - + /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; - + /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max; - + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max; + /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; - - var length = result.length, - skipIndexes = !!length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } - } - return result; - } - + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; + } + /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -293,56 +296,56 @@ var WaveformPlaylist = object[key] = value; } } - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - + /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. */ - function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function () { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); }; } - + /** * Copies properties of `source` to `object`. * @@ -355,22 +358,22 @@ var WaveformPlaylist = */ function copyObject(source, props, object, customizer) { object || (object = {}); - + var index = -1, length = props.length; - + while (++index < length) { var key = props[index]; - + var newValue = customizer ? customizer(object[key], source[key], key, object, source) - : undefined; - - assignValue(object, key, newValue === undefined ? source[key] : newValue); + : undefined; + + assignValue(object, key, newValue === undefined ? source[key] : newValue); } return object; } - + /** * Creates a function like `_.assign`. * @@ -379,16 +382,16 @@ var WaveformPlaylist = * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { - return baseRest(function(object, sources) { + return baseRest(function (object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - + customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; - + if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; @@ -403,7 +406,7 @@ var WaveformPlaylist = return object; }); } - + /** * Checks if `value` is a valid array-like index. * @@ -418,7 +421,7 @@ var WaveformPlaylist = (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } - + /** * Checks if the given arguments are from an iteratee call. * @@ -442,7 +445,7 @@ var WaveformPlaylist = } return false; } - + /** * Checks if `value` is likely a prototype object. * @@ -453,13 +456,13 @@ var WaveformPlaylist = function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - + return value === proto; } - + /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -471,8 +474,8 @@ var WaveformPlaylist = * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; * * _.eq(object, object); * // => true @@ -492,7 +495,7 @@ var WaveformPlaylist = function eq(value, other) { return value === other || (value !== value && other !== other); } - + /** * Checks if `value` is likely an `arguments` object. * @@ -501,7 +504,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * @@ -512,11 +515,11 @@ var WaveformPlaylist = * // => false */ function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } - + /** * Checks if `value` is classified as an `Array` object. * @@ -525,7 +528,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); @@ -541,7 +544,7 @@ var WaveformPlaylist = * // => false */ var isArray = Array.isArray; - + /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -568,9 +571,9 @@ var WaveformPlaylist = * // => false */ function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } - + /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. @@ -599,7 +602,7 @@ var WaveformPlaylist = function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } - + /** * Checks if `value` is classified as a `Function` object. * @@ -608,7 +611,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -619,23 +622,23 @@ var WaveformPlaylist = */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } - + /** * Checks if `value` is a valid array-like length. * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -654,10 +657,10 @@ var WaveformPlaylist = return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } - + /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -684,7 +687,7 @@ var WaveformPlaylist = var type = typeof value; return !!value && (type == 'object' || type == 'function'); } - + /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". @@ -712,56 +715,56 @@ var WaveformPlaylist = function isObjectLike(value) { return !!value && typeof value == 'object'; } - + /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn * @example * - * function Foo() { + * function Foo() { * this.a = 1; * } * - * function Bar() { + * function Bar() { * this.c = 3; * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } */ - var assign = createAssigner(function(object, source) { - if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - + var assign = createAssigner(function (object, source) { + if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -786,42 +789,42 @@ var WaveformPlaylist = * // => ['0', '1'] */ function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - module.exports = assign; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + + module.exports = assign; /***/ }, -/* 2 */ + /* 2 */ /***/ function(module, exports, __webpack_require__) { - var createElement = __webpack_require__(3) - + var createElement = __webpack_require__(3) + module.exports = createElement /***/ }, -/* 3 */ + /* 3 */ /***/ function(module, exports, __webpack_require__) { - var document = __webpack_require__(4) - - var applyProperties = __webpack_require__(6) - - var isVNode = __webpack_require__(9) - var isVText = __webpack_require__(11) - var isWidget = __webpack_require__(12) - var handleThunk = __webpack_require__(13) - + var document = __webpack_require__(4) + + var applyProperties = __webpack_require__(6) + + var isVNode = __webpack_require__(9) + var isVText = __webpack_require__(11) + var isWidget = __webpack_require__(12) + var handleThunk = __webpack_require__(13) + module.exports = createElement - + function createElement(vnode, opts) { var doc = opts ? opts.document || document : document var warn = opts ? opts.warn : null - + vnode = handleThunk(vnode).a - + if (isWidget(vnode)) { return vnode.init() } else if (isVText(vnode)) { @@ -832,68 +835,68 @@ var WaveformPlaylist = } return null } - + var node = (vnode.namespace === null) ? doc.createElement(vnode.tagName) : doc.createElementNS(vnode.namespace, vnode.tagName) - + var props = vnode.properties applyProperties(node, props) - + var children = vnode.children - + for (var i = 0; i < children.length; i++) { var childNode = createElement(children[i], opts) if (childNode) { node.appendChild(childNode) } } - + return node } /***/ }, -/* 4 */ + /* 4 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var topLevel = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {} - var minDoc = __webpack_require__(5); - + var minDoc = __webpack_require__(5); + if (typeof document !== 'undefined') { module.exports = document; } else { var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; - + if (!doccy) { doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; } - + module.exports = doccy; } - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, -/* 5 */ + /* 5 */ /***/ function(module, exports) { /* (ignored) */ /***/ }, -/* 6 */ + /* 6 */ /***/ function(module, exports, __webpack_require__) { - var isObject = __webpack_require__(7) - var isHook = __webpack_require__(8) - + var isObject = __webpack_require__(7) + var isHook = __webpack_require__(8) + module.exports = applyProperties - + function applyProperties(node, props, previous) { for (var propName in props) { var propValue = props[propName] - + if (propValue === undefined) { removeProperty(node, propName, propValue, previous); } else if (isHook(propValue)) { @@ -912,11 +915,11 @@ var WaveformPlaylist = } } } - + function removeProperty(node, propName, propValue, previous) { if (previous) { var previousValue = previous[propName] - + if (!isHook(previousValue)) { if (propName === "attributes") { for (var attrName in previousValue) { @@ -936,43 +939,43 @@ var WaveformPlaylist = } } } - + function patchObject(node, props, previous, propName, propValue) { var previousValue = previous ? previous[propName] : undefined - + // Set attributes if (propName === "attributes") { for (var attrName in propValue) { var attrValue = propValue[attrName] - + if (attrValue === undefined) { node.removeAttribute(attrName) } else { node.setAttribute(attrName, attrValue) } } - + return } - + if(previousValue && isObject(previousValue) && getPrototype(previousValue) !== getPrototype(propValue)) { node[propName] = propValue return } - + if (!isObject(node[propName])) { node[propName] = {} } - + var replacer = propName === "style" ? "" : undefined - + for (var k in propValue) { var value = propValue[k] node[propName][k] = (value === undefined) ? replacer : value } } - + function getPrototype(value) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(value) @@ -985,22 +988,22 @@ var WaveformPlaylist = /***/ }, -/* 7 */ + /* 7 */ /***/ function(module, exports) { "use strict"; - + module.exports = function isObject(x) { return typeof x === "object" && x !== null; }; /***/ }, -/* 8 */ + /* 8 */ /***/ function(module, exports) { module.exports = isHook - + function isHook(hook) { return hook && (typeof hook.hook === "function" && !hook.hasOwnProperty("hook") || @@ -1009,128 +1012,128 @@ var WaveformPlaylist = /***/ }, -/* 9 */ + /* 9 */ /***/ function(module, exports, __webpack_require__) { - var version = __webpack_require__(10) - + var version = __webpack_require__(10) + module.exports = isVirtualNode - + function isVirtualNode(x) { return x && x.type === "VirtualNode" && x.version === version } /***/ }, -/* 10 */ + /* 10 */ /***/ function(module, exports) { module.exports = "2" /***/ }, -/* 11 */ + /* 11 */ /***/ function(module, exports, __webpack_require__) { - var version = __webpack_require__(10) - + var version = __webpack_require__(10) + module.exports = isVirtualText - + function isVirtualText(x) { return x && x.type === "VirtualText" && x.version === version } /***/ }, -/* 12 */ + /* 12 */ /***/ function(module, exports) { module.exports = isWidget - + function isWidget(w) { return w && w.type === "Widget" } /***/ }, -/* 13 */ + /* 13 */ /***/ function(module, exports, __webpack_require__) { - var isVNode = __webpack_require__(9) - var isVText = __webpack_require__(11) - var isWidget = __webpack_require__(12) - var isThunk = __webpack_require__(14) - + var isVNode = __webpack_require__(9) + var isVText = __webpack_require__(11) + var isWidget = __webpack_require__(12) + var isThunk = __webpack_require__(14) + module.exports = handleThunk - + function handleThunk(a, b) { var renderedA = a var renderedB = b - + if (isThunk(b)) { renderedB = renderThunk(b, a) } - + if (isThunk(a)) { renderedA = renderThunk(a, null) } - + return { a: renderedA, b: renderedB } } - + function renderThunk(thunk, previous) { var renderedThunk = thunk.vnode - + if (!renderedThunk) { renderedThunk = thunk.vnode = thunk.render(previous) } - + if (!(isVNode(renderedThunk) || isVText(renderedThunk) || isWidget(renderedThunk))) { throw new Error("thunk did not return a valid node"); } - + return renderedThunk } /***/ }, -/* 14 */ + /* 14 */ /***/ function(module, exports) { - module.exports = isThunk - - function isThunk(t) { - return t && t.type === "Thunk" - } + module.exports = isThunk + + function isThunk(t) { + return t && t.type === "Thunk" + } /***/ }, -/* 15 */ + /* 15 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var d = __webpack_require__(16) - , callable = __webpack_require__(29) - + + var d = __webpack_require__(16) + , callable = __webpack_require__(29) + , apply = Function.prototype.apply, call = Function.prototype.call , create = Object.create, defineProperty = Object.defineProperty , defineProperties = Object.defineProperties , hasOwnProperty = Object.prototype.hasOwnProperty , descriptor = { configurable: true, enumerable: false, writable: true } - + , on, once, off, emit, methods, descriptors, base; - + on = function (type, listener) { var data; - + callable(listener); - + if (!hasOwnProperty.call(this, '__ee__')) { data = descriptor.value = create(null); defineProperty(this, '__ee__', descriptor); @@ -1141,34 +1144,34 @@ var WaveformPlaylist = if (!data[type]) data[type] = listener; else if (typeof data[type] === 'object') data[type].push(listener); else data[type] = [data[type], listener]; - + return this; }; - + once = function (type, listener) { var once, self; - + callable(listener); self = this; on.call(this, type, once = function () { off.call(self, type, once); apply.call(listener, this, arguments); }); - + once.__eeOnceListener__ = listener; return this; }; - + off = function (type, listener) { var data, listeners, candidate, i; - + callable(listener); - + if (!hasOwnProperty.call(this, '__ee__')) return this; data = this.__ee__; if (!data[type]) return this; listeners = data[type]; - + if (typeof listeners === 'object') { for (i = 0; (candidate = listeners[i]); ++i) { if ((candidate === listener) || @@ -1183,22 +1186,22 @@ var WaveformPlaylist = delete data[type]; } } - + return this; }; - + emit = function (type) { var i, l, listener, listeners, args; - + if (!hasOwnProperty.call(this, '__ee__')) return; listeners = this.__ee__[type]; if (!listeners) return; - + if (typeof listeners === 'object') { l = arguments.length; args = new Array(l - 1); for (i = 1; i < l; ++i) args[i - 1] = arguments[i]; - + listeners = listeners.slice(); for (i = 0; (listener = listeners[i]); ++i) { apply.call(listener, this, args); @@ -1224,23 +1227,23 @@ var WaveformPlaylist = } } }; - + methods = { on: on, once: once, off: off, emit: emit }; - + descriptors = { on: d(on), once: d(once), off: d(off), emit: d(emit) }; - + base = defineProperties({}, descriptors); - + module.exports = exports = function (o) { return (o == null) ? create(base) : defineProperties(Object(o), descriptors); }; @@ -1248,18 +1251,18 @@ var WaveformPlaylist = /***/ }, -/* 16 */ + /* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var assign = __webpack_require__(17) - , normalizeOpts = __webpack_require__(24) - , isCallable = __webpack_require__(25) - , contains = __webpack_require__(26) - + + var assign = __webpack_require__(17) + , normalizeOpts = __webpack_require__(24) + , isCallable = __webpack_require__(25) + , contains = __webpack_require__(26) + , d; - + d = module.exports = function (dscr, value/*, options*/) { var c, e, w, options, desc; if ((arguments.length < 2) || (typeof dscr !== 'string')) { @@ -1277,11 +1280,11 @@ var WaveformPlaylist = e = contains.call(dscr, 'e'); w = contains.call(dscr, 'w'); } - + desc = { value: value, configurable: c, enumerable: e, writable: w }; return !options ? desc : assign(normalizeOpts(options), desc); }; - + d.gs = function (dscr, get, set/*, options*/) { var c, e, options, desc; if (typeof dscr !== 'string') { @@ -1310,29 +1313,29 @@ var WaveformPlaylist = c = contains.call(dscr, 'c'); e = contains.call(dscr, 'e'); } - + desc = { get: get, set: set, configurable: c, enumerable: e }; return !options ? desc : assign(normalizeOpts(options), desc); }; /***/ }, -/* 17 */ + /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - module.exports = __webpack_require__(18)() + + module.exports = __webpack_require__(18)() ? Object.assign - : __webpack_require__(19); + : __webpack_require__(19); /***/ }, -/* 18 */ + /* 18 */ /***/ function(module, exports) { 'use strict'; - + module.exports = function () { var assign = Object.assign, obj; if (typeof assign !== 'function') return false; @@ -1343,16 +1346,16 @@ var WaveformPlaylist = /***/ }, -/* 19 */ + /* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var keys = __webpack_require__(20) - , value = __webpack_require__(23) - + + var keys = __webpack_require__(20) + , value = __webpack_require__(23) + , max = Math.max; - + module.exports = function (dest, src/*, …srcn*/) { var error, i, l = max(arguments.length, 2), assign; dest = Object(value(dest)); @@ -1371,22 +1374,22 @@ var WaveformPlaylist = /***/ }, -/* 20 */ + /* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - module.exports = __webpack_require__(21)() + + module.exports = __webpack_require__(21)() ? Object.keys - : __webpack_require__(22); + : __webpack_require__(22); /***/ }, -/* 21 */ + /* 21 */ /***/ function(module, exports) { 'use strict'; - + module.exports = function () { try { Object.keys('primitive'); @@ -1396,24 +1399,24 @@ var WaveformPlaylist = /***/ }, -/* 22 */ + /* 22 */ /***/ function(module, exports) { 'use strict'; - + var keys = Object.keys; - + module.exports = function (object) { return keys(object == null ? object : Object(object)); }; /***/ }, -/* 23 */ + /* 23 */ /***/ function(module, exports) { 'use strict'; - + module.exports = function (value) { if (value == null) throw new TypeError("Cannot use null or undefined"); return value; @@ -1421,18 +1424,18 @@ var WaveformPlaylist = /***/ }, -/* 24 */ + /* 24 */ /***/ function(module, exports) { 'use strict'; - + var forEach = Array.prototype.forEach, create = Object.create; - + var process = function (src, obj) { var key; for (key in src) obj[key] = src[key]; }; - + module.exports = function (options/*, …options*/) { var result = create(null); forEach.call(arguments, function (options) { @@ -1444,35 +1447,35 @@ var WaveformPlaylist = /***/ }, -/* 25 */ + /* 25 */ /***/ function(module, exports) { // Deprecated - + 'use strict'; - + module.exports = function (obj) { return typeof obj === 'function'; }; /***/ }, -/* 26 */ + /* 26 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - module.exports = __webpack_require__(27)() + + module.exports = __webpack_require__(27)() ? String.prototype.contains - : __webpack_require__(28); + : __webpack_require__(28); /***/ }, -/* 27 */ + /* 27 */ /***/ function(module, exports) { 'use strict'; - + var str = 'razdwatrzy'; - + module.exports = function () { if (typeof str.contains !== 'function') return false; return ((str.contains('dwa') === true) && (str.contains('foo') === false)); @@ -1480,24 +1483,24 @@ var WaveformPlaylist = /***/ }, -/* 28 */ + /* 28 */ /***/ function(module, exports) { 'use strict'; - + var indexOf = String.prototype.indexOf; - + module.exports = function (searchString/*, position*/) { return indexOf.call(this, searchString, arguments[1]) > -1; }; /***/ }, -/* 29 */ + /* 29 */ /***/ function(module, exports) { 'use strict'; - + module.exports = function (fn) { if (typeof fn !== 'function') throw new TypeError(fn + " is not a function"); return fn; @@ -1505,1016 +1508,1045 @@ var WaveformPlaylist = /***/ }, -/* 30 */ + /* 30 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - + Object.defineProperty(exports, "__esModule", { - value: true + value: true }); - + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _lodash = __webpack_require__(31); - + + var _lodash = __webpack_require__(31); + var _lodash2 = _interopRequireDefault(_lodash); - - var _h = __webpack_require__(32); - + + var _h = __webpack_require__(32); + var _h2 = _interopRequireDefault(_h); - - var _diff = __webpack_require__(44); - + + var _diff = __webpack_require__(44); + var _diff2 = _interopRequireDefault(_diff); - - var _patch = __webpack_require__(48); - + + var _patch = __webpack_require__(48); + var _patch2 = _interopRequireDefault(_patch); - - var _inlineWorker = __webpack_require__(53); - - var _inlineWorker2 = _interopRequireDefault(_inlineWorker); - - var _conversions = __webpack_require__(54); - - var _LoaderFactory = __webpack_require__(55); - + + var _inlineWorker = __webpack_require__(53); + + var _inlineWorker2 = _interopRequireDefault(_inlineWorker); + + var _conversions = __webpack_require__(54); + + var _LoaderFactory = __webpack_require__(55); + var _LoaderFactory2 = _interopRequireDefault(_LoaderFactory); - - var _ScrollHook = __webpack_require__(59); - + + var _ScrollHook = __webpack_require__(59); + var _ScrollHook2 = _interopRequireDefault(_ScrollHook); - - var _TimeScale = __webpack_require__(60); - + + var _TimeScale = __webpack_require__(60); + var _TimeScale2 = _interopRequireDefault(_TimeScale); - - var _Track = __webpack_require__(62); - + + var _Track = __webpack_require__(62); + var _Track2 = _interopRequireDefault(_Track); - - var _Playout = __webpack_require__(78); - + + var _Playout = __webpack_require__(78); + var _Playout2 = _interopRequireDefault(_Playout); - - var _recorderWorker = __webpack_require__(79); - - var _recorderWorker2 = _interopRequireDefault(_recorderWorker); - - var _exportWavWorker = __webpack_require__(80); - + + var _recorderWorker = __webpack_require__(79); + + var _recorderWorker2 = _interopRequireDefault(_recorderWorker); + + var _exportWavWorker = __webpack_require__(80); + var _exportWavWorker2 = _interopRequireDefault(_exportWavWorker); - + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - + var _class = function () { - function _class() { - _classCallCheck(this, _class); - - this.tracks = []; - this.soloedTracks = []; - this.mutedTracks = []; - this.playoutPromises = []; - - this.cursor = 0; - this.playbackSeconds = 0; - this.duration = 0; - this.scrollLeft = 0; - this.showTimescale = false; - - this.fadeType = 'logarithmic'; - this.masterGain = 1; - } - - // TODO extract into a plugin - - - _createClass(_class, [{ - key: 'initExporter', - value: function initExporter() { - this.exportWorker = new _inlineWorker2.default(_exportWavWorker2.default); - } - - // TODO extract into a plugin - - }, { - key: 'initRecorder', - value: function initRecorder(stream) { - var _this = this; - - this.mediaRecorder = new window.MediaRecorder(stream); - - this.mediaRecorder.onstart = function () { - var track = new _Track2.default(); - track.setName('Recording'); - track.setEnabledStates(); - track.setEventEmitter(_this.ee); - - _this.recordingTrack = track; - _this.tracks.push(track); - - _this.chunks = []; - }; - - this.mediaRecorder.ondataavailable = function (e) { - _this.chunks.push(e.data); - - var recording = new Blob(_this.chunks, { type: 'audio/ogg; codecs=opus' }); - var loader = _LoaderFactory2.default.createLoader(recording, _this.ac); - loader.load().then(function (audioBuffer) { - // ask web worker for peaks. - _this.recorderWorker.postMessage({ - samples: audioBuffer.getChannelData(0), - samplesPerPixel: _this.samplesPerPixel - }); - _this.recordingTrack.setCues(0, audioBuffer.duration); - _this.recordingTrack.setBuffer(audioBuffer); - _this.recordingTrack.setPlayout(new _Playout2.default(_this.ac, audioBuffer)); - _this.adjustDuration(); - }); - }; - - this.recorderWorker = new _inlineWorker2.default(_recorderWorker2.default); - // use a worker for calculating recording peaks. - this.recorderWorker.onmessage = function (e) { - _this.recordingTrack.setPeaks(e.data); - _this.draw(_this.render()); - }; - - this.recorderWorker.onerror = function (e) { - throw e; - }; - } - }, { - key: 'setShowTimeScale', - value: function setShowTimeScale(show) { - this.showTimescale = show; - } - }, { - key: 'setMono', - value: function setMono(mono) { - this.mono = mono; - } - }, { - key: 'setExclSolo', - value: function setExclSolo(exclSolo) { - this.exclSolo = exclSolo; - } - }, { - key: 'setSeekStyle', - value: function setSeekStyle(style) { - this.seekStyle = style; - } - }, { - key: 'getSeekStyle', - value: function getSeekStyle() { - return this.seekStyle; - } - }, { - key: 'setSampleRate', - value: function setSampleRate(sampleRate) { - this.sampleRate = sampleRate; - } - }, { - key: 'setSamplesPerPixel', - value: function setSamplesPerPixel(samplesPerPixel) { - this.samplesPerPixel = samplesPerPixel; - } - }, { - key: 'setAudioContext', - value: function setAudioContext(ac) { - this.ac = ac; - } - }, { - key: 'setControlOptions', - value: function setControlOptions(controlOptions) { - this.controls = controlOptions; - } - }, { - key: 'setWaveHeight', - value: function setWaveHeight(height) { - this.waveHeight = height; - } - }, { - key: 'setColors', - value: function setColors(colors) { - this.colors = colors; - } - }, { - key: 'setEventEmitter', - value: function setEventEmitter(ee) { - this.ee = ee; - } - }, { - key: 'getEventEmitter', - value: function getEventEmitter() { - return this.ee; - } - }, { - key: 'setUpEventEmitter', - value: function setUpEventEmitter() { - var _this2 = this; - - var ee = this.ee; - - ee.on('select', function (start, end, track) { - if (_this2.isPlaying()) { - _this2.lastSeeked = start; - _this2.pausedAt = undefined; - _this2.restartPlayFrom(start); - } else { - // reset if it was paused. - _this2.seek(start, end, track); - _this2.ee.emit('timeupdate', start); - _this2.draw(_this2.render()); - } - }); - - ee.on('startaudiorendering', function (type) { - _this2.startOfflineRender(type); - }); - - ee.on('statechange', function (state) { - _this2.setState(state); - _this2.draw(_this2.render()); - }); - - ee.on('shift', function (deltaTime, track) { - track.setStartTime(track.getStartTime() + deltaTime); - _this2.adjustDuration(); - _this2.draw(_this2.render()); - }); - - ee.on('record', function () { - _this2.record(); - }); - - ee.on('play', function (start, end) { - _this2.play(start, end); - }); - - ee.on('pause', function () { - _this2.pause(); - }); - - ee.on('stop', function () { - _this2.stop(); - }); - - ee.on('rewind', function () { - _this2.rewind(); - }); - - ee.on('fastforward', function () { - _this2.fastForward(); - }); - - ee.on('clear', function () { - _this2.clear().then(function () { - _this2.draw(_this2.render()); - }); - }); - - ee.on('solo', function (track) { - _this2.soloTrack(track); - _this2.adjustTrackPlayout(); - _this2.draw(_this2.render()); - }); - - ee.on('mute', function (track) { - _this2.muteTrack(track); - _this2.adjustTrackPlayout(); - _this2.draw(_this2.render()); - }); - - ee.on('volumechange', function (volume, track) { - track.setGainLevel(volume / 100); - }); - - ee.on('mastervolumechange', function (volume) { - _this2.masterGain = volume / 100; - _this2.tracks.forEach(function (track) { - track.setMasterGainLevel(_this2.masterGain); - }); - }); - - ee.on('fadein', function (duration, track) { - track.setFadeIn(duration, _this2.fadeType); - _this2.draw(_this2.render()); - }); - - ee.on('fadeout', function (duration, track) { - track.setFadeOut(duration, _this2.fadeType); - _this2.draw(_this2.render()); - }); - - ee.on('fadetype', function (type) { - _this2.fadeType = type; - }); - - ee.on('newtrack', function (file) { - _this2.load([{ - src: file, - name: file.name - }]); - }); - - ee.on('trim', function () { - var track = _this2.getActiveTrack(); - var timeSelection = _this2.getTimeSelection(); - - track.trim(timeSelection.start, timeSelection.end); - track.calculatePeaks(_this2.samplesPerPixel, _this2.sampleRate); - - _this2.setTimeSelection(0, 0); - _this2.draw(_this2.render()); - }); - - ee.on('zoomin', function () { - var zoomIndex = Math.max(0, _this2.zoomIndex - 1); - var zoom = _this2.zoomLevels[zoomIndex]; - - if (zoom !== _this2.samplesPerPixel) { - _this2.setZoom(zoom); - _this2.draw(_this2.render()); - } - }); - - ee.on('zoomout', function () { - var zoomIndex = Math.min(_this2.zoomLevels.length - 1, _this2.zoomIndex + 1); - var zoom = _this2.zoomLevels[zoomIndex]; - - if (zoom !== _this2.samplesPerPixel) { - _this2.setZoom(zoom); - _this2.draw(_this2.render()); - } - }); - - ee.on('scroll', function () { - _this2.draw(_this2.render()); - }); - } - }, { - key: 'load', - value: function load(trackList) { - var _this3 = this; - - var loadPromises = trackList.map(function (trackInfo) { - var loader = _LoaderFactory2.default.createLoader(trackInfo.src, _this3.ac, _this3.ee); - return loader.load(); - }); - - return Promise.all(loadPromises).then(function (audioBuffers) { - _this3.ee.emit('audiosourcesloaded'); - - var tracks = audioBuffers.map(function (audioBuffer, index) { - var info = trackList[index]; - var name = info.name || 'Untitled'; - var start = info.start || 0; - var states = info.states || {}; - var fadeIn = info.fadeIn; - var fadeOut = info.fadeOut; - var cueIn = info.cuein || 0; - var cueOut = info.cueout || audioBuffer.duration; - var gain = info.gain || 1; - var muted = info.muted || false; - var soloed = info.soloed || false; - var selection = info.selected; - var peaks = info.peaks || { type: 'WebAudio', mono: _this3.mono }; - var customClass = info.customClass || undefined; - var waveOutlineColor = info.waveOutlineColor || undefined; - - // webaudio specific playout for now. - var playout = new _Playout2.default(_this3.ac, audioBuffer); - - var track = new _Track2.default(); - track.src = info.src; - track.setBuffer(audioBuffer); - track.setName(name); - track.setEventEmitter(_this3.ee); - track.setEnabledStates(states); - track.setCues(cueIn, cueOut); - track.setCustomClass(customClass); - track.setWaveOutlineColor(waveOutlineColor); - - if (fadeIn !== undefined) { - track.setFadeIn(fadeIn.duration, fadeIn.shape); - } - - if (fadeOut !== undefined) { - track.setFadeOut(fadeOut.duration, fadeOut.shape); - } - - if (selection !== undefined) { - _this3.setActiveTrack(track); - _this3.setTimeSelection(selection.start, selection.end); - } - - if (peaks !== undefined) { - track.setPeakData(peaks); - } - - track.setState(_this3.getState()); - track.setStartTime(start); - track.setPlayout(playout); - - track.setGainLevel(gain); - - if (muted) { - _this3.muteTrack(track); - } - - if (soloed) { - _this3.soloTrack(track); - } - - // extract peaks with AudioContext for now. - track.calculatePeaks(_this3.samplesPerPixel, _this3.sampleRate); - - return track; - }); - - _this3.tracks = _this3.tracks.concat(tracks); - _this3.adjustDuration(); - _this3.draw(_this3.render()); - - _this3.ee.emit('audiosourcesrendered'); - }); - } - - /* - track instance of Track. - */ - - }, { - key: 'setActiveTrack', - value: function setActiveTrack(track) { - this.activeTrack = track; - } - }, { - key: 'getActiveTrack', - value: function getActiveTrack() { - return this.activeTrack; - } - }, { - key: 'isSegmentSelection', - value: function isSegmentSelection() { - return this.timeSelection.start !== this.timeSelection.end; - } - - /* - start, end in seconds. - */ - - }, { - key: 'setTimeSelection', - value: function setTimeSelection() { - var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - var end = arguments[1]; - - this.timeSelection = { - start: start, - end: end === undefined ? start : end - }; - - this.cursor = start; - } - }, { - key: 'startOfflineRender', - value: function startOfflineRender(type) { - var _this4 = this; - - if (this.isRendering) { - return; - } - - this.isRendering = true; - this.offlineAudioContext = new OfflineAudioContext(2, 44100 * this.duration, 44100); - - var currentTime = this.offlineAudioContext.currentTime; - - this.tracks.forEach(function (track) { - track.setOfflinePlayout(new _Playout2.default(_this4.offlineAudioContext, track.buffer)); - track.schedulePlay(currentTime, 0, 0, { - shouldPlay: _this4.shouldTrackPlay(track), - masterGain: 1, - isOffline: true - }); - }); - - /* - TODO cleanup of different audio playouts handling. - */ - this.offlineAudioContext.startRendering().then(function (audioBuffer) { - if (type === 'buffer') { - _this4.ee.emit('audiorenderingfinished', type, audioBuffer); - _this4.isRendering = false; - return; - } - - if (type === 'wav') { - _this4.exportWorker.postMessage({ - command: 'init', - config: { - sampleRate: 44100 - } - }); - - // callback for `exportWAV` - _this4.exportWorker.onmessage = function (e) { - _this4.ee.emit('audiorenderingfinished', type, e.data); - _this4.isRendering = false; - - // clear out the buffer for next renderings. - _this4.exportWorker.postMessage({ - command: 'clear' - }); - }; - - // send the channel data from our buffer to the worker - _this4.exportWorker.postMessage({ - command: 'record', - buffer: [audioBuffer.getChannelData(0), audioBuffer.getChannelData(1)] - }); - - // ask the worker for a WAV - _this4.exportWorker.postMessage({ - command: 'exportWAV', - type: 'audio/wav' - }); - } - }).catch(function (e) { - throw e; - }); - } - }, { - key: 'getTimeSelection', - value: function getTimeSelection() { - return this.timeSelection; - } - }, { - key: 'setState', - value: function setState(state) { - this.state = state; - - this.tracks.forEach(function (track) { - track.setState(state); - }); - } - }, { - key: 'getState', - value: function getState() { - return this.state; - } - }, { - key: 'setZoomIndex', - value: function setZoomIndex(index) { - this.zoomIndex = index; - } - }, { - key: 'setZoomLevels', - value: function setZoomLevels(levels) { - this.zoomLevels = levels; - } - }, { - key: 'setZoom', - value: function setZoom(zoom) { - var _this5 = this; - - this.samplesPerPixel = zoom; - this.zoomIndex = this.zoomLevels.indexOf(zoom); - this.tracks.forEach(function (track) { - track.calculatePeaks(zoom, _this5.sampleRate); - }); - } - }, { - key: 'muteTrack', - value: function muteTrack(track) { - var index = this.mutedTracks.indexOf(track); - - if (index > -1) { - this.mutedTracks.splice(index, 1); - } else { - this.mutedTracks.push(track); - } - } - }, { - key: 'soloTrack', - value: function soloTrack(track) { - var index = this.soloedTracks.indexOf(track); - - if (index > -1) { - this.soloedTracks.splice(index, 1); - } else if (this.exclSolo) { - this.soloedTracks = [track]; - } else { - this.soloedTracks.push(track); - } - } - }, { - key: 'adjustTrackPlayout', - value: function adjustTrackPlayout() { - var _this6 = this; - - this.tracks.forEach(function (track) { - track.setShouldPlay(_this6.shouldTrackPlay(track)); - }); - } - }, { - key: 'adjustDuration', - value: function adjustDuration() { - this.duration = this.tracks.reduce(function (duration, track) { - return Math.max(duration, track.getEndTime()); - }, 0); - } - }, { - key: 'shouldTrackPlay', - value: function shouldTrackPlay(track) { - var shouldPlay = void 0; - // if there are solo tracks, only they should play. - if (this.soloedTracks.length > 0) { - shouldPlay = false; - if (this.soloedTracks.indexOf(track) > -1) { - shouldPlay = true; - } - } else { - // play all tracks except any muted tracks. - shouldPlay = true; - if (this.mutedTracks.indexOf(track) > -1) { - shouldPlay = false; - } - } - - return shouldPlay; - } - }, { - key: 'isPlaying', - value: function isPlaying() { - return this.tracks.reduce(function (isPlaying, track) { - return isPlaying || track.isPlaying(); - }, false); - } - - /* - * returns the current point of time in the playlist in seconds. - */ - - }, { - key: 'getCurrentTime', - value: function getCurrentTime() { - var cursorPos = this.lastSeeked || this.pausedAt || this.cursor; - - return cursorPos + this.getElapsedTime(); - } - }, { - key: 'getElapsedTime', - value: function getElapsedTime() { - return this.ac.currentTime - this.lastPlay; - } - }, { - key: 'setMasterGain', - value: function setMasterGain(gain) { - this.ee.emit('mastervolumechange', gain); - } - }, { - key: 'restartPlayFrom', - value: function restartPlayFrom(start, end) { - this.stopAnimation(); - - this.tracks.forEach(function (editor) { - editor.scheduleStop(); - }); - - return Promise.all(this.playoutPromises).then(this.play.bind(this, start, end)); - } - }, { - key: 'play', - value: function play(startTime, endTime) { - var _this7 = this; - - var currentTime = this.ac.currentTime; - var selected = this.getTimeSelection(); - var playoutPromises = []; - - var start = startTime || this.pausedAt || this.cursor; - var end = endTime; - - if (!end && selected.end !== selected.start && selected.end > start) { - end = selected.end; - } - - if (this.isPlaying()) { - return this.restartPlayFrom(start, end); - } - - this.tracks.forEach(function (track) { - track.setState('cursor'); - playoutPromises.push(track.schedulePlay(currentTime, start, end, { - shouldPlay: _this7.shouldTrackPlay(track), - masterGain: _this7.masterGain - })); - }); - - this.lastPlay = currentTime; - // use these to track when the playlist has fully stopped. - this.playoutPromises = playoutPromises; - this.startAnimation(start); - - return Promise.all(this.playoutPromises); - } - }, { - key: 'pause', - value: function pause() { - if (!this.isPlaying()) { - return Promise.all(this.playoutPromises); - } - - this.pausedAt = this.getCurrentTime(); - return this.playbackReset(); - } - }, { - key: 'stop', - value: function stop() { - if (this.mediaRecorder && this.mediaRecorder.state === 'recording') { - this.mediaRecorder.stop(); - } - - this.pausedAt = undefined; - this.playbackSeconds = 0; - return this.playbackReset(); - } - }, { - key: 'playbackReset', - value: function playbackReset() { - var _this8 = this; - - this.lastSeeked = undefined; - this.stopAnimation(); - - this.tracks.forEach(function (track) { - track.scheduleStop(); - track.setState(_this8.getState()); - }); - - this.draw(this.render()); - return Promise.all(this.playoutPromises); - } - }, { - key: 'rewind', - value: function rewind() { - var _this9 = this; - - return this.stop().then(function () { - _this9.scrollLeft = 0; - _this9.ee.emit('select', 0, 0); - }); - } - }, { - key: 'fastForward', - value: function fastForward() { - var _this10 = this; - - return this.stop().then(function () { - if (_this10.viewDuration < _this10.duration) { - _this10.scrollLeft = _this10.duration - _this10.viewDuration; - } else { - _this10.scrollLeft = 0; - } - - _this10.ee.emit('select', _this10.duration, _this10.duration); - }); - } - }, { - key: 'clear', - value: function clear() { - var _this11 = this; - - return this.stop().then(function () { - _this11.tracks = []; - _this11.soloedTracks = []; - _this11.mutedTracks = []; - _this11.playoutPromises = []; - - _this11.cursor = 0; - _this11.playbackSeconds = 0; - _this11.duration = 0; - _this11.scrollLeft = 0; - - _this11.seek(0, 0, undefined); - }); - } - }, { - key: 'record', - value: function record() { - var _this12 = this; - - var playoutPromises = []; - this.mediaRecorder.start(300); - - this.tracks.forEach(function (track) { - track.setState('none'); - playoutPromises.push(track.schedulePlay(_this12.ac.currentTime, 0, undefined, { - shouldPlay: _this12.shouldTrackPlay(track) - })); - }); - - this.playoutPromises = playoutPromises; - } - }, { - key: 'startAnimation', - value: function startAnimation(startTime) { - this.lastDraw = this.ac.currentTime; - this.animationRequest = window.requestAnimationFrame(this.updateEditor.bind(this, startTime)); - } - }, { - key: 'stopAnimation', - value: function stopAnimation() { - window.cancelAnimationFrame(this.animationRequest); - this.lastDraw = undefined; - } - }, { - key: 'seek', - value: function seek(start, end, track) { - if (this.isPlaying()) { - this.lastSeeked = start; - this.pausedAt = undefined; - this.restartPlayFrom(start); - } else { - // reset if it was paused. - this.setActiveTrack(track || this.tracks[0]); - this.pausedAt = start; - this.setTimeSelection(start, end); - if (this.getSeekStyle() === 'fill') { - this.playbackSeconds = start; - } - } - } - - /* - * Animation function for the playlist. - */ - - }, { - key: 'updateEditor', - value: function updateEditor(cursor) { - var currentTime = this.ac.currentTime; - var playbackSeconds = 0; - var selection = this.getTimeSelection(); - - var cursorPos = cursor || this.cursor; - var elapsed = currentTime - this.lastDraw; - - if (this.isPlaying()) { - playbackSeconds = cursorPos + elapsed; - this.ee.emit('timeupdate', playbackSeconds); - this.animationRequest = window.requestAnimationFrame(this.updateEditor.bind(this, playbackSeconds)); - } else { - if (cursorPos + elapsed >= this.isSegmentSelection() ? selection.end : this.duration) { - this.ee.emit('finished'); - } - - this.stopAnimation(); - this.pausedAt = undefined; - this.lastSeeked = undefined; - this.setState(this.getState()); - } - - this.playbackSeconds = playbackSeconds; - - this.draw(this.render()); - this.lastDraw = currentTime; - } - }, { - key: 'draw', - value: function draw(newTree) { - var _this13 = this; - - window.requestAnimationFrame(function () { - var patches = (0, _diff2.default)(_this13.tree, newTree); - _this13.rootNode = (0, _patch2.default)(_this13.rootNode, patches); - _this13.tree = newTree; - - // use for fast forwarding. - _this13.viewDuration = (0, _conversions.pixelsToSeconds)(_this13.rootNode.clientWidth - _this13.controls.width, _this13.samplesPerPixel, _this13.sampleRate); - }); - } - }, { - key: 'getTrackRenderData', - value: function getTrackRenderData() { - var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var defaults = { - height: this.waveHeight, - resolution: this.samplesPerPixel, - sampleRate: this.sampleRate, - controls: this.controls, - isActive: false, - timeSelection: this.getTimeSelection(), - playlistLength: this.duration, - playbackSeconds: this.playbackSeconds, - colors: this.colors - }; - - return (0, _lodash2.default)(data, defaults); - } - }, { - key: 'isActiveTrack', - value: function isActiveTrack(track) { - var activeTrack = this.getActiveTrack(); - - if (this.isSegmentSelection()) { - return activeTrack === track; - } - - return true; - } - }, { - key: 'render', - value: function render() { - var _this14 = this; - - var controlWidth = this.controls.show ? this.controls.width : 0; - var timeScale = new _TimeScale2.default(this.duration, this.scrollLeft, this.samplesPerPixel, this.sampleRate, controlWidth); - - var trackElements = this.tracks.map(function (track) { - return track.render(_this14.getTrackRenderData({ - isActive: _this14.isActiveTrack(track), - shouldPlay: _this14.shouldTrackPlay(track), - soloed: _this14.soloedTracks.indexOf(track) > -1, - muted: _this14.mutedTracks.indexOf(track) > -1 - })); - }); - - var trackSection = (0, _h2.default)('div.playlist-tracks', { - attributes: { - style: 'overflow: auto;' - }, - onscroll: function onscroll(e) { - _this14.scrollLeft = (0, _conversions.pixelsToSeconds)(e.target.scrollLeft, _this14.samplesPerPixel, _this14.sampleRate); - _this14.ee.emit('scroll', _this14.scrollLeft); - }, - hook: new _ScrollHook2.default(this, this.samplesPerPixel, this.sampleRate) - }, trackElements); - - var containerChildren = []; - - if (this.showTimescale) { - containerChildren.push(timeScale.render()); - } - - containerChildren.push(trackSection); - - return (0, _h2.default)('div.playlist', { - attributes: { - style: 'overflow: hidden; position: relative;' + function _class() { + _classCallCheck(this, _class); + + this.tracks = []; + this.soloedTracks = []; + this.mutedTracks = []; + this.playoutPromises = []; + + this.cursor = 0; + this.playbackSeconds = 0; + this.duration = 0; + this.scrollLeft = 0; + this.showTimescale = false; + + this.fadeType = 'logarithmic'; + this.masterGain = 1; + } + + // TODO extract into a plugin + + + _createClass(_class, [{ + key: 'initExporter', + value: function initExporter() { + this.exportWorker = new _inlineWorker2.default(_exportWavWorker2.default); + } + + // TODO extract into a plugin + + }, { + key: 'initRecorder', + value: function initRecorder(stream) { + var _this = this; + + this.mediaRecorder = new window.MediaRecorder(stream); + + this.mediaRecorder.onstart = function () { + var track = new _Track2.default(); + track.setName('Recording'); + track.setEnabledStates(); + track.setEventEmitter(_this.ee); + + _this.recordingTrack = track; + _this.tracks.push(track); + + _this.chunks = []; + }; + + this.mediaRecorder.ondataavailable = function (e) { + _this.chunks.push(e.data); + + var recording = new Blob(_this.chunks, {type: 'audio/ogg; codecs=opus'}); + var loader = _LoaderFactory2.default.createLoader(recording, _this.ac); + loader.load().then(function (audioBuffer) { + // ask web worker for peaks. + _this.recorderWorker.postMessage({ + samples: audioBuffer.getChannelData(0), + samplesPerPixel: _this.samplesPerPixel + }); + _this.recordingTrack.setCues(0, audioBuffer.duration); + _this.recordingTrack.setBuffer(audioBuffer); + _this.recordingTrack.setPlayout(new _Playout2.default(_this.ac, audioBuffer)); + _this.adjustDuration(); + }); + }; + + this.recorderWorker = new _inlineWorker2.default(_recorderWorker2.default); + // use a worker for calculating recording peaks. + this.recorderWorker.onmessage = function (e) { + _this.recordingTrack.setPeaks(e.data); + _this.draw(_this.render()); + }; + + this.recorderWorker.onerror = function (e) { + throw e; + }; + } + }, { + key: 'setShowTimeScale', + value: function setShowTimeScale(show) { + this.showTimescale = show; + } + }, { + key: 'setMono', + value: function setMono(mono) { + this.mono = mono; + } + }, { + key: 'setExclSolo', + value: function setExclSolo(exclSolo) { + this.exclSolo = exclSolo; + } + }, { + key: 'setSeekStyle', + value: function setSeekStyle(style) { + this.seekStyle = style; + } + }, { + key: 'getSeekStyle', + value: function getSeekStyle() { + return this.seekStyle; + } + }, { + key: 'setSampleRate', + value: function setSampleRate(sampleRate) { + this.sampleRate = sampleRate; + } + }, { + key: 'setSamplesPerPixel', + value: function setSamplesPerPixel(samplesPerPixel) { + this.samplesPerPixel = samplesPerPixel; + } + }, { + key: 'setAudioContext', + value: function setAudioContext(ac) { + this.ac = ac; + } + }, { + key: 'setControlOptions', + value: function setControlOptions(controlOptions) { + this.controls = controlOptions; + } + }, { + key: 'setWaveHeight', + value: function setWaveHeight(height) { + this.waveHeight = height; + } + }, { + key: 'setColors', + value: function setColors(colors) { + this.colors = colors; + } + }, { + key: 'setEventEmitter', + value: function setEventEmitter(ee) { + this.ee = ee; + } + }, { + key: 'getEventEmitter', + value: function getEventEmitter() { + return this.ee; + } + }, { + key: 'setUpEventEmitter', + value: function setUpEventEmitter() { + var _this2 = this; + + var ee = this.ee; + + ee.on('speedchange', function (speed) { + _this2.setSpeed(speed); + }); + + ee.on('loopnumber', function (number) { + _this2.setLoop(number); + }); + + ee.on('select', function (start, end, track) { + if (_this2.isPlaying()) { + _this2.lastSeeked = start; + _this2.pausedAt = undefined; + _this2.restartPlayFrom(start); + } else { + //reset if it was paused. + _this2.seek(start, end, track); + _this2.ee.emit('timeupdate', start); + _this2.draw(_this2.render()); + } + }); + + ee.on('startaudiorendering', function (type) { + _this2.startOfflineRender(type); + }); + + ee.on('statechange', function (state) { + _this2.setState(state); + _this2.draw(_this2.render()); + }); + + ee.on('shift', function (deltaTime, track) { + track.setStartTime(track.getStartTime() + deltaTime); + _this2.adjustDuration(); + _this2.draw(_this2.render()); + }); + + ee.on('record', function () { + _this2.record(); + }); + + ee.on('play', function (start, end) { + _this2.play(start, end); + }); + + ee.on('pause', function () { + _this2.pause(); + }); + + ee.on('stop', function () { + _this2.stop(); + }); + + ee.on('rewind', function () { + _this2.rewind(); + }); + + ee.on('fastforward', function () { + _this2.fastForward(); + }); + + ee.on('clear', function () { + _this2.clear().then(function () { + _this2.draw(_this2.render()); + }); + }); + + ee.on('solo', function (track) { + _this2.soloTrack(track); + _this2.adjustTrackPlayout(); + _this2.draw(_this2.render()); + }); + + ee.on('mute', function (track) { + _this2.muteTrack(track); + _this2.adjustTrackPlayout(); + _this2.draw(_this2.render()); + }); + + ee.on('volumechange', function (volume, track) { + track.setGainLevel(volume / 100); + }); + + ee.on('mastervolumechange', function (volume) { + _this2.masterGain = volume / 100; + _this2.tracks.forEach(function (track) { + track.setMasterGainLevel(_this2.masterGain); + }); + }); + + ee.on('fadein', function (duration, track) { + track.setFadeIn(duration, _this2.fadeType); + _this2.draw(_this2.render()); + }); + + ee.on('fadeout', function (duration, track) { + track.setFadeOut(duration, _this2.fadeType); + _this2.draw(_this2.render()); + }); + + ee.on('fadetype', function (type) { + _this2.fadeType = type; + }); + + ee.on('newtrack', function (file) { + _this2.load([{ + src: file, + name: file.name + }]); + }); + + ee.on('trim', function () { + var track = _this2.getActiveTrack(); + var timeSelection = _this2.getTimeSelection(); + + track.trim(timeSelection.start, timeSelection.end); + track.calculatePeaks(_this2.samplesPerPixel, _this2.sampleRate); + + _this2.setTimeSelection(0, 0); + _this2.draw(_this2.render()); + }); + + ee.on('zoomin', function () { + var zoomIndex = Math.max(0, _this2.zoomIndex - 1); + var zoom = _this2.zoomLevels[zoomIndex]; + + if (zoom !== _this2.samplesPerPixel) { + _this2.setZoom(zoom); + _this2.draw(_this2.render()); + } + }); + + ee.on('zoomout', function () { + var zoomIndex = Math.min(_this2.zoomLevels.length - 1, _this2.zoomIndex + 1); + var zoom = _this2.zoomLevels[zoomIndex]; + + if (zoom !== _this2.samplesPerPixel) { + _this2.setZoom(zoom); + _this2.draw(_this2.render()); + } + }); + + ee.on('scroll', function () { + _this2.draw(_this2.render()); + }); + } + }, { + key: 'load', + value: function load(trackList) { + var _this3 = this; + + var loadPromises = trackList.map(function (trackInfo) { + var loader = _LoaderFactory2.default.createLoader(trackInfo.src, _this3.ac, _this3.ee); + return loader.load(); + }); + + return Promise.all(loadPromises).then(function (audioBuffers) { + _this3.ee.emit('audiosourcesloaded'); + + var tracks = audioBuffers.map(function (audioBuffer, index) { + var info = trackList[index]; + var name = info.name || 'Untitled'; + var start = info.start || 0; + var states = info.states || {}; + var fadeIn = info.fadeIn; + var fadeOut = info.fadeOut; + var cueIn = info.cuein || 0; + var cueOut = info.cueout || audioBuffer.duration; + var gain = info.gain || 1; + var muted = info.muted || false; + var soloed = info.soloed || false; + var selection = info.selected; + var peaks = info.peaks || {type: 'WebAudio', mono: _this3.mono}; + var customClass = info.customClass || undefined; + var waveOutlineColor = info.waveOutlineColor || undefined; + + // webaudio specific playout for now. + var playout = new _Playout2.default(_this3.ac, audioBuffer); + + var track = new _Track2.default(); + track.src = info.src; + track.setBuffer(audioBuffer); + track.setName(name); + track.setEventEmitter(_this3.ee); + track.setEnabledStates(states); + track.setCues(cueIn, cueOut); + track.setCustomClass(customClass); + track.setWaveOutlineColor(waveOutlineColor); + + if (fadeIn !== undefined) { + track.setFadeIn(fadeIn.duration, fadeIn.shape); + } + + if (fadeOut !== undefined) { + track.setFadeOut(fadeOut.duration, fadeOut.shape); + } + + if (selection !== undefined) { + _this3.setActiveTrack(track); + _this3.setTimeSelection(selection.start, selection.end); + } + + if (peaks !== undefined) { + track.setPeakData(peaks); + } + + track.setState(_this3.getState()); + track.setStartTime(start); + track.setPlayout(playout); + track.setSpeed(1); + + track.setGainLevel(gain); + + if (muted) { + _this3.muteTrack(track); + } + + if (soloed) { + _this3.soloTrack(track); + } + + // extract peaks with AudioContext for now. + track.calculatePeaks(_this3.samplesPerPixel, _this3.sampleRate); + + return track; + }); + + _this3.tracks = _this3.tracks.concat(tracks); + _this3.adjustDuration(); + _this3.draw(_this3.render()); + + _this3.ee.emit('audiosourcesrendered'); + }); + } + + /* + track instance of Track. + */ + + }, { + key: 'setActiveTrack', + value: function setActiveTrack(track) { + this.activeTrack = track; + } + }, { + key: 'getActiveTrack', + value: function getActiveTrack() { + return this.activeTrack; + } + }, { + key: 'isSegmentSelection', + value: function isSegmentSelection() { + return this.timeSelection.start !== this.timeSelection.end; + } + + /* + start, end in seconds. + */ + + }, { + key: 'setTimeSelection', + value: function setTimeSelection() { + var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var end = arguments[1]; + + this.timeSelection = { + start: start, + end: end === undefined ? start : end + }; + + this.cursor = start; + } + }, { + key: 'startOfflineRender', + value: function startOfflineRender(type) { + var _this4 = this; + + if (this.isRendering) { + return; + } + + this.isRendering = true; + this.offlineAudioContext = new OfflineAudioContext(2, 44100 * this.duration, 44100); + + var currentTime = this.offlineAudioContext.currentTime; + + this.tracks.forEach(function (track) { + track.setOfflinePlayout(new _Playout2.default(_this4.offlineAudioContext, track.buffer)); + track.schedulePlay(currentTime, 0, 0, { + shouldPlay: _this4.shouldTrackPlay(track), + masterGain: 1, + isOffline: true + }); + }); + + /* + TODO cleanup of different audio playouts handling. + */ + this.offlineAudioContext.startRendering().then(function (audioBuffer) { + if (type === 'buffer') { + _this4.ee.emit('audiorenderingfinished', type, audioBuffer); + _this4.isRendering = false; + return; + } + + if (type === 'wav') { + _this4.exportWorker.postMessage({ + command: 'init', + config: { + sampleRate: 44100 + } + }); + + // callback for `exportWAV` + _this4.exportWorker.onmessage = function (e) { + _this4.ee.emit('audiorenderingfinished', type, e.data); + _this4.isRendering = false; + + // clear out the buffer for next renderings. + _this4.exportWorker.postMessage({ + command: 'clear' + }); + }; + + // send the channel data from our buffer to the worker + _this4.exportWorker.postMessage({ + command: 'record', + buffer: [audioBuffer.getChannelData(0), audioBuffer.getChannelData(1)] + }); + + // ask the worker for a WAV + _this4.exportWorker.postMessage({ + command: 'exportWAV', + type: 'audio/wav' + }); + } + }).catch(function (e) { + throw e; + }); + } + }, { + key: 'getTimeSelection', + value: function getTimeSelection() { + return this.timeSelection; + } + }, { + key: 'setState', + value: function setState(state) { + this.state = state; + + this.tracks.forEach(function (track) { + track.setState(state); + }); + } + }, { + key: 'getState', + value: function getState() { + return this.state; + } + }, { + key: 'setZoomIndex', + value: function setZoomIndex(index) { + this.zoomIndex = index; + } + }, { + key: 'setZoomLevels', + value: function setZoomLevels(levels) { + this.zoomLevels = levels; + } + }, { + key: 'setZoom', + value: function setZoom(zoom) { + var _this5 = this; + + this.samplesPerPixel = zoom; + this.zoomIndex = this.zoomLevels.indexOf(zoom); + this.tracks.forEach(function (track) { + track.calculatePeaks(zoom, _this5.sampleRate); + }); + } + }, { + key: 'setLoop', + value: function setLoop(number) { + this.loopNumber = number; + } + }, { + key: 'setSpeed', + value: function setSpeed(speed) { + this.speed = speed >= 0.5 && speed <= 4 ? speed : 1; + if (this.isPlaying()) this.restartPlayFrom(this.playbackSeconds); + this.ee.emit('speedchanged', this.speed); + } + }, { + key: 'muteTrack', + value: function muteTrack(track) { + var index = this.mutedTracks.indexOf(track); + + if (index > -1) { + this.mutedTracks.splice(index, 1); + } else { + this.mutedTracks.push(track); + } + } + }, { + key: 'soloTrack', + value: function soloTrack(track) { + var index = this.soloedTracks.indexOf(track); + + if (index > -1) { + this.soloedTracks.splice(index, 1); + } else if (this.exclSolo) { + this.soloedTracks = [track]; + } else { + this.soloedTracks.push(track); + } + } + }, { + key: 'adjustTrackPlayout', + value: function adjustTrackPlayout() { + var _this6 = this; + + this.tracks.forEach(function (track) { + track.setShouldPlay(_this6.shouldTrackPlay(track)); + }); + } + }, { + key: 'adjustDuration', + value: function adjustDuration() { + this.duration = this.tracks.reduce(function (duration, track) { + return Math.max(duration, track.getEndTime()); + }, 0); + } + }, { + key: 'shouldTrackPlay', + value: function shouldTrackPlay(track) { + var shouldPlay = void 0; + // if there are solo tracks, only they should play. + if (this.soloedTracks.length > 0) { + shouldPlay = false; + if (this.soloedTracks.indexOf(track) > -1) { + shouldPlay = true; + } + } else { + // play all tracks except any muted tracks. + shouldPlay = true; + if (this.mutedTracks.indexOf(track) > -1) { + shouldPlay = false; + } + } + + return shouldPlay; + } + }, { + key: 'isPlaying', + value: function isPlaying() { + return this.tracks.reduce(function (isPlaying, track) { + return isPlaying || track.isPlaying(); + }, false); + } + + /* + * returns the current point of time in the playlist in seconds. + */ + + }, { + key: 'getCurrentTime', + value: function getCurrentTime() { + var cursorPos = this.lastSeeked || this.pausedAt || this.cursor; + + return cursorPos + this.getElapsedTime(); + } + }, { + key: 'getElapsedTime', + value: function getElapsedTime() { + return this.ac.currentTime - this.lastPlay; + } + }, { + key: 'setMasterGain', + value: function setMasterGain(gain) { + this.ee.emit('mastervolumechange', gain); + } + }, { + key: 'restartPlayFrom', + value: function restartPlayFrom(start, end) { + this.stopAnimation(); + + this.tracks.forEach(function (editor) { + editor.scheduleStop(); + }); + + return Promise.all(this.playoutPromises).then(this.play.bind(this, start, end)); + } + }, { + key: 'play', + value: function play(startTime, endTime) { + var _this7 = this; + + var currentTime = this.ac.currentTime; + var selected = this.getTimeSelection(); + var playoutPromises = []; + + var start = startTime || this.pausedAt || this.cursor; + var end = endTime; + + if (!end && selected.end !== selected.start && selected.end > start) { + end = selected.end; + } + + if (this.isPlaying()) { + return this.restartPlayFrom(start, end); + } + + this.tracks.forEach(function (track) { + track.setSpeed(_this7.speed); + track.setState('cursor'); + playoutPromises.push(track.schedulePlay(currentTime, start, end, { + shouldPlay: _this7.shouldTrackPlay(track), + masterGain: _this7.masterGain + })); + }); + + this.lastPlay = currentTime; + // use these to track when the playlist has fully stopped. + this.playoutPromises = playoutPromises; + this.startAnimation(start); + + return Promise.all(this.playoutPromises); + } + }, { + key: 'pause', + value: function pause() { + if (!this.isPlaying()) { + return Promise.all(this.playoutPromises); + } + + this.pausedAt = this.getCurrentTime(); + return this.playbackReset(); + } + }, { + key: 'stop', + value: function stop() { + if (this.mediaRecorder && this.mediaRecorder.state === 'recording') { + this.mediaRecorder.stop(); + } + + this.pausedAt = undefined; + this.playbackSeconds = 0; + return this.playbackReset(); + } + }, { + key: 'playbackReset', + value: function playbackReset() { + var _this8 = this; + + this.lastSeeked = undefined; + this.stopAnimation(); + + this.tracks.forEach(function (track) { + track.scheduleStop(); + track.setState(_this8.getState()); + }); + + this.draw(this.render()); + return Promise.all(this.playoutPromises); + } + }, { + key: 'rewind', + value: function rewind() { + var _this9 = this; + + return this.stop().then(function () { + _this9.scrollLeft = 0; + _this9.ee.emit('select', 0, 0); + }); + } + }, { + key: 'fastForward', + value: function fastForward() { + var _this10 = this; + + return this.stop().then(function () { + if (_this10.viewDuration < _this10.duration) { + _this10.scrollLeft = _this10.duration - _this10.viewDuration; + } else { + _this10.scrollLeft = 0; + } + + _this10.ee.emit('select', _this10.duration, _this10.duration); + }); + } + }, { + key: 'clear', + value: function clear() { + var _this11 = this; + + return this.stop().then(function () { + _this11.tracks = []; + _this11.soloedTracks = []; + _this11.mutedTracks = []; + _this11.playoutPromises = []; + + _this11.cursor = 0; + _this11.playbackSeconds = 0; + _this11.duration = 0; + _this11.scrollLeft = 0; + + _this11.seek(0, 0, undefined); + }); + } + }, { + key: 'record', + value: function record() { + var _this12 = this; + + var playoutPromises = []; + this.mediaRecorder.start(300); + + this.tracks.forEach(function (track) { + track.setState('none'); + playoutPromises.push(track.schedulePlay(_this12.ac.currentTime, 0, undefined, { + shouldPlay: _this12.shouldTrackPlay(track) + })); + }); + + this.playoutPromises = playoutPromises; + } + }, { + key: 'startAnimation', + value: function startAnimation(startTime) { + this.lastDraw = this.ac.currentTime; + this.animationRequest = window.requestAnimationFrame(this.updateEditor.bind(this, startTime)); + } + }, { + key: 'stopAnimation', + value: function stopAnimation() { + window.cancelAnimationFrame(this.animationRequest); + this.lastDraw = undefined; + } + }, { + key: 'seek', + value: function seek(start, end, track) { + if (this.isPlaying()) { + this.lastSeeked = start; + this.pausedAt = undefined; + this.restartPlayFrom(start); + } else { + // reset if it was paused. + this.setActiveTrack(track || this.tracks[0]); + this.pausedAt = start; + this.setTimeSelection(start, end); + if (this.getSeekStyle() === 'fill') { + this.playbackSeconds = start; + } + } + } + + /* + * Animation function for the playlist. + */ + + }, { + key: 'updateEditor', + value: function updateEditor(cursor) { + var currentTime = this.ac.currentTime; + var playbackSeconds = 0; + var selection = this.getTimeSelection(); + + var cursorPos = cursor || this.cursor; + var elapsed = currentTime - this.lastDraw; + + if (this.isPlaying()) { + //console.log("speed " + this.speed); + playbackSeconds = cursorPos + elapsed * this.speed; + this.ee.emit('timeupdate', playbackSeconds); + this.animationRequest = window.requestAnimationFrame(this.updateEditor.bind(this, playbackSeconds)); + } else { + if (cursorPos + elapsed >= this.isSegmentSelection() ? selection.end : this.duration) { + if (this.loopNumber > 0) { + this.loopNumber--; + this.ee.emit('newloop', this.loopNumber); + this.restartPlayFrom(selection.start, selection.end); + } else if (this.loopNumber == -1) { + this.ee.emit('newloop', this.loopNumber); + this.restartPlayFrom(selection.start, selection.end); + } else this.ee.emit('finished'); + } + + this.stopAnimation(); + this.pausedAt = undefined; + this.lastSeeked = undefined; + this.setState(this.getState()); + } + + this.playbackSeconds = playbackSeconds; + + this.draw(this.render()); + this.lastDraw = currentTime; + } + }, { + key: 'draw', + value: function draw(newTree) { + var _this13 = this; + + window.requestAnimationFrame(function () { + var patches = (0, _diff2.default)(_this13.tree, newTree); + _this13.rootNode = (0, _patch2.default)(_this13.rootNode, patches); + _this13.tree = newTree; + + //use for fast forwarding. + _this13.viewDuration = (0, _conversions.pixelsToSeconds)(_this13.rootNode.clientWidth - _this13.controls.width, _this13.samplesPerPixel, _this13.sampleRate); + }); + } + }, { + key: 'getTrackRenderData', + value: function getTrackRenderData() { + var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var defaults = { + height: this.waveHeight, + resolution: this.samplesPerPixel, + sampleRate: this.sampleRate, + controls: this.controls, + isActive: false, + timeSelection: this.getTimeSelection(), + playlistLength: this.duration, + playbackSeconds: this.playbackSeconds, + colors: this.colors + }; + + return (0, _lodash2.default)(data, defaults); + } + }, { + key: 'isActiveTrack', + value: function isActiveTrack(track) { + var activeTrack = this.getActiveTrack(); + if (this.isSegmentSelection()) { + return activeTrack === track; + } + + return true; + } + }, { + key: 'render', + value: function render() { + var _this14 = this; + + var controlWidth = this.controls.show ? this.controls.width : 0; + var timeScale = new _TimeScale2.default(this.duration, this.scrollLeft, this.samplesPerPixel, this.sampleRate, controlWidth); + + var trackElements = this.tracks.map(function (track) { + return track.render(_this14.getTrackRenderData({ + isActive: _this14.isActiveTrack(track), + shouldPlay: _this14.shouldTrackPlay(track), + soloed: _this14.soloedTracks.indexOf(track) > -1, + muted: _this14.mutedTracks.indexOf(track) > -1 + })); + }); + + var trackSection = (0, _h2.default)('div.playlist-tracks', { + attributes: { + style: 'overflow: auto;' + }, + onscroll: function onscroll(e) { + _this14.scrollLeft = (0, _conversions.pixelsToSeconds)(e.target.scrollLeft, _this14.samplesPerPixel, _this14.sampleRate); + _this14.ee.emit('scroll', _this14.scrollLeft); + }, + hook: new _ScrollHook2.default(this, this.samplesPerPixel, this.sampleRate) + }, trackElements); + + var containerChildren = []; + + if (this.showTimescale) { + containerChildren.push(timeScale.render()); + } + + containerChildren.push(trackSection); + + return (0, _h2.default)('div.playlist', { + attributes: { + style: 'overflow: hidden; position: relative;' } - }, containerChildren); - } - }, { - key: 'getInfo', - value: function getInfo() { - var info = []; - - this.tracks.forEach(function (track) { - info.push(track.getTrackDetails()); - }); - - return info; - } - }]); - - return _class; + }, containerChildren); + } + }, { + key: 'getInfo', + value: function getInfo() { + var info = []; + + this.tracks.forEach(function (track) { + info.push(track.getTrackDetails()); + }); + + return info; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 31 */ -/***/ function(module, exports) { + /* 31 */ + /***/ function (module, exports) { /** - * lodash (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - + + /** Used as references for various `Number` constants. */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -2522,11 +2554,11 @@ var WaveformPlaylist = * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. + * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { - switch (args.length) { + switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); @@ -2534,72 +2566,71 @@ var WaveformPlaylist = } return func.apply(thisArg, args); } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + /** Used for built-in method references. */ var objectProto = Object.prototype; - + /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var objectToString = objectProto.toString; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeMax = Math.max; - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; - - var length = result.length, - skipIndexes = !!length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } - } - return result; - } - + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var objectToString = objectProto.toString; + + /** Built-in value references. */ + var propertyIsEnumerable = objectProto.propertyIsEnumerable; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max; + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; + } + /** * Used by `_.defaults` to customize its `_.assignIn` use. * @@ -2617,10 +2648,10 @@ var WaveformPlaylist = } return objValue; } - + /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -2635,58 +2666,58 @@ var WaveformPlaylist = object[key] = value; } } - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - + /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. */ - function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function () { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); }; } - + /** * Copies properties of `source` to `object`. * @@ -2699,22 +2730,22 @@ var WaveformPlaylist = */ function copyObject(source, props, object, customizer) { object || (object = {}); - + var index = -1, length = props.length; - + while (++index < length) { var key = props[index]; - + var newValue = customizer ? customizer(object[key], source[key], key, object, source) - : undefined; - - assignValue(object, key, newValue === undefined ? source[key] : newValue); + : undefined; + + assignValue(object, key, newValue === undefined ? source[key] : newValue); } return object; } - + /** * Creates a function like `_.assign`. * @@ -2723,16 +2754,16 @@ var WaveformPlaylist = * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { - return baseRest(function(object, sources) { + return baseRest(function (object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - + customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; - + if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; @@ -2747,7 +2778,7 @@ var WaveformPlaylist = return object; }); } - + /** * Checks if `value` is a valid array-like index. * @@ -2762,7 +2793,7 @@ var WaveformPlaylist = (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } - + /** * Checks if the given arguments are from an iteratee call. * @@ -2786,43 +2817,43 @@ var WaveformPlaylist = } return false; } - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - + + /** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; + } + + /** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; + } + /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -2834,8 +2865,8 @@ var WaveformPlaylist = * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; * * _.eq(object, object); * // => true @@ -2855,7 +2886,7 @@ var WaveformPlaylist = function eq(value, other) { return value === other || (value !== value && other !== other); } - + /** * Checks if `value` is likely an `arguments` object. * @@ -2864,7 +2895,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * @@ -2875,11 +2906,11 @@ var WaveformPlaylist = * // => false */ function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } - + /** * Checks if `value` is classified as an `Array` object. * @@ -2888,7 +2919,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); @@ -2904,7 +2935,7 @@ var WaveformPlaylist = * // => false */ var isArray = Array.isArray; - + /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -2931,9 +2962,9 @@ var WaveformPlaylist = * // => false */ function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } - + /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. @@ -2962,7 +2993,7 @@ var WaveformPlaylist = function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } - + /** * Checks if `value` is classified as a `Function` object. * @@ -2971,7 +3002,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -2982,23 +3013,23 @@ var WaveformPlaylist = */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } - + /** * Checks if `value` is a valid array-like length. * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -3017,10 +3048,10 @@ var WaveformPlaylist = return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } - + /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -3047,7 +3078,7 @@ var WaveformPlaylist = var type = typeof value; return !!value && (type == 'object' || type == 'function'); } - + /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". @@ -3075,66 +3106,66 @@ var WaveformPlaylist = function isObjectLike(value) { return !!value && typeof value == 'object'; } - + /** - * This method is like `_.assignIn` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignWith - * @example - * - * function customizer(objValue, srcValue) { + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); - }); - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function (object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. * * @static * @since 0.1.0 * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep * @example * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } */ - var defaults = baseRest(function(args) { - args.push(undefined, assignInDefaults); - return apply(assignInWith, undefined, args); - }); - + var defaults = baseRest(function (args) { + args.push(undefined, assignInDefaults); + return apply(assignInWith, undefined, args); + }); + /** * Creates an array of the own and inherited enumerable property names of `object`. * @@ -3159,67 +3190,67 @@ var WaveformPlaylist = * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } - - module.exports = defaults; + + module.exports = defaults; /***/ }, -/* 32 */ + /* 32 */ /***/ function(module, exports, __webpack_require__) { - var h = __webpack_require__(33) - + var h = __webpack_require__(33) + module.exports = h /***/ }, -/* 33 */ + /* 33 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var isArray = __webpack_require__(34); - - var VNode = __webpack_require__(35); - var VText = __webpack_require__(36); - var isVNode = __webpack_require__(9); - var isVText = __webpack_require__(11); - var isWidget = __webpack_require__(12); - var isHook = __webpack_require__(8); - var isVThunk = __webpack_require__(14); - - var parseTag = __webpack_require__(37); - var softSetHook = __webpack_require__(39); - var evHook = __webpack_require__(40); - + + var isArray = __webpack_require__(34); + + var VNode = __webpack_require__(35); + var VText = __webpack_require__(36); + var isVNode = __webpack_require__(9); + var isVText = __webpack_require__(11); + var isWidget = __webpack_require__(12); + var isHook = __webpack_require__(8); + var isVThunk = __webpack_require__(14); + + var parseTag = __webpack_require__(37); + var softSetHook = __webpack_require__(39); + var evHook = __webpack_require__(40); + module.exports = h; - + function h(tagName, properties, children) { var childNodes = []; var tag, props, key, namespace; - + if (!children && isChildren(properties)) { children = properties; props = {}; } - + props = props || properties || {}; tag = parseTag(tagName, props); - + // support keys if (props.hasOwnProperty('key')) { key = props.key; props.key = undefined; } - + // support namespace if (props.hasOwnProperty('namespace')) { namespace = props.namespace; props.namespace = undefined; } - + // fix cursor bug if (tag === 'INPUT' && !namespace && @@ -3229,17 +3260,17 @@ var WaveformPlaylist = ) { props.value = softSetHook(props.value); } - + transformProperties(props); - + if (children !== undefined && children !== null) { addChild(children, childNodes, tag, props); } - - - return new VNode(tag, props, childNodes, key, namespace); + + + return new VNode(tag, props, childNodes, key, namespace); } - + function addChild(c, childNodes, tag, props) { if (typeof c === 'string') { childNodes.push(new VText(c)); @@ -3263,16 +3294,16 @@ var WaveformPlaylist = }); } } - + function transformProperties(props) { for (var propName in props) { if (props.hasOwnProperty(propName)) { var value = props[propName]; - + if (isHook(value)) { continue; } - + if (propName.substr(0, 3) === 'ev-') { // add ev-foo support props[propName] = evHook(value); @@ -3280,18 +3311,18 @@ var WaveformPlaylist = } } } - + function isChild(x) { return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x); } - + function isChildren(x) { return typeof x === 'string' || isArray(x) || isChild(x); } - + function UnexpectedVirtualElement(data) { var err = new Error(); - + err.type = 'virtual-hyperscript.unexpected.virtual-element'; err.message = 'Unexpected virtual child passed to h().\n' + 'Expected a VNode / Vthunk / VWidget / string but:\n' + @@ -3304,10 +3335,10 @@ var WaveformPlaylist = 'Suggested fix: change your `h(..., [ ... ])` callsite.'; err.foreignObject = data.foreignObject; err.parentVnode = data.parentVnode; - + return err; } - + function errorString(obj) { try { return JSON.stringify(obj, null, ' '); @@ -3318,48 +3349,48 @@ var WaveformPlaylist = /***/ }, -/* 34 */ + /* 34 */ /***/ function(module, exports) { var nativeIsArray = Array.isArray var toString = Object.prototype.toString - + module.exports = nativeIsArray || isArray - + function isArray(obj) { return toString.call(obj) === "[object Array]" } /***/ }, -/* 35 */ + /* 35 */ /***/ function(module, exports, __webpack_require__) { - var version = __webpack_require__(10) - var isVNode = __webpack_require__(9) - var isWidget = __webpack_require__(12) - var isThunk = __webpack_require__(14) - var isVHook = __webpack_require__(8) - + var version = __webpack_require__(10) + var isVNode = __webpack_require__(9) + var isWidget = __webpack_require__(12) + var isThunk = __webpack_require__(14) + var isVHook = __webpack_require__(8) + module.exports = VirtualNode - + var noProperties = {} var noChildren = [] - + function VirtualNode(tagName, properties, children, key, namespace) { this.tagName = tagName this.properties = properties || noProperties this.children = children || noChildren this.key = key != null ? String(key) : undefined this.namespace = (typeof namespace === "string") ? namespace : null - + var count = (children && children.length) || 0 var descendants = 0 var hasWidgets = false var hasThunks = false var descendantHooks = false var hooks - + for (var propName in properties) { if (properties.hasOwnProperty(propName)) { var property = properties[propName] @@ -3367,25 +3398,25 @@ var WaveformPlaylist = if (!hooks) { hooks = {} } - + hooks[propName] = property } } } - + for (var i = 0; i < count; i++) { var child = children[i] if (isVNode(child)) { descendants += child.count || 0 - + if (!hasWidgets && child.hasWidgets) { hasWidgets = true } - + if (!hasThunks && child.hasThunks) { hasThunks = true } - + if (!descendantHooks && (child.hooks || child.descendantHooks)) { descendantHooks = true } @@ -3397,72 +3428,72 @@ var WaveformPlaylist = hasThunks = true; } } - + this.count = count + descendants this.hasWidgets = hasWidgets this.hasThunks = hasThunks this.hooks = hooks this.descendantHooks = descendantHooks } - + VirtualNode.prototype.version = version VirtualNode.prototype.type = "VirtualNode" /***/ }, -/* 36 */ + /* 36 */ /***/ function(module, exports, __webpack_require__) { - var version = __webpack_require__(10) - + var version = __webpack_require__(10) + module.exports = VirtualText - + function VirtualText(text) { this.text = String(text) } - + VirtualText.prototype.version = version VirtualText.prototype.type = "VirtualText" /***/ }, -/* 37 */ + /* 37 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var split = __webpack_require__(38); - + + var split = __webpack_require__(38); + var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/; var notClassId = /^\.|#/; - + module.exports = parseTag; - + function parseTag(tag, props) { if (!tag) { return 'DIV'; } - + var noId = !(props.hasOwnProperty('id')); - + var tagParts = split(tag, classIdSplit); var tagName = null; - + if (notClassId.test(tagParts[1])) { tagName = 'DIV'; } - + var classes, part, type, i; - + for (i = 0; i < tagParts.length; i++) { part = tagParts[i]; - + if (!part) { continue; } - + type = part.charAt(0); - + if (!tagName) { tagName = part; } else if (type === '.') { @@ -3472,21 +3503,21 @@ var WaveformPlaylist = props.id = part.substring(1, part.length); } } - + if (classes) { if (props.className) { classes.push(props.className); } - + props.className = classes.join(' '); } - + return props.namespace ? tagName : tagName.toUpperCase(); } /***/ }, -/* 38 */ + /* 38 */ /***/ function(module, exports) { /*! @@ -3495,7 +3526,7 @@ var WaveformPlaylist = * Available under the MIT License * ECMAScript compliant, uniform cross-browser split method */ - + /** * Splits a string into an array of strings using a regex or string separator. Matches of the * separator are not included in the result array. However, if `separator` is a regex that contains @@ -3521,12 +3552,12 @@ var WaveformPlaylist = * // -> ['..', 'word', '1', ' ', 'word', '2', '..'] */ module.exports = (function split(undef) { - + var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group self; - + self = function(str, separator, limit) { // If `separator` is not a regex, use `nativeSplit` if (Object.prototype.toString.call(separator) !== "[object RegExp]") { @@ -3592,27 +3623,27 @@ var WaveformPlaylist = } return output.length > limit ? output.slice(0, limit) : output; }; - + return self; })(); /***/ }, -/* 39 */ + /* 39 */ /***/ function(module, exports) { 'use strict'; - + module.exports = SoftSetHook; - + function SoftSetHook(value) { if (!(this instanceof SoftSetHook)) { return new SoftSetHook(value); } - + this.value = value; } - + SoftSetHook.prototype.hook = function (node, propertyName) { if (node[propertyName] !== this.value) { node[propertyName] = this.value; @@ -3621,80 +3652,80 @@ var WaveformPlaylist = /***/ }, -/* 40 */ + /* 40 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var EvStore = __webpack_require__(41); - + + var EvStore = __webpack_require__(41); + module.exports = EvHook; - + function EvHook(value) { if (!(this instanceof EvHook)) { return new EvHook(value); } - + this.value = value; } - + EvHook.prototype.hook = function (node, propertyName) { var es = EvStore(node); var propName = propertyName.substr(3); - + es[propName] = this.value; }; - + EvHook.prototype.unhook = function(node, propertyName) { var es = EvStore(node); var propName = propertyName.substr(3); - + es[propName] = undefined; }; /***/ }, -/* 41 */ + /* 41 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var OneVersionConstraint = __webpack_require__(42); - + + var OneVersionConstraint = __webpack_require__(42); + var MY_VERSION = '7'; OneVersionConstraint('ev-store', MY_VERSION); - + var hashKey = '__EV_STORE_KEY@' + MY_VERSION; - + module.exports = EvStore; - + function EvStore(elem) { var hash = elem[hashKey]; - + if (!hash) { hash = elem[hashKey] = {}; } - + return hash; } /***/ }, -/* 42 */ + /* 42 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - var Individual = __webpack_require__(43); - + + var Individual = __webpack_require__(43); + module.exports = OneVersion; - + function OneVersion(moduleName, version, defaultValue) { var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName; var enforceKey = key + '_ENFORCE_SINGLETON'; - + var versionValue = Individual(enforceKey, version); - + if (versionValue !== version) { throw new Error('Can only have one copy of ' + moduleName + '.\n' + @@ -3702,90 +3733,90 @@ var WaveformPlaylist = ' installed.\n' + 'This means you cannot install version ' + version); } - - return Individual(key, defaultValue); + + return Individual(key, defaultValue); } /***/ }, -/* 43 */ + /* 43 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - /*global window, global*/ - - var root = typeof window !== 'undefined' ? + + /*global window, global*/ + + var root = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; - - module.exports = Individual; - - function Individual(key, value) { + + module.exports = Individual; + + function Individual(key, value) { if (key in root) { return root[key]; } - - root[key] = value; - - return value; + + root[key] = value; + + return value; } - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, -/* 44 */ + /* 44 */ /***/ function(module, exports, __webpack_require__) { - var diff = __webpack_require__(45) - + var diff = __webpack_require__(45) + module.exports = diff /***/ }, -/* 45 */ + /* 45 */ /***/ function(module, exports, __webpack_require__) { - var isArray = __webpack_require__(34) - - var VPatch = __webpack_require__(46) - var isVNode = __webpack_require__(9) - var isVText = __webpack_require__(11) - var isWidget = __webpack_require__(12) - var isThunk = __webpack_require__(14) - var handleThunk = __webpack_require__(13) - - var diffProps = __webpack_require__(47) - + var isArray = __webpack_require__(34) + + var VPatch = __webpack_require__(46) + var isVNode = __webpack_require__(9) + var isVText = __webpack_require__(11) + var isWidget = __webpack_require__(12) + var isThunk = __webpack_require__(14) + var handleThunk = __webpack_require__(13) + + var diffProps = __webpack_require__(47) + module.exports = diff - - function diff(a, b) { + + function diff(a, b) { var patch = { a: a } walk(a, b, patch, 0) return patch } - - function walk(a, b, patch, index) { + + function walk(a, b, patch, index) { if (a === b) { return } - - var apply = patch[index] + + var apply = patch[index] var applyClear = false - - if (isThunk(a) || isThunk(b)) { + + if (isThunk(a) || isThunk(b)) { thunks(a, b, patch, index) } else if (b == null) { - - // If a is a widget we will add a remove patch for it + + // If a is a widget we will add a remove patch for it // Otherwise any child widgets/hooks must be destroyed. // This prevents adding two remove patches for a widget. if (!isWidget(a)) { clearState(a, patch, index) apply = patch[index] } - - apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b)) + + apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b)) } else if (isVNode(b)) { if (isVNode(a)) { if (a.tagName === b.tagName && @@ -3816,34 +3847,34 @@ var WaveformPlaylist = if (!isWidget(a)) { applyClear = true } - - apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b)) + + apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b)) } - - if (apply) { + + if (apply) { patch[index] = apply } - - if (applyClear) { + + if (applyClear) { clearState(a, patch, index) } } - - function diffChildren(a, b, patch, apply, index) { + + function diffChildren(a, b, patch, apply, index) { var aChildren = a.children var orderedSet = reorder(aChildren, b.children) var bChildren = orderedSet.children - - var aLen = aChildren.length + + var aLen = aChildren.length var bLen = bChildren.length var len = aLen > bLen ? aLen : bLen - - for (var i = 0; i < len; i++) { + + for (var i = 0; i < len; i++) { var leftNode = aChildren[i] var rightNode = bChildren[i] index += 1 - - if (!leftNode) { + + if (!leftNode) { if (rightNode) { // Excess nodes in b need to be added apply = appendPatch(apply, @@ -3852,13 +3883,13 @@ var WaveformPlaylist = } else { walk(leftNode, rightNode, patch, index) } - - if (isVNode(leftNode) && leftNode.count) { + + if (isVNode(leftNode) && leftNode.count) { index += leftNode.count } } - - if (orderedSet.moves) { + + if (orderedSet.moves) { // Reorder nodes last apply = appendPatch(apply, new VPatch( VPatch.ORDER, @@ -3866,17 +3897,17 @@ var WaveformPlaylist = orderedSet.moves )) } - - return apply + + return apply } - - function clearState(vNode, patch, index) { + + function clearState(vNode, patch, index) { // TODO: Make this a single walk, not two unhook(vNode, patch, index) destroyWidgets(vNode, patch, index) } - - // Patch records for all destroyed widgets must be added because we need + + // Patch records for all destroyed widgets must be added because we need // a DOM node reference for the destroy function function destroyWidgets(vNode, patch, index) { if (isWidget(vNode)) { @@ -3892,10 +3923,10 @@ var WaveformPlaylist = for (var i = 0; i < len; i++) { var child = children[i] index += 1 - - destroyWidgets(child, patch, index) - - if (isVNode(child) && child.count) { + + destroyWidgets(child, patch, index) + + if (isVNode(child) && child.count) { index += child.count } } @@ -3903,8 +3934,8 @@ var WaveformPlaylist = thunks(vNode, null, patch, index) } } - - // Create a sub-patch for thunks + + // Create a sub-patch for thunks function thunks(a, b, patch, index) { var nodes = handleThunk(a, b) var thunkPatch = diff(nodes.a, nodes.b) @@ -3912,18 +3943,18 @@ var WaveformPlaylist = patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch) } } - - function hasPatches(patch) { + + function hasPatches(patch) { for (var index in patch) { if (index !== "a") { return true } } - - return false + + return false } - - // Execute hooks when two nodes are identical + + // Execute hooks when two nodes are identical function unhook(vNode, patch, index) { if (isVNode(vNode)) { if (vNode.hooks) { @@ -3936,17 +3967,17 @@ var WaveformPlaylist = ) ) } - - if (vNode.descendantHooks || vNode.hasThunks) { + + if (vNode.descendantHooks || vNode.hasThunks) { var children = vNode.children var len = children.length for (var i = 0; i < len; i++) { var child = children[i] index += 1 - - unhook(child, patch, index) - - if (isVNode(child) && child.count) { + + unhook(child, patch, index) + + if (isVNode(child) && child.count) { index += child.count } } @@ -3955,63 +3986,63 @@ var WaveformPlaylist = thunks(vNode, null, patch, index) } } - - function undefinedKeys(obj) { + + function undefinedKeys(obj) { var result = {} - - for (var key in obj) { + + for (var key in obj) { result[key] = undefined } - - return result + + return result } - - // List diff, naive left to right reordering + + // List diff, naive left to right reordering function reorder(aChildren, bChildren) { // O(M) time, O(M) memory var bChildIndex = keyIndex(bChildren) var bKeys = bChildIndex.keys var bFree = bChildIndex.free - - if (bFree.length === bChildren.length) { + + if (bFree.length === bChildren.length) { return { children: bChildren, moves: null } } - - // O(N) time, O(N) memory + + // O(N) time, O(N) memory var aChildIndex = keyIndex(aChildren) var aKeys = aChildIndex.keys var aFree = aChildIndex.free - - if (aFree.length === aChildren.length) { + + if (aFree.length === aChildren.length) { return { children: bChildren, moves: null } } - - // O(MAX(N, M)) memory + + // O(MAX(N, M)) memory var newChildren = [] - - var freeIndex = 0 + + var freeIndex = 0 var freeCount = bFree.length var deletedItems = 0 - - // Iterate through a and match a node in b + + // Iterate through a and match a node in b // O(N) time, for (var i = 0 ; i < aChildren.length; i++) { var aItem = aChildren[i] var itemIndex - - if (aItem.key) { + + if (aItem.key) { if (bKeys.hasOwnProperty(aItem.key)) { // Match up the old keys itemIndex = bKeys[aItem.key] newChildren.push(bChildren[itemIndex]) - - } else { + + } else { // Remove old keyed items itemIndex = i - deletedItems++ newChildren.push(null) @@ -4030,17 +4061,17 @@ var WaveformPlaylist = } } } - - var lastFreeIndex = freeIndex >= bFree.length ? + + var lastFreeIndex = freeIndex >= bFree.length ? bChildren.length : bFree[freeIndex] - - // Iterate through b and append any new keys + + // Iterate through b and append any new keys // O(M) time for (var j = 0; j < bChildren.length; j++) { var newItem = bChildren[j] - - if (newItem.key) { + + if (newItem.key) { if (!aKeys.hasOwnProperty(newItem.key)) { // Add any new keyed items // We are adding new items to the end and then sorting them @@ -4052,24 +4083,24 @@ var WaveformPlaylist = newChildren.push(newItem) } } - - var simulate = newChildren.slice() + + var simulate = newChildren.slice() var simulateIndex = 0 var removes = [] var inserts = [] var simulateItem - - for (var k = 0; k < bChildren.length;) { + + for (var k = 0; k < bChildren.length;) { var wantedItem = bChildren[k] simulateItem = simulate[simulateIndex] - - // remove items + + // remove items while (simulateItem === null && simulate.length) { removes.push(remove(simulate, simulateIndex, null)) simulateItem = simulate[simulateIndex] } - - if (!simulateItem || simulateItem.key !== wantedItem.key) { + + if (!simulateItem || simulateItem.key !== wantedItem.key) { // if we need a key in this position... if (wantedItem.key) { if (simulateItem && simulateItem.key) { @@ -4105,14 +4136,14 @@ var WaveformPlaylist = k++ } } - - // remove all the remaining nodes from simulate + + // remove all the remaining nodes from simulate while(simulateIndex < simulate.length) { simulateItem = simulate[simulateIndex] removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key)) } - - // If the only moves we have are deletes then we can just + + // If the only moves we have are deletes then we can just // let the delete patch remove these items. if (removes.length === deletedItems && !inserts.length) { return { @@ -4120,8 +4151,8 @@ var WaveformPlaylist = moves: null } } - - return { + + return { children: newChildren, moves: { removes: removes, @@ -4129,46 +4160,46 @@ var WaveformPlaylist = } } } - - function remove(arr, index, key) { + + function remove(arr, index, key) { arr.splice(index, 1) - - return { + + return { from: index, key: key } } - - function keyIndex(children) { + + function keyIndex(children) { var keys = {} var free = [] var length = children.length - - for (var i = 0; i < length; i++) { + + for (var i = 0; i < length; i++) { var child = children[i] - - if (child.key) { + + if (child.key) { keys[child.key] = i } else { free.push(i) } } - - return { + + return { keys: keys, // A hash of key name to index free: free // An array of unkeyed item indices } } - - function appendPatch(apply, patch) { + + function appendPatch(apply, patch) { if (apply) { if (isArray(apply)) { apply.push(patch) } else { apply = [apply, patch] } - - return apply + + return apply } else { return patch } @@ -4176,11 +4207,11 @@ var WaveformPlaylist = /***/ }, -/* 46 */ + /* 46 */ /***/ function(module, exports, __webpack_require__) { - var version = __webpack_require__(10) - + var version = __webpack_require__(10) + VirtualPatch.NONE = 0 VirtualPatch.VTEXT = 1 VirtualPatch.VNODE = 2 @@ -4190,41 +4221,41 @@ var WaveformPlaylist = VirtualPatch.INSERT = 6 VirtualPatch.REMOVE = 7 VirtualPatch.THUNK = 8 - - module.exports = VirtualPatch - - function VirtualPatch(type, vNode, patch) { + + module.exports = VirtualPatch + + function VirtualPatch(type, vNode, patch) { this.type = Number(type) this.vNode = vNode this.patch = patch } - - VirtualPatch.prototype.version = version + + VirtualPatch.prototype.version = version VirtualPatch.prototype.type = "VirtualPatch" /***/ }, -/* 47 */ + /* 47 */ /***/ function(module, exports, __webpack_require__) { - var isObject = __webpack_require__(7) - var isHook = __webpack_require__(8) - + var isObject = __webpack_require__(7) + var isHook = __webpack_require__(8) + module.exports = diffProps - - function diffProps(a, b) { + + function diffProps(a, b) { var diff - - for (var aKey in a) { + + for (var aKey in a) { if (!(aKey in b)) { diff = diff || {} diff[aKey] = undefined } - - var aValue = a[aKey] + + var aValue = a[aKey] var bValue = b[aKey] - - if (aValue === bValue) { + + if (aValue === bValue) { continue } else if (isObject(aValue) && isObject(bValue)) { if (getPrototype(bValue) !== getPrototype(aValue)) { @@ -4245,18 +4276,18 @@ var WaveformPlaylist = diff[aKey] = bValue } } - - for (var bKey in b) { + + for (var bKey in b) { if (!(bKey in a)) { diff = diff || {} diff[bKey] = b[bKey] } } - - return diff + + return diff } - - function getPrototype(value) { + + function getPrototype(value) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(value) } else if (value.__proto__) { @@ -4268,102 +4299,102 @@ var WaveformPlaylist = /***/ }, -/* 48 */ + /* 48 */ /***/ function(module, exports, __webpack_require__) { - var patch = __webpack_require__(49) - + var patch = __webpack_require__(49) + module.exports = patch /***/ }, -/* 49 */ + /* 49 */ /***/ function(module, exports, __webpack_require__) { - var document = __webpack_require__(4) - var isArray = __webpack_require__(34) - - var render = __webpack_require__(3) - var domIndex = __webpack_require__(50) - var patchOp = __webpack_require__(51) + var document = __webpack_require__(4) + var isArray = __webpack_require__(34) + + var render = __webpack_require__(3) + var domIndex = __webpack_require__(50) + var patchOp = __webpack_require__(51) module.exports = patch - - function patch(rootNode, patches, renderOptions) { + + function patch(rootNode, patches, renderOptions) { renderOptions = renderOptions || {} renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch ? renderOptions.patch : patchRecursive renderOptions.render = renderOptions.render || render - - return renderOptions.patch(rootNode, patches, renderOptions) + + return renderOptions.patch(rootNode, patches, renderOptions) } - - function patchRecursive(rootNode, patches, renderOptions) { + + function patchRecursive(rootNode, patches, renderOptions) { var indices = patchIndices(patches) - - if (indices.length === 0) { + + if (indices.length === 0) { return rootNode } - - var index = domIndex(rootNode, patches.a, indices) + + var index = domIndex(rootNode, patches.a, indices) var ownerDocument = rootNode.ownerDocument - - if (!renderOptions.document && ownerDocument !== document) { + + if (!renderOptions.document && ownerDocument !== document) { renderOptions.document = ownerDocument } - - for (var i = 0; i < indices.length; i++) { + + for (var i = 0; i < indices.length; i++) { var nodeIndex = indices[i] rootNode = applyPatch(rootNode, index[nodeIndex], patches[nodeIndex], renderOptions) } - - return rootNode + + return rootNode } - - function applyPatch(rootNode, domNode, patchList, renderOptions) { + + function applyPatch(rootNode, domNode, patchList, renderOptions) { if (!domNode) { return rootNode } - - var newNode - - if (isArray(patchList)) { + + var newNode + + if (isArray(patchList)) { for (var i = 0; i < patchList.length; i++) { newNode = patchOp(patchList[i], domNode, renderOptions) - - if (domNode === rootNode) { + + if (domNode === rootNode) { rootNode = newNode } } } else { newNode = patchOp(patchList, domNode, renderOptions) - - if (domNode === rootNode) { + + if (domNode === rootNode) { rootNode = newNode } } - - return rootNode + + return rootNode } - - function patchIndices(patches) { + + function patchIndices(patches) { var indices = [] - - for (var key in patches) { + + for (var key in patches) { if (key !== "a") { indices.push(Number(key)) } } - - return indices + + return indices } /***/ }, -/* 50 */ + /* 50 */ /***/ function(module, exports) { // Maps a virtual DOM tree onto a real DOM tree in an efficient manner. @@ -4371,12 +4402,12 @@ var WaveformPlaylist = // the in-order tree indexing to eliminate recursion down certain branches. // We only recurse into a DOM node if we know that it contains a child of // interest. - - var noChild = {} - - module.exports = domIndex - - function domIndex(rootNode, tree, indices, nodes) { + + var noChild = {} + + module.exports = domIndex + + function domIndex(rootNode, tree, indices, nodes) { if (!indices || indices.length === 0) { return {} } else { @@ -4384,57 +4415,57 @@ var WaveformPlaylist = return recurse(rootNode, tree, indices, nodes, 0) } } - - function recurse(rootNode, tree, indices, nodes, rootIndex) { + + function recurse(rootNode, tree, indices, nodes, rootIndex) { nodes = nodes || {} - - - if (rootNode) { + + + if (rootNode) { if (indexInRange(indices, rootIndex, rootIndex)) { nodes[rootIndex] = rootNode } - - var vChildren = tree.children - - if (vChildren) { - - var childNodes = rootNode.childNodes - - for (var i = 0; i < tree.children.length; i++) { + + var vChildren = tree.children + + if (vChildren) { + + var childNodes = rootNode.childNodes + + for (var i = 0; i < tree.children.length; i++) { rootIndex += 1 - - var vChild = vChildren[i] || noChild + + var vChild = vChildren[i] || noChild var nextIndex = rootIndex + (vChild.count || 0) - - // skip recursion down the tree if there are no nodes down here + + // skip recursion down the tree if there are no nodes down here if (indexInRange(indices, rootIndex, nextIndex)) { recurse(childNodes[i], vChild, indices, nodes, rootIndex) } - - rootIndex = nextIndex + + rootIndex = nextIndex } } } - - return nodes + + return nodes } - - // Binary search for an index in the interval [left, right] + + // Binary search for an index in the interval [left, right] function indexInRange(indices, left, right) { if (indices.length === 0) { return false } - - var minIndex = 0 + + var minIndex = 0 var maxIndex = indices.length - 1 var currentIndex var currentItem - - while (minIndex <= maxIndex) { + + while (minIndex <= maxIndex) { currentIndex = ((maxIndex + minIndex) / 2) >> 0 currentItem = indices[currentIndex] - - if (minIndex === maxIndex) { + + if (minIndex === maxIndex) { return currentItem >= left && currentItem <= right } else if (currentItem < left) { minIndex = currentIndex + 1 @@ -4444,34 +4475,34 @@ var WaveformPlaylist = return true } } - - return false; + + return false; } - - function ascending(a, b) { + + function ascending(a, b) { return a > b ? 1 : -1 } /***/ }, -/* 51 */ + /* 51 */ /***/ function(module, exports, __webpack_require__) { - var applyProperties = __webpack_require__(6) - - var isWidget = __webpack_require__(12) - var VPatch = __webpack_require__(46) - - var updateWidget = __webpack_require__(52) - + var applyProperties = __webpack_require__(6) + + var isWidget = __webpack_require__(12) + var VPatch = __webpack_require__(46) + + var updateWidget = __webpack_require__(52) + module.exports = applyPatch - - function applyPatch(vpatch, domNode, renderOptions) { + + function applyPatch(vpatch, domNode, renderOptions) { var type = vpatch.type var vNode = vpatch.vNode var patch = vpatch.patch - - switch (type) { + + switch (type) { case VPatch.REMOVE: return removeNode(domNode, vNode) case VPatch.INSERT: @@ -4495,95 +4526,95 @@ var WaveformPlaylist = return domNode } } - - function removeNode(domNode, vNode) { + + function removeNode(domNode, vNode) { var parentNode = domNode.parentNode - - if (parentNode) { + + if (parentNode) { parentNode.removeChild(domNode) } - - destroyWidget(domNode, vNode); - - return null + + destroyWidget(domNode, vNode); + + return null } - - function insertNode(parentNode, vNode, renderOptions) { + + function insertNode(parentNode, vNode, renderOptions) { var newNode = renderOptions.render(vNode, renderOptions) - - if (parentNode) { + + if (parentNode) { parentNode.appendChild(newNode) } - - return parentNode + + return parentNode } - - function stringPatch(domNode, leftVNode, vText, renderOptions) { + + function stringPatch(domNode, leftVNode, vText, renderOptions) { var newNode - - if (domNode.nodeType === 3) { + + if (domNode.nodeType === 3) { domNode.replaceData(0, domNode.length, vText.text) newNode = domNode } else { var parentNode = domNode.parentNode newNode = renderOptions.render(vText, renderOptions) - - if (parentNode && newNode !== domNode) { + + if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } } - - return newNode + + return newNode } - - function widgetPatch(domNode, leftVNode, widget, renderOptions) { + + function widgetPatch(domNode, leftVNode, widget, renderOptions) { var updating = updateWidget(leftVNode, widget) var newNode - - if (updating) { + + if (updating) { newNode = widget.update(leftVNode, domNode) || domNode } else { newNode = renderOptions.render(widget, renderOptions) } - - var parentNode = domNode.parentNode - - if (parentNode && newNode !== domNode) { + + var parentNode = domNode.parentNode + + if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } - - if (!updating) { + + if (!updating) { destroyWidget(domNode, leftVNode) } - - return newNode + + return newNode } - - function vNodePatch(domNode, leftVNode, vNode, renderOptions) { + + function vNodePatch(domNode, leftVNode, vNode, renderOptions) { var parentNode = domNode.parentNode var newNode = renderOptions.render(vNode, renderOptions) - - if (parentNode && newNode !== domNode) { + + if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } - - return newNode + + return newNode } - - function destroyWidget(domNode, w) { + + function destroyWidget(domNode, w) { if (typeof w.destroy === "function" && isWidget(w)) { w.destroy(domNode) } } - - function reorderChildren(domNode, moves) { + + function reorderChildren(domNode, moves) { var childNodes = domNode.childNodes var keyMap = {} var node var remove var insert - - for (var i = 0; i < moves.removes.length; i++) { + + for (var i = 0; i < moves.removes.length; i++) { remove = moves.removes[i] node = childNodes[remove.from] if (remove.key) { @@ -4591,8 +4622,8 @@ var WaveformPlaylist = } domNode.removeChild(node) } - - var length = childNodes.length + + var length = childNodes.length for (var j = 0; j < moves.inserts.length; j++) { insert = moves.inserts[j] node = keyMap[insert.key] @@ -4600,25 +4631,25 @@ var WaveformPlaylist = domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to]) } } - - function replaceRoot(oldRoot, newRoot) { + + function replaceRoot(oldRoot, newRoot) { if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) { oldRoot.parentNode.replaceChild(newRoot, oldRoot) } - - return newRoot; + + return newRoot; } /***/ }, -/* 52 */ + /* 52 */ /***/ function(module, exports, __webpack_require__) { - var isWidget = __webpack_require__(12) - + var isWidget = __webpack_require__(12) + module.exports = updateWidget - - function updateWidget(a, b) { + + function updateWidget(a, b) { if (isWidget(a) && isWidget(b)) { if ("name" in a && "name" in b) { return a.id === b.id @@ -4626,65 +4657,71 @@ var WaveformPlaylist = return a.init === b.init } } - - return false + + return false } /***/ }, -/* 53 */ + /* 53 */ /***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(global) {var WORKER_ENABLED = !!(global === global.window && global.URL && global.Blob && global.Worker); - - function InlineWorker(func, self) { - var _this = this; - var functionBody; - - self = self || {}; - - if (WORKER_ENABLED) { - functionBody = func.toString().trim().match( - /^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/ - )[1]; - - return new global.Worker(global.URL.createObjectURL( - new global.Blob([ functionBody ], { type: "text/javascript" }) - )); - } - - function postMessage(data) { - setTimeout(function() { - _this.onmessage({ data: data }); - }, 0); - } - - this.self = self; - this.self.postMessage = postMessage; - - setTimeout(func.bind(self, self), 0); - } - - InlineWorker.prototype.postMessage = function postMessage(data) { - var _this = this; - - setTimeout(function() { - _this.self.onmessage({ data: data }); - }, 0); - }; - - module.exports = InlineWorker; - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + /* WEBPACK VAR INJECTION */ + (function (global) { + var WORKER_ENABLED = !!(global === global.window && global.URL && global.Blob && global.Worker); -/***/ }, -/* 54 */ -/***/ function(module, exports) { + function InlineWorker(func, self) { + var _this = this; + var functionBody; + + self = self || {}; + + if (WORKER_ENABLED) { + functionBody = func.toString().trim().match( + /^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/ + )[1]; + + return new global.Worker(global.URL.createObjectURL( + new global.Blob([functionBody], {type: "text/javascript"}) + )); + } + + function postMessage(data) { + setTimeout(function () { + _this.onmessage({data: data}); + }, 0); + } + + this.self = self; + this.self.postMessage = postMessage; + + setTimeout(func.bind(self, self), 0); + } + + InlineWorker.prototype.postMessage = function postMessage(data) { + var _this = this; + + setTimeout(function () { + _this.self.onmessage({data: data}); + }, 0); + }; + + module.exports = InlineWorker; + + /* WEBPACK VAR INJECTION */ + }.call(exports, (function () { + return this; + }()))) + + /***/ + }, + /* 54 */ + /***/ function (module, exports) { + + "use strict"; - "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true + value: true }); exports.samplesToSeconds = samplesToSeconds; exports.secondsToSamples = secondsToSamples; @@ -4693,1242 +4730,1247 @@ var WaveformPlaylist = exports.pixelsToSeconds = pixelsToSeconds; exports.secondsToPixels = secondsToPixels; function samplesToSeconds(samples, sampleRate) { - return samples / sampleRate; + return samples / sampleRate; } - - function secondsToSamples(seconds, sampleRate) { - return Math.ceil(seconds * sampleRate); + + function secondsToSamples(seconds, sampleRate) { + return Math.ceil(seconds * sampleRate); } - - function samplesToPixels(samples, resolution) { - return Math.floor(samples / resolution); + + function samplesToPixels(samples, resolution) { + return Math.floor(samples / resolution); } - - function pixelsToSamples(pixels, resolution) { - return Math.floor(pixels * resolution); + + function pixelsToSamples(pixels, resolution) { + return Math.floor(pixels * resolution); } - - function pixelsToSeconds(pixels, resolution, sampleRate) { - return pixels * resolution / sampleRate; + + function pixelsToSeconds(pixels, resolution, sampleRate) { + return pixels * resolution / sampleRate; } - - function secondsToPixels(seconds, resolution, sampleRate) { - return Math.ceil(seconds * sampleRate / resolution); + + function secondsToPixels(seconds, resolution, sampleRate) { + return Math.ceil(seconds * sampleRate / resolution); } /***/ }, -/* 55 */ + /* 55 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _BlobLoader = __webpack_require__(56); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _BlobLoader = __webpack_require__(56); + var _BlobLoader2 = _interopRequireDefault(_BlobLoader); - - var _XHRLoader = __webpack_require__(58); - + + var _XHRLoader = __webpack_require__(58); + var _XHRLoader2 = _interopRequireDefault(_XHRLoader); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class() { - _classCallCheck(this, _class); - } - - _createClass(_class, null, [{ - key: 'createLoader', - value: function createLoader(src, audioContext, ee) { - if (src instanceof Blob) { - return new _BlobLoader2.default(src, audioContext, ee); - } else if (typeof src === 'string') { - return new _XHRLoader2.default(src, audioContext, ee); - } - - throw new Error('Unsupported src type'); - } - }]); - return _class; + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var _class = function () { + function _class() { + _classCallCheck(this, _class); + } + + _createClass(_class, null, [{ + key: 'createLoader', + value: function createLoader(src, audioContext, ee) { + if (src instanceof Blob) { + return new _BlobLoader2.default(src, audioContext, ee); + } else if (typeof src === 'string') { + return new _XHRLoader2.default(src, audioContext, ee); + } + + throw new Error('Unsupported src type'); + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 56 */ + /* 56 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - - var _Loader2 = __webpack_require__(57); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + + var _Loader2 = __webpack_require__(57); + var _Loader3 = _interopRequireDefault(_Loader2); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var _class = function (_Loader) { - _inherits(_class, _Loader); - - function _class() { - _classCallCheck(this, _class); - - return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments)); - } - - _createClass(_class, [{ - key: 'load', - - - /* - * Loads an audio file via a FileReader - */ - value: function load() { - var _this2 = this; - - return new Promise(function (resolve, reject) { - if (_this2.src.type.match(/audio.*/) || - // added for problems with Firefox mime types + ogg. - _this2.src.type.match(/video\/ogg/)) { - var fr = new FileReader(); - - fr.readAsArrayBuffer(_this2.src); - - fr.addEventListener('progress', function (e) { - _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileProgress', _this2).call(_this2, e); - }); - - fr.addEventListener('load', function (e) { - var decoderPromise = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileLoad', _this2).call(_this2, e); - - decoderPromise.then(function (audioBuffer) { - resolve(audioBuffer); - }); - }); - - fr.addEventListener('error', function (err) { - reject(err); - }); - } else { - reject(Error('Unsupported file type ' + _this2.src.type)); - } - }); - } - }]); - return _class; + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var _class = function (_Loader) { + _inherits(_class, _Loader); + + function _class() { + _classCallCheck(this, _class); + + return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments)); + } + + _createClass(_class, [{ + key: 'load', + + + /* + * Loads an audio file via a FileReader + */ + value: function load() { + var _this2 = this; + + return new Promise(function (resolve, reject) { + if (_this2.src.type.match(/audio.*/) || + // added for problems with Firefox mime types + ogg. + _this2.src.type.match(/video\/ogg/)) { + var fr = new FileReader(); + + fr.readAsArrayBuffer(_this2.src); + + fr.addEventListener('progress', function (e) { + _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileProgress', _this2).call(_this2, e); + }); + + fr.addEventListener('load', function (e) { + var decoderPromise = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileLoad', _this2).call(_this2, e); + + decoderPromise.then(function (audioBuffer) { + resolve(audioBuffer); + }); + }); + + fr.addEventListener('error', function (err) { + reject(err); + }); + } else { + reject(Error('Unsupported file type ' + _this2.src.type)); + } + }); + } + }]); + + return _class; }(_Loader3.default); exports.default = _class; /***/ }, -/* 57 */ + /* 57 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); exports.STATE_FINISHED = exports.STATE_DECODING = exports.STATE_LOADING = exports.STATE_UNINITIALIZED = undefined; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _eventEmitter = __webpack_require__(15); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _eventEmitter = __webpack_require__(15); + var _eventEmitter2 = _interopRequireDefault(_eventEmitter); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var STATE_UNINITIALIZED = exports.STATE_UNINITIALIZED = 0; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var STATE_UNINITIALIZED = exports.STATE_UNINITIALIZED = 0; var STATE_LOADING = exports.STATE_LOADING = 1; var STATE_DECODING = exports.STATE_DECODING = 2; var STATE_FINISHED = exports.STATE_FINISHED = 3; - - var _class = function () { - function _class(src, audioContext) { - var ee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (0, _eventEmitter2.default)(); - - _classCallCheck(this, _class); - - this.src = src; - this.ac = audioContext; - this.audioRequestState = STATE_UNINITIALIZED; - this.ee = ee; - } - - _createClass(_class, [{ - key: 'setStateChange', - value: function setStateChange(state) { - this.audioRequestState = state; - this.ee.emit('audiorequeststatechange', this.audioRequestState, this.src); - } - }, { - key: 'fileProgress', - value: function fileProgress(e) { - var percentComplete = 0; - - if (this.audioRequestState === STATE_UNINITIALIZED) { - this.setStateChange(STATE_LOADING); - } - - if (e.lengthComputable) { - percentComplete = e.loaded / e.total * 100; - } - - this.ee.emit('loadprogress', percentComplete, this.src); - } - }, { - key: 'fileLoad', - value: function fileLoad(e) { - var _this = this; - - var audioData = e.target.response || e.target.result; - - this.setStateChange(STATE_DECODING); - - return new Promise(function (resolve, reject) { - _this.ac.decodeAudioData(audioData, function (audioBuffer) { - _this.audioBuffer = audioBuffer; - _this.setStateChange(STATE_FINISHED); - - resolve(audioBuffer); - }, function (err) { - reject(err); - }); - }); - } - }]); - return _class; + var _class = function () { + function _class(src, audioContext) { + var ee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (0, _eventEmitter2.default)(); + + _classCallCheck(this, _class); + + this.src = src; + this.ac = audioContext; + this.audioRequestState = STATE_UNINITIALIZED; + this.ee = ee; + } + + _createClass(_class, [{ + key: 'setStateChange', + value: function setStateChange(state) { + this.audioRequestState = state; + this.ee.emit('audiorequeststatechange', this.audioRequestState, this.src); + } + }, { + key: 'fileProgress', + value: function fileProgress(e) { + var percentComplete = 0; + + if (this.audioRequestState === STATE_UNINITIALIZED) { + this.setStateChange(STATE_LOADING); + } + + if (e.lengthComputable) { + percentComplete = e.loaded / e.total * 100; + } + + this.ee.emit('loadprogress', percentComplete, this.src); + } + }, { + key: 'fileLoad', + value: function fileLoad(e) { + var _this = this; + + var audioData = e.target.response || e.target.result; + + this.setStateChange(STATE_DECODING); + + return new Promise(function (resolve, reject) { + _this.ac.decodeAudioData(audioData, function (audioBuffer) { + _this.audioBuffer = audioBuffer; + _this.setStateChange(STATE_FINISHED); + + resolve(audioBuffer); + }, function (err) { + reject(err); + }); + }); + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 58 */ + /* 58 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - - var _Loader2 = __webpack_require__(57); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + + var _Loader2 = __webpack_require__(57); + var _Loader3 = _interopRequireDefault(_Loader2); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var _class = function (_Loader) { - _inherits(_class, _Loader); - - function _class() { - _classCallCheck(this, _class); - - return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments)); - } - - _createClass(_class, [{ - key: 'load', - - - /** - * Loads an audio file via XHR. - */ - value: function load() { - var _this2 = this; - - return new Promise(function (resolve, reject) { - var xhr = new XMLHttpRequest(); - - xhr.open('GET', _this2.src, true); - xhr.responseType = 'arraybuffer'; - xhr.send(); - - xhr.addEventListener('progress', function (e) { - _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileProgress', _this2).call(_this2, e); - }); - - xhr.addEventListener('load', function (e) { - var decoderPromise = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileLoad', _this2).call(_this2, e); - - decoderPromise.then(function (audioBuffer) { - resolve(audioBuffer); - }); - }); - - xhr.addEventListener('error', function () { - reject(Error('Track ' + _this2.src + ' failed to load')); - }); - }); - } - }]); - return _class; + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var _class = function (_Loader) { + _inherits(_class, _Loader); + + function _class() { + _classCallCheck(this, _class); + + return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments)); + } + + _createClass(_class, [{ + key: 'load', + + + /** + * Loads an audio file via XHR. + */ + value: function load() { + var _this2 = this; + + return new Promise(function (resolve, reject) { + var xhr = new XMLHttpRequest(); + + xhr.open('GET', _this2.src, true); + xhr.responseType = 'arraybuffer'; + xhr.send(); + + xhr.addEventListener('progress', function (e) { + _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileProgress', _this2).call(_this2, e); + }); + + xhr.addEventListener('load', function (e) { + var decoderPromise = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'fileLoad', _this2).call(_this2, e); + + decoderPromise.then(function (audioBuffer) { + resolve(audioBuffer); + }); + }); + + xhr.addEventListener('error', function () { + reject(Error('Track ' + _this2.src + ' failed to load')); + }); + }); + } + }]); + + return _class; }(_Loader3.default); exports.default = _class; /***/ }, -/* 59 */ + /* 59 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _conversions = __webpack_require__(54); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _conversions = __webpack_require__(54); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /* + + /* * virtual-dom hook for scrolling the track container. */ var _class = function () { - function _class(track, resolution, sampleRate) { - _classCallCheck(this, _class); - - this.track = track; - this.resolution = resolution; - this.sampleRate = sampleRate; - } - - _createClass(_class, [{ - key: 'hook', - value: function hook(node) { - var trackArea = node; - trackArea.scrollLeft = (0, _conversions.secondsToPixels)(this.track.scrollLeft, this.resolution, this.sampleRate); - } - }]); - - return _class; + function _class(track, resolution, sampleRate) { + _classCallCheck(this, _class); + + this.track = track; + this.resolution = resolution; + this.sampleRate = sampleRate; + } + + _createClass(_class, [{ + key: 'hook', + value: function hook(node) { + var trackArea = node; + trackArea.scrollLeft = (0, _conversions.secondsToPixels)(this.track.scrollLeft, this.resolution, this.sampleRate); + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 60 */ + /* 60 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _h = __webpack_require__(32); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _h = __webpack_require__(32); + var _h2 = _interopRequireDefault(_h); - - var _conversions = __webpack_require__(54); - - var _TimeScaleHook = __webpack_require__(61); - + + var _conversions = __webpack_require__(54); + + var _TimeScaleHook = __webpack_require__(61); + var _TimeScaleHook2 = _interopRequireDefault(_TimeScaleHook); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var TimeScale = function () { - function TimeScale(duration, offset, samplesPerPixel, sampleRate) { - var marginLeft = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; - - _classCallCheck(this, TimeScale); - - this.duration = duration; - this.offset = offset; - this.samplesPerPixel = samplesPerPixel; - this.sampleRate = sampleRate; - this.marginLeft = marginLeft; - - this.timeinfo = { - 20000: { - marker: 30000, - bigStep: 10000, - smallStep: 5000, - secondStep: 5 - }, - 12000: { - marker: 15000, - bigStep: 5000, - smallStep: 1000, - secondStep: 1 - }, - 10000: { - marker: 10000, - bigStep: 5000, - smallStep: 1000, - secondStep: 1 - }, - 5000: { - marker: 5000, - bigStep: 1000, - smallStep: 500, - secondStep: 1 / 2 - }, - 2500: { - marker: 2000, - bigStep: 1000, - smallStep: 500, - secondStep: 1 / 2 - }, - 1500: { - marker: 2000, - bigStep: 1000, - smallStep: 200, - secondStep: 1 / 5 - }, - 700: { - marker: 1000, - bigStep: 500, - smallStep: 100, - secondStep: 1 / 10 - } - }; - } - - _createClass(TimeScale, [{ - key: 'getScaleInfo', - value: function getScaleInfo(resolution) { - var keys = Object.keys(this.timeinfo).map(function (item) { - return parseInt(item, 10); - }); - - // make sure keys are numerically sorted. - keys = keys.sort(function (a, b) { - return a - b; - }); - - for (var i = 0; i < keys.length; i += 1) { - if (resolution <= keys[i]) { - return this.timeinfo[keys[i]]; - } - } - - return this.timeinfo[keys[0]]; - } - - /* - Return time in format mm:ss - */ - - }, { - key: 'render', - value: function render() { - var widthX = (0, _conversions.secondsToPixels)(this.duration, this.samplesPerPixel, this.sampleRate); - var pixPerSec = this.sampleRate / this.samplesPerPixel; - var pixOffset = (0, _conversions.secondsToPixels)(this.offset, this.samplesPerPixel, this.sampleRate); - var scaleInfo = this.getScaleInfo(this.samplesPerPixel); - var canvasInfo = {}; - var timeMarkers = []; - var end = widthX + pixOffset; - var counter = 0; - - for (var i = 0; i < end; i += pixPerSec * scaleInfo.secondStep) { - var pixIndex = Math.floor(i); - var pix = pixIndex - pixOffset; - - if (pixIndex >= pixOffset) { - // put a timestamp every 30 seconds. - if (scaleInfo.marker && counter % scaleInfo.marker === 0) { - timeMarkers.push((0, _h2.default)('div.time', { - attributes: { - style: 'position: absolute; left: ' + pix + 'px;' - } - }, [TimeScale.formatTime(counter)])); - - canvasInfo[pix] = 10; - } else if (scaleInfo.bigStep && counter % scaleInfo.bigStep === 0) { - canvasInfo[pix] = 5; - } else if (scaleInfo.smallStep && counter % scaleInfo.smallStep === 0) { - canvasInfo[pix] = 2; - } - } - - counter += 1000 * scaleInfo.secondStep; - } - - return (0, _h2.default)('div.playlist-time-scale', { - attributes: { - style: 'position: relative; left: 0; right: 0; margin-left: ' + this.marginLeft + 'px;' - } - }, [timeMarkers, (0, _h2.default)('canvas', { - attributes: { - width: widthX, - height: 30, - style: 'position: absolute; left: 0; right: 0; top: 0; bottom: 0;' - }, - hook: new _TimeScaleHook2.default(canvasInfo, this.offset, this.samplesPerPixel, this.duration) - })]); - } - }], [{ - key: 'formatTime', - value: function formatTime(milliseconds) { - var seconds = milliseconds / 1000; - var s = seconds % 60; - var m = (seconds - s) / 60; - - if (s < 10) { - s = '0' + s; - } - - return m + ':' + s; - } - }]); - - return TimeScale; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var TimeScale = function () { + function TimeScale(duration, offset, samplesPerPixel, sampleRate) { + var marginLeft = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + + _classCallCheck(this, TimeScale); + + this.duration = duration; + this.offset = offset; + this.samplesPerPixel = samplesPerPixel; + this.sampleRate = sampleRate; + this.marginLeft = marginLeft; + + this.timeinfo = { + 20000: { + marker: 30000, + bigStep: 10000, + smallStep: 5000, + secondStep: 5 + }, + 12000: { + marker: 15000, + bigStep: 5000, + smallStep: 1000, + secondStep: 1 + }, + 10000: { + marker: 10000, + bigStep: 5000, + smallStep: 1000, + secondStep: 1 + }, + 5000: { + marker: 5000, + bigStep: 1000, + smallStep: 500, + secondStep: 1 / 2 + }, + 2500: { + marker: 2000, + bigStep: 1000, + smallStep: 500, + secondStep: 1 / 2 + }, + 1500: { + marker: 2000, + bigStep: 1000, + smallStep: 200, + secondStep: 1 / 5 + }, + 700: { + marker: 1000, + bigStep: 500, + smallStep: 100, + secondStep: 1 / 10 + } + }; + } + + _createClass(TimeScale, [{ + key: 'getScaleInfo', + value: function getScaleInfo(resolution) { + var keys = Object.keys(this.timeinfo).map(function (item) { + return parseInt(item, 10); + }); + + // make sure keys are numerically sorted. + keys = keys.sort(function (a, b) { + return a - b; + }); + + for (var i = 0; i < keys.length; i += 1) { + if (resolution <= keys[i]) { + return this.timeinfo[keys[i]]; + } + } + + return this.timeinfo[keys[0]]; + } + + /* + Return time in format mm:ss + */ + + }, { + key: 'render', + value: function render() { + var widthX = (0, _conversions.secondsToPixels)(this.duration, this.samplesPerPixel, this.sampleRate); + var pixPerSec = this.sampleRate / this.samplesPerPixel; + var pixOffset = (0, _conversions.secondsToPixels)(this.offset, this.samplesPerPixel, this.sampleRate); + var scaleInfo = this.getScaleInfo(this.samplesPerPixel); + var canvasInfo = {}; + var timeMarkers = []; + var end = widthX + pixOffset; + var counter = 0; + + for (var i = 0; i < end; i += pixPerSec * scaleInfo.secondStep) { + var pixIndex = Math.floor(i); + var pix = pixIndex - pixOffset; + + if (pixIndex >= pixOffset) { + // put a timestamp every 30 seconds. + if (scaleInfo.marker && counter % scaleInfo.marker === 0) { + timeMarkers.push((0, _h2.default)('div.time', { + attributes: { + style: 'position: absolute; left: ' + pix + 'px;' + } + }, [TimeScale.formatTime(counter)])); + + canvasInfo[pix] = 10; + } else if (scaleInfo.bigStep && counter % scaleInfo.bigStep === 0) { + canvasInfo[pix] = 5; + } else if (scaleInfo.smallStep && counter % scaleInfo.smallStep === 0) { + canvasInfo[pix] = 2; + } + } + + counter += 1000 * scaleInfo.secondStep; + } + + return (0, _h2.default)('div.playlist-time-scale', { + attributes: { + style: 'position: relative; left: 0; right: 0; margin-left: ' + this.marginLeft + 'px;' + } + }, [timeMarkers, (0, _h2.default)('canvas', { + attributes: { + width: widthX, + height: 30, + style: 'position: absolute; left: 0; right: 0; top: 0; bottom: 0;' + }, + hook: new _TimeScaleHook2.default(canvasInfo, this.offset, this.samplesPerPixel, this.duration) + })]); + } + }], [{ + key: 'formatTime', + value: function formatTime(milliseconds) { + var seconds = milliseconds / 1000; + var s = seconds % 60; + var m = (seconds - s) / 60; + + if (s < 10) { + s = '0' + s; + } + + return m + ':' + s; + } + }]); + + return TimeScale; }(); - - exports.default = TimeScale; + + exports.default = TimeScale; /***/ }, -/* 61 */ + /* 61 */ /***/ function(module, exports) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /* + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /* * virtual-dom hook for rendering the time scale canvas. */ var _class = function () { - function _class(tickInfo, offset, samplesPerPixel, duration) { - _classCallCheck(this, _class); - - this.tickInfo = tickInfo; - this.offset = offset; - this.samplesPerPixel = samplesPerPixel; - this.duration = duration; - } - - _createClass(_class, [{ - key: 'hook', - value: function hook(canvas, prop, prev) { - var _this = this; - - // canvas is up to date - if (prev !== undefined && prev.offset === this.offset && prev.duration === this.duration && prev.samplesPerPixel === this.samplesPerPixel) { - return; - } - - var width = canvas.width; - var height = canvas.height; - var ctx = canvas.getContext('2d'); - - ctx.clearRect(0, 0, width, height); - - Object.keys(this.tickInfo).forEach(function (x) { - var scaleHeight = _this.tickInfo[x]; - var scaleY = height - scaleHeight; - ctx.fillRect(x, scaleY, 1, scaleHeight); - }); - } - }]); - - return _class; + function _class(tickInfo, offset, samplesPerPixel, duration) { + _classCallCheck(this, _class); + + this.tickInfo = tickInfo; + this.offset = offset; + this.samplesPerPixel = samplesPerPixel; + this.duration = duration; + } + + _createClass(_class, [{ + key: 'hook', + value: function hook(canvas, prop, prev) { + var _this = this; + + // canvas is up to date + if (prev !== undefined && prev.offset === this.offset && prev.duration === this.duration && prev.samplesPerPixel === this.samplesPerPixel) { + return; + } + + var width = canvas.width; + var height = canvas.height; + var ctx = canvas.getContext('2d'); + + ctx.clearRect(0, 0, width, height); + + Object.keys(this.tickInfo).forEach(function (x) { + var scaleHeight = _this.tickInfo[x]; + var scaleY = height - scaleHeight; + ctx.fillRect(x, scaleY, 1, scaleHeight); + }); + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 62 */ + /* 62 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _lodash = __webpack_require__(1); - - var _lodash2 = _interopRequireDefault(_lodash); - - var _lodash3 = __webpack_require__(63); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _lodash = __webpack_require__(1); + + var _lodash2 = _interopRequireDefault(_lodash); + + var _lodash3 = __webpack_require__(63); + var _lodash4 = _interopRequireDefault(_lodash3); - - var _uuid = __webpack_require__(64); - + + var _uuid = __webpack_require__(64); + var _uuid2 = _interopRequireDefault(_uuid); - - var _h = __webpack_require__(32); - + + var _h = __webpack_require__(32); + var _h2 = _interopRequireDefault(_h); - - var _webaudioPeaks = __webpack_require__(66); - + + var _webaudioPeaks = __webpack_require__(66); + var _webaudioPeaks2 = _interopRequireDefault(_webaudioPeaks); - - var _fadeMaker = __webpack_require__(67); - - var _conversions = __webpack_require__(54); - - var _states = __webpack_require__(69); - + + var _fadeMaker = __webpack_require__(67); + + var _conversions = __webpack_require__(54); + + var _states = __webpack_require__(69); + var _states2 = _interopRequireDefault(_states); - - var _CanvasHook = __webpack_require__(75); - + + var _CanvasHook = __webpack_require__(75); + var _CanvasHook2 = _interopRequireDefault(_CanvasHook); - - var _FadeCanvasHook = __webpack_require__(76); - + + var _FadeCanvasHook = __webpack_require__(76); + var _FadeCanvasHook2 = _interopRequireDefault(_FadeCanvasHook); - - var _VolumeSliderHook = __webpack_require__(77); - + + var _VolumeSliderHook = __webpack_require__(77); + var _VolumeSliderHook2 = _interopRequireDefault(_VolumeSliderHook); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var MAX_CANVAS_WIDTH = 1000; - - var _class = function () { - function _class() { - _classCallCheck(this, _class); - - this.name = 'Untitled'; - this.customClass = undefined; - this.waveOutlineColor = undefined; - this.gain = 1; - this.fades = {}; - this.peakData = { - type: 'WebAudio', - mono: false - }; - - this.cueIn = 0; - this.cueOut = 0; - this.duration = 0; - this.startTime = 0; - this.endTime = 0; - } - - _createClass(_class, [{ - key: 'setEventEmitter', - value: function setEventEmitter(ee) { - this.ee = ee; - } - }, { - key: 'setName', - value: function setName(name) { - this.name = name; - } - }, { - key: 'setCustomClass', - value: function setCustomClass(className) { - this.customClass = className; - } - }, { - key: 'setWaveOutlineColor', - value: function setWaveOutlineColor(color) { - this.waveOutlineColor = color; - } - }, { - key: 'setCues', - value: function setCues(cueIn, cueOut) { - if (cueOut < cueIn) { - throw new Error('cue out cannot be less than cue in'); - } - - this.cueIn = cueIn; - this.cueOut = cueOut; - this.duration = this.cueOut - this.cueIn; - this.endTime = this.startTime + this.duration; - } - - /* - * start, end in seconds relative to the entire playlist. - */ - - }, { - key: 'trim', - value: function trim(start, end) { - var trackStart = this.getStartTime(); - var trackEnd = this.getEndTime(); - var offset = this.cueIn - trackStart; - - if (trackStart <= start && trackEnd >= start || trackStart <= end && trackEnd >= end) { - var cueIn = start < trackStart ? trackStart : start; - var cueOut = end > trackEnd ? trackEnd : end; - - this.setCues(cueIn + offset, cueOut + offset); - if (start > trackStart) { - this.setStartTime(start); - } - } - } - }, { - key: 'setStartTime', - value: function setStartTime(start) { - this.startTime = start; - this.endTime = start + this.duration; - } - }, { - key: 'setPlayout', - value: function setPlayout(playout) { - this.playout = playout; - } - }, { - key: 'setOfflinePlayout', - value: function setOfflinePlayout(playout) { - this.offlinePlayout = playout; - } - }, { - key: 'setEnabledStates', - value: function setEnabledStates() { - var enabledStates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var defaultStatesEnabled = { - cursor: true, - fadein: true, - fadeout: true, - select: true, - shift: true - }; - - this.enabledStates = (0, _lodash2.default)({}, defaultStatesEnabled, enabledStates); - } - }, { - key: 'setFadeIn', - value: function setFadeIn(duration) { - var shape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logarithmic'; - - if (duration > this.duration) { - throw new Error('Invalid Fade In'); - } - - var fade = { - shape: shape, - start: 0, - end: duration - }; - - if (this.fadeIn) { - this.removeFade(this.fadeIn); - this.fadeIn = undefined; - } - - this.fadeIn = this.saveFade(_fadeMaker.FADEIN, fade.shape, fade.start, fade.end); - } - }, { - key: 'setFadeOut', - value: function setFadeOut(duration) { - var shape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logarithmic'; - - if (duration > this.duration) { - throw new Error('Invalid Fade Out'); - } - - var fade = { - shape: shape, - start: this.duration - duration, - end: this.duration - }; - - if (this.fadeOut) { - this.removeFade(this.fadeOut); - this.fadeOut = undefined; - } - - this.fadeOut = this.saveFade(_fadeMaker.FADEOUT, fade.shape, fade.start, fade.end); - } - }, { - key: 'saveFade', - value: function saveFade(type, shape, start, end) { - var id = _uuid2.default.v4(); - - this.fades[id] = { - type: type, - shape: shape, - start: start, - end: end - }; - - return id; - } - }, { - key: 'removeFade', - value: function removeFade(id) { - delete this.fades[id]; - } - }, { - key: 'setBuffer', - value: function setBuffer(buffer) { - this.buffer = buffer; - } - }, { - key: 'setPeakData', - value: function setPeakData(data) { - this.peakData = data; - } - }, { - key: 'calculatePeaks', - value: function calculatePeaks(samplesPerPixel, sampleRate) { - var cueIn = (0, _conversions.secondsToSamples)(this.cueIn, sampleRate); - var cueOut = (0, _conversions.secondsToSamples)(this.cueOut, sampleRate); - - this.setPeaks((0, _webaudioPeaks2.default)(this.buffer, samplesPerPixel, this.peakData.mono, cueIn, cueOut)); - } - }, { - key: 'setPeaks', - value: function setPeaks(peaks) { - this.peaks = peaks; - } - }, { - key: 'setState', - value: function setState(state) { - this.state = state; - - if (this.state && this.enabledStates[this.state]) { - var StateClass = _states2.default[this.state]; - this.stateObj = new StateClass(this); - } else { - this.stateObj = undefined; - } - } - }, { - key: 'getStartTime', - value: function getStartTime() { - return this.startTime; - } - }, { - key: 'getEndTime', - value: function getEndTime() { - return this.endTime; - } - }, { - key: 'getDuration', - value: function getDuration() { - return this.duration; - } - }, { - key: 'isPlaying', - value: function isPlaying() { - return this.playout.isPlaying(); - } - }, { - key: 'setShouldPlay', - value: function setShouldPlay(bool) { - this.playout.setShouldPlay(bool); - } - }, { - key: 'setGainLevel', - value: function setGainLevel(level) { - this.gain = level; - this.playout.setVolumeGainLevel(level); - } - }, { - key: 'setMasterGainLevel', - value: function setMasterGainLevel(level) { - this.playout.setMasterGainLevel(level); - } - - /* - startTime, endTime in seconds (float). - segment is for a highlighted section in the UI. - returns a Promise that will resolve when the AudioBufferSource - is either stopped or plays out naturally. - */ - - }, { - key: 'schedulePlay', - value: function schedulePlay(now, startTime, endTime, config) { - var start = void 0; - var duration = void 0; - var when = now; - var segment = endTime ? endTime - startTime : undefined; - - var defaultOptions = { - shouldPlay: true, - masterGain: 1, - isOffline: false - }; - - var options = (0, _lodash2.default)({}, defaultOptions, config); - var playoutSystem = options.isOffline ? this.offlinePlayout : this.playout; - - // 1) track has no content to play. - // 2) track does not play in this selection. - if (this.endTime <= startTime || segment && startTime + segment < this.startTime) { - // return a resolved promise since this track is technically "stopped". - return Promise.resolve(); - } - - // track should have something to play if it gets here. - - // the track starts in the future or on the cursor position - if (this.startTime >= startTime) { - start = 0; - // schedule additional delay for this audio node. - when += this.startTime - startTime; - - if (endTime) { - segment -= this.startTime - startTime; - duration = Math.min(segment, this.duration); - } else { - duration = this.duration; - } - } else { - start = startTime - this.startTime; - - if (endTime) { - duration = Math.min(segment, this.duration - start); - } else { - duration = this.duration - start; - } - } - - start += this.cueIn; - var relPos = startTime - this.startTime; - var sourcePromise = playoutSystem.setUpSource(); - - // param relPos: cursor position in seconds relative to this track. - // can be negative if the cursor is placed before the start of this track etc. - (0, _lodash4.default)(this.fades, function (fade) { - var fadeStart = void 0; - var fadeDuration = void 0; - - // only apply fade if it's ahead of the cursor. - if (relPos < fade.end) { - if (relPos <= fade.start) { - fadeStart = now + (fade.start - relPos); - fadeDuration = fade.end - fade.start; - } else if (relPos > fade.start && relPos < fade.end) { - fadeStart = now - (relPos - fade.start); - fadeDuration = fade.end - fade.start; - } - - switch (fade.type) { - case _fadeMaker.FADEIN: - { - playoutSystem.applyFadeIn(fadeStart, fadeDuration, fade.shape); - break; - } - case _fadeMaker.FADEOUT: - { - playoutSystem.applyFadeOut(fadeStart, fadeDuration, fade.shape); - break; - } - default: - { - throw new Error('Invalid fade type saved on track.'); - } - } - } - }); - - playoutSystem.setVolumeGainLevel(this.gain); - playoutSystem.setShouldPlay(options.shouldPlay); - playoutSystem.setMasterGainLevel(options.masterGain); - playoutSystem.play(when, start, duration); - - return sourcePromise; - } - }, { - key: 'scheduleStop', - value: function scheduleStop() { - var when = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - - this.playout.stop(when); - } - }, { - key: 'renderOverlay', - value: function renderOverlay(data) { - var _this = this; - - var channelPixels = (0, _conversions.secondsToPixels)(data.playlistLength, data.resolution, data.sampleRate); - - var config = { - attributes: { - style: 'position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: ' + channelPixels + 'px; z-index: 9;' - } - }; - - var overlayClass = ''; - - if (this.stateObj) { - this.stateObj.setup(data.resolution, data.sampleRate); - var StateClass = _states2.default[this.state]; - var events = StateClass.getEvents(); - - events.forEach(function (event) { - config['on' + event] = _this.stateObj[event].bind(_this.stateObj); - }); - - overlayClass = StateClass.getClass(); - } - // use this overlay for track event cursor position calculations. - return (0, _h2.default)('div.playlist-overlay' + overlayClass, config); - } - }, { - key: 'renderControls', - value: function renderControls(data) { - var _this2 = this; - - var muteClass = data.muted ? '.active' : ''; - var soloClass = data.soloed ? '.active' : ''; - var numChan = this.peaks.data.length; - - return (0, _h2.default)('div.controls', { - attributes: { - style: 'height: ' + numChan * data.height + 'px; width: ' + data.controls.width + 'px; position: absolute; left: 0; z-index: 10;' - } - }, [(0, _h2.default)('header', [this.name]), (0, _h2.default)('div.btn-group', [(0, _h2.default)('span.btn.btn-default.btn-xs.btn-mute' + muteClass, { - onclick: function onclick() { - _this2.ee.emit('mute', _this2); - } - }, ['Mute']), (0, _h2.default)('span.btn.btn-default.btn-xs.btn-solo' + soloClass, { - onclick: function onclick() { - _this2.ee.emit('solo', _this2); - } - }, ['Solo'])]), (0, _h2.default)('label', [(0, _h2.default)('input.volume-slider', { - attributes: { - type: 'range', - min: 0, - max: 100, - value: 100 - }, - hook: new _VolumeSliderHook2.default(this.gain), - oninput: function oninput(e) { - _this2.ee.emit('volumechange', e.target.value, _this2); - } - })])]); - } - }, { - key: 'render', - value: function render(data) { - var _this3 = this; - - var width = this.peaks.length; - var playbackX = (0, _conversions.secondsToPixels)(data.playbackSeconds, data.resolution, data.sampleRate); - var startX = (0, _conversions.secondsToPixels)(this.startTime, data.resolution, data.sampleRate); - var endX = (0, _conversions.secondsToPixels)(this.endTime, data.resolution, data.sampleRate); - var progressWidth = 0; - var numChan = this.peaks.data.length; - - if (playbackX > 0 && playbackX > startX) { - if (playbackX < endX) { - progressWidth = playbackX - startX; - } else { - progressWidth = width; - } - } - - var waveformChildren = [(0, _h2.default)('div.cursor', { - attributes: { - style: 'position: absolute; width: 1px; margin: 0; padding: 0; top: 0; left: ' + playbackX + 'px; bottom: 0; z-index: 5;' - } - })]; - - var channels = Object.keys(this.peaks.data).map(function (channelNum) { - var channelChildren = [(0, _h2.default)('div.channel-progress', { - attributes: { - style: 'position: absolute; width: ' + progressWidth + 'px; height: ' + data.height + 'px; z-index: 2;' - } - })]; - var offset = 0; - var totalWidth = width; - var peaks = _this3.peaks.data[channelNum]; - - while (totalWidth > 0) { - var currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH); - var canvasColor = _this3.waveOutlineColor ? _this3.waveOutlineColor : data.colors.waveOutlineColor; - - channelChildren.push((0, _h2.default)('canvas', { - attributes: { - width: currentWidth, - height: data.height, - style: 'float: left; position: relative; margin: 0; padding: 0; z-index: 3;' - }, - hook: new _CanvasHook2.default(peaks, offset, _this3.peaks.bits, canvasColor) - })); - - totalWidth -= currentWidth; - offset += MAX_CANVAS_WIDTH; - } - - // if there are fades, display them. - if (_this3.fadeIn) { - var fadeIn = _this3.fades[_this3.fadeIn]; - var fadeWidth = (0, _conversions.secondsToPixels)(fadeIn.end - fadeIn.start, data.resolution, data.sampleRate); - - channelChildren.push((0, _h2.default)('div.wp-fade.wp-fadein', { - attributes: { - style: 'position: absolute; height: ' + data.height + 'px; width: ' + fadeWidth + 'px; top: 0; left: 0; z-index: 4;' - } - }, [(0, _h2.default)('canvas', { - attributes: { - width: fadeWidth, - height: data.height - }, - hook: new _FadeCanvasHook2.default(fadeIn.type, fadeIn.shape, fadeIn.end - fadeIn.start, data.resolution) - })])); - } - - if (_this3.fadeOut) { - var fadeOut = _this3.fades[_this3.fadeOut]; - var _fadeWidth = (0, _conversions.secondsToPixels)(fadeOut.end - fadeOut.start, data.resolution, data.sampleRate); - - channelChildren.push((0, _h2.default)('div.wp-fade.wp-fadeout', { - attributes: { - style: 'position: absolute; height: ' + data.height + 'px; width: ' + _fadeWidth + 'px; top: 0; right: 0; z-index: 4;' - } - }, [(0, _h2.default)('canvas', { - attributes: { - width: _fadeWidth, - height: data.height - }, - hook: new _FadeCanvasHook2.default(fadeOut.type, fadeOut.shape, fadeOut.end - fadeOut.start, data.resolution) - })])); - } - - return (0, _h2.default)('div.channel.channel-' + channelNum, { - attributes: { - style: 'height: ' + data.height + 'px; width: ' + width + 'px; top: ' + channelNum * data.height + 'px; left: ' + startX + 'px; position: absolute; margin: 0; padding: 0; z-index: 1;' - } - }, channelChildren); - }); - - waveformChildren.push(channels); - waveformChildren.push(this.renderOverlay(data)); - - // draw cursor selection on active track. - if (data.isActive === true) { - var cStartX = (0, _conversions.secondsToPixels)(data.timeSelection.start, data.resolution, data.sampleRate); - var cEndX = (0, _conversions.secondsToPixels)(data.timeSelection.end, data.resolution, data.sampleRate); - var cWidth = cEndX - cStartX + 1; - var cClassName = cWidth > 1 ? '.segment' : '.point'; - - waveformChildren.push((0, _h2.default)('div.selection' + cClassName, { - attributes: { - style: 'position: absolute; width: ' + cWidth + 'px; bottom: 0; top: 0; left: ' + cStartX + 'px; z-index: 4;' - } - })); - } - - var waveform = (0, _h2.default)('div.waveform', { - attributes: { - style: 'height: ' + numChan * data.height + 'px; position: relative;' - } - }, waveformChildren); - - var channelChildren = []; - var channelMargin = 0; - - if (data.controls.show) { - channelChildren.push(this.renderControls(data)); - channelMargin = data.controls.width; - } - - channelChildren.push(waveform); - - var audibleClass = data.shouldPlay ? '' : '.silent'; - var customClass = this.customClass === undefined ? '' : '.' + this.customClass; - - return (0, _h2.default)('div.channel-wrapper' + audibleClass + customClass, { - attributes: { - style: 'margin-left: ' + channelMargin + 'px; height: ' + data.height * numChan + 'px;' - } - }, channelChildren); - } - }, { - key: 'getTrackDetails', - value: function getTrackDetails() { - var info = { - src: this.src, - start: this.startTime, - end: this.endTime, - name: this.name, - customClass: this.customClass, - cuein: this.cueIn, - cueout: this.cueOut - }; - - if (this.fadeIn) { - var fadeIn = this.fades[this.fadeIn]; - - info.fadeIn = { - shape: fadeIn.shape, - duration: fadeIn.end - fadeIn.start - }; - } - - if (this.fadeOut) { - var fadeOut = this.fades[this.fadeOut]; - - info.fadeOut = { - shape: fadeOut.shape, - duration: fadeOut.end - fadeOut.start - }; - } - - return info; - } - }]); - return _class; + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var MAX_CANVAS_WIDTH = 1000; + + var _class = function () { + function _class() { + _classCallCheck(this, _class); + + this.name = 'Untitled'; + this.customClass = undefined; + this.waveOutlineColor = undefined; + this.gain = 1; + this.speed = 1; + this.fades = {}; + this.peakData = { + type: 'WebAudio', + mono: false + }; + + this.cueIn = 0; + this.cueOut = 0; + this.duration = 0; + this.startTime = 0; + this.endTime = 0; + } + + _createClass(_class, [{ + key: 'setEventEmitter', + value: function setEventEmitter(ee) { + this.ee = ee; + } + }, { + key: 'setName', + value: function setName(name) { + this.name = name; + } + }, { + key: 'setCustomClass', + value: function setCustomClass(className) { + this.customClass = className; + } + }, { + key: 'setWaveOutlineColor', + value: function setWaveOutlineColor(color) { + this.waveOutlineColor = color; + } + }, { + key: 'setCues', + value: function setCues(cueIn, cueOut) { + if (cueOut < cueIn) { + throw new Error('cue out cannot be less than cue in'); + } + + this.cueIn = cueIn; + this.cueOut = cueOut; + this.duration = this.cueOut - this.cueIn; + this.endTime = this.startTime + this.duration; + } + + /* + * start, end in seconds relative to the entire playlist. + */ + + }, { + key: 'trim', + value: function trim(start, end) { + var trackStart = this.getStartTime(); + var trackEnd = this.getEndTime(); + var offset = this.cueIn - trackStart; + + if (trackStart <= start && trackEnd >= start || trackStart <= end && trackEnd >= end) { + var cueIn = start < trackStart ? trackStart : start; + var cueOut = end > trackEnd ? trackEnd : end; + + this.setCues(cueIn + offset, cueOut + offset); + if (start > trackStart) { + this.setStartTime(start); + } + } + } + }, { + key: 'setStartTime', + value: function setStartTime(start) { + this.startTime = start; + this.endTime = start + this.duration; + } + }, { + key: 'setPlayout', + value: function setPlayout(playout) { + this.playout = playout; + } + }, { + key: 'setOfflinePlayout', + value: function setOfflinePlayout(playout) { + this.offlinePlayout = playout; + } + }, { + key: 'setEnabledStates', + value: function setEnabledStates() { + var enabledStates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var defaultStatesEnabled = { + cursor: true, + fadein: true, + fadeout: true, + select: true, + shift: true + }; + + this.enabledStates = (0, _lodash2.default)({}, defaultStatesEnabled, enabledStates); + } + }, { + key: 'setFadeIn', + value: function setFadeIn(duration) { + var shape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logarithmic'; + + if (duration > this.duration) { + throw new Error('Invalid Fade In'); + } + + var fade = { + shape: shape, + start: 0, + end: duration + }; + + if (this.fadeIn) { + this.removeFade(this.fadeIn); + this.fadeIn = undefined; + } + + this.fadeIn = this.saveFade(_fadeMaker.FADEIN, fade.shape, fade.start, fade.end); + } + }, { + key: 'setFadeOut', + value: function setFadeOut(duration) { + var shape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logarithmic'; + + if (duration > this.duration) { + throw new Error('Invalid Fade Out'); + } + + var fade = { + shape: shape, + start: this.duration - duration, + end: this.duration + }; + + if (this.fadeOut) { + this.removeFade(this.fadeOut); + this.fadeOut = undefined; + } + + this.fadeOut = this.saveFade(_fadeMaker.FADEOUT, fade.shape, fade.start, fade.end); + } + }, { + key: 'saveFade', + value: function saveFade(type, shape, start, end) { + var id = _uuid2.default.v4(); + + this.fades[id] = { + type: type, + shape: shape, + start: start, + end: end + }; + + return id; + } + }, { + key: 'removeFade', + value: function removeFade(id) { + delete this.fades[id]; + } + }, { + key: 'setBuffer', + value: function setBuffer(buffer) { + this.buffer = buffer; + } + }, { + key: 'setPeakData', + value: function setPeakData(data) { + this.peakData = data; + } + }, { + key: 'calculatePeaks', + value: function calculatePeaks(samplesPerPixel, sampleRate) { + var cueIn = (0, _conversions.secondsToSamples)(this.cueIn, sampleRate); + var cueOut = (0, _conversions.secondsToSamples)(this.cueOut, sampleRate); + + this.setPeaks((0, _webaudioPeaks2.default)(this.buffer, samplesPerPixel, this.peakData.mono, cueIn, cueOut)); + } + }, { + key: 'setPeaks', + value: function setPeaks(peaks) { + this.peaks = peaks; + } + }, { + key: 'setState', + value: function setState(state) { + this.state = state; + + if (this.state && this.enabledStates[this.state]) { + var StateClass = _states2.default[this.state]; + this.stateObj = new StateClass(this); + } else { + this.stateObj = undefined; + } + } + }, { + key: 'getStartTime', + value: function getStartTime() { + return this.startTime; + } + }, { + key: 'getEndTime', + value: function getEndTime() { + return this.endTime; + } + }, { + key: 'getDuration', + value: function getDuration() { + return this.duration; + } + }, { + key: 'isPlaying', + value: function isPlaying() { + return this.playout.isPlaying(); + } + }, { + key: 'setShouldPlay', + value: function setShouldPlay(bool) { + this.playout.setShouldPlay(bool); + } + }, { + key: 'setGainLevel', + value: function setGainLevel(level) { + this.gain = level; + this.playout.setVolumeGainLevel(level); + } + }, { + key: 'setMasterGainLevel', + value: function setMasterGainLevel(level) { + this.playout.setMasterGainLevel(level); + } + }, { + key: 'setSpeed', + value: function setSpeed(speed) { + this.speed = speed; + } + /* + startTime, endTime in seconds (float). + segment is for a highlighted section in the UI. + returns a Promise that will resolve when the AudioBufferSource + is either stopped or plays out naturally. + */ + + }, { + key: 'schedulePlay', + value: function schedulePlay(now, startTime, endTime, config) { + var _this = this; + + var start = void 0; + var duration = void 0; + var when = now; + var segment = endTime ? endTime - startTime : undefined; + + var defaultOptions = { + shouldPlay: true, + masterGain: 1, + isOffline: false + }; + + var options = (0, _lodash2.default)({}, defaultOptions, config); + var playoutSystem = options.isOffline ? this.offlinePlayout : this.playout; + + // 1) track has no content to play. + // 2) track does not play in this selection. + if (this.endTime <= startTime || segment && startTime + segment < this.startTime) { + // return a resolved promise since this track is technically "stopped". + return Promise.resolve(); + } + + // track should have something to play if it gets here. + + // the track starts in the future or on the cursor position + if (this.startTime >= startTime) { + start = 0; + // schedule additional delay for this audio node. + when += this.startTime - startTime; + + if (endTime) { + segment -= this.startTime - startTime; + duration = Math.min(segment, this.duration); + } else { + duration = this.duration; + } + } else { + start = startTime - this.startTime; + + if (endTime) { + duration = Math.min(segment, this.duration - start); + } else { + duration = this.duration - start; + } + } + + start += this.cueIn; + var relPos = startTime - this.startTime; + var sourcePromise = playoutSystem.setUpSource(); + + // param relPos: cursor position in seconds relative to this track. + // can be negative if the cursor is placed before the start of this track etc. + (0, _lodash4.default)(this.fades, function (fade) { + var fadeStart = void 0; + var fadeDuration = void 0; + + // only apply fade if it's ahead of the cursor. + if (relPos < fade.end) { + if (relPos <= fade.start) { + fadeStart = now + (fade.start - relPos) / _this.speed; + fadeDuration = (fade.end - fade.start) / _this.speed; + } else if (relPos > fade.start && relPos < fade.end) { + fadeStart = now - (relPos - fade.start) / _this.speed; + fadeDuration = (fade.end - fade.start) / _this.speed; + } + + switch (fade.type) { + case _fadeMaker.FADEIN: { + playoutSystem.applyFadeIn(fadeStart, fadeDuration, fade.shape); + break; + } + case _fadeMaker.FADEOUT: { + playoutSystem.applyFadeOut(fadeStart, fadeDuration, fade.shape); + break; + } + default: { + throw new Error('Invalid fade type saved on track.'); + } + } + } + }); + + playoutSystem.setSpeed(this.speed); + playoutSystem.setVolumeGainLevel(this.gain); + playoutSystem.setShouldPlay(options.shouldPlay); + playoutSystem.setMasterGainLevel(options.masterGain); + playoutSystem.play(when, start, duration); + + return sourcePromise; + } + }, { + key: 'scheduleStop', + value: function scheduleStop() { + var when = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + + this.playout.stop(when); + } + }, { + key: 'renderOverlay', + value: function renderOverlay(data) { + var _this2 = this; + + var channelPixels = (0, _conversions.secondsToPixels)(data.playlistLength, data.resolution, data.sampleRate); + + var config = { + attributes: { + style: 'position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: ' + channelPixels + 'px; z-index: 9;' + } + }; + + var overlayClass = ''; + + if (this.stateObj) { + this.stateObj.setup(data.resolution, data.sampleRate); + var StateClass = _states2.default[this.state]; + var events = StateClass.getEvents(); + + events.forEach(function (event) { + config['on' + event] = _this2.stateObj[event].bind(_this2.stateObj); + }); + + overlayClass = StateClass.getClass(); + } + // use this overlay for track event cursor position calculations. + return (0, _h2.default)('div.playlist-overlay' + overlayClass, config); + } + }, { + key: 'renderControls', + value: function renderControls(data) { + var _this3 = this; + + var muteClass = data.muted ? '.active' : ''; + var soloClass = data.soloed ? '.active' : ''; + var numChan = this.peaks.data.length; + + return (0, _h2.default)('div.controls', { + attributes: { + style: 'height: ' + numChan * data.height + 'px; width: ' + data.controls.width + 'px; position: absolute; left: 0; z-index: 10;' + } + }, [(0, _h2.default)('header', [this.name]), (0, _h2.default)('div.btn-group', [(0, _h2.default)('span.btn.btn-default.btn-xs.btn-mute' + muteClass, { + onclick: function onclick() { + _this3.ee.emit('mute', _this3); + } + }, ['Mute']), (0, _h2.default)('span.btn.btn-default.btn-xs.btn-solo' + soloClass, { + onclick: function onclick() { + _this3.ee.emit('solo', _this3); + } + }, ['Solo'])]), (0, _h2.default)('label', [(0, _h2.default)('input.volume-slider', { + attributes: { + type: 'range', + min: 0, + max: 100, + value: 100 + }, + hook: new _VolumeSliderHook2.default(this.gain), + oninput: function oninput(e) { + _this3.ee.emit('volumechange', e.target.value, _this3); + } + })])]); + } + }, { + key: 'render', + value: function render(data) { + var _this4 = this; + + var width = this.peaks.length; + var playbackX = (0, _conversions.secondsToPixels)(data.playbackSeconds, data.resolution, data.sampleRate); + var startX = (0, _conversions.secondsToPixels)(this.startTime, data.resolution, data.sampleRate); + var endX = (0, _conversions.secondsToPixels)(this.endTime, data.resolution, data.sampleRate); + var progressWidth = 0; + var numChan = this.peaks.data.length; + + if (playbackX > 0 && playbackX > startX) { + if (playbackX < endX) { + progressWidth = playbackX - startX; + } else { + progressWidth = width; + } + } + + var waveformChildren = [(0, _h2.default)('div.cursor', { + attributes: { + style: 'position: absolute; width: 1px; margin: 0; padding: 0; top: 0; left: ' + playbackX + 'px; bottom: 0; z-index: 5;' + } + })]; + + var channels = Object.keys(this.peaks.data).map(function (channelNum) { + var channelChildren = [(0, _h2.default)('div.channel-progress', { + attributes: { + style: 'position: absolute; width: ' + progressWidth + 'px; height: ' + data.height + 'px; z-index: 2;' + } + })]; + var offset = 0; + var totalWidth = width; + var peaks = _this4.peaks.data[channelNum]; + + while (totalWidth > 0) { + var currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH); + var canvasColor = _this4.waveOutlineColor ? _this4.waveOutlineColor : data.colors.waveOutlineColor; + + channelChildren.push((0, _h2.default)('canvas', { + attributes: { + width: currentWidth, + height: data.height, + style: 'float: left; position: relative; margin: 0; padding: 0; z-index: 3;' + }, + hook: new _CanvasHook2.default(peaks, offset, _this4.peaks.bits, canvasColor) + })); + + totalWidth -= currentWidth; + offset += MAX_CANVAS_WIDTH; + } + + // if there are fades, display them. + if (_this4.fadeIn) { + var fadeIn = _this4.fades[_this4.fadeIn]; + var fadeWidth = (0, _conversions.secondsToPixels)(fadeIn.end - fadeIn.start, data.resolution, data.sampleRate); + + channelChildren.push((0, _h2.default)('div.wp-fade.wp-fadein', { + attributes: { + style: 'position: absolute; height: ' + data.height + 'px; width: ' + fadeWidth + 'px; top: 0; left: 0; z-index: 4;' + } + }, [(0, _h2.default)('canvas', { + attributes: { + width: fadeWidth, + height: data.height + }, + hook: new _FadeCanvasHook2.default(fadeIn.type, fadeIn.shape, fadeIn.end - fadeIn.start, data.resolution) + })])); + } + + if (_this4.fadeOut) { + var fadeOut = _this4.fades[_this4.fadeOut]; + var _fadeWidth = (0, _conversions.secondsToPixels)(fadeOut.end - fadeOut.start, data.resolution, data.sampleRate); + + channelChildren.push((0, _h2.default)('div.wp-fade.wp-fadeout', { + attributes: { + style: 'position: absolute; height: ' + data.height + 'px; width: ' + _fadeWidth + 'px; top: 0; right: 0; z-index: 4;' + } + }, [(0, _h2.default)('canvas', { + attributes: { + width: _fadeWidth, + height: data.height + }, + hook: new _FadeCanvasHook2.default(fadeOut.type, fadeOut.shape, fadeOut.end - fadeOut.start, data.resolution) + })])); + } + + return (0, _h2.default)('div.channel.channel-' + channelNum, { + attributes: { + style: 'height: ' + data.height + 'px; width: ' + width + 'px; top: ' + channelNum * data.height + 'px; left: ' + startX + 'px; position: absolute; margin: 0; padding: 0; z-index: 1;' + } + }, channelChildren); + }); + + waveformChildren.push(channels); + waveformChildren.push(this.renderOverlay(data)); + + // draw cursor selection on active track. + if (data.isActive === true) { + var cStartX = (0, _conversions.secondsToPixels)(data.timeSelection.start, data.resolution, data.sampleRate); + var cEndX = (0, _conversions.secondsToPixels)(data.timeSelection.end, data.resolution, data.sampleRate); + var cWidth = cEndX - cStartX + 1; + var cClassName = cWidth > 1 ? '.segment' : '.point'; + + waveformChildren.push((0, _h2.default)('div.selection' + cClassName, { + attributes: { + style: 'position: absolute; width: ' + cWidth + 'px; bottom: 0; top: 0; left: ' + cStartX + 'px; z-index: 4;' + } + })); + } + + var waveform = (0, _h2.default)('div.waveform', { + attributes: { + style: 'height: ' + numChan * data.height + 'px; position: relative;' + } + }, waveformChildren); + + var channelChildren = []; + var channelMargin = 0; + + if (data.controls.show) { + channelChildren.push(this.renderControls(data)); + channelMargin = data.controls.width; + } + + channelChildren.push(waveform); + + var audibleClass = data.shouldPlay ? '' : '.silent'; + var customClass = this.customClass === undefined ? '' : '.' + this.customClass; + + return (0, _h2.default)('div.channel-wrapper' + audibleClass + customClass, { + attributes: { + style: 'margin-left: ' + channelMargin + 'px; height: ' + data.height * numChan + 'px;' + } + }, channelChildren); + } + }, { + key: 'getTrackDetails', + value: function getTrackDetails() { + var info = { + src: this.src, + start: this.startTime, + end: this.endTime, + name: this.name, + customClass: this.customClass, + cuein: this.cueIn, + cueout: this.cueOut + }; + + if (this.fadeIn) { + var fadeIn = this.fades[this.fadeIn]; + + info.fadeIn = { + shape: fadeIn.shape, + duration: fadeIn.end - fadeIn.start + }; + } + + if (this.fadeOut) { + var fadeOut = this.fades[this.fadeOut]; + + info.fadeOut = { + shape: fadeOut.shape, + duration: fadeOut.end - fadeOut.start + }; + } + + return info; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 63 */ + /* 63 */ /***/ function(module, exports) { /** @@ -5939,19 +5981,19 @@ var WaveformPlaylist = * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - + + /** Used as references for various `Number` constants. */ + var MAX_SAFE_INTEGER = 9007199254740991; + /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - + genTag = '[object GeneratorFunction]'; + /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** + + /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * @@ -5963,143 +6005,142 @@ var WaveformPlaylist = function baseTimes(n, iteratee) { var index = -1, result = Array(n); - - while (++index < n) { + + while (++index < n) { result[index] = iteratee(index); } return result; } - - /** - * Creates a unary function that invokes `func` with its argument transformed. + + /** + * Creates a unary function that invokes `func` with its argument transformed. * * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; + function overArg(func, transform) { + return function (arg) { + return func(transform(arg)); + }; } - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; - - /** + + /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto.propertyIsEnumerable; - + + /** Built-in value references. */ + var propertyIsEnumerable = objectProto.propertyIsEnumerable; + /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object); - + var nativeKeys = overArg(Object.keys, Object); + /** - * Creates an array of the enumerable property names of the array-like `value`. + * Creates an array of the enumerable property names of the array-like `value`. * * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. */ - function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; - - var length = result.length, - skipIndexes = !!length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } + function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } } - return result; + return result; } - - /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. */ - var baseFor = createBaseFor(); - + var baseFor = createBaseFor(); + /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. + * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); } - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } return result; } - - /** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** + function createBaseFor(fromRight) { + return function (object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** * Checks if `value` is a valid array-like index. * * @private @@ -6113,8 +6154,8 @@ var WaveformPlaylist = (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } - - /** + + /** * Checks if `value` is likely a prototype object. * * @private @@ -6124,11 +6165,11 @@ var WaveformPlaylist = function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; + + return value === proto; } - - /** + + /** * Checks if `value` is likely an `arguments` object. * * @static @@ -6136,7 +6177,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * @@ -6147,12 +6188,12 @@ var WaveformPlaylist = * // => false */ function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } - - /** + + /** * Checks if `value` is classified as an `Array` object. * * @static @@ -6160,7 +6201,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); @@ -6176,8 +6217,8 @@ var WaveformPlaylist = * // => false */ var isArray = Array.isArray; - - /** + + /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. @@ -6203,10 +6244,10 @@ var WaveformPlaylist = * // => false */ function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } - - /** + + /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * @@ -6234,8 +6275,8 @@ var WaveformPlaylist = function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } - - /** + + /** * Checks if `value` is classified as a `Function` object. * * @static @@ -6243,7 +6284,7 @@ var WaveformPlaylist = * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -6254,23 +6295,23 @@ var WaveformPlaylist = */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } - - /** + + /** * Checks if `value` is a valid array-like length. * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -6289,10 +6330,10 @@ var WaveformPlaylist = return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } - - /** + + /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -6319,8 +6360,8 @@ var WaveformPlaylist = var type = typeof value; return !!value && (type == 'object' || type == 'function'); } - - /** + + /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * @@ -6347,44 +6388,44 @@ var WaveformPlaylist = function isObjectLike(value) { return !!value && typeof value == 'object'; } - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. * * @static * @memberOf _ - * @since 0.3.0 + * @since 0.3.0 * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight * @example * - * function Foo() { + * function Foo() { * this.a = 1; * this.b = 2; * } * - * Foo.prototype.c = 3; + * Foo.prototype.c = 3; * - * _.forOwn(new Foo, function(value, key) { + * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, typeof iteratee == 'function' ? iteratee : identity); + function forOwn(object, iteratee) { + return object && baseForOwn(object, typeof iteratee == 'function' ? iteratee : identity); } - - /** + + /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -6409,11 +6450,11 @@ var WaveformPlaylist = * // => ['0', '1'] */ function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } - - /** - * This method returns the first argument it receives. + + /** + * This method returns the first argument it receives. * * @static * @since 0.1.0 @@ -6423,32 +6464,32 @@ var WaveformPlaylist = * @returns {*} Returns `value`. * @example * - * var object = { 'a': 1 }; + * var object = { 'a': 1 }; * - * console.log(_.identity(object) === object); + * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } - - module.exports = forOwn; + + module.exports = forOwn; /***/ }, -/* 64 */ + /* 64 */ /***/ function(module, exports, __webpack_require__) { // uuid.js // // Copyright (c) 2010-2012 Robert Kieffer // MIT License - http://opensource.org/licenses/mit-license.php - - // Unique ID creation requires a high quality random # generator. We feature + + // Unique ID creation requires a high quality random # generator. We feature // detect to determine the best RNG source, normalizing to a function that // returns 128-bits of randomness, since that's what's usually required - var _rng = __webpack_require__(65); - + var _rng = __webpack_require__(65); + // Maps for number <-> hex string conversion var _byteToHex = []; var _hexToByte = {}; @@ -6456,27 +6497,27 @@ var WaveformPlaylist = _byteToHex[i] = (i + 0x100).toString(16).substr(1); _hexToByte[_byteToHex[i]] = i; } - - // **`parse()` - Parse a UUID into it's component bytes** + + // **`parse()` - Parse a UUID into it's component bytes** function parse(s, buf, offset) { var i = (buf && offset) || 0, ii = 0; - - buf = buf || []; + + buf = buf || []; s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) { if (ii < 16) { // Don't overflow! buf[i + ii++] = _hexToByte[oct]; } }); - - // Zero out remaining bytes if string was short + + // Zero out remaining bytes if string was short while (ii < 16) { buf[i + ii++] = 0; } - - return buf; + + return buf; } - - // **`unparse()` - Convert UUID byte array (ala parse()) into a string** + + // **`unparse()` - Convert UUID byte array (ala parse()) into a string** function unparse(buf, offset) { var i = offset || 0, bth = _byteToHex; return bth[buf[i++]] + bth[buf[i++]] + @@ -6488,151 +6529,151 @@ var WaveformPlaylist = bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; } - - // **`v1()` - Generate time-based UUID** + + // **`v1()` - Generate time-based UUID** // // Inspired by https://github.com/LiosK/UUID.js // and http://docs.python.org/library/uuid.html - - // random #'s we need to init node and clockseq + + // random #'s we need to init node and clockseq var _seedBytes = _rng(); - - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) var _nodeId = [ _seedBytes[0] | 0x01, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] ]; - - // Per 4.2.2, randomize (14 bit) clockseq + + // Per 4.2.2, randomize (14 bit) clockseq var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; - - // Previous uuid creation time + + // Previous uuid creation time var _lastMSecs = 0, _lastNSecs = 0; - - // See https://github.com/broofa/node-uuid for API details + + // See https://github.com/broofa/node-uuid for API details function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; - - options = options || {}; - - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; - - // UUID timestamps are 100 nano-second units since the Gregorian epoch, + + options = options || {}; + + var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; + + // UUID timestamps are 100 nano-second units since the Gregorian epoch, // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); - - // Per 4.2.1.2, use count of uuid's generated during the current clock + + // Per 4.2.1.2, use count of uuid's generated during the current clock // cycle to simulate higher resolution clock var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; - - // Time since last uuid creation (in msecs) + + // Time since last uuid creation (in msecs) var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; - - // Per 4.2.1.2, Bump clockseq on clock regression + + // Per 4.2.1.2, Bump clockseq on clock regression if (dt < 0 && options.clockseq === undefined) { clockseq = clockseq + 1 & 0x3fff; } - - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + + // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new // time interval if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { nsecs = 0; } - - // Per 4.2.1.2 Throw error if too many uuids are requested + + // Per 4.2.1.2 Throw error if too many uuids are requested if (nsecs >= 10000) { throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); } - - _lastMSecs = msecs; + + _lastMSecs = msecs; _lastNSecs = nsecs; _clockseq = clockseq; - - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + // Per 4.1.4 - Convert from unix epoch to Gregorian epoch msecs += 12219292800000; - - // `time_low` + + // `time_low` var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; b[i++] = tl >>> 24 & 0xff; b[i++] = tl >>> 16 & 0xff; b[i++] = tl >>> 8 & 0xff; b[i++] = tl & 0xff; - - // `time_mid` + + // `time_mid` var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; b[i++] = tmh >>> 8 & 0xff; b[i++] = tmh & 0xff; - - // `time_high_and_version` + + // `time_high_and_version` b[i++] = tmh >>> 24 & 0xf | 0x10; // include version b[i++] = tmh >>> 16 & 0xff; - - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) b[i++] = clockseq >>> 8 | 0x80; - - // `clock_seq_low` + + // `clock_seq_low` b[i++] = clockseq & 0xff; - - // `node` + + // `node` var node = options.node || _nodeId; for (var n = 0; n < 6; n++) { b[i + n] = node[n]; } - - return buf ? buf : unparse(b); + + return buf ? buf : unparse(b); } - - // **`v4()` - Generate random UUID** - - // See https://github.com/broofa/node-uuid for API details + + // **`v4()` - Generate random UUID** + + // See https://github.com/broofa/node-uuid for API details function v4(options, buf, offset) { // Deprecated - 'format' argument, as supported in v1.2 var i = buf && offset || 0; - - if (typeof(options) == 'string') { + + if (typeof(options) == 'string') { buf = options == 'binary' ? new Array(16) : null; options = null; } options = options || {}; - - var rnds = options.random || (options.rng || _rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + var rnds = options.random || (options.rng || _rng)(); + + // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = (rnds[6] & 0x0f) | 0x40; rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided + + // Copy bytes to buffer, if provided if (buf) { for (var ii = 0; ii < 16; ii++) { buf[i + ii] = rnds[ii]; } } - - return buf || unparse(rnds); + + return buf || unparse(rnds); } - - // Export public API + + // Export public API var uuid = v4; uuid.v1 = v1; uuid.v4 = v4; uuid.parse = parse; uuid.unparse = unparse; - - module.exports = uuid; + + module.exports = uuid; /***/ }, -/* 65 */ + /* 65 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) { var rng; - - var crypto = global.crypto || global.msCrypto; // for IE 11 - if (crypto && crypto.getRandomValues) { + + var crypto = global.crypto || global.msCrypto; // for IE 11 + if (crypto && crypto.getRandomValues) { // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto // Moderately fast, high quality var _rnds8 = new Uint8Array(16); @@ -6641,8 +6682,8 @@ var WaveformPlaylist = return _rnds8; }; } - - if (!rng) { + + if (!rng) { // Math.random()-based (RNG) // // If all else fails, use Math.random(). It's fast, but is of unspecified @@ -6653,23 +6694,23 @@ var WaveformPlaylist = if ((i & 0x03) === 0) r = Math.random() * 0x100000000; _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; } - - return _rnds; + + return _rnds; }; } - - module.exports = rng; - - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + + module.exports = rng; + + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, -/* 66 */ + /* 66 */ /***/ function(module, exports) { 'use strict'; - - //http://jsperf.com/typed-array-min-max/2 + + //http://jsperf.com/typed-array-min-max/2 //plain for loop for finding min/max is way faster than anything else. /** * @param {TypedArray} array - Subarray of audio to calculate peaks from. @@ -6680,8 +6721,8 @@ var WaveformPlaylist = var i = 0; var len = array.length; var curr; - - for(; i < len; i++) { + + for (; i < len; i++) { curr = array[i]; if (min > curr) { min = curr; @@ -6690,14 +6731,14 @@ var WaveformPlaylist = max = curr; } } - - return { + + return { min: min, max: max }; } - - /** + + /** * @param {Number} n - peak to convert from float to Int8, Int16 etc. * @param {Number} bits - convert to #bits two's complement signed integer */ @@ -6706,8 +6747,8 @@ var WaveformPlaylist = var v = n < 0 ? n * max : n * max - 1; return Math.max(-max, Math.min(max-1, v)); } - - /** + + /** * @param {TypedArray} channel - Audio track frames to calculate peaks from. * @param {Number} samplesPerPixel - Audio frames per peak */ @@ -6718,31 +6759,31 @@ var WaveformPlaylist = var start; var end; var segment; - var max; + var max; var min; var extrema; - - //create interleaved array of min,max + + //create interleaved array of min,max var peaks = new (eval("Int"+bits+"Array"))(numPeaks*2); - - for (i = 0; i < numPeaks; i++) { - - start = i * samplesPerPixel; + + for (i = 0; i < numPeaks; i++) { + + start = i * samplesPerPixel; end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel; - - segment = channel.subarray(start, end); + + segment = channel.subarray(start, end); extrema = findMinMax(segment); min = convert(extrema.min, bits); max = convert(extrema.max, bits); - - peaks[i*2] = min; + + peaks[i*2] = min; peaks[i*2+1] = max; } - - return peaks; + + return peaks; } - - function makeMono(channelPeaks, bits) { + + function makeMono(channelPeaks, bits) { var numChan = channelPeaks.length; var weight = 1 / numChan; var numPeaks = channelPeaks[0].length / 2; @@ -6751,25 +6792,25 @@ var WaveformPlaylist = var min; var max; var peaks = new (eval("Int"+bits+"Array"))(numPeaks*2); - - for (i = 0; i < numPeaks; i++) { + + for (i = 0; i < numPeaks; i++) { min = 0; max = 0; - - for (c = 0; c < numChan; c++) { + + for (c = 0; c < numChan; c++) { min += weight * channelPeaks[c][i*2]; max += weight * channelPeaks[c][i*2+1]; } - - peaks[i*2] = min; + + peaks[i*2] = min; peaks[i*2+1] = max; } - - //return in array so channel number counts still work. + + //return in array so channel number counts still work. return [peaks]; } - - /** + + /** * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations. * @param {Number} samplesPerPixel - Number of audio samples per peak. * @param {Number} cueIn - index in channel to start peak calculations from. @@ -6778,1320 +6819,1313 @@ var WaveformPlaylist = module.exports = function(source, samplesPerPixel, isMono, cueIn, cueOut, bits) { samplesPerPixel = samplesPerPixel || 10000; bits = bits || 8; - - if (isMono === null || isMono === undefined) { - isMono = true; - } - + + if (isMono === null || isMono === undefined) { + isMono = true; + } + if ([8, 16, 32].indexOf(bits) < 0) { throw new Error("Invalid number of bits specified for peaks."); } - - var numChan = source.numberOfChannels; + + var numChan = source.numberOfChannels; var peaks = []; var c; var numPeaks; var channel; var slice; - - if (typeof source.subarray === "undefined") { - for (c = 0; c < numChan; c++) { - channel = source.getChannelData(c); - cueIn = cueIn || 0; - cueOut = cueOut || channel.length; - slice = channel.subarray(cueIn, cueOut); - peaks.push(extractPeaks(slice, samplesPerPixel, bits)); - } - } - else { - cueIn = cueIn || 0; - cueOut = cueOut || source.length; - peaks.push(extractPeaks(source.subarray(cueIn, cueOut), samplesPerPixel, bits)); - } - - if (isMono && peaks.length > 1) { - peaks = makeMono(peaks, bits); - } - - numPeaks = peaks[0].length / 2; - - return { - length: numPeaks, - data: peaks, - bits: bits - }; - }; - -/***/ }, -/* 67 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.FADEOUT = exports.FADEIN = exports.LOGARITHMIC = exports.EXPONENTIAL = exports.LINEAR = exports.SCURVE = undefined; - exports.createFadeIn = createFadeIn; - exports.createFadeOut = createFadeOut; - - var _fadeCurves = __webpack_require__(68); - - var SCURVE = exports.SCURVE = "sCurve"; - var LINEAR = exports.LINEAR = "linear"; - var EXPONENTIAL = exports.EXPONENTIAL = "exponential"; - var LOGARITHMIC = exports.LOGARITHMIC = "logarithmic"; - - var FADEIN = exports.FADEIN = "FadeIn"; - var FADEOUT = exports.FADEOUT = "FadeOut"; - - function sCurveFadeIn(start, duration) { - var curve = (0, _fadeCurves.sCurve)(10000, 1); - this.setValueCurveAtTime(curve, start, duration); - } - - function sCurveFadeOut(start, duration) { - var curve = (0, _fadeCurves.sCurve)(10000, -1); - this.setValueCurveAtTime(curve, start, duration); - } - - function linearFadeIn(start, duration) { - this.linearRampToValueAtTime(0, start); - this.linearRampToValueAtTime(1, start + duration); - } - - function linearFadeOut(start, duration) { - this.linearRampToValueAtTime(1, start); - this.linearRampToValueAtTime(0, start + duration); - } - - function exponentialFadeIn(start, duration) { - this.exponentialRampToValueAtTime(0.01, start); - this.exponentialRampToValueAtTime(1, start + duration); - } - - function exponentialFadeOut(start, duration) { - this.exponentialRampToValueAtTime(1, start); - this.exponentialRampToValueAtTime(0.01, start + duration); - } - - function logarithmicFadeIn(start, duration) { - var curve = (0, _fadeCurves.logarithmic)(10000, 10, 1); - this.setValueCurveAtTime(curve, start, duration); - } - - function logarithmicFadeOut(start, duration) { - var curve = (0, _fadeCurves.logarithmic)(10000, 10, -1); - this.setValueCurveAtTime(curve, start, duration); - } - - function createFadeIn(gain, shape, start, duration) { - switch (shape) { - case SCURVE: - sCurveFadeIn.call(gain, start, duration); - break; - case LINEAR: - linearFadeIn.call(gain, start, duration); - break; - case EXPONENTIAL: - exponentialFadeIn.call(gain, start, duration); - break; - case LOGARITHMIC: - logarithmicFadeIn.call(gain, start, duration); - break; - default: - throw new Error("Unsupported Fade type"); - } - } - - function createFadeOut(gain, shape, start, duration) { - switch (shape) { - case SCURVE: - sCurveFadeOut.call(gain, start, duration); - break; - case LINEAR: - linearFadeOut.call(gain, start, duration); - break; - case EXPONENTIAL: - exponentialFadeOut.call(gain, start, duration); - break; - case LOGARITHMIC: - logarithmicFadeOut.call(gain, start, duration); - break; - default: - throw new Error("Unsupported Fade type"); - } - } - - -/***/ }, -/* 68 */ -/***/ function(module, exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.linear = linear; - exports.exponential = exponential; - exports.sCurve = sCurve; - exports.logarithmic = logarithmic; - function linear(length, rotation) { - var curve = new Float32Array(length), - i, - x, - scale = length - 1; - - for (i = 0; i < length; i++) { - x = i / scale; - - if (rotation > 0) { - curve[i] = x; - } else { - curve[i] = 1 - x; + if (typeof source.subarray === "undefined") { + for (c = 0; c < numChan; c++) { + channel = source.getChannelData(c); + cueIn = cueIn || 0; + cueOut = cueOut || channel.length; + slice = channel.subarray(cueIn, cueOut); + peaks.push(extractPeaks(slice, samplesPerPixel, bits)); } } - - return curve; - } - - function exponential(length, rotation) { - var curve = new Float32Array(length), - i, - x, - scale = length - 1, - index; - - for (i = 0; i < length; i++) { - x = i / scale; - index = rotation > 0 ? i : length - 1 - i; - - curve[index] = Math.exp(2 * x - 1) / Math.exp(1); - } - - return curve; - } - - //creating a curve to simulate an S-curve with setValueCurveAtTime. - function sCurve(length, rotation) { - var curve = new Float32Array(length), - i, - phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2); - - for (i = 0; i < length; ++i) { - curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5; + else { + cueIn = cueIn || 0; + cueOut = cueOut || source.length; + peaks.push(extractPeaks(source.subarray(cueIn, cueOut), samplesPerPixel, bits)); } - return curve; - } - - //creating a curve to simulate a logarithmic curve with setValueCurveAtTime. - function logarithmic(length, base, rotation) { - var curve = new Float32Array(length), - index, - x = 0, - i; - - for (i = 0; i < length; i++) { - //index for the curve array. - index = rotation > 0 ? i : length - 1 - i; - - x = i / length; - curve[index] = Math.log(1 + base * x) / Math.log(1 + base); + + if (isMono && peaks.length > 1) { + peaks = makeMono(peaks, bits); } - - return curve; - } + numPeaks = peaks[0].length / 2; + + return { + length: numPeaks, + data: peaks, + bits: bits + }; + }; /***/ }, -/* 69 */ + /* 67 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _CursorState = __webpack_require__(70); - + exports.FADEOUT = exports.FADEIN = exports.LOGARITHMIC = exports.EXPONENTIAL = exports.LINEAR = exports.SCURVE = undefined; + exports.createFadeIn = createFadeIn; + exports.createFadeOut = createFadeOut; + + var _fadeCurves = __webpack_require__(68); + + var SCURVE = exports.SCURVE = "sCurve"; + var LINEAR = exports.LINEAR = "linear"; + var EXPONENTIAL = exports.EXPONENTIAL = "exponential"; + var LOGARITHMIC = exports.LOGARITHMIC = "logarithmic"; + + var FADEIN = exports.FADEIN = "FadeIn"; + var FADEOUT = exports.FADEOUT = "FadeOut"; + + function sCurveFadeIn(start, duration) { + var curve = (0, _fadeCurves.sCurve)(10000, 1); + this.setValueCurveAtTime(curve, start, duration); + } + + function sCurveFadeOut(start, duration) { + var curve = (0, _fadeCurves.sCurve)(10000, -1); + this.setValueCurveAtTime(curve, start, duration); + } + + function linearFadeIn(start, duration) { + this.linearRampToValueAtTime(0, start); + this.linearRampToValueAtTime(1, start + duration); + } + + function linearFadeOut(start, duration) { + this.linearRampToValueAtTime(1, start); + this.linearRampToValueAtTime(0, start + duration); + } + + function exponentialFadeIn(start, duration) { + this.exponentialRampToValueAtTime(0.01, start); + this.exponentialRampToValueAtTime(1, start + duration); + } + + function exponentialFadeOut(start, duration) { + this.exponentialRampToValueAtTime(1, start); + this.exponentialRampToValueAtTime(0.01, start + duration); + } + + function logarithmicFadeIn(start, duration) { + var curve = (0, _fadeCurves.logarithmic)(10000, 10, 1); + this.setValueCurveAtTime(curve, start, duration); + } + + function logarithmicFadeOut(start, duration) { + var curve = (0, _fadeCurves.logarithmic)(10000, 10, -1); + this.setValueCurveAtTime(curve, start, duration); + } + + function createFadeIn(gain, shape, start, duration) { + switch (shape) { + case SCURVE: + sCurveFadeIn.call(gain, start, duration); + break; + case LINEAR: + linearFadeIn.call(gain, start, duration); + break; + case EXPONENTIAL: + exponentialFadeIn.call(gain, start, duration); + break; + case LOGARITHMIC: + logarithmicFadeIn.call(gain, start, duration); + break; + default: + throw new Error("Unsupported Fade type"); + } + } + + function createFadeOut(gain, shape, start, duration) { + switch (shape) { + case SCURVE: + sCurveFadeOut.call(gain, start, duration); + break; + case LINEAR: + linearFadeOut.call(gain, start, duration); + break; + case EXPONENTIAL: + exponentialFadeOut.call(gain, start, duration); + break; + case LOGARITHMIC: + logarithmicFadeOut.call(gain, start, duration); + break; + default: + throw new Error("Unsupported Fade type"); + } + } + + + /***/ + }, + /* 68 */ + /***/ function (module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.linear = linear; + exports.exponential = exponential; + exports.sCurve = sCurve; + exports.logarithmic = logarithmic; + function linear(length, rotation) { + var curve = new Float32Array(length), + i, + x, + scale = length - 1; + + for (i = 0; i < length; i++) { + x = i / scale; + + if (rotation > 0) { + curve[i] = x; + } else { + curve[i] = 1 - x; + } + } + + return curve; + } + + function exponential(length, rotation) { + var curve = new Float32Array(length), + i, + x, + scale = length - 1, + index; + + for (i = 0; i < length; i++) { + x = i / scale; + index = rotation > 0 ? i : length - 1 - i; + + curve[index] = Math.exp(2 * x - 1) / Math.exp(1); + } + + return curve; + } + + //creating a curve to simulate an S-curve with setValueCurveAtTime. + function sCurve(length, rotation) { + var curve = new Float32Array(length), + i, + phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2); + + for (i = 0; i < length; ++i) { + curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5; + } + return curve; + } + + //creating a curve to simulate a logarithmic curve with setValueCurveAtTime. + function logarithmic(length, base, rotation) { + var curve = new Float32Array(length), + index, + x = 0, + i; + + for (i = 0; i < length; i++) { + //index for the curve array. + index = rotation > 0 ? i : length - 1 - i; + + x = i / length; + curve[index] = Math.log(1 + base * x) / Math.log(1 + base); + } + + return curve; + } + + + /***/ + }, + /* 69 */ + /***/ function (module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _CursorState = __webpack_require__(70); + var _CursorState2 = _interopRequireDefault(_CursorState); - - var _SelectState = __webpack_require__(71); - + + var _SelectState = __webpack_require__(71); + var _SelectState2 = _interopRequireDefault(_SelectState); - - var _ShiftState = __webpack_require__(72); - + + var _ShiftState = __webpack_require__(72); + var _ShiftState2 = _interopRequireDefault(_ShiftState); - - var _FadeInState = __webpack_require__(73); - + + var _FadeInState = __webpack_require__(73); + var _FadeInState2 = _interopRequireDefault(_FadeInState); - - var _FadeOutState = __webpack_require__(74); - + + var _FadeOutState = __webpack_require__(74); + var _FadeOutState2 = _interopRequireDefault(_FadeOutState); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - cursor: _CursorState2.default, - select: _SelectState2.default, - shift: _ShiftState2.default, - fadein: _FadeInState2.default, - fadeout: _FadeOutState2.default + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + cursor: _CursorState2.default, + select: _SelectState2.default, + shift: _ShiftState2.default, + fadein: _FadeInState2.default, + fadeout: _FadeOutState2.default }; /***/ }, -/* 70 */ + /* 70 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _conversions = __webpack_require__(54); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _conversions = __webpack_require__(54); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class(track) { - _classCallCheck(this, _class); - - this.track = track; - } - - _createClass(_class, [{ - key: 'setup', - value: function setup(samplesPerPixel, sampleRate) { - this.samplesPerPixel = samplesPerPixel; - this.sampleRate = sampleRate; - } - }, { - key: 'click', - value: function click(e) { - e.preventDefault(); - - var startX = e.offsetX; - var startTime = (0, _conversions.pixelsToSeconds)(startX, this.samplesPerPixel, this.sampleRate); - - this.track.ee.emit('select', startTime, startTime, this.track); - } - }], [{ - key: 'getClass', - value: function getClass() { - return '.state-cursor'; - } - }, { - key: 'getEvents', - value: function getEvents() { - return ['click']; - } - }]); - return _class; + var _class = function () { + function _class(track) { + _classCallCheck(this, _class); + + this.track = track; + } + + _createClass(_class, [{ + key: 'setup', + value: function setup(samplesPerPixel, sampleRate) { + this.samplesPerPixel = samplesPerPixel; + this.sampleRate = sampleRate; + } + }, { + key: 'click', + value: function click(e) { + e.preventDefault(); + + var startX = e.offsetX; + var startTime = (0, _conversions.pixelsToSeconds)(startX, this.samplesPerPixel, this.sampleRate); + + this.track.ee.emit('select', startTime, startTime, this.track); + } + }], [{ + key: 'getClass', + value: function getClass() { + return '.state-cursor'; + } + }, { + key: 'getEvents', + value: function getEvents() { + return ['click']; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 71 */ + /* 71 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _conversions = __webpack_require__(54); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _conversions = __webpack_require__(54); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class(track) { - _classCallCheck(this, _class); - - this.track = track; - this.active = false; - } - - _createClass(_class, [{ - key: 'setup', - value: function setup(samplesPerPixel, sampleRate) { - this.samplesPerPixel = samplesPerPixel; - this.sampleRate = sampleRate; - } - }, { - key: 'emitSelection', - value: function emitSelection(x) { - var minX = Math.min(x, this.startX); - var maxX = Math.max(x, this.startX); - var startTime = (0, _conversions.pixelsToSeconds)(minX, this.samplesPerPixel, this.sampleRate); - var endTime = (0, _conversions.pixelsToSeconds)(maxX, this.samplesPerPixel, this.sampleRate); - - this.track.ee.emit('select', startTime, endTime, this.track); - } - }, { - key: 'complete', - value: function complete(x) { - this.emitSelection(x); - this.active = false; - } - }, { - key: 'mousedown', - value: function mousedown(e) { - e.preventDefault(); - this.active = true; - - this.startX = e.offsetX; - var startTime = (0, _conversions.pixelsToSeconds)(this.startX, this.samplesPerPixel, this.sampleRate); - - this.track.ee.emit('select', startTime, startTime, this.track); - } - }, { - key: 'mousemove', - value: function mousemove(e) { - if (this.active) { - e.preventDefault(); - this.emitSelection(e.offsetX); - } - } - }, { - key: 'mouseup', - value: function mouseup(e) { - if (this.active) { - e.preventDefault(); - this.complete(e.offsetX); - } - } - }, { - key: 'mouseleave', - value: function mouseleave(e) { - if (this.active) { - e.preventDefault(); - this.complete(e.offsetX); - } - } - }], [{ - key: 'getClass', - value: function getClass() { - return '.state-select'; - } - }, { - key: 'getEvents', - value: function getEvents() { - return ['mousedown', 'mousemove', 'mouseup', 'mouseleave']; - } - }]); - return _class; + var _class = function () { + function _class(track) { + _classCallCheck(this, _class); + + this.track = track; + this.active = false; + } + + _createClass(_class, [{ + key: 'setup', + value: function setup(samplesPerPixel, sampleRate) { + this.samplesPerPixel = samplesPerPixel; + this.sampleRate = sampleRate; + } + }, { + key: 'emitSelection', + value: function emitSelection(x) { + var minX = Math.min(x, this.startX); + var maxX = Math.max(x, this.startX); + var startTime = (0, _conversions.pixelsToSeconds)(minX, this.samplesPerPixel, this.sampleRate); + var endTime = (0, _conversions.pixelsToSeconds)(maxX, this.samplesPerPixel, this.sampleRate); + + this.track.ee.emit('select', startTime, endTime, this.track); + } + }, { + key: 'complete', + value: function complete(x) { + this.emitSelection(x); + this.active = false; + } + }, { + key: 'mousedown', + value: function mousedown(e) { + e.preventDefault(); + this.active = true; + + this.startX = e.offsetX; + var startTime = (0, _conversions.pixelsToSeconds)(this.startX, this.samplesPerPixel, this.sampleRate); + + this.track.ee.emit('select', startTime, startTime, this.track); + } + }, { + key: 'mousemove', + value: function mousemove(e) { + if (this.active) { + e.preventDefault(); + this.emitSelection(e.offsetX); + } + } + }, { + key: 'mouseup', + value: function mouseup(e) { + if (this.active) { + e.preventDefault(); + this.complete(e.offsetX); + } + } + }, { + key: 'mouseleave', + value: function mouseleave(e) { + if (this.active) { + e.preventDefault(); + this.complete(e.offsetX); + } + } + }], [{ + key: 'getClass', + value: function getClass() { + return '.state-select'; + } + }, { + key: 'getEvents', + value: function getEvents() { + return ['mousedown', 'mousemove', 'mouseup', 'mouseleave']; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 72 */ + /* 72 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _conversions = __webpack_require__(54); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _conversions = __webpack_require__(54); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class(track) { - _classCallCheck(this, _class); - - this.track = track; - this.active = false; - } - - _createClass(_class, [{ - key: 'setup', - value: function setup(samplesPerPixel, sampleRate) { - this.samplesPerPixel = samplesPerPixel; - this.sampleRate = sampleRate; - } - }, { - key: 'emitShift', - value: function emitShift(x) { - var deltaX = x - this.prevX; - var deltaTime = (0, _conversions.pixelsToSeconds)(deltaX, this.samplesPerPixel, this.sampleRate); - this.prevX = x; - this.track.ee.emit('shift', deltaTime, this.track); - } - }, { - key: 'complete', - value: function complete(x) { - this.emitShift(x); - this.active = false; - } - }, { - key: 'mousedown', - value: function mousedown(e) { - e.preventDefault(); - - this.active = true; - this.el = e.target; - this.prevX = e.offsetX; - } - }, { - key: 'mousemove', - value: function mousemove(e) { - if (this.active) { - e.preventDefault(); - this.emitShift(e.offsetX); - } - } - }, { - key: 'mouseup', - value: function mouseup(e) { - if (this.active) { - e.preventDefault(); - this.complete(e.offsetX); - } - } - }, { - key: 'mouseleave', - value: function mouseleave(e) { - if (this.active) { - e.preventDefault(); - this.complete(e.offsetX); - } - } - }], [{ - key: 'getClass', - value: function getClass() { - return '.state-shift'; - } - }, { - key: 'getEvents', - value: function getEvents() { - return ['mousedown', 'mousemove', 'mouseup', 'mouseleave']; - } - }]); - return _class; + var _class = function () { + function _class(track) { + _classCallCheck(this, _class); + + this.track = track; + this.active = false; + } + + _createClass(_class, [{ + key: 'setup', + value: function setup(samplesPerPixel, sampleRate) { + this.samplesPerPixel = samplesPerPixel; + this.sampleRate = sampleRate; + } + }, { + key: 'emitShift', + value: function emitShift(x) { + var deltaX = x - this.prevX; + var deltaTime = (0, _conversions.pixelsToSeconds)(deltaX, this.samplesPerPixel, this.sampleRate); + this.prevX = x; + this.track.ee.emit('shift', deltaTime, this.track); + } + }, { + key: 'complete', + value: function complete(x) { + this.emitShift(x); + this.active = false; + } + }, { + key: 'mousedown', + value: function mousedown(e) { + e.preventDefault(); + + this.active = true; + this.el = e.target; + this.prevX = e.offsetX; + } + }, { + key: 'mousemove', + value: function mousemove(e) { + if (this.active) { + e.preventDefault(); + this.emitShift(e.offsetX); + } + } + }, { + key: 'mouseup', + value: function mouseup(e) { + if (this.active) { + e.preventDefault(); + this.complete(e.offsetX); + } + } + }, { + key: 'mouseleave', + value: function mouseleave(e) { + if (this.active) { + e.preventDefault(); + this.complete(e.offsetX); + } + } + }], [{ + key: 'getClass', + value: function getClass() { + return '.state-shift'; + } + }, { + key: 'getEvents', + value: function getEvents() { + return ['mousedown', 'mousemove', 'mouseup', 'mouseleave']; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 73 */ + /* 73 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _conversions = __webpack_require__(54); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _conversions = __webpack_require__(54); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class(track) { - _classCallCheck(this, _class); - - this.track = track; - } - - _createClass(_class, [{ - key: 'setup', - value: function setup(samplesPerPixel, sampleRate) { - this.samplesPerPixel = samplesPerPixel; - this.sampleRate = sampleRate; - } - }, { - key: 'click', - value: function click(e) { - var startX = e.offsetX; - var time = (0, _conversions.pixelsToSeconds)(startX, this.samplesPerPixel, this.sampleRate); - - if (time > this.track.getStartTime() && time < this.track.getEndTime()) { - this.track.ee.emit('fadein', time - this.track.getStartTime(), this.track); - } - } - }], [{ - key: 'getClass', - value: function getClass() { - return '.state-fadein'; - } - }, { - key: 'getEvents', - value: function getEvents() { - return ['click']; - } - }]); - return _class; + var _class = function () { + function _class(track) { + _classCallCheck(this, _class); + + this.track = track; + } + + _createClass(_class, [{ + key: 'setup', + value: function setup(samplesPerPixel, sampleRate) { + this.samplesPerPixel = samplesPerPixel; + this.sampleRate = sampleRate; + } + }, { + key: 'click', + value: function click(e) { + var startX = e.offsetX; + var time = (0, _conversions.pixelsToSeconds)(startX, this.samplesPerPixel, this.sampleRate); + + if (time > this.track.getStartTime() && time < this.track.getEndTime()) { + this.track.ee.emit('fadein', time - this.track.getStartTime(), this.track); + } + } + }], [{ + key: 'getClass', + value: function getClass() { + return '.state-fadein'; + } + }, { + key: 'getEvents', + value: function getEvents() { + return ['click']; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 74 */ + /* 74 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _conversions = __webpack_require__(54); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _conversions = __webpack_require__(54); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class(track) { - _classCallCheck(this, _class); - - this.track = track; - } - - _createClass(_class, [{ - key: 'setup', - value: function setup(samplesPerPixel, sampleRate) { - this.samplesPerPixel = samplesPerPixel; - this.sampleRate = sampleRate; - } - }, { - key: 'click', - value: function click(e) { - var startX = e.offsetX; - var time = (0, _conversions.pixelsToSeconds)(startX, this.samplesPerPixel, this.sampleRate); - - if (time > this.track.getStartTime() && time < this.track.getEndTime()) { - this.track.ee.emit('fadeout', this.track.getEndTime() - time, this.track); - } - } - }], [{ - key: 'getClass', - value: function getClass() { - return '.state-fadeout'; - } - }, { - key: 'getEvents', - value: function getEvents() { - return ['click']; - } - }]); - return _class; + var _class = function () { + function _class(track) { + _classCallCheck(this, _class); + + this.track = track; + } + + _createClass(_class, [{ + key: 'setup', + value: function setup(samplesPerPixel, sampleRate) { + this.samplesPerPixel = samplesPerPixel; + this.sampleRate = sampleRate; + } + }, { + key: 'click', + value: function click(e) { + var startX = e.offsetX; + var time = (0, _conversions.pixelsToSeconds)(startX, this.samplesPerPixel, this.sampleRate); + + if (time > this.track.getStartTime() && time < this.track.getEndTime()) { + this.track.ee.emit('fadeout', this.track.getEndTime() - time, this.track); + } + } + }], [{ + key: 'getClass', + value: function getClass() { + return '.state-fadeout'; + } + }, { + key: 'getEvents', + value: function getEvents() { + return ['click']; + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 75 */ + /* 75 */ /***/ function(module, exports) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /* + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /* * virtual-dom hook for drawing to the canvas element. */ - var CanvasHook = function () { - function CanvasHook(peaks, offset, bits, color) { - _classCallCheck(this, CanvasHook); - - this.peaks = peaks; - // http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element - this.offset = offset; - this.color = color; - this.bits = bits; - } - - _createClass(CanvasHook, [{ - key: 'hook', - value: function hook(canvas, prop, prev) { - // canvas is up to date - if (prev !== undefined && prev.peaks === this.peaks) { - return; - } - - var len = canvas.width; - var cc = canvas.getContext('2d'); - var h2 = canvas.height / 2; - var maxValue = Math.pow(2, this.bits - 1); - - cc.clearRect(0, 0, canvas.width, canvas.height); - cc.fillStyle = this.color; - - for (var i = 0; i < len; i += 1) { - var minPeak = this.peaks[(i + this.offset) * 2] / maxValue; - var maxPeak = this.peaks[(i + this.offset) * 2 + 1] / maxValue; - CanvasHook.drawFrame(cc, h2, i, minPeak, maxPeak); - } - } - }], [{ - key: 'drawFrame', - value: function drawFrame(cc, h2, x, minPeak, maxPeak) { - var min = Math.abs(minPeak * h2); - var max = Math.abs(maxPeak * h2); - - // draw max - cc.fillRect(x, 0, 1, h2 - max); - // draw min - cc.fillRect(x, h2 + min, 1, h2 - min); - } - }]); - - return CanvasHook; + var CanvasHook = function () { + function CanvasHook(peaks, offset, bits, color) { + _classCallCheck(this, CanvasHook); + + this.peaks = peaks; + // http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element + this.offset = offset; + this.color = color; + this.bits = bits; + } + + _createClass(CanvasHook, [{ + key: 'hook', + value: function hook(canvas, prop, prev) { + // canvas is up to date + if (prev !== undefined && prev.peaks === this.peaks) { + return; + } + + var len = canvas.width; + var cc = canvas.getContext('2d'); + var h2 = canvas.height / 2; + var maxValue = Math.pow(2, this.bits - 1); + + cc.clearRect(0, 0, canvas.width, canvas.height); + cc.fillStyle = this.color; + + for (var i = 0; i < len; i += 1) { + var minPeak = this.peaks[(i + this.offset) * 2] / maxValue; + var maxPeak = this.peaks[(i + this.offset) * 2 + 1] / maxValue; + CanvasHook.drawFrame(cc, h2, i, minPeak, maxPeak); + } + } + }], [{ + key: 'drawFrame', + value: function drawFrame(cc, h2, x, minPeak, maxPeak) { + var min = Math.abs(minPeak * h2); + var max = Math.abs(maxPeak * h2); + + // draw max + cc.fillRect(x, 0, 1, h2 - max); + // draw min + cc.fillRect(x, h2 + min, 1, h2 - min); + } + }]); + + return CanvasHook; }(); - - exports.default = CanvasHook; + + exports.default = CanvasHook; /***/ }, -/* 76 */ + /* 76 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _fadeMaker = __webpack_require__(67); - - var _fadeCurves = __webpack_require__(68); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _fadeMaker = __webpack_require__(67); + + var _fadeCurves = __webpack_require__(68); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /* + + /* * virtual-dom hook for drawing the fade curve to the canvas element. */ - var FadeCanvasHook = function () { - function FadeCanvasHook(type, shape, duration, samplesPerPixel) { - _classCallCheck(this, FadeCanvasHook); - - this.type = type; - this.shape = shape; - this.duration = duration; - this.samplesPerPixel = samplesPerPixel; - } - - _createClass(FadeCanvasHook, [{ - key: 'hook', - value: function hook(canvas, prop, prev) { - // node is up to date. - if (prev !== undefined && prev.shape === this.shape && prev.type === this.type && prev.duration === this.duration && prev.samplesPerPixel === this.samplesPerPixel) { - return; - } - - var ctx = canvas.getContext('2d'); - var width = canvas.width; - var height = canvas.height; - var curve = FadeCanvasHook.createCurve(this.shape, this.type, width); - var len = curve.length; - var y = height - curve[0] * height; - - ctx.strokeStyle = 'black'; - ctx.beginPath(); - ctx.moveTo(0, y); - - for (var i = 1; i < len; i += 1) { - y = height - curve[i] * height; - ctx.lineTo(i, y); - } - ctx.stroke(); - } - }], [{ - key: 'createCurve', - value: function createCurve(shape, type, width) { - var reflection = void 0; - var curve = void 0; - - switch (type) { - case _fadeMaker.FADEIN: - { - reflection = 1; + var FadeCanvasHook = function () { + function FadeCanvasHook(type, shape, duration, samplesPerPixel) { + _classCallCheck(this, FadeCanvasHook); + + this.type = type; + this.shape = shape; + this.duration = duration; + this.samplesPerPixel = samplesPerPixel; + } + + _createClass(FadeCanvasHook, [{ + key: 'hook', + value: function hook(canvas, prop, prev) { + // node is up to date. + if (prev !== undefined && prev.shape === this.shape && prev.type === this.type && prev.duration === this.duration && prev.samplesPerPixel === this.samplesPerPixel) { + return; + } + + var ctx = canvas.getContext('2d'); + var width = canvas.width; + var height = canvas.height; + var curve = FadeCanvasHook.createCurve(this.shape, this.type, width); + var len = curve.length; + var y = height - curve[0] * height; + + ctx.strokeStyle = 'black'; + ctx.beginPath(); + ctx.moveTo(0, y); + + for (var i = 1; i < len; i += 1) { + y = height - curve[i] * height; + ctx.lineTo(i, y); + } + ctx.stroke(); + } + }], [{ + key: 'createCurve', + value: function createCurve(shape, type, width) { + var reflection = void 0; + var curve = void 0; + + switch (type) { + case _fadeMaker.FADEIN: { + reflection = 1; break; - } - case _fadeMaker.FADEOUT: - { - reflection = -1; + } + case _fadeMaker.FADEOUT: { + reflection = -1; break; - } - default: - { - throw new Error('Unsupported fade type.'); - } - } - - switch (shape) { - case _fadeMaker.SCURVE: - { - curve = (0, _fadeCurves.sCurve)(width, reflection); + } + default: { + throw new Error('Unsupported fade type.'); + } + } + + switch (shape) { + case _fadeMaker.SCURVE: { + curve = (0, _fadeCurves.sCurve)(width, reflection); break; - } - case _fadeMaker.LINEAR: - { - curve = (0, _fadeCurves.linear)(width, reflection); + } + case _fadeMaker.LINEAR: { + curve = (0, _fadeCurves.linear)(width, reflection); break; - } - case _fadeMaker.EXPONENTIAL: - { - curve = (0, _fadeCurves.exponential)(width, reflection); + } + case _fadeMaker.EXPONENTIAL: { + curve = (0, _fadeCurves.exponential)(width, reflection); break; - } - case _fadeMaker.LOGARITHMIC: - { - curve = (0, _fadeCurves.logarithmic)(width, 10, reflection); + } + case _fadeMaker.LOGARITHMIC: { + curve = (0, _fadeCurves.logarithmic)(width, 10, reflection); break; - } - default: - { - throw new Error('Unsupported fade shape'); - } - } - - return curve; - } - }]); - - return FadeCanvasHook; - }(); - - exports.default = FadeCanvasHook; + } + default: { + throw new Error('Unsupported fade shape'); + } + } + + return curve; + } + }]); + + return FadeCanvasHook; + }(); + + exports.default = FadeCanvasHook; /***/ }, -/* 77 */ + /* 77 */ /***/ function(module, exports) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /* + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /* * virtual-dom hook for setting the volume input programmatically. */ var _class = function () { - function _class(gain) { - _classCallCheck(this, _class); - - this.gain = gain; - } - - _createClass(_class, [{ - key: 'hook', - value: function hook(volumeInput) { - volumeInput.setAttribute('value', this.gain * 100); - } - }]); + function _class(gain) { + _classCallCheck(this, _class); + + this.gain = gain; + } - return _class; + _createClass(_class, [{ + key: 'hook', + value: function hook(volumeInput) { + volumeInput.setAttribute('value', this.gain * 100); + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 78 */ + /* 78 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true + + Object.defineProperty(exports, "__esModule", { + value: true }); - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _fadeMaker = __webpack_require__(67); - + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _fadeMaker = __webpack_require__(67); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var _class = function () { - function _class(ac, buffer) { - _classCallCheck(this, _class); - - this.ac = ac; - this.gain = 1; - this.buffer = buffer; - this.destination = this.ac.destination; - } - - _createClass(_class, [{ - key: 'applyFade', - value: function applyFade(type, start, duration) { - var shape = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'logarithmic'; - - if (type === _fadeMaker.FADEIN) { - (0, _fadeMaker.createFadeIn)(this.fadeGain.gain, shape, start, duration); - } else if (type === _fadeMaker.FADEOUT) { - (0, _fadeMaker.createFadeOut)(this.fadeGain.gain, shape, start, duration); - } else { - throw new Error('Unsupported fade type'); - } - } - }, { - key: 'applyFadeIn', - value: function applyFadeIn(start, duration) { - var shape = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'logarithmic'; - - this.applyFade(_fadeMaker.FADEIN, start, duration, shape); - } - }, { - key: 'applyFadeOut', - value: function applyFadeOut(start, duration) { - var shape = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'logarithmic'; - - this.applyFade(_fadeMaker.FADEOUT, start, duration, shape); - } - }, { - key: 'isPlaying', - value: function isPlaying() { - return this.source !== undefined; - } - }, { - key: 'getDuration', - value: function getDuration() { - return this.buffer.duration; - } - }, { - key: 'setAudioContext', - value: function setAudioContext(audioContext) { - this.ac = audioContext; - this.destination = this.ac.destination; - } - }, { - key: 'setUpSource', - value: function setUpSource() { - var _this = this; - - this.source = this.ac.createBufferSource(); - this.source.buffer = this.buffer; - - var sourcePromise = new Promise(function (resolve) { - // keep track of the buffer state. - _this.source.onended = function () { - _this.source.disconnect(); - _this.fadeGain.disconnect(); - _this.volumeGain.disconnect(); - _this.shouldPlayGain.disconnect(); - _this.masterGain.disconnect(); - - _this.source = undefined; - _this.fadeGain = undefined; - _this.volumeGain = undefined; - _this.shouldPlayGain = undefined; - _this.masterGain = undefined; - - resolve(); - }; - }); - - this.fadeGain = this.ac.createGain(); - // used for track volume slider - this.volumeGain = this.ac.createGain(); - // used for solo/mute - this.shouldPlayGain = this.ac.createGain(); - this.masterGain = this.ac.createGain(); - - this.source.connect(this.fadeGain); - this.fadeGain.connect(this.volumeGain); - this.volumeGain.connect(this.shouldPlayGain); - this.shouldPlayGain.connect(this.masterGain); - this.masterGain.connect(this.destination); - - return sourcePromise; - } - }, { - key: 'setVolumeGainLevel', - value: function setVolumeGainLevel(level) { - if (this.volumeGain) { - this.volumeGain.gain.value = level; - } - } - }, { - key: 'setShouldPlay', - value: function setShouldPlay(bool) { - if (this.shouldPlayGain) { - this.shouldPlayGain.gain.value = bool ? 1 : 0; - } - } - }, { - key: 'setMasterGainLevel', - value: function setMasterGainLevel(level) { - if (this.masterGain) { - this.masterGain.gain.value = level; - } - } - - /* - source.start is picky when passing the end time. - If rounding error causes a number to make the source think - it is playing slightly more samples than it has it won't play at all. - Unfortunately it doesn't seem to work if you just give it a start time. - */ - - }, { - key: 'play', - value: function play(when, start, duration) { - this.source.start(when, start, duration); - } - }, { - key: 'stop', - value: function stop() { - var when = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - - if (this.source) { - this.source.stop(when); - } - } - }]); - return _class; + var _class = function () { + function _class(ac, buffer) { + _classCallCheck(this, _class); + + this.ac = ac; + this.gain = 1; + this.buffer = buffer; + this.destination = this.ac.destination; + } + + _createClass(_class, [{ + key: 'applyFade', + value: function applyFade(type, start, duration) { + var shape = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'logarithmic'; + + if (type === _fadeMaker.FADEIN) { + (0, _fadeMaker.createFadeIn)(this.fadeGain.gain, shape, start, duration); + } else if (type === _fadeMaker.FADEOUT) { + (0, _fadeMaker.createFadeOut)(this.fadeGain.gain, shape, start, duration); + } else { + throw new Error('Unsupported fade type'); + } + } + }, { + key: 'applyFadeIn', + value: function applyFadeIn(start, duration) { + var shape = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'logarithmic'; + + this.applyFade(_fadeMaker.FADEIN, start, duration, shape); + } + }, { + key: 'applyFadeOut', + value: function applyFadeOut(start, duration) { + var shape = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'logarithmic'; + + this.applyFade(_fadeMaker.FADEOUT, start, duration, shape); + } + }, { + key: 'isPlaying', + value: function isPlaying() { + return this.source !== undefined; + } + }, { + key: 'getDuration', + value: function getDuration() { + return this.buffer.duration; + } + }, { + key: 'setAudioContext', + value: function setAudioContext(audioContext) { + this.ac = audioContext; + this.destination = this.ac.destination; + } + }, { + key: 'setUpSource', + value: function setUpSource() { + var _this = this; + + this.source = this.ac.createBufferSource(); + this.source.buffer = this.buffer; + + var sourcePromise = new Promise(function (resolve) { + // keep track of the buffer state. + _this.source.onended = function () { + _this.source.disconnect(); + _this.fadeGain.disconnect(); + _this.volumeGain.disconnect(); + _this.shouldPlayGain.disconnect(); + _this.masterGain.disconnect(); + + _this.source = undefined; + _this.fadeGain = undefined; + _this.volumeGain = undefined; + _this.shouldPlayGain = undefined; + _this.masterGain = undefined; + + resolve(); + }; + }); + + this.fadeGain = this.ac.createGain(); + // used for track volume slider + this.volumeGain = this.ac.createGain(); + // used for solo/mute + this.shouldPlayGain = this.ac.createGain(); + this.masterGain = this.ac.createGain(); + + this.source.connect(this.fadeGain); + this.fadeGain.connect(this.volumeGain); + this.volumeGain.connect(this.shouldPlayGain); + this.shouldPlayGain.connect(this.masterGain); + this.masterGain.connect(this.destination); + + return sourcePromise; + } + }, { + key: 'setVolumeGainLevel', + value: function setVolumeGainLevel(level) { + if (this.volumeGain) { + this.volumeGain.gain.value = level; + } + } + }, { + key: 'setShouldPlay', + value: function setShouldPlay(bool) { + if (this.shouldPlayGain) { + this.shouldPlayGain.gain.value = bool ? 1 : 0; + } + } + }, { + key: 'setMasterGainLevel', + value: function setMasterGainLevel(level) { + if (this.masterGain) { + this.masterGain.gain.value = level; + } + } + }, { + key: 'setSpeed', + value: function setSpeed(speed) { + this.speed = speed; + } /* + source.start is picky when passing the end time. + If rounding error causes a number to make the source think + it is playing slightly more samples than it has it won't play at all. + Unfortunately it doesn't seem to work if you just give it a start time. + */ + + }, { + key: 'play', + value: function play(when, start, duration) { + this.source.start(when, start, duration); + this.source.playbackRate.value = this.speed; + } + }, { + key: 'stop', + value: function stop() { + var when = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + + if (this.source) { + this.source.stop(when); + } + } + }]); + + return _class; }(); exports.default = _class; /***/ }, -/* 79 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - exports.default = function () { - // http://jsperf.com/typed-array-min-max/2 - // plain for loop for finding min/max is way faster than anything else. - /** - * @param {TypedArray} array - Subarray of audio to calculate peaks from. - */ - function findMinMax(array) { - var min = Infinity; - var max = -Infinity; - var curr = void 0; - - for (var i = 0; i < array.length; i += 1) { - curr = array[i]; - if (min > curr) { - min = curr; - } - if (max < curr) { - max = curr; - } - } - - return { - min: min, - max: max - }; - } - - /** - * @param {Number} n - peak to convert from float to Int8, Int16 etc. - * @param {Number} bits - convert to #bits two's complement signed integer - */ - function convert(n, bits) { - var max = Math.pow(2, bits - 1); - var v = n < 0 ? n * max : n * max - 1; - return Math.max(-max, Math.min(max - 1, v)); - } - - /** - * @param {TypedArray} channel - Audio track frames to calculate peaks from. - * @param {Number} samplesPerPixel - Audio frames per peak - */ - function extractPeaks(channel, samplesPerPixel, bits) { - var chanLength = channel.length; - var numPeaks = Math.ceil(chanLength / samplesPerPixel); - var start = void 0; - var end = void 0; - var segment = void 0; - var max = void 0; - var min = void 0; - var extrema = void 0; - - // create interleaved array of min,max - var peaks = new self['Int' + bits + 'Array'](numPeaks * 2); - - for (var i = 0; i < numPeaks; i += 1) { - start = i * samplesPerPixel; - end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel; - - segment = channel.subarray(start, end); - extrema = findMinMax(segment); - min = convert(extrema.min, bits); - max = convert(extrema.max, bits); - - peaks[i * 2] = min; - peaks[i * 2 + 1] = max; - } - - return peaks; - } - - function makeMono(channelPeaks, bits) { - var numChan = channelPeaks.length; - var weight = 1 / numChan; - var numPeaks = channelPeaks[0].length / 2; - var min = void 0; - var max = void 0; - var peaks = new self['Int' + bits + 'Array'](numPeaks * 2); - - for (var i = 0; i < numPeaks; i += 1) { - min = 0; - max = 0; - - for (var c = 0; c < numChan; c += 1) { - min += weight * channelPeaks[c][i * 2]; - max += weight * channelPeaks[c][i * 2 + 1]; - } - - peaks[i * 2] = min; - peaks[i * 2 + 1] = max; - } - - // return in array so channel number counts still work. - return [peaks]; - } - - /** - * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations. - * @param {Number} samplesPerPixel - Number of audio samples per peak. - * @param {Number} cueIn - index in channel to start peak calculations from. - * @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive). - */ - function audioPeaks(source) { - var samplesPerPixel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000; - var isMono = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - var cueIn = arguments[3]; - var cueOut = arguments[4]; - var bits = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 8; - - if ([8, 16, 32].indexOf(bits) < 0) { - throw new Error('Invalid number of bits specified for peaks.'); - } - - var numChan = source.numberOfChannels; - var peaks = []; - - if (typeof source.subarray === 'undefined') { - for (var c = 0; c < numChan; c += 1) { - var channel = source.getChannelData(c); - var start = cueIn || 0; - var end = cueOut || channel.length; - var slice = channel.subarray(start, end); - peaks.push(extractPeaks(slice, samplesPerPixel, bits)); - } - } else { - var _start = cueIn || 0; - var _end = cueOut || source.length; - peaks.push(extractPeaks(source.subarray(_start, _end), samplesPerPixel, bits)); - } - - if (isMono && peaks.length > 1) { - peaks = makeMono(peaks, bits); - } - - var length = peaks[0].length / 2; - - return { - bits: bits, - length: length, - data: peaks - }; - } - - onmessage = function onmessage(e) { - var peaks = audioPeaks(e.data.samples, e.data.samplesPerPixel); - - postMessage(peaks); - }; + /* 79 */ + /***/ function (module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.default = function () { + // http://jsperf.com/typed-array-min-max/2 + // plain for loop for finding min/max is way faster than anything else. + /** + * @param {TypedArray} array - Subarray of audio to calculate peaks from. + */ + function findMinMax(array) { + var min = Infinity; + var max = -Infinity; + var curr = void 0; + + for (var i = 0; i < array.length; i += 1) { + curr = array[i]; + if (min > curr) { + min = curr; + } + if (max < curr) { + max = curr; + } + } + + return { + min: min, + max: max + }; + } + + /** + * @param {Number} n - peak to convert from float to Int8, Int16 etc. + * @param {Number} bits - convert to #bits two's complement signed integer + */ + function convert(n, bits) { + var max = Math.pow(2, bits - 1); + var v = n < 0 ? n * max : n * max - 1; + return Math.max(-max, Math.min(max - 1, v)); + } + + /** + * @param {TypedArray} channel - Audio track frames to calculate peaks from. + * @param {Number} samplesPerPixel - Audio frames per peak + */ + function extractPeaks(channel, samplesPerPixel, bits) { + var chanLength = channel.length; + var numPeaks = Math.ceil(chanLength / samplesPerPixel); + var start = void 0; + var end = void 0; + var segment = void 0; + var max = void 0; + var min = void 0; + var extrema = void 0; + + // create interleaved array of min,max + var peaks = new self['Int' + bits + 'Array'](numPeaks * 2); + + for (var i = 0; i < numPeaks; i += 1) { + start = i * samplesPerPixel; + end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel; + + segment = channel.subarray(start, end); + extrema = findMinMax(segment); + min = convert(extrema.min, bits); + max = convert(extrema.max, bits); + + peaks[i * 2] = min; + peaks[i * 2 + 1] = max; + } + + return peaks; + } + + function makeMono(channelPeaks, bits) { + var numChan = channelPeaks.length; + var weight = 1 / numChan; + var numPeaks = channelPeaks[0].length / 2; + var min = void 0; + var max = void 0; + var peaks = new self['Int' + bits + 'Array'](numPeaks * 2); + + for (var i = 0; i < numPeaks; i += 1) { + min = 0; + max = 0; + + for (var c = 0; c < numChan; c += 1) { + min += weight * channelPeaks[c][i * 2]; + max += weight * channelPeaks[c][i * 2 + 1]; + } + + peaks[i * 2] = min; + peaks[i * 2 + 1] = max; + } + + // return in array so channel number counts still work. + return [peaks]; + } + + /** + * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations. + * @param {Number} samplesPerPixel - Number of audio samples per peak. + * @param {Number} cueIn - index in channel to start peak calculations from. + * @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive). + */ + function audioPeaks(source) { + var samplesPerPixel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000; + var isMono = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var cueIn = arguments[3]; + var cueOut = arguments[4]; + var bits = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 8; + + if ([8, 16, 32].indexOf(bits) < 0) { + throw new Error('Invalid number of bits specified for peaks.'); + } + + var numChan = source.numberOfChannels; + var peaks = []; + + if (typeof source.subarray === 'undefined') { + for (var c = 0; c < numChan; c += 1) { + var channel = source.getChannelData(c); + var start = cueIn || 0; + var end = cueOut || channel.length; + var slice = channel.subarray(start, end); + peaks.push(extractPeaks(slice, samplesPerPixel, bits)); + } + } else { + var _start = cueIn || 0; + var _end = cueOut || source.length; + peaks.push(extractPeaks(source.subarray(_start, _end), samplesPerPixel, bits)); + } + + if (isMono && peaks.length > 1) { + peaks = makeMono(peaks, bits); + } + + var length = peaks[0].length / 2; + + return { + bits: bits, + length: length, + data: peaks + }; + } + + onmessage = function onmessage(e) { + var peaks = audioPeaks(e.data.samples, e.data.samplesPerPixel); + + postMessage(peaks); + }; }; /***/ }, -/* 80 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - exports.default = function () { - var recLength = 0; - var recBuffersL = []; - var recBuffersR = []; - var sampleRate = void 0; - - function init(config) { - sampleRate = config.sampleRate; - } - - function record(inputBuffer) { - recBuffersL.push(inputBuffer[0]); - recBuffersR.push(inputBuffer[1]); - recLength += inputBuffer[0].length; - } - - function writeString(view, offset, string) { - for (var i = 0; i < string.length; i += 1) { - view.setUint8(offset + i, string.charCodeAt(i)); - } - } - - function floatTo16BitPCM(output, offset, input) { - var writeOffset = offset; - for (var i = 0; i < input.length; i += 1, writeOffset += 2) { - var s = Math.max(-1, Math.min(1, input[i])); - output.setInt16(writeOffset, s < 0 ? s * 0x8000 : s * 0x7FFF, true); - } - } - - function encodeWAV(samples) { - var mono = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - var buffer = new ArrayBuffer(44 + samples.length * 2); - var view = new DataView(buffer); - - /* RIFF identifier */ - writeString(view, 0, 'RIFF'); - /* file length */ - view.setUint32(4, 32 + samples.length * 2, true); - /* RIFF type */ - writeString(view, 8, 'WAVE'); - /* format chunk identifier */ - writeString(view, 12, 'fmt '); - /* format chunk length */ - view.setUint32(16, 16, true); - /* sample format (raw) */ - view.setUint16(20, 1, true); - /* channel count */ - view.setUint16(22, mono ? 1 : 2, true); - /* sample rate */ - view.setUint32(24, sampleRate, true); - /* byte rate (sample rate * block align) */ - view.setUint32(28, sampleRate * 4, true); - /* block align (channel count * bytes per sample) */ - view.setUint16(32, 4, true); - /* bits per sample */ - view.setUint16(34, 16, true); - /* data chunk identifier */ - writeString(view, 36, 'data'); - /* data chunk length */ - view.setUint32(40, samples.length * 2, true); - - floatTo16BitPCM(view, 44, samples); - - return view; - } - - function mergeBuffers(recBuffers, length) { - var result = new Float32Array(length); - var offset = 0; - - for (var i = 0; i < recBuffers.length; i += 1) { - result.set(recBuffers[i], offset); - offset += recBuffers[i].length; - } - return result; - } - - function interleave(inputL, inputR) { - var length = inputL.length + inputR.length; - var result = new Float32Array(length); - - var index = 0; - var inputIndex = 0; - - while (index < length) { - result[index += 1] = inputL[inputIndex]; - result[index += 1] = inputR[inputIndex]; - inputIndex += 1; - } - - return result; - } - - function exportWAV(type) { - var bufferL = mergeBuffers(recBuffersL, recLength); - var bufferR = mergeBuffers(recBuffersR, recLength); - var interleaved = interleave(bufferL, bufferR); - var dataview = encodeWAV(interleaved); - var audioBlob = new Blob([dataview], { type: type }); - - postMessage(audioBlob); - } - - function clear() { - recLength = 0; - recBuffersL = []; - recBuffersR = []; - } - - onmessage = function onmessage(e) { - switch (e.data.command) { - case 'init': - { - init(e.data.config); - break; - } - case 'record': - { - record(e.data.buffer); - break; - } - case 'exportWAV': - { - exportWAV(e.data.type); - break; - } - case 'clear': - { - clear(); - break; - } - default: - { - throw new Error('Unknown export worker command'); - } - } - }; + /* 80 */ + /***/ function (module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.default = function () { + var recLength = 0; + var recBuffersL = []; + var recBuffersR = []; + var sampleRate = void 0; + + function init(config) { + sampleRate = config.sampleRate; + } + + function record(inputBuffer) { + recBuffersL.push(inputBuffer[0]); + recBuffersR.push(inputBuffer[1]); + recLength += inputBuffer[0].length; + } + + function writeString(view, offset, string) { + for (var i = 0; i < string.length; i += 1) { + view.setUint8(offset + i, string.charCodeAt(i)); + } + } + + function floatTo16BitPCM(output, offset, input) { + var writeOffset = offset; + for (var i = 0; i < input.length; i += 1, writeOffset += 2) { + var s = Math.max(-1, Math.min(1, input[i])); + output.setInt16(writeOffset, s < 0 ? s * 0x8000 : s * 0x7FFF, true); + } + } + + function encodeWAV(samples) { + var mono = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var buffer = new ArrayBuffer(44 + samples.length * 2); + var view = new DataView(buffer); + + /* RIFF identifier */ + writeString(view, 0, 'RIFF'); + /* file length */ + view.setUint32(4, 32 + samples.length * 2, true); + /* RIFF type */ + writeString(view, 8, 'WAVE'); + /* format chunk identifier */ + writeString(view, 12, 'fmt '); + /* format chunk length */ + view.setUint32(16, 16, true); + /* sample format (raw) */ + view.setUint16(20, 1, true); + /* channel count */ + view.setUint16(22, mono ? 1 : 2, true); + /* sample rate */ + view.setUint32(24, sampleRate, true); + /* byte rate (sample rate * block align) */ + view.setUint32(28, sampleRate * 4, true); + /* block align (channel count * bytes per sample) */ + view.setUint16(32, 4, true); + /* bits per sample */ + view.setUint16(34, 16, true); + /* data chunk identifier */ + writeString(view, 36, 'data'); + /* data chunk length */ + view.setUint32(40, samples.length * 2, true); + + floatTo16BitPCM(view, 44, samples); + + return view; + } + + function mergeBuffers(recBuffers, length) { + var result = new Float32Array(length); + var offset = 0; + + for (var i = 0; i < recBuffers.length; i += 1) { + result.set(recBuffers[i], offset); + offset += recBuffers[i].length; + } + return result; + } + + function interleave(inputL, inputR) { + var length = inputL.length + inputR.length; + var result = new Float32Array(length); + + var index = 0; + var inputIndex = 0; + + while (index < length) { + result[index += 1] = inputL[inputIndex]; + result[index += 1] = inputR[inputIndex]; + inputIndex += 1; + } + + return result; + } + + function exportWAV(type) { + var bufferL = mergeBuffers(recBuffersL, recLength); + var bufferR = mergeBuffers(recBuffersR, recLength); + var interleaved = interleave(bufferL, bufferR); + var dataview = encodeWAV(interleaved); + var audioBlob = new Blob([dataview], {type: type}); + + postMessage(audioBlob); + } + + function clear() { + recLength = 0; + recBuffersL = []; + recBuffersR = []; + } + + onmessage = function onmessage(e) { + switch (e.data.command) { + case 'init': { + init(e.data.config); + break; + } + case 'record': { + record(e.data.buffer); + break; + } + case 'exportWAV': { + exportWAV(e.data.type); + break; + } + case 'clear': { + clear(); + break; + } + default: { + throw new Error('Unknown export worker command'); + } + } + }; }; /***/ } diff --git a/dist/waveform-playlist/js/waveform-playlist.var.js.map b/dist/waveform-playlist/js/waveform-playlist.var.js.map index e86f4957..1f27342f 100644 --- a/dist/waveform-playlist/js/waveform-playlist.var.js.map +++ b/dist/waveform-playlist/js/waveform-playlist.var.js.map @@ -1 +1,667 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 2d943e5df3b1c1cbab63","webpack:///./src/app.js","webpack:///./~/lodash.assign/index.js","webpack:///./~/virtual-dom/create-element.js","webpack:///./~/virtual-dom/vdom/create-element.js","webpack:///./~/global/document.js","webpack:///min-document (ignored)","webpack:///./~/virtual-dom/vdom/apply-properties.js","webpack:///./~/is-object/index.js","webpack:///./~/virtual-dom/vnode/is-vhook.js","webpack:///./~/virtual-dom/vnode/is-vnode.js","webpack:///./~/virtual-dom/vnode/version.js","webpack:///./~/virtual-dom/vnode/is-vtext.js","webpack:///./~/virtual-dom/vnode/is-widget.js","webpack:///./~/virtual-dom/vnode/handle-thunk.js","webpack:///./~/virtual-dom/vnode/is-thunk.js","webpack:///./~/event-emitter/index.js","webpack:///./~/d/index.js","webpack:///./~/es5-ext/object/assign/index.js","webpack:///./~/es5-ext/object/assign/is-implemented.js","webpack:///./~/es5-ext/object/assign/shim.js","webpack:///./~/es5-ext/object/keys/index.js","webpack:///./~/es5-ext/object/keys/is-implemented.js","webpack:///./~/es5-ext/object/keys/shim.js","webpack:///./~/es5-ext/object/valid-value.js","webpack:///./~/es5-ext/object/normalize-options.js","webpack:///./~/es5-ext/object/is-callable.js","webpack:///./~/es5-ext/string/#/contains/index.js","webpack:///./~/es5-ext/string/#/contains/is-implemented.js","webpack:///./~/es5-ext/string/#/contains/shim.js","webpack:///./~/es5-ext/object/valid-callable.js","webpack:///./src/Playlist.js","webpack:///./~/lodash.defaults/index.js","webpack:///./~/virtual-dom/h.js","webpack:///./~/virtual-dom/virtual-hyperscript/index.js","webpack:///./~/x-is-array/index.js","webpack:///./~/virtual-dom/vnode/vnode.js","webpack:///./~/virtual-dom/vnode/vtext.js","webpack:///./~/virtual-dom/virtual-hyperscript/parse-tag.js","webpack:///./~/browser-split/index.js","webpack:///./~/virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js","webpack:///./~/virtual-dom/virtual-hyperscript/hooks/ev-hook.js","webpack:///./~/ev-store/index.js","webpack:///./~/individual/one-version.js","webpack:///./~/individual/index.js","webpack:///./~/virtual-dom/diff.js","webpack:///./~/virtual-dom/vtree/diff.js","webpack:///./~/virtual-dom/vnode/vpatch.js","webpack:///./~/virtual-dom/vtree/diff-props.js","webpack:///./~/virtual-dom/patch.js","webpack:///./~/virtual-dom/vdom/patch.js","webpack:///./~/virtual-dom/vdom/dom-index.js","webpack:///./~/virtual-dom/vdom/patch-op.js","webpack:///./~/virtual-dom/vdom/update-widget.js","webpack:///./~/inline-worker/index.js","webpack:///./src/utils/conversions.js","webpack:///./src/track/loader/LoaderFactory.js","webpack:///./src/track/loader/BlobLoader.js","webpack:///./src/track/loader/Loader.js","webpack:///./src/track/loader/XHRLoader.js","webpack:///./src/render/ScrollHook.js","webpack:///./src/TimeScale.js","webpack:///./src/render/TimeScaleHook.js","webpack:///./src/Track.js","webpack:///./~/lodash.forown/index.js","webpack:///./~/uuid/uuid.js","webpack:///./~/uuid/rng-browser.js","webpack:///./~/webaudio-peaks/index.js","webpack:///./~/fade-maker/index.js","webpack:///./~/fade-curves/index.js","webpack:///./src/track/states.js","webpack:///./src/track/states/CursorState.js","webpack:///./src/track/states/SelectState.js","webpack:///./src/track/states/ShiftState.js","webpack:///./src/track/states/FadeInState.js","webpack:///./src/track/states/FadeOutState.js","webpack:///./src/render/CanvasHook.js","webpack:///./src/render/FadeCanvasHook.js","webpack:///./src/render/VolumeSliderHook.js","webpack:///./src/Playout.js","webpack:///./src/utils/recorderWorker.js","webpack:///./src/utils/exportWavWorker.js"],"names":["init","options","ee","container","undefined","Error","window","OfflineAudioContext","webkitOfflineAudioContext","AudioContext","webkitAudioContext","audioContext","defaults","ac","sampleRate","samplesPerPixel","mono","fadeType","exclSolo","timescale","controls","show","width","colors","waveOutlineColor","timeColor","fadeColor","seekStyle","waveHeight","state","zoomLevels","config","zoomIndex","indexOf","playlist","setSampleRate","setSamplesPerPixel","setAudioContext","setEventEmitter","setUpEventEmitter","setTimeSelection","setState","setControlOptions","setWaveHeight","setColors","setZoomLevels","setZoomIndex","setMono","setExclSolo","setShowTimeScale","setSeekStyle","tree","render","rootNode","appendChild","tracks","soloedTracks","mutedTracks","playoutPromises","cursor","playbackSeconds","duration","scrollLeft","showTimescale","masterGain","exportWorker","stream","mediaRecorder","MediaRecorder","onstart","track","setName","setEnabledStates","recordingTrack","push","chunks","ondataavailable","e","data","recording","Blob","type","loader","createLoader","load","then","audioBuffer","recorderWorker","postMessage","samples","getChannelData","setCues","setBuffer","setPlayout","adjustDuration","onmessage","setPeaks","draw","onerror","style","controlOptions","height","on","start","end","isPlaying","lastSeeked","pausedAt","restartPlayFrom","seek","emit","startOfflineRender","deltaTime","setStartTime","getStartTime","record","play","pause","stop","rewind","fastForward","clear","soloTrack","adjustTrackPlayout","muteTrack","volume","setGainLevel","forEach","setMasterGainLevel","setFadeIn","setFadeOut","file","src","name","getActiveTrack","timeSelection","getTimeSelection","trim","calculatePeaks","Math","max","zoom","setZoom","min","length","trackList","loadPromises","map","trackInfo","Promise","all","audioBuffers","index","info","states","fadeIn","fadeOut","cueIn","cuein","cueOut","cueout","gain","muted","soloed","selection","selected","peaks","customClass","playout","setCustomClass","setWaveOutlineColor","shape","setActiveTrack","setPeakData","getState","concat","activeTrack","isRendering","offlineAudioContext","currentTime","setOfflinePlayout","buffer","schedulePlay","shouldPlay","shouldTrackPlay","isOffline","startRendering","command","catch","levels","splice","setShouldPlay","reduce","getEndTime","cursorPos","getElapsedTime","lastPlay","stopAnimation","editor","scheduleStop","bind","startTime","endTime","startAnimation","getCurrentTime","playbackReset","viewDuration","lastDraw","animationRequest","requestAnimationFrame","updateEditor","cancelAnimationFrame","getSeekStyle","elapsed","isSegmentSelection","newTree","patches","clientWidth","resolution","isActive","playlistLength","controlWidth","timeScale","trackElements","getTrackRenderData","isActiveTrack","trackSection","attributes","onscroll","target","hook","containerChildren","getTrackDetails","samplesToSeconds","secondsToSamples","samplesToPixels","pixelsToSamples","pixelsToSeconds","secondsToPixels","seconds","ceil","floor","pixels","resolve","reject","match","fr","FileReader","readAsArrayBuffer","addEventListener","decoderPromise","err","STATE_UNINITIALIZED","STATE_LOADING","STATE_DECODING","STATE_FINISHED","audioRequestState","percentComplete","setStateChange","lengthComputable","loaded","total","audioData","response","result","decodeAudioData","xhr","XMLHttpRequest","open","responseType","send","node","trackArea","TimeScale","offset","marginLeft","timeinfo","marker","bigStep","smallStep","secondStep","keys","Object","parseInt","item","sort","a","b","i","widthX","pixPerSec","pixOffset","scaleInfo","getScaleInfo","canvasInfo","timeMarkers","counter","pixIndex","pix","formatTime","milliseconds","s","m","tickInfo","canvas","prop","prev","ctx","getContext","clearRect","x","scaleHeight","scaleY","fillRect","MAX_CANVAS_WIDTH","fades","peakData","className","color","trackStart","trackEnd","offlinePlayout","enabledStates","defaultStatesEnabled","fadein","fadeout","select","shift","fade","removeFade","saveFade","id","v4","StateClass","stateObj","bool","level","setVolumeGainLevel","now","when","segment","defaultOptions","playoutSystem","relPos","sourcePromise","setUpSource","fadeStart","fadeDuration","applyFadeIn","applyFadeOut","channelPixels","overlayClass","setup","events","getEvents","event","getClass","muteClass","soloClass","numChan","onclick","value","oninput","playbackX","startX","endX","progressWidth","waveformChildren","channels","channelNum","channelChildren","totalWidth","currentWidth","canvasColor","bits","fadeWidth","renderOverlay","cStartX","cEndX","cWidth","cClassName","waveform","channelMargin","renderControls","audibleClass","preventDefault","offsetX","active","minX","maxX","emitSelection","complete","deltaX","prevX","emitShift","el","time","CanvasHook","len","cc","h2","maxValue","fillStyle","minPeak","maxPeak","drawFrame","abs","FadeCanvasHook","curve","createCurve","y","strokeStyle","beginPath","moveTo","lineTo","stroke","reflection","volumeInput","setAttribute","destination","fadeGain","applyFade","source","createBufferSource","onended","disconnect","volumeGain","shouldPlayGain","createGain","connect","findMinMax","array","Infinity","curr","convert","n","v","extractPeaks","channel","chanLength","numPeaks","extrema","self","subarray","makeMono","channelPeaks","weight","c","audioPeaks","isMono","numberOfChannels","slice","recLength","recBuffersL","recBuffersR","inputBuffer","writeString","view","string","setUint8","charCodeAt","floatTo16BitPCM","output","input","writeOffset","setInt16","encodeWAV","ArrayBuffer","DataView","setUint32","setUint16","mergeBuffers","recBuffers","Float32Array","set","interleave","inputL","inputR","inputIndex","exportWAV","bufferL","bufferR","interleaved","dataview","audioBlob"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;SChCgBA,I,GAAAA,I;;mBAqED,YAA6C;AAAA,OAAnCC,OAAmC,uEAAzB,EAAyB;AAAA,OAArBC,EAAqB,uEAAhB,6BAAgB;;AAC1D,UAAOF,KAAKC,OAAL,EAAcC,EAAd,CAAP;AACD,E;;AA7ED;;;;AACA;;;;AACA;;;;AACA;;;;;;AAGO,UAASF,IAAT,GAAiD;AAAA,OAAnCC,OAAmC,uEAAzB,EAAyB;AAAA,OAArBC,EAAqB,uEAAhB,6BAAgB;;AACtD,OAAID,QAAQE,SAAR,KAAsBC,SAA1B,EAAqC;AACnC,WAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAEDC,UAAOC,mBAAP,GAA6BD,OAAOC,mBAAP,IAA8BD,OAAOE,yBAAlE;AACAF,UAAOG,YAAP,GAAsBH,OAAOG,YAAP,IAAuBH,OAAOI,kBAApD;;AAEA,OAAMC,eAAe,IAAIL,OAAOG,YAAX,EAArB;;AAEA,OAAMG,WAAW;AACfC,SAAIF,YADW;AAEfG,iBAAYH,aAAaG,UAFV;AAGfC,sBAAiB,IAH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AACAe,YAASgB,YAAT,CAAsBnB,OAAOJ,SAA7B;;AAEA;AACA,OAAMwB,OAAOjB,SAASkB,MAAT,EAAb;AACA,OAAMC,WAAW,6BAAcF,IAAd,CAAjB;;AAEApB,UAAO5B,SAAP,CAAiBmD,WAAjB,CAA6BD,QAA7B;AACAnB,YAASiB,IAAT,GAAgBA,IAAhB;AACAjB,YAASmB,QAAT,GAAoBA,QAApB;;AAEA,UAAOnB,QAAP;AACD,E;;;;;;ACzED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,EAAE;AACb,YAAW,MAAM;AACjB,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kDAAiD,eAAe;;AAEhE;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,QAAQ;AACnB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,YAAW,OAAO,WAAW;AAC7B,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA,yBAAwB;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,kBAAiB;AACjB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,UAAU;AACrB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,SAAS;AACtB,WAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC5nBA;;AAEA;;;;;;;ACFA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,oBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC7CA;AACA;AACA;;AAEA;AACA;AACA,EAAC;AACD;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;ACdA,gB;;;;;;ACAA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA,cAAa;AACb;AACA,cAAa;AACb;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;;;;;;;AChGA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;ACNA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACNA;;;;;;;ACAA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACNA;;AAEA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACvCA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAkB;;AAElB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAa,4BAA4B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,OAAO;;AAEpB;AACA,cAAa,2BAA2B;AACxC;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA0B;;AAE1B;AACA;AACA;AACA;;;;;;;ACnIA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;;AAEA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA,GAAE;AACF;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;;AAEA,UAAS;AACT;AACA;;;;;;;AC9DA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;AACA;AACA,SAAQ;AACR,eAAc,aAAa,GAAG,eAAe;AAC7C;AACA;;;;;;;ACRA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,QAAO,sBAAsB,EAAE;AAC/B;AACA;AACA;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;;;;;;ACrBA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;AACA;AACA;AACA,GAAE,YAAY,cAAc;AAC5B;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACNA;;AAEA;AACA;AACA;AACA;;;;;;;ACLA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;;;;;;;AChBA;;AAEA;;AAEA,kCAAiC,kCAAkC;;;;;;;ACJnE;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;;AAEA;AACA;AACA;AACA;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACNA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACLA;;;;AAEA;;;;AACA;;;;AACA;;;;AAEA;;;;AAEA;;AAEA;;;;AAEA;;;;AAEA;;;;AACA;;;;AACA;;;;AAEA;;;;AACA;;;;;;;;;AAGE,qBAAc;AAAA;;AACZ,UAAKqB,MAAL,GAAc,EAAd;AACA,UAAKC,YAAL,GAA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AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,EAAE;AACb,YAAW,MAAM;AACjB,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,QAAQ;AACnB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,YAAW,OAAO,WAAW;AAC7B,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA,yBAAwB;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,kBAAiB;AACjB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,UAAU;AACrB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,SAAS,GAAG,SAAS,GAAG,SAAS;AAC9C,WAAU;AACV;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,UAAU;AACrB,cAAa,OAAO;AACpB;AACA;AACA;AACA,gBAAe,SAAS,GAAG,SAAS,GAAG,SAAS;AAChD,WAAU;AACV;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC3pBA;;AAEA;;;;;;;ACFA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL,wBAAuB,cAAc;AACrC;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;;;;;;ACxIA;AACA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACPA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAmB,WAAW;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACvEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;ACTA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,gBAAe,qBAAqB;AACpC;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,cAAc;AACzB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAqD;AACrD;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,EAAC;;;;;;;ACzGD;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;AChBA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;AC1BA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;ACnBA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACrBA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;AClBA;;AAEA;;;;;;;ACFA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,kBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAmB,SAAS;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,wBAAuB,SAAS;AAChC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA2B,SAAS;AACpC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAoB,sBAAsB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAa;AACb;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAmB,sBAAsB;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,oBAAmB,sBAAsB;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA0C,2BAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAsC,2BAA2B;AACjE;AACA;AACA;AACA,mCAAkC,2BAA2B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAmB,YAAY;AAC/B;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA,MAAK;AACL;AACA;AACA;;;;;;;AC1aA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACrBA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA;;;;;;;ACzDA;;AAEA;;;;;;;ACFA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,wBAAuB,sBAAsB;AAC7C;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC/EA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,4BAA2B,0BAA0B;AACrD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;;;;;ACpFA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAmB,0BAA0B;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACtJA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;;;;;;;ACdA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,0CAAyC,WAAW;AACpD;;AAEA;AACA,0CAAyC,0BAA0B;AACnE;AACA;;AAEA;AACA;AACA,wBAAuB,aAAa;AACpC,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;A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AAK+J,KAAL,CAAW,KAAK/J,OAAhB,CAAhB;;AAEAH,cAAKG,OAAL,GAAe;AACbe,kBAAOf,QAAQe,KADF;AAEb9G,qBAAU+F,QAAQpD,GAAR,GAAcoD,QAAQrD;AAFnB,UAAf;AAID;;AAED,cAAOkD,IAAP;AACD;;;;;;;;;;;;ACzlBH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,QAAQ;AACnB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,EAAE;AACf;AACA;AACA,kBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACrfA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAe,SAAS;AACxB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qCAAoC,EAAE;AACtC,mBAAkB;AAClB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAmC;AACnC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAoB,SAAS;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACrLA;;AAEA,+CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;;;AC9BA;;AAEA;AACA;AACA;AACA,WAAU,WAAW;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAS,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAU,OAAO;AACjB,WAAU,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAU,WAAW;AACrB,WAAU,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,a;AACA;AACA;;AAEA;AACA;;AAEA,gBAAe,cAAc;;AAE7B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,cAAc;AAC7B;AACA;;AAEA,oBAAmB,aAAa;AAChC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAU,uBAAuB;AACjC,WAAU,OAAO;AACjB,WAAU,OAAO;AACjB,WAAU,OAAO;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACzJA;;AAEA;AACA;AACA,EAAC;AACD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC/FA;;AAEA;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACzEA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;;;mBAEe;AACb9F,gCADa;AAEb2Q,gCAFa;AAGbC,8BAHa;AAIbH,g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C,IAAF,CAAO6G,OAAf;AACE,YAAK,MAAL;AAAa;AACX3L,gBAAK6E,EAAEC,IAAF,CAAO/C,MAAZ;AACA;AACD;AACD,YAAK,QAAL;AAAe;AACboF,kBAAOtC,EAAEC,IAAF,CAAOuG,MAAd;AACA;AACD;AACD,YAAK,WAAL;AAAkB;AAChB0S,qBAAUlZ,EAAEC,IAAF,CAAOG,IAAjB;AACA;AACD;AACD,YAAK,OAAL;AAAc;AACZwC;AACA;AACD;AACD;AAAS;AACP,iBAAM,IAAIpH,KAAJ,CAAU,+BAAV,CAAN;AACD;AAnBH;AAqBD,IAtBD;AAuBD,E","file":"waveform-playlist.var.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/waveform-playlist/js/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2d943e5df3b1c1cbab63","import _assign from 'lodash.assign';\nimport createElement from 'virtual-dom/create-element';\nimport EventEmitter from 'event-emitter';\nimport Playlist from './Playlist';\n\n\nexport function init(options = {}, ee = EventEmitter()) {\n if (options.container === undefined) {\n throw new Error('DOM element container must be given.');\n }\n\n window.OfflineAudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext;\n window.AudioContext = window.AudioContext || window.webkitAudioContext;\n\n const audioContext = new window.AudioContext();\n\n const defaults = {\n ac: audioContext,\n sampleRate: audioContext.sampleRate,\n samplesPerPixel: 4096,\n mono: true,\n fadeType: 'logarithmic',\n exclSolo: false,\n timescale: false,\n controls: {\n show: false,\n width: 150,\n },\n colors: {\n waveOutlineColor: 'white',\n timeColor: 'grey',\n fadeColor: 'black',\n },\n seekStyle: 'line',\n waveHeight: 128,\n state: 'cursor',\n zoomLevels: [512, 1024, 2048, 4096],\n };\n\n const config = _assign(defaults, options);\n const zoomIndex = config.zoomLevels.indexOf(config.samplesPerPixel);\n\n if (zoomIndex === -1) {\n throw new Error('initial samplesPerPixel must be included in array zoomLevels');\n }\n\n const playlist = new Playlist();\n playlist.setSampleRate(config.sampleRate);\n playlist.setSamplesPerPixel(config.samplesPerPixel);\n playlist.setAudioContext(config.ac);\n playlist.setEventEmitter(ee);\n playlist.setUpEventEmitter();\n playlist.setTimeSelection(0, 0);\n playlist.setState(config.state);\n playlist.setControlOptions(config.controls);\n playlist.setWaveHeight(config.waveHeight);\n playlist.setColors(config.colors);\n playlist.setZoomLevels(config.zoomLevels);\n playlist.setZoomIndex(zoomIndex);\n playlist.setMono(config.mono);\n playlist.setExclSolo(config.exclSolo);\n playlist.setShowTimeScale(config.timescale);\n playlist.setSeekStyle(config.seekStyle);\n\n // take care of initial virtual dom rendering.\n const tree = playlist.render();\n const rootNode = createElement(tree);\n\n config.container.appendChild(rootNode);\n playlist.tree = tree;\n playlist.rootNode = rootNode;\n\n return playlist;\n}\n\nexport default function (options = {}, ee = EventEmitter()) {\n return init(options, ee);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/app.js","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max;\n\n/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */\nvar nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\nvar assign = createAssigner(function(object, source) {\n if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n});\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = assign;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash.assign/index.js\n// module id = 1\n// module chunks = 0","var createElement = require(\"./vdom/create-element.js\")\n\nmodule.exports = createElement\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/create-element.js\n// module id = 2\n// module chunks = 0","var document = require(\"global/document\")\n\nvar applyProperties = require(\"./apply-properties\")\n\nvar isVNode = require(\"../vnode/is-vnode.js\")\nvar isVText = require(\"../vnode/is-vtext.js\")\nvar isWidget = require(\"../vnode/is-widget.js\")\nvar handleThunk = require(\"../vnode/handle-thunk.js\")\n\nmodule.exports = createElement\n\nfunction createElement(vnode, opts) {\n var doc = opts ? opts.document || document : document\n var warn = opts ? opts.warn : null\n\n vnode = handleThunk(vnode).a\n\n if (isWidget(vnode)) {\n return vnode.init()\n } else if (isVText(vnode)) {\n return doc.createTextNode(vnode.text)\n } else if (!isVNode(vnode)) {\n if (warn) {\n warn(\"Item is not a valid virtual dom node\", vnode)\n }\n return null\n }\n\n var node = (vnode.namespace === null) ?\n doc.createElement(vnode.tagName) :\n doc.createElementNS(vnode.namespace, vnode.tagName)\n\n var props = vnode.properties\n applyProperties(node, props)\n\n var children = vnode.children\n\n for (var i = 0; i < children.length; i++) {\n var childNode = createElement(children[i], opts)\n if (childNode) {\n node.appendChild(childNode)\n }\n }\n\n return node\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vdom/create-element.js\n// module id = 3\n// module chunks = 0","var topLevel = typeof global !== 'undefined' ? global :\n typeof window !== 'undefined' ? window : {}\nvar minDoc = require('min-document');\n\nif (typeof document !== 'undefined') {\n module.exports = document;\n} else {\n var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\n\n if (!doccy) {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\n }\n\n module.exports = doccy;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/global/document.js\n// module id = 4\n// module chunks = 0","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// min-document (ignored)\n// module id = 5\n// module chunks = 0","var isObject = require(\"is-object\")\nvar isHook = require(\"../vnode/is-vhook.js\")\n\nmodule.exports = applyProperties\n\nfunction applyProperties(node, props, previous) {\n for (var propName in props) {\n var propValue = props[propName]\n\n if (propValue === undefined) {\n removeProperty(node, propName, propValue, previous);\n } else if (isHook(propValue)) {\n removeProperty(node, propName, propValue, previous)\n if (propValue.hook) {\n propValue.hook(node,\n propName,\n previous ? previous[propName] : undefined)\n }\n } else {\n if (isObject(propValue)) {\n patchObject(node, props, previous, propName, propValue);\n } else {\n node[propName] = propValue\n }\n }\n }\n}\n\nfunction removeProperty(node, propName, propValue, previous) {\n if (previous) {\n var previousValue = previous[propName]\n\n if (!isHook(previousValue)) {\n if (propName === \"attributes\") {\n for (var attrName in previousValue) {\n node.removeAttribute(attrName)\n }\n } else if (propName === \"style\") {\n for (var i in previousValue) {\n node.style[i] = \"\"\n }\n } else if (typeof previousValue === \"string\") {\n node[propName] = \"\"\n } else {\n node[propName] = null\n }\n } else if (previousValue.unhook) {\n previousValue.unhook(node, propName, propValue)\n }\n }\n}\n\nfunction patchObject(node, props, previous, propName, propValue) {\n var previousValue = previous ? previous[propName] : undefined\n\n // Set attributes\n if (propName === \"attributes\") {\n for (var attrName in propValue) {\n var attrValue = propValue[attrName]\n\n if (attrValue === undefined) {\n node.removeAttribute(attrName)\n } else {\n node.setAttribute(attrName, attrValue)\n }\n }\n\n return\n }\n\n if(previousValue && isObject(previousValue) &&\n getPrototype(previousValue) !== getPrototype(propValue)) {\n node[propName] = propValue\n return\n }\n\n if (!isObject(node[propName])) {\n node[propName] = {}\n }\n\n var replacer = propName === \"style\" ? \"\" : undefined\n\n for (var k in propValue) {\n var value = propValue[k]\n node[propName][k] = (value === undefined) ? replacer : value\n }\n}\n\nfunction getPrototype(value) {\n if (Object.getPrototypeOf) {\n return Object.getPrototypeOf(value)\n } else if (value.__proto__) {\n return value.__proto__\n } else if (value.constructor) {\n return value.constructor.prototype\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vdom/apply-properties.js\n// module id = 6\n// module chunks = 0","\"use strict\";\n\nmodule.exports = function isObject(x) {\n\treturn typeof x === \"object\" && x !== null;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/is-object/index.js\n// module id = 7\n// module chunks = 0","module.exports = isHook\n\nfunction isHook(hook) {\n return hook &&\n (typeof hook.hook === \"function\" && !hook.hasOwnProperty(\"hook\") ||\n typeof hook.unhook === \"function\" && !hook.hasOwnProperty(\"unhook\"))\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/is-vhook.js\n// module id = 8\n// module chunks = 0","var version = require(\"./version\")\n\nmodule.exports = isVirtualNode\n\nfunction isVirtualNode(x) {\n return x && x.type === \"VirtualNode\" && x.version === version\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/is-vnode.js\n// module id = 9\n// module chunks = 0","module.exports = \"2\"\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/version.js\n// module id = 10\n// module chunks = 0","var version = require(\"./version\")\n\nmodule.exports = isVirtualText\n\nfunction isVirtualText(x) {\n return x && x.type === \"VirtualText\" && x.version === version\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/is-vtext.js\n// module id = 11\n// module chunks = 0","module.exports = isWidget\n\nfunction isWidget(w) {\n return w && w.type === \"Widget\"\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/is-widget.js\n// module id = 12\n// module chunks = 0","var isVNode = require(\"./is-vnode\")\nvar isVText = require(\"./is-vtext\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\n\nmodule.exports = handleThunk\n\nfunction handleThunk(a, b) {\n var renderedA = a\n var renderedB = b\n\n if (isThunk(b)) {\n renderedB = renderThunk(b, a)\n }\n\n if (isThunk(a)) {\n renderedA = renderThunk(a, null)\n }\n\n return {\n a: renderedA,\n b: renderedB\n }\n}\n\nfunction renderThunk(thunk, previous) {\n var renderedThunk = thunk.vnode\n\n if (!renderedThunk) {\n renderedThunk = thunk.vnode = thunk.render(previous)\n }\n\n if (!(isVNode(renderedThunk) ||\n isVText(renderedThunk) ||\n isWidget(renderedThunk))) {\n throw new Error(\"thunk did not return a valid node\");\n }\n\n return renderedThunk\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/handle-thunk.js\n// module id = 13\n// module chunks = 0","module.exports = isThunk\r\n\r\nfunction isThunk(t) {\r\n return t && t.type === \"Thunk\"\r\n}\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/is-thunk.js\n// module id = 14\n// module chunks = 0","'use strict';\n\nvar d = require('d')\n , callable = require('es5-ext/object/valid-callable')\n\n , apply = Function.prototype.apply, call = Function.prototype.call\n , create = Object.create, defineProperty = Object.defineProperty\n , defineProperties = Object.defineProperties\n , hasOwnProperty = Object.prototype.hasOwnProperty\n , descriptor = { configurable: true, enumerable: false, writable: true }\n\n , on, once, off, emit, methods, descriptors, base;\n\non = function (type, listener) {\n\tvar data;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) {\n\t\tdata = descriptor.value = create(null);\n\t\tdefineProperty(this, '__ee__', descriptor);\n\t\tdescriptor.value = null;\n\t} else {\n\t\tdata = this.__ee__;\n\t}\n\tif (!data[type]) data[type] = listener;\n\telse if (typeof data[type] === 'object') data[type].push(listener);\n\telse data[type] = [data[type], listener];\n\n\treturn this;\n};\n\nonce = function (type, listener) {\n\tvar once, self;\n\n\tcallable(listener);\n\tself = this;\n\ton.call(this, type, once = function () {\n\t\toff.call(self, type, once);\n\t\tapply.call(listener, this, arguments);\n\t});\n\n\tonce.__eeOnceListener__ = listener;\n\treturn this;\n};\n\noff = function (type, listener) {\n\tvar data, listeners, candidate, i;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return this;\n\tdata = this.__ee__;\n\tif (!data[type]) return this;\n\tlisteners = data[type];\n\n\tif (typeof listeners === 'object') {\n\t\tfor (i = 0; (candidate = listeners[i]); ++i) {\n\t\t\tif ((candidate === listener) ||\n\t\t\t\t\t(candidate.__eeOnceListener__ === listener)) {\n\t\t\t\tif (listeners.length === 2) data[type] = listeners[i ? 0 : 1];\n\t\t\t\telse listeners.splice(i, 1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ((listeners === listener) ||\n\t\t\t\t(listeners.__eeOnceListener__ === listener)) {\n\t\t\tdelete data[type];\n\t\t}\n\t}\n\n\treturn this;\n};\n\nemit = function (type) {\n\tvar i, l, listener, listeners, args;\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return;\n\tlisteners = this.__ee__[type];\n\tif (!listeners) return;\n\n\tif (typeof listeners === 'object') {\n\t\tl = arguments.length;\n\t\targs = new Array(l - 1);\n\t\tfor (i = 1; i < l; ++i) args[i - 1] = arguments[i];\n\n\t\tlisteners = listeners.slice();\n\t\tfor (i = 0; (listener = listeners[i]); ++i) {\n\t\t\tapply.call(listener, this, args);\n\t\t}\n\t} else {\n\t\tswitch (arguments.length) {\n\t\tcase 1:\n\t\t\tcall.call(listeners, this);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcall.call(listeners, this, arguments[1]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcall.call(listeners, this, arguments[1], arguments[2]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tl = arguments.length;\n\t\t\targs = new Array(l - 1);\n\t\t\tfor (i = 1; i < l; ++i) {\n\t\t\t\targs[i - 1] = arguments[i];\n\t\t\t}\n\t\t\tapply.call(listeners, this, args);\n\t\t}\n\t}\n};\n\nmethods = {\n\ton: on,\n\tonce: once,\n\toff: off,\n\temit: emit\n};\n\ndescriptors = {\n\ton: d(on),\n\tonce: d(once),\n\toff: d(off),\n\temit: d(emit)\n};\n\nbase = defineProperties({}, descriptors);\n\nmodule.exports = exports = function (o) {\n\treturn (o == null) ? create(base) : defineProperties(Object(o), descriptors);\n};\nexports.methods = methods;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/event-emitter/index.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar assign = require('es5-ext/object/assign')\n , normalizeOpts = require('es5-ext/object/normalize-options')\n , isCallable = require('es5-ext/object/is-callable')\n , contains = require('es5-ext/string/#/contains')\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/d/index.js\n// module id = 16\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.assign\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/index.js\n// module id = 17\n// module chunks = 0","'use strict';\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== 'function') return false;\n\tobj = { foo: 'raz' };\n\tassign(obj, { bar: 'dwa' }, { trzy: 'trzy' });\n\treturn (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/is-implemented.js\n// module id = 18\n// module chunks = 0","'use strict';\n\nvar keys = require('../keys')\n , value = require('../valid-value')\n\n , max = Math.max;\n\nmodule.exports = function (dest, src/*, …srcn*/) {\n\tvar error, i, l = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry { dest[key] = src[key]; } catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < l; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/shim.js\n// module id = 19\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.keys\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/index.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys('primitive');\n\t\treturn true;\n\t} catch (e) { return false; }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/is-implemented.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) {\n\treturn keys(object == null ? object : Object(object));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/shim.js\n// module id = 22\n// module chunks = 0","'use strict';\n\nmodule.exports = function (value) {\n\tif (value == null) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-value.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\nmodule.exports = function (options/*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (options == null) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/normalize-options.js\n// module id = 24\n// module chunks = 0","// Deprecated\n\n'use strict';\n\nmodule.exports = function (obj) { return typeof obj === 'function'; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/is-callable.js\n// module id = 25\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? String.prototype.contains\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/index.js\n// module id = 26\n// module chunks = 0","'use strict';\n\nvar str = 'razdwatrzy';\n\nmodule.exports = function () {\n\tif (typeof str.contains !== 'function') return false;\n\treturn ((str.contains('dwa') === true) && (str.contains('foo') === false));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/is-implemented.js\n// module id = 27\n// module chunks = 0","'use strict';\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/shim.js\n// module id = 28\n// module chunks = 0","'use strict';\n\nmodule.exports = function (fn) {\n\tif (typeof fn !== 'function') throw new TypeError(fn + \" is not a function\");\n\treturn fn;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-callable.js\n// module id = 29\n// module chunks = 0","import _defaults from 'lodash.defaults';\n\nimport h from 'virtual-dom/h';\nimport diff from 'virtual-dom/diff';\nimport patch from 'virtual-dom/patch';\n\nimport InlineWorker from 'inline-worker';\n\nimport { pixelsToSeconds } from './utils/conversions';\n\nimport LoaderFactory from './track/loader/LoaderFactory';\n\nimport ScrollHook from './render/ScrollHook';\n\nimport TimeScale from './TimeScale';\nimport Track from './Track';\nimport Playout from './Playout';\n\nimport RecorderWorkerFunction from './utils/recorderWorker';\nimport ExportWavWorkerFunction from './utils/exportWavWorker';\n\nexport default class {\n constructor() {\n this.tracks = [];\n this.soloedTracks = [];\n this.mutedTracks = [];\n this.playoutPromises = [];\n\n this.cursor = 0;\n this.playbackSeconds = 0;\n this.duration = 0;\n this.scrollLeft = 0;\n this.showTimescale = false;\n\n this.fadeType = 'logarithmic';\n this.masterGain = 1;\n }\n\n // TODO extract into a plugin\n initExporter() {\n this.exportWorker = new InlineWorker(ExportWavWorkerFunction);\n }\n\n // TODO extract into a plugin\n initRecorder(stream) {\n this.mediaRecorder = new window.MediaRecorder(stream);\n\n this.mediaRecorder.onstart = () => {\n const track = new Track();\n track.setName('Recording');\n track.setEnabledStates();\n track.setEventEmitter(this.ee);\n\n this.recordingTrack = track;\n this.tracks.push(track);\n\n this.chunks = [];\n };\n\n this.mediaRecorder.ondataavailable = (e) => {\n this.chunks.push(e.data);\n\n const recording = new Blob(this.chunks, { type: 'audio/ogg; codecs=opus' });\n const loader = LoaderFactory.createLoader(recording, this.ac);\n loader.load().then((audioBuffer) => {\n // ask web worker for peaks.\n this.recorderWorker.postMessage({\n samples: audioBuffer.getChannelData(0),\n samplesPerPixel: this.samplesPerPixel,\n });\n this.recordingTrack.setCues(0, audioBuffer.duration);\n this.recordingTrack.setBuffer(audioBuffer);\n this.recordingTrack.setPlayout(new Playout(this.ac, audioBuffer));\n this.adjustDuration();\n });\n };\n\n this.recorderWorker = new InlineWorker(RecorderWorkerFunction);\n // use a worker for calculating recording peaks.\n this.recorderWorker.onmessage = (e) => {\n this.recordingTrack.setPeaks(e.data);\n this.draw(this.render());\n };\n\n this.recorderWorker.onerror = (e) => {\n throw e;\n };\n }\n\n setShowTimeScale(show) {\n this.showTimescale = show;\n }\n\n setMono(mono) {\n this.mono = mono;\n }\n\n setExclSolo(exclSolo) {\n this.exclSolo = exclSolo;\n }\n\n setSeekStyle(style) {\n this.seekStyle = style;\n }\n\n getSeekStyle() {\n return this.seekStyle;\n }\n\n setSampleRate(sampleRate) {\n this.sampleRate = sampleRate;\n }\n\n setSamplesPerPixel(samplesPerPixel) {\n this.samplesPerPixel = samplesPerPixel;\n }\n\n setAudioContext(ac) {\n this.ac = ac;\n }\n\n setControlOptions(controlOptions) {\n this.controls = controlOptions;\n }\n\n setWaveHeight(height) {\n this.waveHeight = height;\n }\n\n setColors(colors) {\n this.colors = colors;\n }\n\n setEventEmitter(ee) {\n this.ee = ee;\n }\n\n getEventEmitter() {\n return this.ee;\n }\n\n setUpEventEmitter() {\n const ee = this.ee;\n\n ee.on('select', (start, end, track) => {\n if (this.isPlaying()) {\n this.lastSeeked = start;\n this.pausedAt = undefined;\n this.restartPlayFrom(start);\n } else {\n // reset if it was paused.\n this.seek(start, end, track);\n this.ee.emit('timeupdate', start);\n this.draw(this.render());\n }\n });\n\n ee.on('startaudiorendering', (type) => {\n this.startOfflineRender(type);\n });\n\n ee.on('statechange', (state) => {\n this.setState(state);\n this.draw(this.render());\n });\n\n ee.on('shift', (deltaTime, track) => {\n track.setStartTime(track.getStartTime() + deltaTime);\n this.adjustDuration();\n this.draw(this.render());\n });\n\n ee.on('record', () => {\n this.record();\n });\n\n ee.on('play', (start, end) => {\n this.play(start, end);\n });\n\n ee.on('pause', () => {\n this.pause();\n });\n\n ee.on('stop', () => {\n this.stop();\n });\n\n ee.on('rewind', () => {\n this.rewind();\n });\n\n ee.on('fastforward', () => {\n this.fastForward();\n });\n\n ee.on('clear', () => {\n this.clear().then(() => {\n this.draw(this.render());\n });\n });\n\n ee.on('solo', (track) => {\n this.soloTrack(track);\n this.adjustTrackPlayout();\n this.draw(this.render());\n });\n\n ee.on('mute', (track) => {\n this.muteTrack(track);\n this.adjustTrackPlayout();\n this.draw(this.render());\n });\n\n ee.on('volumechange', (volume, track) => {\n track.setGainLevel(volume / 100);\n });\n\n ee.on('mastervolumechange', (volume) => {\n this.masterGain = volume / 100;\n this.tracks.forEach((track) => {\n track.setMasterGainLevel(this.masterGain);\n });\n });\n\n ee.on('fadein', (duration, track) => {\n track.setFadeIn(duration, this.fadeType);\n this.draw(this.render());\n });\n\n ee.on('fadeout', (duration, track) => {\n track.setFadeOut(duration, this.fadeType);\n this.draw(this.render());\n });\n\n ee.on('fadetype', (type) => {\n this.fadeType = type;\n });\n\n ee.on('newtrack', (file) => {\n this.load([{\n src: file,\n name: file.name,\n }]);\n });\n\n ee.on('trim', () => {\n const track = this.getActiveTrack();\n const timeSelection = this.getTimeSelection();\n\n track.trim(timeSelection.start, timeSelection.end);\n track.calculatePeaks(this.samplesPerPixel, this.sampleRate);\n\n this.setTimeSelection(0, 0);\n this.draw(this.render());\n });\n\n ee.on('zoomin', () => {\n const zoomIndex = Math.max(0, this.zoomIndex - 1);\n const zoom = this.zoomLevels[zoomIndex];\n\n if (zoom !== this.samplesPerPixel) {\n this.setZoom(zoom);\n this.draw(this.render());\n }\n });\n\n ee.on('zoomout', () => {\n const zoomIndex = Math.min(this.zoomLevels.length - 1, this.zoomIndex + 1);\n const zoom = this.zoomLevels[zoomIndex];\n\n if (zoom !== this.samplesPerPixel) {\n this.setZoom(zoom);\n this.draw(this.render());\n }\n });\n\n ee.on('scroll', () => {\n this.draw(this.render());\n });\n }\n\n load(trackList) {\n const loadPromises = trackList.map((trackInfo) => {\n const loader = LoaderFactory.createLoader(trackInfo.src, this.ac, this.ee);\n return loader.load();\n });\n\n return Promise.all(loadPromises).then((audioBuffers) => {\n this.ee.emit('audiosourcesloaded');\n\n const tracks = audioBuffers.map((audioBuffer, index) => {\n const info = trackList[index];\n const name = info.name || 'Untitled';\n const start = info.start || 0;\n const states = info.states || {};\n const fadeIn = info.fadeIn;\n const fadeOut = info.fadeOut;\n const cueIn = info.cuein || 0;\n const cueOut = info.cueout || audioBuffer.duration;\n const gain = info.gain || 1;\n const muted = info.muted || false;\n const soloed = info.soloed || false;\n const selection = info.selected;\n const peaks = info.peaks || { type: 'WebAudio', mono: this.mono };\n const customClass = info.customClass || undefined;\n const waveOutlineColor = info.waveOutlineColor || undefined;\n\n // webaudio specific playout for now.\n const playout = new Playout(this.ac, audioBuffer);\n\n const track = new Track();\n track.src = info.src;\n track.setBuffer(audioBuffer);\n track.setName(name);\n track.setEventEmitter(this.ee);\n track.setEnabledStates(states);\n track.setCues(cueIn, cueOut);\n track.setCustomClass(customClass);\n track.setWaveOutlineColor(waveOutlineColor);\n\n if (fadeIn !== undefined) {\n track.setFadeIn(fadeIn.duration, fadeIn.shape);\n }\n\n if (fadeOut !== undefined) {\n track.setFadeOut(fadeOut.duration, fadeOut.shape);\n }\n\n if (selection !== undefined) {\n this.setActiveTrack(track);\n this.setTimeSelection(selection.start, selection.end);\n }\n\n if (peaks !== undefined) {\n track.setPeakData(peaks);\n }\n\n track.setState(this.getState());\n track.setStartTime(start);\n track.setPlayout(playout);\n\n track.setGainLevel(gain);\n\n if (muted) {\n this.muteTrack(track);\n }\n\n if (soloed) {\n this.soloTrack(track);\n }\n\n // extract peaks with AudioContext for now.\n track.calculatePeaks(this.samplesPerPixel, this.sampleRate);\n\n return track;\n });\n\n this.tracks = this.tracks.concat(tracks);\n this.adjustDuration();\n this.draw(this.render());\n\n this.ee.emit('audiosourcesrendered');\n });\n }\n\n /*\n track instance of Track.\n */\n setActiveTrack(track) {\n this.activeTrack = track;\n }\n\n getActiveTrack() {\n return this.activeTrack;\n }\n\n isSegmentSelection() {\n return this.timeSelection.start !== this.timeSelection.end;\n }\n\n /*\n start, end in seconds.\n */\n setTimeSelection(start = 0, end) {\n this.timeSelection = {\n start,\n end: (end === undefined) ? start : end,\n };\n\n this.cursor = start;\n }\n\n startOfflineRender(type) {\n if (this.isRendering) {\n return;\n }\n\n this.isRendering = true;\n this.offlineAudioContext = new OfflineAudioContext(2, 44100 * this.duration, 44100);\n\n const currentTime = this.offlineAudioContext.currentTime;\n\n this.tracks.forEach((track) => {\n track.setOfflinePlayout(new Playout(this.offlineAudioContext, track.buffer));\n track.schedulePlay(currentTime, 0, 0, {\n shouldPlay: this.shouldTrackPlay(track),\n masterGain: 1,\n isOffline: true,\n });\n });\n\n /*\n TODO cleanup of different audio playouts handling.\n */\n this.offlineAudioContext.startRendering().then((audioBuffer) => {\n if (type === 'buffer') {\n this.ee.emit('audiorenderingfinished', type, audioBuffer);\n this.isRendering = false;\n return;\n }\n\n if (type === 'wav') {\n this.exportWorker.postMessage({\n command: 'init',\n config: {\n sampleRate: 44100,\n },\n });\n\n // callback for `exportWAV`\n this.exportWorker.onmessage = (e) => {\n this.ee.emit('audiorenderingfinished', type, e.data);\n this.isRendering = false;\n\n // clear out the buffer for next renderings.\n this.exportWorker.postMessage({\n command: 'clear',\n });\n };\n\n // send the channel data from our buffer to the worker\n this.exportWorker.postMessage({\n command: 'record',\n buffer: [\n audioBuffer.getChannelData(0),\n audioBuffer.getChannelData(1),\n ],\n });\n\n // ask the worker for a WAV\n this.exportWorker.postMessage({\n command: 'exportWAV',\n type: 'audio/wav',\n });\n }\n }).catch((e) => {\n throw e;\n });\n }\n\n getTimeSelection() {\n return this.timeSelection;\n }\n\n setState(state) {\n this.state = state;\n\n this.tracks.forEach((track) => {\n track.setState(state);\n });\n }\n\n getState() {\n return this.state;\n }\n\n setZoomIndex(index) {\n this.zoomIndex = index;\n }\n\n setZoomLevels(levels) {\n this.zoomLevels = levels;\n }\n\n setZoom(zoom) {\n this.samplesPerPixel = zoom;\n this.zoomIndex = this.zoomLevels.indexOf(zoom);\n this.tracks.forEach((track) => {\n track.calculatePeaks(zoom, this.sampleRate);\n });\n }\n\n muteTrack(track) {\n const index = this.mutedTracks.indexOf(track);\n\n if (index > -1) {\n this.mutedTracks.splice(index, 1);\n } else {\n this.mutedTracks.push(track);\n }\n }\n\n soloTrack(track) {\n const index = this.soloedTracks.indexOf(track);\n\n if (index > -1) {\n this.soloedTracks.splice(index, 1);\n } else if (this.exclSolo) {\n this.soloedTracks = [track];\n } else {\n this.soloedTracks.push(track);\n }\n }\n\n adjustTrackPlayout() {\n this.tracks.forEach((track) => {\n track.setShouldPlay(this.shouldTrackPlay(track));\n });\n }\n\n adjustDuration() {\n this.duration = this.tracks.reduce(\n (duration, track) => Math.max(duration, track.getEndTime()),\n 0,\n );\n }\n\n shouldTrackPlay(track) {\n let shouldPlay;\n // if there are solo tracks, only they should play.\n if (this.soloedTracks.length > 0) {\n shouldPlay = false;\n if (this.soloedTracks.indexOf(track) > -1) {\n shouldPlay = true;\n }\n } else {\n // play all tracks except any muted tracks.\n shouldPlay = true;\n if (this.mutedTracks.indexOf(track) > -1) {\n shouldPlay = false;\n }\n }\n\n return shouldPlay;\n }\n\n isPlaying() {\n return this.tracks.reduce(\n (isPlaying, track) => isPlaying || track.isPlaying(),\n false,\n );\n }\n\n /*\n * returns the current point of time in the playlist in seconds.\n */\n getCurrentTime() {\n const cursorPos = this.lastSeeked || this.pausedAt || this.cursor;\n\n return cursorPos + this.getElapsedTime();\n }\n\n getElapsedTime() {\n return this.ac.currentTime - this.lastPlay;\n }\n\n setMasterGain(gain) {\n this.ee.emit('mastervolumechange', gain);\n }\n\n restartPlayFrom(start, end) {\n this.stopAnimation();\n\n this.tracks.forEach((editor) => {\n editor.scheduleStop();\n });\n\n return Promise.all(this.playoutPromises).then(this.play.bind(this, start, end));\n }\n\n play(startTime, endTime) {\n const currentTime = this.ac.currentTime;\n const selected = this.getTimeSelection();\n const playoutPromises = [];\n\n const start = startTime || this.pausedAt || this.cursor;\n let end = endTime;\n\n if (!end && selected.end !== selected.start && selected.end > start) {\n end = selected.end;\n }\n\n if (this.isPlaying()) {\n return this.restartPlayFrom(start, end);\n }\n\n this.tracks.forEach((track) => {\n track.setState('cursor');\n playoutPromises.push(track.schedulePlay(currentTime, start, end, {\n shouldPlay: this.shouldTrackPlay(track),\n masterGain: this.masterGain,\n }));\n });\n\n this.lastPlay = currentTime;\n // use these to track when the playlist has fully stopped.\n this.playoutPromises = playoutPromises;\n this.startAnimation(start);\n\n return Promise.all(this.playoutPromises);\n }\n\n pause() {\n if (!this.isPlaying()) {\n return Promise.all(this.playoutPromises);\n }\n\n this.pausedAt = this.getCurrentTime();\n return this.playbackReset();\n }\n\n stop() {\n if (this.mediaRecorder && this.mediaRecorder.state === 'recording') {\n this.mediaRecorder.stop();\n }\n\n this.pausedAt = undefined;\n this.playbackSeconds = 0;\n return this.playbackReset();\n }\n\n playbackReset() {\n this.lastSeeked = undefined;\n this.stopAnimation();\n\n this.tracks.forEach((track) => {\n track.scheduleStop();\n track.setState(this.getState());\n });\n\n this.draw(this.render());\n return Promise.all(this.playoutPromises);\n }\n\n rewind() {\n return this.stop().then(() => {\n this.scrollLeft = 0;\n this.ee.emit('select', 0, 0);\n });\n }\n\n fastForward() {\n return this.stop().then(() => {\n if (this.viewDuration < this.duration) {\n this.scrollLeft = this.duration - this.viewDuration;\n } else {\n this.scrollLeft = 0;\n }\n\n this.ee.emit('select', this.duration, this.duration);\n });\n }\n\n clear() {\n return this.stop().then(() => {\n this.tracks = [];\n this.soloedTracks = [];\n this.mutedTracks = [];\n this.playoutPromises = [];\n\n this.cursor = 0;\n this.playbackSeconds = 0;\n this.duration = 0;\n this.scrollLeft = 0;\n\n this.seek(0, 0, undefined);\n });\n }\n\n record() {\n const playoutPromises = [];\n this.mediaRecorder.start(300);\n\n this.tracks.forEach((track) => {\n track.setState('none');\n playoutPromises.push(track.schedulePlay(this.ac.currentTime, 0, undefined, {\n shouldPlay: this.shouldTrackPlay(track),\n }));\n });\n\n this.playoutPromises = playoutPromises;\n }\n\n startAnimation(startTime) {\n this.lastDraw = this.ac.currentTime;\n this.animationRequest = window.requestAnimationFrame(this.updateEditor.bind(this, startTime));\n }\n\n stopAnimation() {\n window.cancelAnimationFrame(this.animationRequest);\n this.lastDraw = undefined;\n }\n\n seek(start, end, track) {\n if (this.isPlaying()) {\n this.lastSeeked = start;\n this.pausedAt = undefined;\n this.restartPlayFrom(start);\n } else {\n // reset if it was paused.\n this.setActiveTrack(track || this.tracks[0]);\n this.pausedAt = start;\n this.setTimeSelection(start, end);\n if (this.getSeekStyle() === 'fill') {\n this.playbackSeconds = start;\n }\n }\n }\n\n /*\n * Animation function for the playlist.\n */\n updateEditor(cursor) {\n const currentTime = this.ac.currentTime;\n let playbackSeconds = 0;\n const selection = this.getTimeSelection();\n\n const cursorPos = cursor || this.cursor;\n const elapsed = currentTime - this.lastDraw;\n\n if (this.isPlaying()) {\n playbackSeconds = cursorPos + elapsed;\n this.ee.emit('timeupdate', playbackSeconds);\n this.animationRequest = window.requestAnimationFrame(\n this.updateEditor.bind(this, playbackSeconds),\n );\n } else {\n if ((cursorPos + elapsed) >=\n (this.isSegmentSelection()) ? selection.end : this.duration) {\n this.ee.emit('finished');\n }\n\n this.stopAnimation();\n this.pausedAt = undefined;\n this.lastSeeked = undefined;\n this.setState(this.getState());\n }\n\n this.playbackSeconds = playbackSeconds;\n\n this.draw(this.render());\n this.lastDraw = currentTime;\n }\n\n draw(newTree) {\n window.requestAnimationFrame(() => {\n const patches = diff(this.tree, newTree);\n this.rootNode = patch(this.rootNode, patches);\n this.tree = newTree;\n\n // use for fast forwarding.\n this.viewDuration = pixelsToSeconds(\n this.rootNode.clientWidth - this.controls.width,\n this.samplesPerPixel,\n this.sampleRate,\n );\n });\n }\n\n getTrackRenderData(data = {}) {\n const defaults = {\n height: this.waveHeight,\n resolution: this.samplesPerPixel,\n sampleRate: this.sampleRate,\n controls: this.controls,\n isActive: false,\n timeSelection: this.getTimeSelection(),\n playlistLength: this.duration,\n playbackSeconds: this.playbackSeconds,\n colors: this.colors,\n };\n\n return _defaults(data, defaults);\n }\n\n isActiveTrack(track) {\n const activeTrack = this.getActiveTrack();\n\n if (this.isSegmentSelection()) {\n return activeTrack === track;\n }\n\n return true;\n }\n\n render() {\n const controlWidth = this.controls.show ? this.controls.width : 0;\n const timeScale = new TimeScale(this.duration, this.scrollLeft,\n this.samplesPerPixel, this.sampleRate, controlWidth);\n\n const trackElements = this.tracks.map(track =>\n track.render(this.getTrackRenderData({\n isActive: this.isActiveTrack(track),\n shouldPlay: this.shouldTrackPlay(track),\n soloed: this.soloedTracks.indexOf(track) > -1,\n muted: this.mutedTracks.indexOf(track) > -1,\n })),\n );\n\n const trackSection = h('div.playlist-tracks',\n {\n attributes: {\n style: 'overflow: auto;',\n },\n onscroll: (e) => {\n this.scrollLeft = pixelsToSeconds(\n e.target.scrollLeft,\n this.samplesPerPixel,\n this.sampleRate,\n );\n this.ee.emit('scroll', this.scrollLeft);\n },\n hook: new ScrollHook(this, this.samplesPerPixel, this.sampleRate),\n },\n trackElements,\n );\n\n const containerChildren = [];\n\n if (this.showTimescale) {\n containerChildren.push(timeScale.render());\n }\n\n containerChildren.push(trackSection);\n\n return h('div.playlist',\n {\n attributes: {\n style: 'overflow: hidden; position: relative;',\n },\n },\n containerChildren,\n );\n }\n\n getInfo() {\n const info = [];\n\n this.tracks.forEach((track) => {\n info.push(track.getTrackDetails());\n });\n\n return info;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Playlist.js","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction assignInDefaults(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(args) {\n args.push(undefined, assignInDefaults);\n return apply(assignInWith, undefined, args);\n});\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = defaults;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash.defaults/index.js\n// module id = 31\n// module chunks = 0","var h = require(\"./virtual-hyperscript/index.js\")\n\nmodule.exports = h\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/h.js\n// module id = 32\n// module chunks = 0","'use strict';\n\nvar isArray = require('x-is-array');\n\nvar VNode = require('../vnode/vnode.js');\nvar VText = require('../vnode/vtext.js');\nvar isVNode = require('../vnode/is-vnode');\nvar isVText = require('../vnode/is-vtext');\nvar isWidget = require('../vnode/is-widget');\nvar isHook = require('../vnode/is-vhook');\nvar isVThunk = require('../vnode/is-thunk');\n\nvar parseTag = require('./parse-tag.js');\nvar softSetHook = require('./hooks/soft-set-hook.js');\nvar evHook = require('./hooks/ev-hook.js');\n\nmodule.exports = h;\n\nfunction h(tagName, properties, children) {\n var childNodes = [];\n var tag, props, key, namespace;\n\n if (!children && isChildren(properties)) {\n children = properties;\n props = {};\n }\n\n props = props || properties || {};\n tag = parseTag(tagName, props);\n\n // support keys\n if (props.hasOwnProperty('key')) {\n key = props.key;\n props.key = undefined;\n }\n\n // support namespace\n if (props.hasOwnProperty('namespace')) {\n namespace = props.namespace;\n props.namespace = undefined;\n }\n\n // fix cursor bug\n if (tag === 'INPUT' &&\n !namespace &&\n props.hasOwnProperty('value') &&\n props.value !== undefined &&\n !isHook(props.value)\n ) {\n props.value = softSetHook(props.value);\n }\n\n transformProperties(props);\n\n if (children !== undefined && children !== null) {\n addChild(children, childNodes, tag, props);\n }\n\n\n return new VNode(tag, props, childNodes, key, namespace);\n}\n\nfunction addChild(c, childNodes, tag, props) {\n if (typeof c === 'string') {\n childNodes.push(new VText(c));\n } else if (typeof c === 'number') {\n childNodes.push(new VText(String(c)));\n } else if (isChild(c)) {\n childNodes.push(c);\n } else if (isArray(c)) {\n for (var i = 0; i < c.length; i++) {\n addChild(c[i], childNodes, tag, props);\n }\n } else if (c === null || c === undefined) {\n return;\n } else {\n throw UnexpectedVirtualElement({\n foreignObject: c,\n parentVnode: {\n tagName: tag,\n properties: props\n }\n });\n }\n}\n\nfunction transformProperties(props) {\n for (var propName in props) {\n if (props.hasOwnProperty(propName)) {\n var value = props[propName];\n\n if (isHook(value)) {\n continue;\n }\n\n if (propName.substr(0, 3) === 'ev-') {\n // add ev-foo support\n props[propName] = evHook(value);\n }\n }\n }\n}\n\nfunction isChild(x) {\n return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);\n}\n\nfunction isChildren(x) {\n return typeof x === 'string' || isArray(x) || isChild(x);\n}\n\nfunction UnexpectedVirtualElement(data) {\n var err = new Error();\n\n err.type = 'virtual-hyperscript.unexpected.virtual-element';\n err.message = 'Unexpected virtual child passed to h().\\n' +\n 'Expected a VNode / Vthunk / VWidget / string but:\\n' +\n 'got:\\n' +\n errorString(data.foreignObject) +\n '.\\n' +\n 'The parent vnode is:\\n' +\n errorString(data.parentVnode)\n '\\n' +\n 'Suggested fix: change your `h(..., [ ... ])` callsite.';\n err.foreignObject = data.foreignObject;\n err.parentVnode = data.parentVnode;\n\n return err;\n}\n\nfunction errorString(obj) {\n try {\n return JSON.stringify(obj, null, ' ');\n } catch (e) {\n return String(obj);\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/virtual-hyperscript/index.js\n// module id = 33\n// module chunks = 0","var nativeIsArray = Array.isArray\nvar toString = Object.prototype.toString\n\nmodule.exports = nativeIsArray || isArray\n\nfunction isArray(obj) {\n return toString.call(obj) === \"[object Array]\"\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/x-is-array/index.js\n// module id = 34\n// module chunks = 0","var version = require(\"./version\")\nvar isVNode = require(\"./is-vnode\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\nvar isVHook = require(\"./is-vhook\")\n\nmodule.exports = VirtualNode\n\nvar noProperties = {}\nvar noChildren = []\n\nfunction VirtualNode(tagName, properties, children, key, namespace) {\n this.tagName = tagName\n this.properties = properties || noProperties\n this.children = children || noChildren\n this.key = key != null ? String(key) : undefined\n this.namespace = (typeof namespace === \"string\") ? namespace : null\n\n var count = (children && children.length) || 0\n var descendants = 0\n var hasWidgets = false\n var hasThunks = false\n var descendantHooks = false\n var hooks\n\n for (var propName in properties) {\n if (properties.hasOwnProperty(propName)) {\n var property = properties[propName]\n if (isVHook(property) && property.unhook) {\n if (!hooks) {\n hooks = {}\n }\n\n hooks[propName] = property\n }\n }\n }\n\n for (var i = 0; i < count; i++) {\n var child = children[i]\n if (isVNode(child)) {\n descendants += child.count || 0\n\n if (!hasWidgets && child.hasWidgets) {\n hasWidgets = true\n }\n\n if (!hasThunks && child.hasThunks) {\n hasThunks = true\n }\n\n if (!descendantHooks && (child.hooks || child.descendantHooks)) {\n descendantHooks = true\n }\n } else if (!hasWidgets && isWidget(child)) {\n if (typeof child.destroy === \"function\") {\n hasWidgets = true\n }\n } else if (!hasThunks && isThunk(child)) {\n hasThunks = true;\n }\n }\n\n this.count = count + descendants\n this.hasWidgets = hasWidgets\n this.hasThunks = hasThunks\n this.hooks = hooks\n this.descendantHooks = descendantHooks\n}\n\nVirtualNode.prototype.version = version\nVirtualNode.prototype.type = \"VirtualNode\"\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/vnode.js\n// module id = 35\n// module chunks = 0","var version = require(\"./version\")\n\nmodule.exports = VirtualText\n\nfunction VirtualText(text) {\n this.text = String(text)\n}\n\nVirtualText.prototype.version = version\nVirtualText.prototype.type = \"VirtualText\"\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/vtext.js\n// module id = 36\n// module chunks = 0","'use strict';\n\nvar split = require('browser-split');\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = parseTag;\n\nfunction parseTag(tag, props) {\n if (!tag) {\n return 'DIV';\n }\n\n var noId = !(props.hasOwnProperty('id'));\n\n var tagParts = split(tag, classIdSplit);\n var tagName = null;\n\n if (notClassId.test(tagParts[1])) {\n tagName = 'DIV';\n }\n\n var classes, part, type, i;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes = classes || [];\n classes.push(part.substring(1, part.length));\n } else if (type === '#' && noId) {\n props.id = part.substring(1, part.length);\n }\n }\n\n if (classes) {\n if (props.className) {\n classes.push(props.className);\n }\n\n props.className = classes.join(' ');\n }\n\n return props.namespace ? tagName : tagName.toUpperCase();\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/virtual-hyperscript/parse-tag.js\n// module id = 37\n// module chunks = 0","/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan \n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n var nativeSplit = String.prototype.split,\n compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n // NPCG: nonparticipating capturing group\n self;\n\n self = function(str, separator, limit) {\n // If `separator` is not a regex, use `nativeSplit`\n if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n return nativeSplit.call(str, separator, limit);\n }\n var output = [],\n flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n (separator.sticky ? \"y\" : \"\"),\n // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator = new RegExp(separator.source, flags + \"g\"),\n separator2, match, lastIndex, lastLength;\n str += \"\"; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n * If other: Type-convert, then use the above rules\n */\n limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n limit >>> 0; // ToUint32(limit)\n while (match = separator.exec(str)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function() {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undef) {\n match[i] = undef;\n }\n }\n });\n }\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === str.length) {\n if (lastLength || !separator.test(\"\")) {\n output.push(\"\");\n }\n } else {\n output.push(str.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n\n return self;\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/browser-split/index.js\n// module id = 38\n// module chunks = 0","'use strict';\n\nmodule.exports = SoftSetHook;\n\nfunction SoftSetHook(value) {\n if (!(this instanceof SoftSetHook)) {\n return new SoftSetHook(value);\n }\n\n this.value = value;\n}\n\nSoftSetHook.prototype.hook = function (node, propertyName) {\n if (node[propertyName] !== this.value) {\n node[propertyName] = this.value;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js\n// module id = 39\n// module chunks = 0","'use strict';\n\nvar EvStore = require('ev-store');\n\nmodule.exports = EvHook;\n\nfunction EvHook(value) {\n if (!(this instanceof EvHook)) {\n return new EvHook(value);\n }\n\n this.value = value;\n}\n\nEvHook.prototype.hook = function (node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = this.value;\n};\n\nEvHook.prototype.unhook = function(node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = undefined;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/virtual-hyperscript/hooks/ev-hook.js\n// module id = 40\n// module chunks = 0","'use strict';\n\nvar OneVersionConstraint = require('individual/one-version');\n\nvar MY_VERSION = '7';\nOneVersionConstraint('ev-store', MY_VERSION);\n\nvar hashKey = '__EV_STORE_KEY@' + MY_VERSION;\n\nmodule.exports = EvStore;\n\nfunction EvStore(elem) {\n var hash = elem[hashKey];\n\n if (!hash) {\n hash = elem[hashKey] = {};\n }\n\n return hash;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/ev-store/index.js\n// module id = 41\n// module chunks = 0","'use strict';\n\nvar Individual = require('./index.js');\n\nmodule.exports = OneVersion;\n\nfunction OneVersion(moduleName, version, defaultValue) {\n var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;\n var enforceKey = key + '_ENFORCE_SINGLETON';\n\n var versionValue = Individual(enforceKey, version);\n\n if (versionValue !== version) {\n throw new Error('Can only have one copy of ' +\n moduleName + '.\\n' +\n 'You already have version ' + versionValue +\n ' installed.\\n' +\n 'This means you cannot install version ' + version);\n }\n\n return Individual(key, defaultValue);\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/individual/one-version.js\n// module id = 42\n// module chunks = 0","'use strict';\n\n/*global window, global*/\n\nvar root = typeof window !== 'undefined' ?\n window : typeof global !== 'undefined' ?\n global : {};\n\nmodule.exports = Individual;\n\nfunction Individual(key, value) {\n if (key in root) {\n return root[key];\n }\n\n root[key] = value;\n\n return value;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/individual/index.js\n// module id = 43\n// module chunks = 0","var diff = require(\"./vtree/diff.js\")\n\nmodule.exports = diff\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/diff.js\n// module id = 44\n// module chunks = 0","var isArray = require(\"x-is-array\")\n\nvar VPatch = require(\"../vnode/vpatch\")\nvar isVNode = require(\"../vnode/is-vnode\")\nvar isVText = require(\"../vnode/is-vtext\")\nvar isWidget = require(\"../vnode/is-widget\")\nvar isThunk = require(\"../vnode/is-thunk\")\nvar handleThunk = require(\"../vnode/handle-thunk\")\n\nvar diffProps = require(\"./diff-props\")\n\nmodule.exports = diff\n\nfunction diff(a, b) {\n var patch = { a: a }\n walk(a, b, patch, 0)\n return patch\n}\n\nfunction walk(a, b, patch, index) {\n if (a === b) {\n return\n }\n\n var apply = patch[index]\n var applyClear = false\n\n if (isThunk(a) || isThunk(b)) {\n thunks(a, b, patch, index)\n } else if (b == null) {\n\n // If a is a widget we will add a remove patch for it\n // Otherwise any child widgets/hooks must be destroyed.\n // This prevents adding two remove patches for a widget.\n if (!isWidget(a)) {\n clearState(a, patch, index)\n apply = patch[index]\n }\n\n apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))\n } else if (isVNode(b)) {\n if (isVNode(a)) {\n if (a.tagName === b.tagName &&\n a.namespace === b.namespace &&\n a.key === b.key) {\n var propsPatch = diffProps(a.properties, b.properties)\n if (propsPatch) {\n apply = appendPatch(apply,\n new VPatch(VPatch.PROPS, a, propsPatch))\n }\n apply = diffChildren(a, b, patch, apply, index)\n } else {\n apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))\n applyClear = true\n }\n } else {\n apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))\n applyClear = true\n }\n } else if (isVText(b)) {\n if (!isVText(a)) {\n apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))\n applyClear = true\n } else if (a.text !== b.text) {\n apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))\n }\n } else if (isWidget(b)) {\n if (!isWidget(a)) {\n applyClear = true\n }\n\n apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))\n }\n\n if (apply) {\n patch[index] = apply\n }\n\n if (applyClear) {\n clearState(a, patch, index)\n }\n}\n\nfunction diffChildren(a, b, patch, apply, index) {\n var aChildren = a.children\n var orderedSet = reorder(aChildren, b.children)\n var bChildren = orderedSet.children\n\n var aLen = aChildren.length\n var bLen = bChildren.length\n var len = aLen > bLen ? aLen : bLen\n\n for (var i = 0; i < len; i++) {\n var leftNode = aChildren[i]\n var rightNode = bChildren[i]\n index += 1\n\n if (!leftNode) {\n if (rightNode) {\n // Excess nodes in b need to be added\n apply = appendPatch(apply,\n new VPatch(VPatch.INSERT, null, rightNode))\n }\n } else {\n walk(leftNode, rightNode, patch, index)\n }\n\n if (isVNode(leftNode) && leftNode.count) {\n index += leftNode.count\n }\n }\n\n if (orderedSet.moves) {\n // Reorder nodes last\n apply = appendPatch(apply, new VPatch(\n VPatch.ORDER,\n a,\n orderedSet.moves\n ))\n }\n\n return apply\n}\n\nfunction clearState(vNode, patch, index) {\n // TODO: Make this a single walk, not two\n unhook(vNode, patch, index)\n destroyWidgets(vNode, patch, index)\n}\n\n// Patch records for all destroyed widgets must be added because we need\n// a DOM node reference for the destroy function\nfunction destroyWidgets(vNode, patch, index) {\n if (isWidget(vNode)) {\n if (typeof vNode.destroy === \"function\") {\n patch[index] = appendPatch(\n patch[index],\n new VPatch(VPatch.REMOVE, vNode, null)\n )\n }\n } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n destroyWidgets(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n } else if (isThunk(vNode)) {\n thunks(vNode, null, patch, index)\n }\n}\n\n// Create a sub-patch for thunks\nfunction thunks(a, b, patch, index) {\n var nodes = handleThunk(a, b)\n var thunkPatch = diff(nodes.a, nodes.b)\n if (hasPatches(thunkPatch)) {\n patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)\n }\n}\n\nfunction hasPatches(patch) {\n for (var index in patch) {\n if (index !== \"a\") {\n return true\n }\n }\n\n return false\n}\n\n// Execute hooks when two nodes are identical\nfunction unhook(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = appendPatch(\n patch[index],\n new VPatch(\n VPatch.PROPS,\n vNode,\n undefinedKeys(vNode.hooks)\n )\n )\n }\n\n if (vNode.descendantHooks || vNode.hasThunks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n unhook(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n } else if (isThunk(vNode)) {\n thunks(vNode, null, patch, index)\n }\n}\n\nfunction undefinedKeys(obj) {\n var result = {}\n\n for (var key in obj) {\n result[key] = undefined\n }\n\n return result\n}\n\n// List diff, naive left to right reordering\nfunction reorder(aChildren, bChildren) {\n // O(M) time, O(M) memory\n var bChildIndex = keyIndex(bChildren)\n var bKeys = bChildIndex.keys\n var bFree = bChildIndex.free\n\n if (bFree.length === bChildren.length) {\n return {\n children: bChildren,\n moves: null\n }\n }\n\n // O(N) time, O(N) memory\n var aChildIndex = keyIndex(aChildren)\n var aKeys = aChildIndex.keys\n var aFree = aChildIndex.free\n\n if (aFree.length === aChildren.length) {\n return {\n children: bChildren,\n moves: null\n }\n }\n\n // O(MAX(N, M)) memory\n var newChildren = []\n\n var freeIndex = 0\n var freeCount = bFree.length\n var deletedItems = 0\n\n // Iterate through a and match a node in b\n // O(N) time,\n for (var i = 0 ; i < aChildren.length; i++) {\n var aItem = aChildren[i]\n var itemIndex\n\n if (aItem.key) {\n if (bKeys.hasOwnProperty(aItem.key)) {\n // Match up the old keys\n itemIndex = bKeys[aItem.key]\n newChildren.push(bChildren[itemIndex])\n\n } else {\n // Remove old keyed items\n itemIndex = i - deletedItems++\n newChildren.push(null)\n }\n } else {\n // Match the item in a with the next free item in b\n if (freeIndex < freeCount) {\n itemIndex = bFree[freeIndex++]\n newChildren.push(bChildren[itemIndex])\n } else {\n // There are no free items in b to match with\n // the free items in a, so the extra free nodes\n // are deleted.\n itemIndex = i - deletedItems++\n newChildren.push(null)\n }\n }\n }\n\n var lastFreeIndex = freeIndex >= bFree.length ?\n bChildren.length :\n bFree[freeIndex]\n\n // Iterate through b and append any new keys\n // O(M) time\n for (var j = 0; j < bChildren.length; j++) {\n var newItem = bChildren[j]\n\n if (newItem.key) {\n if (!aKeys.hasOwnProperty(newItem.key)) {\n // Add any new keyed items\n // We are adding new items to the end and then sorting them\n // in place. In future we should insert new items in place.\n newChildren.push(newItem)\n }\n } else if (j >= lastFreeIndex) {\n // Add any leftover non-keyed items\n newChildren.push(newItem)\n }\n }\n\n var simulate = newChildren.slice()\n var simulateIndex = 0\n var removes = []\n var inserts = []\n var simulateItem\n\n for (var k = 0; k < bChildren.length;) {\n var wantedItem = bChildren[k]\n simulateItem = simulate[simulateIndex]\n\n // remove items\n while (simulateItem === null && simulate.length) {\n removes.push(remove(simulate, simulateIndex, null))\n simulateItem = simulate[simulateIndex]\n }\n\n if (!simulateItem || simulateItem.key !== wantedItem.key) {\n // if we need a key in this position...\n if (wantedItem.key) {\n if (simulateItem && simulateItem.key) {\n // if an insert doesn't put this key in place, it needs to move\n if (bKeys[simulateItem.key] !== k + 1) {\n removes.push(remove(simulate, simulateIndex, simulateItem.key))\n simulateItem = simulate[simulateIndex]\n // if the remove didn't put the wanted item in place, we need to insert it\n if (!simulateItem || simulateItem.key !== wantedItem.key) {\n inserts.push({key: wantedItem.key, to: k})\n }\n // items are matching, so skip ahead\n else {\n simulateIndex++\n }\n }\n else {\n inserts.push({key: wantedItem.key, to: k})\n }\n }\n else {\n inserts.push({key: wantedItem.key, to: k})\n }\n k++\n }\n // a key in simulate has no matching wanted key, remove it\n else if (simulateItem && simulateItem.key) {\n removes.push(remove(simulate, simulateIndex, simulateItem.key))\n }\n }\n else {\n simulateIndex++\n k++\n }\n }\n\n // remove all the remaining nodes from simulate\n while(simulateIndex < simulate.length) {\n simulateItem = simulate[simulateIndex]\n removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))\n }\n\n // If the only moves we have are deletes then we can just\n // let the delete patch remove these items.\n if (removes.length === deletedItems && !inserts.length) {\n return {\n children: newChildren,\n moves: null\n }\n }\n\n return {\n children: newChildren,\n moves: {\n removes: removes,\n inserts: inserts\n }\n }\n}\n\nfunction remove(arr, index, key) {\n arr.splice(index, 1)\n\n return {\n from: index,\n key: key\n }\n}\n\nfunction keyIndex(children) {\n var keys = {}\n var free = []\n var length = children.length\n\n for (var i = 0; i < length; i++) {\n var child = children[i]\n\n if (child.key) {\n keys[child.key] = i\n } else {\n free.push(i)\n }\n }\n\n return {\n keys: keys, // A hash of key name to index\n free: free // An array of unkeyed item indices\n }\n}\n\nfunction appendPatch(apply, patch) {\n if (apply) {\n if (isArray(apply)) {\n apply.push(patch)\n } else {\n apply = [apply, patch]\n }\n\n return apply\n } else {\n return patch\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vtree/diff.js\n// module id = 45\n// module chunks = 0","var version = require(\"./version\")\n\nVirtualPatch.NONE = 0\nVirtualPatch.VTEXT = 1\nVirtualPatch.VNODE = 2\nVirtualPatch.WIDGET = 3\nVirtualPatch.PROPS = 4\nVirtualPatch.ORDER = 5\nVirtualPatch.INSERT = 6\nVirtualPatch.REMOVE = 7\nVirtualPatch.THUNK = 8\n\nmodule.exports = VirtualPatch\n\nfunction VirtualPatch(type, vNode, patch) {\n this.type = Number(type)\n this.vNode = vNode\n this.patch = patch\n}\n\nVirtualPatch.prototype.version = version\nVirtualPatch.prototype.type = \"VirtualPatch\"\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vnode/vpatch.js\n// module id = 46\n// module chunks = 0","var isObject = require(\"is-object\")\nvar isHook = require(\"../vnode/is-vhook\")\n\nmodule.exports = diffProps\n\nfunction diffProps(a, b) {\n var diff\n\n for (var aKey in a) {\n if (!(aKey in b)) {\n diff = diff || {}\n diff[aKey] = undefined\n }\n\n var aValue = a[aKey]\n var bValue = b[aKey]\n\n if (aValue === bValue) {\n continue\n } else if (isObject(aValue) && isObject(bValue)) {\n if (getPrototype(bValue) !== getPrototype(aValue)) {\n diff = diff || {}\n diff[aKey] = bValue\n } else if (isHook(bValue)) {\n diff = diff || {}\n diff[aKey] = bValue\n } else {\n var objectDiff = diffProps(aValue, bValue)\n if (objectDiff) {\n diff = diff || {}\n diff[aKey] = objectDiff\n }\n }\n } else {\n diff = diff || {}\n diff[aKey] = bValue\n }\n }\n\n for (var bKey in b) {\n if (!(bKey in a)) {\n diff = diff || {}\n diff[bKey] = b[bKey]\n }\n }\n\n return diff\n}\n\nfunction getPrototype(value) {\n if (Object.getPrototypeOf) {\n return Object.getPrototypeOf(value)\n } else if (value.__proto__) {\n return value.__proto__\n } else if (value.constructor) {\n return value.constructor.prototype\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vtree/diff-props.js\n// module id = 47\n// module chunks = 0","var patch = require(\"./vdom/patch.js\")\n\nmodule.exports = patch\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/patch.js\n// module id = 48\n// module chunks = 0","var document = require(\"global/document\")\nvar isArray = require(\"x-is-array\")\n\nvar render = require(\"./create-element\")\nvar domIndex = require(\"./dom-index\")\nvar patchOp = require(\"./patch-op\")\nmodule.exports = patch\n\nfunction patch(rootNode, patches, renderOptions) {\n renderOptions = renderOptions || {}\n renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch\n ? renderOptions.patch\n : patchRecursive\n renderOptions.render = renderOptions.render || render\n\n return renderOptions.patch(rootNode, patches, renderOptions)\n}\n\nfunction patchRecursive(rootNode, patches, renderOptions) {\n var indices = patchIndices(patches)\n\n if (indices.length === 0) {\n return rootNode\n }\n\n var index = domIndex(rootNode, patches.a, indices)\n var ownerDocument = rootNode.ownerDocument\n\n if (!renderOptions.document && ownerDocument !== document) {\n renderOptions.document = ownerDocument\n }\n\n for (var i = 0; i < indices.length; i++) {\n var nodeIndex = indices[i]\n rootNode = applyPatch(rootNode,\n index[nodeIndex],\n patches[nodeIndex],\n renderOptions)\n }\n\n return rootNode\n}\n\nfunction applyPatch(rootNode, domNode, patchList, renderOptions) {\n if (!domNode) {\n return rootNode\n }\n\n var newNode\n\n if (isArray(patchList)) {\n for (var i = 0; i < patchList.length; i++) {\n newNode = patchOp(patchList[i], domNode, renderOptions)\n\n if (domNode === rootNode) {\n rootNode = newNode\n }\n }\n } else {\n newNode = patchOp(patchList, domNode, renderOptions)\n\n if (domNode === rootNode) {\n rootNode = newNode\n }\n }\n\n return rootNode\n}\n\nfunction patchIndices(patches) {\n var indices = []\n\n for (var key in patches) {\n if (key !== \"a\") {\n indices.push(Number(key))\n }\n }\n\n return indices\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vdom/patch.js\n// module id = 49\n// module chunks = 0","// Maps a virtual DOM tree onto a real DOM tree in an efficient manner.\n// We don't want to read all of the DOM nodes in the tree so we use\n// the in-order tree indexing to eliminate recursion down certain branches.\n// We only recurse into a DOM node if we know that it contains a child of\n// interest.\n\nvar noChild = {}\n\nmodule.exports = domIndex\n\nfunction domIndex(rootNode, tree, indices, nodes) {\n if (!indices || indices.length === 0) {\n return {}\n } else {\n indices.sort(ascending)\n return recurse(rootNode, tree, indices, nodes, 0)\n }\n}\n\nfunction recurse(rootNode, tree, indices, nodes, rootIndex) {\n nodes = nodes || {}\n\n\n if (rootNode) {\n if (indexInRange(indices, rootIndex, rootIndex)) {\n nodes[rootIndex] = rootNode\n }\n\n var vChildren = tree.children\n\n if (vChildren) {\n\n var childNodes = rootNode.childNodes\n\n for (var i = 0; i < tree.children.length; i++) {\n rootIndex += 1\n\n var vChild = vChildren[i] || noChild\n var nextIndex = rootIndex + (vChild.count || 0)\n\n // skip recursion down the tree if there are no nodes down here\n if (indexInRange(indices, rootIndex, nextIndex)) {\n recurse(childNodes[i], vChild, indices, nodes, rootIndex)\n }\n\n rootIndex = nextIndex\n }\n }\n }\n\n return nodes\n}\n\n// Binary search for an index in the interval [left, right]\nfunction indexInRange(indices, left, right) {\n if (indices.length === 0) {\n return false\n }\n\n var minIndex = 0\n var maxIndex = indices.length - 1\n var currentIndex\n var currentItem\n\n while (minIndex <= maxIndex) {\n currentIndex = ((maxIndex + minIndex) / 2) >> 0\n currentItem = indices[currentIndex]\n\n if (minIndex === maxIndex) {\n return currentItem >= left && currentItem <= right\n } else if (currentItem < left) {\n minIndex = currentIndex + 1\n } else if (currentItem > right) {\n maxIndex = currentIndex - 1\n } else {\n return true\n }\n }\n\n return false;\n}\n\nfunction ascending(a, b) {\n return a > b ? 1 : -1\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vdom/dom-index.js\n// module id = 50\n// module chunks = 0","var applyProperties = require(\"./apply-properties\")\n\nvar isWidget = require(\"../vnode/is-widget.js\")\nvar VPatch = require(\"../vnode/vpatch.js\")\n\nvar updateWidget = require(\"./update-widget\")\n\nmodule.exports = applyPatch\n\nfunction applyPatch(vpatch, domNode, renderOptions) {\n var type = vpatch.type\n var vNode = vpatch.vNode\n var patch = vpatch.patch\n\n switch (type) {\n case VPatch.REMOVE:\n return removeNode(domNode, vNode)\n case VPatch.INSERT:\n return insertNode(domNode, patch, renderOptions)\n case VPatch.VTEXT:\n return stringPatch(domNode, vNode, patch, renderOptions)\n case VPatch.WIDGET:\n return widgetPatch(domNode, vNode, patch, renderOptions)\n case VPatch.VNODE:\n return vNodePatch(domNode, vNode, patch, renderOptions)\n case VPatch.ORDER:\n reorderChildren(domNode, patch)\n return domNode\n case VPatch.PROPS:\n applyProperties(domNode, patch, vNode.properties)\n return domNode\n case VPatch.THUNK:\n return replaceRoot(domNode,\n renderOptions.patch(domNode, patch, renderOptions))\n default:\n return domNode\n }\n}\n\nfunction removeNode(domNode, vNode) {\n var parentNode = domNode.parentNode\n\n if (parentNode) {\n parentNode.removeChild(domNode)\n }\n\n destroyWidget(domNode, vNode);\n\n return null\n}\n\nfunction insertNode(parentNode, vNode, renderOptions) {\n var newNode = renderOptions.render(vNode, renderOptions)\n\n if (parentNode) {\n parentNode.appendChild(newNode)\n }\n\n return parentNode\n}\n\nfunction stringPatch(domNode, leftVNode, vText, renderOptions) {\n var newNode\n\n if (domNode.nodeType === 3) {\n domNode.replaceData(0, domNode.length, vText.text)\n newNode = domNode\n } else {\n var parentNode = domNode.parentNode\n newNode = renderOptions.render(vText, renderOptions)\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n }\n\n return newNode\n}\n\nfunction widgetPatch(domNode, leftVNode, widget, renderOptions) {\n var updating = updateWidget(leftVNode, widget)\n var newNode\n\n if (updating) {\n newNode = widget.update(leftVNode, domNode) || domNode\n } else {\n newNode = renderOptions.render(widget, renderOptions)\n }\n\n var parentNode = domNode.parentNode\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n\n if (!updating) {\n destroyWidget(domNode, leftVNode)\n }\n\n return newNode\n}\n\nfunction vNodePatch(domNode, leftVNode, vNode, renderOptions) {\n var parentNode = domNode.parentNode\n var newNode = renderOptions.render(vNode, renderOptions)\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n\n return newNode\n}\n\nfunction destroyWidget(domNode, w) {\n if (typeof w.destroy === \"function\" && isWidget(w)) {\n w.destroy(domNode)\n }\n}\n\nfunction reorderChildren(domNode, moves) {\n var childNodes = domNode.childNodes\n var keyMap = {}\n var node\n var remove\n var insert\n\n for (var i = 0; i < moves.removes.length; i++) {\n remove = moves.removes[i]\n node = childNodes[remove.from]\n if (remove.key) {\n keyMap[remove.key] = node\n }\n domNode.removeChild(node)\n }\n\n var length = childNodes.length\n for (var j = 0; j < moves.inserts.length; j++) {\n insert = moves.inserts[j]\n node = keyMap[insert.key]\n // this is the weirdest bug i've ever seen in webkit\n domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])\n }\n}\n\nfunction replaceRoot(oldRoot, newRoot) {\n if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {\n oldRoot.parentNode.replaceChild(newRoot, oldRoot)\n }\n\n return newRoot;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vdom/patch-op.js\n// module id = 51\n// module chunks = 0","var isWidget = require(\"../vnode/is-widget.js\")\n\nmodule.exports = updateWidget\n\nfunction updateWidget(a, b) {\n if (isWidget(a) && isWidget(b)) {\n if (\"name\" in a && \"name\" in b) {\n return a.id === b.id\n } else {\n return a.init === b.init\n }\n }\n\n return false\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/virtual-dom/vdom/update-widget.js\n// module id = 52\n// module chunks = 0","var WORKER_ENABLED = !!(global === global.window && global.URL && global.Blob && global.Worker);\n\nfunction InlineWorker(func, self) {\n var _this = this;\n var functionBody;\n\n self = self || {};\n\n if (WORKER_ENABLED) {\n functionBody = func.toString().trim().match(\n /^function\\s*\\w*\\s*\\([\\w\\s,]*\\)\\s*{([\\w\\W]*?)}$/\n )[1];\n\n return new global.Worker(global.URL.createObjectURL(\n new global.Blob([ functionBody ], { type: \"text/javascript\" })\n ));\n }\n\n function postMessage(data) {\n setTimeout(function() {\n _this.onmessage({ data: data });\n }, 0);\n }\n\n this.self = self;\n this.self.postMessage = postMessage;\n\n setTimeout(func.bind(self, self), 0);\n}\n\nInlineWorker.prototype.postMessage = function postMessage(data) {\n var _this = this;\n\n setTimeout(function() {\n _this.self.onmessage({ data: data });\n }, 0);\n};\n\nmodule.exports = InlineWorker;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/inline-worker/index.js\n// module id = 53\n// module chunks = 0","export function samplesToSeconds(samples, sampleRate) {\n return samples / sampleRate;\n}\n\nexport function secondsToSamples(seconds, sampleRate) {\n return Math.ceil(seconds * sampleRate);\n}\n\nexport function samplesToPixels(samples, resolution) {\n return Math.floor(samples / resolution);\n}\n\nexport function pixelsToSamples(pixels, resolution) {\n return Math.floor(pixels * resolution);\n}\n\nexport function pixelsToSeconds(pixels, resolution, sampleRate) {\n return (pixels * resolution) / sampleRate;\n}\n\nexport function secondsToPixels(seconds, resolution, sampleRate) {\n return Math.ceil((seconds * sampleRate) / resolution);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/conversions.js","import BlobLoader from './BlobLoader';\nimport XHRLoader from './XHRLoader';\n\nexport default class {\n static createLoader(src, audioContext, ee) {\n if (src instanceof Blob) {\n return new BlobLoader(src, audioContext, ee);\n } else if (typeof (src) === 'string') {\n return new XHRLoader(src, audioContext, ee);\n }\n\n throw new Error('Unsupported src type');\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/loader/LoaderFactory.js","import Loader from './Loader';\n\nexport default class extends Loader {\n\n /*\n * Loads an audio file via a FileReader\n */\n load() {\n return new Promise((resolve, reject) => {\n if (this.src.type.match(/audio.*/) ||\n // added for problems with Firefox mime types + ogg.\n this.src.type.match(/video\\/ogg/)) {\n const fr = new FileReader();\n\n fr.readAsArrayBuffer(this.src);\n\n fr.addEventListener('progress', (e) => {\n super.fileProgress(e);\n });\n\n fr.addEventListener('load', (e) => {\n const decoderPromise = super.fileLoad(e);\n\n decoderPromise.then((audioBuffer) => {\n resolve(audioBuffer);\n });\n });\n\n fr.addEventListener('error', (err) => {\n reject(err);\n });\n } else {\n reject(Error(`Unsupported file type ${this.src.type}`));\n }\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/loader/BlobLoader.js","import EventEmitter from 'event-emitter';\n\nexport const STATE_UNINITIALIZED = 0;\nexport const STATE_LOADING = 1;\nexport const STATE_DECODING = 2;\nexport const STATE_FINISHED = 3;\n\n\nexport default class {\n constructor(src, audioContext, ee = EventEmitter()) {\n this.src = src;\n this.ac = audioContext;\n this.audioRequestState = STATE_UNINITIALIZED;\n this.ee = ee;\n }\n\n setStateChange(state) {\n this.audioRequestState = state;\n this.ee.emit('audiorequeststatechange', this.audioRequestState, this.src);\n }\n\n fileProgress(e) {\n let percentComplete = 0;\n\n if (this.audioRequestState === STATE_UNINITIALIZED) {\n this.setStateChange(STATE_LOADING);\n }\n\n if (e.lengthComputable) {\n percentComplete = (e.loaded / e.total) * 100;\n }\n\n this.ee.emit('loadprogress', percentComplete, this.src);\n }\n\n fileLoad(e) {\n const audioData = e.target.response || e.target.result;\n\n this.setStateChange(STATE_DECODING);\n\n return new Promise((resolve, reject) => {\n this.ac.decodeAudioData(\n audioData,\n (audioBuffer) => {\n this.audioBuffer = audioBuffer;\n this.setStateChange(STATE_FINISHED);\n\n resolve(audioBuffer);\n },\n (err) => {\n reject(err);\n },\n );\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/loader/Loader.js","import Loader from './Loader';\n\nexport default class extends Loader {\n\n /**\n * Loads an audio file via XHR.\n */\n load() {\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n\n xhr.open('GET', this.src, true);\n xhr.responseType = 'arraybuffer';\n xhr.send();\n\n xhr.addEventListener('progress', (e) => {\n super.fileProgress(e);\n });\n\n xhr.addEventListener('load', (e) => {\n const decoderPromise = super.fileLoad(e);\n\n decoderPromise.then((audioBuffer) => {\n resolve(audioBuffer);\n });\n });\n\n xhr.addEventListener('error', () => {\n reject(Error(`Track ${this.src} failed to load`));\n });\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/loader/XHRLoader.js","import { secondsToPixels } from '../utils/conversions';\n\n/*\n* virtual-dom hook for scrolling the track container.\n*/\nexport default class {\n constructor(track, resolution, sampleRate) {\n this.track = track;\n this.resolution = resolution;\n this.sampleRate = sampleRate;\n }\n\n hook(node) {\n const trackArea = node;\n trackArea.scrollLeft = secondsToPixels(this.track.scrollLeft, this.resolution, this.sampleRate);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/render/ScrollHook.js","import h from 'virtual-dom/h';\n\nimport { secondsToPixels } from './utils/conversions';\nimport TimeScaleHook from './render/TimeScaleHook';\n\nclass TimeScale {\n constructor(duration, offset, samplesPerPixel, sampleRate, marginLeft = 0) {\n this.duration = duration;\n this.offset = offset;\n this.samplesPerPixel = samplesPerPixel;\n this.sampleRate = sampleRate;\n this.marginLeft = marginLeft;\n\n this.timeinfo = {\n 20000: {\n marker: 30000,\n bigStep: 10000,\n smallStep: 5000,\n secondStep: 5,\n },\n 12000: {\n marker: 15000,\n bigStep: 5000,\n smallStep: 1000,\n secondStep: 1,\n },\n 10000: {\n marker: 10000,\n bigStep: 5000,\n smallStep: 1000,\n secondStep: 1,\n },\n 5000: {\n marker: 5000,\n bigStep: 1000,\n smallStep: 500,\n secondStep: 1 / 2,\n },\n 2500: {\n marker: 2000,\n bigStep: 1000,\n smallStep: 500,\n secondStep: 1 / 2,\n },\n 1500: {\n marker: 2000,\n bigStep: 1000,\n smallStep: 200,\n secondStep: 1 / 5,\n },\n 700: {\n marker: 1000,\n bigStep: 500,\n smallStep: 100,\n secondStep: 1 / 10,\n },\n };\n }\n\n getScaleInfo(resolution) {\n let keys = Object.keys(this.timeinfo).map(item => parseInt(item, 10));\n\n // make sure keys are numerically sorted.\n keys = keys.sort((a, b) => a - b);\n\n for (let i = 0; i < keys.length; i += 1) {\n if (resolution <= keys[i]) {\n return this.timeinfo[keys[i]];\n }\n }\n\n return this.timeinfo[keys[0]];\n }\n\n /*\n Return time in format mm:ss\n */\n static formatTime(milliseconds) {\n const seconds = milliseconds / 1000;\n let s = seconds % 60;\n const m = (seconds - s) / 60;\n\n if (s < 10) {\n s = `0${s}`;\n }\n\n return `${m}:${s}`;\n }\n\n render() {\n const widthX = secondsToPixels(this.duration, this.samplesPerPixel, this.sampleRate);\n const pixPerSec = this.sampleRate / this.samplesPerPixel;\n const pixOffset = secondsToPixels(this.offset, this.samplesPerPixel, this.sampleRate);\n const scaleInfo = this.getScaleInfo(this.samplesPerPixel);\n const canvasInfo = {};\n const timeMarkers = [];\n const end = widthX + pixOffset;\n let counter = 0;\n\n for (let i = 0; i < end; i += (pixPerSec * scaleInfo.secondStep)) {\n const pixIndex = Math.floor(i);\n const pix = pixIndex - pixOffset;\n\n if (pixIndex >= pixOffset) {\n // put a timestamp every 30 seconds.\n if (scaleInfo.marker && (counter % scaleInfo.marker === 0)) {\n timeMarkers.push(h('div.time',\n {\n attributes: {\n style: `position: absolute; left: ${pix}px;`,\n },\n },\n [TimeScale.formatTime(counter)],\n ));\n\n canvasInfo[pix] = 10;\n } else if (scaleInfo.bigStep && (counter % scaleInfo.bigStep === 0)) {\n canvasInfo[pix] = 5;\n } else if (scaleInfo.smallStep && (counter % scaleInfo.smallStep === 0)) {\n canvasInfo[pix] = 2;\n }\n }\n\n counter += (1000 * scaleInfo.secondStep);\n }\n\n return h('div.playlist-time-scale',\n {\n attributes: {\n style: `position: relative; left: 0; right: 0; margin-left: ${this.marginLeft}px;`,\n },\n },\n [\n timeMarkers,\n h('canvas',\n {\n attributes: {\n width: widthX,\n height: 30,\n style: 'position: absolute; left: 0; right: 0; top: 0; bottom: 0;',\n },\n hook: new TimeScaleHook(canvasInfo, this.offset, this.samplesPerPixel, this.duration),\n },\n ),\n ],\n );\n }\n}\n\nexport default TimeScale;\n\n\n\n// WEBPACK FOOTER //\n// ./src/TimeScale.js","/*\n* virtual-dom hook for rendering the time scale canvas.\n*/\nexport default class {\n constructor(tickInfo, offset, samplesPerPixel, duration) {\n this.tickInfo = tickInfo;\n this.offset = offset;\n this.samplesPerPixel = samplesPerPixel;\n this.duration = duration;\n }\n\n hook(canvas, prop, prev) {\n // canvas is up to date\n if (prev !== undefined\n && (prev.offset === this.offset)\n && (prev.duration === this.duration)\n && (prev.samplesPerPixel === this.samplesPerPixel)) {\n return;\n }\n\n const width = canvas.width;\n const height = canvas.height;\n const ctx = canvas.getContext('2d');\n\n ctx.clearRect(0, 0, width, height);\n\n Object.keys(this.tickInfo).forEach((x) => {\n const scaleHeight = this.tickInfo[x];\n const scaleY = height - scaleHeight;\n ctx.fillRect(x, scaleY, 1, scaleHeight);\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/render/TimeScaleHook.js","import _assign from 'lodash.assign';\nimport _forOwn from 'lodash.forown';\n\nimport uuid from 'uuid';\nimport h from 'virtual-dom/h';\n\nimport extractPeaks from 'webaudio-peaks';\nimport { FADEIN, FADEOUT } from 'fade-maker';\n\nimport { secondsToPixels, secondsToSamples } from './utils/conversions';\nimport stateClasses from './track/states';\n\nimport CanvasHook from './render/CanvasHook';\nimport FadeCanvasHook from './render/FadeCanvasHook';\nimport VolumeSliderHook from './render/VolumeSliderHook';\n\nconst MAX_CANVAS_WIDTH = 1000;\n\nexport default class {\n\n constructor() {\n this.name = 'Untitled';\n this.customClass = undefined;\n this.waveOutlineColor = undefined;\n this.gain = 1;\n this.fades = {};\n this.peakData = {\n type: 'WebAudio',\n mono: false,\n };\n\n this.cueIn = 0;\n this.cueOut = 0;\n this.duration = 0;\n this.startTime = 0;\n this.endTime = 0;\n }\n\n setEventEmitter(ee) {\n this.ee = ee;\n }\n\n setName(name) {\n this.name = name;\n }\n\n setCustomClass(className) {\n this.customClass = className;\n }\n\n setWaveOutlineColor(color) {\n this.waveOutlineColor = color;\n }\n\n setCues(cueIn, cueOut) {\n if (cueOut < cueIn) {\n throw new Error('cue out cannot be less than cue in');\n }\n\n this.cueIn = cueIn;\n this.cueOut = cueOut;\n this.duration = this.cueOut - this.cueIn;\n this.endTime = this.startTime + this.duration;\n }\n\n /*\n * start, end in seconds relative to the entire playlist.\n */\n trim(start, end) {\n const trackStart = this.getStartTime();\n const trackEnd = this.getEndTime();\n const offset = this.cueIn - trackStart;\n\n if ((trackStart <= start && trackEnd >= start) ||\n (trackStart <= end && trackEnd >= end)) {\n const cueIn = (start < trackStart) ? trackStart : start;\n const cueOut = (end > trackEnd) ? trackEnd : end;\n\n this.setCues(cueIn + offset, cueOut + offset);\n if (start > trackStart) {\n this.setStartTime(start);\n }\n }\n }\n\n setStartTime(start) {\n this.startTime = start;\n this.endTime = start + this.duration;\n }\n\n setPlayout(playout) {\n this.playout = playout;\n }\n\n setOfflinePlayout(playout) {\n this.offlinePlayout = playout;\n }\n\n setEnabledStates(enabledStates = {}) {\n const defaultStatesEnabled = {\n cursor: true,\n fadein: true,\n fadeout: true,\n select: true,\n shift: true,\n };\n\n this.enabledStates = _assign({}, defaultStatesEnabled, enabledStates);\n }\n\n setFadeIn(duration, shape = 'logarithmic') {\n if (duration > this.duration) {\n throw new Error('Invalid Fade In');\n }\n\n const fade = {\n shape,\n start: 0,\n end: duration,\n };\n\n if (this.fadeIn) {\n this.removeFade(this.fadeIn);\n this.fadeIn = undefined;\n }\n\n this.fadeIn = this.saveFade(FADEIN, fade.shape, fade.start, fade.end);\n }\n\n setFadeOut(duration, shape = 'logarithmic') {\n if (duration > this.duration) {\n throw new Error('Invalid Fade Out');\n }\n\n const fade = {\n shape,\n start: this.duration - duration,\n end: this.duration,\n };\n\n if (this.fadeOut) {\n this.removeFade(this.fadeOut);\n this.fadeOut = undefined;\n }\n\n this.fadeOut = this.saveFade(FADEOUT, fade.shape, fade.start, fade.end);\n }\n\n saveFade(type, shape, start, end) {\n const id = uuid.v4();\n\n this.fades[id] = {\n type,\n shape,\n start,\n end,\n };\n\n return id;\n }\n\n removeFade(id) {\n delete this.fades[id];\n }\n\n setBuffer(buffer) {\n this.buffer = buffer;\n }\n\n setPeakData(data) {\n this.peakData = data;\n }\n\n calculatePeaks(samplesPerPixel, sampleRate) {\n const cueIn = secondsToSamples(this.cueIn, sampleRate);\n const cueOut = secondsToSamples(this.cueOut, sampleRate);\n\n this.setPeaks(extractPeaks(this.buffer, samplesPerPixel, this.peakData.mono, cueIn, cueOut));\n }\n\n setPeaks(peaks) {\n this.peaks = peaks;\n }\n\n setState(state) {\n this.state = state;\n\n if (this.state && this.enabledStates[this.state]) {\n const StateClass = stateClasses[this.state];\n this.stateObj = new StateClass(this);\n } else {\n this.stateObj = undefined;\n }\n }\n\n getStartTime() {\n return this.startTime;\n }\n\n getEndTime() {\n return this.endTime;\n }\n\n getDuration() {\n return this.duration;\n }\n\n isPlaying() {\n return this.playout.isPlaying();\n }\n\n setShouldPlay(bool) {\n this.playout.setShouldPlay(bool);\n }\n\n setGainLevel(level) {\n this.gain = level;\n this.playout.setVolumeGainLevel(level);\n }\n\n setMasterGainLevel(level) {\n this.playout.setMasterGainLevel(level);\n }\n\n /*\n startTime, endTime in seconds (float).\n segment is for a highlighted section in the UI.\n\n returns a Promise that will resolve when the AudioBufferSource\n is either stopped or plays out naturally.\n */\n schedulePlay(now, startTime, endTime, config) {\n let start;\n let duration;\n let when = now;\n let segment = (endTime) ? (endTime - startTime) : undefined;\n\n const defaultOptions = {\n shouldPlay: true,\n masterGain: 1,\n isOffline: false,\n };\n\n const options = _assign({}, defaultOptions, config);\n const playoutSystem = options.isOffline ? this.offlinePlayout : this.playout;\n\n // 1) track has no content to play.\n // 2) track does not play in this selection.\n if ((this.endTime <= startTime) || (segment && (startTime + segment) < this.startTime)) {\n // return a resolved promise since this track is technically \"stopped\".\n return Promise.resolve();\n }\n\n // track should have something to play if it gets here.\n\n // the track starts in the future or on the cursor position\n if (this.startTime >= startTime) {\n start = 0;\n // schedule additional delay for this audio node.\n when += (this.startTime - startTime);\n\n if (endTime) {\n segment -= (this.startTime - startTime);\n duration = Math.min(segment, this.duration);\n } else {\n duration = this.duration;\n }\n } else {\n start = startTime - this.startTime;\n\n if (endTime) {\n duration = Math.min(segment, this.duration - start);\n } else {\n duration = this.duration - start;\n }\n }\n\n start += this.cueIn;\n const relPos = startTime - this.startTime;\n const sourcePromise = playoutSystem.setUpSource();\n\n // param relPos: cursor position in seconds relative to this track.\n // can be negative if the cursor is placed before the start of this track etc.\n _forOwn(this.fades, (fade) => {\n let fadeStart;\n let fadeDuration;\n\n // only apply fade if it's ahead of the cursor.\n if (relPos < fade.end) {\n if (relPos <= fade.start) {\n fadeStart = now + (fade.start - relPos);\n fadeDuration = fade.end - fade.start;\n } else if (relPos > fade.start && relPos < fade.end) {\n fadeStart = now - (relPos - fade.start);\n fadeDuration = fade.end - fade.start;\n }\n\n switch (fade.type) {\n case FADEIN: {\n playoutSystem.applyFadeIn(fadeStart, fadeDuration, fade.shape);\n break;\n }\n case FADEOUT: {\n playoutSystem.applyFadeOut(fadeStart, fadeDuration, fade.shape);\n break;\n }\n default: {\n throw new Error('Invalid fade type saved on track.');\n }\n }\n }\n });\n\n playoutSystem.setVolumeGainLevel(this.gain);\n playoutSystem.setShouldPlay(options.shouldPlay);\n playoutSystem.setMasterGainLevel(options.masterGain);\n playoutSystem.play(when, start, duration);\n\n return sourcePromise;\n }\n\n scheduleStop(when = 0) {\n this.playout.stop(when);\n }\n\n renderOverlay(data) {\n const channelPixels = secondsToPixels(data.playlistLength, data.resolution, data.sampleRate);\n\n const config = {\n attributes: {\n style: `position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: ${channelPixels}px; z-index: 9;`,\n },\n };\n\n let overlayClass = '';\n\n if (this.stateObj) {\n this.stateObj.setup(data.resolution, data.sampleRate);\n const StateClass = stateClasses[this.state];\n const events = StateClass.getEvents();\n\n events.forEach((event) => {\n config[`on${event}`] = this.stateObj[event].bind(this.stateObj);\n });\n\n overlayClass = StateClass.getClass();\n }\n // use this overlay for track event cursor position calculations.\n return h(`div.playlist-overlay${overlayClass}`, config);\n }\n\n renderControls(data) {\n const muteClass = data.muted ? '.active' : '';\n const soloClass = data.soloed ? '.active' : '';\n const numChan = this.peaks.data.length;\n\n return h('div.controls',\n {\n attributes: {\n style: `height: ${numChan * data.height}px; width: ${data.controls.width}px; position: absolute; left: 0; z-index: 10;`,\n },\n }, [\n h('header', [this.name]),\n h('div.btn-group', [\n h(`span.btn.btn-default.btn-xs.btn-mute${muteClass}`, {\n onclick: () => {\n this.ee.emit('mute', this);\n },\n }, ['Mute']),\n h(`span.btn.btn-default.btn-xs.btn-solo${soloClass}`, {\n onclick: () => {\n this.ee.emit('solo', this);\n },\n }, ['Solo']),\n ]),\n h('label', [\n h('input.volume-slider', {\n attributes: {\n type: 'range',\n min: 0,\n max: 100,\n value: 100,\n },\n hook: new VolumeSliderHook(this.gain),\n oninput: (e) => {\n this.ee.emit('volumechange', e.target.value, this);\n },\n }),\n ]),\n ],\n );\n }\n\n render(data) {\n const width = this.peaks.length;\n const playbackX = secondsToPixels(data.playbackSeconds, data.resolution, data.sampleRate);\n const startX = secondsToPixels(this.startTime, data.resolution, data.sampleRate);\n const endX = secondsToPixels(this.endTime, data.resolution, data.sampleRate);\n let progressWidth = 0;\n const numChan = this.peaks.data.length;\n\n if (playbackX > 0 && playbackX > startX) {\n if (playbackX < endX) {\n progressWidth = playbackX - startX;\n } else {\n progressWidth = width;\n }\n }\n\n const waveformChildren = [\n h('div.cursor', {\n attributes: {\n style: `position: absolute; width: 1px; margin: 0; padding: 0; top: 0; left: ${playbackX}px; bottom: 0; z-index: 5;`,\n },\n }),\n ];\n\n const channels = Object.keys(this.peaks.data).map((channelNum) => {\n const channelChildren = [\n h('div.channel-progress', {\n attributes: {\n style: `position: absolute; width: ${progressWidth}px; height: ${data.height}px; z-index: 2;`,\n },\n }),\n ];\n let offset = 0;\n let totalWidth = width;\n const peaks = this.peaks.data[channelNum];\n\n while (totalWidth > 0) {\n const currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH);\n const canvasColor = this.waveOutlineColor\n ? this.waveOutlineColor\n : data.colors.waveOutlineColor;\n\n channelChildren.push(h('canvas', {\n attributes: {\n width: currentWidth,\n height: data.height,\n style: 'float: left; position: relative; margin: 0; padding: 0; z-index: 3;',\n },\n hook: new CanvasHook(peaks, offset, this.peaks.bits, canvasColor),\n }));\n\n totalWidth -= currentWidth;\n offset += MAX_CANVAS_WIDTH;\n }\n\n // if there are fades, display them.\n if (this.fadeIn) {\n const fadeIn = this.fades[this.fadeIn];\n const fadeWidth = secondsToPixels(\n fadeIn.end - fadeIn.start,\n data.resolution,\n data.sampleRate,\n );\n\n channelChildren.push(h('div.wp-fade.wp-fadein',\n {\n attributes: {\n style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; left: 0; z-index: 4;`,\n },\n }, [\n h('canvas',\n {\n attributes: {\n width: fadeWidth,\n height: data.height,\n },\n hook: new FadeCanvasHook(\n fadeIn.type,\n fadeIn.shape,\n fadeIn.end - fadeIn.start,\n data.resolution,\n ),\n },\n ),\n ],\n ));\n }\n\n if (this.fadeOut) {\n const fadeOut = this.fades[this.fadeOut];\n const fadeWidth = secondsToPixels(\n fadeOut.end - fadeOut.start,\n data.resolution,\n data.sampleRate,\n );\n\n channelChildren.push(h('div.wp-fade.wp-fadeout',\n {\n attributes: {\n style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; right: 0; z-index: 4;`,\n },\n },\n [\n h('canvas', {\n attributes: {\n width: fadeWidth,\n height: data.height,\n },\n hook: new FadeCanvasHook(\n fadeOut.type,\n fadeOut.shape,\n fadeOut.end - fadeOut.start,\n data.resolution,\n ),\n }),\n ],\n ));\n }\n\n return h(`div.channel.channel-${channelNum}`,\n {\n attributes: {\n style: `height: ${data.height}px; width: ${width}px; top: ${channelNum * data.height}px; left: ${startX}px; position: absolute; margin: 0; padding: 0; z-index: 1;`,\n },\n },\n channelChildren,\n );\n });\n\n waveformChildren.push(channels);\n waveformChildren.push(this.renderOverlay(data));\n\n // draw cursor selection on active track.\n if (data.isActive === true) {\n const cStartX = secondsToPixels(data.timeSelection.start, data.resolution, data.sampleRate);\n const cEndX = secondsToPixels(data.timeSelection.end, data.resolution, data.sampleRate);\n const cWidth = (cEndX - cStartX) + 1;\n const cClassName = (cWidth > 1) ? '.segment' : '.point';\n\n waveformChildren.push(h(`div.selection${cClassName}`, {\n attributes: {\n style: `position: absolute; width: ${cWidth}px; bottom: 0; top: 0; left: ${cStartX}px; z-index: 4;`,\n },\n }));\n }\n\n const waveform = h('div.waveform',\n {\n attributes: {\n style: `height: ${numChan * data.height}px; position: relative;`,\n },\n },\n waveformChildren,\n );\n\n const channelChildren = [];\n let channelMargin = 0;\n\n if (data.controls.show) {\n channelChildren.push(this.renderControls(data));\n channelMargin = data.controls.width;\n }\n\n channelChildren.push(waveform);\n\n const audibleClass = data.shouldPlay ? '' : '.silent';\n const customClass = (this.customClass === undefined) ? '' : `.${this.customClass}`;\n\n return h(`div.channel-wrapper${audibleClass}${customClass}`,\n {\n attributes: {\n style: `margin-left: ${channelMargin}px; height: ${data.height * numChan}px;`,\n },\n },\n channelChildren,\n );\n }\n\n getTrackDetails() {\n const info = {\n src: this.src,\n start: this.startTime,\n end: this.endTime,\n name: this.name,\n customClass: this.customClass,\n cuein: this.cueIn,\n cueout: this.cueOut,\n };\n\n if (this.fadeIn) {\n const fadeIn = this.fades[this.fadeIn];\n\n info.fadeIn = {\n shape: fadeIn.shape,\n duration: fadeIn.end - fadeIn.start,\n };\n }\n\n if (this.fadeOut) {\n const fadeOut = this.fades[this.fadeOut];\n\n info.fadeOut = {\n shape: fadeOut.shape,\n duration: fadeOut.end - fadeOut.start,\n };\n }\n\n return info;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Track.js","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forOwn(object, iteratee) {\n return object && baseForOwn(object, typeof iteratee == 'function' ? iteratee : identity);\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = forOwn;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash.forown/index.js\n// module id = 63\n// module chunks = 0","// uuid.js\n//\n// Copyright (c) 2010-2012 Robert Kieffer\n// MIT License - http://opensource.org/licenses/mit-license.php\n\n// Unique ID creation requires a high quality random # generator. We feature\n// detect to determine the best RNG source, normalizing to a function that\n// returns 128-bits of randomness, since that's what's usually required\nvar _rng = require('./rng');\n\n// Maps for number <-> hex string conversion\nvar _byteToHex = [];\nvar _hexToByte = {};\nfor (var i = 0; i < 256; i++) {\n _byteToHex[i] = (i + 0x100).toString(16).substr(1);\n _hexToByte[_byteToHex[i]] = i;\n}\n\n// **`parse()` - Parse a UUID into it's component bytes**\nfunction parse(s, buf, offset) {\n var i = (buf && offset) || 0, ii = 0;\n\n buf = buf || [];\n s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {\n if (ii < 16) { // Don't overflow!\n buf[i + ii++] = _hexToByte[oct];\n }\n });\n\n // Zero out remaining bytes if string was short\n while (ii < 16) {\n buf[i + ii++] = 0;\n }\n\n return buf;\n}\n\n// **`unparse()` - Convert UUID byte array (ala parse()) into a string**\nfunction unparse(buf, offset) {\n var i = offset || 0, bth = _byteToHex;\n return bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]];\n}\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\n// random #'s we need to init node and clockseq\nvar _seedBytes = _rng();\n\n// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\nvar _nodeId = [\n _seedBytes[0] | 0x01,\n _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]\n];\n\n// Per 4.2.2, randomize (14 bit) clockseq\nvar _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;\n\n// Previous uuid creation time\nvar _lastMSecs = 0, _lastNSecs = 0;\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n var node = options.node || _nodeId;\n for (var n = 0; n < 6; n++) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : unparse(b);\n}\n\n// **`v4()` - Generate random UUID**\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v4(options, buf, offset) {\n // Deprecated - 'format' argument, as supported in v1.2\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options == 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || _rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ii++) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || unparse(rnds);\n}\n\n// Export public API\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\nuuid.parse = parse;\nuuid.unparse = unparse;\n\nmodule.exports = uuid;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/uuid/uuid.js\n// module id = 64\n// module chunks = 0","\nvar rng;\n\nvar crypto = global.crypto || global.msCrypto; // for IE 11\nif (crypto && crypto.getRandomValues) {\n // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto\n // Moderately fast, high quality\n var _rnds8 = new Uint8Array(16);\n rng = function whatwgRNG() {\n crypto.getRandomValues(_rnds8);\n return _rnds8;\n };\n}\n\nif (!rng) {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var _rnds = new Array(16);\n rng = function() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return _rnds;\n };\n}\n\nmodule.exports = rng;\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/uuid/rng-browser.js\n// module id = 65\n// module chunks = 0","'use strict';\n\n//http://jsperf.com/typed-array-min-max/2\n//plain for loop for finding min/max is way faster than anything else.\n/**\n* @param {TypedArray} array - Subarray of audio to calculate peaks from.\n*/\nfunction findMinMax(array) {\n var min = Infinity;\n var max = -Infinity;\n var i = 0;\n var len = array.length;\n var curr;\n\n for(; i < len; i++) {\n curr = array[i];\n if (min > curr) {\n min = curr;\n }\n if (max < curr) {\n max = curr;\n }\n }\n\n return {\n min: min,\n max: max\n };\n}\n\n/**\n* @param {Number} n - peak to convert from float to Int8, Int16 etc.\n* @param {Number} bits - convert to #bits two's complement signed integer\n*/\nfunction convert(n, bits) {\n var max = Math.pow(2, bits-1);\n var v = n < 0 ? n * max : n * max - 1;\n return Math.max(-max, Math.min(max-1, v));\n}\n\n/**\n* @param {TypedArray} channel - Audio track frames to calculate peaks from.\n* @param {Number} samplesPerPixel - Audio frames per peak\n*/\nfunction extractPeaks(channel, samplesPerPixel, bits) {\n var i;\n var chanLength = channel.length;\n var numPeaks = Math.ceil(chanLength / samplesPerPixel);\n var start;\n var end;\n var segment;\n var max; \n var min;\n var extrema;\n\n //create interleaved array of min,max\n var peaks = new (eval(\"Int\"+bits+\"Array\"))(numPeaks*2);\n\n for (i = 0; i < numPeaks; i++) {\n\n start = i * samplesPerPixel;\n end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel;\n\n segment = channel.subarray(start, end);\n extrema = findMinMax(segment);\n min = convert(extrema.min, bits);\n max = convert(extrema.max, bits);\n\n peaks[i*2] = min;\n peaks[i*2+1] = max;\n }\n\n return peaks;\n}\n\nfunction makeMono(channelPeaks, bits) {\n var numChan = channelPeaks.length;\n var weight = 1 / numChan;\n var numPeaks = channelPeaks[0].length / 2;\n var c = 0;\n var i = 0;\n var min;\n var max;\n var peaks = new (eval(\"Int\"+bits+\"Array\"))(numPeaks*2);\n\n for (i = 0; i < numPeaks; i++) {\n min = 0;\n max = 0;\n\n for (c = 0; c < numChan; c++) {\n min += weight * channelPeaks[c][i*2];\n max += weight * channelPeaks[c][i*2+1];\n }\n\n peaks[i*2] = min;\n peaks[i*2+1] = max;\n }\n\n //return in array so channel number counts still work.\n return [peaks];\n}\n\n/**\n* @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.\n* @param {Number} samplesPerPixel - Number of audio samples per peak.\n* @param {Number} cueIn - index in channel to start peak calculations from.\n* @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).\n*/\nmodule.exports = function(source, samplesPerPixel, isMono, cueIn, cueOut, bits) {\n samplesPerPixel = samplesPerPixel || 10000;\n bits = bits || 8;\n \n if (isMono === null || isMono === undefined) {\n isMono = true;\n }\n\n if ([8, 16, 32].indexOf(bits) < 0) {\n throw new Error(\"Invalid number of bits specified for peaks.\");\n }\n\n var numChan = source.numberOfChannels;\n var peaks = [];\n var c;\n var numPeaks;\n var channel;\n var slice;\n\n if (typeof source.subarray === \"undefined\") {\n for (c = 0; c < numChan; c++) {\n channel = source.getChannelData(c);\n cueIn = cueIn || 0;\n cueOut = cueOut || channel.length;\n slice = channel.subarray(cueIn, cueOut);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n }\n else {\n cueIn = cueIn || 0;\n cueOut = cueOut || source.length;\n peaks.push(extractPeaks(source.subarray(cueIn, cueOut), samplesPerPixel, bits));\n }\n\n if (isMono && peaks.length > 1) {\n peaks = makeMono(peaks, bits);\n }\n\n numPeaks = peaks[0].length / 2;\n\n return {\n length: numPeaks,\n data: peaks,\n bits: bits\n };\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webaudio-peaks/index.js\n// module id = 66\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.FADEOUT = exports.FADEIN = exports.LOGARITHMIC = exports.EXPONENTIAL = exports.LINEAR = exports.SCURVE = undefined;\nexports.createFadeIn = createFadeIn;\nexports.createFadeOut = createFadeOut;\n\nvar _fadeCurves = require('fade-curves');\n\nvar SCURVE = exports.SCURVE = \"sCurve\";\nvar LINEAR = exports.LINEAR = \"linear\";\nvar EXPONENTIAL = exports.EXPONENTIAL = \"exponential\";\nvar LOGARITHMIC = exports.LOGARITHMIC = \"logarithmic\";\n\nvar FADEIN = exports.FADEIN = \"FadeIn\";\nvar FADEOUT = exports.FADEOUT = \"FadeOut\";\n\nfunction sCurveFadeIn(start, duration) {\n var curve = (0, _fadeCurves.sCurve)(10000, 1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction sCurveFadeOut(start, duration) {\n var curve = (0, _fadeCurves.sCurve)(10000, -1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction linearFadeIn(start, duration) {\n this.linearRampToValueAtTime(0, start);\n this.linearRampToValueAtTime(1, start + duration);\n}\n\nfunction linearFadeOut(start, duration) {\n this.linearRampToValueAtTime(1, start);\n this.linearRampToValueAtTime(0, start + duration);\n}\n\nfunction exponentialFadeIn(start, duration) {\n this.exponentialRampToValueAtTime(0.01, start);\n this.exponentialRampToValueAtTime(1, start + duration);\n}\n\nfunction exponentialFadeOut(start, duration) {\n this.exponentialRampToValueAtTime(1, start);\n this.exponentialRampToValueAtTime(0.01, start + duration);\n}\n\nfunction logarithmicFadeIn(start, duration) {\n var curve = (0, _fadeCurves.logarithmic)(10000, 10, 1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction logarithmicFadeOut(start, duration) {\n var curve = (0, _fadeCurves.logarithmic)(10000, 10, -1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction createFadeIn(gain, shape, start, duration) {\n switch (shape) {\n case SCURVE:\n sCurveFadeIn.call(gain, start, duration);\n break;\n case LINEAR:\n linearFadeIn.call(gain, start, duration);\n break;\n case EXPONENTIAL:\n exponentialFadeIn.call(gain, start, duration);\n break;\n case LOGARITHMIC:\n logarithmicFadeIn.call(gain, start, duration);\n break;\n default:\n throw new Error(\"Unsupported Fade type\");\n }\n}\n\nfunction createFadeOut(gain, shape, start, duration) {\n switch (shape) {\n case SCURVE:\n sCurveFadeOut.call(gain, start, duration);\n break;\n case LINEAR:\n linearFadeOut.call(gain, start, duration);\n break;\n case EXPONENTIAL:\n exponentialFadeOut.call(gain, start, duration);\n break;\n case LOGARITHMIC:\n logarithmicFadeOut.call(gain, start, duration);\n break;\n default:\n throw new Error(\"Unsupported Fade type\");\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/fade-maker/index.js\n// module id = 67\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.linear = linear;\nexports.exponential = exponential;\nexports.sCurve = sCurve;\nexports.logarithmic = logarithmic;\nfunction linear(length, rotation) {\n var curve = new Float32Array(length),\n i,\n x,\n scale = length - 1;\n\n for (i = 0; i < length; i++) {\n x = i / scale;\n\n if (rotation > 0) {\n curve[i] = x;\n } else {\n curve[i] = 1 - x;\n }\n }\n\n return curve;\n}\n\nfunction exponential(length, rotation) {\n var curve = new Float32Array(length),\n i,\n x,\n scale = length - 1,\n index;\n\n for (i = 0; i < length; i++) {\n x = i / scale;\n index = rotation > 0 ? i : length - 1 - i;\n\n curve[index] = Math.exp(2 * x - 1) / Math.exp(1);\n }\n\n return curve;\n}\n\n//creating a curve to simulate an S-curve with setValueCurveAtTime.\nfunction sCurve(length, rotation) {\n var curve = new Float32Array(length),\n i,\n phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2);\n\n for (i = 0; i < length; ++i) {\n curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5;\n }\n return curve;\n}\n\n//creating a curve to simulate a logarithmic curve with setValueCurveAtTime.\nfunction logarithmic(length, base, rotation) {\n var curve = new Float32Array(length),\n index,\n x = 0,\n i;\n\n for (i = 0; i < length; i++) {\n //index for the curve array.\n index = rotation > 0 ? i : length - 1 - i;\n\n x = i / length;\n curve[index] = Math.log(1 + base * x) / Math.log(1 + base);\n }\n\n return curve;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/fade-curves/index.js\n// module id = 68\n// module chunks = 0","import cursor from './states/CursorState';\nimport select from './states/SelectState';\nimport shift from './states/ShiftState';\nimport fadein from './states/FadeInState';\nimport fadeout from './states/FadeOutState';\n\nexport default {\n cursor,\n select,\n shift,\n fadein,\n fadeout,\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/states.js","import { pixelsToSeconds } from '../../utils/conversions';\n\nexport default class {\n constructor(track) {\n this.track = track;\n }\n\n setup(samplesPerPixel, sampleRate) {\n this.samplesPerPixel = samplesPerPixel;\n this.sampleRate = sampleRate;\n }\n\n click(e) {\n e.preventDefault();\n\n const startX = e.offsetX;\n const startTime = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);\n\n this.track.ee.emit('select', startTime, startTime, this.track);\n }\n\n static getClass() {\n return '.state-cursor';\n }\n\n static getEvents() {\n return ['click'];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/states/CursorState.js","import { pixelsToSeconds } from '../../utils/conversions';\n\nexport default class {\n constructor(track) {\n this.track = track;\n this.active = false;\n }\n\n setup(samplesPerPixel, sampleRate) {\n this.samplesPerPixel = samplesPerPixel;\n this.sampleRate = sampleRate;\n }\n\n emitSelection(x) {\n const minX = Math.min(x, this.startX);\n const maxX = Math.max(x, this.startX);\n const startTime = pixelsToSeconds(minX, this.samplesPerPixel, this.sampleRate);\n const endTime = pixelsToSeconds(maxX, this.samplesPerPixel, this.sampleRate);\n\n this.track.ee.emit('select', startTime, endTime, this.track);\n }\n\n complete(x) {\n this.emitSelection(x);\n this.active = false;\n }\n\n mousedown(e) {\n e.preventDefault();\n this.active = true;\n\n this.startX = e.offsetX;\n const startTime = pixelsToSeconds(this.startX, this.samplesPerPixel, this.sampleRate);\n\n this.track.ee.emit('select', startTime, startTime, this.track);\n }\n\n mousemove(e) {\n if (this.active) {\n e.preventDefault();\n this.emitSelection(e.offsetX);\n }\n }\n\n mouseup(e) {\n if (this.active) {\n e.preventDefault();\n this.complete(e.offsetX);\n }\n }\n\n mouseleave(e) {\n if (this.active) {\n e.preventDefault();\n this.complete(e.offsetX);\n }\n }\n\n static getClass() {\n return '.state-select';\n }\n\n static getEvents() {\n return ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/states/SelectState.js","import { pixelsToSeconds } from '../../utils/conversions';\n\nexport default class {\n constructor(track) {\n this.track = track;\n this.active = false;\n }\n\n setup(samplesPerPixel, sampleRate) {\n this.samplesPerPixel = samplesPerPixel;\n this.sampleRate = sampleRate;\n }\n\n emitShift(x) {\n const deltaX = x - this.prevX;\n const deltaTime = pixelsToSeconds(deltaX, this.samplesPerPixel, this.sampleRate);\n this.prevX = x;\n this.track.ee.emit('shift', deltaTime, this.track);\n }\n\n complete(x) {\n this.emitShift(x);\n this.active = false;\n }\n\n mousedown(e) {\n e.preventDefault();\n\n this.active = true;\n this.el = e.target;\n this.prevX = e.offsetX;\n }\n\n mousemove(e) {\n if (this.active) {\n e.preventDefault();\n this.emitShift(e.offsetX);\n }\n }\n\n mouseup(e) {\n if (this.active) {\n e.preventDefault();\n this.complete(e.offsetX);\n }\n }\n\n mouseleave(e) {\n if (this.active) {\n e.preventDefault();\n this.complete(e.offsetX);\n }\n }\n\n static getClass() {\n return '.state-shift';\n }\n\n static getEvents() {\n return ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/states/ShiftState.js","import { pixelsToSeconds } from '../../utils/conversions';\n\nexport default class {\n constructor(track) {\n this.track = track;\n }\n\n setup(samplesPerPixel, sampleRate) {\n this.samplesPerPixel = samplesPerPixel;\n this.sampleRate = sampleRate;\n }\n\n click(e) {\n const startX = e.offsetX;\n const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);\n\n if (time > this.track.getStartTime() && time < this.track.getEndTime()) {\n this.track.ee.emit('fadein', time - this.track.getStartTime(), this.track);\n }\n }\n\n static getClass() {\n return '.state-fadein';\n }\n\n static getEvents() {\n return ['click'];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/states/FadeInState.js","import { pixelsToSeconds } from '../../utils/conversions';\n\nexport default class {\n constructor(track) {\n this.track = track;\n }\n\n setup(samplesPerPixel, sampleRate) {\n this.samplesPerPixel = samplesPerPixel;\n this.sampleRate = sampleRate;\n }\n\n click(e) {\n const startX = e.offsetX;\n const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);\n\n if (time > this.track.getStartTime() && time < this.track.getEndTime()) {\n this.track.ee.emit('fadeout', this.track.getEndTime() - time, this.track);\n }\n }\n\n static getClass() {\n return '.state-fadeout';\n }\n\n static getEvents() {\n return ['click'];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/track/states/FadeOutState.js","/*\n* virtual-dom hook for drawing to the canvas element.\n*/\nclass CanvasHook {\n constructor(peaks, offset, bits, color) {\n this.peaks = peaks;\n // http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element\n this.offset = offset;\n this.color = color;\n this.bits = bits;\n }\n\n static drawFrame(cc, h2, x, minPeak, maxPeak) {\n const min = Math.abs(minPeak * h2);\n const max = Math.abs(maxPeak * h2);\n\n // draw max\n cc.fillRect(x, 0, 1, h2 - max);\n // draw min\n cc.fillRect(x, h2 + min, 1, h2 - min);\n }\n\n hook(canvas, prop, prev) {\n // canvas is up to date\n if (prev !== undefined &&\n (prev.peaks === this.peaks)) {\n return;\n }\n\n const len = canvas.width;\n const cc = canvas.getContext('2d');\n const h2 = canvas.height / 2;\n const maxValue = 2 ** (this.bits - 1);\n\n cc.clearRect(0, 0, canvas.width, canvas.height);\n cc.fillStyle = this.color;\n\n for (let i = 0; i < len; i += 1) {\n const minPeak = this.peaks[(i + this.offset) * 2] / maxValue;\n const maxPeak = this.peaks[((i + this.offset) * 2) + 1] / maxValue;\n CanvasHook.drawFrame(cc, h2, i, minPeak, maxPeak);\n }\n }\n}\n\nexport default CanvasHook;\n\n\n\n// WEBPACK FOOTER //\n// ./src/render/CanvasHook.js","import { FADEIN, FADEOUT, SCURVE, LINEAR, EXPONENTIAL, LOGARITHMIC } from 'fade-maker';\nimport { sCurve, logarithmic, linear, exponential } from 'fade-curves';\n\n/*\n* virtual-dom hook for drawing the fade curve to the canvas element.\n*/\nclass FadeCanvasHook {\n constructor(type, shape, duration, samplesPerPixel) {\n this.type = type;\n this.shape = shape;\n this.duration = duration;\n this.samplesPerPixel = samplesPerPixel;\n }\n\n static createCurve(shape, type, width) {\n let reflection;\n let curve;\n\n switch (type) {\n case FADEIN: {\n reflection = 1;\n break;\n }\n case FADEOUT: {\n reflection = -1;\n break;\n }\n default: {\n throw new Error('Unsupported fade type.');\n }\n }\n\n switch (shape) {\n case SCURVE: {\n curve = sCurve(width, reflection);\n break;\n }\n case LINEAR: {\n curve = linear(width, reflection);\n break;\n }\n case EXPONENTIAL: {\n curve = exponential(width, reflection);\n break;\n }\n case LOGARITHMIC: {\n curve = logarithmic(width, 10, reflection);\n break;\n }\n default: {\n throw new Error('Unsupported fade shape');\n }\n }\n\n return curve;\n }\n\n hook(canvas, prop, prev) {\n // node is up to date.\n if (prev !== undefined &&\n prev.shape === this.shape &&\n prev.type === this.type &&\n prev.duration === this.duration &&\n prev.samplesPerPixel === this.samplesPerPixel) {\n return;\n }\n\n const ctx = canvas.getContext('2d');\n const width = canvas.width;\n const height = canvas.height;\n const curve = FadeCanvasHook.createCurve(this.shape, this.type, width);\n const len = curve.length;\n let y = height - (curve[0] * height);\n\n ctx.strokeStyle = 'black';\n ctx.beginPath();\n ctx.moveTo(0, y);\n\n for (let i = 1; i < len; i += 1) {\n y = height - (curve[i] * height);\n ctx.lineTo(i, y);\n }\n ctx.stroke();\n }\n}\n\nexport default FadeCanvasHook;\n\n\n\n// WEBPACK FOOTER //\n// ./src/render/FadeCanvasHook.js","/*\n* virtual-dom hook for setting the volume input programmatically.\n*/\nexport default class {\n constructor(gain) {\n this.gain = gain;\n }\n\n hook(volumeInput) {\n volumeInput.setAttribute('value', this.gain * 100);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/render/VolumeSliderHook.js","import { FADEIN, FADEOUT, createFadeIn, createFadeOut } from 'fade-maker';\n\nexport default class {\n\n constructor(ac, buffer) {\n this.ac = ac;\n this.gain = 1;\n this.buffer = buffer;\n this.destination = this.ac.destination;\n }\n\n applyFade(type, start, duration, shape = 'logarithmic') {\n if (type === FADEIN) {\n createFadeIn(this.fadeGain.gain, shape, start, duration);\n } else if (type === FADEOUT) {\n createFadeOut(this.fadeGain.gain, shape, start, duration);\n } else {\n throw new Error('Unsupported fade type');\n }\n }\n\n applyFadeIn(start, duration, shape = 'logarithmic') {\n this.applyFade(FADEIN, start, duration, shape);\n }\n\n applyFadeOut(start, duration, shape = 'logarithmic') {\n this.applyFade(FADEOUT, start, duration, shape);\n }\n\n isPlaying() {\n return this.source !== undefined;\n }\n\n getDuration() {\n return this.buffer.duration;\n }\n\n setAudioContext(audioContext) {\n this.ac = audioContext;\n this.destination = this.ac.destination;\n }\n\n setUpSource() {\n this.source = this.ac.createBufferSource();\n this.source.buffer = this.buffer;\n\n const sourcePromise = new Promise((resolve) => {\n // keep track of the buffer state.\n this.source.onended = () => {\n this.source.disconnect();\n this.fadeGain.disconnect();\n this.volumeGain.disconnect();\n this.shouldPlayGain.disconnect();\n this.masterGain.disconnect();\n\n\n this.source = undefined;\n this.fadeGain = undefined;\n this.volumeGain = undefined;\n this.shouldPlayGain = undefined;\n this.masterGain = undefined;\n\n resolve();\n };\n });\n\n this.fadeGain = this.ac.createGain();\n // used for track volume slider\n this.volumeGain = this.ac.createGain();\n // used for solo/mute\n this.shouldPlayGain = this.ac.createGain();\n this.masterGain = this.ac.createGain();\n\n this.source.connect(this.fadeGain);\n this.fadeGain.connect(this.volumeGain);\n this.volumeGain.connect(this.shouldPlayGain);\n this.shouldPlayGain.connect(this.masterGain);\n this.masterGain.connect(this.destination);\n\n return sourcePromise;\n }\n\n setVolumeGainLevel(level) {\n if (this.volumeGain) {\n this.volumeGain.gain.value = level;\n }\n }\n\n setShouldPlay(bool) {\n if (this.shouldPlayGain) {\n this.shouldPlayGain.gain.value = bool ? 1 : 0;\n }\n }\n\n setMasterGainLevel(level) {\n if (this.masterGain) {\n this.masterGain.gain.value = level;\n }\n }\n\n /*\n source.start is picky when passing the end time.\n If rounding error causes a number to make the source think\n it is playing slightly more samples than it has it won't play at all.\n Unfortunately it doesn't seem to work if you just give it a start time.\n */\n play(when, start, duration) {\n this.source.start(when, start, duration);\n }\n\n stop(when = 0) {\n if (this.source) {\n this.source.stop(when);\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Playout.js","export default function () {\n // http://jsperf.com/typed-array-min-max/2\n // plain for loop for finding min/max is way faster than anything else.\n /**\n * @param {TypedArray} array - Subarray of audio to calculate peaks from.\n */\n function findMinMax(array) {\n let min = Infinity;\n let max = -Infinity;\n let curr;\n\n for (let i = 0; i < array.length; i += 1) {\n curr = array[i];\n if (min > curr) {\n min = curr;\n }\n if (max < curr) {\n max = curr;\n }\n }\n\n return {\n min,\n max,\n };\n }\n\n /**\n * @param {Number} n - peak to convert from float to Int8, Int16 etc.\n * @param {Number} bits - convert to #bits two's complement signed integer\n */\n function convert(n, bits) {\n const max = 2 ** (bits - 1);\n const v = n < 0 ? (n * max) : (n * max) - 1;\n return Math.max(-max, Math.min(max - 1, v));\n }\n\n /**\n * @param {TypedArray} channel - Audio track frames to calculate peaks from.\n * @param {Number} samplesPerPixel - Audio frames per peak\n */\n function extractPeaks(channel, samplesPerPixel, bits) {\n const chanLength = channel.length;\n const numPeaks = Math.ceil(chanLength / samplesPerPixel);\n let start;\n let end;\n let segment;\n let max;\n let min;\n let extrema;\n\n // create interleaved array of min,max\n const peaks = new self[`Int${bits}Array`](numPeaks * 2);\n\n for (let i = 0; i < numPeaks; i += 1) {\n start = i * samplesPerPixel;\n end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel;\n\n segment = channel.subarray(start, end);\n extrema = findMinMax(segment);\n min = convert(extrema.min, bits);\n max = convert(extrema.max, bits);\n\n peaks[i * 2] = min;\n peaks[(i * 2) + 1] = max;\n }\n\n return peaks;\n }\n\n function makeMono(channelPeaks, bits) {\n const numChan = channelPeaks.length;\n const weight = 1 / numChan;\n const numPeaks = channelPeaks[0].length / 2;\n let min;\n let max;\n const peaks = new self[`Int${bits}Array`](numPeaks * 2);\n\n for (let i = 0; i < numPeaks; i += 1) {\n min = 0;\n max = 0;\n\n for (let c = 0; c < numChan; c += 1) {\n min += weight * channelPeaks[c][i * 2];\n max += weight * channelPeaks[c][(i * 2) + 1];\n }\n\n peaks[i * 2] = min;\n peaks[(i * 2) + 1] = max;\n }\n\n // return in array so channel number counts still work.\n return [peaks];\n }\n\n /**\n * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.\n * @param {Number} samplesPerPixel - Number of audio samples per peak.\n * @param {Number} cueIn - index in channel to start peak calculations from.\n * @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).\n */\n function audioPeaks(source, samplesPerPixel = 10000, isMono = true, cueIn, cueOut, bits = 8) {\n if ([8, 16, 32].indexOf(bits) < 0) {\n throw new Error('Invalid number of bits specified for peaks.');\n }\n\n const numChan = source.numberOfChannels;\n let peaks = [];\n\n if (typeof source.subarray === 'undefined') {\n for (let c = 0; c < numChan; c += 1) {\n const channel = source.getChannelData(c);\n const start = cueIn || 0;\n const end = cueOut || channel.length;\n const slice = channel.subarray(start, end);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n } else {\n const start = cueIn || 0;\n const end = cueOut || source.length;\n peaks.push(extractPeaks(source.subarray(start, end), samplesPerPixel, bits));\n }\n\n if (isMono && peaks.length > 1) {\n peaks = makeMono(peaks, bits);\n }\n\n const length = peaks[0].length / 2;\n\n return {\n bits,\n length,\n data: peaks,\n };\n }\n\n onmessage = function onmessage(e) {\n const peaks = audioPeaks(e.data.samples, e.data.samplesPerPixel);\n\n postMessage(peaks);\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/recorderWorker.js","export default function () {\n let recLength = 0;\n let recBuffersL = [];\n let recBuffersR = [];\n let sampleRate;\n\n function init(config) {\n sampleRate = config.sampleRate;\n }\n\n function record(inputBuffer) {\n recBuffersL.push(inputBuffer[0]);\n recBuffersR.push(inputBuffer[1]);\n recLength += inputBuffer[0].length;\n }\n\n function writeString(view, offset, string) {\n for (let i = 0; i < string.length; i += 1) {\n view.setUint8(offset + i, string.charCodeAt(i));\n }\n }\n\n function floatTo16BitPCM(output, offset, input) {\n let writeOffset = offset;\n for (let i = 0; i < input.length; i += 1, writeOffset += 2) {\n const s = Math.max(-1, Math.min(1, input[i]));\n output.setInt16(writeOffset, s < 0 ? s * 0x8000 : s * 0x7FFF, true);\n }\n }\n\n function encodeWAV(samples, mono = false) {\n const buffer = new ArrayBuffer(44 + (samples.length * 2));\n const view = new DataView(buffer);\n\n /* RIFF identifier */\n writeString(view, 0, 'RIFF');\n /* file length */\n view.setUint32(4, 32 + (samples.length * 2), true);\n /* RIFF type */\n writeString(view, 8, 'WAVE');\n /* format chunk identifier */\n writeString(view, 12, 'fmt ');\n /* format chunk length */\n view.setUint32(16, 16, true);\n /* sample format (raw) */\n view.setUint16(20, 1, true);\n /* channel count */\n view.setUint16(22, mono ? 1 : 2, true);\n /* sample rate */\n view.setUint32(24, sampleRate, true);\n /* byte rate (sample rate * block align) */\n view.setUint32(28, sampleRate * 4, true);\n /* block align (channel count * bytes per sample) */\n view.setUint16(32, 4, true);\n /* bits per sample */\n view.setUint16(34, 16, true);\n /* data chunk identifier */\n writeString(view, 36, 'data');\n /* data chunk length */\n view.setUint32(40, samples.length * 2, true);\n\n floatTo16BitPCM(view, 44, samples);\n\n return view;\n }\n\n function mergeBuffers(recBuffers, length) {\n const result = new Float32Array(length);\n let offset = 0;\n\n for (let i = 0; i < recBuffers.length; i += 1) {\n result.set(recBuffers[i], offset);\n offset += recBuffers[i].length;\n }\n return result;\n }\n\n function interleave(inputL, inputR) {\n const length = inputL.length + inputR.length;\n const result = new Float32Array(length);\n\n let index = 0;\n let inputIndex = 0;\n\n while (index < length) {\n result[index += 1] = inputL[inputIndex];\n result[index += 1] = inputR[inputIndex];\n inputIndex += 1;\n }\n\n return result;\n }\n\n function exportWAV(type) {\n const bufferL = mergeBuffers(recBuffersL, recLength);\n const bufferR = mergeBuffers(recBuffersR, recLength);\n const interleaved = interleave(bufferL, bufferR);\n const dataview = encodeWAV(interleaved);\n const audioBlob = new Blob([dataview], { type });\n\n postMessage(audioBlob);\n }\n\n function clear() {\n recLength = 0;\n recBuffersL = [];\n recBuffersR = [];\n }\n\n onmessage = function onmessage(e) {\n switch (e.data.command) {\n case 'init': {\n init(e.data.config);\n break;\n }\n case 'record': {\n record(e.data.buffer);\n break;\n }\n case 'exportWAV': {\n exportWAV(e.data.type);\n break;\n }\n case 'clear': {\n clear();\n break;\n }\n default: {\n throw new Error('Unknown export worker command');\n }\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/exportWavWorker.js"],"sourceRoot":""} \ No newline at end of file +{ + "version": 3, + "sources": [ + "webpack:///webpack/bootstrap aeafc8584d8139dc1582", + "webpack:///./src/app.js", + "webpack:///./~/lodash.assign/index.js", + "webpack:///./~/virtual-dom/create-element.js", + "webpack:///./~/virtual-dom/vdom/create-element.js", + "webpack:///./~/global/document.js", + "webpack:///min-document (ignored)", + "webpack:///./~/virtual-dom/vdom/apply-properties.js", + "webpack:///./~/is-object/index.js", + "webpack:///./~/virtual-dom/vnode/is-vhook.js", + "webpack:///./~/virtual-dom/vnode/is-vnode.js", + "webpack:///./~/virtual-dom/vnode/version.js", + "webpack:///./~/virtual-dom/vnode/is-vtext.js", + "webpack:///./~/virtual-dom/vnode/is-widget.js", + "webpack:///./~/virtual-dom/vnode/handle-thunk.js", + "webpack:///./~/virtual-dom/vnode/is-thunk.js", + "webpack:///./~/event-emitter/index.js", + "webpack:///./~/d/index.js", + "webpack:///./~/es5-ext/object/assign/index.js", + "webpack:///./~/es5-ext/object/assign/is-implemented.js", + "webpack:///./~/es5-ext/object/assign/shim.js", + "webpack:///./~/es5-ext/object/keys/index.js", + "webpack:///./~/es5-ext/object/keys/is-implemented.js", + "webpack:///./~/es5-ext/object/keys/shim.js", + "webpack:///./~/es5-ext/object/valid-value.js", + "webpack:///./~/es5-ext/object/normalize-options.js", + "webpack:///./~/es5-ext/object/is-callable.js", + "webpack:///./~/es5-ext/string/#/contains/index.js", + "webpack:///./~/es5-ext/string/#/contains/is-implemented.js", + "webpack:///./~/es5-ext/string/#/contains/shim.js", + "webpack:///./~/es5-ext/object/valid-callable.js", + "webpack:///./src/Playlist.js", + "webpack:///./~/lodash.defaults/index.js", + "webpack:///./~/virtual-dom/h.js", + "webpack:///./~/virtual-dom/virtual-hyperscript/index.js", + "webpack:///./~/x-is-array/index.js", + "webpack:///./~/virtual-dom/vnode/vnode.js", + "webpack:///./~/virtual-dom/vnode/vtext.js", + "webpack:///./~/virtual-dom/virtual-hyperscript/parse-tag.js", + "webpack:///./~/browser-split/index.js", + "webpack:///./~/virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js", + "webpack:///./~/virtual-dom/virtual-hyperscript/hooks/ev-hook.js", + "webpack:///./~/ev-store/index.js", + "webpack:///./~/individual/one-version.js", + "webpack:///./~/individual/index.js", + "webpack:///./~/virtual-dom/diff.js", + "webpack:///./~/virtual-dom/vtree/diff.js", + "webpack:///./~/virtual-dom/vnode/vpatch.js", + "webpack:///./~/virtual-dom/vtree/diff-props.js", + "webpack:///./~/virtual-dom/patch.js", + "webpack:///./~/virtual-dom/vdom/patch.js", + "webpack:///./~/virtual-dom/vdom/dom-index.js", + "webpack:///./~/virtual-dom/vdom/patch-op.js", + "webpack:///./~/virtual-dom/vdom/update-widget.js", + "webpack:///./~/inline-worker/index.js", + "webpack:///./src/utils/conversions.js", + "webpack:///./src/track/loader/LoaderFactory.js", + "webpack:///./src/track/loader/BlobLoader.js", + "webpack:///./src/track/loader/Loader.js", + "webpack:///./src/track/loader/XHRLoader.js", + "webpack:///./src/render/ScrollHook.js", + "webpack:///./src/TimeScale.js", + "webpack:///./src/render/TimeScaleHook.js", + "webpack:///./src/Track.js", + "webpack:///./~/lodash.forown/index.js", + "webpack:///./~/uuid/uuid.js", + "webpack:///./~/uuid/rng-browser.js", + "webpack:///./~/webaudio-peaks/index.js", + "webpack:///./~/fade-maker/index.js", + "webpack:///./~/fade-curves/index.js", + "webpack:///./src/track/states.js", + "webpack:///./src/track/states/CursorState.js", + "webpack:///./src/track/states/SelectState.js", + "webpack:///./src/track/states/ShiftState.js", + "webpack:///./src/track/states/FadeInState.js", + "webpack:///./src/track/states/FadeOutState.js", + "webpack:///./src/render/CanvasHook.js", + "webpack:///./src/render/FadeCanvasHook.js", + "webpack:///./src/render/VolumeSliderHook.js", + "webpack:///./src/Playout.js", + "webpack:///./src/utils/recorderWorker.js", + "webpack:///./src/utils/exportWavWorker.js" + ], + "names": [ + "init", + "options", + "ee", + "container", + "undefined", + "Error", + "window", + "OfflineAudioContext", + "webkitOfflineAudioContext", + "AudioContext", + "webkitAudioContext", + "audioContext", + "defaults", + "ac", + "sampleRate", + "samplesPerPixel", + "mono", + "fadeType", + "exclSolo", + "timescale", + "controls", + "show", + "width", + "colors", + "waveOutlineColor", + "timeColor", + "fadeColor", + "seekStyle", + "waveHeight", + "state", + "zoomLevels", + "config", + "zoomIndex", + "indexOf", + "playlist", + "setSampleRate", + "setSamplesPerPixel", + "setAudioContext", + "setEventEmitter", + "setUpEventEmitter", + "setTimeSelection", + "setState", + "setControlOptions", + "setWaveHeight", + "setColors", + "setZoomLevels", + "setZoomIndex", + "setMono", + "setExclSolo", + "setShowTimeScale", + "setSeekStyle", + "tree", + "render", + "rootNode", + "appendChild", + "tracks", + "soloedTracks", + "mutedTracks", + "playoutPromises", + "cursor", + "playbackSeconds", + "duration", + "scrollLeft", + "showTimescale", + "masterGain", + "exportWorker", + "stream", + "mediaRecorder", + "MediaRecorder", + "onstart", + "track", + "setName", + "setEnabledStates", + "recordingTrack", + "push", + "chunks", + "ondataavailable", + "e", + "data", + "recording", + "Blob", + "type", + "loader", + "createLoader", + "load", + "then", + "audioBuffer", + "recorderWorker", + "postMessage", + "samples", + "getChannelData", + "setCues", + "setBuffer", + "setPlayout", + "adjustDuration", + "onmessage", + "setPeaks", + "draw", + "onerror", + "style", + "controlOptions", + "height", + "on", + "speed", + "setSpeed", + "number", + "setLoop", + "start", + "end", + "isPlaying", + "lastSeeked", + "pausedAt", + "restartPlayFrom", + "seek", + "emit", + "startOfflineRender", + "deltaTime", + "setStartTime", + "getStartTime", + "record", + "play", + "pause", + "stop", + "rewind", + "fastForward", + "clear", + "soloTrack", + "adjustTrackPlayout", + "muteTrack", + "volume", + "setGainLevel", + "forEach", + "setMasterGainLevel", + "setFadeIn", + "setFadeOut", + "file", + "src", + "name", + "getActiveTrack", + "timeSelection", + "getTimeSelection", + "trim", + "calculatePeaks", + "Math", + "max", + "zoom", + "setZoom", + "min", + "length", + "trackList", + "loadPromises", + "map", + "trackInfo", + "Promise", + "all", + "audioBuffers", + "index", + "info", + "states", + "fadeIn", + "fadeOut", + "cueIn", + "cuein", + "cueOut", + "cueout", + "gain", + "muted", + "soloed", + "selection", + "selected", + "peaks", + "customClass", + "playout", + "setCustomClass", + "setWaveOutlineColor", + "shape", + "setActiveTrack", + "setPeakData", + "getState", + "concat", + "activeTrack", + "isRendering", + "offlineAudioContext", + "currentTime", + "setOfflinePlayout", + "buffer", + "schedulePlay", + "shouldPlay", + "shouldTrackPlay", + "isOffline", + "startRendering", + "command", + "catch", + "levels", + "loopNumber", + "splice", + "setShouldPlay", + "reduce", + "getEndTime", + "cursorPos", + "getElapsedTime", + "lastPlay", + "stopAnimation", + "editor", + "scheduleStop", + "bind", + "startTime", + "endTime", + "startAnimation", + "getCurrentTime", + "playbackReset", + "viewDuration", + "lastDraw", + "animationRequest", + "requestAnimationFrame", + "updateEditor", + "cancelAnimationFrame", + "getSeekStyle", + "elapsed", + "isSegmentSelection", + "newTree", + "patches", + "clientWidth", + "resolution", + "isActive", + "playlistLength", + "controlWidth", + "timeScale", + "trackElements", + "getTrackRenderData", + "isActiveTrack", + "trackSection", + "attributes", + "onscroll", + "target", + "hook", + "containerChildren", + "getTrackDetails", + "samplesToSeconds", + "secondsToSamples", + "samplesToPixels", + "pixelsToSamples", + "pixelsToSeconds", + "secondsToPixels", + "seconds", + "ceil", + "floor", + "pixels", + "resolve", + "reject", + "match", + "fr", + "FileReader", + "readAsArrayBuffer", + "addEventListener", + "decoderPromise", + "err", + "STATE_UNINITIALIZED", + "STATE_LOADING", + "STATE_DECODING", + "STATE_FINISHED", + "audioRequestState", + "percentComplete", + "setStateChange", + "lengthComputable", + "loaded", + "total", + "audioData", + "response", + "result", + "decodeAudioData", + "xhr", + "XMLHttpRequest", + "open", + "responseType", + "send", + "node", + "trackArea", + "TimeScale", + "offset", + "marginLeft", + "timeinfo", + "marker", + "bigStep", + "smallStep", + "secondStep", + "keys", + "Object", + "parseInt", + "item", + "sort", + "a", + "b", + "i", + "widthX", + "pixPerSec", + "pixOffset", + "scaleInfo", + "getScaleInfo", + "canvasInfo", + "timeMarkers", + "counter", + "pixIndex", + "pix", + "formatTime", + "milliseconds", + "s", + "m", + "tickInfo", + "canvas", + "prop", + "prev", + "ctx", + "getContext", + "clearRect", + "x", + "scaleHeight", + "scaleY", + "fillRect", + "MAX_CANVAS_WIDTH", + "fades", + "peakData", + "className", + "color", + "trackStart", + "trackEnd", + "offlinePlayout", + "enabledStates", + "defaultStatesEnabled", + "fadein", + "fadeout", + "select", + "shift", + "fade", + "removeFade", + "saveFade", + "id", + "v4", + "StateClass", + "stateObj", + "bool", + "level", + "setVolumeGainLevel", + "now", + "when", + "segment", + "defaultOptions", + "playoutSystem", + "relPos", + "sourcePromise", + "setUpSource", + "fadeStart", + "fadeDuration", + "applyFadeIn", + "applyFadeOut", + "channelPixels", + "overlayClass", + "setup", + "events", + "getEvents", + "event", + "getClass", + "muteClass", + "soloClass", + "numChan", + "onclick", + "value", + "oninput", + "playbackX", + "startX", + "endX", + "progressWidth", + "waveformChildren", + "channels", + "channelNum", + "channelChildren", + "totalWidth", + "currentWidth", + "canvasColor", + "bits", + "fadeWidth", + "renderOverlay", + "cStartX", + "cEndX", + "cWidth", + "cClassName", + "waveform", + "channelMargin", + "renderControls", + "audibleClass", + "preventDefault", + "offsetX", + "active", + "minX", + "maxX", + "emitSelection", + "complete", + "deltaX", + "prevX", + "emitShift", + "el", + "time", + "CanvasHook", + "len", + "cc", + "h2", + "maxValue", + "fillStyle", + "minPeak", + "maxPeak", + "drawFrame", + "abs", + "FadeCanvasHook", + "curve", + "createCurve", + "y", + "strokeStyle", + "beginPath", + "moveTo", + "lineTo", + "stroke", + "reflection", + "volumeInput", + "setAttribute", + "destination", + "fadeGain", + "applyFade", + "source", + "createBufferSource", + "onended", + "disconnect", + "volumeGain", + "shouldPlayGain", + "createGain", + "connect", + "playbackRate", + "findMinMax", + "array", + "Infinity", + "curr", + "convert", + "n", + "v", + "extractPeaks", + "channel", + "chanLength", + "numPeaks", + "extrema", + "self", + "subarray", + "makeMono", + "channelPeaks", + "weight", + "c", + "audioPeaks", + "isMono", + "numberOfChannels", + "slice", + "recLength", + "recBuffersL", + "recBuffersR", + "inputBuffer", + "writeString", + "view", + "string", + "setUint8", + "charCodeAt", + "floatTo16BitPCM", + "output", + "input", + "writeOffset", + "setInt16", + "encodeWAV", + "ArrayBuffer", + "DataView", + "setUint32", + "setUint16", + "mergeBuffers", + "recBuffers", + "Float32Array", + "set", + "interleave", + "inputL", + "inputR", + "inputIndex", + "exportWAV", + "bufferL", + "bufferR", + "interleaved", + "dataview", + "audioBlob" + ], + "mappings": ";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kDAAiD,eAAe;;AAEhE;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,QAAQ;AACnB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,YAAW,OAAO,WAAW;AAC7B,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA,yBAAwB;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,kBAAiB;AACjB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,UAAU;AACrB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,SAAS;AACtB,WAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC5nBA;;AAEA;;;;;;;ACFA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,oBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC7CA;AACA;AACA;;AAEA;AACA;AACA,EAAC;AACD;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;ACdA,gB;;;;;;ACAA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA,cAAa;AACb;AACA,cAAa;AACb;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;;;;;;;AChGA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;ACNA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACNA;;;;;;;ACAA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACNA;;AAEA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACvCA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAkB;;AAElB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAa,4BAA4B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,OAAO;;AAEpB;AACA,cAAa,2BAA2B;AACxC;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA0B;;AAE1B;AACA;AACA;AACA;;;;;;;ACnIA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;;AAEA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA,GAAE;AACF;AACA,GAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,GAAE;AACF;AACA;AACA;;AAEA,UAAS;AACT;AACA;;;;;;;AC9DA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;AACA;AACA,SAAQ;AACR,eAAc,aAAa,GAAG,eAAe;AAC7C;AACA;;;;;;;ACRA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AAC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AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,YAAW,OAAO,WAAW;AAC7B,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA,yBAAwB;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,kBAAiB;AACjB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,UAAU;AACrB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,SAAS,GAAG,SAAS,GAAG,SAAS;AAC9C,WAAU;AACV;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,UAAU;AACrB,cAAa,OAAO;AACpB;AACA;AACA;AACA,gBAAe,SAAS,GAAG,SAAS,GAAG,SAAS;AAChD,WAAU;AACV;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC3pBA;;AAEA;;;;;;;ACFA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL,wBAAuB,cAAc;AACrC;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;;;;;;ACxIA;AACA;;AAEA;;AAEA;AACA;AACA;;;;;;;ACPA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAmB,WAAW;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACvEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;ACTA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,gBAAe,qBAAqB;AACpC;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,cAAc;AACzB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAqD;AACrD;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,EAAC;;;;;;;ACzGD;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;AChBA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;AC1BA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;ACnBA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACrBA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;AClBA;;AAEA;;;;;;;ACFA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,kBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAmB,SAAS;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,wBAAuB,SAAS;AAChC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA2B,SAAS;AACpC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAoB,sBAAsB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAa;AACb;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAmB,sBAAsB;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,oBAAmB,sBAAsB;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA0C,2BAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAsC,2BAA2B;AACjE;AACA;AACA;AACA,mCAAkC,2BAA2B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAmB,YAAY;AAC/B;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA,MAAK;AACL;AACA;AACA;;;;;;;AC1aA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACrBA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA;;;;;;;ACzDA;;AAEA;;;;;;;ACFA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,wBAAuB,sBAAsB;AAC7C;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC/EA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,4BAA2B,0BAA0B;AACrD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;;;;;ACpFA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;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;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,QAAQ;AACnB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,EAAE;AACf;AACA;AACA,kBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACrfA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAe,SAAS;AACxB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qCAAoC,EAAE;AACtC,mBAAkB;AAClB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAmC;AACnC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAoB,SAAS;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACrLA;;AAEA,+CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;;;AC9BA;;AAEA;AACA;AACA;AACA,WAAU,WAAW;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAS,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAU,OAAO;AACjB,WAAU,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAU,WAAW;AACrB,WAAU,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,a;AACA;AACA;;AAEA;AACA;;AAEA,gBAAe,cAAc;;AAE7B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,cAAc;AAC7B;AACA;;AAEA,oBAAmB,aAAa;AAChC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAU,uBAAuB;AACjC,WAAU,OAAO;AACjB,WAAU,OAAO;AACjB,WAAU,OAAO;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,G;;;;;;ACzJA;;AAEA;AACA;AACA,EAAC;AACD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC/FA;;AAEA;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,YAAY;AAC3B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACzEA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;;;mBAEe;AACblG,gCADa;AAEbgR,gCAFa;AAGbC,8BAHa;AAIbH,gCAJa;AAKbC;AALa,E;;;;;;;;;;;;;;ACNf;;;;;AAGE,mBAAYpQ,KAAZ,EAAmB;AAAA;;AACjB,UAAKA,KAAL,GAAaA,KAAb;AACD;;;;2BAEKvD,e,EAAiBD,U,EAAY;AACjC,YAAKC,eAAL,GAAuBA,eAAvB;AACA,YAAKD,UAAL,GAAkBA,UAAlB;AACD;;;2BAEK+D,C,EAAG;AACPA,SAAEyT,cAAF;;AAEA,WAAMrB,SAASpS,EAAE0T,OAAjB;AACA,WAAMzL,YAAY,kCAAgBmK,MAAhB,EAAwB,KAAKlW,eAA7B,EAA8C,KAAKD,UAAnD,C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AAL;AAAc;AACZ4C;AACA;AACD;AACD;AAAS;AACP,iBAAM,IAAIxH,KAAJ,CAAU,+BAAV,CAAN;AACD;AAnBH;AAqBD,IAtBD;AAuBD,E", + "file": "waveform-playlist.var.js", + "sourcesContent": [ + " \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/waveform-playlist/js/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap aeafc8584d8139dc1582\n **/", + "import _assign from \"lodash.assign\";\r\nimport createElement from \"virtual-dom/create-element\";\r\nimport EventEmitter from \"event-emitter\";\r\nimport Playlist from \"./Playlist\";\r\n\r\n\r\nexport function init(options = {}, ee = EventEmitter()) {\r\n if (options.container === undefined) {\r\n throw new Error('DOM element container must be given.');\r\n }\r\n\r\n window.OfflineAudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext;\r\n window.AudioContext = window.AudioContext || window.webkitAudioContext;\r\n\r\n const audioContext = new window.AudioContext();\r\n\r\n const defaults = {\r\n ac: audioContext,\r\n sampleRate: audioContext.sampleRate,\r\n samplesPerPixel: 4096,\r\n mono: true,\r\n fadeType: 'logarithmic',\r\n exclSolo: false,\r\n timescale: false,\r\n controls: {\r\n show: false,\r\n width: 150,\r\n },\r\n colors: {\r\n waveOutlineColor: 'white',\r\n timeColor: 'grey',\r\n fadeColor: 'black',\r\n },\r\n seekStyle: 'line',\r\n waveHeight: 128,\r\n state: 'cursor',\r\n zoomLevels: [512, 1024, 2048, 4096],\r\n };\r\n\r\n const config = _assign(defaults, options);\r\n const zoomIndex = config.zoomLevels.indexOf(config.samplesPerPixel);\r\n\r\n if (zoomIndex === -1) {\r\n throw new Error('initial samplesPerPixel must be included in array zoomLevels');\r\n }\r\n\r\n const playlist = new Playlist();\r\n playlist.setSampleRate(config.sampleRate);\r\n playlist.setSamplesPerPixel(config.samplesPerPixel);\r\n playlist.setAudioContext(config.ac);\r\n playlist.setEventEmitter(ee);\r\n playlist.setUpEventEmitter();\r\n playlist.setTimeSelection(0, 0);\r\n playlist.setState(config.state);\r\n playlist.setControlOptions(config.controls);\r\n playlist.setWaveHeight(config.waveHeight);\r\n playlist.setColors(config.colors);\r\n playlist.setZoomLevels(config.zoomLevels);\r\n playlist.setZoomIndex(zoomIndex);\r\n playlist.setMono(config.mono);\r\n playlist.setExclSolo(config.exclSolo);\r\n playlist.setShowTimeScale(config.timescale);\r\n playlist.setSeekStyle(config.seekStyle);\r\n\r\n // take care of initial virtual dom rendering.\r\n const tree = playlist.render();\r\n const rootNode = createElement(tree);\r\n\r\n config.container.appendChild(rootNode);\r\n playlist.tree = tree;\r\n playlist.rootNode = rootNode;\r\n\r\n return playlist;\r\n}\r\n\r\nexport default function (options = {}, ee = EventEmitter()) {\r\n return init(options, ee);\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/app.js\n **/", + "/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max;\n\n/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */\nvar nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\nvar assign = createAssigner(function(object, source) {\n if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n});\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = assign;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.assign/index.js\n ** module id = 1\n ** module chunks = 0\n **/", + "var createElement = require(\"./vdom/create-element.js\")\n\nmodule.exports = createElement\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/create-element.js\n ** module id = 2\n ** module chunks = 0\n **/", + "var document = require(\"global/document\")\n\nvar applyProperties = require(\"./apply-properties\")\n\nvar isVNode = require(\"../vnode/is-vnode.js\")\nvar isVText = require(\"../vnode/is-vtext.js\")\nvar isWidget = require(\"../vnode/is-widget.js\")\nvar handleThunk = require(\"../vnode/handle-thunk.js\")\n\nmodule.exports = createElement\n\nfunction createElement(vnode, opts) {\n var doc = opts ? opts.document || document : document\n var warn = opts ? opts.warn : null\n\n vnode = handleThunk(vnode).a\n\n if (isWidget(vnode)) {\n return vnode.init()\n } else if (isVText(vnode)) {\n return doc.createTextNode(vnode.text)\n } else if (!isVNode(vnode)) {\n if (warn) {\n warn(\"Item is not a valid virtual dom node\", vnode)\n }\n return null\n }\n\n var node = (vnode.namespace === null) ?\n doc.createElement(vnode.tagName) :\n doc.createElementNS(vnode.namespace, vnode.tagName)\n\n var props = vnode.properties\n applyProperties(node, props)\n\n var children = vnode.children\n\n for (var i = 0; i < children.length; i++) {\n var childNode = createElement(children[i], opts)\n if (childNode) {\n node.appendChild(childNode)\n }\n }\n\n return node\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vdom/create-element.js\n ** module id = 3\n ** module chunks = 0\n **/", + "var topLevel = typeof global !== 'undefined' ? global :\n typeof window !== 'undefined' ? window : {}\nvar minDoc = require('min-document');\n\nif (typeof document !== 'undefined') {\n module.exports = document;\n} else {\n var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\n\n if (!doccy) {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\n }\n\n module.exports = doccy;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/global/document.js\n ** module id = 4\n ** module chunks = 0\n **/", + "/* (ignored) */\n\n\n/*****************\n ** WEBPACK FOOTER\n ** min-document (ignored)\n ** module id = 5\n ** module chunks = 0\n **/", + "var isObject = require(\"is-object\")\nvar isHook = require(\"../vnode/is-vhook.js\")\n\nmodule.exports = applyProperties\n\nfunction applyProperties(node, props, previous) {\n for (var propName in props) {\n var propValue = props[propName]\n\n if (propValue === undefined) {\n removeProperty(node, propName, propValue, previous);\n } else if (isHook(propValue)) {\n removeProperty(node, propName, propValue, previous)\n if (propValue.hook) {\n propValue.hook(node,\n propName,\n previous ? previous[propName] : undefined)\n }\n } else {\n if (isObject(propValue)) {\n patchObject(node, props, previous, propName, propValue);\n } else {\n node[propName] = propValue\n }\n }\n }\n}\n\nfunction removeProperty(node, propName, propValue, previous) {\n if (previous) {\n var previousValue = previous[propName]\n\n if (!isHook(previousValue)) {\n if (propName === \"attributes\") {\n for (var attrName in previousValue) {\n node.removeAttribute(attrName)\n }\n } else if (propName === \"style\") {\n for (var i in previousValue) {\n node.style[i] = \"\"\n }\n } else if (typeof previousValue === \"string\") {\n node[propName] = \"\"\n } else {\n node[propName] = null\n }\n } else if (previousValue.unhook) {\n previousValue.unhook(node, propName, propValue)\n }\n }\n}\n\nfunction patchObject(node, props, previous, propName, propValue) {\n var previousValue = previous ? previous[propName] : undefined\n\n // Set attributes\n if (propName === \"attributes\") {\n for (var attrName in propValue) {\n var attrValue = propValue[attrName]\n\n if (attrValue === undefined) {\n node.removeAttribute(attrName)\n } else {\n node.setAttribute(attrName, attrValue)\n }\n }\n\n return\n }\n\n if(previousValue && isObject(previousValue) &&\n getPrototype(previousValue) !== getPrototype(propValue)) {\n node[propName] = propValue\n return\n }\n\n if (!isObject(node[propName])) {\n node[propName] = {}\n }\n\n var replacer = propName === \"style\" ? \"\" : undefined\n\n for (var k in propValue) {\n var value = propValue[k]\n node[propName][k] = (value === undefined) ? replacer : value\n }\n}\n\nfunction getPrototype(value) {\n if (Object.getPrototypeOf) {\n return Object.getPrototypeOf(value)\n } else if (value.__proto__) {\n return value.__proto__\n } else if (value.constructor) {\n return value.constructor.prototype\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vdom/apply-properties.js\n ** module id = 6\n ** module chunks = 0\n **/", + "\"use strict\";\n\nmodule.exports = function isObject(x) {\n\treturn typeof x === \"object\" && x !== null;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/is-object/index.js\n ** module id = 7\n ** module chunks = 0\n **/", + "module.exports = isHook\n\nfunction isHook(hook) {\n return hook &&\n (typeof hook.hook === \"function\" && !hook.hasOwnProperty(\"hook\") ||\n typeof hook.unhook === \"function\" && !hook.hasOwnProperty(\"unhook\"))\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/is-vhook.js\n ** module id = 8\n ** module chunks = 0\n **/", + "var version = require(\"./version\")\n\nmodule.exports = isVirtualNode\n\nfunction isVirtualNode(x) {\n return x && x.type === \"VirtualNode\" && x.version === version\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/is-vnode.js\n ** module id = 9\n ** module chunks = 0\n **/", + "module.exports = \"2\"\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/version.js\n ** module id = 10\n ** module chunks = 0\n **/", + "var version = require(\"./version\")\n\nmodule.exports = isVirtualText\n\nfunction isVirtualText(x) {\n return x && x.type === \"VirtualText\" && x.version === version\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/is-vtext.js\n ** module id = 11\n ** module chunks = 0\n **/", + "module.exports = isWidget\n\nfunction isWidget(w) {\n return w && w.type === \"Widget\"\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/is-widget.js\n ** module id = 12\n ** module chunks = 0\n **/", + "var isVNode = require(\"./is-vnode\")\nvar isVText = require(\"./is-vtext\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\n\nmodule.exports = handleThunk\n\nfunction handleThunk(a, b) {\n var renderedA = a\n var renderedB = b\n\n if (isThunk(b)) {\n renderedB = renderThunk(b, a)\n }\n\n if (isThunk(a)) {\n renderedA = renderThunk(a, null)\n }\n\n return {\n a: renderedA,\n b: renderedB\n }\n}\n\nfunction renderThunk(thunk, previous) {\n var renderedThunk = thunk.vnode\n\n if (!renderedThunk) {\n renderedThunk = thunk.vnode = thunk.render(previous)\n }\n\n if (!(isVNode(renderedThunk) ||\n isVText(renderedThunk) ||\n isWidget(renderedThunk))) {\n throw new Error(\"thunk did not return a valid node\");\n }\n\n return renderedThunk\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/handle-thunk.js\n ** module id = 13\n ** module chunks = 0\n **/", + "module.exports = isThunk\r\n\r\nfunction isThunk(t) {\r\n return t && t.type === \"Thunk\"\r\n}\r\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/is-thunk.js\n ** module id = 14\n ** module chunks = 0\n **/", + "'use strict';\n\nvar d = require('d')\n , callable = require('es5-ext/object/valid-callable')\n\n , apply = Function.prototype.apply, call = Function.prototype.call\n , create = Object.create, defineProperty = Object.defineProperty\n , defineProperties = Object.defineProperties\n , hasOwnProperty = Object.prototype.hasOwnProperty\n , descriptor = { configurable: true, enumerable: false, writable: true }\n\n , on, once, off, emit, methods, descriptors, base;\n\non = function (type, listener) {\n\tvar data;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) {\n\t\tdata = descriptor.value = create(null);\n\t\tdefineProperty(this, '__ee__', descriptor);\n\t\tdescriptor.value = null;\n\t} else {\n\t\tdata = this.__ee__;\n\t}\n\tif (!data[type]) data[type] = listener;\n\telse if (typeof data[type] === 'object') data[type].push(listener);\n\telse data[type] = [data[type], listener];\n\n\treturn this;\n};\n\nonce = function (type, listener) {\n\tvar once, self;\n\n\tcallable(listener);\n\tself = this;\n\ton.call(this, type, once = function () {\n\t\toff.call(self, type, once);\n\t\tapply.call(listener, this, arguments);\n\t});\n\n\tonce.__eeOnceListener__ = listener;\n\treturn this;\n};\n\noff = function (type, listener) {\n\tvar data, listeners, candidate, i;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return this;\n\tdata = this.__ee__;\n\tif (!data[type]) return this;\n\tlisteners = data[type];\n\n\tif (typeof listeners === 'object') {\n\t\tfor (i = 0; (candidate = listeners[i]); ++i) {\n\t\t\tif ((candidate === listener) ||\n\t\t\t\t\t(candidate.__eeOnceListener__ === listener)) {\n\t\t\t\tif (listeners.length === 2) data[type] = listeners[i ? 0 : 1];\n\t\t\t\telse listeners.splice(i, 1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ((listeners === listener) ||\n\t\t\t\t(listeners.__eeOnceListener__ === listener)) {\n\t\t\tdelete data[type];\n\t\t}\n\t}\n\n\treturn this;\n};\n\nemit = function (type) {\n\tvar i, l, listener, listeners, args;\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return;\n\tlisteners = this.__ee__[type];\n\tif (!listeners) return;\n\n\tif (typeof listeners === 'object') {\n\t\tl = arguments.length;\n\t\targs = new Array(l - 1);\n\t\tfor (i = 1; i < l; ++i) args[i - 1] = arguments[i];\n\n\t\tlisteners = listeners.slice();\n\t\tfor (i = 0; (listener = listeners[i]); ++i) {\n\t\t\tapply.call(listener, this, args);\n\t\t}\n\t} else {\n\t\tswitch (arguments.length) {\n\t\tcase 1:\n\t\t\tcall.call(listeners, this);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcall.call(listeners, this, arguments[1]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcall.call(listeners, this, arguments[1], arguments[2]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tl = arguments.length;\n\t\t\targs = new Array(l - 1);\n\t\t\tfor (i = 1; i < l; ++i) {\n\t\t\t\targs[i - 1] = arguments[i];\n\t\t\t}\n\t\t\tapply.call(listeners, this, args);\n\t\t}\n\t}\n};\n\nmethods = {\n\ton: on,\n\tonce: once,\n\toff: off,\n\temit: emit\n};\n\ndescriptors = {\n\ton: d(on),\n\tonce: d(once),\n\toff: d(off),\n\temit: d(emit)\n};\n\nbase = defineProperties({}, descriptors);\n\nmodule.exports = exports = function (o) {\n\treturn (o == null) ? create(base) : defineProperties(Object(o), descriptors);\n};\nexports.methods = methods;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/event-emitter/index.js\n ** module id = 15\n ** module chunks = 0\n **/", + "'use strict';\n\nvar assign = require('es5-ext/object/assign')\n , normalizeOpts = require('es5-ext/object/normalize-options')\n , isCallable = require('es5-ext/object/is-callable')\n , contains = require('es5-ext/string/#/contains')\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/d/index.js\n ** module id = 16\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.assign\n\t: require('./shim');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/assign/index.js\n ** module id = 17\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== 'function') return false;\n\tobj = { foo: 'raz' };\n\tassign(obj, { bar: 'dwa' }, { trzy: 'trzy' });\n\treturn (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/assign/is-implemented.js\n ** module id = 18\n ** module chunks = 0\n **/", + "'use strict';\n\nvar keys = require('../keys')\n , value = require('../valid-value')\n\n , max = Math.max;\n\nmodule.exports = function (dest, src/*, …srcn*/) {\n\tvar error, i, l = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry { dest[key] = src[key]; } catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < l; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/assign/shim.js\n ** module id = 19\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.keys\n\t: require('./shim');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/keys/index.js\n ** module id = 20\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys('primitive');\n\t\treturn true;\n\t} catch (e) { return false; }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/keys/is-implemented.js\n ** module id = 21\n ** module chunks = 0\n **/", + "'use strict';\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) {\n\treturn keys(object == null ? object : Object(object));\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/keys/shim.js\n ** module id = 22\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = function (value) {\n\tif (value == null) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/valid-value.js\n ** module id = 23\n ** module chunks = 0\n **/", + "'use strict';\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\nmodule.exports = function (options/*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (options == null) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/normalize-options.js\n ** module id = 24\n ** module chunks = 0\n **/", + "// Deprecated\n\n'use strict';\n\nmodule.exports = function (obj) { return typeof obj === 'function'; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/is-callable.js\n ** module id = 25\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? String.prototype.contains\n\t: require('./shim');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/string/#/contains/index.js\n ** module id = 26\n ** module chunks = 0\n **/", + "'use strict';\n\nvar str = 'razdwatrzy';\n\nmodule.exports = function () {\n\tif (typeof str.contains !== 'function') return false;\n\treturn ((str.contains('dwa') === true) && (str.contains('foo') === false));\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/string/#/contains/is-implemented.js\n ** module id = 27\n ** module chunks = 0\n **/", + "'use strict';\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/string/#/contains/shim.js\n ** module id = 28\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = function (fn) {\n\tif (typeof fn !== 'function') throw new TypeError(fn + \" is not a function\");\n\treturn fn;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/es5-ext/object/valid-callable.js\n ** module id = 29\n ** module chunks = 0\n **/", + "import _defaults from 'lodash.defaults';\r\n\r\nimport h from 'virtual-dom/h';\r\nimport diff from 'virtual-dom/diff';\r\nimport patch from 'virtual-dom/patch';\r\n\r\nimport InlineWorker from 'inline-worker';\r\n\r\nimport { pixelsToSeconds } from './utils/conversions';\r\n\r\nimport LoaderFactory from './track/loader/LoaderFactory';\r\n\r\nimport ScrollHook from './render/ScrollHook';\r\n\r\nimport TimeScale from './TimeScale';\r\nimport Track from './Track';\r\nimport Playout from './Playout';\r\n\r\nimport RecorderWorkerFunction from './utils/recorderWorker';\r\nimport ExportWavWorkerFunction from './utils/exportWavWorker';\r\n\r\nexport default class {\r\n constructor() {\r\n this.tracks = [];\r\n this.soloedTracks = [];\r\n this.mutedTracks = [];\r\n this.playoutPromises = [];\r\n\r\n this.cursor = 0;\r\n this.playbackSeconds = 0;\r\n this.duration = 0;\r\n this.scrollLeft = 0;\r\n this.showTimescale = false;\r\n\r\n this.fadeType = 'logarithmic';\r\n this.masterGain = 1;\r\n }\r\n\r\n // TODO extract into a plugin\r\n initExporter() {\r\n this.exportWorker = new InlineWorker(ExportWavWorkerFunction);\r\n }\r\n\r\n // TODO extract into a plugin\r\n initRecorder(stream) {\r\n this.mediaRecorder = new window.MediaRecorder(stream);\r\n\r\n this.mediaRecorder.onstart = () => {\r\n const track = new Track();\r\n track.setName('Recording');\r\n track.setEnabledStates();\r\n track.setEventEmitter(this.ee);\r\n\r\n this.recordingTrack = track;\r\n this.tracks.push(track);\r\n\r\n this.chunks = [];\r\n };\r\n\r\n this.mediaRecorder.ondataavailable = (e) => {\r\n this.chunks.push(e.data);\r\n\r\n const recording = new Blob(this.chunks, { type: 'audio/ogg; codecs=opus' });\r\n const loader = LoaderFactory.createLoader(recording, this.ac);\r\n loader.load().then((audioBuffer) => {\r\n // ask web worker for peaks.\r\n this.recorderWorker.postMessage({\r\n samples: audioBuffer.getChannelData(0),\r\n samplesPerPixel: this.samplesPerPixel,\r\n });\r\n this.recordingTrack.setCues(0, audioBuffer.duration);\r\n this.recordingTrack.setBuffer(audioBuffer);\r\n this.recordingTrack.setPlayout(new Playout(this.ac, audioBuffer));\r\n this.adjustDuration();\r\n });\r\n };\r\n\r\n this.recorderWorker = new InlineWorker(RecorderWorkerFunction);\r\n // use a worker for calculating recording peaks.\r\n this.recorderWorker.onmessage = (e) => {\r\n this.recordingTrack.setPeaks(e.data);\r\n this.draw(this.render());\r\n };\r\n\r\n this.recorderWorker.onerror = (e) => {\r\n throw e;\r\n };\r\n }\r\n\r\n setShowTimeScale(show) {\r\n this.showTimescale = show;\r\n }\r\n\r\n setMono(mono) {\r\n this.mono = mono;\r\n }\r\n\r\n setExclSolo(exclSolo) {\r\n this.exclSolo = exclSolo;\r\n }\r\n\r\n setSeekStyle(style) {\r\n this.seekStyle = style;\r\n }\r\n\r\n getSeekStyle() {\r\n return this.seekStyle;\r\n }\r\n\r\n setSampleRate(sampleRate) {\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n setSamplesPerPixel(samplesPerPixel) {\r\n this.samplesPerPixel = samplesPerPixel;\r\n }\r\n\r\n setAudioContext(ac) {\r\n this.ac = ac;\r\n }\r\n\r\n setControlOptions(controlOptions) {\r\n this.controls = controlOptions;\r\n }\r\n\r\n setWaveHeight(height) {\r\n this.waveHeight = height;\r\n }\r\n\r\n setColors(colors) {\r\n this.colors = colors;\r\n }\r\n\r\n setEventEmitter(ee) {\r\n this.ee = ee;\r\n }\r\n\r\n getEventEmitter() {\r\n return this.ee;\r\n }\r\n\r\n setUpEventEmitter() {\r\n const ee = this.ee;\r\n\r\n ee.on('speedchange', (speed) => {\r\n this.setSpeed(speed);\r\n });\r\n\r\n ee.on('loopnumber', (number) => {\r\n this.setLoop(number);\r\n });\r\n\r\n ee.on('select', (start, end, track) => {\r\n if (this.isPlaying()) {\r\n this.lastSeeked = start;\r\n this.pausedAt = undefined;\r\n this.restartPlayFrom(start);\r\n }\r\n else {\r\n //reset if it was paused.\r\n this.seek(start, end, track);\r\n this.ee.emit('timeupdate', start);\r\n this.draw(this.render());\r\n }\r\n });\r\n\r\n ee.on('startaudiorendering', (type) => {\r\n this.startOfflineRender(type);\r\n });\r\n\r\n ee.on('statechange', (state) => {\r\n this.setState(state);\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('shift', (deltaTime, track) => {\r\n track.setStartTime(track.getStartTime() + deltaTime);\r\n this.adjustDuration();\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('record', () => {\r\n this.record();\r\n });\r\n\r\n ee.on('play', (start, end) => {\r\n this.play(start, end);\r\n });\r\n\r\n ee.on('pause', () => {\r\n this.pause();\r\n });\r\n\r\n ee.on('stop', () => {\r\n this.stop();\r\n });\r\n\r\n ee.on('rewind', () => {\r\n this.rewind();\r\n });\r\n\r\n ee.on('fastforward', () => {\r\n this.fastForward();\r\n });\r\n\r\n ee.on('clear', () => {\r\n this.clear().then(() => {\r\n this.draw(this.render());\r\n });\r\n });\r\n\r\n ee.on('solo', (track) => {\r\n this.soloTrack(track);\r\n this.adjustTrackPlayout();\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('mute', (track) => {\r\n this.muteTrack(track);\r\n this.adjustTrackPlayout();\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('volumechange', (volume, track) => {\r\n track.setGainLevel(volume / 100);\r\n });\r\n\r\n ee.on('mastervolumechange', (volume) => {\r\n this.masterGain = volume / 100;\r\n this.tracks.forEach((track) => {\r\n track.setMasterGainLevel(this.masterGain);\r\n });\r\n });\r\n\r\n ee.on('fadein', (duration, track) => {\r\n track.setFadeIn(duration, this.fadeType);\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('fadeout', (duration, track) => {\r\n track.setFadeOut(duration, this.fadeType);\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('fadetype', (type) => {\r\n this.fadeType = type;\r\n });\r\n\r\n ee.on('newtrack', (file) => {\r\n this.load([{\r\n src: file,\r\n name: file.name,\r\n }]);\r\n });\r\n\r\n ee.on('trim', () => {\r\n const track = this.getActiveTrack();\r\n const timeSelection = this.getTimeSelection();\r\n\r\n track.trim(timeSelection.start, timeSelection.end);\r\n track.calculatePeaks(this.samplesPerPixel, this.sampleRate);\r\n\r\n this.setTimeSelection(0, 0);\r\n this.draw(this.render());\r\n });\r\n\r\n ee.on('zoomin', () => {\r\n const zoomIndex = Math.max(0, this.zoomIndex - 1);\r\n const zoom = this.zoomLevels[zoomIndex];\r\n\r\n if (zoom !== this.samplesPerPixel) {\r\n this.setZoom(zoom);\r\n this.draw(this.render());\r\n }\r\n });\r\n\r\n ee.on('zoomout', () => {\r\n const zoomIndex = Math.min(this.zoomLevels.length - 1, this.zoomIndex + 1);\r\n const zoom = this.zoomLevels[zoomIndex];\r\n\r\n if (zoom !== this.samplesPerPixel) {\r\n this.setZoom(zoom);\r\n this.draw(this.render());\r\n }\r\n });\r\n\r\n ee.on('scroll', () => {\r\n this.draw(this.render());\r\n });\r\n }\r\n\r\n load(trackList) {\r\n const loadPromises = trackList.map((trackInfo) => {\r\n const loader = LoaderFactory.createLoader(trackInfo.src, this.ac, this.ee);\r\n return loader.load();\r\n });\r\n\r\n return Promise.all(loadPromises).then((audioBuffers) => {\r\n this.ee.emit('audiosourcesloaded');\r\n\r\n const tracks = audioBuffers.map((audioBuffer, index) => {\r\n const info = trackList[index];\r\n const name = info.name || 'Untitled';\r\n const start = info.start || 0;\r\n const states = info.states || {};\r\n const fadeIn = info.fadeIn;\r\n const fadeOut = info.fadeOut;\r\n const cueIn = info.cuein || 0;\r\n const cueOut = info.cueout || audioBuffer.duration;\r\n const gain = info.gain || 1;\r\n const muted = info.muted || false;\r\n const soloed = info.soloed || false;\r\n const selection = info.selected;\r\n const peaks = info.peaks || { type: 'WebAudio', mono: this.mono };\r\n const customClass = info.customClass || undefined;\r\n const waveOutlineColor = info.waveOutlineColor || undefined;\r\n\r\n // webaudio specific playout for now.\r\n const playout = new Playout(this.ac, audioBuffer);\r\n\r\n const track = new Track();\r\n track.src = info.src;\r\n track.setBuffer(audioBuffer);\r\n track.setName(name);\r\n track.setEventEmitter(this.ee);\r\n track.setEnabledStates(states);\r\n track.setCues(cueIn, cueOut);\r\n track.setCustomClass(customClass);\r\n track.setWaveOutlineColor(waveOutlineColor);\r\n\r\n if (fadeIn !== undefined) {\r\n track.setFadeIn(fadeIn.duration, fadeIn.shape);\r\n }\r\n\r\n if (fadeOut !== undefined) {\r\n track.setFadeOut(fadeOut.duration, fadeOut.shape);\r\n }\r\n\r\n if (selection !== undefined) {\r\n this.setActiveTrack(track);\r\n this.setTimeSelection(selection.start, selection.end);\r\n }\r\n\r\n if (peaks !== undefined) {\r\n track.setPeakData(peaks);\r\n }\r\n\r\n track.setState(this.getState());\r\n track.setStartTime(start);\r\n track.setPlayout(playout);\r\n track.setSpeed(1);\r\n\r\n track.setGainLevel(gain);\r\n\r\n if (muted) {\r\n this.muteTrack(track);\r\n }\r\n\r\n if (soloed) {\r\n this.soloTrack(track);\r\n }\r\n\r\n // extract peaks with AudioContext for now.\r\n track.calculatePeaks(this.samplesPerPixel, this.sampleRate);\r\n\r\n return track;\r\n });\r\n\r\n this.tracks = this.tracks.concat(tracks);\r\n this.adjustDuration();\r\n this.draw(this.render());\r\n\r\n this.ee.emit('audiosourcesrendered');\r\n });\r\n }\r\n\r\n /*\r\n track instance of Track.\r\n */\r\n setActiveTrack(track) {\r\n this.activeTrack = track;\r\n }\r\n\r\n getActiveTrack() {\r\n return this.activeTrack;\r\n }\r\n\r\n isSegmentSelection() {\r\n return this.timeSelection.start !== this.timeSelection.end;\r\n }\r\n\r\n /*\r\n start, end in seconds.\r\n */\r\n setTimeSelection(start=0, end) {\r\n this.timeSelection = {\r\n start,\r\n end: (end === undefined) ? start : end,\r\n };\r\n\r\n this.cursor = start;\r\n }\r\n\r\n startOfflineRender(type) {\r\n if (this.isRendering) {\r\n return;\r\n }\r\n\r\n this.isRendering = true;\r\n this.offlineAudioContext = new OfflineAudioContext(2, 44100 * this.duration, 44100);\r\n\r\n const currentTime = this.offlineAudioContext.currentTime;\r\n\r\n this.tracks.forEach((track) => {\r\n track.setOfflinePlayout(new Playout(this.offlineAudioContext, track.buffer));\r\n track.schedulePlay(currentTime, 0, 0, {\r\n shouldPlay: this.shouldTrackPlay(track),\r\n masterGain: 1,\r\n isOffline: true,\r\n });\r\n });\r\n\r\n /*\r\n TODO cleanup of different audio playouts handling.\r\n */\r\n this.offlineAudioContext.startRendering().then((audioBuffer) => {\r\n if (type === 'buffer') {\r\n this.ee.emit('audiorenderingfinished', type, audioBuffer);\r\n this.isRendering = false;\r\n return;\r\n }\r\n\r\n if (type === 'wav') {\r\n this.exportWorker.postMessage({\r\n command: 'init',\r\n config: {\r\n sampleRate: 44100,\r\n },\r\n });\r\n\r\n // callback for `exportWAV`\r\n this.exportWorker.onmessage = (e) => {\r\n this.ee.emit('audiorenderingfinished', type, e.data);\r\n this.isRendering = false;\r\n\r\n // clear out the buffer for next renderings.\r\n this.exportWorker.postMessage({\r\n command: 'clear',\r\n });\r\n };\r\n\r\n // send the channel data from our buffer to the worker\r\n this.exportWorker.postMessage({\r\n command: 'record',\r\n buffer: [\r\n audioBuffer.getChannelData(0),\r\n audioBuffer.getChannelData(1),\r\n ],\r\n });\r\n\r\n // ask the worker for a WAV\r\n this.exportWorker.postMessage({\r\n command: 'exportWAV',\r\n type: 'audio/wav',\r\n });\r\n }\r\n }).catch((e) => {\r\n throw e;\r\n });\r\n }\r\n\r\n getTimeSelection() {\r\n return this.timeSelection;\r\n }\r\n\r\n setState(state) {\r\n this.state = state;\r\n\r\n this.tracks.forEach((track) => {\r\n track.setState(state);\r\n });\r\n }\r\n\r\n getState() {\r\n return this.state;\r\n }\r\n\r\n setZoomIndex(index) {\r\n this.zoomIndex = index;\r\n }\r\n\r\n setZoomLevels(levels) {\r\n this.zoomLevels = levels;\r\n }\r\n\r\n setZoom(zoom) {\r\n this.samplesPerPixel = zoom;\r\n this.zoomIndex = this.zoomLevels.indexOf(zoom);\r\n this.tracks.forEach((track) => {\r\n track.calculatePeaks(zoom, this.sampleRate);\r\n });\r\n }\r\n\r\n setLoop(number) {\r\n this.loopNumber = number\r\n }\r\n\r\n\r\n setSpeed(speed) {\r\n this.speed = (speed >= 0.5 && speed <= 4) ? speed : 1;\r\n if (this.isPlaying())\r\n this.restartPlayFrom(this.playbackSeconds);\r\n this.ee.emit('speedchanged', this.speed);\r\n }\r\n\r\n muteTrack(track) {\r\n const index = this.mutedTracks.indexOf(track);\r\n\r\n if (index > -1) {\r\n this.mutedTracks.splice(index, 1);\r\n } else {\r\n this.mutedTracks.push(track);\r\n }\r\n }\r\n\r\n soloTrack(track) {\r\n const index = this.soloedTracks.indexOf(track);\r\n\r\n if (index > -1) {\r\n this.soloedTracks.splice(index, 1);\r\n } else if (this.exclSolo) {\r\n this.soloedTracks = [track];\r\n } else {\r\n this.soloedTracks.push(track);\r\n }\r\n }\r\n\r\n adjustTrackPlayout() {\r\n this.tracks.forEach((track) => {\r\n track.setShouldPlay(this.shouldTrackPlay(track));\r\n });\r\n }\r\n\r\n adjustDuration() {\r\n this.duration = this.tracks.reduce(\r\n (duration, track) => Math.max(duration, track.getEndTime()),\r\n 0,\r\n );\r\n }\r\n\r\n shouldTrackPlay(track) {\r\n let shouldPlay;\r\n // if there are solo tracks, only they should play.\r\n if (this.soloedTracks.length > 0) {\r\n shouldPlay = false;\r\n if (this.soloedTracks.indexOf(track) > -1) {\r\n shouldPlay = true;\r\n }\r\n } else {\r\n // play all tracks except any muted tracks.\r\n shouldPlay = true;\r\n if (this.mutedTracks.indexOf(track) > -1) {\r\n shouldPlay = false;\r\n }\r\n }\r\n\r\n return shouldPlay;\r\n }\r\n\r\n isPlaying() {\r\n return this.tracks.reduce(\r\n (isPlaying, track) => isPlaying || track.isPlaying(),\r\n false,\r\n );\r\n }\r\n\r\n /*\r\n * returns the current point of time in the playlist in seconds.\r\n */\r\n getCurrentTime() {\r\n const cursorPos = this.lastSeeked || this.pausedAt || this.cursor;\r\n\r\n return cursorPos + this.getElapsedTime();\r\n }\r\n\r\n getElapsedTime() {\r\n return this.ac.currentTime - this.lastPlay;\r\n }\r\n\r\n setMasterGain(gain) {\r\n this.ee.emit('mastervolumechange', gain);\r\n }\r\n\r\n restartPlayFrom(start, end) {\r\n this.stopAnimation();\r\n\r\n this.tracks.forEach((editor) => {\r\n editor.scheduleStop();\r\n });\r\n\r\n return Promise.all(this.playoutPromises).then(this.play.bind(this, start, end));\r\n }\r\n\r\n play(startTime, endTime) {\r\n const currentTime = this.ac.currentTime;\r\n const selected = this.getTimeSelection();\r\n const playoutPromises = [];\r\n\r\n const start = startTime || this.pausedAt || this.cursor;\r\n let end = endTime;\r\n\r\n if (!end && selected.end !== selected.start && selected.end > start) {\r\n end = selected.end;\r\n }\r\n\r\n if (this.isPlaying()) {\r\n return this.restartPlayFrom(start, end);\r\n }\r\n\r\n this.tracks.forEach((track) => {\r\n track.setSpeed(this.speed);track.setState('cursor');\r\n playoutPromises.push(track.schedulePlay(currentTime, start, end, {\r\n shouldPlay: this.shouldTrackPlay(track),\r\n masterGain : this.masterGain,\r\n }));\r\n });\r\n\r\n this.lastPlay = currentTime;\r\n // use these to track when the playlist has fully stopped.\r\n this.playoutPromises = playoutPromises;\r\n this.startAnimation(start);\r\n\r\n return Promise.all(this.playoutPromises);\r\n }\r\n\r\n pause() {\r\n if (!this.isPlaying()) {\r\n return Promise.all(this.playoutPromises);\r\n }\r\n\r\n this.pausedAt = this.getCurrentTime();\r\n return this.playbackReset();\r\n }\r\n\r\n stop() {\r\n if (this.mediaRecorder && this.mediaRecorder.state === 'recording') {\r\n this.mediaRecorder.stop();\r\n }\r\n\r\n this.pausedAt = undefined;\r\n this.playbackSeconds = 0;\r\n return this.playbackReset();\r\n }\r\n\r\n playbackReset() {\r\n this.lastSeeked = undefined;\r\n this.stopAnimation();\r\n\r\n this.tracks.forEach((track) => {\r\n track.scheduleStop();\r\n track.setState(this.getState());\r\n });\r\n\r\n this.draw(this.render());\r\n return Promise.all(this.playoutPromises);\r\n }\r\n\r\n rewind() {\r\n return this.stop().then(() => {\r\n this.scrollLeft = 0;\r\n this.ee.emit('select', 0, 0);\r\n });\r\n }\r\n\r\n fastForward() {\r\n return this.stop().then(() => {\r\n if (this.viewDuration < this.duration) {\r\n this.scrollLeft = this.duration - this.viewDuration;\r\n } else {\r\n this.scrollLeft = 0;\r\n }\r\n\r\n this.ee.emit('select', this.duration, this.duration);\r\n });\r\n }\r\n\r\n clear() {\r\n return this.stop().then(() => {\r\n this.tracks = [];\r\n this.soloedTracks = [];\r\n this.mutedTracks = [];\r\n this.playoutPromises = [];\r\n\r\n this.cursor = 0;\r\n this.playbackSeconds = 0;\r\n this.duration = 0;\r\n this.scrollLeft = 0;\r\n\r\n this.seek(0, 0, undefined);\r\n });\r\n }\r\n\r\n record() {\r\n const playoutPromises = [];\r\n this.mediaRecorder.start(300);\r\n\r\n this.tracks.forEach((track) => {\r\n track.setState('none');\r\n playoutPromises.push(track.schedulePlay(this.ac.currentTime, 0, undefined, {\r\n shouldPlay: this.shouldTrackPlay(track),\r\n }));\r\n });\r\n\r\n this.playoutPromises = playoutPromises;\r\n }\r\n\r\n startAnimation(startTime) {\r\n this.lastDraw = this.ac.currentTime;\r\n this.animationRequest = window.requestAnimationFrame(this.updateEditor.bind(this, startTime));\r\n }\r\n\r\n stopAnimation() {\r\n window.cancelAnimationFrame(this.animationRequest);\r\n this.lastDraw = undefined;\r\n }\r\n\r\n seek(start, end, track) {\r\n if (this.isPlaying()) {\r\n this.lastSeeked = start;\r\n this.pausedAt = undefined;\r\n this.restartPlayFrom(start);\r\n } else {\r\n // reset if it was paused.\r\n this.setActiveTrack(track || this.tracks[0]);\r\n this.pausedAt = start;\r\n this.setTimeSelection(start, end);\r\n if (this.getSeekStyle() === 'fill') {\r\n this.playbackSeconds = start;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * Animation function for the playlist.\r\n */\r\n updateEditor(cursor) {\r\n const currentTime = this.ac.currentTime;\r\n let playbackSeconds = 0;\r\n const selection = this.getTimeSelection();\r\n\r\n const cursorPos = cursor || this.cursor;\r\n const elapsed = currentTime - this.lastDraw;\r\n\r\n if (this.isPlaying()) {\r\n //console.log(\"speed \" + this.speed);\r\n playbackSeconds = cursorPos + elapsed* this.speed;\r\n this.ee.emit('timeupdate', playbackSeconds);\r\n this.animationRequest = window.requestAnimationFrame(\r\n this.updateEditor.bind(this, playbackSeconds),\r\n );\r\n }\r\n else {\r\n if ((cursorPos + elapsed) >=\r\n (this.isSegmentSelection()) ? selection.end : this.duration) {if (this.loopNumber > 0) {\r\n this.loopNumber--;\r\n this.ee.emit('newloop', this.loopNumber);\r\n this.restartPlayFrom(selection.start, selection.end)\r\n }\r\n else if (this.loopNumber == -1) {\r\n this.ee.emit('newloop', this.loopNumber);\r\n this.restartPlayFrom(selection.start, selection.end)\r\n\r\n }\r\n else\r\n this.ee.emit('finished');\r\n }\r\n\r\n this.stopAnimation();\r\n this.pausedAt = undefined;\r\n this.lastSeeked = undefined;\r\n this.setState(this.getState());\r\n }\r\n\r\n this.playbackSeconds = playbackSeconds;\r\n\r\n this.draw(this.render());\r\n this.lastDraw = currentTime;\r\n }\r\n\r\n draw(newTree) {\r\n window.requestAnimationFrame(() => {\r\n const patches = diff(this.tree, newTree);\r\n this.rootNode = patch(this.rootNode, patches);\r\n this.tree = newTree;\r\n\r\n //use for fast forwarding.\r\n this.viewDuration = pixelsToSeconds(\r\n this.rootNode.clientWidth - this.controls.width,\r\n this.samplesPerPixel,\r\n this.sampleRate,\r\n );\r\n });\r\n }\r\n\r\n getTrackRenderData(data = {}) {\r\n const defaults = {\r\n height: this.waveHeight,\r\n resolution: this.samplesPerPixel,\r\n sampleRate: this.sampleRate,\r\n controls: this.controls,\r\n isActive: false,\r\n timeSelection: this.getTimeSelection(),\r\n playlistLength: this.duration,\r\n playbackSeconds: this.playbackSeconds,\r\n colors: this.colors,\r\n };\r\n\r\n return _defaults(data, defaults);\r\n }\r\n\r\n isActiveTrack(track) {\r\n const activeTrack = this.getActiveTrack();\r\n if ( this.isSegmentSelection() ) {\r\n return activeTrack === track;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n render() {\r\n const controlWidth = this.controls.show ? this.controls.width : 0;\r\n const timeScale = new TimeScale(this.duration, this.scrollLeft,\r\n this.samplesPerPixel, this.sampleRate, controlWidth);\r\n\r\n const trackElements = this.tracks.map(track =>\r\n track.render(this.getTrackRenderData({\r\n isActive: this.isActiveTrack(track),\r\n shouldPlay: this.shouldTrackPlay(track),\r\n soloed: this.soloedTracks.indexOf(track) > -1,\r\n muted: this.mutedTracks.indexOf(track) > -1,\r\n })),\r\n );\r\n\r\n const trackSection = h('div.playlist-tracks',\r\n {\r\n attributes: {\r\n style: 'overflow: auto;',\r\n },\r\n onscroll: (e) => {\r\n this.scrollLeft = pixelsToSeconds(\r\n e.target.scrollLeft,\r\n this.samplesPerPixel,\r\n this.sampleRate,\r\n );\r\n this.ee.emit('scroll', this.scrollLeft);\r\n },\r\n hook: new ScrollHook(this, this.samplesPerPixel, this.sampleRate),\r\n },\r\n trackElements,\r\n );\r\n\r\n const containerChildren = [];\r\n\r\n if (this.showTimescale) {\r\n containerChildren.push(timeScale.render());\r\n }\r\n\r\n containerChildren.push(trackSection);\r\n\r\n return h('div.playlist',\r\n {\r\n attributes: {\r\n style: 'overflow: hidden; position: relative;',\r\n },\r\n },\r\n containerChildren,\r\n );\r\n }\r\n\r\n getInfo() {\r\n const info = [];\r\n\r\n this.tracks.forEach((track) => {\r\n info.push(track.getTrackDetails());\r\n });\r\n\r\n return info;\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/Playlist.js\n **/", + "/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction assignInDefaults(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(args) {\n args.push(undefined, assignInDefaults);\n return apply(assignInWith, undefined, args);\n});\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = defaults;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.defaults/index.js\n ** module id = 31\n ** module chunks = 0\n **/", + "var h = require(\"./virtual-hyperscript/index.js\")\n\nmodule.exports = h\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/h.js\n ** module id = 32\n ** module chunks = 0\n **/", + "'use strict';\n\nvar isArray = require('x-is-array');\n\nvar VNode = require('../vnode/vnode.js');\nvar VText = require('../vnode/vtext.js');\nvar isVNode = require('../vnode/is-vnode');\nvar isVText = require('../vnode/is-vtext');\nvar isWidget = require('../vnode/is-widget');\nvar isHook = require('../vnode/is-vhook');\nvar isVThunk = require('../vnode/is-thunk');\n\nvar parseTag = require('./parse-tag.js');\nvar softSetHook = require('./hooks/soft-set-hook.js');\nvar evHook = require('./hooks/ev-hook.js');\n\nmodule.exports = h;\n\nfunction h(tagName, properties, children) {\n var childNodes = [];\n var tag, props, key, namespace;\n\n if (!children && isChildren(properties)) {\n children = properties;\n props = {};\n }\n\n props = props || properties || {};\n tag = parseTag(tagName, props);\n\n // support keys\n if (props.hasOwnProperty('key')) {\n key = props.key;\n props.key = undefined;\n }\n\n // support namespace\n if (props.hasOwnProperty('namespace')) {\n namespace = props.namespace;\n props.namespace = undefined;\n }\n\n // fix cursor bug\n if (tag === 'INPUT' &&\n !namespace &&\n props.hasOwnProperty('value') &&\n props.value !== undefined &&\n !isHook(props.value)\n ) {\n props.value = softSetHook(props.value);\n }\n\n transformProperties(props);\n\n if (children !== undefined && children !== null) {\n addChild(children, childNodes, tag, props);\n }\n\n\n return new VNode(tag, props, childNodes, key, namespace);\n}\n\nfunction addChild(c, childNodes, tag, props) {\n if (typeof c === 'string') {\n childNodes.push(new VText(c));\n } else if (typeof c === 'number') {\n childNodes.push(new VText(String(c)));\n } else if (isChild(c)) {\n childNodes.push(c);\n } else if (isArray(c)) {\n for (var i = 0; i < c.length; i++) {\n addChild(c[i], childNodes, tag, props);\n }\n } else if (c === null || c === undefined) {\n return;\n } else {\n throw UnexpectedVirtualElement({\n foreignObject: c,\n parentVnode: {\n tagName: tag,\n properties: props\n }\n });\n }\n}\n\nfunction transformProperties(props) {\n for (var propName in props) {\n if (props.hasOwnProperty(propName)) {\n var value = props[propName];\n\n if (isHook(value)) {\n continue;\n }\n\n if (propName.substr(0, 3) === 'ev-') {\n // add ev-foo support\n props[propName] = evHook(value);\n }\n }\n }\n}\n\nfunction isChild(x) {\n return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);\n}\n\nfunction isChildren(x) {\n return typeof x === 'string' || isArray(x) || isChild(x);\n}\n\nfunction UnexpectedVirtualElement(data) {\n var err = new Error();\n\n err.type = 'virtual-hyperscript.unexpected.virtual-element';\n err.message = 'Unexpected virtual child passed to h().\\n' +\n 'Expected a VNode / Vthunk / VWidget / string but:\\n' +\n 'got:\\n' +\n errorString(data.foreignObject) +\n '.\\n' +\n 'The parent vnode is:\\n' +\n errorString(data.parentVnode)\n '\\n' +\n 'Suggested fix: change your `h(..., [ ... ])` callsite.';\n err.foreignObject = data.foreignObject;\n err.parentVnode = data.parentVnode;\n\n return err;\n}\n\nfunction errorString(obj) {\n try {\n return JSON.stringify(obj, null, ' ');\n } catch (e) {\n return String(obj);\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/virtual-hyperscript/index.js\n ** module id = 33\n ** module chunks = 0\n **/", + "var nativeIsArray = Array.isArray\nvar toString = Object.prototype.toString\n\nmodule.exports = nativeIsArray || isArray\n\nfunction isArray(obj) {\n return toString.call(obj) === \"[object Array]\"\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/x-is-array/index.js\n ** module id = 34\n ** module chunks = 0\n **/", + "var version = require(\"./version\")\nvar isVNode = require(\"./is-vnode\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\nvar isVHook = require(\"./is-vhook\")\n\nmodule.exports = VirtualNode\n\nvar noProperties = {}\nvar noChildren = []\n\nfunction VirtualNode(tagName, properties, children, key, namespace) {\n this.tagName = tagName\n this.properties = properties || noProperties\n this.children = children || noChildren\n this.key = key != null ? String(key) : undefined\n this.namespace = (typeof namespace === \"string\") ? namespace : null\n\n var count = (children && children.length) || 0\n var descendants = 0\n var hasWidgets = false\n var hasThunks = false\n var descendantHooks = false\n var hooks\n\n for (var propName in properties) {\n if (properties.hasOwnProperty(propName)) {\n var property = properties[propName]\n if (isVHook(property) && property.unhook) {\n if (!hooks) {\n hooks = {}\n }\n\n hooks[propName] = property\n }\n }\n }\n\n for (var i = 0; i < count; i++) {\n var child = children[i]\n if (isVNode(child)) {\n descendants += child.count || 0\n\n if (!hasWidgets && child.hasWidgets) {\n hasWidgets = true\n }\n\n if (!hasThunks && child.hasThunks) {\n hasThunks = true\n }\n\n if (!descendantHooks && (child.hooks || child.descendantHooks)) {\n descendantHooks = true\n }\n } else if (!hasWidgets && isWidget(child)) {\n if (typeof child.destroy === \"function\") {\n hasWidgets = true\n }\n } else if (!hasThunks && isThunk(child)) {\n hasThunks = true;\n }\n }\n\n this.count = count + descendants\n this.hasWidgets = hasWidgets\n this.hasThunks = hasThunks\n this.hooks = hooks\n this.descendantHooks = descendantHooks\n}\n\nVirtualNode.prototype.version = version\nVirtualNode.prototype.type = \"VirtualNode\"\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/vnode.js\n ** module id = 35\n ** module chunks = 0\n **/", + "var version = require(\"./version\")\n\nmodule.exports = VirtualText\n\nfunction VirtualText(text) {\n this.text = String(text)\n}\n\nVirtualText.prototype.version = version\nVirtualText.prototype.type = \"VirtualText\"\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/vtext.js\n ** module id = 36\n ** module chunks = 0\n **/", + "'use strict';\n\nvar split = require('browser-split');\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = parseTag;\n\nfunction parseTag(tag, props) {\n if (!tag) {\n return 'DIV';\n }\n\n var noId = !(props.hasOwnProperty('id'));\n\n var tagParts = split(tag, classIdSplit);\n var tagName = null;\n\n if (notClassId.test(tagParts[1])) {\n tagName = 'DIV';\n }\n\n var classes, part, type, i;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes = classes || [];\n classes.push(part.substring(1, part.length));\n } else if (type === '#' && noId) {\n props.id = part.substring(1, part.length);\n }\n }\n\n if (classes) {\n if (props.className) {\n classes.push(props.className);\n }\n\n props.className = classes.join(' ');\n }\n\n return props.namespace ? tagName : tagName.toUpperCase();\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/virtual-hyperscript/parse-tag.js\n ** module id = 37\n ** module chunks = 0\n **/", + "/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan \n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n var nativeSplit = String.prototype.split,\n compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n // NPCG: nonparticipating capturing group\n self;\n\n self = function(str, separator, limit) {\n // If `separator` is not a regex, use `nativeSplit`\n if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n return nativeSplit.call(str, separator, limit);\n }\n var output = [],\n flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n (separator.sticky ? \"y\" : \"\"),\n // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator = new RegExp(separator.source, flags + \"g\"),\n separator2, match, lastIndex, lastLength;\n str += \"\"; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n * If other: Type-convert, then use the above rules\n */\n limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n limit >>> 0; // ToUint32(limit)\n while (match = separator.exec(str)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function() {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undef) {\n match[i] = undef;\n }\n }\n });\n }\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === str.length) {\n if (lastLength || !separator.test(\"\")) {\n output.push(\"\");\n }\n } else {\n output.push(str.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n\n return self;\n})();\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/browser-split/index.js\n ** module id = 38\n ** module chunks = 0\n **/", + "'use strict';\n\nmodule.exports = SoftSetHook;\n\nfunction SoftSetHook(value) {\n if (!(this instanceof SoftSetHook)) {\n return new SoftSetHook(value);\n }\n\n this.value = value;\n}\n\nSoftSetHook.prototype.hook = function (node, propertyName) {\n if (node[propertyName] !== this.value) {\n node[propertyName] = this.value;\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js\n ** module id = 39\n ** module chunks = 0\n **/", + "'use strict';\n\nvar EvStore = require('ev-store');\n\nmodule.exports = EvHook;\n\nfunction EvHook(value) {\n if (!(this instanceof EvHook)) {\n return new EvHook(value);\n }\n\n this.value = value;\n}\n\nEvHook.prototype.hook = function (node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = this.value;\n};\n\nEvHook.prototype.unhook = function(node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = undefined;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/virtual-hyperscript/hooks/ev-hook.js\n ** module id = 40\n ** module chunks = 0\n **/", + "'use strict';\n\nvar OneVersionConstraint = require('individual/one-version');\n\nvar MY_VERSION = '7';\nOneVersionConstraint('ev-store', MY_VERSION);\n\nvar hashKey = '__EV_STORE_KEY@' + MY_VERSION;\n\nmodule.exports = EvStore;\n\nfunction EvStore(elem) {\n var hash = elem[hashKey];\n\n if (!hash) {\n hash = elem[hashKey] = {};\n }\n\n return hash;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ev-store/index.js\n ** module id = 41\n ** module chunks = 0\n **/", + "'use strict';\n\nvar Individual = require('./index.js');\n\nmodule.exports = OneVersion;\n\nfunction OneVersion(moduleName, version, defaultValue) {\n var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;\n var enforceKey = key + '_ENFORCE_SINGLETON';\n\n var versionValue = Individual(enforceKey, version);\n\n if (versionValue !== version) {\n throw new Error('Can only have one copy of ' +\n moduleName + '.\\n' +\n 'You already have version ' + versionValue +\n ' installed.\\n' +\n 'This means you cannot install version ' + version);\n }\n\n return Individual(key, defaultValue);\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/individual/one-version.js\n ** module id = 42\n ** module chunks = 0\n **/", + "'use strict';\n\n/*global window, global*/\n\nvar root = typeof window !== 'undefined' ?\n window : typeof global !== 'undefined' ?\n global : {};\n\nmodule.exports = Individual;\n\nfunction Individual(key, value) {\n if (key in root) {\n return root[key];\n }\n\n root[key] = value;\n\n return value;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/individual/index.js\n ** module id = 43\n ** module chunks = 0\n **/", + "var diff = require(\"./vtree/diff.js\")\n\nmodule.exports = diff\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/diff.js\n ** module id = 44\n ** module chunks = 0\n **/", + "var isArray = require(\"x-is-array\")\n\nvar VPatch = require(\"../vnode/vpatch\")\nvar isVNode = require(\"../vnode/is-vnode\")\nvar isVText = require(\"../vnode/is-vtext\")\nvar isWidget = require(\"../vnode/is-widget\")\nvar isThunk = require(\"../vnode/is-thunk\")\nvar handleThunk = require(\"../vnode/handle-thunk\")\n\nvar diffProps = require(\"./diff-props\")\n\nmodule.exports = diff\n\nfunction diff(a, b) {\n var patch = { a: a }\n walk(a, b, patch, 0)\n return patch\n}\n\nfunction walk(a, b, patch, index) {\n if (a === b) {\n return\n }\n\n var apply = patch[index]\n var applyClear = false\n\n if (isThunk(a) || isThunk(b)) {\n thunks(a, b, patch, index)\n } else if (b == null) {\n\n // If a is a widget we will add a remove patch for it\n // Otherwise any child widgets/hooks must be destroyed.\n // This prevents adding two remove patches for a widget.\n if (!isWidget(a)) {\n clearState(a, patch, index)\n apply = patch[index]\n }\n\n apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))\n } else if (isVNode(b)) {\n if (isVNode(a)) {\n if (a.tagName === b.tagName &&\n a.namespace === b.namespace &&\n a.key === b.key) {\n var propsPatch = diffProps(a.properties, b.properties)\n if (propsPatch) {\n apply = appendPatch(apply,\n new VPatch(VPatch.PROPS, a, propsPatch))\n }\n apply = diffChildren(a, b, patch, apply, index)\n } else {\n apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))\n applyClear = true\n }\n } else {\n apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))\n applyClear = true\n }\n } else if (isVText(b)) {\n if (!isVText(a)) {\n apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))\n applyClear = true\n } else if (a.text !== b.text) {\n apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))\n }\n } else if (isWidget(b)) {\n if (!isWidget(a)) {\n applyClear = true\n }\n\n apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))\n }\n\n if (apply) {\n patch[index] = apply\n }\n\n if (applyClear) {\n clearState(a, patch, index)\n }\n}\n\nfunction diffChildren(a, b, patch, apply, index) {\n var aChildren = a.children\n var orderedSet = reorder(aChildren, b.children)\n var bChildren = orderedSet.children\n\n var aLen = aChildren.length\n var bLen = bChildren.length\n var len = aLen > bLen ? aLen : bLen\n\n for (var i = 0; i < len; i++) {\n var leftNode = aChildren[i]\n var rightNode = bChildren[i]\n index += 1\n\n if (!leftNode) {\n if (rightNode) {\n // Excess nodes in b need to be added\n apply = appendPatch(apply,\n new VPatch(VPatch.INSERT, null, rightNode))\n }\n } else {\n walk(leftNode, rightNode, patch, index)\n }\n\n if (isVNode(leftNode) && leftNode.count) {\n index += leftNode.count\n }\n }\n\n if (orderedSet.moves) {\n // Reorder nodes last\n apply = appendPatch(apply, new VPatch(\n VPatch.ORDER,\n a,\n orderedSet.moves\n ))\n }\n\n return apply\n}\n\nfunction clearState(vNode, patch, index) {\n // TODO: Make this a single walk, not two\n unhook(vNode, patch, index)\n destroyWidgets(vNode, patch, index)\n}\n\n// Patch records for all destroyed widgets must be added because we need\n// a DOM node reference for the destroy function\nfunction destroyWidgets(vNode, patch, index) {\n if (isWidget(vNode)) {\n if (typeof vNode.destroy === \"function\") {\n patch[index] = appendPatch(\n patch[index],\n new VPatch(VPatch.REMOVE, vNode, null)\n )\n }\n } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n destroyWidgets(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n } else if (isThunk(vNode)) {\n thunks(vNode, null, patch, index)\n }\n}\n\n// Create a sub-patch for thunks\nfunction thunks(a, b, patch, index) {\n var nodes = handleThunk(a, b)\n var thunkPatch = diff(nodes.a, nodes.b)\n if (hasPatches(thunkPatch)) {\n patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)\n }\n}\n\nfunction hasPatches(patch) {\n for (var index in patch) {\n if (index !== \"a\") {\n return true\n }\n }\n\n return false\n}\n\n// Execute hooks when two nodes are identical\nfunction unhook(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = appendPatch(\n patch[index],\n new VPatch(\n VPatch.PROPS,\n vNode,\n undefinedKeys(vNode.hooks)\n )\n )\n }\n\n if (vNode.descendantHooks || vNode.hasThunks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n unhook(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n } else if (isThunk(vNode)) {\n thunks(vNode, null, patch, index)\n }\n}\n\nfunction undefinedKeys(obj) {\n var result = {}\n\n for (var key in obj) {\n result[key] = undefined\n }\n\n return result\n}\n\n// List diff, naive left to right reordering\nfunction reorder(aChildren, bChildren) {\n // O(M) time, O(M) memory\n var bChildIndex = keyIndex(bChildren)\n var bKeys = bChildIndex.keys\n var bFree = bChildIndex.free\n\n if (bFree.length === bChildren.length) {\n return {\n children: bChildren,\n moves: null\n }\n }\n\n // O(N) time, O(N) memory\n var aChildIndex = keyIndex(aChildren)\n var aKeys = aChildIndex.keys\n var aFree = aChildIndex.free\n\n if (aFree.length === aChildren.length) {\n return {\n children: bChildren,\n moves: null\n }\n }\n\n // O(MAX(N, M)) memory\n var newChildren = []\n\n var freeIndex = 0\n var freeCount = bFree.length\n var deletedItems = 0\n\n // Iterate through a and match a node in b\n // O(N) time,\n for (var i = 0 ; i < aChildren.length; i++) {\n var aItem = aChildren[i]\n var itemIndex\n\n if (aItem.key) {\n if (bKeys.hasOwnProperty(aItem.key)) {\n // Match up the old keys\n itemIndex = bKeys[aItem.key]\n newChildren.push(bChildren[itemIndex])\n\n } else {\n // Remove old keyed items\n itemIndex = i - deletedItems++\n newChildren.push(null)\n }\n } else {\n // Match the item in a with the next free item in b\n if (freeIndex < freeCount) {\n itemIndex = bFree[freeIndex++]\n newChildren.push(bChildren[itemIndex])\n } else {\n // There are no free items in b to match with\n // the free items in a, so the extra free nodes\n // are deleted.\n itemIndex = i - deletedItems++\n newChildren.push(null)\n }\n }\n }\n\n var lastFreeIndex = freeIndex >= bFree.length ?\n bChildren.length :\n bFree[freeIndex]\n\n // Iterate through b and append any new keys\n // O(M) time\n for (var j = 0; j < bChildren.length; j++) {\n var newItem = bChildren[j]\n\n if (newItem.key) {\n if (!aKeys.hasOwnProperty(newItem.key)) {\n // Add any new keyed items\n // We are adding new items to the end and then sorting them\n // in place. In future we should insert new items in place.\n newChildren.push(newItem)\n }\n } else if (j >= lastFreeIndex) {\n // Add any leftover non-keyed items\n newChildren.push(newItem)\n }\n }\n\n var simulate = newChildren.slice()\n var simulateIndex = 0\n var removes = []\n var inserts = []\n var simulateItem\n\n for (var k = 0; k < bChildren.length;) {\n var wantedItem = bChildren[k]\n simulateItem = simulate[simulateIndex]\n\n // remove items\n while (simulateItem === null && simulate.length) {\n removes.push(remove(simulate, simulateIndex, null))\n simulateItem = simulate[simulateIndex]\n }\n\n if (!simulateItem || simulateItem.key !== wantedItem.key) {\n // if we need a key in this position...\n if (wantedItem.key) {\n if (simulateItem && simulateItem.key) {\n // if an insert doesn't put this key in place, it needs to move\n if (bKeys[simulateItem.key] !== k + 1) {\n removes.push(remove(simulate, simulateIndex, simulateItem.key))\n simulateItem = simulate[simulateIndex]\n // if the remove didn't put the wanted item in place, we need to insert it\n if (!simulateItem || simulateItem.key !== wantedItem.key) {\n inserts.push({key: wantedItem.key, to: k})\n }\n // items are matching, so skip ahead\n else {\n simulateIndex++\n }\n }\n else {\n inserts.push({key: wantedItem.key, to: k})\n }\n }\n else {\n inserts.push({key: wantedItem.key, to: k})\n }\n k++\n }\n // a key in simulate has no matching wanted key, remove it\n else if (simulateItem && simulateItem.key) {\n removes.push(remove(simulate, simulateIndex, simulateItem.key))\n }\n }\n else {\n simulateIndex++\n k++\n }\n }\n\n // remove all the remaining nodes from simulate\n while(simulateIndex < simulate.length) {\n simulateItem = simulate[simulateIndex]\n removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))\n }\n\n // If the only moves we have are deletes then we can just\n // let the delete patch remove these items.\n if (removes.length === deletedItems && !inserts.length) {\n return {\n children: newChildren,\n moves: null\n }\n }\n\n return {\n children: newChildren,\n moves: {\n removes: removes,\n inserts: inserts\n }\n }\n}\n\nfunction remove(arr, index, key) {\n arr.splice(index, 1)\n\n return {\n from: index,\n key: key\n }\n}\n\nfunction keyIndex(children) {\n var keys = {}\n var free = []\n var length = children.length\n\n for (var i = 0; i < length; i++) {\n var child = children[i]\n\n if (child.key) {\n keys[child.key] = i\n } else {\n free.push(i)\n }\n }\n\n return {\n keys: keys, // A hash of key name to index\n free: free // An array of unkeyed item indices\n }\n}\n\nfunction appendPatch(apply, patch) {\n if (apply) {\n if (isArray(apply)) {\n apply.push(patch)\n } else {\n apply = [apply, patch]\n }\n\n return apply\n } else {\n return patch\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vtree/diff.js\n ** module id = 45\n ** module chunks = 0\n **/", + "var version = require(\"./version\")\n\nVirtualPatch.NONE = 0\nVirtualPatch.VTEXT = 1\nVirtualPatch.VNODE = 2\nVirtualPatch.WIDGET = 3\nVirtualPatch.PROPS = 4\nVirtualPatch.ORDER = 5\nVirtualPatch.INSERT = 6\nVirtualPatch.REMOVE = 7\nVirtualPatch.THUNK = 8\n\nmodule.exports = VirtualPatch\n\nfunction VirtualPatch(type, vNode, patch) {\n this.type = Number(type)\n this.vNode = vNode\n this.patch = patch\n}\n\nVirtualPatch.prototype.version = version\nVirtualPatch.prototype.type = \"VirtualPatch\"\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vnode/vpatch.js\n ** module id = 46\n ** module chunks = 0\n **/", + "var isObject = require(\"is-object\")\nvar isHook = require(\"../vnode/is-vhook\")\n\nmodule.exports = diffProps\n\nfunction diffProps(a, b) {\n var diff\n\n for (var aKey in a) {\n if (!(aKey in b)) {\n diff = diff || {}\n diff[aKey] = undefined\n }\n\n var aValue = a[aKey]\n var bValue = b[aKey]\n\n if (aValue === bValue) {\n continue\n } else if (isObject(aValue) && isObject(bValue)) {\n if (getPrototype(bValue) !== getPrototype(aValue)) {\n diff = diff || {}\n diff[aKey] = bValue\n } else if (isHook(bValue)) {\n diff = diff || {}\n diff[aKey] = bValue\n } else {\n var objectDiff = diffProps(aValue, bValue)\n if (objectDiff) {\n diff = diff || {}\n diff[aKey] = objectDiff\n }\n }\n } else {\n diff = diff || {}\n diff[aKey] = bValue\n }\n }\n\n for (var bKey in b) {\n if (!(bKey in a)) {\n diff = diff || {}\n diff[bKey] = b[bKey]\n }\n }\n\n return diff\n}\n\nfunction getPrototype(value) {\n if (Object.getPrototypeOf) {\n return Object.getPrototypeOf(value)\n } else if (value.__proto__) {\n return value.__proto__\n } else if (value.constructor) {\n return value.constructor.prototype\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vtree/diff-props.js\n ** module id = 47\n ** module chunks = 0\n **/", + "var patch = require(\"./vdom/patch.js\")\n\nmodule.exports = patch\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/patch.js\n ** module id = 48\n ** module chunks = 0\n **/", + "var document = require(\"global/document\")\nvar isArray = require(\"x-is-array\")\n\nvar render = require(\"./create-element\")\nvar domIndex = require(\"./dom-index\")\nvar patchOp = require(\"./patch-op\")\nmodule.exports = patch\n\nfunction patch(rootNode, patches, renderOptions) {\n renderOptions = renderOptions || {}\n renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch\n ? renderOptions.patch\n : patchRecursive\n renderOptions.render = renderOptions.render || render\n\n return renderOptions.patch(rootNode, patches, renderOptions)\n}\n\nfunction patchRecursive(rootNode, patches, renderOptions) {\n var indices = patchIndices(patches)\n\n if (indices.length === 0) {\n return rootNode\n }\n\n var index = domIndex(rootNode, patches.a, indices)\n var ownerDocument = rootNode.ownerDocument\n\n if (!renderOptions.document && ownerDocument !== document) {\n renderOptions.document = ownerDocument\n }\n\n for (var i = 0; i < indices.length; i++) {\n var nodeIndex = indices[i]\n rootNode = applyPatch(rootNode,\n index[nodeIndex],\n patches[nodeIndex],\n renderOptions)\n }\n\n return rootNode\n}\n\nfunction applyPatch(rootNode, domNode, patchList, renderOptions) {\n if (!domNode) {\n return rootNode\n }\n\n var newNode\n\n if (isArray(patchList)) {\n for (var i = 0; i < patchList.length; i++) {\n newNode = patchOp(patchList[i], domNode, renderOptions)\n\n if (domNode === rootNode) {\n rootNode = newNode\n }\n }\n } else {\n newNode = patchOp(patchList, domNode, renderOptions)\n\n if (domNode === rootNode) {\n rootNode = newNode\n }\n }\n\n return rootNode\n}\n\nfunction patchIndices(patches) {\n var indices = []\n\n for (var key in patches) {\n if (key !== \"a\") {\n indices.push(Number(key))\n }\n }\n\n return indices\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vdom/patch.js\n ** module id = 49\n ** module chunks = 0\n **/", + "// Maps a virtual DOM tree onto a real DOM tree in an efficient manner.\n// We don't want to read all of the DOM nodes in the tree so we use\n// the in-order tree indexing to eliminate recursion down certain branches.\n// We only recurse into a DOM node if we know that it contains a child of\n// interest.\n\nvar noChild = {}\n\nmodule.exports = domIndex\n\nfunction domIndex(rootNode, tree, indices, nodes) {\n if (!indices || indices.length === 0) {\n return {}\n } else {\n indices.sort(ascending)\n return recurse(rootNode, tree, indices, nodes, 0)\n }\n}\n\nfunction recurse(rootNode, tree, indices, nodes, rootIndex) {\n nodes = nodes || {}\n\n\n if (rootNode) {\n if (indexInRange(indices, rootIndex, rootIndex)) {\n nodes[rootIndex] = rootNode\n }\n\n var vChildren = tree.children\n\n if (vChildren) {\n\n var childNodes = rootNode.childNodes\n\n for (var i = 0; i < tree.children.length; i++) {\n rootIndex += 1\n\n var vChild = vChildren[i] || noChild\n var nextIndex = rootIndex + (vChild.count || 0)\n\n // skip recursion down the tree if there are no nodes down here\n if (indexInRange(indices, rootIndex, nextIndex)) {\n recurse(childNodes[i], vChild, indices, nodes, rootIndex)\n }\n\n rootIndex = nextIndex\n }\n }\n }\n\n return nodes\n}\n\n// Binary search for an index in the interval [left, right]\nfunction indexInRange(indices, left, right) {\n if (indices.length === 0) {\n return false\n }\n\n var minIndex = 0\n var maxIndex = indices.length - 1\n var currentIndex\n var currentItem\n\n while (minIndex <= maxIndex) {\n currentIndex = ((maxIndex + minIndex) / 2) >> 0\n currentItem = indices[currentIndex]\n\n if (minIndex === maxIndex) {\n return currentItem >= left && currentItem <= right\n } else if (currentItem < left) {\n minIndex = currentIndex + 1\n } else if (currentItem > right) {\n maxIndex = currentIndex - 1\n } else {\n return true\n }\n }\n\n return false;\n}\n\nfunction ascending(a, b) {\n return a > b ? 1 : -1\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vdom/dom-index.js\n ** module id = 50\n ** module chunks = 0\n **/", + "var applyProperties = require(\"./apply-properties\")\n\nvar isWidget = require(\"../vnode/is-widget.js\")\nvar VPatch = require(\"../vnode/vpatch.js\")\n\nvar updateWidget = require(\"./update-widget\")\n\nmodule.exports = applyPatch\n\nfunction applyPatch(vpatch, domNode, renderOptions) {\n var type = vpatch.type\n var vNode = vpatch.vNode\n var patch = vpatch.patch\n\n switch (type) {\n case VPatch.REMOVE:\n return removeNode(domNode, vNode)\n case VPatch.INSERT:\n return insertNode(domNode, patch, renderOptions)\n case VPatch.VTEXT:\n return stringPatch(domNode, vNode, patch, renderOptions)\n case VPatch.WIDGET:\n return widgetPatch(domNode, vNode, patch, renderOptions)\n case VPatch.VNODE:\n return vNodePatch(domNode, vNode, patch, renderOptions)\n case VPatch.ORDER:\n reorderChildren(domNode, patch)\n return domNode\n case VPatch.PROPS:\n applyProperties(domNode, patch, vNode.properties)\n return domNode\n case VPatch.THUNK:\n return replaceRoot(domNode,\n renderOptions.patch(domNode, patch, renderOptions))\n default:\n return domNode\n }\n}\n\nfunction removeNode(domNode, vNode) {\n var parentNode = domNode.parentNode\n\n if (parentNode) {\n parentNode.removeChild(domNode)\n }\n\n destroyWidget(domNode, vNode);\n\n return null\n}\n\nfunction insertNode(parentNode, vNode, renderOptions) {\n var newNode = renderOptions.render(vNode, renderOptions)\n\n if (parentNode) {\n parentNode.appendChild(newNode)\n }\n\n return parentNode\n}\n\nfunction stringPatch(domNode, leftVNode, vText, renderOptions) {\n var newNode\n\n if (domNode.nodeType === 3) {\n domNode.replaceData(0, domNode.length, vText.text)\n newNode = domNode\n } else {\n var parentNode = domNode.parentNode\n newNode = renderOptions.render(vText, renderOptions)\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n }\n\n return newNode\n}\n\nfunction widgetPatch(domNode, leftVNode, widget, renderOptions) {\n var updating = updateWidget(leftVNode, widget)\n var newNode\n\n if (updating) {\n newNode = widget.update(leftVNode, domNode) || domNode\n } else {\n newNode = renderOptions.render(widget, renderOptions)\n }\n\n var parentNode = domNode.parentNode\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n\n if (!updating) {\n destroyWidget(domNode, leftVNode)\n }\n\n return newNode\n}\n\nfunction vNodePatch(domNode, leftVNode, vNode, renderOptions) {\n var parentNode = domNode.parentNode\n var newNode = renderOptions.render(vNode, renderOptions)\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n\n return newNode\n}\n\nfunction destroyWidget(domNode, w) {\n if (typeof w.destroy === \"function\" && isWidget(w)) {\n w.destroy(domNode)\n }\n}\n\nfunction reorderChildren(domNode, moves) {\n var childNodes = domNode.childNodes\n var keyMap = {}\n var node\n var remove\n var insert\n\n for (var i = 0; i < moves.removes.length; i++) {\n remove = moves.removes[i]\n node = childNodes[remove.from]\n if (remove.key) {\n keyMap[remove.key] = node\n }\n domNode.removeChild(node)\n }\n\n var length = childNodes.length\n for (var j = 0; j < moves.inserts.length; j++) {\n insert = moves.inserts[j]\n node = keyMap[insert.key]\n // this is the weirdest bug i've ever seen in webkit\n domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])\n }\n}\n\nfunction replaceRoot(oldRoot, newRoot) {\n if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {\n oldRoot.parentNode.replaceChild(newRoot, oldRoot)\n }\n\n return newRoot;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vdom/patch-op.js\n ** module id = 51\n ** module chunks = 0\n **/", + "var isWidget = require(\"../vnode/is-widget.js\")\n\nmodule.exports = updateWidget\n\nfunction updateWidget(a, b) {\n if (isWidget(a) && isWidget(b)) {\n if (\"name\" in a && \"name\" in b) {\n return a.id === b.id\n } else {\n return a.init === b.init\n }\n }\n\n return false\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/virtual-dom/vdom/update-widget.js\n ** module id = 52\n ** module chunks = 0\n **/", + "var WORKER_ENABLED = !!(global === global.window && global.URL && global.Blob && global.Worker);\n\nfunction InlineWorker(func, self) {\n var _this = this;\n var functionBody;\n\n self = self || {};\n\n if (WORKER_ENABLED) {\n functionBody = func.toString().trim().match(\n /^function\\s*\\w*\\s*\\([\\w\\s,]*\\)\\s*{([\\w\\W]*?)}$/\n )[1];\n\n return new global.Worker(global.URL.createObjectURL(\n new global.Blob([ functionBody ], { type: \"text/javascript\" })\n ));\n }\n\n function postMessage(data) {\n setTimeout(function() {\n _this.onmessage({ data: data });\n }, 0);\n }\n\n this.self = self;\n this.self.postMessage = postMessage;\n\n setTimeout(func.bind(self, self), 0);\n}\n\nInlineWorker.prototype.postMessage = function postMessage(data) {\n var _this = this;\n\n setTimeout(function() {\n _this.self.onmessage({ data: data });\n }, 0);\n};\n\nmodule.exports = InlineWorker;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/inline-worker/index.js\n ** module id = 53\n ** module chunks = 0\n **/", + "export function samplesToSeconds(samples, sampleRate) {\r\n return samples / sampleRate;\r\n}\r\n\r\nexport function secondsToSamples(seconds, sampleRate) {\r\n return Math.ceil(seconds * sampleRate);\r\n}\r\n\r\nexport function samplesToPixels(samples, resolution) {\r\n return Math.floor(samples / resolution);\r\n}\r\n\r\nexport function pixelsToSamples(pixels, resolution) {\r\n return Math.floor(pixels * resolution);\r\n}\r\n\r\nexport function pixelsToSeconds(pixels, resolution, sampleRate) {\r\n return (pixels * resolution) / sampleRate;\r\n}\r\n\r\nexport function secondsToPixels(seconds, resolution, sampleRate) {\r\n return Math.ceil((seconds * sampleRate) / resolution);\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/conversions.js\n **/", + "import BlobLoader from './BlobLoader';\r\nimport XHRLoader from './XHRLoader';\r\n\r\nexport default class {\r\n static createLoader(src, audioContext, ee) {\r\n if (src instanceof Blob) {\r\n return new BlobLoader(src, audioContext, ee);\r\n } else if (typeof (src) === 'string') {\r\n return new XHRLoader(src, audioContext, ee);\r\n }\r\n\r\n throw new Error('Unsupported src type');\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/loader/LoaderFactory.js\n **/", + "import Loader from './Loader';\r\n\r\nexport default class extends Loader {\r\n\r\n /*\r\n * Loads an audio file via a FileReader\r\n */\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n if (this.src.type.match(/audio.*/) ||\r\n // added for problems with Firefox mime types + ogg.\r\n this.src.type.match(/video\\/ogg/)) {\r\n const fr = new FileReader();\r\n\r\n fr.readAsArrayBuffer(this.src);\r\n\r\n fr.addEventListener('progress', (e) => {\r\n super.fileProgress(e);\r\n });\r\n\r\n fr.addEventListener('load', (e) => {\r\n const decoderPromise = super.fileLoad(e);\r\n\r\n decoderPromise.then((audioBuffer) => {\r\n resolve(audioBuffer);\r\n });\r\n });\r\n\r\n fr.addEventListener('error', (err) => {\r\n reject(err);\r\n });\r\n } else {\r\n reject(Error(`Unsupported file type ${this.src.type}`));\r\n }\r\n });\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/loader/BlobLoader.js\n **/", + "import EventEmitter from 'event-emitter';\r\n\r\nexport const STATE_UNINITIALIZED = 0;\r\nexport const STATE_LOADING = 1;\r\nexport const STATE_DECODING = 2;\r\nexport const STATE_FINISHED = 3;\r\n\r\n\r\nexport default class {\r\n constructor(src, audioContext, ee = EventEmitter()) {\r\n this.src = src;\r\n this.ac = audioContext;\r\n this.audioRequestState = STATE_UNINITIALIZED;\r\n this.ee = ee;\r\n }\r\n\r\n setStateChange(state) {\r\n this.audioRequestState = state;\r\n this.ee.emit('audiorequeststatechange', this.audioRequestState, this.src);\r\n }\r\n\r\n fileProgress(e) {\r\n let percentComplete = 0;\r\n\r\n if (this.audioRequestState === STATE_UNINITIALIZED) {\r\n this.setStateChange(STATE_LOADING);\r\n }\r\n\r\n if (e.lengthComputable) {\r\n percentComplete = (e.loaded / e.total) * 100;\r\n }\r\n\r\n this.ee.emit('loadprogress', percentComplete, this.src);\r\n }\r\n\r\n fileLoad(e) {\r\n const audioData = e.target.response || e.target.result;\r\n\r\n this.setStateChange(STATE_DECODING);\r\n\r\n return new Promise((resolve, reject) => {\r\n this.ac.decodeAudioData(\r\n audioData,\r\n (audioBuffer) => {\r\n this.audioBuffer = audioBuffer;\r\n this.setStateChange(STATE_FINISHED);\r\n\r\n resolve(audioBuffer);\r\n },\r\n (err) => {\r\n reject(err);\r\n },\r\n );\r\n });\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/loader/Loader.js\n **/", + "import Loader from './Loader';\r\n\r\nexport default class extends Loader {\r\n\r\n /**\r\n * Loads an audio file via XHR.\r\n */\r\n load() {\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n\r\n xhr.open('GET', this.src, true);\r\n xhr.responseType = 'arraybuffer';\r\n xhr.send();\r\n\r\n xhr.addEventListener('progress', (e) => {\r\n super.fileProgress(e);\r\n });\r\n\r\n xhr.addEventListener('load', (e) => {\r\n const decoderPromise = super.fileLoad(e);\r\n\r\n decoderPromise.then((audioBuffer) => {\r\n resolve(audioBuffer);\r\n });\r\n });\r\n\r\n xhr.addEventListener('error', () => {\r\n reject(Error(`Track ${this.src} failed to load`));\r\n });\r\n });\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/loader/XHRLoader.js\n **/", + "import { secondsToPixels } from '../utils/conversions';\r\n\r\n/*\r\n* virtual-dom hook for scrolling the track container.\r\n*/\r\nexport default class {\r\n constructor(track, resolution, sampleRate) {\r\n this.track = track;\r\n this.resolution = resolution;\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n hook(node) {\r\n const trackArea = node;\r\n trackArea.scrollLeft = secondsToPixels(this.track.scrollLeft, this.resolution, this.sampleRate);\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/ScrollHook.js\n **/", + "import h from 'virtual-dom/h';\r\n\r\nimport { secondsToPixels } from './utils/conversions';\r\nimport TimeScaleHook from './render/TimeScaleHook';\r\n\r\nclass TimeScale {\r\n constructor(duration, offset, samplesPerPixel, sampleRate, marginLeft = 0) {\r\n this.duration = duration;\r\n this.offset = offset;\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.sampleRate = sampleRate;\r\n this.marginLeft = marginLeft;\r\n\r\n this.timeinfo = {\r\n 20000: {\r\n marker: 30000,\r\n bigStep: 10000,\r\n smallStep: 5000,\r\n secondStep: 5,\r\n },\r\n 12000: {\r\n marker: 15000,\r\n bigStep: 5000,\r\n smallStep: 1000,\r\n secondStep: 1,\r\n },\r\n 10000: {\r\n marker: 10000,\r\n bigStep: 5000,\r\n smallStep: 1000,\r\n secondStep: 1,\r\n },\r\n 5000: {\r\n marker: 5000,\r\n bigStep: 1000,\r\n smallStep: 500,\r\n secondStep: 1 / 2,\r\n },\r\n 2500: {\r\n marker: 2000,\r\n bigStep: 1000,\r\n smallStep: 500,\r\n secondStep: 1 / 2,\r\n },\r\n 1500: {\r\n marker: 2000,\r\n bigStep: 1000,\r\n smallStep: 200,\r\n secondStep: 1 / 5,\r\n },\r\n 700: {\r\n marker: 1000,\r\n bigStep: 500,\r\n smallStep: 100,\r\n secondStep: 1 / 10,\r\n },\r\n };\r\n }\r\n\r\n getScaleInfo(resolution) {\r\n let keys = Object.keys(this.timeinfo).map(item => parseInt(item, 10));\r\n\r\n // make sure keys are numerically sorted.\r\n keys = keys.sort((a, b) => a - b);\r\n\r\n for (let i = 0; i < keys.length; i += 1) {\r\n if (resolution <= keys[i]) {\r\n return this.timeinfo[keys[i]];\r\n }\r\n }\r\n\r\n return this.timeinfo[keys[0]];\r\n }\r\n\r\n /*\r\n Return time in format mm:ss\r\n */\r\n static formatTime(milliseconds) {\r\n const seconds = milliseconds / 1000;\r\n let s = seconds % 60;\r\n const m = (seconds - s) / 60;\r\n\r\n if (s < 10) {\r\n s = `0${s}`;\r\n }\r\n\r\n return `${m}:${s}`;\r\n }\r\n\r\n render() {\r\n const widthX = secondsToPixels(this.duration, this.samplesPerPixel, this.sampleRate);\r\n const pixPerSec = this.sampleRate / this.samplesPerPixel;\r\n const pixOffset = secondsToPixels(this.offset, this.samplesPerPixel, this.sampleRate);\r\n const scaleInfo = this.getScaleInfo(this.samplesPerPixel);\r\n const canvasInfo = {};\r\n const timeMarkers = [];\r\n const end = widthX + pixOffset;\r\n let counter = 0;\r\n\r\n for (let i = 0; i < end; i += (pixPerSec * scaleInfo.secondStep)) {\r\n const pixIndex = Math.floor(i);\r\n const pix = pixIndex - pixOffset;\r\n\r\n if (pixIndex >= pixOffset) {\r\n // put a timestamp every 30 seconds.\r\n if (scaleInfo.marker && (counter % scaleInfo.marker === 0)) {\r\n timeMarkers.push(h('div.time',\r\n {\r\n attributes: {\r\n style: `position: absolute; left: ${pix}px;`,\r\n },\r\n },\r\n [TimeScale.formatTime(counter)],\r\n ));\r\n\r\n canvasInfo[pix] = 10;\r\n } else if (scaleInfo.bigStep && (counter % scaleInfo.bigStep === 0)) {\r\n canvasInfo[pix] = 5;\r\n } else if (scaleInfo.smallStep && (counter % scaleInfo.smallStep === 0)) {\r\n canvasInfo[pix] = 2;\r\n }\r\n }\r\n\r\n counter += (1000 * scaleInfo.secondStep);\r\n }\r\n\r\n return h('div.playlist-time-scale',\r\n {\r\n attributes: {\r\n style: `position: relative; left: 0; right: 0; margin-left: ${this.marginLeft}px;`,\r\n },\r\n },\r\n [\r\n timeMarkers,\r\n h('canvas',\r\n {\r\n attributes: {\r\n width: widthX,\r\n height: 30,\r\n style: 'position: absolute; left: 0; right: 0; top: 0; bottom: 0;',\r\n },\r\n hook: new TimeScaleHook(canvasInfo, this.offset, this.samplesPerPixel, this.duration),\r\n },\r\n ),\r\n ],\r\n );\r\n }\r\n}\r\n\r\nexport default TimeScale;\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/TimeScale.js\n **/", + "/*\r\n* virtual-dom hook for rendering the time scale canvas.\r\n*/\r\nexport default class {\r\n constructor(tickInfo, offset, samplesPerPixel, duration) {\r\n this.tickInfo = tickInfo;\r\n this.offset = offset;\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.duration = duration;\r\n }\r\n\r\n hook(canvas, prop, prev) {\r\n // canvas is up to date\r\n if (prev !== undefined\r\n && (prev.offset === this.offset)\r\n && (prev.duration === this.duration)\r\n && (prev.samplesPerPixel === this.samplesPerPixel)) {\r\n return;\r\n }\r\n\r\n const width = canvas.width;\r\n const height = canvas.height;\r\n const ctx = canvas.getContext('2d');\r\n\r\n ctx.clearRect(0, 0, width, height);\r\n\r\n Object.keys(this.tickInfo).forEach((x) => {\r\n const scaleHeight = this.tickInfo[x];\r\n const scaleY = height - scaleHeight;\r\n ctx.fillRect(x, scaleY, 1, scaleHeight);\r\n });\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/TimeScaleHook.js\n **/", + "import _assign from 'lodash.assign';\r\nimport _forOwn from 'lodash.forown';\r\n\r\nimport uuid from 'uuid';\r\nimport h from 'virtual-dom/h';\r\n\r\nimport extractPeaks from 'webaudio-peaks';\r\nimport { FADEIN, FADEOUT } from 'fade-maker';\r\n\r\nimport { secondsToPixels, secondsToSamples } from './utils/conversions';\r\nimport stateClasses from './track/states';\r\n\r\nimport CanvasHook from './render/CanvasHook';\r\nimport FadeCanvasHook from './render/FadeCanvasHook';\r\nimport VolumeSliderHook from './render/VolumeSliderHook';\r\n\r\nconst MAX_CANVAS_WIDTH = 1000;\r\n\r\nexport default class {\r\n\r\n constructor() {\r\n\r\n this.name = 'Untitled';\r\n this.customClass = undefined;\r\n this.waveOutlineColor = undefined;\r\n this.gain = 1;\r\n this.speed = 1;this.fades = {};\r\n this.peakData = {\r\n type: 'WebAudio',\r\n mono: false,\r\n };\r\n\r\n this.cueIn = 0;\r\n this.cueOut = 0;\r\n this.duration = 0;\r\n this.startTime = 0;\r\n this.endTime = 0;\r\n }\r\n\r\n setEventEmitter(ee) {\r\n this.ee = ee;\r\n }\r\n\r\n setName(name) {\r\n this.name = name;\r\n }\r\n\r\n setCustomClass(className) {\r\n this.customClass = className;\r\n }\r\n\r\n setWaveOutlineColor(color) {\r\n this.waveOutlineColor = color;\r\n }\r\n\r\n setCues(cueIn, cueOut) {\r\n if (cueOut < cueIn) {\r\n throw new Error('cue out cannot be less than cue in');\r\n }\r\n\r\n this.cueIn = cueIn;\r\n this.cueOut = cueOut;\r\n this.duration = this.cueOut - this.cueIn;\r\n this.endTime = this.startTime + this.duration;\r\n }\r\n\r\n /*\r\n * start, end in seconds relative to the entire playlist.\r\n */\r\n trim(start, end) {\r\n const trackStart = this.getStartTime();\r\n const trackEnd = this.getEndTime();\r\n const offset = this.cueIn - trackStart;\r\n\r\n if ((trackStart <= start && trackEnd >= start) ||\r\n (trackStart <= end && trackEnd >= end)) {\r\n const cueIn = (start < trackStart) ? trackStart : start;\r\n const cueOut = (end > trackEnd) ? trackEnd : end;\r\n\r\n this.setCues(cueIn + offset, cueOut + offset);\r\n if (start > trackStart) {\r\n this.setStartTime(start);\r\n }\r\n }\r\n }\r\n\r\n setStartTime(start) {\r\n this.startTime = start;\r\n this.endTime = start + this.duration;\r\n }\r\n\r\n setPlayout(playout) {\r\n this.playout = playout;\r\n }\r\n\r\n setOfflinePlayout(playout) {\r\n this.offlinePlayout = playout;\r\n }\r\n\r\n setEnabledStates(enabledStates = {}) {\r\n const defaultStatesEnabled = {\r\n cursor: true,\r\n fadein: true,\r\n fadeout: true,\r\n select: true,\r\n shift: true,\r\n };\r\n\r\n this.enabledStates = _assign({}, defaultStatesEnabled, enabledStates);\r\n }\r\n\r\n setFadeIn(duration, shape = 'logarithmic') {\r\n if (duration > this.duration) {\r\n throw new Error('Invalid Fade In');\r\n }\r\n\r\n const fade = {\r\n shape,\r\n start: 0,\r\n end: duration,\r\n };\r\n\r\n if (this.fadeIn) {\r\n this.removeFade(this.fadeIn);\r\n this.fadeIn = undefined;\r\n }\r\n\r\n this.fadeIn = this.saveFade(FADEIN, fade.shape, fade.start, fade.end);\r\n }\r\n\r\n setFadeOut(duration, shape = 'logarithmic') {\r\n if (duration > this.duration) {\r\n throw new Error('Invalid Fade Out');\r\n }\r\n\r\n const fade = {\r\n shape,\r\n start: this.duration - duration,\r\n end: this.duration,\r\n };\r\n\r\n if (this.fadeOut) {\r\n this.removeFade(this.fadeOut);\r\n this.fadeOut = undefined;\r\n }\r\n\r\n this.fadeOut = this.saveFade(FADEOUT, fade.shape, fade.start, fade.end);\r\n }\r\n\r\n saveFade(type, shape, start, end) {\r\n const id = uuid.v4();\r\n\r\n this.fades[id] = {\r\n type,\r\n shape,\r\n start,\r\n end,\r\n };\r\n\r\n return id;\r\n }\r\n\r\n removeFade(id) {\r\n delete this.fades[id];\r\n }\r\n\r\n setBuffer(buffer) {\r\n this.buffer = buffer;\r\n }\r\n\r\n setPeakData(data) {\r\n this.peakData = data;\r\n }\r\n\r\n calculatePeaks(samplesPerPixel, sampleRate) {\r\n const cueIn = secondsToSamples(this.cueIn, sampleRate);\r\n const cueOut = secondsToSamples(this.cueOut, sampleRate);\r\n\r\n this.setPeaks(extractPeaks(this.buffer, samplesPerPixel, this.peakData.mono, cueIn, cueOut));\r\n }\r\n\r\n setPeaks(peaks) {\r\n this.peaks = peaks;\r\n }\r\n\r\n setState(state) {\r\n this.state = state;\r\n\r\n if (this.state && this.enabledStates[this.state]) {\r\n const StateClass = stateClasses[this.state];\r\n this.stateObj = new StateClass(this);\r\n } else {\r\n this.stateObj = undefined;\r\n }\r\n }\r\n\r\n getStartTime() {\r\n return this.startTime;\r\n }\r\n\r\n getEndTime() {\r\n return this.endTime;\r\n }\r\n\r\n getDuration() {\r\n return this.duration;\r\n }\r\n\r\n isPlaying() {\r\n return this.playout.isPlaying();\r\n }\r\n\r\n setShouldPlay(bool) {\r\n this.playout.setShouldPlay(bool);\r\n }\r\n\r\n setGainLevel(level) {\r\n this.gain = level;\r\n this.playout.setVolumeGainLevel(level);\r\n }\r\n\r\n setMasterGainLevel(level) {\r\n this.playout.setMasterGainLevel(level);\r\n }\r\n\r\n setSpeed(speed){\r\n this.speed = speed;\r\n }\r\n /*\r\n startTime, endTime in seconds (float).\r\n segment is for a highlighted section in the UI.\r\n\r\n returns a Promise that will resolve when the AudioBufferSource\r\n is either stopped or plays out naturally.\r\n */\r\n schedulePlay(now, startTime, endTime, config) {\r\n let start;\r\n let duration;\r\n let when = now;\r\n let segment = (endTime) ? (endTime - startTime) : undefined;\r\n\r\n const defaultOptions = {\r\n shouldPlay: true,\r\n masterGain: 1,\r\n isOffline: false,\r\n };\r\n\r\n const options = _assign({}, defaultOptions, config);\r\n const playoutSystem = options.isOffline ? this.offlinePlayout : this.playout;\r\n\r\n // 1) track has no content to play.\r\n // 2) track does not play in this selection.\r\n if ((this.endTime <= startTime) || (segment && (startTime + segment) < this.startTime)) {\r\n // return a resolved promise since this track is technically \"stopped\".\r\n return Promise.resolve();\r\n }\r\n\r\n // track should have something to play if it gets here.\r\n\r\n // the track starts in the future or on the cursor position\r\n if (this.startTime >= startTime) {\r\n start = 0;\r\n // schedule additional delay for this audio node.\r\n when += (this.startTime - startTime);\r\n\r\n if (endTime) {\r\n segment -= (this.startTime - startTime);\r\n duration = Math.min(segment, this.duration);\r\n } else {\r\n duration = this.duration;\r\n }\r\n } else {\r\n start = startTime - this.startTime;\r\n\r\n if (endTime) {\r\n duration = Math.min(segment, this.duration - start);\r\n } else {\r\n duration = this.duration - start;\r\n }\r\n }\r\n\r\n start += this.cueIn;\r\n const relPos = startTime - this.startTime;\r\n const sourcePromise = playoutSystem.setUpSource();\r\n\r\n // param relPos: cursor position in seconds relative to this track.\r\n // can be negative if the cursor is placed before the start of this track etc.\r\n _forOwn(this.fades, (fade) => {\r\n let fadeStart;\r\n let fadeDuration;\r\n\r\n // only apply fade if it's ahead of the cursor.\r\n if (relPos < fade.end) {\r\n if (relPos <= fade.start) {\r\n fadeStart = now + (fade.start - relPos)/this.speed;\r\n fadeDuration = (fade.end - fade.start)/this.speed;\r\n } else if (relPos > fade.start && relPos < fade.end) {\r\n fadeStart = now - (relPos - fade.start)/this.speed;\r\n fadeDuration = (fade.end - fade.start)/this.speed;\r\n }\r\n\r\n switch (fade.type) {\r\n case FADEIN: {\r\n playoutSystem.applyFadeIn(fadeStart, fadeDuration, fade.shape);\r\n break;\r\n }\r\n case FADEOUT: {\r\n playoutSystem.applyFadeOut(fadeStart, fadeDuration, fade.shape);\r\n break;\r\n }\r\n default: {\r\n throw new Error('Invalid fade type saved on track.');\r\n }\r\n }\r\n }\r\n });\r\n\r\n playoutSystem.setSpeed(this.speed);\r\n playoutSystem.setVolumeGainLevel(this.gain);\r\n playoutSystem.setShouldPlay(options.shouldPlay);\r\n playoutSystem.setMasterGainLevel(options.masterGain);\r\n playoutSystem.play(when, start, duration);\r\n\r\n return sourcePromise;\r\n }\r\n\r\n scheduleStop(when = 0) {\r\n this.playout.stop(when);\r\n }\r\n\r\n renderOverlay(data) {\r\n const channelPixels = secondsToPixels(data.playlistLength, data.resolution, data.sampleRate);\r\n\r\n const config = {\r\n attributes: {\r\n style: `position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: ${channelPixels}px; z-index: 9;`,\r\n },\r\n };\r\n\r\n let overlayClass = '';\r\n\r\n if (this.stateObj) {\r\n this.stateObj.setup(data.resolution, data.sampleRate);\r\n const StateClass = stateClasses[this.state];\r\n const events = StateClass.getEvents();\r\n\r\n events.forEach((event) => {\r\n config[`on${event}`] = this.stateObj[event].bind(this.stateObj);\r\n });\r\n\r\n overlayClass = StateClass.getClass();\r\n }\r\n // use this overlay for track event cursor position calculations.\r\n return h(`div.playlist-overlay${overlayClass}`, config);\r\n }\r\n\r\n renderControls(data) {\r\n const muteClass = data.muted ? '.active' : '';\r\n const soloClass = data.soloed ? '.active' : '';\r\n const numChan = this.peaks.data.length;\r\n\r\n return h('div.controls',\r\n {\r\n attributes: {\r\n style: `height: ${numChan * data.height}px; width: ${data.controls.width}px; position: absolute; left: 0; z-index: 10;`,\r\n },\r\n }, [\r\n h('header', [this.name]),\r\n h('div.btn-group', [\r\n h(`span.btn.btn-default.btn-xs.btn-mute${muteClass}`, {\r\n onclick: () => {\r\n this.ee.emit('mute', this);\r\n },\r\n }, ['Mute']),\r\n h(`span.btn.btn-default.btn-xs.btn-solo${soloClass}`, {\r\n onclick: () => {\r\n this.ee.emit('solo', this);\r\n },\r\n }, ['Solo']),\r\n ]),\r\n h('label', [\r\n h('input.volume-slider', {\r\n attributes: {\r\n type: 'range',\r\n min: 0,\r\n max: 100,\r\n value: 100,\r\n },\r\n hook: new VolumeSliderHook(this.gain),\r\n oninput: (e) => {\r\n this.ee.emit('volumechange', e.target.value, this);\r\n },\r\n }),\r\n ]),\r\n ],\r\n );\r\n }\r\n\r\n render(data) {\r\n const width = this.peaks.length;\r\n const playbackX = secondsToPixels(data.playbackSeconds, data.resolution, data.sampleRate);\r\n const startX = secondsToPixels(this.startTime, data.resolution, data.sampleRate);\r\n const endX = secondsToPixels(this.endTime, data.resolution, data.sampleRate);\r\n let progressWidth = 0;\r\n const numChan = this.peaks.data.length;\r\n\r\n if (playbackX > 0 && playbackX > startX) {\r\n if (playbackX < endX) {\r\n progressWidth = playbackX - startX;\r\n } else {\r\n progressWidth = width;\r\n }\r\n }\r\n\r\n const waveformChildren = [\r\n h('div.cursor', {\r\n attributes: {\r\n style: `position: absolute; width: 1px; margin: 0; padding: 0; top: 0; left: ${playbackX}px; bottom: 0; z-index: 5;`,\r\n },\r\n }),\r\n ];\r\n\r\n const channels = Object.keys(this.peaks.data).map((channelNum) => {\r\n const channelChildren = [\r\n h('div.channel-progress', {\r\n attributes: {\r\n style: `position: absolute; width: ${progressWidth}px; height: ${data.height}px; z-index: 2;`,\r\n },\r\n }),\r\n ];\r\n let offset = 0;\r\n let totalWidth = width;\r\n const peaks = this.peaks.data[channelNum];\r\n\r\n while (totalWidth > 0) {\r\n const currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH);\r\n const canvasColor = this.waveOutlineColor\r\n ? this.waveOutlineColor\r\n : data.colors.waveOutlineColor;\r\n\r\n channelChildren.push(h('canvas', {\r\n attributes: {\r\n width: currentWidth,\r\n height: data.height,\r\n style: 'float: left; position: relative; margin: 0; padding: 0; z-index: 3;',\r\n },\r\n hook: new CanvasHook(peaks, offset, this.peaks.bits, canvasColor),\r\n }));\r\n\r\n totalWidth -= currentWidth;\r\n offset += MAX_CANVAS_WIDTH;\r\n }\r\n\r\n // if there are fades, display them.\r\n if (this.fadeIn) {\r\n const fadeIn = this.fades[this.fadeIn];\r\n const fadeWidth = secondsToPixels(\r\n fadeIn.end - fadeIn.start,\r\n data.resolution,\r\n data.sampleRate,\r\n );\r\n\r\n channelChildren.push(h('div.wp-fade.wp-fadein',\r\n {\r\n attributes: {\r\n style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; left: 0; z-index: 4;`,\r\n },\r\n }, [\r\n h('canvas',\r\n {\r\n attributes: {\r\n width: fadeWidth,\r\n height: data.height,\r\n },\r\n hook: new FadeCanvasHook(\r\n fadeIn.type,\r\n fadeIn.shape,\r\n fadeIn.end - fadeIn.start,\r\n data.resolution,\r\n ),\r\n },\r\n ),\r\n ],\r\n ));\r\n }\r\n\r\n if (this.fadeOut) {\r\n const fadeOut = this.fades[this.fadeOut];\r\n const fadeWidth = secondsToPixels(\r\n fadeOut.end - fadeOut.start,\r\n data.resolution,\r\n data.sampleRate,\r\n );\r\n\r\n channelChildren.push(h('div.wp-fade.wp-fadeout',\r\n {\r\n attributes: {\r\n style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; right: 0; z-index: 4;`,\r\n },\r\n },\r\n [\r\n h('canvas', {\r\n attributes: {\r\n width: fadeWidth,\r\n height: data.height,\r\n },\r\n hook: new FadeCanvasHook(\r\n fadeOut.type,\r\n fadeOut.shape,\r\n fadeOut.end - fadeOut.start,\r\n data.resolution,\r\n ),\r\n }),\r\n ],\r\n ));\r\n }\r\n\r\n return h(`div.channel.channel-${channelNum}`,\r\n {\r\n attributes: {\r\n style: `height: ${data.height}px; width: ${width}px; top: ${channelNum * data.height}px; left: ${startX}px; position: absolute; margin: 0; padding: 0; z-index: 1;`,\r\n },\r\n },\r\n channelChildren,\r\n );\r\n });\r\n\r\n waveformChildren.push(channels);\r\n waveformChildren.push(this.renderOverlay(data));\r\n\r\n // draw cursor selection on active track.\r\n if (data.isActive === true) {\r\n const cStartX = secondsToPixels(data.timeSelection.start, data.resolution, data.sampleRate);\r\n const cEndX = secondsToPixels(data.timeSelection.end, data.resolution, data.sampleRate);\r\n const cWidth = (cEndX - cStartX) + 1;\r\n const cClassName = (cWidth > 1) ? '.segment' : '.point';\r\n\r\n waveformChildren.push(h(`div.selection${cClassName}`, {\r\n attributes: {\r\n style: `position: absolute; width: ${cWidth}px; bottom: 0; top: 0; left: ${cStartX}px; z-index: 4;`,\r\n },\r\n }));\r\n }\r\n\r\n const waveform = h('div.waveform',\r\n {\r\n attributes: {\r\n style: `height: ${numChan * data.height}px; position: relative;`,\r\n },\r\n },\r\n waveformChildren,\r\n );\r\n\r\n const channelChildren = [];\r\n let channelMargin = 0;\r\n\r\n if (data.controls.show) {\r\n channelChildren.push(this.renderControls(data));\r\n channelMargin = data.controls.width;\r\n }\r\n\r\n channelChildren.push(waveform);\r\n\r\n const audibleClass = data.shouldPlay ? '' : '.silent';\r\n const customClass = (this.customClass === undefined) ? '' : `.${this.customClass}`;\r\n\r\n return h(`div.channel-wrapper${audibleClass}${customClass}`,\r\n {\r\n attributes: {\r\n style: `margin-left: ${channelMargin}px; height: ${data.height * numChan}px;`,\r\n },\r\n },\r\n channelChildren,\r\n );\r\n }\r\n\r\n getTrackDetails() {\r\n const info = {\r\n src: this.src,\r\n start: this.startTime,\r\n end: this.endTime,\r\n name: this.name,\r\n customClass: this.customClass,\r\n cuein: this.cueIn,\r\n cueout: this.cueOut,\r\n };\r\n\r\n if (this.fadeIn) {\r\n const fadeIn = this.fades[this.fadeIn];\r\n\r\n info.fadeIn = {\r\n shape: fadeIn.shape,\r\n duration: fadeIn.end - fadeIn.start,\r\n };\r\n }\r\n\r\n if (this.fadeOut) {\r\n const fadeOut = this.fades[this.fadeOut];\r\n\r\n info.fadeOut = {\r\n shape: fadeOut.shape,\r\n duration: fadeOut.end - fadeOut.start,\r\n };\r\n }\r\n\r\n return info;\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/Track.js\n **/", + "/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forOwn(object, iteratee) {\n return object && baseForOwn(object, typeof iteratee == 'function' ? iteratee : identity);\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = forOwn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.forown/index.js\n ** module id = 63\n ** module chunks = 0\n **/", + "// uuid.js\n//\n// Copyright (c) 2010-2012 Robert Kieffer\n// MIT License - http://opensource.org/licenses/mit-license.php\n\n// Unique ID creation requires a high quality random # generator. We feature\n// detect to determine the best RNG source, normalizing to a function that\n// returns 128-bits of randomness, since that's what's usually required\nvar _rng = require('./rng');\n\n// Maps for number <-> hex string conversion\nvar _byteToHex = [];\nvar _hexToByte = {};\nfor (var i = 0; i < 256; i++) {\n _byteToHex[i] = (i + 0x100).toString(16).substr(1);\n _hexToByte[_byteToHex[i]] = i;\n}\n\n// **`parse()` - Parse a UUID into it's component bytes**\nfunction parse(s, buf, offset) {\n var i = (buf && offset) || 0, ii = 0;\n\n buf = buf || [];\n s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {\n if (ii < 16) { // Don't overflow!\n buf[i + ii++] = _hexToByte[oct];\n }\n });\n\n // Zero out remaining bytes if string was short\n while (ii < 16) {\n buf[i + ii++] = 0;\n }\n\n return buf;\n}\n\n// **`unparse()` - Convert UUID byte array (ala parse()) into a string**\nfunction unparse(buf, offset) {\n var i = offset || 0, bth = _byteToHex;\n return bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]];\n}\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\n// random #'s we need to init node and clockseq\nvar _seedBytes = _rng();\n\n// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\nvar _nodeId = [\n _seedBytes[0] | 0x01,\n _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]\n];\n\n// Per 4.2.2, randomize (14 bit) clockseq\nvar _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;\n\n// Previous uuid creation time\nvar _lastMSecs = 0, _lastNSecs = 0;\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n var node = options.node || _nodeId;\n for (var n = 0; n < 6; n++) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : unparse(b);\n}\n\n// **`v4()` - Generate random UUID**\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v4(options, buf, offset) {\n // Deprecated - 'format' argument, as supported in v1.2\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options == 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || _rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ii++) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || unparse(rnds);\n}\n\n// Export public API\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\nuuid.parse = parse;\nuuid.unparse = unparse;\n\nmodule.exports = uuid;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/uuid/uuid.js\n ** module id = 64\n ** module chunks = 0\n **/", + "\nvar rng;\n\nvar crypto = global.crypto || global.msCrypto; // for IE 11\nif (crypto && crypto.getRandomValues) {\n // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto\n // Moderately fast, high quality\n var _rnds8 = new Uint8Array(16);\n rng = function whatwgRNG() {\n crypto.getRandomValues(_rnds8);\n return _rnds8;\n };\n}\n\nif (!rng) {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var _rnds = new Array(16);\n rng = function() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return _rnds;\n };\n}\n\nmodule.exports = rng;\n\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/uuid/rng-browser.js\n ** module id = 65\n ** module chunks = 0\n **/", + "'use strict';\n\n//http://jsperf.com/typed-array-min-max/2\n//plain for loop for finding min/max is way faster than anything else.\n/**\n* @param {TypedArray} array - Subarray of audio to calculate peaks from.\n*/\nfunction findMinMax(array) {\n var min = Infinity;\n var max = -Infinity;\n var i = 0;\n var len = array.length;\n var curr;\n\n for(; i < len; i++) {\n curr = array[i];\n if (min > curr) {\n min = curr;\n }\n if (max < curr) {\n max = curr;\n }\n }\n\n return {\n min: min,\n max: max\n };\n}\n\n/**\n* @param {Number} n - peak to convert from float to Int8, Int16 etc.\n* @param {Number} bits - convert to #bits two's complement signed integer\n*/\nfunction convert(n, bits) {\n var max = Math.pow(2, bits-1);\n var v = n < 0 ? n * max : n * max - 1;\n return Math.max(-max, Math.min(max-1, v));\n}\n\n/**\n* @param {TypedArray} channel - Audio track frames to calculate peaks from.\n* @param {Number} samplesPerPixel - Audio frames per peak\n*/\nfunction extractPeaks(channel, samplesPerPixel, bits) {\n var i;\n var chanLength = channel.length;\n var numPeaks = Math.ceil(chanLength / samplesPerPixel);\n var start;\n var end;\n var segment;\n var max; \n var min;\n var extrema;\n\n //create interleaved array of min,max\n var peaks = new (eval(\"Int\"+bits+\"Array\"))(numPeaks*2);\n\n for (i = 0; i < numPeaks; i++) {\n\n start = i * samplesPerPixel;\n end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel;\n\n segment = channel.subarray(start, end);\n extrema = findMinMax(segment);\n min = convert(extrema.min, bits);\n max = convert(extrema.max, bits);\n\n peaks[i*2] = min;\n peaks[i*2+1] = max;\n }\n\n return peaks;\n}\n\nfunction makeMono(channelPeaks, bits) {\n var numChan = channelPeaks.length;\n var weight = 1 / numChan;\n var numPeaks = channelPeaks[0].length / 2;\n var c = 0;\n var i = 0;\n var min;\n var max;\n var peaks = new (eval(\"Int\"+bits+\"Array\"))(numPeaks*2);\n\n for (i = 0; i < numPeaks; i++) {\n min = 0;\n max = 0;\n\n for (c = 0; c < numChan; c++) {\n min += weight * channelPeaks[c][i*2];\n max += weight * channelPeaks[c][i*2+1];\n }\n\n peaks[i*2] = min;\n peaks[i*2+1] = max;\n }\n\n //return in array so channel number counts still work.\n return [peaks];\n}\n\n/**\n* @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.\n* @param {Number} samplesPerPixel - Number of audio samples per peak.\n* @param {Number} cueIn - index in channel to start peak calculations from.\n* @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).\n*/\nmodule.exports = function(source, samplesPerPixel, isMono, cueIn, cueOut, bits) {\n samplesPerPixel = samplesPerPixel || 10000;\n bits = bits || 8;\n \n if (isMono === null || isMono === undefined) {\n isMono = true;\n }\n\n if ([8, 16, 32].indexOf(bits) < 0) {\n throw new Error(\"Invalid number of bits specified for peaks.\");\n }\n\n var numChan = source.numberOfChannels;\n var peaks = [];\n var c;\n var numPeaks;\n var channel;\n var slice;\n\n if (typeof source.subarray === \"undefined\") {\n for (c = 0; c < numChan; c++) {\n channel = source.getChannelData(c);\n cueIn = cueIn || 0;\n cueOut = cueOut || channel.length;\n slice = channel.subarray(cueIn, cueOut);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n }\n else {\n cueIn = cueIn || 0;\n cueOut = cueOut || source.length;\n peaks.push(extractPeaks(source.subarray(cueIn, cueOut), samplesPerPixel, bits));\n }\n\n if (isMono && peaks.length > 1) {\n peaks = makeMono(peaks, bits);\n }\n\n numPeaks = peaks[0].length / 2;\n\n return {\n length: numPeaks,\n data: peaks,\n bits: bits\n };\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/webaudio-peaks/index.js\n ** module id = 66\n ** module chunks = 0\n **/", + "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.FADEOUT = exports.FADEIN = exports.LOGARITHMIC = exports.EXPONENTIAL = exports.LINEAR = exports.SCURVE = undefined;\nexports.createFadeIn = createFadeIn;\nexports.createFadeOut = createFadeOut;\n\nvar _fadeCurves = require('fade-curves');\n\nvar SCURVE = exports.SCURVE = \"sCurve\";\nvar LINEAR = exports.LINEAR = \"linear\";\nvar EXPONENTIAL = exports.EXPONENTIAL = \"exponential\";\nvar LOGARITHMIC = exports.LOGARITHMIC = \"logarithmic\";\n\nvar FADEIN = exports.FADEIN = \"FadeIn\";\nvar FADEOUT = exports.FADEOUT = \"FadeOut\";\n\nfunction sCurveFadeIn(start, duration) {\n var curve = (0, _fadeCurves.sCurve)(10000, 1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction sCurveFadeOut(start, duration) {\n var curve = (0, _fadeCurves.sCurve)(10000, -1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction linearFadeIn(start, duration) {\n this.linearRampToValueAtTime(0, start);\n this.linearRampToValueAtTime(1, start + duration);\n}\n\nfunction linearFadeOut(start, duration) {\n this.linearRampToValueAtTime(1, start);\n this.linearRampToValueAtTime(0, start + duration);\n}\n\nfunction exponentialFadeIn(start, duration) {\n this.exponentialRampToValueAtTime(0.01, start);\n this.exponentialRampToValueAtTime(1, start + duration);\n}\n\nfunction exponentialFadeOut(start, duration) {\n this.exponentialRampToValueAtTime(1, start);\n this.exponentialRampToValueAtTime(0.01, start + duration);\n}\n\nfunction logarithmicFadeIn(start, duration) {\n var curve = (0, _fadeCurves.logarithmic)(10000, 10, 1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction logarithmicFadeOut(start, duration) {\n var curve = (0, _fadeCurves.logarithmic)(10000, 10, -1);\n this.setValueCurveAtTime(curve, start, duration);\n}\n\nfunction createFadeIn(gain, shape, start, duration) {\n switch (shape) {\n case SCURVE:\n sCurveFadeIn.call(gain, start, duration);\n break;\n case LINEAR:\n linearFadeIn.call(gain, start, duration);\n break;\n case EXPONENTIAL:\n exponentialFadeIn.call(gain, start, duration);\n break;\n case LOGARITHMIC:\n logarithmicFadeIn.call(gain, start, duration);\n break;\n default:\n throw new Error(\"Unsupported Fade type\");\n }\n}\n\nfunction createFadeOut(gain, shape, start, duration) {\n switch (shape) {\n case SCURVE:\n sCurveFadeOut.call(gain, start, duration);\n break;\n case LINEAR:\n linearFadeOut.call(gain, start, duration);\n break;\n case EXPONENTIAL:\n exponentialFadeOut.call(gain, start, duration);\n break;\n case LOGARITHMIC:\n logarithmicFadeOut.call(gain, start, duration);\n break;\n default:\n throw new Error(\"Unsupported Fade type\");\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/fade-maker/index.js\n ** module id = 67\n ** module chunks = 0\n **/", + "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.linear = linear;\nexports.exponential = exponential;\nexports.sCurve = sCurve;\nexports.logarithmic = logarithmic;\nfunction linear(length, rotation) {\n var curve = new Float32Array(length),\n i,\n x,\n scale = length - 1;\n\n for (i = 0; i < length; i++) {\n x = i / scale;\n\n if (rotation > 0) {\n curve[i] = x;\n } else {\n curve[i] = 1 - x;\n }\n }\n\n return curve;\n}\n\nfunction exponential(length, rotation) {\n var curve = new Float32Array(length),\n i,\n x,\n scale = length - 1,\n index;\n\n for (i = 0; i < length; i++) {\n x = i / scale;\n index = rotation > 0 ? i : length - 1 - i;\n\n curve[index] = Math.exp(2 * x - 1) / Math.exp(1);\n }\n\n return curve;\n}\n\n//creating a curve to simulate an S-curve with setValueCurveAtTime.\nfunction sCurve(length, rotation) {\n var curve = new Float32Array(length),\n i,\n phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2);\n\n for (i = 0; i < length; ++i) {\n curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5;\n }\n return curve;\n}\n\n//creating a curve to simulate a logarithmic curve with setValueCurveAtTime.\nfunction logarithmic(length, base, rotation) {\n var curve = new Float32Array(length),\n index,\n x = 0,\n i;\n\n for (i = 0; i < length; i++) {\n //index for the curve array.\n index = rotation > 0 ? i : length - 1 - i;\n\n x = i / length;\n curve[index] = Math.log(1 + base * x) / Math.log(1 + base);\n }\n\n return curve;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/fade-curves/index.js\n ** module id = 68\n ** module chunks = 0\n **/", + "import cursor from './states/CursorState';\r\nimport select from './states/SelectState';\r\nimport shift from './states/ShiftState';\r\nimport fadein from './states/FadeInState';\r\nimport fadeout from './states/FadeOutState';\r\n\r\nexport default {\r\n cursor,\r\n select,\r\n shift,\r\n fadein,\r\n fadeout,\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/states.js\n **/", + "import { pixelsToSeconds } from '../../utils/conversions';\r\n\r\nexport default class {\r\n constructor(track) {\r\n this.track = track;\r\n }\r\n\r\n setup(samplesPerPixel, sampleRate) {\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n click(e) {\r\n e.preventDefault();\r\n\r\n const startX = e.offsetX;\r\n const startTime = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);\r\n\r\n this.track.ee.emit('select', startTime, startTime, this.track);\r\n }\r\n\r\n static getClass() {\r\n return '.state-cursor';\r\n }\r\n\r\n static getEvents() {\r\n return ['click'];\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/states/CursorState.js\n **/", + "import { pixelsToSeconds } from '../../utils/conversions';\r\n\r\nexport default class {\r\n constructor(track) {\r\n this.track = track;\r\n this.active = false;\r\n }\r\n\r\n setup(samplesPerPixel, sampleRate) {\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n emitSelection(x) {\r\n const minX = Math.min(x, this.startX);\r\n const maxX = Math.max(x, this.startX);\r\n const startTime = pixelsToSeconds(minX, this.samplesPerPixel, this.sampleRate);\r\n const endTime = pixelsToSeconds(maxX, this.samplesPerPixel, this.sampleRate);\r\n\r\n this.track.ee.emit('select', startTime, endTime, this.track);\r\n }\r\n\r\n complete(x) {\r\n this.emitSelection(x);\r\n this.active = false;\r\n }\r\n\r\n mousedown(e) {\r\n e.preventDefault();\r\n this.active = true;\r\n\r\n this.startX = e.offsetX;\r\n const startTime = pixelsToSeconds(this.startX, this.samplesPerPixel, this.sampleRate);\r\n\r\n this.track.ee.emit('select', startTime, startTime, this.track);\r\n }\r\n\r\n mousemove(e) {\r\n if (this.active) {\r\n e.preventDefault();\r\n this.emitSelection(e.offsetX);\r\n }\r\n }\r\n\r\n mouseup(e) {\r\n if (this.active) {\r\n e.preventDefault();\r\n this.complete(e.offsetX);\r\n }\r\n }\r\n\r\n mouseleave(e) {\r\n if (this.active) {\r\n e.preventDefault();\r\n this.complete(e.offsetX);\r\n }\r\n }\r\n\r\n static getClass() {\r\n return '.state-select';\r\n }\r\n\r\n static getEvents() {\r\n return ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/states/SelectState.js\n **/", + "import { pixelsToSeconds } from '../../utils/conversions';\r\n\r\nexport default class {\r\n constructor(track) {\r\n this.track = track;\r\n this.active = false;\r\n }\r\n\r\n setup(samplesPerPixel, sampleRate) {\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n emitShift(x) {\r\n const deltaX = x - this.prevX;\r\n const deltaTime = pixelsToSeconds(deltaX, this.samplesPerPixel, this.sampleRate);\r\n this.prevX = x;\r\n this.track.ee.emit('shift', deltaTime, this.track);\r\n }\r\n\r\n complete(x) {\r\n this.emitShift(x);\r\n this.active = false;\r\n }\r\n\r\n mousedown(e) {\r\n e.preventDefault();\r\n\r\n this.active = true;\r\n this.el = e.target;\r\n this.prevX = e.offsetX;\r\n }\r\n\r\n mousemove(e) {\r\n if (this.active) {\r\n e.preventDefault();\r\n this.emitShift(e.offsetX);\r\n }\r\n }\r\n\r\n mouseup(e) {\r\n if (this.active) {\r\n e.preventDefault();\r\n this.complete(e.offsetX);\r\n }\r\n }\r\n\r\n mouseleave(e) {\r\n if (this.active) {\r\n e.preventDefault();\r\n this.complete(e.offsetX);\r\n }\r\n }\r\n\r\n static getClass() {\r\n return '.state-shift';\r\n }\r\n\r\n static getEvents() {\r\n return ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/states/ShiftState.js\n **/", + "import { pixelsToSeconds } from '../../utils/conversions';\r\n\r\nexport default class {\r\n constructor(track) {\r\n this.track = track;\r\n }\r\n\r\n setup(samplesPerPixel, sampleRate) {\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n click(e) {\r\n const startX = e.offsetX;\r\n const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);\r\n\r\n if (time > this.track.getStartTime() && time < this.track.getEndTime()) {\r\n this.track.ee.emit('fadein', time - this.track.getStartTime(), this.track);\r\n }\r\n }\r\n\r\n static getClass() {\r\n return '.state-fadein';\r\n }\r\n\r\n static getEvents() {\r\n return ['click'];\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/states/FadeInState.js\n **/", + "import { pixelsToSeconds } from '../../utils/conversions';\r\n\r\nexport default class {\r\n constructor(track) {\r\n this.track = track;\r\n }\r\n\r\n setup(samplesPerPixel, sampleRate) {\r\n this.samplesPerPixel = samplesPerPixel;\r\n this.sampleRate = sampleRate;\r\n }\r\n\r\n click(e) {\r\n const startX = e.offsetX;\r\n const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);\r\n\r\n if (time > this.track.getStartTime() && time < this.track.getEndTime()) {\r\n this.track.ee.emit('fadeout', this.track.getEndTime() - time, this.track);\r\n }\r\n }\r\n\r\n static getClass() {\r\n return '.state-fadeout';\r\n }\r\n\r\n static getEvents() {\r\n return ['click'];\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/track/states/FadeOutState.js\n **/", + "/*\r\n* virtual-dom hook for drawing to the canvas element.\r\n*/\r\nclass CanvasHook {\r\n constructor(peaks, offset, bits, color) {\r\n this.peaks = peaks;\r\n // http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element\r\n this.offset = offset;\r\n this.color = color;\r\n this.bits = bits;\r\n }\r\n\r\n static drawFrame(cc, h2, x, minPeak, maxPeak) {\r\n const min = Math.abs(minPeak * h2);\r\n const max = Math.abs(maxPeak * h2);\r\n\r\n // draw max\r\n cc.fillRect(x, 0, 1, h2 - max);\r\n // draw min\r\n cc.fillRect(x, h2 + min, 1, h2 - min);\r\n }\r\n\r\n hook(canvas, prop, prev) {\r\n // canvas is up to date\r\n if (prev !== undefined &&\r\n (prev.peaks === this.peaks)) {\r\n return;\r\n }\r\n\r\n const len = canvas.width;\r\n const cc = canvas.getContext('2d');\r\n const h2 = canvas.height / 2;\r\n const maxValue = 2 ** (this.bits - 1);\r\n\r\n cc.clearRect(0, 0, canvas.width, canvas.height);\r\n cc.fillStyle = this.color;\r\n\r\n for (let i = 0; i < len; i += 1) {\r\n const minPeak = this.peaks[(i + this.offset) * 2] / maxValue;\r\n const maxPeak = this.peaks[((i + this.offset) * 2) + 1] / maxValue;\r\n CanvasHook.drawFrame(cc, h2, i, minPeak, maxPeak);\r\n }\r\n }\r\n}\r\n\r\nexport default CanvasHook;\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/CanvasHook.js\n **/", + "import { FADEIN, FADEOUT, SCURVE, LINEAR, EXPONENTIAL, LOGARITHMIC } from 'fade-maker';\r\nimport { sCurve, logarithmic, linear, exponential } from 'fade-curves';\r\n\r\n/*\r\n* virtual-dom hook for drawing the fade curve to the canvas element.\r\n*/\r\nclass FadeCanvasHook {\r\n constructor(type, shape, duration, samplesPerPixel) {\r\n this.type = type;\r\n this.shape = shape;\r\n this.duration = duration;\r\n this.samplesPerPixel = samplesPerPixel;\r\n }\r\n\r\n static createCurve(shape, type, width) {\r\n let reflection;\r\n let curve;\r\n\r\n switch (type) {\r\n case FADEIN: {\r\n reflection = 1;\r\n break;\r\n }\r\n case FADEOUT: {\r\n reflection = -1;\r\n break;\r\n }\r\n default: {\r\n throw new Error('Unsupported fade type.');\r\n }\r\n }\r\n\r\n switch (shape) {\r\n case SCURVE: {\r\n curve = sCurve(width, reflection);\r\n break;\r\n }\r\n case LINEAR: {\r\n curve = linear(width, reflection);\r\n break;\r\n }\r\n case EXPONENTIAL: {\r\n curve = exponential(width, reflection);\r\n break;\r\n }\r\n case LOGARITHMIC: {\r\n curve = logarithmic(width, 10, reflection);\r\n break;\r\n }\r\n default: {\r\n throw new Error('Unsupported fade shape');\r\n }\r\n }\r\n\r\n return curve;\r\n }\r\n\r\n hook(canvas, prop, prev) {\r\n // node is up to date.\r\n if (prev !== undefined &&\r\n prev.shape === this.shape &&\r\n prev.type === this.type &&\r\n prev.duration === this.duration &&\r\n prev.samplesPerPixel === this.samplesPerPixel) {\r\n return;\r\n }\r\n\r\n const ctx = canvas.getContext('2d');\r\n const width = canvas.width;\r\n const height = canvas.height;\r\n const curve = FadeCanvasHook.createCurve(this.shape, this.type, width);\r\n const len = curve.length;\r\n let y = height - (curve[0] * height);\r\n\r\n ctx.strokeStyle = 'black';\r\n ctx.beginPath();\r\n ctx.moveTo(0, y);\r\n\r\n for (let i = 1; i < len; i += 1) {\r\n y = height - (curve[i] * height);\r\n ctx.lineTo(i, y);\r\n }\r\n ctx.stroke();\r\n }\r\n}\r\n\r\nexport default FadeCanvasHook;\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/FadeCanvasHook.js\n **/", + "/*\r\n* virtual-dom hook for setting the volume input programmatically.\r\n*/\r\nexport default class {\r\n constructor(gain) {\r\n this.gain = gain;\r\n }\r\n\r\n hook(volumeInput) {\r\n volumeInput.setAttribute('value', this.gain * 100);\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/VolumeSliderHook.js\n **/", + "import { FADEIN, FADEOUT, createFadeIn, createFadeOut } from 'fade-maker';\r\n\r\nexport default class {\r\n\r\n constructor(ac, buffer) {\r\n this.ac = ac;\r\n this.gain = 1;\r\n this.buffer = buffer;\r\n this.destination = this.ac.destination;\r\n }\r\n\r\n applyFade(type, start, duration, shape = 'logarithmic') {\r\n if (type === FADEIN) {\r\n createFadeIn(this.fadeGain.gain, shape, start, duration);\r\n } else if (type === FADEOUT) {\r\n createFadeOut(this.fadeGain.gain, shape, start, duration);\r\n } else {\r\n throw new Error('Unsupported fade type');\r\n }\r\n }\r\n\r\n applyFadeIn(start, duration, shape = 'logarithmic') {\r\n this.applyFade(FADEIN, start, duration, shape);\r\n }\r\n\r\n applyFadeOut(start, duration, shape = 'logarithmic') {\r\n this.applyFade(FADEOUT, start, duration, shape);\r\n }\r\n\r\n isPlaying() {\r\n return this.source !== undefined;\r\n }\r\n\r\n getDuration() {\r\n return this.buffer.duration;\r\n }\r\n\r\n setAudioContext(audioContext) {\r\n this.ac = audioContext;\r\n this.destination = this.ac.destination;\r\n }\r\n\r\n setUpSource() {\r\n this.source = this.ac.createBufferSource();\r\n this.source.buffer = this.buffer;\r\n\r\n const sourcePromise = new Promise((resolve) => {\r\n // keep track of the buffer state.\r\n this.source.onended = () => {\r\n this.source.disconnect();\r\n this.fadeGain.disconnect();\r\n this.volumeGain.disconnect();\r\n this.shouldPlayGain.disconnect();\r\n this.masterGain.disconnect();\r\n\r\n\r\n this.source = undefined;\r\n this.fadeGain = undefined;\r\n this.volumeGain = undefined;\r\n this.shouldPlayGain = undefined;\r\n this.masterGain = undefined;\r\n\r\n resolve();\r\n };\r\n });\r\n\r\n this.fadeGain = this.ac.createGain();\r\n // used for track volume slider\r\n this.volumeGain = this.ac.createGain();\r\n // used for solo/mute\r\n this.shouldPlayGain = this.ac.createGain();\r\n this.masterGain = this.ac.createGain();\r\n\r\n this.source.connect(this.fadeGain);\r\n this.fadeGain.connect(this.volumeGain);\r\n this.volumeGain.connect(this.shouldPlayGain);\r\n this.shouldPlayGain.connect(this.masterGain);\r\n this.masterGain.connect(this.destination);\r\n\r\n return sourcePromise;\r\n }\r\n\r\n setVolumeGainLevel(level) {\r\n if (this.volumeGain) {\r\n this.volumeGain.gain.value = level;\r\n }\r\n }\r\n\r\n setShouldPlay(bool) {\r\n if (this.shouldPlayGain) {\r\n this.shouldPlayGain.gain.value = bool ? 1 : 0;\r\n }\r\n }\r\n\r\n setMasterGainLevel(level) {\r\n if (this.masterGain) {\r\n this.masterGain.gain.value = level;\r\n }\r\n }\r\n\r\n setSpeed(speed) {\r\n this.speed = speed;\r\n }/*\r\n source.start is picky when passing the end time.\r\n If rounding error causes a number to make the source think\r\n it is playing slightly more samples than it has it won't play at all.\r\n Unfortunately it doesn't seem to work if you just give it a start time.\r\n */\r\n play(when, start, duration) {\r\n this.source.start(when, start, duration);\r\n this.source.playbackRate.value = this.speed;}\r\n\r\n stop(when = 0) {\r\n if (this.source) {\r\n this.source.stop(when);\r\n }\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/Playout.js\n **/", + "export default function () {\r\n // http://jsperf.com/typed-array-min-max/2\r\n // plain for loop for finding min/max is way faster than anything else.\r\n /**\r\n * @param {TypedArray} array - Subarray of audio to calculate peaks from.\r\n */\r\n function findMinMax(array) {\r\n let min = Infinity;\r\n let max = -Infinity;\r\n let curr;\r\n\r\n for (let i = 0; i < array.length; i += 1) {\r\n curr = array[i];\r\n if (min > curr) {\r\n min = curr;\r\n }\r\n if (max < curr) {\r\n max = curr;\r\n }\r\n }\r\n\r\n return {\r\n min,\r\n max,\r\n };\r\n }\r\n\r\n /**\r\n * @param {Number} n - peak to convert from float to Int8, Int16 etc.\r\n * @param {Number} bits - convert to #bits two's complement signed integer\r\n */\r\n function convert(n, bits) {\r\n const max = 2 ** (bits - 1);\r\n const v = n < 0 ? (n * max) : (n * max) - 1;\r\n return Math.max(-max, Math.min(max - 1, v));\r\n }\r\n\r\n /**\r\n * @param {TypedArray} channel - Audio track frames to calculate peaks from.\r\n * @param {Number} samplesPerPixel - Audio frames per peak\r\n */\r\n function extractPeaks(channel, samplesPerPixel, bits) {\r\n const chanLength = channel.length;\r\n const numPeaks = Math.ceil(chanLength / samplesPerPixel);\r\n let start;\r\n let end;\r\n let segment;\r\n let max;\r\n let min;\r\n let extrema;\r\n\r\n // create interleaved array of min,max\r\n const peaks = new self[`Int${bits}Array`](numPeaks * 2);\r\n\r\n for (let i = 0; i < numPeaks; i += 1) {\r\n start = i * samplesPerPixel;\r\n end = (i + 1) * samplesPerPixel > chanLength ? chanLength : (i + 1) * samplesPerPixel;\r\n\r\n segment = channel.subarray(start, end);\r\n extrema = findMinMax(segment);\r\n min = convert(extrema.min, bits);\r\n max = convert(extrema.max, bits);\r\n\r\n peaks[i * 2] = min;\r\n peaks[(i * 2) + 1] = max;\r\n }\r\n\r\n return peaks;\r\n }\r\n\r\n function makeMono(channelPeaks, bits) {\r\n const numChan = channelPeaks.length;\r\n const weight = 1 / numChan;\r\n const numPeaks = channelPeaks[0].length / 2;\r\n let min;\r\n let max;\r\n const peaks = new self[`Int${bits}Array`](numPeaks * 2);\r\n\r\n for (let i = 0; i < numPeaks; i += 1) {\r\n min = 0;\r\n max = 0;\r\n\r\n for (let c = 0; c < numChan; c += 1) {\r\n min += weight * channelPeaks[c][i * 2];\r\n max += weight * channelPeaks[c][(i * 2) + 1];\r\n }\r\n\r\n peaks[i * 2] = min;\r\n peaks[(i * 2) + 1] = max;\r\n }\r\n\r\n // return in array so channel number counts still work.\r\n return [peaks];\r\n }\r\n\r\n /**\r\n * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.\r\n * @param {Number} samplesPerPixel - Number of audio samples per peak.\r\n * @param {Number} cueIn - index in channel to start peak calculations from.\r\n * @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).\r\n */\r\n function audioPeaks(source, samplesPerPixel = 10000, isMono = true, cueIn, cueOut, bits = 8) {\r\n if ([8, 16, 32].indexOf(bits) < 0) {\r\n throw new Error('Invalid number of bits specified for peaks.');\r\n }\r\n\r\n const numChan = source.numberOfChannels;\r\n let peaks = [];\r\n\r\n if (typeof source.subarray === 'undefined') {\r\n for (let c = 0; c < numChan; c += 1) {\r\n const channel = source.getChannelData(c);\r\n const start = cueIn || 0;\r\n const end = cueOut || channel.length;\r\n const slice = channel.subarray(start, end);\r\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\r\n }\r\n } else {\r\n const start = cueIn || 0;\r\n const end = cueOut || source.length;\r\n peaks.push(extractPeaks(source.subarray(start, end), samplesPerPixel, bits));\r\n }\r\n\r\n if (isMono && peaks.length > 1) {\r\n peaks = makeMono(peaks, bits);\r\n }\r\n\r\n const length = peaks[0].length / 2;\r\n\r\n return {\r\n bits,\r\n length,\r\n data: peaks,\r\n };\r\n }\r\n\r\n onmessage = function onmessage(e) {\r\n const peaks = audioPeaks(e.data.samples, e.data.samplesPerPixel);\r\n\r\n postMessage(peaks);\r\n };\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/recorderWorker.js\n **/", + "export default function () {\r\n let recLength = 0;\r\n let recBuffersL = [];\r\n let recBuffersR = [];\r\n let sampleRate;\r\n\r\n function init(config) {\r\n sampleRate = config.sampleRate;\r\n }\r\n\r\n function record(inputBuffer) {\r\n recBuffersL.push(inputBuffer[0]);\r\n recBuffersR.push(inputBuffer[1]);\r\n recLength += inputBuffer[0].length;\r\n }\r\n\r\n function writeString(view, offset, string) {\r\n for (let i = 0; i < string.length; i += 1) {\r\n view.setUint8(offset + i, string.charCodeAt(i));\r\n }\r\n }\r\n\r\n function floatTo16BitPCM(output, offset, input) {\r\n let writeOffset = offset;\r\n for (let i = 0; i < input.length; i += 1, writeOffset += 2) {\r\n const s = Math.max(-1, Math.min(1, input[i]));\r\n output.setInt16(writeOffset, s < 0 ? s * 0x8000 : s * 0x7FFF, true);\r\n }\r\n }\r\n\r\n function encodeWAV(samples, mono = false) {\r\n const buffer = new ArrayBuffer(44 + (samples.length * 2));\r\n const view = new DataView(buffer);\r\n\r\n /* RIFF identifier */\r\n writeString(view, 0, 'RIFF');\r\n /* file length */\r\n view.setUint32(4, 32 + (samples.length * 2), true);\r\n /* RIFF type */\r\n writeString(view, 8, 'WAVE');\r\n /* format chunk identifier */\r\n writeString(view, 12, 'fmt ');\r\n /* format chunk length */\r\n view.setUint32(16, 16, true);\r\n /* sample format (raw) */\r\n view.setUint16(20, 1, true);\r\n /* channel count */\r\n view.setUint16(22, mono ? 1 : 2, true);\r\n /* sample rate */\r\n view.setUint32(24, sampleRate, true);\r\n /* byte rate (sample rate * block align) */\r\n view.setUint32(28, sampleRate * 4, true);\r\n /* block align (channel count * bytes per sample) */\r\n view.setUint16(32, 4, true);\r\n /* bits per sample */\r\n view.setUint16(34, 16, true);\r\n /* data chunk identifier */\r\n writeString(view, 36, 'data');\r\n /* data chunk length */\r\n view.setUint32(40, samples.length * 2, true);\r\n\r\n floatTo16BitPCM(view, 44, samples);\r\n\r\n return view;\r\n }\r\n\r\n function mergeBuffers(recBuffers, length) {\r\n const result = new Float32Array(length);\r\n let offset = 0;\r\n\r\n for (let i = 0; i < recBuffers.length; i += 1) {\r\n result.set(recBuffers[i], offset);\r\n offset += recBuffers[i].length;\r\n }\r\n return result;\r\n }\r\n\r\n function interleave(inputL, inputR) {\r\n const length = inputL.length + inputR.length;\r\n const result = new Float32Array(length);\r\n\r\n let index = 0;\r\n let inputIndex = 0;\r\n\r\n while (index < length) {\r\n result[index += 1] = inputL[inputIndex];\r\n result[index += 1] = inputR[inputIndex];\r\n inputIndex += 1;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n function exportWAV(type) {\r\n const bufferL = mergeBuffers(recBuffersL, recLength);\r\n const bufferR = mergeBuffers(recBuffersR, recLength);\r\n const interleaved = interleave(bufferL, bufferR);\r\n const dataview = encodeWAV(interleaved);\r\n const audioBlob = new Blob([dataview], { type });\r\n\r\n postMessage(audioBlob);\r\n }\r\n\r\n function clear() {\r\n recLength = 0;\r\n recBuffersL = [];\r\n recBuffersR = [];\r\n }\r\n\r\n onmessage = function onmessage(e) {\r\n switch (e.data.command) {\r\n case 'init': {\r\n init(e.data.config);\r\n break;\r\n }\r\n case 'record': {\r\n record(e.data.buffer);\r\n break;\r\n }\r\n case 'exportWAV': {\r\n exportWAV(e.data.type);\r\n break;\r\n }\r\n case 'clear': {\r\n clear();\r\n break;\r\n }\r\n default: {\r\n throw new Error('Unknown export worker command');\r\n }\r\n }\r\n };\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/exportWavWorker.js\n **/" + ], + "sourceRoot": "" +} \ No newline at end of file diff --git a/dist/waveform-playlist/multi-channel.html b/dist/waveform-playlist/multi-channel.html index 928e4f73..b8d8d306 100644 --- a/dist/waveform-playlist/multi-channel.html +++ b/dist/waveform-playlist/multi-channel.html @@ -42,13 +42,13 @@

Stereo Channel Editor

-
-
- - - +
+
+ + + +
-
diff --git a/dist/waveform-playlist/web-audio-editor.html b/dist/waveform-playlist/web-audio-editor.html index d8779661..5e7af391 100644 --- a/dist/waveform-playlist/web-audio-editor.html +++ b/dist/waveform-playlist/web-audio-editor.html @@ -42,100 +42,119 @@

Full Waveform Editor

-
-
+
+
- + - + - + - + -
-
+
+
- + -
-
+
+
- + - + - + - + -
- - + + -
+
+
Print Playlist Info to Console - Clear -
-
+ Clear +
+
+
-
-
- - - - -
-
- -
-
-
- - - Seek ! -
-
-
-
-
+
+ + + + +
+
+
+ + +
+
+
+
+ + + + Change speed +
+
+
+
+ + + Seek ! +
+
+
+
+ + + Set loop +
+
+
+
+
diff --git a/ghpages/_examples/11exclusivesolo.html b/ghpages/_examples/11exclusivesolo.html index fc1a14f5..3e07ad87 100644 --- a/ghpages/_examples/11exclusivesolo.html +++ b/ghpages/_examples/11exclusivesolo.html @@ -8,19 +8,20 @@ ---
-
-
- - - - - +
+
+ + + + + +
-
- +
diff --git a/ghpages/_examples/12multichannel.html b/ghpages/_examples/12multichannel.html index 665e19fb..4d6de2ef 100644 --- a/ghpages/_examples/12multichannel.html +++ b/ghpages/_examples/12multichannel.html @@ -8,12 +8,12 @@ ---
-
-
- - - +
+
+ + + +
-
diff --git a/ghpages/_examples/99webaudioeditor.html b/ghpages/_examples/99webaudioeditor.html index 93c9f5c2..d0871668 100644 --- a/ghpages/_examples/99webaudioeditor.html +++ b/ghpages/_examples/99webaudioeditor.html @@ -8,98 +8,117 @@ ---
-
-
+
+
- + - + - + - + -
-
+
+
- + -
-
+
+
- + - + - + - + -
- - + + -
+
+
Print Playlist Info to Console - Clear -
-
+ Clear +
+
+
-
-
- - - - -
-
- -
-
-
- - - Seek ! -
-
-
-
-
+
+ + + + +
+
+
+ + +
+
+
+
+ + + + Change speed +
+
+
+
+ + + Seek ! +
+
+
+
+ + + Set loop +
+
+
+
+
diff --git a/ghpages/js/emitter.js b/ghpages/js/emitter.js index 87175582..a0d68a77 100644 --- a/ghpages/js/emitter.js +++ b/ghpages/js/emitter.js @@ -1,7 +1,7 @@ /* * This script is provided to give an example how the playlist can be controlled using the event emitter. * This enables projects to create/control the useability of the project. -*/ + */ var ee = playlist.getEventEmitter(); var $container = $("body"); var $timeFormat = $container.find('.time-format'); @@ -30,9 +30,9 @@ function cueFormatters(format) { function clockFormat(seconds, decimals) { var hours, - minutes, - secs, - result; + minutes, + secs, + result; hours = parseInt(seconds / 3600, 10) % 24; minutes = parseInt(seconds / 60, 10) % 60; @@ -46,22 +46,22 @@ function cueFormatters(format) { var formats = { "seconds": function (seconds) { - return seconds.toFixed(0); + return seconds.toFixed(0); }, "thousandths": function (seconds) { - return seconds.toFixed(3); + return seconds.toFixed(3); }, "hh:mm:ss": function (seconds) { - return clockFormat(seconds, 0); + return clockFormat(seconds, 0); }, "hh:mm:ss.u": function (seconds) { - return clockFormat(seconds, 1); + return clockFormat(seconds, 1); }, "hh:mm:ss.uu": function (seconds) { - return clockFormat(seconds, 2); + return clockFormat(seconds, 2); }, "hh:mm:ss.uuu": function (seconds) { - return clockFormat(seconds, 3); + return clockFormat(seconds, 3); } }; @@ -95,9 +95,9 @@ updateTime(audioPos); /* -* Code below sets up events to send messages to the playlist. -*/ -$container.on("click", ".btn-playlist-state-group", function() { + * Code below sets up events to send messages to the playlist. + */ +$container.on("click", ".btn-playlist-state-group", function () { //reset these for now. $('.btn-fade-state-group').addClass('hidden'); $('.btn-select-state-group').addClass('hidden'); @@ -111,95 +111,95 @@ $container.on("click", ".btn-playlist-state-group", function() { } }); -$container.on("click", ".btn-play", function() { +$container.on("click", ".btn-play", function () { ee.emit("play"); }); -$container.on("click", ".btn-pause", function() { +$container.on("click", ".btn-pause", function () { ee.emit("pause"); }); -$container.on("click", ".btn-stop", function() { +$container.on("click", ".btn-stop", function () { ee.emit("stop"); }); -$container.on("click", ".btn-rewind", function() { +$container.on("click", ".btn-rewind", function () { ee.emit("rewind"); }); -$container.on("click", ".btn-fast-forward", function() { +$container.on("click", ".btn-fast-forward", function () { ee.emit("fastforward"); }); -$container.on("click", ".btn-clear", function() { +$container.on("click", ".btn-clear", function () { ee.emit("clear"); }); -$container.on("click", ".btn-record", function() { - ee.emit("record"); +$container.on("click", ".btn-record", function () { + ee.emit("record"); }); //track interaction states -$container.on("click", ".btn-cursor", function() { +$container.on("click", ".btn-cursor", function () { ee.emit("statechange", "cursor"); toggleActive(this); }); -$container.on("click", ".btn-select", function() { +$container.on("click", ".btn-select", function () { ee.emit("statechange", "select"); toggleActive(this); }); -$container.on("click", ".btn-shift", function() { +$container.on("click", ".btn-shift", function () { ee.emit("statechange", "shift"); toggleActive(this); }); -$container.on("click", ".btn-fadein", function() { +$container.on("click", ".btn-fadein", function () { ee.emit("statechange", "fadein"); toggleActive(this); }); -$container.on("click", ".btn-fadeout", function() { +$container.on("click", ".btn-fadeout", function () { ee.emit("statechange", "fadeout"); toggleActive(this); }); //fade types -$container.on("click", ".btn-logarithmic", function() { +$container.on("click", ".btn-logarithmic", function () { ee.emit("fadetype", "logarithmic"); toggleActive(this); }); -$container.on("click", ".btn-linear", function() { +$container.on("click", ".btn-linear", function () { ee.emit("fadetype", "linear"); toggleActive(this); }); -$container.on("click", ".btn-scurve", function() { +$container.on("click", ".btn-scurve", function () { ee.emit("fadetype", "sCurve"); toggleActive(this); }); -$container.on("click", ".btn-exponential", function() { +$container.on("click", ".btn-exponential", function () { ee.emit("fadetype", "exponential"); toggleActive(this); }); //zoom buttons -$container.on("click", ".btn-zoom-in", function() { +$container.on("click", ".btn-zoom-in", function () { ee.emit("zoomin"); }); -$container.on("click", ".btn-zoom-out", function() { +$container.on("click", ".btn-zoom-out", function () { ee.emit("zoomout"); }); -$container.on("click", ".btn-trim-audio", function() { +$container.on("click", ".btn-trim-audio", function () { ee.emit("trim"); }); -$container.on("click", ".btn-info", function() { +$container.on("click", ".btn-info", function () { console.log(playlist.getInfo()); }); @@ -217,21 +217,21 @@ $container.on("change", ".select-seek-style", function (node) { }); //track drop -$container.on("dragenter", ".track-drop", function(e) { +$container.on("dragenter", ".track-drop", function (e) { e.preventDefault(); e.target.classList.add("drag-enter"); }); -$container.on("dragover", ".track-drop", function(e) { +$container.on("dragover", ".track-drop", function (e) { e.preventDefault(); }); -$container.on("dragleave", ".track-drop", function(e) { +$container.on("dragleave", ".track-drop", function (e) { e.preventDefault(); e.target.classList.remove("drag-enter"); }); -$container.on("drop", ".track-drop", function(e) { +$container.on("drop", ".track-drop", function (e) { e.preventDefault(); e.target.classList.remove("drag-enter"); @@ -242,17 +242,33 @@ $container.on("drop", ".track-drop", function(e) { } }); -$container.on("change", ".time-format", function(e) { +$container.on("change", ".time-format", function (e) { format = $timeFormat.val(); updateSelect(startTime, endTime); updateTime(audioPos); }); -$container.on("input change", ".master-gain", function(node){ +$container.on("input change", ".master-gain", function (node) { ee.emit("mastervolumechange", node.target.value); }); +$container.on("input change", ".speed-slider", function (node) { + document.getElementById('speedValue').value = node.target.value; + ee.emit("speedchange", node.target.value); + displaySoundStatus("Playback speed is now " + node.target.value + "x !"); +}); + +$container.on('click', ".set-loop-number", function () { + ee.emit("loopnumber", document.getElementById("loopValue").value); +}); + +$container.on("click", ".btn-speed-change", function () { + var value = document.getElementById('speedValue').value; + ee.emit("speedchange", value); + displaySoundStatus("Playback speed is now " + value + "x !"); +}); + function displaySoundStatus(status) { $(".sound-status").html(status); } @@ -277,32 +293,32 @@ function displayDownloadLink(link) { /* -* Code below receives updates from the playlist. -*/ + * Code below receives updates from the playlist. + */ ee.on("select", updateSelect); ee.on("timeupdate", updateTime); -ee.on("mute", function(track) { +ee.on("mute", function (track) { displaySoundStatus("Mute button pressed for " + track.name); }); -ee.on("solo", function(track) { +ee.on("solo", function (track) { displaySoundStatus("Solo button pressed for " + track.name); }); -ee.on("volumechange", function(volume, track) { +ee.on("volumechange", function (volume, track) { displaySoundStatus(track.name + " now has volume " + volume + "."); }); -ee.on("mastervolumechange", function(volume) { +ee.on("mastervolumechange", function (volume) { displaySoundStatus("Master volume now has volume " + volume + "."); }); var audioStates = ["uninitialized", "loading", "decoding", "finished"]; -ee.on("audiorequeststatechange", function(state, src) { +ee.on("audiorequeststatechange", function (state, src) { var name = src; if (src instanceof File) { @@ -312,7 +328,7 @@ ee.on("audiorequeststatechange", function(state, src) { displayLoadingData("Track " + name + " is in state " + audioStates[state]); }); -ee.on("loadprogress", function(percent, src) { +ee.on("loadprogress", function (percent, src) { var name = src; if (src instanceof File) { @@ -322,16 +338,16 @@ ee.on("loadprogress", function(percent, src) { displayLoadingData("Track " + name + " has loaded " + percent + "%"); }); -ee.on("audiosourcesloaded", function() { +ee.on("audiosourcesloaded", function () { displayLoadingData("Tracks have all finished decoding."); }); -ee.on("audiosourcesrendered", function() { +ee.on("audiosourcesrendered", function () { displayLoadingData("Tracks have been rendered"); }); ee.on('audiorenderingfinished', function (type, data) { - if (type == 'wav'){ + if (type == 'wav') { if (downloadUrl) { window.URL.revokeObjectURL(downloadUrl); } @@ -344,3 +360,14 @@ ee.on('audiorenderingfinished', function (type, data) { ee.on('finished', function () { console.log("The cursor has reached the end of the selection !"); }); + +ee.on('speedchanged', function (speed) { + document.getElementById('speedValue').value = speed; + document.querySelector(".speed-slider").value = speed; + displaySoundStatus("Received speed : " + speed + "x "); +}); + +ee.on('newloop', function (number) { + //document.getElementById("loopValue").value = number; + displaySoundStatus(number + " remaining loop ..."); +}); diff --git a/ghpages/js/exclusivesolo.js b/ghpages/js/exclusivesolo.js index ece8d325..ea681680 100644 --- a/ghpages/js/exclusivesolo.js +++ b/ghpages/js/exclusivesolo.js @@ -32,6 +32,6 @@ playlist.load([ "src": "media/audio/BassDrums30.mp3", "name": "Drums" } -]).then(function() { +]).then(function () { //can do stuff with the playlist. }); diff --git a/ghpages/js/multi-channel.js b/ghpages/js/multi-channel.js index 2bd80b94..fd380507 100644 --- a/ghpages/js/multi-channel.js +++ b/ghpages/js/multi-channel.js @@ -18,6 +18,6 @@ playlist.load([ src: "media/audio/BassDrums30.mp3", name: "Bass & Drums" } -]).then(function() { +]).then(function () { //can do stuff with the playlist. }); diff --git a/src/Playlist.js b/src/Playlist.js index e638ae7a..b4acaec9 100644 --- a/src/Playlist.js +++ b/src/Playlist.js @@ -1,21 +1,14 @@ import _defaults from 'lodash.defaults'; - import h from 'virtual-dom/h'; import diff from 'virtual-dom/diff'; import patch from 'virtual-dom/patch'; - import InlineWorker from 'inline-worker'; - import { pixelsToSeconds } from './utils/conversions'; - import LoaderFactory from './track/loader/LoaderFactory'; - import ScrollHook from './render/ScrollHook'; - import TimeScale from './TimeScale'; import Track from './Track'; import Playout from './Playout'; - import RecorderWorkerFunction from './utils/recorderWorker'; import ExportWavWorkerFunction from './utils/exportWavWorker'; @@ -34,6 +27,7 @@ export default class { this.fadeType = 'logarithmic'; this.masterGain = 1; + this.speed = 1; } // TODO extract into a plugin @@ -142,6 +136,14 @@ export default class { setUpEventEmitter() { const ee = this.ee; + ee.on('speedchange', (speed) => { + this.setSpeed(speed); + }); + + ee.on('loopnumber', (number) => { + this.setLoop(number); + }); + ee.on('select', (start, end, track) => { if (this.isPlaying()) { this.lastSeeked = start; @@ -339,6 +341,7 @@ export default class { track.setState(this.getState()); track.setStartTime(start); track.setPlayout(playout); + track.setSpeed(1); track.setGainLevel(gain); @@ -365,8 +368,8 @@ export default class { } /* - track instance of Track. - */ + track instance of Track. + */ setActiveTrack(track) { this.activeTrack = track; } @@ -380,8 +383,8 @@ export default class { } /* - start, end in seconds. - */ + start, end in seconds. + */ setTimeSelection(start = 0, end) { this.timeSelection = { start, @@ -411,8 +414,8 @@ export default class { }); /* - TODO cleanup of different audio playouts handling. - */ + TODO cleanup of different audio playouts handling. + */ this.offlineAudioContext.startRendering().then((audioBuffer) => { if (type === 'buffer') { this.ee.emit('audiorenderingfinished', type, audioBuffer); @@ -491,6 +494,19 @@ export default class { }); } + setLoop(number) { + this.loopNumber = number; + } + + + setSpeed(speed) { + this.speed = (speed >= 0.5 && speed <= 4) ? speed : 1; + if (this.isPlaying()) { + this.restartPlayFrom(this.playbackSeconds); + } + this.ee.emit('speedchanged', this.speed); + } + muteTrack(track) { const index = this.mutedTracks.indexOf(track); @@ -553,8 +569,8 @@ export default class { } /* - * returns the current point of time in the playlist in seconds. - */ + * returns the current point of time in the playlist in seconds. + */ getCurrentTime() { const cursorPos = this.lastSeeked || this.pausedAt || this.cursor; @@ -596,6 +612,7 @@ export default class { } this.tracks.forEach((track) => { + track.setSpeed(this.speed); track.setState('cursor'); playoutPromises.push(track.schedulePlay(currentTime, start, end, { shouldPlay: this.shouldTrackPlay(track), @@ -719,8 +736,8 @@ export default class { } /* - * Animation function for the playlist. - */ + * Animation function for the playlist. + */ updateEditor(cursor) { const currentTime = this.ac.currentTime; let playbackSeconds = 0; @@ -730,15 +747,23 @@ export default class { const elapsed = currentTime - this.lastDraw; if (this.isPlaying()) { - playbackSeconds = cursorPos + elapsed; + playbackSeconds = cursorPos + (elapsed * this.speed); this.ee.emit('timeupdate', playbackSeconds); this.animationRequest = window.requestAnimationFrame( this.updateEditor.bind(this, playbackSeconds), ); } else { - if ((cursorPos + elapsed) >= - (this.isSegmentSelection()) ? selection.end : this.duration) { - this.ee.emit('finished'); + if ((cursorPos + elapsed) >= (this.isSegmentSelection()) ? selection.end : this.duration) { + if (this.loopNumber > 0) { + this.loopNumber -= 1; + this.ee.emit('newloop', this.loopNumber); + this.restartPlayFrom(selection.start, selection.end); + } else if (this.loopNumber === -1) { + this.ee.emit('newloop', this.loopNumber); + this.restartPlayFrom(selection.start, selection.end); + } else { + this.ee.emit('finished'); + } } this.stopAnimation(); @@ -786,7 +811,6 @@ export default class { isActiveTrack(track) { const activeTrack = this.getActiveTrack(); - if (this.isSegmentSelection()) { return activeTrack === track; } diff --git a/src/Playout.js b/src/Playout.js index 7b932565..c4ef925e 100644 --- a/src/Playout.js +++ b/src/Playout.js @@ -98,14 +98,19 @@ export default class { } } + setSpeed(speed) { + this.speed = speed; + } + /* - source.start is picky when passing the end time. - If rounding error causes a number to make the source think - it is playing slightly more samples than it has it won't play at all. - Unfortunately it doesn't seem to work if you just give it a start time. - */ + source.start is picky when passing the end time. + If rounding error causes a number to make the source think + it is playing slightly more samples than it has it won't play at all. + Unfortunately it doesn't seem to work if you just give it a start time. + */ play(when, start, duration) { this.source.start(when, start, duration); + this.source.playbackRate.value = this.speed; } stop(when = 0) { diff --git a/src/TimeScale.js b/src/TimeScale.js index 0d348611..74c3bb30 100644 --- a/src/TimeScale.js +++ b/src/TimeScale.js @@ -1,5 +1,4 @@ import h from 'virtual-dom/h'; - import { secondsToPixels } from './utils/conversions'; import TimeScaleHook from './render/TimeScaleHook'; @@ -73,8 +72,8 @@ class TimeScale { } /* - Return time in format mm:ss - */ + Return time in format mm:ss + */ static formatTime(milliseconds) { const seconds = milliseconds / 1000; let s = seconds % 60; diff --git a/src/Track.js b/src/Track.js index 5133ef91..73cb8906 100644 --- a/src/Track.js +++ b/src/Track.js @@ -1,15 +1,11 @@ import _assign from 'lodash.assign'; import _forOwn from 'lodash.forown'; - import uuid from 'uuid'; import h from 'virtual-dom/h'; - import extractPeaks from 'webaudio-peaks'; import { FADEIN, FADEOUT } from 'fade-maker'; - import { secondsToPixels, secondsToSamples } from './utils/conversions'; import stateClasses from './track/states'; - import CanvasHook from './render/CanvasHook'; import FadeCanvasHook from './render/FadeCanvasHook'; import VolumeSliderHook from './render/VolumeSliderHook'; @@ -23,12 +19,12 @@ export default class { this.customClass = undefined; this.waveOutlineColor = undefined; this.gain = 1; + this.speed = 1; this.fades = {}; this.peakData = { type: 'WebAudio', mono: false, }; - this.cueIn = 0; this.cueOut = 0; this.duration = 0; @@ -64,8 +60,8 @@ export default class { } /* - * start, end in seconds relative to the entire playlist. - */ + * start, end in seconds relative to the entire playlist. + */ trim(start, end) { const trackStart = this.getStartTime(); const trackEnd = this.getEndTime(); @@ -222,6 +218,10 @@ export default class { this.playout.setMasterGainLevel(level); } + setSpeed(speed) { + this.speed = speed; + } + /* startTime, endTime in seconds (float). segment is for a highlighted section in the UI. @@ -229,6 +229,7 @@ export default class { returns a Promise that will resolve when the AudioBufferSource is either stopped or plays out naturally. */ + schedulePlay(now, startTime, endTime, config) { let start; let duration; @@ -247,7 +248,7 @@ export default class { // 1) track has no content to play. // 2) track does not play in this selection. if ((this.endTime <= startTime) || (segment && (startTime + segment) < this.startTime)) { - // return a resolved promise since this track is technically "stopped". + // return a resolved promise since this track is technically 'stopped'. return Promise.resolve(); } @@ -257,7 +258,7 @@ export default class { if (this.startTime >= startTime) { start = 0; // schedule additional delay for this audio node. - when += (this.startTime - startTime); + when += (this.startTime - startTime) / this.speed; if (endTime) { segment -= (this.startTime - startTime); @@ -288,11 +289,11 @@ export default class { // only apply fade if it's ahead of the cursor. if (relPos < fade.end) { if (relPos <= fade.start) { - fadeStart = now + (fade.start - relPos); - fadeDuration = fade.end - fade.start; + fadeStart = now + ((fade.start - relPos) / this.speed); + fadeDuration = ((fade.end - fade.start) / this.speed); } else if (relPos > fade.start && relPos < fade.end) { - fadeStart = now - (relPos - fade.start); - fadeDuration = fade.end - fade.start; + fadeStart = now - ((relPos - fade.start) / this.speed); + fadeDuration = ((fade.end - fade.start) / this.speed); } switch (fade.type) { @@ -311,6 +312,7 @@ export default class { } }); + playoutSystem.setSpeed(this.speed); playoutSystem.setVolumeGainLevel(this.gain); playoutSystem.setShouldPlay(options.shouldPlay); playoutSystem.setMasterGainLevel(options.masterGain); diff --git a/src/render/FadeCanvasHook.js b/src/render/FadeCanvasHook.js index 66be13b1..98d706a4 100644 --- a/src/render/FadeCanvasHook.js +++ b/src/render/FadeCanvasHook.js @@ -2,8 +2,8 @@ import { FADEIN, FADEOUT, SCURVE, LINEAR, EXPONENTIAL, LOGARITHMIC } from 'fade- import { sCurve, logarithmic, linear, exponential } from 'fade-curves'; /* -* virtual-dom hook for drawing the fade curve to the canvas element. -*/ + * virtual-dom hook for drawing the fade curve to the canvas element. + */ class FadeCanvasHook { constructor(type, shape, duration, samplesPerPixel) { this.type = type; diff --git a/src/track/loader/BlobLoader.js b/src/track/loader/BlobLoader.js index 600b6cd0..382c66d8 100644 --- a/src/track/loader/BlobLoader.js +++ b/src/track/loader/BlobLoader.js @@ -3,8 +3,8 @@ import Loader from './Loader'; export default class extends Loader { /* - * Loads an audio file via a FileReader - */ + * Loads an audio file via a FileReader + */ load() { return new Promise((resolve, reject) => { if (this.src.type.match(/audio.*/) || diff --git a/src/utils/recorderWorker.js b/src/utils/recorderWorker.js index 096b56ac..f4809162 100644 --- a/src/utils/recorderWorker.js +++ b/src/utils/recorderWorker.js @@ -2,8 +2,8 @@ export default function () { // http://jsperf.com/typed-array-min-max/2 // plain for loop for finding min/max is way faster than anything else. /** - * @param {TypedArray} array - Subarray of audio to calculate peaks from. - */ + * @param {TypedArray} array - Subarray of audio to calculate peaks from. + */ function findMinMax(array) { let min = Infinity; let max = -Infinity; @@ -26,9 +26,9 @@ export default function () { } /** - * @param {Number} n - peak to convert from float to Int8, Int16 etc. - * @param {Number} bits - convert to #bits two's complement signed integer - */ + * @param {Number} n - peak to convert from float to Int8, Int16 etc. + * @param {Number} bits - convert to #bits two's complement signed integer + */ function convert(n, bits) { const max = 2 ** (bits - 1); const v = n < 0 ? (n * max) : (n * max) - 1; @@ -36,9 +36,9 @@ export default function () { } /** - * @param {TypedArray} channel - Audio track frames to calculate peaks from. - * @param {Number} samplesPerPixel - Audio frames per peak - */ + * @param {TypedArray} channel - Audio track frames to calculate peaks from. + * @param {Number} samplesPerPixel - Audio frames per peak + */ function extractPeaks(channel, samplesPerPixel, bits) { const chanLength = channel.length; const numPeaks = Math.ceil(chanLength / samplesPerPixel); @@ -94,11 +94,11 @@ export default function () { } /** - * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations. - * @param {Number} samplesPerPixel - Number of audio samples per peak. - * @param {Number} cueIn - index in channel to start peak calculations from. - * @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive). - */ + * @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations. + * @param {Number} samplesPerPixel - Number of audio samples per peak. + * @param {Number} cueIn - index in channel to start peak calculations from. + * @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive). + */ function audioPeaks(source, samplesPerPixel = 10000, isMono = true, cueIn, cueOut, bits = 8) { if ([8, 16, 32].indexOf(bits) < 0) { throw new Error('Invalid number of bits specified for peaks.');