diff --git a/build/pegs_expr_parser.js b/build/pegs_expr_parser.js index 750b768..92a0d09 100644 --- a/build/pegs_expr_parser.js +++ b/build/pegs_expr_parser.js @@ -152,100 +152,112 @@ Webvs.PegExprParser = (function(){ return cachedResult.result; } - var result0, result1, result2, result3, result4, result5, result6; + var result0, result1, result2, result3, result4, result5, result6, result7; var pos0, pos1, pos2; pos0 = clone(pos); pos1 = clone(pos); - result0 = parse_statement(); + result0 = parse___(); if (result0 !== null) { - result1 = parse___(); + result1 = parse_statement(); if (result1 !== null) { - result2 = []; - pos2 = clone(pos); - if (input.charCodeAt(pos.offset) === 59) { - result3 = ";"; - advance(pos, 1); - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\";\""); + result2 = parse___(); + if (result2 !== null) { + result3 = []; + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 59) { + result4 = ";"; + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("\";\""); + } } - } - if (result3 !== null) { - result4 = parse___(); if (result4 !== null) { - result5 = parse_statement(); + result5 = parse___(); if (result5 !== null) { - result6 = parse___(); + result6 = parse_statement(); if (result6 !== null) { - result3 = [result3, result4, result5, result6]; + result7 = parse___(); + if (result7 !== null) { + result4 = [result4, result5, result6, result7]; + } else { + result4 = null; + pos = clone(pos2); + } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } - } else { - result3 = null; - pos = clone(pos2); - } - while (result3 !== null) { - result2.push(result3); - pos2 = clone(pos); - if (input.charCodeAt(pos.offset) === 59) { - result3 = ";"; - advance(pos, 1); - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\";\""); + while (result4 !== null) { + result3.push(result4); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 59) { + result4 = ";"; + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("\";\""); + } } - } - if (result3 !== null) { - result4 = parse___(); if (result4 !== null) { - result5 = parse_statement(); + result5 = parse___(); if (result5 !== null) { - result6 = parse___(); + result6 = parse_statement(); if (result6 !== null) { - result3 = [result3, result4, result5, result6]; + result7 = parse___(); + if (result7 !== null) { + result4 = [result4, result5, result6, result7]; + } else { + result4 = null; + pos = clone(pos2); + } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } - } else { - result3 = null; - pos = clone(pos2); } - } - if (result2 !== null) { - if (input.charCodeAt(pos.offset) === 59) { - result3 = ";"; - advance(pos, 1); - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - result3 = result3 !== null ? result3 : ""; if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (input.charCodeAt(pos.offset) === 59) { + result4 = ";"; + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("\";\""); + } + } + result4 = result4 !== null ? result4 : ""; + if (result4 !== null) { + result5 = parse___(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } } else { result0 = null; pos = clone(pos1); @@ -264,8 +276,8 @@ Webvs.PegExprParser = (function(){ } if (result0 !== null) { result0 = (function(offset, line, column, p) { - var stmts = [p[0]]; - stmts = stmts.concat(_.map(p[2], function(pp) { + var stmts = [p[1]]; + stmts = stmts.concat(_.map(p[3], function(pp) { return pp[2]; })); return new Webvs.AstProgram(stmts); diff --git a/build/webvs.js b/build/webvs.js index 903cad2..a896a5e 100644 --- a/build/webvs.js +++ b/build/webvs.js @@ -48,7 +48,7 @@ Webvs.checkRequiredOptions = function(options, requiredOptions) { for(var i in requiredOptions) { var key = requiredOptions[i]; if(!(key in options)) { - throw new Error("Required option " + key + "not found"); + throw new Error("Required option " + key + " not found"); } } }; @@ -183,7 +183,7 @@ Webvs.Promise = Webvs.defineClass(Promise, Object, { */ Webvs.joinPromises = function(promises) { var joinedPromise = new Promise(); - + promises = _.filter(promises, function(p) {return !_.isUndefined(p);}); if(promises.length === 0) { joinedPromise.resolve(); } else { @@ -262,6 +262,14 @@ Webvs.clamp = function(num, min, max) { return Math.min(Math.max(num, min), max); }; +Webvs.getComponentClass = function(name) { + var componentClass = Webvs[name]; + if(!componentClass) { + throw new Error("Unknown Component class " + name); + } + return componentClass; +}; + })(window); /** @@ -532,38 +540,30 @@ Webvs.Main = Webvs.defineClass(Main, Object, { return; } - var rootComponent = this.rootComponent; - - var that = this; + var _this = this; var drawFrame = function() { - if(that.analyser.isPlaying()) { - rootComponent.update(); + if(_this.analyser.isPlaying()) { + _this.rootComponent.update(); } - that.animReqId = requestAnimationFrame(drawFrame); + _this.animReqId = requestAnimationFrame(drawFrame); }; // wrap drawframe in stats collection if required if(this.stats) { var oldDrawFrame = drawFrame; drawFrame = function() { - that.stats.begin(); + _this.stats.begin(); oldDrawFrame.call(this, arguments); - that.stats.end(); + _this.stats.end(); }; } - if(rootComponent.componentInited) { - this.animReqId = requestAnimationFrame(drawFrame); - } else { + if(!this.rootComponent.componentInited) { this.registerBank = {}; this.bootTime = (new Date()).getTime(); - var promise = rootComponent.init(this.gl, this); - - // start rendering when the promise is done - promise.onResolve(function() { - that.animReqId = requestAnimationFrame(drawFrame); - }); + this.rootComponent.init(this.gl, this); } + this.animReqId = requestAnimationFrame(drawFrame); this.isStarted = true; }, @@ -601,16 +601,9 @@ Webvs.Main = Webvs.defineClass(Main, Object, { * @memberof Webvs.Main# */ addComponent: function(parentId, options, pos) { - this.stop(); options = _.clone(options); // use our own copy - var res = this.rootComponent.addComponent(parentId, options, pos); - if(res) { - var _this = this; - res[1].onResolve(function() { - _this.start(); - }); - return res[0]; - } + this.rootComponent.addComponent(parentId, options, pos); + return res; }, /** @@ -621,29 +614,18 @@ Webvs.Main = Webvs.defineClass(Main, Object, { * @memberof Webvs.Main# */ updateComponent: function(id, options) { - this.stop(); - var _this = this; options = _.clone(options); // use our own copy - if(id != "root") { - var promise = this.rootComponent.updateComponent(); - if(promise) { - promises.onResolve(function() { - _this.start(); - }); - return true; - } - } else { - var factories = this.rootComponent.detachAllComponents(); - var preset = this.rootComponent.preset; + options.id = id; + if(id == "root") { + var subComponents = this.rootComponent.detachAllComponents(); + options = _.defaults(options, this.rootComponent.options); this.rootComponent.destroy(); - this.rootComponent = new EffectList(preset, factories); - _.each(factories, function(factory) { - factory.destroyPool(); - }); - _this.start(); + this.rootComponent = new Webvs.EffectList(options, subComponents); + this.rootComponent.init(this.gl, this); return true; + } else { + return this.rootComponent.updateComponent(id, options); } - return false; }, @@ -654,31 +636,30 @@ Webvs.Main = Webvs.defineClass(Main, Object, { * @memberof Webvs.Main# */ removeComponent: function(id) { - var factory = this.rootComponent.detachComponent(id); - if(factory) { - factory.destroyPool(); + var component = this.rootComponent.detachComponent(id); + if(component) { + component.destroy(); return true; + } else { + return false; } - return false; }, /** * Moves a component to a different parent * @param {string} id - id of the component to be moved * @param {string} newParentId - id of the new parent + * @param {number} pos - position in the new parent * @returns {boolean} - success of the operation * @memberof Webvs.Main# */ - moveComponent: function(id, newParentId) { - var factory = this.rootComponent.detachComponent(id); - if(factory) { - var res = this.rootComponent.addComponent(newParentId, factory); - factory.destroyPool(); - if(res) { - return true; - } + moveComponent: function(id, newParentId, pos) { + var component = this.rootComponent.detachComponent(id); + if(component) { + return this.rootComponent.addComponent(newParentId, component, pos); + } else { + return false; } - return false; }, /** @@ -892,15 +873,14 @@ Webvs.Component = Webvs.defineClass(Component, Object, { * provided then subcomponents are added from this factory and options.components is ignored. * useful when moving existing subcomponent instances into new container. */ -function Container(options, subFactories) { +function Container(options, subComponents) { Container.super.constructor.call(this, options); this.components = []; - this._containerInited = false; // add all the sub components - _.each(subFactories || options.components || [], function(factory) { - this.addComponent(this.id, factory); + _.each(subComponents || options.components || [], function(component) { + this.addComponent(this.id, component); }, this); } @@ -911,19 +891,10 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { */ init: function(gl, main, parent) { Container.super.init.call(this, gl, main, parent); - this._containerInited = true; - - var initPromises = []; - _.each(this.components, function(component) { - doClones(component, function(clone) { - var res = clone.adoptOrInit(gl, main, this); - if(res) { - initPromises.push(res); - } - }, this); - }, this); - return Webvs.joinPromises(initPromises); + for(var i = 0;i < this.components.length;i++) { + this.components[i].adoptOrInit(gl, main, this); + } }, /** @@ -932,25 +903,11 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { */ destroy: function() { Container.super.destroy.call(this); - _.each(this.components, function(component) { - doClones(component, function(clone) { - clone.destroy(); - }); - }); - }, - - /** - * Allows iterating over all the subcomponents, flattening - * out cloned components. - * @param {function} callback - callback - * @memberof Webvs.Container# - */ - iterChildren: function(callback) { for(var i = 0;i < this.components.length;i++) { - doClones(this.components[i], callback, this); + this.components[i].destroy(); } }, - + /** * Adds a component as child of the given parent that * resides under this containers subtree @@ -961,57 +918,38 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { * is implicitly created from it * @param {number} [pos] - position at which the component will be inserted. * default is the end of the list - * @returns {Array} - a pair containing 1) id of the new component 2) promise - * for the new component initialization + * @returns {string} - id of the new component * @memberof Webvs.Container# */ - addComponent: function(parentId, factory, pos) { - if(!(factory instanceof ComponentFactory)) { - // if its an options object, then make a factory - // out of it - factory.id = factory.id || Webvs.randString(5); - factory = new ComponentFactory(factory); + addComponent: function(parentId, options, pos) { + if(!(options instanceof Webvs.Component)) { + options.id = options.id || Webvs.randString(5); } - var component, promises; - // we are at the correct parent + var component; if(parentId == this.id) { - component = factory.get(); - promises = []; + if(options instanceof Webvs.Component) { + component = options; + } else { + component = new (Webvs.getComponentClass(options.type))(options); + } if(this.componentInited) { - doClones(component, function(clone) { - var promise = clone.adoptOrInit(this.gl, this.main, this); - if(promise) { - promises.push(res); - } - }, this); + component.adoptOrInit(this.gl, this.main, this); } - promises = Webvs.joinPromises(promises); if(_.isNumber(pos)) { this.components.splice(pos, 0, component); } else { this.components.push(component); } - return [component.id, promises]; + return component.id; } else { - // try any of the subcontainers and repeat - // on all clones if required for(var i = 0;i < this.components.length;i++) { component = this.components[i]; if(component instanceof Container) { - var res = component.addComponent(parentId, factory, pos); - if(res) { - var id = res[0]; - promises = [res[1]]; - if(component.__clones) { - for(var j = 0;j < component.__clones.length;j++) { - res = component.__clones[j].addComponent(parentId, factory, pos); - promises.push(res[1]); - } - } - promises = Webvs.joinPromises(promises); - return [id, promises]; + var id = component.addComponent(parentId, options, pos); + if(id) { + return id; } } } @@ -1022,63 +960,37 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { * Updates a component under this container's subtree * @param {string} id - id of the component * @param {object} options - options to be updated. - * @returns {Webvs.Promise} - promise for the component reinitialiaztion + * @returns {boolean} - true if update succeeded else false * @memberof Webvs.Container# */ updateComponent: function(id, options) { - var component, componentIndex, promise, i, j; + var component, i; // find the component in this container for(i = 0;i < this.components.length;i++) { - if(this.components[i].id == id) { - component = this.components[i]; - componentIndex = i; + component = this.components[i]; + if(component.id != id) { + continue; } - } - if(component) { - options = _.defaults(options, component.options); // use undefined properties from existing + + options = _.defaults(options, component.options); options.id = id; - // create updated component. detach and move subcomponents if required - var subFactories = component instanceof Container?component.detachAllComponents():undefined; - var newComponent = ComponentFactory.makeComponent(options, subFactories); - if(subFactories) { - // cleanup the detached factories. in case they have more elements - for(j = 0;j < subFactories.length;j++) { - subFactories[j].destroyPool(); - } - } + var subComponents = component instanceof Container?component.detachAllComponents():undefined; + var newComponent = new (Webvs.getComponentClass(options.type))(options, subComponents); - // replace and init the components - var promises = []; if(this.componentInited) { - doClones(newComponent, function(clone) { - promises.push(clone.adoptOrInit(this.gl, this.main, this)); - }, this); + newComponent.adoptOrInit(this.gl, this.main, this); } - promises = Webvs.joinPromises(promises); - - // replace the component - this.components[componentIndex] = newComponent; - - // destroy the old component - doClones(component, function(clone) { - clone.destroy(); - }); - return promises; + this.components[i] = newComponent; + component.destroy(); + return true; } - // if component not in this container - // then try any of the subcomponents - for(i = 0;i < this.component.length;i++) { + for(i = 0;i < this.components.length;i++) { component = this.components[i]; if(component instanceof Container) { - promise = component.updateComponent(id, options); - if(promise) { - promise = [promise]; - for(j = 0;j < component.__clones.length;j++) { - promise.push(component.__clones[j].updateComponent(id, options)); - } - return Webvs.joinPromises(promise); + if(component.updateComponent(id, options)) { + return true; } } } @@ -1090,11 +1002,9 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { * @memberof Webvs.Container# */ detachAllComponents: function() { - var detached = _.map(this.components, function(component) { - return new ComponentFactory(component.options, [component]); - }); + var components = this.components; this.components = []; - return detached; + return components; }, /** @@ -1110,7 +1020,7 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { component = this.components[i]; if(component.id == id) { this.components.splice(i, 1); - return new ComponentFactory(component.options, [component]); + return component; } } @@ -1119,16 +1029,9 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { for(i = 0;i < this.components.length;i++) { component = this.components[i]; if(component instanceof Container) { - var factory = component.detachComponent(id); - if(factory) { - if(component.__clones) { - factory = [factory]; - for(var j = 0;j < component.__clones.length;j++) { - factory.push(component.__clones[j].detachComponent(id)); - } - factory = ComponentFactory.merge(factory); - } - return factory; + var detached = component.detachComponent(id); + if(detached) { + return detached; } } } @@ -1156,7 +1059,8 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { */ traverse: function(callback) { callback.call(this, this.id, (this.parent?this.parent.id:undefined), this.options); - _.each(this.components, function(component) { + for(var i = 0;i < this.components.length;i++) { + var component = this.components[i]; if(component instanceof Container) { component.traverse(callback); } else { @@ -1165,7 +1069,7 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { var options = component.options; callback.call(component, id, parentId, options); } - }); + } } /** @@ -1177,106 +1081,6 @@ Webvs.Container = Webvs.defineClass(Container, Webvs.Component, { */ }); -/** - * @class - * A Helper class for creating/reusing component instances - * consistently. Basically this provides a facility for - * giving out component instances from a pool. New instances - * are created for requests that come after the pool is exhausted. - * @constructor - * @memberof Webvs - * @param {object} options - options for the component. this will be used when creating - * new instances - * @param {Array.} pool - pool of used components - */ -function ComponentFactory(options, pool) { - this.options = options; - this.pool = pool || []; -} -Webvs.ComponentFactory = Webvs.defineClass(ComponentFactory, Object, { - /** - * Gives out a component instance from the pool. Creates one - * if pool is empty - * @param {Array.} [subFactories] - factories for sub-components when - * creating containers. - * @memberof Webvs.ComponentFactory# - */ - get: function(subFactories) { - if(this.pool.length > 0) { - return this.pool.pop(); - } else { - return ComponentFactory.makeComponent(this.options, subFactories); - } - }, - - /** - * Destroys all components in the pool and empties it - * @memberof Webvs.ComponentFactory# - */ - destroyPool: function() { - _.each(this.pool, function(component) { - doClones(component, function(clone) { - clone.destroy(); - }); - }); - this.pool = []; - } -}); -/** - * Creates a new component instance, and its clones, if required. Clones - * are conveniently tucked away inside one component, so that a component - * can be moved around as if it is a single component. - * @param {object} options - options for the component - * @param {Array.} subFactories - factories for sub-components when - * creating containers. - * @memberof Webvs.ComponentFactory - */ -ComponentFactory.makeComponent = function(options, subFactories) { - var componentClass = Webvs[options.type]; - if(!componentClass) { - throw new Error("Unknown Component class " + options.type); - } - - var component = new componentClass(options, subFactories); - - var count = _.isNumber(options.clone)?options.clone:1; - count--; - if(count) { - var clones = []; - _.times(count, function(index) { - var clone = new componentClass(options, subFactories); - clone.cloneId = index + 1; - clones.push(clone); - }); - component.cloneId = 0; - component.__clones = clones; - } - - return component; -}; -/** - * Merges several Webvs.ComponentFactory into one with a merged pool - * @param {Array.} factories - factories to be merged - * @memberof Webvs.ComponentFactory - */ -ComponentFactory.merge = function(factories) { - var pool = []; - _.each(factories, function(factory) { - pool = pool.concat(factory.pool); - }); - return new ComponentFactory(factories[0].options, pool); -}; - -// this function lets us iterate over a component and its clones -function doClones(component, callback, context) { - callback.call(context, component); - if(component.__clones) { - for(var i = 0;i < component.__clones.length;i++) { - callback.call(context, component.__clones[i]); - } - } -} - })(Webvs); /** @@ -1326,8 +1130,7 @@ function EffectList(options) { this._inited = false; var codeGen = new Webvs.ExprCodeGenerator(options.code, ["beat", "enabled", "clear", "w", "h", "cid"]); - var genResult = codeGen.generateCode(["init", "perFrame"], [], []); - this.code = genResult[0]; + this.code = codeGen.generateJs(["init", "perFrame"]); EffectList.super.constructor.apply(this, arguments); } @@ -1339,14 +1142,12 @@ Webvs.EffectList = Webvs.defineClass(EffectList, Webvs.Container, { * @memberof Webvs.EffectList# */ init: function(gl, main, parent) { - var promises = EffectList.super.init.call(this, gl, main, parent); + EffectList.super.init.call(this, gl, main, parent); this.code.setup(main, this); // create a framebuffer manager for this effect list - this.fm = new Webvs.FrameBufferManager(main.canvas.width, main.canvas.height, gl, main.copier); - - return promises; + this.fm = new Webvs.FrameBufferManager(main.canvas.width, main.canvas.height, gl, main.copier, parent?true:false); }, /** @@ -1400,11 +1201,11 @@ Webvs.EffectList = Webvs.defineClass(EffectList, Webvs.Container, { } // render all the components - this.iterChildren(function(component) { - if(component.enabled) { - component.update(); + for(var i = 0;i < this.components.length;i++) { + if(this.components[i].enabled) { + this.components[i].update(); } - }); + } // switch to old framebuffer this.fm.restoreRenderTarget(); @@ -2002,31 +1803,34 @@ Webvs.CopyProgram = Webvs.defineClass(CopyProgram, Webvs.QuadBoxProgram, { /** * @class * FrameBufferManager maintains a set of render targets - * and switches between them, when requested by different - * shader programs. Its used in EffectLists to compose rendering - * of the different {@link Webvs.Component} + * and can switch between them. * * @param {number} width - the width of the textures to be initialized * @param {number} height - the height of the textures to be initialized * @param {WebGLRenderingContext} gl - the webgl context to be used * @param {Webvs.CopyProgram} copier - an instance of a CopyProgram that should be used * when a frame copyOver is required + * @param {boolean} textureOnly - if set then only texture's and renderbuffers are maintained * @constructor * @memberof Webvs */ -function FrameBufferManager(width, height, gl, copier, texCount) { +function FrameBufferManager(width, height, gl, copier, textureOnly, texCount) { this.gl = gl; this.width = width; this.height = height; this.copier = copier; this.texCount = texCount || 2; + this.textureOnly = textureOnly; this._initFrameBuffers(); } Webvs.FrameBufferManager = Webvs.defineClass(FrameBufferManager, Object, { _initFrameBuffers: function() { var gl = this.gl; - var framebuffer = gl.createFramebuffer(); + if(!this.textureOnly) { + this.framebuffer = gl.createFramebuffer(); + } + var attachments = []; for(var i = 0;i < this.texCount;i++) { var texture = gl.createTexture(); @@ -2049,7 +1853,6 @@ Webvs.FrameBufferManager = Webvs.defineClass(FrameBufferManager, Object, { }; } - this.framebuffer = framebuffer; this.frameAttachments = attachments; this.currAttachment = 0; }, @@ -2061,10 +1864,13 @@ Webvs.FrameBufferManager = Webvs.defineClass(FrameBufferManager, Object, { */ setRenderTarget: function() { var gl = this.gl; - this.inputFrameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); - gl.viewport(0, 0, this.width, this.height); + if(this.textureOnly) { + this.oldAttachment = this._getFBAttachment(); + } else { + this.oldFrameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); + gl.viewport(0, 0, this.width, this.height); + } this._setFBAttachment(); }, @@ -2075,8 +1881,11 @@ Webvs.FrameBufferManager = Webvs.defineClass(FrameBufferManager, Object, { */ restoreRenderTarget: function() { var gl = this.gl; - gl.bindFramebuffer(gl.FRAMEBUFFER, this.inputFrameBuffer); - gl.viewport(0, 0, this.width, this.height); + if(this.textureOnly) { + this._setFBAttachment(this.oldAttachment); + } else { + gl.bindFramebuffer(gl.FRAMEBUFFER, this.oldFrameBuffer); + } }, /** @@ -2116,12 +1925,19 @@ Webvs.FrameBufferManager = Webvs.defineClass(FrameBufferManager, Object, { gl.deleteRenderbuffer(this.frameAttachments[i].renderbuffer); gl.deleteTexture(this.frameAttachments[i].texture); } - gl.deleteFramebuffer(this.framebuffer); }, - _setFBAttachment: function() { - var attachment = this.frameAttachments[this.currAttachment]; + _getFBAttachment: function() { + var gl = this.gl; + return { + texture: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME), + renderbuffer: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) + }; + }, + + _setFBAttachment: function(attachment) { + attachment = attachment || this.frameAttachments[this.currAttachment]; var gl = this.gl; gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, attachment.texture, 0); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, attachment.renderbuffer); @@ -2425,100 +2241,112 @@ Webvs.PegExprParser = (function(){ return cachedResult.result; } - var result0, result1, result2, result3, result4, result5, result6; + var result0, result1, result2, result3, result4, result5, result6, result7; var pos0, pos1, pos2; pos0 = clone(pos); pos1 = clone(pos); - result0 = parse_statement(); + result0 = parse___(); if (result0 !== null) { - result1 = parse___(); + result1 = parse_statement(); if (result1 !== null) { - result2 = []; - pos2 = clone(pos); - if (input.charCodeAt(pos.offset) === 59) { - result3 = ";"; - advance(pos, 1); - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\";\""); + result2 = parse___(); + if (result2 !== null) { + result3 = []; + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 59) { + result4 = ";"; + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("\";\""); + } } - } - if (result3 !== null) { - result4 = parse___(); if (result4 !== null) { - result5 = parse_statement(); + result5 = parse___(); if (result5 !== null) { - result6 = parse___(); + result6 = parse_statement(); if (result6 !== null) { - result3 = [result3, result4, result5, result6]; + result7 = parse___(); + if (result7 !== null) { + result4 = [result4, result5, result6, result7]; + } else { + result4 = null; + pos = clone(pos2); + } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } - } else { - result3 = null; - pos = clone(pos2); - } - while (result3 !== null) { - result2.push(result3); - pos2 = clone(pos); - if (input.charCodeAt(pos.offset) === 59) { - result3 = ";"; - advance(pos, 1); - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\";\""); + while (result4 !== null) { + result3.push(result4); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 59) { + result4 = ";"; + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("\";\""); + } } - } - if (result3 !== null) { - result4 = parse___(); if (result4 !== null) { - result5 = parse_statement(); + result5 = parse___(); if (result5 !== null) { - result6 = parse___(); + result6 = parse_statement(); if (result6 !== null) { - result3 = [result3, result4, result5, result6]; + result7 = parse___(); + if (result7 !== null) { + result4 = [result4, result5, result6, result7]; + } else { + result4 = null; + pos = clone(pos2); + } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } } else { - result3 = null; + result4 = null; pos = clone(pos2); } - } else { - result3 = null; - pos = clone(pos2); } - } - if (result2 !== null) { - if (input.charCodeAt(pos.offset) === 59) { - result3 = ";"; - advance(pos, 1); - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - result3 = result3 !== null ? result3 : ""; if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (input.charCodeAt(pos.offset) === 59) { + result4 = ";"; + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("\";\""); + } + } + result4 = result4 !== null ? result4 : ""; + if (result4 !== null) { + result5 = parse___(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } } else { result0 = null; pos = clone(pos1); @@ -2537,8 +2365,8 @@ Webvs.PegExprParser = (function(){ } if (result0 !== null) { result0 = (function(offset, line, column, p) { - var stmts = [p[0]]; - stmts = stmts.concat(_.map(p[2], function(pp) { + var stmts = [p[1]]; + stmts = stmts.concat(_.map(p[3], function(pp) { return pp[2]; })); return new Webvs.AstProgram(stmts); @@ -4541,7 +4369,6 @@ Webvs.CodeInstance = Webvs.defineClass(CodeInstance, Object, { this.w = main.canvas.width; this.h = main.canvas.height; - this.cid = parent.cloneId || 0; // clear all used registers _.each(this._registerUsages, function(name) { @@ -4552,6 +4379,19 @@ Webvs.CodeInstance = Webvs.defineClass(CodeInstance, Object, { } }); +CodeInstance.clone = function(codeInst, count) { + codeInst.cid = 0; + var clones = [codeInst]; + if(count > 1) { + _.times(count-1, function(index) { + var clone = _.clone(codeInst); + clone.cid = index+1; + clones.push(clone); + }); + } + return clones; +}; + })(Webvs); @@ -4572,7 +4412,17 @@ Webvs.CodeInstance = Webvs.defineClass(CodeInstance, Object, { * @constructor */ function ExprCodeGenerator(codeSrc, externalVars) { - this.codeSrc = codeSrc; + this.codeSrc = {}; + for(var key in codeSrc) { + var code = codeSrc[key]; + if(_.isArray(code)) { + code = code.join("\n"); + } + code = code.trim(); + if(code !== "") { + this.codeSrc[key] = code; + } + } this.externalVars = _.union(externalVars || [], ["w", "h", "cid"]); this._parseSrc(); } @@ -4586,9 +4436,6 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { for(var name in this.codeSrc) { try { var codeSrc = this.codeSrc[name]; - if(_.isArray(codeSrc)) { - codeSrc = codeSrc.join("\n"); - } codeAst[name] = Webvs.PegExprParser.parse(codeSrc); var vars = []; var fu = []; @@ -4617,21 +4464,11 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { * @returns {Array} pair containing {@link Webvs.CodeInstance} and a glsl code * @memberof Webvs.ExprCodeGenerator# */ - generateCode: function(jsFuncs, glslFuncs, treatAsNonUniform) { - var inst = new Webvs.CodeInstance(); - var that = this; - var glsl = []; + generateJs: function(jsFuncs) { + var codeInst = new Webvs.CodeInstance(); _.each(this.instanceVars, function(ivar) { - // clear instance variables in code instance - inst[ivar] = 0; - - // create declarations for instance variables in glsl - var prefix = ""; - if(!_.contains(treatAsNonUniform, ivar)) { - prefix = "uniform "; - } - glsl.push(prefix + "float " + ivar + ";"); + codeInst[ivar] = 0; }); var jsFuncList = _.intersection(_.keys(this.codeAst), jsFuncs); @@ -4639,61 +4476,79 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { // generate javascript functions and assign to code instance _.each(jsFuncList, function(name) { - var ast = that.codeAst[name]; - var codeString = that._generateJs(ast); - inst[name] = new Function(codeString); - }); + var ast = this.codeAst[name]; + var codeString = this._generateJs(ast); + codeInst[name] = new Function(codeString); + }, this); // add noops for missing expressions _.each(missingJsFuncList, function(name) { - inst[name] = Webvs.noop; + codeInst[name] = Webvs.noop; + }); + + codeInst._registerUsages = this.registerUsages; + + return codeInst; + }, + + generateGlsl: function(glslFuncs, treatAsNonUniform, codeInst) { + var glsl = []; + treatAsNonUniform = treatAsNonUniform || []; + + _.each(this.instanceVars, function(ivar) { + // create declarations for instance variables in glsl + var prefix = ""; + if(!_.contains(treatAsNonUniform, ivar)) { + prefix = "uniform "; + } + glsl.push(prefix + "float " + ivar + ";"); }); var glslFuncList = _.intersection(_.keys(this.codeAst), glslFuncs); var missingGlslFuncList = _.difference(glslFuncs, glslFuncList); var glsFuncUsages = _.uniq( - _.flatMap(glslFuncList, function(name) { return that.funcUsages[name]; }) + _.flatMap(glslFuncList, function(name) { return this.funcUsages[name]; }, this) ); // include required functions in glsl _.each(glsFuncUsages, function(usage) { - var code = that.glslFuncCode[usage]; + var code = this.glslFuncCode[usage]; if(!code) { return; } glsl.push(code); - }); + }, this); var preCompute = []; // list of precomputed bindings var generatedGlslFuncs = []; // generate glsl functions _.each(glslFuncList, function(name) { - var ast = that.codeAst[name]; - var codeString = that._generateGlsl(ast, preCompute); + var ast = this.codeAst[name]; + var codeString = this._generateGlsl(ast, preCompute); generatedGlslFuncs.push("void " + name + "() {"); generatedGlslFuncs.push(codeString); generatedGlslFuncs.push("}"); - }); + }, this); // add the uniform declarations for precomputed functions glsl = glsl.concat(_.map(preCompute, function(item) { return "uniform float " + item[1] + ";"; })); glsl = glsl.concat(generatedGlslFuncs); - inst._preCompute = preCompute; // generate noops for missing functions _.each(missingGlslFuncList, function(name) { glsl.push("void " + name + "() {}"); }); + // create required bindings in the code instance + codeInst._preCompute = preCompute; if(_.contains(glslFuncList, "rand")) { - inst.hasRandom = true; + codeInst.hasRandom = true; } if(_.contains(glslFuncList, "gettime")) { - inst.hasGettime = true; + codeInst.hasGettime = true; } - inst._treatAsNonUniform = treatAsNonUniform; - inst._registerUsages = this.registerUsages; + codeInst._treatAsNonUniform = treatAsNonUniform; - return [inst, glsl.join("")]; + return glsl.join("\n"); }, funcArgLengths: { @@ -4768,7 +4623,6 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { }, _generateGlsl: function(ast, preCompute) { - var that = this; if(ast instanceof Webvs.AstBinaryExpr) { return "(" + this._generateGlsl(ast.leftOperand, preCompute) + ast.operator + this._generateGlsl(ast.rightOperand, preCompute) + ")"; @@ -4815,6 +4669,7 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { ].join(""); case "select": var selectExpr = this._generateGlsl(ast.args[0], preCompute); + var that = this; var generateSelect = function(args, i) { if(args.length == 1) { return that._generateGlsl(args[0], preCompute); @@ -4856,7 +4711,7 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { } return uniformName; default: - var args = _.map(ast.args, function(arg) {return that._generateGlsl(arg, preCompute);}).join(","); + var args = _.map(ast.args, function(arg) {return this._generateGlsl(arg, preCompute);}, this).join(","); var funcName = ast.funcName; if(_.contains(this.varArgFuncs, ast.funcName)) { funcName += ast.args.length; @@ -4868,7 +4723,7 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { return this._generateGlsl(ast.lhs, preCompute) + "=" + this._generateGlsl(ast.expr, preCompute); } if(ast instanceof Webvs.AstProgram) { - var stmts = _.map(ast.statements, function(stmt) {return that._generateGlsl(stmt, preCompute);}); + var stmts = _.map(ast.statements, function(stmt) {return this._generateGlsl(stmt, preCompute);}, this); return stmts.join(";\n")+";"; } if(ast instanceof Webvs.AstPrimaryExpr && ast.type === "VALUE") { @@ -4884,7 +4739,6 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { _generateJs: function(ast) { var prefix; - var that = this; if(ast instanceof Webvs.AstBinaryExpr) { return "(" + this._generateJs(ast.leftOperand) + ast.operator + this._generateJs(ast.rightOperand) + ")"; @@ -4951,7 +4805,7 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { case "atan2": return "(Math.atan(("+this._generateJs(ast.args[0])+")/("+this._generateJs(ast.args[1])+")))"; default: - var args = _.map(ast.args, function(arg) {return that._generateJs(arg);}).join(","); + var args = _.map(ast.args, function(arg) {return this._generateJs(arg);}, this).join(","); if(_.contains(this.jsMathFuncs, ast.funcName)) { prefix = "Math."; } else { @@ -4964,7 +4818,7 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { return this._generateJs(ast.lhs) + "=" + this._generateJs(ast.expr); } if(ast instanceof Webvs.AstProgram) { - var stmts = _.map(ast.statements, function(stmt) {return that._generateJs(stmt);}); + var stmts = _.map(ast.statements, function(stmt) {return this._generateJs(stmt);}, this); return stmts.join(";\n"); } if(ast instanceof Webvs.AstPrimaryExpr && ast.type === "VALUE") { @@ -4982,8 +4836,6 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { }, _getVars: function(ast, vars, funcUsages, regUsages) { - var that = this; - if(ast instanceof Webvs.AstBinaryExpr) { this._getVars(ast.leftOperand, vars, funcUsages, regUsages); this._getVars(ast.rightOperand, vars, funcUsages, regUsages); @@ -4995,8 +4847,8 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { else if(ast instanceof Webvs.AstFuncCall) { funcUsages.push(ast.funcName); _.each(ast.args, function(arg) { - that._getVars(arg, vars, funcUsages, regUsages); - }); + this._getVars(arg, vars, funcUsages, regUsages); + }, this); } else if(ast instanceof Webvs.AstAssignment) { this._getVars(ast.lhs, vars, funcUsages, regUsages); @@ -5004,8 +4856,8 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { } else if(ast instanceof Webvs.AstProgram) { _.each(ast.statements, function(stmt) { - that._getVars(stmt, vars, funcUsages, regUsages); - }); + this._getVars(stmt, vars, funcUsages, regUsages); + }, this); } else if(ast instanceof Webvs.AstPrimaryExpr && ast.type === "ID") { vars.push(ast.value); @@ -5050,8 +4902,7 @@ Webvs.ExprCodeGenerator = Webvs.defineClass(ExprCodeGenerator, Object, { function GlobalVar(options) { Webvs.checkRequiredOptions(options, ["code"]); var codeGen = new Webvs.ExprCodeGenerator(options.code, ["b"]); - var genResult = codeGen.generateCode(["init", "onBeat", "perFrame"], [], []); - this.code = genResult[0]; + this.code = codeGen.generateJs(["init", "onBeat", "perFrame"]); this.inited = false; GlobalVar.super.constructor.apply(this, arguments); @@ -5175,7 +5026,7 @@ Webvs.BufferSave = Webvs.defineClass(BufferSave, Webvs.Component, { // create frame buffer manager if(!main.registerBank[this._bufferId]) { - var fm = new Webvs.FrameBufferManager(main.canvas.width, main.canvas.height, gl, main.copier, 1); + var fm = new Webvs.FrameBufferManager(main.canvas.width, main.canvas.height, gl, main.copier, true, 1); main.registerBank[this._bufferId] = fm; } }, @@ -5920,8 +5771,9 @@ function DynamicMovement(options) { throw new Error("Invalid Dynamic movement code"); } var codeGen = new Webvs.ExprCodeGenerator(codeSrc, ["x", "y", "r", "d", "b"]); - var genResult = codeGen.generateCode(["init", "onBeat", "perFrame"], ["perPixel"], ["x", "y", "d", "r"]); - this.code = genResult[0]; + this.code = codeGen.generateJs(["init", "onBeat", "perFrame"]); + var glslCode = codeGen.generateGlsl(["perPixel"], ["x", "y", "d", "r"], this.code); + this.inited = false; this.noGrid = options.noGrid; @@ -5935,11 +5787,11 @@ function DynamicMovement(options) { if(this.noGrid) { this.program = new Webvs.DMovProgramNG(this.coordMode, this.bFilter, this.compat, this.code.hasRandom, - genResult[1]); + glslCode); } else { this.program = new Webvs.DMovProgram(this.coordMode, this.bFilter, this.compat, this.code.hasRandom, - genResult[1]); + glslCode); } DynamicMovement.super.constructor.apply(this, arguments); @@ -6546,15 +6398,15 @@ function SuperScope(options) { throw new Error("Invalid superscope"); } var codeGen = new Webvs.ExprCodeGenerator(codeSrc, ["n", "v", "i", "x", "y", "b", "red", "green", "blue"]); - var genResult = codeGen.generateCode(["init", "onBeat", "perFrame", "perPoint"], [], []); - this.code = genResult[0]; + this.code = codeGen.generateJs(["init", "onBeat", "perFrame", "perPoint"]); this.code.n = 100; + this.clone = options.clone || 1; this.spectrum = options.source == "SPECTRUM"; this.dots = options.drawMode == "DOTS"; this.colors = _.map(options.colors, Webvs.parseColorNorm); - this.currentColor = this.colors[0]; + this.currentColor = []; this.maxStep = 100; this.step = this.maxStep; // so that we compute steps, the first time @@ -6580,24 +6432,31 @@ Webvs.SuperScope = Webvs.defineClass(SuperScope, Webvs.Component, { SuperScope.super.init.call(this, gl, main, parent); this.program.init(gl); this.code.setup(main, this); + + this.code = Webvs.CodeInstance.clone(this.code, this.clone); + }, + + update: function() { + this._stepColor(); + _.each(this.code, function(code) { + this.drawScope(code, !this.inited); + }, this); + this.inited = true; }, /** * renders the scope * @memberof Webvs.SuperScope# */ - update: function() { + drawScope: function(code, runInit) { var gl = this.gl; - var code = this.code; - this._stepColor(); code.red = this.currentColor[0]; code.green = this.currentColor[1]; code.blue = this.currentColor[2]; - if(!this.inited) { + if(runInit) { code.init(); - this.inited = true; } var beat = this.main.analyser.beat; @@ -6670,13 +6529,17 @@ Webvs.SuperScope = Webvs.defineClass(SuperScope, Webvs.Component, { this.colorStep[i] = (nextColor[i]-curColor[i])/this.maxStep; } this.step = 0; - this.currentColor = curColor; + for(i = 0;i < 3;i++) { + this.currentColor[i] = curColor[i]; + } } else { for(i = 0;i < 3;i++) { this.currentColor[i] += this.colorStep[i]; } this.step++; } + } else { + this.currentColor = this.colors[0]; } } }); @@ -6903,8 +6766,7 @@ function Texer(options) { this.imageSrc = options.imageSrc; var codeGen = new Webvs.ExprCodeGenerator(options.code, ["n", "v", "i", "x", "y", "b", "sizex", "sizey", "red", "green", "blue"]); - var genResult = codeGen.generateCode(["init", "onBeat", "perFrame", "perPoint"], [], []); - this.code = genResult[0]; + this.code = codeGen.generateJs(["init", "onBeat", "perFrame", "perPoint"]); this.code.n = 100; this.spectrum = options.source == "SPECTRUM"; @@ -6927,24 +6789,17 @@ Webvs.Texer = Webvs.defineClass(Texer, Webvs.Component, { this.program.init(gl); this.code.setup(main, this); - var _this = this; var image = new Image(); image.src = main.getResource(this.imageSrc); - var promise = new Webvs.Promise(); - image.onload = function() { - _this.imagewidth = image.width; - _this.imageHeight = image.height; - _this.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, _this.texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - promise.resolve(); - }; - - return promise; + this.imagewidth = image.width; + this.imageHeight = image.height; + this.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, this.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); }, /** @@ -7278,24 +7133,17 @@ Webvs.Picture = Webvs.defineClass(Picture, Webvs.Component, { this.program.init(gl); - var _this = this; var image = new Image(); image.src = main.getResource(this.src); - var promise = new Webvs.Promise(); - image.onload = function() { - _this.width = image.width; - _this.height = image.height; - _this.texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, _this.texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - promise.resolve(); - }; - - return promise; + this.width = image.width; + this.height = image.height; + this.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, this.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); }, /** diff --git a/dist/libs.min.js b/dist/libs.min.js new file mode 100644 index 0000000..cedea3e --- /dev/null +++ b/dist/libs.min.js @@ -0,0 +1 @@ +function FourierTransform(a,b){this.bufferSize=a,this.sampleRate=b,this.bandwidth=2/a*b/2,this.spectrum=new Float32Array(a/2),this.real=new Float32Array(a),this.imag=new Float32Array(a),this.peakBand=0,this.peak=0,this.getBandFrequency=function(a){return this.bandwidth*a+this.bandwidth/2},this.calculateSpectrum=function(){for(var b,c,d,e=this.spectrum,f=this.real,g=this.imag,h=2/this.bufferSize,i=Math.sqrt,j=0,k=a/2;k>j;j++)b=f[j],c=g[j],d=h*i(b*b+c*c),d>this.peak&&(this.peakBand=j,this.peak=d),e[j]=d}}function FFT(a,b){FourierTransform.call(this,a,b),this.reverseTable=new Uint32Array(a);for(var c,d=1,e=a>>1;a>d;){for(c=0;d>c;c++)this.reverseTable[c+d]=this.reverseTable[c]+e;d<<=1,e>>=1}for(this.sinTable=new Float32Array(a),this.cosTable=new Float32Array(a),c=0;a>c;c++)this.sinTable[c]=Math.sin(-Math.PI/c),this.cosTable[c]=Math.cos(-Math.PI/c)}function FourierTransform(a,b){this.bufferSize=a,this.sampleRate=b,this.bandwidth=2/a*b/2,this.spectrum=new Float32Array(a/2),this.real=new Float32Array(a),this.imag=new Float32Array(a),this.peakBand=0,this.peak=0,this.getBandFrequency=function(a){return this.bandwidth*a+this.bandwidth/2},this.calculateSpectrum=function(){for(var b,c,d,e=this.spectrum,f=this.real,g=this.imag,h=2/this.bufferSize,i=Math.sqrt,j=0,k=a/2;k>j;j++)b=f[j],c=g[j],d=h*i(b*b+c*c),d>this.peak&&(this.peakBand=j,this.peak=d),e[j]=d}}function FFT(a,b){FourierTransform.call(this,a,b),this.reverseTable=new Uint32Array(a);for(var c,d=1,e=a>>1;a>d;){for(c=0;d>c;c++)this.reverseTable[c+d]=this.reverseTable[c]+e;d<<=1,e>>=1}for(this.sinTable=new Float32Array(a),this.cosTable=new Float32Array(a),c=0;a>c;c++)this.sinTable[c]=Math.sin(-Math.PI/c),this.cosTable[c]=Math.cos(-Math.PI/c)}(function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=e.toString,k=e.hasOwnProperty,l=d.forEach,m=d.map,n=d.reduce,o=d.reduceRight,p=d.filter,q=d.every,r=d.some,s=d.indexOf,t=d.lastIndexOf,u=Array.isArray,v=Object.keys,w=f.bind,x=function(a){return a instanceof x?a:this instanceof x?(this._wrapped=a,void 0):new x(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):a._=x,x.VERSION="1.5.1";var y=x.each=x.forEach=function(a,b,d){if(null!=a)if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;f>e;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?void 0:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;gd||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;c.call(d,a[h])=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=x.max(x.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=x.pluck(arguments,""+c);return b},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var E=function(){};x.bind=function(a,b){var c,d;if(w&&a.bind===w)return w.apply(a,h.call(arguments,1));if(!x.isFunction(a))throw new TypeError;return c=h.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(h.call(arguments)));E.prototype=a.prototype;var e=new E;E.prototype=null;var f=a.apply(e,c.concat(h.call(arguments)));return Object(f)===f?f:e}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:new Date,g=null,f=a.apply(d,e)};return function(){var j=new Date;h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},x.debounce=function(a,b,c){var d,e=null;return function(){var f=this,g=arguments,h=function(){e=null,c||(d=a.apply(f,g))},i=c&&!e;return clearTimeout(e),e=setTimeout(h,b),i&&(d=a.apply(f,g)),d}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&b.push(c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var F=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(x.isFunction(g)&&g instanceof g&&x.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i=0,k=!0;if("[object Array]"==e){if(i=a.length,k=i==b.length)for(;i--&&(k=F(a[i],b[i],c,d)););}else{for(var l in a)if(x.has(a,l)&&(i++,!(k=x.has(b,l)&&F(a[l],b[l],c,d))))break;if(k){for(l in b)if(x.has(b,l)&&!i--)break;k=!i}}return c.pop(),d.pop(),k};x.isEqual=function(a,b){return F(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var G={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};G.unescape=x.invert(G.escape);var H={escape:new RegExp("["+x.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(G.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(H[a],function(b){return G[a][b]})}}),x.result=function(a,b){if(null==a)return void 0;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),M.call(this,c.apply(x,a))}})};var I=0;x.uniqueId=function(a){var b=++I+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=new RegExp([(c.escape||J).source,(c.interpolate||J).source,(c.evaluate||J).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(L,function(a){return"\\"+K[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var M=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],M.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return M.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),FFT.prototype.forward=function(a){var b=this.bufferSize,c=this.cosTable,d=this.sinTable,e=this.reverseTable,f=this.real,g=this.imag;this.spectrum;var h=Math.floor(Math.log(b)/Math.LN2);if(Math.pow(2,h)!==b)throw"Invalid buffer size, must be a power of 2.";if(b!==a.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+b+" Buffer Size: "+a.length;var i,j,k,l,m,n,o,p,q,r=1;for(q=0;b>q;q++)f[q]=a[e[q]],g[q]=0;for(;b>r;){i=c[r],j=d[r],k=1,l=0;for(var s=0;r>s;s++){for(q=s;b>q;)m=q+r,n=k*f[m]-l*g[m],o=k*g[m]+l*f[m],f[m]=f[q]-n,g[m]=g[q]-o,f[q]+=n,g[q]+=o,q+=r<<1;p=k,k=p*i-l*j,l=p*j+l*i}r<<=1}return this.calculateSpectrum()},function(){function a(){for(var a in this.sections)this.sections[a].condition()&&this.sections[a].callback.call(this)}var b=function(){this.audioAdapter=b._getAdapter(this),this.events={},this.sections=[],this.bind("update",a)};b.adapters={},b.prototype={load:function(a){return a instanceof HTMLElement?(this.source=a,"flash"===b.isSupported()&&(this.source={src:b._getMP3SrcFromAudio(a)})):(this.source=window.Audio?new Audio:{},this.source.src=b._makeSupportedPath(a.src,a.codecs)),this.audio=this.audioAdapter.load(this.source),this},play:function(){return this.audioAdapter.play(),this},pause:function(){return this.audioAdapter.pause(),this},setVolume:function(a){return this.audioAdapter.setVolume(a),this},createKick:function(a){return new b.Kick(this,a)},bind:function(a,b){return this.events[a]||(this.events[a]=[]),this.events[a].push(b),this},unbind:function(a){return this.events[a]&&delete this.events[a],this},trigger:function(a){var b=this;return this.events[a]&&this.events[a].forEach(function(a){a.call(b)}),this},getVolume:function(){return this.audioAdapter.getVolume()},getProgress:function(){return this.audioAdapter.getProgress()},getTime:function(){return this.audioAdapter.getTime()},getFrequency:function(a,b){var c=0;if(void 0!==b){for(var d=a;b>=d;d++)c+=this.getSpectrum()[d];return c/(b-a+1)}return this.getSpectrum()[a]},getWaveform:function(){return this.audioAdapter.getWaveform()},getSpectrum:function(){return this.audioAdapter.getSpectrum()},isLoaded:function(){return this.audioAdapter.isLoaded},isPlaying:function(){return this.audioAdapter.isPlaying},after:function(a,b){var c=this;return this.sections.push({condition:function(){return c.getTime()>a},callback:b}),this},before:function(a,b){var c=this;return this.sections.push({condition:function(){return c.getTime()a&&d.getTime()a&&!this.called},callback:function(){b.call(this),d.called=!0},called:!1}),d=this.sections[this.sections.length-1],this}},window.Dancer=b}(),function(a){function b(){var a=!!(navigator.vendor||"").match(/Apple/),b=navigator.userAgent.match(/Version\/([^ ]*)/);return b=b?parseFloat(b[1]):0,a&&6>=b}var c={mp3:"audio/mpeg;",ogg:'audio/ogg; codecs="vorbis"',wav:'audio/wav; codecs="1"',aac:'audio/mp4; codecs="mp4a.40.2"'},d=document.createElement("audio");a.options={},a.setOptions=function(b){for(var c in b)b.hasOwnProperty(c)&&(a.options[c]=b[c])},a.isSupported=function(){return window.Float32Array&&window.Uint32Array?b()||!window.AudioContext&&!window.webkitAudioContext?d&&d.mozSetup?"audiodata":FlashDetect.versionAtLeast(9)?"flash":"":"webaudio":null},a.canPlay=function(b){return d.canPlayType,!!("flash"===a.isSupported()?"mp3"===b.toLowerCase():d.canPlayType&&d.canPlayType(c[b.toLowerCase()]).replace(/no/,""))},a.addPlugin=function(b,c){void 0===a.prototype[b]&&(a.prototype[b]=c)},a._makeSupportedPath=function(b,c){if(!c)return b;for(var d=0;d=this.currentThreshold&&a>=this.threshold?(this.currentThreshold=a,this.onKick&&this.onKick.call(this.dancer,a)):(this.offKick&&this.offKick.call(this.dancer,a),this.currentThreshold-=this.decay)}},maxAmplitude:function(a){var b=0,c=this.dancer.getSpectrum();if(!a.length)return a=d;d++)c[d]>b&&(b=c[d]);return b}},window.Dancer.Kick=b}(),function(){function a(){this.source=this.context.createMediaElementSource(this.audio),this.source.connect(this.proc),this.source.connect(this.gain),this.gain.connect(this.context.destination),this.proc.connect(this.context.destination),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var b=2048,c=44100,d=function(a){this.dancer=a,this.audio=new Audio,this.context=window.AudioContext?new window.AudioContext:new window.webkitAudioContext};d.prototype={load:function(d){var e=this;return this.audio=d,this.isLoaded=!1,this.progress=0,this.proc=this.context.createJavaScriptNode(b/2,1,1),this.proc.onaudioprocess=function(a){e.update.call(e,a)},this.gain=this.context.createGainNode(),this.fft=new FFT(b/2,c),this.signal=new Float32Array(b/2),this.audio.readyState<3?this.audio.addEventListener("canplay",function(){a.call(e)}):a.call(e),this.audio.addEventListener("progress",function(a){a.currentTarget.duration&&(e.progress=a.currentTarget.seekable.end(0)/a.currentTarget.duration)}),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.gain.gain.value=a},getVolume:function(){return this.gain.gain.value},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(a){if(this.isPlaying&&this.isLoaded){var c,d=[],e=a.inputBuffer.numberOfChannels,f=b/e,g=function(a,b){return a[c]+b[c]};for(c=e;c--;)d.push(a.inputBuffer.getChannelData(c));for(c=0;f>c;c++)this.signal[c]=e>1?d.reduce(g(prev,curr))/e:d[0][c];this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.webkit=d}(),function(){function a(){this.fbLength=this.audio.mozFrameBufferLength,this.channels=this.audio.mozChannels,this.rate=this.audio.mozSampleRate,this.fft=new FFT(this.fbLength/this.channels,this.rate),this.signal=new Float32Array(this.fbLength/this.channels),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var b=function(a){this.dancer=a,this.audio=new Audio};b.prototype={load:function(b){var c=this;return this.audio=b,this.isLoaded=!1,this.progress=0,this.audio.readyState<3?this.audio.addEventListener("loadedmetadata",function(){a.call(c)},!1):a.call(c),this.audio.addEventListener("MozAudioAvailable",function(a){c.update(a)},!1),this.audio.addEventListener("progress",function(a){a.currentTarget.duration&&(c.progress=a.currentTarget.seekable.end(0)/a.currentTarget.duration)},!1),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.audio.volume=a},getVolume:function(){return this.audio.volume},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(a){if(this.isPlaying&&this.isLoaded){for(var b=0,c=this.fbLength/2;c>b;b++)this.signal[b]=(a.frameBuffer[2*b]+a.frameBuffer[2*b+1])/2;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.moz=b}(),function(){function a(){var a=this;f=!0,b(Dancer.options.flashJS,function(){soundManager=new SoundManager,soundManager.flashVersion=9,soundManager.flash9Options.useWaveformData=!0,soundManager.useWaveformData=!0,soundManager.useHighPerformance=!0,soundManager.useFastPolling=!0,soundManager.multiShot=!1,soundManager.debugMode=!1,soundManager.debugFlash=!1,soundManager.url=Dancer.options.flashSWF,soundManager.onready(function(){e=!0,a.load()}),soundManager.ontimeout(function(){console.error("Error loading SoundManager2.swf")}),soundManager.beginDelayedInit()})}function b(a,b){var c=document.createElement("script"),d=document.getElementsByTagName("script")[0];c.type="text/javascript",c.src=a,c.onload=b,d.parentNode.insertBefore(c,d)}var c=1024,d=44100,e=!1,f=!1,g=.93,h=function(a){this.dancer=a,this.wave_L=[],this.wave_R=[],this.spectrum=[],window.SM2_DEFER=!0};h.prototype={load:function(b){var e=this;return this.path=b?b.src:this.path,this.isLoaded=!1,this.progress=0,!window.soundManager&&!f&&a.call(this),window.soundManager&&(this.audio=soundManager.createSound({id:"dancer"+Math.random(),url:this.path,stream:!0,autoPlay:!1,autoLoad:!0,whileplaying:function(){e.update()},whileloading:function(){e.progress=this.bytesLoaded/this.bytesTotal},onload:function(){e.fft=new FFT(c,d),e.signal=new Float32Array(c),e.waveform=new Float32Array(c),e.isLoaded=!0,e.progress=1,e.dancer.trigger("loaded")}}),this.dancer.audio=this.audio),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.audio.setVolume(100*a)},getVolume:function(){return this.audio.volume/100},getProgress:function(){return this.progress},getWaveform:function(){return this.waveform},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.position/1e3},update:function(){if(this.isPlaying||this.isLoaded){this.wave_L=this.audio.waveformData.left,this.wave_R=this.audio.waveformData.right;for(var a,b=0,c=this.wave_L.length;c>b;b++)a=parseFloat(this.wave_L[b])+parseFloat(this.wave_R[b]),this.waveform[2*b]=a/2,this.waveform[2*b+1]=a/2,this.signal[2*b]=a*g,this.signal[2*b+1]=a*g;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.flash=h}(),FFT.prototype.forward=function(a){var b=this.bufferSize,c=this.cosTable,d=this.sinTable,e=this.reverseTable,f=this.real,g=this.imag;this.spectrum;var h=Math.floor(Math.log(b)/Math.LN2);if(Math.pow(2,h)!==b)throw"Invalid buffer size, must be a power of 2.";if(b!==a.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+b+" Buffer Size: "+a.length;var i,j,k,l,m,n,o,p,q,r=1;for(q=0;b>q;q++)f[q]=a[e[q]],g[q]=0;for(;b>r;){i=c[r],j=d[r],k=1,l=0;for(var s=0;r>s;s++){for(q=s;b>q;)m=q+r,n=k*f[m]-l*g[m],o=k*g[m]+l*f[m],f[m]=f[q]-n,g[m]=g[q]-o,f[q]+=n,g[q]+=o,q+=r<<1;p=k,k=p*i-l*j,l=p*j+l*i}r<<=1}return this.calculateSpectrum()};var FlashDetect=new function(){var a=this;a.installed=!1,a.raw="",a.major=-1,a.minor=-1,a.revision=-1,a.revisionStr="";var b=[{name:"ShockwaveFlash.ShockwaveFlash.7",version:function(a){return c(a)}},{name:"ShockwaveFlash.ShockwaveFlash.6",version:function(a){var b="6,0,21";try{a.AllowScriptAccess="always",b=c(a)}catch(d){}return b}},{name:"ShockwaveFlash.ShockwaveFlash",version:function(a){return c(a)}}],c=function(a){var b=-1;try{b=a.GetVariable("$version")}catch(c){}return b},d=function(a){var b=-1;try{b=new ActiveXObject(a)}catch(c){b={activeXError:!0}}return b},e=function(a){var b=a.split(",");return{raw:a,major:parseInt(b[0].split(" ")[1],10),minor:parseInt(b[1],10),revision:parseInt(b[2],10),revisionStr:b[2]}},f=function(a){var b=a.split(/ +/),c=b[2].split(/\./),d=b[3];return{raw:a,major:parseInt(c[0],10),minor:parseInt(c[1],10),revisionStr:d,revision:g(d)}},g=function(b){return parseInt(b.replace(/[a-zA-Z]/g,""),10)||a.revision};a.majorAtLeast=function(b){return a.major>=b},a.minorAtLeast=function(b){return a.minor>=b},a.revisionAtLeast=function(b){return a.revision>=b},a.versionAtLeast=function(){var b=[a.major,a.minor,a.revision],c=Math.min(b.length,arguments.length);for(i=0;c>i;i++){if(b[i]>=arguments[i]){if(c>i+1&&b[i]==arguments[i])continue;return!0}return!1}},a.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var c="application/x-shockwave-flash",g=navigator.mimeTypes;if(g&&g[c]&&g[c].enabledPlugin&&g[c].enabledPlugin.description){var h=g[c].enabledPlugin.description,i=f(h);a.raw=i.raw,a.major=i.major,a.minor=i.minor,a.revisionStr=i.revisionStr,a.revision=i.revision,a.installed=!0}}else if(-1==navigator.appVersion.indexOf("Mac")&&window.execScript)for(var h=-1,j=0;jb+1e3&&(f=Math.round(1e3*i/(j-b)),g=Math.min(g,f),h=Math.max(h,f),m.textContent=f+" FPS ("+g+"-"+h+")",t(n,Math.min(30,30-30*(f/100))),b=j,i=0),j},update:function(){a=this.end()}}}; \ No newline at end of file diff --git a/dist/webvs.full.min.js b/dist/webvs.full.min.js index 940cefb..e3652c5 100644 --- a/dist/webvs.full.min.js +++ b/dist/webvs.full.min.js @@ -1,4 +1,4 @@ -function FourierTransform(a,b){this.bufferSize=a,this.sampleRate=b,this.bandwidth=2/a*b/2,this.spectrum=new Float32Array(a/2),this.real=new Float32Array(a),this.imag=new Float32Array(a),this.peakBand=0,this.peak=0,this.getBandFrequency=function(a){return this.bandwidth*a+this.bandwidth/2},this.calculateSpectrum=function(){for(var b,c,d,e=this.spectrum,f=this.real,g=this.imag,h=2/this.bufferSize,i=Math.sqrt,j=0,k=a/2;k>j;j++)b=f[j],c=g[j],d=h*i(b*b+c*c),d>this.peak&&(this.peakBand=j,this.peak=d),e[j]=d}}function FFT(a,b){FourierTransform.call(this,a,b),this.reverseTable=new Uint32Array(a);for(var c,d=1,e=a>>1;a>d;){for(c=0;d>c;c++)this.reverseTable[c+d]=this.reverseTable[c]+e;d<<=1,e>>=1}for(this.sinTable=new Float32Array(a),this.cosTable=new Float32Array(a),c=0;a>c;c++)this.sinTable[c]=Math.sin(-Math.PI/c),this.cosTable[c]=Math.cos(-Math.PI/c)}function FourierTransform(a,b){this.bufferSize=a,this.sampleRate=b,this.bandwidth=2/a*b/2,this.spectrum=new Float32Array(a/2),this.real=new Float32Array(a),this.imag=new Float32Array(a),this.peakBand=0,this.peak=0,this.getBandFrequency=function(a){return this.bandwidth*a+this.bandwidth/2},this.calculateSpectrum=function(){for(var b,c,d,e=this.spectrum,f=this.real,g=this.imag,h=2/this.bufferSize,i=Math.sqrt,j=0,k=a/2;k>j;j++)b=f[j],c=g[j],d=h*i(b*b+c*c),d>this.peak&&(this.peakBand=j,this.peak=d),e[j]=d}}function FFT(a,b){FourierTransform.call(this,a,b),this.reverseTable=new Uint32Array(a);for(var c,d=1,e=a>>1;a>d;){for(c=0;d>c;c++)this.reverseTable[c+d]=this.reverseTable[c]+e;d<<=1,e>>=1}for(this.sinTable=new Float32Array(a),this.cosTable=new Float32Array(a),c=0;a>c;c++)this.sinTable[c]=Math.sin(-Math.PI/c),this.cosTable[c]=Math.cos(-Math.PI/c)}(function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=e.toString,k=e.hasOwnProperty,l=d.forEach,m=d.map,n=d.reduce,o=d.reduceRight,p=d.filter,q=d.every,r=d.some,s=d.indexOf,t=d.lastIndexOf,u=Array.isArray,v=Object.keys,w=f.bind,x=function(a){return a instanceof x?a:this instanceof x?(this._wrapped=a,void 0):new x(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):a._=x,x.VERSION="1.5.1";var y=x.each=x.forEach=function(a,b,d){if(null!=a)if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;f>e;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?void 0:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;gd||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;c.call(d,a[h])=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=x.max(x.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=x.pluck(arguments,""+c);return b},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var E=function(){};x.bind=function(a,b){var c,d;if(w&&a.bind===w)return w.apply(a,h.call(arguments,1));if(!x.isFunction(a))throw new TypeError;return c=h.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(h.call(arguments)));E.prototype=a.prototype;var e=new E;E.prototype=null;var f=a.apply(e,c.concat(h.call(arguments)));return Object(f)===f?f:e}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:new Date,g=null,f=a.apply(d,e)};return function(){var j=new Date;h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},x.debounce=function(a,b,c){var d,e=null;return function(){var f=this,g=arguments,h=function(){e=null,c||(d=a.apply(f,g))},i=c&&!e;return clearTimeout(e),e=setTimeout(h,b),i&&(d=a.apply(f,g)),d}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&b.push(c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var F=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(x.isFunction(g)&&g instanceof g&&x.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i=0,k=!0;if("[object Array]"==e){if(i=a.length,k=i==b.length)for(;i--&&(k=F(a[i],b[i],c,d)););}else{for(var l in a)if(x.has(a,l)&&(i++,!(k=x.has(b,l)&&F(a[l],b[l],c,d))))break;if(k){for(l in b)if(x.has(b,l)&&!i--)break;k=!i}}return c.pop(),d.pop(),k};x.isEqual=function(a,b){return F(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var G={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};G.unescape=x.invert(G.escape);var H={escape:new RegExp("["+x.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(G.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(H[a],function(b){return G[a][b]})}}),x.result=function(a,b){if(null==a)return void 0;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),M.call(this,c.apply(x,a))}})};var I=0;x.uniqueId=function(a){var b=++I+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=new RegExp([(c.escape||J).source,(c.interpolate||J).source,(c.evaluate||J).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(L,function(a){return"\\"+K[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var M=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],M.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return M.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),FFT.prototype.forward=function(a){var b=this.bufferSize,c=this.cosTable,d=this.sinTable,e=this.reverseTable,f=this.real,g=this.imag;this.spectrum;var h=Math.floor(Math.log(b)/Math.LN2);if(Math.pow(2,h)!==b)throw"Invalid buffer size, must be a power of 2.";if(b!==a.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+b+" Buffer Size: "+a.length;var i,j,k,l,m,n,o,p,q,r=1;for(q=0;b>q;q++)f[q]=a[e[q]],g[q]=0;for(;b>r;){i=c[r],j=d[r],k=1,l=0;for(var s=0;r>s;s++){for(q=s;b>q;)m=q+r,n=k*f[m]-l*g[m],o=k*g[m]+l*f[m],f[m]=f[q]-n,g[m]=g[q]-o,f[q]+=n,g[q]+=o,q+=r<<1;p=k,k=p*i-l*j,l=p*j+l*i}r<<=1}return this.calculateSpectrum()},function(){function a(){for(var a in this.sections)this.sections[a].condition()&&this.sections[a].callback.call(this)}var b=function(){this.audioAdapter=b._getAdapter(this),this.events={},this.sections=[],this.bind("update",a)};b.adapters={},b.prototype={load:function(a){return a instanceof HTMLElement?(this.source=a,"flash"===b.isSupported()&&(this.source={src:b._getMP3SrcFromAudio(a)})):(this.source=window.Audio?new Audio:{},this.source.src=b._makeSupportedPath(a.src,a.codecs)),this.audio=this.audioAdapter.load(this.source),this},play:function(){return this.audioAdapter.play(),this},pause:function(){return this.audioAdapter.pause(),this},setVolume:function(a){return this.audioAdapter.setVolume(a),this},createKick:function(a){return new b.Kick(this,a)},bind:function(a,b){return this.events[a]||(this.events[a]=[]),this.events[a].push(b),this},unbind:function(a){return this.events[a]&&delete this.events[a],this},trigger:function(a){var b=this;return this.events[a]&&this.events[a].forEach(function(a){a.call(b)}),this},getVolume:function(){return this.audioAdapter.getVolume()},getProgress:function(){return this.audioAdapter.getProgress()},getTime:function(){return this.audioAdapter.getTime()},getFrequency:function(a,b){var c=0;if(void 0!==b){for(var d=a;b>=d;d++)c+=this.getSpectrum()[d];return c/(b-a+1)}return this.getSpectrum()[a]},getWaveform:function(){return this.audioAdapter.getWaveform()},getSpectrum:function(){return this.audioAdapter.getSpectrum()},isLoaded:function(){return this.audioAdapter.isLoaded},isPlaying:function(){return this.audioAdapter.isPlaying},after:function(a,b){var c=this;return this.sections.push({condition:function(){return c.getTime()>a},callback:b}),this},before:function(a,b){var c=this;return this.sections.push({condition:function(){return c.getTime()a&&d.getTime()a&&!this.called},callback:function(){b.call(this),d.called=!0},called:!1}),d=this.sections[this.sections.length-1],this}},window.Dancer=b}(),function(a){function b(){var a=!!(navigator.vendor||"").match(/Apple/),b=navigator.userAgent.match(/Version\/([^ ]*)/);return b=b?parseFloat(b[1]):0,a&&6>=b}var c={mp3:"audio/mpeg;",ogg:'audio/ogg; codecs="vorbis"',wav:'audio/wav; codecs="1"',aac:'audio/mp4; codecs="mp4a.40.2"'},d=document.createElement("audio");a.options={},a.setOptions=function(b){for(var c in b)b.hasOwnProperty(c)&&(a.options[c]=b[c])},a.isSupported=function(){return window.Float32Array&&window.Uint32Array?b()||!window.AudioContext&&!window.webkitAudioContext?d&&d.mozSetup?"audiodata":FlashDetect.versionAtLeast(9)?"flash":"":"webaudio":null},a.canPlay=function(b){return d.canPlayType,!!("flash"===a.isSupported()?"mp3"===b.toLowerCase():d.canPlayType&&d.canPlayType(c[b.toLowerCase()]).replace(/no/,""))},a.addPlugin=function(b,c){void 0===a.prototype[b]&&(a.prototype[b]=c)},a._makeSupportedPath=function(b,c){if(!c)return b;for(var d=0;d=this.currentThreshold&&a>=this.threshold?(this.currentThreshold=a,this.onKick&&this.onKick.call(this.dancer,a)):(this.offKick&&this.offKick.call(this.dancer,a),this.currentThreshold-=this.decay)}},maxAmplitude:function(a){var b=0,c=this.dancer.getSpectrum();if(!a.length)return a=d;d++)c[d]>b&&(b=c[d]);return b}},window.Dancer.Kick=b}(),function(){function a(){this.source=this.context.createMediaElementSource(this.audio),this.source.connect(this.proc),this.source.connect(this.gain),this.gain.connect(this.context.destination),this.proc.connect(this.context.destination),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var b=2048,c=44100,d=function(a){this.dancer=a,this.audio=new Audio,this.context=window.AudioContext?new window.AudioContext:new window.webkitAudioContext};d.prototype={load:function(d){var e=this;return this.audio=d,this.isLoaded=!1,this.progress=0,this.proc=this.context.createJavaScriptNode(b/2,1,1),this.proc.onaudioprocess=function(a){e.update.call(e,a)},this.gain=this.context.createGainNode(),this.fft=new FFT(b/2,c),this.signal=new Float32Array(b/2),this.audio.readyState<3?this.audio.addEventListener("canplay",function(){a.call(e)}):a.call(e),this.audio.addEventListener("progress",function(a){a.currentTarget.duration&&(e.progress=a.currentTarget.seekable.end(0)/a.currentTarget.duration)}),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.gain.gain.value=a},getVolume:function(){return this.gain.gain.value},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(a){if(this.isPlaying&&this.isLoaded){var c,d=[],e=a.inputBuffer.numberOfChannels,f=b/e,g=function(a,b){return a[c]+b[c]};for(c=e;c--;)d.push(a.inputBuffer.getChannelData(c));for(c=0;f>c;c++)this.signal[c]=e>1?d.reduce(g(prev,curr))/e:d[0][c];this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.webkit=d}(),function(){function a(){this.fbLength=this.audio.mozFrameBufferLength,this.channels=this.audio.mozChannels,this.rate=this.audio.mozSampleRate,this.fft=new FFT(this.fbLength/this.channels,this.rate),this.signal=new Float32Array(this.fbLength/this.channels),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var b=function(a){this.dancer=a,this.audio=new Audio};b.prototype={load:function(b){var c=this;return this.audio=b,this.isLoaded=!1,this.progress=0,this.audio.readyState<3?this.audio.addEventListener("loadedmetadata",function(){a.call(c)},!1):a.call(c),this.audio.addEventListener("MozAudioAvailable",function(a){c.update(a)},!1),this.audio.addEventListener("progress",function(a){a.currentTarget.duration&&(c.progress=a.currentTarget.seekable.end(0)/a.currentTarget.duration)},!1),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.audio.volume=a},getVolume:function(){return this.audio.volume},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(a){if(this.isPlaying&&this.isLoaded){for(var b=0,c=this.fbLength/2;c>b;b++)this.signal[b]=(a.frameBuffer[2*b]+a.frameBuffer[2*b+1])/2;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.moz=b}(),function(){function a(){var a=this;f=!0,b(Dancer.options.flashJS,function(){soundManager=new SoundManager,soundManager.flashVersion=9,soundManager.flash9Options.useWaveformData=!0,soundManager.useWaveformData=!0,soundManager.useHighPerformance=!0,soundManager.useFastPolling=!0,soundManager.multiShot=!1,soundManager.debugMode=!1,soundManager.debugFlash=!1,soundManager.url=Dancer.options.flashSWF,soundManager.onready(function(){e=!0,a.load()}),soundManager.ontimeout(function(){console.error("Error loading SoundManager2.swf")}),soundManager.beginDelayedInit()})}function b(a,b){var c=document.createElement("script"),d=document.getElementsByTagName("script")[0];c.type="text/javascript",c.src=a,c.onload=b,d.parentNode.insertBefore(c,d)}var c=1024,d=44100,e=!1,f=!1,g=.93,h=function(a){this.dancer=a,this.wave_L=[],this.wave_R=[],this.spectrum=[],window.SM2_DEFER=!0};h.prototype={load:function(b){var e=this;return this.path=b?b.src:this.path,this.isLoaded=!1,this.progress=0,!window.soundManager&&!f&&a.call(this),window.soundManager&&(this.audio=soundManager.createSound({id:"dancer"+Math.random(),url:this.path,stream:!0,autoPlay:!1,autoLoad:!0,whileplaying:function(){e.update()},whileloading:function(){e.progress=this.bytesLoaded/this.bytesTotal},onload:function(){e.fft=new FFT(c,d),e.signal=new Float32Array(c),e.waveform=new Float32Array(c),e.isLoaded=!0,e.progress=1,e.dancer.trigger("loaded")}}),this.dancer.audio=this.audio),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.audio.setVolume(100*a)},getVolume:function(){return this.audio.volume/100},getProgress:function(){return this.progress},getWaveform:function(){return this.waveform},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.position/1e3},update:function(){if(this.isPlaying||this.isLoaded){this.wave_L=this.audio.waveformData.left,this.wave_R=this.audio.waveformData.right;for(var a,b=0,c=this.wave_L.length;c>b;b++)a=parseFloat(this.wave_L[b])+parseFloat(this.wave_R[b]),this.waveform[2*b]=a/2,this.waveform[2*b+1]=a/2,this.signal[2*b]=a*g,this.signal[2*b+1]=a*g;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.flash=h}(),FFT.prototype.forward=function(a){var b=this.bufferSize,c=this.cosTable,d=this.sinTable,e=this.reverseTable,f=this.real,g=this.imag;this.spectrum;var h=Math.floor(Math.log(b)/Math.LN2);if(Math.pow(2,h)!==b)throw"Invalid buffer size, must be a power of 2.";if(b!==a.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+b+" Buffer Size: "+a.length;var i,j,k,l,m,n,o,p,q,r=1;for(q=0;b>q;q++)f[q]=a[e[q]],g[q]=0;for(;b>r;){i=c[r],j=d[r],k=1,l=0;for(var s=0;r>s;s++){for(q=s;b>q;)m=q+r,n=k*f[m]-l*g[m],o=k*g[m]+l*f[m],f[m]=f[q]-n,g[m]=g[q]-o,f[q]+=n,g[q]+=o,q+=r<<1;p=k,k=p*i-l*j,l=p*j+l*i}r<<=1}return this.calculateSpectrum()};var FlashDetect=new function(){var a=this;a.installed=!1,a.raw="",a.major=-1,a.minor=-1,a.revision=-1,a.revisionStr="";var b=[{name:"ShockwaveFlash.ShockwaveFlash.7",version:function(a){return c(a)}},{name:"ShockwaveFlash.ShockwaveFlash.6",version:function(a){var b="6,0,21";try{a.AllowScriptAccess="always",b=c(a)}catch(d){}return b}},{name:"ShockwaveFlash.ShockwaveFlash",version:function(a){return c(a)}}],c=function(a){var b=-1;try{b=a.GetVariable("$version")}catch(c){}return b},d=function(a){var b=-1;try{b=new ActiveXObject(a)}catch(c){b={activeXError:!0}}return b},e=function(a){var b=a.split(",");return{raw:a,major:parseInt(b[0].split(" ")[1],10),minor:parseInt(b[1],10),revision:parseInt(b[2],10),revisionStr:b[2]}},f=function(a){var b=a.split(/ +/),c=b[2].split(/\./),d=b[3];return{raw:a,major:parseInt(c[0],10),minor:parseInt(c[1],10),revisionStr:d,revision:g(d)}},g=function(b){return parseInt(b.replace(/[a-zA-Z]/g,""),10)||a.revision};a.majorAtLeast=function(b){return a.major>=b},a.minorAtLeast=function(b){return a.minor>=b},a.revisionAtLeast=function(b){return a.revision>=b},a.versionAtLeast=function(){var b=[a.major,a.minor,a.revision],c=Math.min(b.length,arguments.length);for(i=0;c>i;i++){if(b[i]>=arguments[i]){if(c>i+1&&b[i]==arguments[i])continue;return!0}return!1}},a.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var c="application/x-shockwave-flash",g=navigator.mimeTypes;if(g&&g[c]&&g[c].enabledPlugin&&g[c].enabledPlugin.description){var h=g[c].enabledPlugin.description,i=f(h);a.raw=i.raw,a.major=i.major,a.minor=i.minor,a.revisionStr=i.revisionStr,a.revision=i.revision,a.installed=!0}}else if(-1==navigator.appVersion.indexOf("Mac")&&window.execScript)for(var h=-1,j=0;jb+1e3&&(f=Math.round(1e3*i/(j-b)),g=Math.min(g,f),h=Math.max(h,f),m.textContent=f+" FPS ("+g+"-"+h+")",t(n,Math.min(30,30-30*(f/100))),b=j,i=0),j},update:function(){a=this.end()}}};!function(a){var b={};a.Webvs=b,b.defineClass=function(a,b){return a.prototype=Object.create(b.prototype),a.prototype.constructor=a,a.super=b.prototype,_.chain(arguments).drop(2).each(function(b){_.extend(a.prototype,b)}),a},b.noop=function(){},b.checkRequiredOptions=function(a,b){for(var c in b){var d=b[c];if(!(d in a))throw new Error("Required option "+d+"not found")}},b.glslFloatRepr=function(a){return a+(0===a%1?".0":"")},b.parseColor=function(a){if(_.isArray(a)&&3==a.length)return a;if(_.isString(a)){var b;if(a=a.toLowerCase(),b=a.match(/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/))return _.chain(b).last(3).map(function(a){return parseInt(a,16)}).value();if(b=a.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/))return _.chain(b).last(3).map(function(a){return Math.min(parseInt(a,10),255) -}).value()}throw new Error("Invalid Color Format")},b.parseColorNorm=function(a){return _.map(b.parseColor(a),function(a){return a/255})},b.logShaderError=function(a,b){var c=a.split("\n"),d=c.length.toString().length,e=b.match(/(\d+):(\d+)/);e&&(e=[parseInt(e[1],10),parseInt(e[2],10)]);var f=_.map(c,function(a,c){var f,g=c+1+"";for(f=0;fd;d++)c.push(b.charAt(Math.floor(Math.random()*b.length)));return c.join("")},b.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)}}(window),function(a){a.Resources={"avsres_texer_circle_edgeonly_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAMAAABFjsb+AAAABGdBTUEAALGPC/xhBQAAACBjSFJ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bW9kaWZ5ADIwMDMtMTAtMDZUMjI6MDc6NDYrMDY6MDA+xvzGAAAAAElFTkSuQmCC","avsres_texer_circle_sharp_09x09.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAMAAACecocUAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAOVBMVEUAAAACAgJhYWG+vr7b29tiYmKoqKj+/v7///9jY2PBwcHf39/CwsJlZWUDAwOsrKxmZmbDw8Pg4ODJk53hAAAAAWJLR0QIht6VegAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAElJREFUCNdVzUsSwCAIA1CtVakfUO9/WINlY1YvM0xw7op/whuiP0yZiHLSEpUoH1zoT4GrucLN3OBu9x1mOTvCOspjrjn4froBkegClm06guAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTA2LTI5VDE5OjA5OjMyKzA2OjAw50C8rwAAAABJRU5ErkJggg==","avsres_texer_circle_sharp_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAe1BMVEUAAAAFBQVBQUGGhoaurq68vLyvr68GBgYBAQFNTU3Ozs78/Pz+/v7///+Kior6+vr9/f2Li4vR0dFCQkJDQ0OIiIiJiYmzs7PBwcG0tLRERETT09NRUVH7+/uQkJCRkZFTU1PU1NRUVFQHBwdHR0eMjIy1tbXDw8NISEjxdmZoAAAAAWJLR0QN9rRh9QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAJ5JREFUGNN9ke0SgiAUBUUrQbhA9qGpWGZa7/+EgZoCNu7PnTPALEGwAQqj3f4QhbHlMEkoAwBGE4LnIRfwQ3A0LbmEBXkc10SAjSBGxim4pObKE/UsPWt7YZ5lV20z8Mm0zVc2/7u9actX53JtC+lZWZj3lp4th0SVcqSqxg6106GeqqF6Wav7nBg/Gjn0lc0TW93bV9e/++7Tbn3YF1ESEZb9e6HrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0wNC0yOVQwMTo0OTozMCswNTowMPYYqoAAAAAASUVORK5CYII=","avsres_texer_circle_slightblur_13x13.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAASFBMVEUAAAABAQEODg4jIyMtLS0EBARsbGyZmZmoqKiKiorT09Py8vL4+Pj7+/v+/v7///8kJCRtbW3U1NSLi4uampqpqakPDw8uLi7NF0qwAAAAAWJLR0QPGLoA2QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAGhJREFUCNdljkcOwCAMBCmmF9NC/v/TGJBySHwbjXbXjH2PCwlS8AMKtLFGg9oGnA8xeAfLCu1Txpy8FkTShIyIORhJBDbiumiBqLyurFxtO9d2jkNv1Nn67qS9Oq5Rzx7ZWe4y+e/HB1hhBEsscYLrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wNlQyMTozODowMCswNTowMB7KOaoAAAAASUVORK5CYII=","avsres_texer_circle_slightblur_21x21.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAvVBMVEUAAAACA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TvSfpvKhpQe8/J8efY0vNu979+Y90dzXr2/b6Y9eH7g+1l73pwfXb94PqL68n1k7t8l8ub7YPv75JXAT3PA0PVLfBQdQtMVTfAiueAQ92z5DngY90NMDR6lDwLTI2+ATZ4Bji0epY8A2zxtsCp2aPkbYGp2U+StwEO7Z4lbwNs867AqdNX4FOnv0peKYvkXYBjr2fJuwB7vBU4dXuUvBWYun2RvB/g2O9Z8r6Ae8k7AyfRo+SdgUn0RfK+gaPqubUzWmBQvXCn36frIx/dH7y/k+jxhv+Xng96vuj5pOcb348+MN70ftL7TfsD7S+0P+H+1gOu+yPtr7Q/0/5O5wOdL3g+tYHX843ORzpf6Xym853mA5wvguTxfEPzEc1XNJ/RfIfzYQ2cTaf5lOZbmo9pvqb5HOd7D5xdp+8L+j6h75u/uj4BxUT7mSYYfpEAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTA0LTExVDAwOjM0OjU4KzA1OjAwAHKiyQAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_24x24.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABJJREFUCNdjYEAC8v9/UAUjAQD7uCWNIgeQwQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMTAtMDZUMjE6NTc6NDYrMDU6MDDg7pOkAAAAAElFTkSuQmCC","avsres_texer_square_edgeonly_28x28.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcAQMAAABIw03XAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABNJREFUCNdjYEAF8v//N9CPQAUArWA5f2D2DX0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTEwLTA2VDIxOjU4OjQ0KzA1OjAwhnrZAAAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_30x30.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeAQMAAAAB/jzhAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABRJREFUCNdjYEAF8v//PxgIAhUAAOmGR7lQ6SOhAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wNlQyMTo1OToxOCswNTowMOb41i4AAAAASUVORK5CYII=","avsres_texer_square_sharp_20x20.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABJJREFUCNdjYIAC+/9/qIqhAABLlCyJ9A7ihwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMDYtMjlUMTk6Mzg6MDQrMDU6MDBuiiynAAAAAElFTkSuQmCC","avsres_texer_square_sharp_32x32.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABVJREFUCNdjYMAB+P////9hCJM4AACQJX+BjmWyDAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDktMTAtMDhUMDE6NTM6NTYrMDU6MDBzUO7GAAAAAElFTkSuQmCC","avsres_texer_square_sharp_48x48.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4AQMAAACSSKldAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABZJREFUGNNjYCAA+P+DwIdReoBoAgAAldYe8LB8aUoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDA5LTEwLTA4VDAxOjUzOjI4KzA1OjAwKaqcggAAAABJRU5ErkJggg==","avsres_texer_square_sharp_60x60.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABEAQMAAAAC3QHxAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAABdJREFUKM9jYCAS8P+HgFHWKIuaLCIBAH8IpfBELmrmAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMTo1NDozMiswNTowMKOs2CsAAAAASUVORK5CYII=","avsres_texer_square_sharp_64x64.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQAQMAAAC032DuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABdJREFUKM9jYKAV+A8Fo8xR5lBk0gYAAMbE/hBbX3sVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODowMCswNjowML8mns0AAAAASUVORK5CYII=","avsres_texer_square_sharp_72x72.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUAQMAAAAmpYKCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABpJREFUKM9jYKASYP4PBX9G2aPsUTa12VQCABpBhZc9Qe3KAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjowMjoxNiswNjowMMbw5GAAAAAASUVORK5CYII=","avsres_texer_square_sharp_96x96.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwAQMAAAD8LmYIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAB1JREFUOMtjYBgo8B8JjHJHuaPcUe4od/BwBwYAAB86e71LirdOAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODo0NiswNjowMFi8pQ0AAAAASUVORK5CYII=","avsres_texer_square_sharp_250x250.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQoAAAEKAQMAAADQBYmKAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAADlJREFUaN7tykENAAAIBCD7p7KZFrgZwMGbKrK5taIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoivKpkCyUd+T92W3T7QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTEtMDEtMDVUMTg6NTk6NTQrMDU6MDBwiLErAAAAAElFTkSuQmCC"}}(Webvs),function(a){function b(){}a.AnalyserAdapter=a.defineClass(b,Object,{beat:!1,isPlaying:function(){return!1},getWaveform:function(){return new Float32Array(0)},getSpectrum:function(){return new Float32Array(0)}})}(Webvs),function(a){function b(a){this.dancer=a,this.beat=!1;var b=this;this.kick=a.createKick({onKick:function(){b.beat=!0},offKick:function(){b.beat=!1}}),this.kick.on()}a.DancerAdapter=a.defineClass(b,a.AnalyserAdapter,{isPlaying:function(){return this.dancer.isPlaying()},getWaveform:function(){return this.dancer.getWaveform()},getSpectrum:function(){return this.dancer.getSpectrum()}})}(Webvs),function(a){function b(b){if(a.checkRequiredOptions(b,["canvas","analyser"]),b=_.defaults(b,{showStat:!1}),this.canvas=b.canvas,this.analyser=b.analyser,this.isStarted=!1,b.showStat){var c=new Stats;c.setMode(0),c.domElement.style.position="absolute",c.domElement.style.right="5px",c.domElement.style.bottom="5px",document.body.appendChild(c.domElement),this.stats=c}this.resources={},this.rootComponent=new a.EffectList({id:"root"}),this._registerContextEvents(),this._initGl()}a.Main=a.defineClass(b,Object,{_registerContextEvents:function(){var a=this;this.canvas.addEventListener("webglcontextlost",function(b){b.preventDefault(),a.stop()}),this.canvas.addEventListener("webglcontextrestored",function(){a.resetCanvas()})},_initGl:function(){try{this.gl=this.canvas.getContext("experimental-webgl",{alpha:!1}),this.copier=new a.CopyProgram({dynamicBlend:!0}),this.copier.init(this.gl),this.resolution={width:this.canvas.width,height:this.canvas.height}}catch(b){throw new Error("Couldnt get webgl context"+b)}},loadPreset:function(b){b=_.clone(b),b.id="root";var c=new a.EffectList(b);this.stop(),this.rootComponent.destroy(),this.rootComponent=c,this.resources=b.resources||{}},resetCanvas:function(){this.stop();var b=this.rootComponent.getOptions();this.rootComponent.destroy(),this.copier.cleanup(),this._initGl(),this.rootComponent=new a.EffectList(b)},start:function(){if(!this.isStarted){var a=this.rootComponent,b=this,c=function(){b.analyser.isPlaying()&&a.update(),b.animReqId=requestAnimationFrame(c)};if(this.stats){var d=c;c=function(){b.stats.begin(),d.call(this,arguments),b.stats.end()}}if(a.componentInited)this.animReqId=requestAnimationFrame(c);else{this.registerBank={},this.bootTime=(new Date).getTime();var e=a.init(this.gl,this);e.onResolve(function(){b.animReqId=requestAnimationFrame(c)})}this.isStarted=!0}},stop:function(){_.isUndefined(this.animReqId)||(cancelAnimationFrame(this.animReqId),this.isStarted=!1)},getPreset:function(){var a=this.rootComponent.getOptions();return a.resources=this.resources,a},addComponent:function(a,b,c){this.stop(),b=_.clone(b);var d=this.rootComponent.addComponent(a,b,c);if(d){var e=this;return d[1].onResolve(function(){e.start()}),d[0]}},updateComponent:function(a,b){this.stop();var c=this;if(b=_.clone(b),"root"==a){var d=this.rootComponent.detachAllComponents(),e=this.rootComponent.preset;return this.rootComponent.destroy(),this.rootComponent=new EffectList(e,d),_.each(d,function(a){a.destroyPool()}),c.start(),!0}var f=this.rootComponent.updateComponent();return f?(promises.onResolve(function(){c.start()}),!0):!1},removeComponent:function(a){var b=this.rootComponent.detachComponent(a);return b?(b.destroyPool(),!0):!1},moveComponent:function(a,b){var c=this.rootComponent.detachComponent(a);if(c){var d=this.rootComponent.addComponent(b,c);if(c.destroyPool(),d)return!0}return!1},getResource:function(b){var c;return c=this.resources[b],c||(c=a.Resources[b]),c||(c=b),c},setResource:function(a,b){this.resources[a]=b},traverse:function(a){this.rootComponent.traverse(a)}}),b.ui={leaf:!1,disp:"Main",schema:{name:{type:"string",title:"Name"},author:{type:"string",title:"Author"},description:{type:"string",title:"Description"},clearFrame:{type:"boolean",title:"Clear every frame","default":!1,required:!0}}}}(Webvs),function(a){function b(a){this.id=a.id,this.enabled=_.isUndefined(a.enabled)?!0:a.enabled,this.componentInited=!1,this.options=a}a.Component=a.defineClass(b,Object,{componentName:"Component",init:function(a,b,c){this.gl=a,this.main=b,this.parent=c,this.componentInited=!0},adoptOrInit:function(a,b,c){return this.componentInited?this.adopt(c):this.init(a,b,c)},adopt:function(a){this.parent=a},update:function(){},destroy:function(){},getOptions:function(){return this.options},getPath:function(){return _.isUndefined(this.parent)||_.isUndefined(this.id)?this.componentName+"#Main":this.parent.getIdString()+"/"+this.componentName+"#"+this.id}})}(Webvs),function(a){function b(a,c){b.super.constructor.call(this,a),this.components=[],this._containerInited=!1,_.each(c||a.components||[],function(a){this.addComponent(this.id,a)},this)}function c(a,b){this.options=a,this.pool=b||[]}function d(a,b,c){if(b.call(c,a),a.__clones)for(var d=0;d0?this.pool.pop():c.makeComponent(this.options,a)},destroyPool:function(){_.each(this.pool,function(a){d(a,function(a){a.destroy()})}),this.pool=[]}}),c.makeComponent=function(b,c){var d=a[b.type];if(!d)throw new Error("Unknown Component class "+b.type);var e=new d(b,c),f=_.isNumber(b.clone)?b.clone:1;if(f--,f){var g=[];_.times(f,function(a){var e=new d(b,c);e.cloneId=a+1,g.push(e)}),e.cloneId=0,e.__clones=g}return e},c.merge=function(a){var b=[];return _.each(a,function(a){b=b.concat(a.pool)}),new c(a[0].options,b)}}(Webvs),function(a){function b(c){c=_.defaults(c,{output:"REPLACE",input:"IGNORE",clearFrame:!1,enableOnBeat:!1,enableOnBeatFor:1}),this.output="IGNORE"==c.output?-1:a.blendModes[c.output],this.input="IGNORE"==c.input?-1:a.blendModes[c.input],this.clearFrame=c.clearFrame,this.enableOnBeat=c.enableOnBeat,this.enableOnBeatFor=c.enableOnBeatFor,this.first=!0,this._frameCounter=0,this._inited=!1;var d=new a.ExprCodeGenerator(c.code,["beat","enabled","clear","w","h","cid"]),e=d.generateCode(["init","perFrame"],[],[]);this.code=e[0],b.super.constructor.apply(this,arguments)}a.EffectList=a.defineClass(b,a.Container,{componentName:"EffectList",init:function(c,d,e){var f=b.super.init.call(this,c,d,e);return this.code.setup(d,this),this.fm=new a.FrameBufferManager(d.canvas.width,d.canvas.height,c,d.copier),f},update:function(){b.super.update.call(this);var a=this.gl;if((!this.enableOnBeat||(this.main.analyser.beat?this._frameCounter=this.enableOnBeatFor:this._frameCounter>0&&this._frameCounter--,0!==this._frameCounter))&&(this.code.beat=this.main.analyser.beat?1:0,this.code.enabled=1,this.code.clear=this.clearFrame,this._inited||(this._inited=!0,this.code.init()),this.code.perFrame(),0!==this.code.enabled)){if(this.fm.setRenderTarget(),(this.clearFrame||this.first||this.code.clear)&&(a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT),this.first=!1),-1!==this.input){var c=this.parent.fm.getCurrentTexture();this.main.copier.run(this.fm,this.input,c)}this.iterChildren(function(a){a.enabled&&a.update()}),this.fm.restoreRenderTarget(),-1!=this.output&&(this.parent?this.main.copier.run(this.parent.fm,this.output,this.fm.getCurrentTexture()):this.main.copier.run(null,null,this.fm.getCurrentTexture()))}},destroy:function(){b.super.destroy.call(this),this.fm&&this.fm.destroy()}}),b.ui={disp:"Effect List",type:"EffectList",leaf:!1,schema:{clearFrame:{type:"boolean",title:"Clear Frame","default":!1,required:!0},enableOnBeat:{type:"boolean",title:"Enable on beat","default":!1},enableOnBeatFor:{type:"number",title:"Enable on beat for frames","default":1},output:{type:"string",title:"Output","default":"REPLACE","enum":_.keys(a.blendModes)},input:{type:"string",title:"Input","default":"IGNORE","enum":_.union(_.keys(a.blendModes),["IGNORE"])}}}}(Webvs),function(a){function b(b){b=_.defaults(b,{forceShaderBlend:!1,outputBlendMode:a.REPLACE,varyingPos:!1,dynamicBlend:!1,swapFrame:!1,copyOnSwap:!1});var c=["precision mediump float;","uniform vec2 u_resolution;","#define PI "+Math.PI],d=_.clone(c);if(_.isFunction(b.draw)&&(this.draw=b.draw),this.copyOnSwap=b.copyOnSwap,this.varyingPos=b.varyingPos,this.dynamicBlend=b.dynamicBlend,this.outputBlendMode=b.outputBlendMode,b.swapFrame||this.dynamicBlend||b.forceShaderBlend||!_.contains(this.glBlendModes,this.outputBlendMode)?(this.swapFrame=!0,this.glBlendMode=!1,this.varyingPos=!0):(this.swapFrame=!1,this.glBlendMode=!0),this.varyingPos?(c.push("varying vec2 v_position;"),d.push("varying vec2 v_position;","#define setPosition(pos) (v_position = (((pos)+1.0)/2.0),gl_Position = vec4((pos), 0, 1))")):d.push("#define setPosition(pos) (gl_Position = vec4((pos), 0, 1))"),this.swapFrame&&(d.push("uniform sampler2D u_srcTexture;","#define getSrcColorAtPos(pos) (texture2D(u_srcTexture, pos))"),c.push("uniform sampler2D u_srcTexture;","#define getSrcColor() (texture2D(u_srcTexture, v_position))","#define getSrcColorAtPos(pos) (texture2D(u_srcTexture, pos))")),this.dynamicBlend)c.push("uniform int u_blendMode;","void setFragColor(vec4 color) {"),_.each(this.blendEqs,function(a,b){c.push(" if(u_blendMode == "+b+") {"," gl_FragColor = ("+a+");"," }")}),c.push("}");else{var e=this.blendEqs[this.glBlendMode?a.REPLACE:this.outputBlendMode];if(_.isUndefined(e))throw new Error("Blend Mode "+this.outputBlendMode+" not supported");c.push("#define setFragColor(color) (gl_FragColor = ("+e+"))")}this.fragmentSrc=c.join("\n")+"\n"+b.fragmentShader.join("\n"),this.vertexSrc=d.join("\n")+"\n"+b.vertexShader.join("\n"),this._locations={},this._textureVars=[],this._arrBuffers={}}a.ShaderProgram=a.defineClass(b,Object,{glBlendModes:[a.REPLACE,a.AVERAGE,a.ADDITIVE,a.SUBTRACTIVE1,a.SUBTRACTIVE2,a.MULTIPLY],blendEqs:_.object([[a.REPLACE,"color"],[a.MAXIMUM,"max(color, texture2D(u_srcTexture, v_position))"],[a.AVERAGE,"(color+texture2D(u_srcTexture, v_position))/2.0"],[a.ADDITIVE,"color+texture2D(u_srcTexture, v_position)"],[a.SUBTRACTIVE1,"texture2D(u_srcTexture, v_position)-color"],[a.SUBTRACTIVE2,"color-texture2D(u_srcTexture, v_position)"],[a.MULTIPLY,"color*texture2D(u_srcTexture, v_position)"]]),init:function(a){this.gl=a;try{this._compileProgram(this.vertexSrc,this.fragmentSrc)}catch(b){throw b}},setOutputBlendMode:function(a){this.outputBlendMode=a},run:function(b,c){var d=this.gl,e=d.getParameter(d.CURRENT_PROGRAM);if(d.useProgram(this.program),b&&(this.setUniform("u_resolution","2f",b.width,b.height),this.swapFrame&&(this.setUniform("u_srcTexture","texture2D",b.getCurrentTexture()),b.swapAttachment(),this.copyOnSwap&&b.copyOver())),c&&!this.dynamicBlend)throw new Error("Cannot set blendmode at runtime. Use dynamicBlend");c=c||this.outputBlendMode,this.dynamicBlend&&this.setUniform("u_blendMode","1i",c),this.glBlendMode&&c!=a.REPLACE?(d.enable(d.BLEND),this._setGlBlendMode(d,c)):d.disable(d.BLEND),this.draw.apply(this,_.drop(arguments,2)),d.disable(d.BLEND),d.useProgram(e)},draw:function(){},_compileProgram:function(a,b){var c=this.gl,d=this._compileShader(a,c.VERTEX_SHADER),e=this._compileShader(b,c.FRAGMENT_SHADER),f=c.createProgram(); -if(c.attachShader(f,d),c.attachShader(f,e),c.linkProgram(f),!c.getProgramParameter(f,c.LINK_STATUS))throw new Error("Program link Error: "+c.getProgramInfoLog(f));this.vertex=d,this.fragment=e,this.program=f},_compileShader:function(b,c){var d=this.gl,e=d.createShader(c);if(d.shaderSource(e,b),d.compileShader(e),!d.getShaderParameter(e,d.COMPILE_STATUS))throw a.logShaderError(b,d.getShaderInfoLog(e)),new Error("Shader compilation Error: "+d.getShaderInfoLog(e));return e},_setGlBlendMode:function(b,c){switch(c){case a.ADDITIVE:b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_ADD);break;case a.SUBTRACTIVE1:b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_REVERSE_SUBTRACT);break;case a.SUBTRACTIVE2:b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_SUBTRACT);break;case a.MULTIPLY:b.blendFunc(b.DST_COLOR,b.ZERO),b.blendEquation(b.FUNC_ADD);break;case a.AVERAGE:b.blendColor(.5,.5,.5,1),b.blendFunc(b.CONSTANT_COLOR,b.CONSTANT_COLOR),b.blendEquation(b.FUNC_ADD);break;default:throw new Error("Invalid blend mode")}},getLocation:function(a,b){var c=this._locations[a];return _.isUndefined(c)&&(c=b?this.gl.getAttribLocation(this.program,a):this.gl.getUniformLocation(this.program,a),this._locations[a]=c),c},getTextureId:function(a){var b=_.indexOf(this._textureVars,a);return-1===b&&(this._textureVars.push(a),b=this._textureVars.length-1),b},setUniform:function(a,b,c){var d=this.getLocation(a),e=this.gl;switch(b){case"texture2D":var f=this.getTextureId(a);e.activeTexture(e["TEXTURE"+f]),e.bindTexture(e.TEXTURE_2D,c),e.uniform1i(d,f);break;case"1f":case"2f":case"3f":case"4f":case"1i":case"2i":case"3i":case"4i":var g=[d].concat(_.drop(arguments,2));e["uniform"+b].apply(e,g);break;case"1fv":case"2fv":case"3fv":case"4fv":case"1iv":case"2iv":case"3iv":case"4iv":e["uniform"+b].apply(e,d,c)}},setVertexAttribArray:function(a,b,c,d,e,f,g){var h=this.gl;c=c||2,d=d||h.FLOAT,e=e||!1,f=f||0,g=g||0;var i=this._arrBuffers[a];_.isUndefined(i)&&(i=h.createBuffer(),this._arrBuffers[a]=i);var j=this.getLocation(a,!0);h.bindBuffer(h.ARRAY_BUFFER,i),h.bufferData(h.ARRAY_BUFFER,b,h.STATIC_DRAW),h.enableVertexAttribArray(j),h.vertexAttribPointer(j,c,d,e,f,g)},setElementArray:function(a){var b=this.gl,c=this._arrBuffers.__indexBuffer;_.isUndefined(c)&&(c=b.createBuffer(),this._arrBuffers.__indexBuffer=c),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c),b.bufferData(b.ELEMENT_ARRAY_BUFFER,a,b.STATIC_DRAW)},cleanup:function(){var a=this.gl;_.each(this._buffers,function(b){a.deleteBuffer(b)},this),a.deleteProgram(this.program),a.deleteShader(this.vertexShader),a.deleteShader(this.fragmentShader)}})}(Webvs),function(a){function b(a){a=_.defaults(a,{vertexShader:["attribute vec2 a_position;","void main() {"," setPosition(a_position);","}"],varyingPos:!0}),b.super.constructor.call(this,a)}a.QuadBoxProgram=a.defineClass(b,a.ShaderProgram,{draw:function(){this.setVertexAttribArray("a_position",new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1])),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}})}(Webvs),function(a){function b(a){a=_.defaults(a||{},{fragmentShader:["uniform sampler2D u_copySource;","void main() {"," setFragColor(texture2D(u_copySource, v_position));","}"]}),b.super.constructor.call(this,a)}a.CopyProgram=a.defineClass(b,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_copySource","texture2D",a),b.super.draw.call(this)}})}(Webvs),function(a){function b(a,b,c,d,e){this.gl=c,this.width=a,this.height=b,this.copier=d,this.texCount=e||2,this._initFrameBuffers()}a.FrameBufferManager=a.defineClass(b,Object,{_initFrameBuffers:function(){for(var a=this.gl,b=a.createFramebuffer(),c=[],d=0;de;e++){var f=b.charAt(e);"\n"===f?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1)}a.offset+=c}function f(a){F.offsetH.offset&&(H=d(F),I=[]),I.push(a))}function g(){var a="program@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,i,j,k,l,m,n,o,p,q;if(o=d(F),p=d(F),g=h(),null!==g)if(i=x(),null!==i){for(j=[],q=d(F),59===b.charCodeAt(F.offset)?(k=";",e(F,1)):(k=null,0===G&&f('";"')),null!==k?(l=x(),null!==l?(m=h(),null!==m?(n=x(),null!==n?k=[k,l,m,n]:(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q));null!==k;)j.push(k),q=d(F),59===b.charCodeAt(F.offset)?(k=";",e(F,1)):(k=null,0===G&&f('";"')),null!==k?(l=x(),null!==l?(m=h(),null!==m?(n=x(),null!==n?k=[k,l,m,n]:(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q));null!==j?(59===b.charCodeAt(F.offset)?(k=";",e(F,1)):(k=null,0===G&&f('";"')),k=null!==k?k:"",null!==k?g=[g,i,j,k]:(g=null,F=d(p))):(g=null,F=d(p))}else g=null,F=d(p);else g=null,F=d(p);return null!==g&&(g=function(a,b,c,d){var e=[d[0]];return e=e.concat(_.map(d[2],function(a){return a[2]})),new Webvs.AstProgram(e)}(o.offset,o.line,o.column,g)),null===g&&(F=d(o)),J[a]={nextPos:d(F),result:g},g}function h(){var a="statement@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n;return l=d(F),n=d(F),g=s(),null!==g?(h=x(),null!==h?(61===b.charCodeAt(F.offset)?(i="=",e(F,1)):(i=null,0===G&&f('"="')),null!==i?(j=x(),null!==j?(k=m(),null!==k?g=[g,h,i,j,k]:(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d,e){return new Webvs.AstAssignment(d,e)}(l.offset,l.line,l.column,g[0],g[4])),null===g&&(F=d(l)),null===g&&(g=m()),J[a]={nextPos:d(F),result:g},g}function i(){var a="unary_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function j(){var a="additive_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function k(){var a="multiplicative_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 42===b.charCodeAt(F.offset)?(g="*",e(F,1)):(g=null,0===G&&f('"*"')),null===g&&(47===b.charCodeAt(F.offset)?(g="/",e(F,1)):(g=null,0===G&&f('"/"')),null===g&&(37===b.charCodeAt(F.offset)?(g="%",e(F,1)):(g=null,0===G&&f('"%"')))),J[a]={nextPos:d(F),result:g},g}function l(){var a="boolean_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 38===b.charCodeAt(F.offset)?(g="&",e(F,1)):(g=null,0===G&&f('"&"')),null===g&&(124===b.charCodeAt(F.offset)?(g="|",e(F,1)):(g=null,0===G&&f('"|"'))),J[a]={nextPos:d(F),result:g},g}function m(){var a="boolean_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,k,m;if(j=d(F),k=d(F),c=n(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(k))}else c=null,F=d(k);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function n(){var a="additive_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,k,l,m;if(k=d(F),l=d(F),c=o(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(k.offset,k.line,k.column,c[0],c[1])),null===c&&(F=d(k)),J[a]={nextPos:d(F),result:c},c}function o(){var a="multiplicative_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,l,m;if(j=d(F),l=d(F),c=p(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function p(){var a="unary@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h;return g=d(F),h=d(F),c=i(),null!==c?(e=x(),null!==e?(f=q(),null!==f?c=[c,e,f]:(c=null,F=d(h))):(c=null,F=d(h))):(c=null,F=d(h)),null!==c&&(c=function(a,b,c,d,e){return new Webvs.AstUnaryExpr(d,e)}(g.offset,g.line,g.column,c[0],c[2])),null===c&&(F=d(g)),null===c&&(c=q()),J[a]={nextPos:d(F),result:c},c}function q(){var a="func_call@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n,o,p,q,s,t;if(p=d(F),q=d(F),s=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(s))}else g=null,F=d(s);if(null!==g)if(h=x(),null!==h)if(40===b.charCodeAt(F.offset)?(i="(",e(F,1)):(i=null,0===G&&f('"("')),null!==i){for(s=d(F),j=[],t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==k;)j.push(k),t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==j?(k=x(),null!==k?(l=m(),null!==l?j=[j,k,l]:(j=null,F=d(s))):(j=null,F=d(s))):(j=null,F=d(s)),j=null!==j?j:"",null!==j?(k=x(),null!==k?(41===b.charCodeAt(F.offset)?(l=")",e(F,1)):(l=null,0===G&&f('")"')),null!==l?g=[g,h,i,j,k,l]:(g=null,F=d(q))):(g=null,F=d(q))):(g=null,F=d(q))}else g=null,F=d(q);else g=null,F=d(q);else g=null,F=d(q);return null!==g&&(g=function(a,b,c,d,e){var f=[];return _.each(e[0],function(a){f.push(a[1])}),f.push(e[2]),new Webvs.AstFuncCall(D(d),f)}(p.offset,p.line,p.column,g[0],g[3])),null===g&&(F=d(p)),null===g&&(g=r()),J[a]={nextPos:d(F),result:g},g}function r(){var a="primary_expr@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;return g=w(),null===g&&(g=u(),null===g&&(g=v(),null===g&&(g=t(),null===g&&(j=d(F),k=d(F),40===b.charCodeAt(F.offset)?(g="(",e(F,1)):(g=null,0===G&&f('"("')),null!==g?(h=m(),null!==h?(41===b.charCodeAt(F.offset)?(i=")",e(F,1)):(i=null,0===G&&f('")"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))):(g=null,F=d(k)),null!==g&&(g=function(a,b,c,d){return d}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)))))),J[a]={nextPos:d(F),result:g},g}function s(){var a="assignable@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c;return c=v(),null===c&&(c=t()),J[a]={nextPos:d(F),result:c},c}function t(){var a="identifier@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"ID")}(j.offset,j.line,j.column,g)),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function u(){var a="constant@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),36===b.charCodeAt(F.offset)?(g="$",e(F,1)):(g=null,0===G&&f('"$"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"CONST")}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function v(){var a="register@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(l=d(F),m=d(F),64===b.charCodeAt(F.offset)?(g="@",e(F,1)):(g=null,0===G&&f('"@"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(m))}else g=null,F=d(m);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_AT_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g[1])),null===g&&(F=d(l)),null===g&&(l=d(F),m=d(F),/^[rR]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[rR]")),null!==g?(/^[eE]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[eE]")),null!==h?(/^[gG]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[gG]")),null!==i?(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j?(/^[0-9]/.test(b.charAt(F.offset))?(k=b.charAt(F.offset),e(F,1)):(k=null,0===G&&f("[0-9]")),null!==k?g=[g,h,i,j,k]:(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g)),null===g&&(F=d(l))),J[a]={nextPos:d(F),result:g},g}function w(){var a="value@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m,n,o;for(m=d(F),n=d(F),g=[],/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));if(null!==g)if(46===b.charCodeAt(F.offset)?(h=".",e(F,1)):(h=null,0===G&&f('"."')),null!==h){if(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j)for(i=[];null!==j;)i.push(j),/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]"));else i=null;if(null!==i){if(o=d(F),/^[Ee]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[Ee]")),null!==j){if(/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]")),null!==l)for(k=[];null!==l;)k.push(l),/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]"));else k=null;null!==k?j=[j,k]:(j=null,F=d(o))}else j=null,F=d(o);j=null!==j?j:"",null!==j?g=[g,h,i,j]:(g=null,F=d(n))}else g=null,F=d(n)}else g=null,F=d(n);else g=null,F=d(n);if(null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseFloat(D(d)),"VALUE")}(m.offset,m.line,m.column,g)),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]"));else g=null;if(null!==g?(/^[hH]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[hH]")),null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),16),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));else g=null;null!==g?(/^[dD]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[dD]")),h=null!==h?h:"",null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),10),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m))}}return J[a]={nextPos:d(F),result:g},g}function x(){var a="__@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e;for(c=[],e=y(),null===e&&(e=z(),null===e&&(e=A()));null!==e;)c.push(e),e=y(),null===e&&(e=z(),null===e&&(e=A()));return J[a]={nextPos:d(F),result:c},c}function y(){var a="whiteSpace@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\t\x0B\f \xA0\uFEFF]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\t\\x0B\\f \\xA0\\uFEFF]")),J[a]={nextPos:d(F),result:g},g}function z(){var a="lineEnd@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\n\r\u2028\u2029]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\n\\r\\u2028\\u2029]")),J[a]={nextPos:d(F),result:g},g}function A(){var a="comment@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(k=d(F),"/*"===b.substr(F.offset,2)?(g="/*",e(F,2)):(g=null,0===G&&f('"/*"')),null!==g){for(h=[],l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?("*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))}else g=null,F=d(k);if(null===g)if(k=d(F),"//"===b.substr(F.offset,2)?(g="//",e(F,2)):(g=null,0===G&&f('"//"')),null!==g){for(h=[],l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return J[a]={nextPos:d(F),result:g},g}function B(a){a.sort();for(var b=null,c=[],d=0;dH.offset?F:H;throw new this.SyntaxError(B(I),M,L,N.line,N.column)}return K},toSource:function(){return this._source}};return b.SyntaxError=function(b,c,d,e,f){function g(b,c){var d,e;switch(b.length){case 0:d="end of input";break;case 1:d=b[0];break;default:d=b.slice(0,b.length-1).join(", ")+" or "+b[b.length-1]}return e=c?a(c):"end of input","Expected "+d+" but "+e+" found."}this.name="SyntaxError",this.expected=b,this.found=c,this.message=g(b,c),this.offset=d,this.line=e,this.column=f},b.SyntaxError.prototype=Error.prototype,b}(),function(a){function b(){}a.CodeInstance=a.defineClass(b,Object,{rand:function(a){return Math.floor(Math.random()*a)+1},gettime:function(a){switch(a){case 0:var b=(new Date).getTime();return(b-this._bootTime)/1e3;default:throw new Error("Invalid startTime mode for gettime call")}},getosc:function(a,b){for(var c=this._analyser.getWaveform(),d=Math.floor((a-b/2)*(c.length-1)),e=Math.floor((a+b/2)*(c.length-1)),f=0,g=d;e>=g;g++)f+=c[g];return f/(e-d+1)},bindUniforms:function(a){var b=this,c=_.difference(_.keys(this),this._treatAsNonUniform);if(_.each(c,function(c){var d=b[c];"number"==typeof d&&a.setUniform(c,"1f",d)}),_.each(this._registerUsages,function(b){a.setUniform(b,"1f",this._registerBank[b])}),this.hasRandom){var d=[Math.random()/100,Math.random()/100];a.setUniform("__randStep","2fv",d)}if(this.hasGettime){var e=((new Date).getTime()-this._bootTime)/1e3;a.setUniform("__gettime0","1f",e)}_.each(this._preCompute,function(b){var c=_.map(_.last(b,b.length-2),function(a){return _.isString(a)?"__REG"==a.substring(0,5)?this._registerBank[a]:this[a]:a}),d=this[b[0]].apply(this,c);a.setUniform(b[1],"1f",d)})},setup:function(a,b){this._registerBank=a.registerBank,this._bootTime=a.bootTime,this._analyser=a.analyser,this.w=a.canvas.width,this.h=a.canvas.height,this.cid=b.cloneId||0,_.each(this._registerUsages,function(b){_.has(a.registerBank,b)||(a.registerBank[b]=0)})}})}(Webvs),function(a){function b(a,b){this.codeSrc=a,this.externalVars=_.union(b||[],["w","h","cid"]),this._parseSrc()}a.ExprCodeGenerator=a.defineClass(b,Object,{_parseSrc:function(){var b={},c=[],d={},e=[];for(var f in this.codeSrc)try{var g=this.codeSrc[f];_.isArray(g)&&(g=g.join("\n")),b[f]=a.PegExprParser.parse(g);var h=[];this._getVars(b[f],c,h,e),d[f]=h}catch(i){throw new Error("Error parsing "+f+"("+i.line+":"+i.column+")"+" : "+i)}this.codeAst=b,this.funcUsages=d,this.instanceVars=_.uniq(this.externalVars.concat(c)),this.registerUsages=_.uniq(e)},generateCode:function(b,c,d){var e=new a.CodeInstance,f=this,g=[];_.each(this.instanceVars,function(a){e[a]=0;var b="";_.contains(d,a)||(b="uniform "),g.push(b+"float "+a+";")});var h=_.intersection(_.keys(this.codeAst),b),i=_.difference(b,h);_.each(h,function(a){var b=f.codeAst[a],c=f._generateJs(b);e[a]=new Function(c)}),_.each(i,function(b){e[b]=a.noop});var j=_.intersection(_.keys(this.codeAst),c),k=_.difference(c,j),l=_.uniq(_.flatMap(j,function(a){return f.funcUsages[a]}));_.each(l,function(a){var b=f.glslFuncCode[a];b&&g.push(b)});var m=[],n=[];return _.each(j,function(a){var b=f.codeAst[a],c=f._generateGlsl(b,m);n.push("void "+a+"() {"),n.push(c),n.push("}")}),g=g.concat(_.map(m,function(a){return"uniform float "+a[1]+";"})),g=g.concat(n),e._preCompute=m,_.each(k,function(a){g.push("void "+a+"() {}")}),_.contains(j,"rand")&&(e.hasRandom=!0),_.contains(j,"gettime")&&(e.hasGettime=!0),e._treatAsNonUniform=d,e._registerUsages=this.registerUsages,[e,g.join("")]},funcArgLengths:{above:2,below:2,equal:2,pow:2,sqr:1,sqrt:1,invsqrt:1,floor:1,ceil:1,abs:1,"if":3,min:2,max:2,sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,log:1,band:2,bor:2,bnot:1,rand:1,gettime:1,getosc:3,select:{min:2}},jsMathFuncs:["min","max","sin","cos","abs","tan","asin","acos","atan","log","pow","sqrt","floor","ceil"],glslFuncCode:{rand:["uniform vec2 __randStep;","vec2 __randSeed;","float rand(float max) {"," __randCur += __randStep;"," float val = fract(sin(dot(__randSeed.xy ,vec2(12.9898,78.233))) * 43758.5453);"," return (floor(val*max)+1);","}"].join("\n"),gettime:["uniform float __gettime0;","int gettime(int startTime) {"," int time = 0;"," if(startTime == 0) {"," time = __gettime0;"," }"," return time;","}"].join("\n")},_checkFunc:function(a){var b=this.funcArgLengths[a.funcName];if(void 0===b)throw Error("Unknown function "+a.funcName);if(_.isNumber(b)){if(a.args.length!=b)throw Error(a.funcName+" accepts "+b+" arguments")}else if(b.min&&a.args.length",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"below":return["(",this._generateGlsl(b.args[0],c),"<",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"equal":return["(",this._generateGlsl(b.args[0],c),"==",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"if":return["(",this._generateGlsl(b.args[0],c),"!=0.0?",this._generateGlsl(b.args[1],c),":",this._generateGlsl(b.args[2],c),")"].join("");case"select":var e=this._generateGlsl(b.args[0],c),f=function(a,b){return 1==a.length?d._generateGlsl(a[0],c):["(("+e+" === "+b+")?","("+d._generateGlsl(a[0],c)+"):","("+f(_.last(a,a.length-1),b+1)+"))"].join("")};return f(_.last(b.args,b.args.length-1),0);case"sqr":return"(pow(("+this._generateGlsl(b.args[0],c)+"), 2))";case"band":return"(float(("+this._generateGlsl(b.args[0],c)+")&&("+this._generateGlsl(b.args[1],c)+")))";case"bor":return"(float(("+this._generateGlsl(b.args[0],c)+")||("+this._generateGlsl(b.args[1],c)+")))";case"bnot":return"(float(!("+this._generateGlsl(b.args[0],c)+")))";case"invsqrt":return"(1/sqrt("+this._generateGlsl(b.args[0],c)+"))";case"atan2":return"(atan(("+this._generateGlsl(b.args[0],c)+"),("+this._generateGlsl(b.args[1],c)+"))";case"getosc":var g=_.every(b.args,function(b){return b instanceof a.AstPrimaryExpr});if(!g)throw new Error("Non Pre-Computable arguments for getosc in shader code, use variables or constants");var h="__PC_"+b.funcName+"_"+j,i=[b.funcName,h].concat(_.map(b.args,function(a){return a.value})),j=_.indexOf(c,i);return-1==j&&(c.push(i),j=c.length-1),h;default:var k=_.map(b.args,function(a){return d._generateGlsl(a,c)}).join(","),l=b.funcName;return _.contains(this.varArgFuncs,b.funcName)&&(l+=b.args.length),"("+l+"("+k+"))"}if(b instanceof a.AstAssignment)return this._generateGlsl(b.lhs,c)+"="+this._generateGlsl(b.expr,c);if(b instanceof a.AstProgram){var m=_.map(b.statements,function(a){return d._generateGlsl(a,c)});return m.join(";\n")+";"}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?a.glslFloatRepr(b.value):b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&("ID"===b.type||"REG"===b.type)?b.value:void 0},_generateJs:function(b){var c,d=this;if(b instanceof a.AstBinaryExpr)return"("+this._generateJs(b.leftOperand)+b.operator+this._generateJs(b.rightOperand)+")";if(b instanceof a.AstUnaryExpr)return"("+b.operator+this._generateJs(b.operand)+")";if(b instanceof a.AstFuncCall)switch(this._checkFunc(b),b.funcName){case"above":return["(",this._generateJs(b.args[0]),">",this._generateJs(b.args[1]),"?1:0)"].join("");case"below":return["(",this._generateJs(b.args[0]),"<",this._generateJs(b.args[1]),"?1:0)"].join("");case"equal":return["(",this._generateJs(b.args[0]),"==",this._generateJs(b.args[1]),"?1:0)"].join("");case"if":return["(",this._generateJs(b.args[0]),"!==0?",this._generateJs(b.args[1]),":",this._generateJs(b.args[2]),")"].join("");case"select":var e=["((function() {"];return e.push("switch("+this._generateJs(b.args[0])+") {"),_.each(_.last(b.args,b.args.length-1),function(a,b){e.push("case "+b+": return "+this._generateJs(a)+";")},this),e.push("default : throw new Error('Unknown selector value in select');"),e.push("}}).call(this))"),e.join("");case"sqr":return"(Math.pow(("+this._generateJs(b.args[0])+"),2))";case"band":return"((("+this._generateJs(b.args[0])+")&&("+this._generateJs(b.args[1])+"))?1:0)";case"bor":return"((("+this._generateJs(b.args[0])+")||("+this._generateJs(b.args[1])+"))?1:0)";case"bnot":return"((!("+this._generateJs(b.args[0])+"))?1:0)";case"invsqrt":return"(1/Math.sqrt("+this._generateJs(b.args[0])+"))";case"atan2":return"(Math.atan(("+this._generateJs(b.args[0])+")/("+this._generateJs(b.args[1])+")))";default:var f=_.map(b.args,function(a){return d._generateJs(a)}).join(",");return c=_.contains(this.jsMathFuncs,b.funcName)?"Math.":"this.","("+c+b.funcName+"("+f+"))"}if(b instanceof a.AstAssignment)return this._generateJs(b.lhs)+"="+this._generateJs(b.expr);if(b instanceof a.AstProgram){var g=_.map(b.statements,function(a){return d._generateJs(a)});return g.join(";\n")}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?b.value.toString():b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&"ID"===b.type?"this."+b.value:b instanceof a.AstPrimaryExpr&&"REG"===b.type?'this._registerBank["'+b.value+'"]':void 0 -},_getVars:function(b,c,d,e){var f=this;b instanceof a.AstBinaryExpr?(this._getVars(b.leftOperand,c,d,e),this._getVars(b.rightOperand,c,d,e)):b instanceof a.AstUnaryExpr?this._getVars(b.operand,c,d,e):b instanceof a.AstFuncCall?(d.push(b.funcName),_.each(b.args,function(a){f._getVars(a,c,d,e)})):b instanceof a.AstAssignment?(this._getVars(b.lhs,c,d,e),this._getVars(b.expr,c,d,e)):b instanceof a.AstProgram?_.each(b.statements,function(a){f._getVars(a,c,d,e)}):b instanceof a.AstPrimaryExpr&&"ID"===b.type?c.push(b.value):b instanceof a.AstPrimaryExpr&&"REG"===b.type&&e.push(b.value)},_translateConstants:function(a){switch(a){case"pi":return Math.PI;case"e":return Math.E;case"phi":return 1.6180339887;default:throw new Error("Unknown constant "+a)}}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]);var d=new a.ExprCodeGenerator(c.code,["b"]),e=d.generateCode(["init","onBeat","perFrame"],[],[]);this.code=e[0],this.inited=!1,b.super.constructor.apply(this,arguments)}a.GlobalVar=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.code.setup(c,this)},update:function(){var a=this.code;a.b=this.main.analyser.beat?1:0,this.inited||(a.init(),this.inited=!0),this.main.analyser.beat&&a.onBeat(),a.perFrame()}}),b.ui={disp:"Global Var",type:"GlobalVar",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"}}}}}}(Webvs),function(a){function b(c){if(c=_.defaults(c,{action:"SAVE",bufferId:1,blendMode:"REPLACE"}),this.blendMode=a.blendModes[c.blendMode],this.action=this.actions[c.action],!this.action)throw new Error("Unknown BufferSave action "+c.action);this.action==this.actions.SAVERESTORE?this._nextAction=this.actions.SAVE:this.action==this.actions.RESTORESAVE&&(this._nextAction=this.actions.RESTORE),this._bufferId="__BUFFERSAVE_"+c.bufferId,b.super.constructor.apply(this,arguments)}a.BufferSave=a.defineClass(b,a.Component,{actions:{SAVE:1,RESTORE:2,SAVERESTORE:3,RESTORESAVE:4},init:function(c,d,e){if(b.super.init.call(this,c,d,e),!d.registerBank[this._bufferId]){var f=new a.FrameBufferManager(d.canvas.width,d.canvas.height,c,d.copier,1);d.registerBank[this._bufferId]=f}},update:function(){this.gl;var a,b=this.main.registerBank[this._bufferId];switch(this.action==this.actions.SAVERESTORE||this.action==this.RESTORESAVE?(a=this._nextAction,this._nextAction=this._nextAction==this.actions.SAVE?this.actions.RESTORE:this.actions.SAVE):a=this.action,a){case this.actions.SAVE:b.setRenderTarget(),this.main.copier.run(null,null,this.parent.fm.getCurrentTexture()),b.restoreRenderTarget();break;case this.actions.RESTORE:this.main.copier.run(this.parent.fm,this.blendMode,b.getCurrentTexture())}},destroy:function(){b.super.destroy.call(this),this.main.registerBank[this._bufferId].destroy()}}),b.ui={disp:"Buffer Save",type:"BufferSave",schema:{action:{type:"string",title:"Buffer save action","enum":["SAVE","RESTORE","SAVERESTORE","RESTORESAVE"]},bufferId:{type:"number",title:"Buffer Id","enum":[1,2,3,4,5,6,7,8]},blendMode:{type:"string",title:"Blend mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){c=_.defaults(c,{speed:1,color:"#000000"}),this.color=a.parseColorNorm(c.color),this.frameCount=0,this.maxFrameCount=Math.floor(1/c.speed),this.program=new a.ClearScreenProgram(a.AVERAGE),b.super.constructor.apply(this,arguments)}a.FadeOut=a.defineClass(b,a.Component,{componentName:"FadeOut",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.gl,this.frameCount++,this.frameCount==this.maxFrameCount&&(this.frameCount=0,this.program.run(this.parent.fm,null,this.color))},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.ui={type:"FadeOut",disp:"Fade Out",schema:{speed:{type:"number",title:"Speed",maximum:0,minimum:1,"default":1},color:{type:"string",title:"Fadeout color",format:"color","default":"#FFFFFF"}},form:[{key:"speed",type:"range",step:"0.05"},"color"]}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["kernel"]),c=_.defaults(c,{edgeMode:"EXTEND",bias:0});var d;if(c.kernel in b.kernels)d=b.kernels[c.kernel];else{if(!_.isArray(c.kernel)||1!==c.kernel.length%2)throw new Error("Invalid convolution kernel");d=c.kernel}var e=Math.floor(Math.sqrt(d.length));if(e*e!=d.length)throw new Error("Invalid convolution kernel");this.program=new a.ConvolutionProgram(d,e,c.edgeMode,c.scale,c.bias),b.super.constructor.apply(this,arguments)}function c(b,d,e,f,g){var h="";switch(e){case"WRAP":h="pos = vec2(pos.x<0?pos.x+1.0:pos.x%1, pos.y<0?pos.y+1.0:pos.y%1);";break;case"EXTEND":h="pos = clamp(pos, vec2(0,0), vec2(1,1));";break;default:throw new Error("Invalid edge mode")}var i,j,k=[],l=Math.floor(d/2);for(i=0;d>i;i++)for(j=0;d>j;j++){var m=b[i*d+j];0!==m&&(k.push("pos = v_position + texel * vec2("+(i-l)+","+(j-l)+");"),k.push(h),k.push("colorSum += texture2D(u_srcTexture, pos) * "+a.glslFloatRepr(m)+";"))}_.isUndefined(f)&&(f=_.reduce(b,function(a,b){return a+b},0)),c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["void main() {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 pos;"," vec4 colorSum = vec4(0,0,0,0);",k.join("\n")," setFragColor(vec4(((colorSum+"+a.glslFloatRepr(g)+") / "+a.glslFloatRepr(f)+").rgb, 1.0));","}"]})}a.Convolution=a.defineClass(b,a.Component,{componentName:"Convolution",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.kernels={normal:[0,0,0,0,1,0,0,0,0],gaussianBlur:[.045,.122,.045,.122,.332,.122,.045,.122,.045],unsharpen:[-1,-1,-1,-1,9,-1,-1,-1,-1],emboss:[-2,-1,0,-1,1,1,0,1,2],blur:[1,1,1,1,1,1,1,1,1]},a.ConvolutionProgram=a.defineClass(c,a.QuadBoxProgram)}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["maps"]),c=_.defaults(c,{key:"RED",output:"REPLACE",mapCycleMode:"SINGLE"}),this.maps=c.maps,this.currentMap=0,this.mapCycleMode=this.mapCycleModes[c.mapCycleMode],!this.mapCycleMode)throw new Error("Unknown mapCycleMode "+c.mapCycleMode);this.program=new a.ColorMapProgram(c.key,a.getBlendMode(c.output)),b.super.constructor.apply(this,arguments)}function c(a,b){var d="";switch(a){case"RED":d="srcColor.r";break;case"GREEN":d="srcColor.g";break;case"BLUE":d="srcColor.b";break;case"(R+G+B)/2":d="mod((srcColor.r+srcColor.g+srcColor.b)/2.0, 1.0)";break;case"(R+G+B)/3":d="(srcColor.r+srcColor.g+srcColor.b)/3.0";break;case"MAX":d="max(srcColor.r, max(srcColor.g, srcColor.b))";break;default:throw new Error("Unknown colormap key function "+options.key)}c.super.constructor.call(this,{outputBlendMode:b,swapFrame:!0,fragmentShader:["uniform sampler2D u_colorMap;","void main() {"," vec4 srcColor = getSrcColor();"," setFragColor(texture2D(u_colorMap, vec2(("+d+"), 0)));","}"]})}a.ColorMap=a.defineClass(b,a.Component,{mapCycleModes:{SINGLE:1,ONBEATRANDOM:2,ONBEATSEQUENTIAL:3},init:function(a,c,d){b.super.init.call(this,a,c,d),this.colorMaps=_.map(this.maps,function(a){return this._buildColorMap(a)},this),this.currentMap=0,this.program.init(a)},update:function(){if(this.main.analyser.beat)switch(this.mapCycleMode){case this.mapCycleModes.ONBEATRANDOM:this.currentMap=Math.floor(Math.random()*this.colorMaps.length);break;case this.mapCycleModes.ONBEATSEQUENTIAL:this.currentMap=(this.currentMap+1)%this.colorMaps.length}this.program.run(this.parent.fm,null,this.colorMaps[this.currentMap])},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_buildColorMap:function(b){var c=this.gl;b=_.sortBy(b,function(a){return a.index});var d=_.map(b,function(a){return a.index});if(_.uniq(d).length!=d.length)throw new Error("map cannot have repeated indices");b=_.map(b,function(b){var c=a.parseColor(b.color);return{color:c,index:b.index}});var e=_.first(b);0!==e.index&&b.splice(0,0,{color:e.color,index:0});var f=_.last(b);255!==f.index&&b.push({color:f.color,index:255});var g=new Uint8Array(768),h=0,i=_.zip(_.first(b,b.length-1),_.last(b,b.length-1));_.each(i,function(a){var b=a[0],c=a[1],d=c.index-b.index;_.times(d,function(a){g[h++]=Math.floor((b.color[0]*(255-a)+c.color[0]*a)/255),g[h++]=Math.floor((b.color[1]*(255-a)+c.color[1]*a)/255),g[h++]=Math.floor((b.color[2]*(255-a)+c.color[2]*a)/255)})}),g[h++]=f.color[0],g[h++]=f.color[1],g[h++]=f.color[2];var j=c.createTexture();return c.bindTexture(c.TEXTURE_2D,j),c.texImage2D(c.TEXTURE_2D,0,c.RGB,256,1,0,c.RGB,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),j}}),a.ColorMapProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_colorMap","texture2D",a),c.super.draw.call(this)}}),b.ui={disp:"Color Map",type:"ColorMap",schema:{maps:{type:"array",items:{type:"array",title:"Map",items:{type:"object",properties:{color:{type:"string",title:"Color",format:"color","default":"#FFFFFF"},index:{type:"number",title:"Index",minimum:0,maximum:255}}}}},key:{type:"string",title:"Map key","enum":["RED","GREEN","BLUE","(R+G+B)/2","(R+G+B)/3","MAX"],"default":"RED"},mapCycleMode:{type:"string",title:"Map Cycle Mode","enum":["SINGLE","ONBEATRANDOM","ONBEATSEQUENTIAL"],"default":"SINGLE"},output:{type:"string",title:"Output blend mode","enum":_.keys(a.blendModes),"default":"REPLACE"}}}}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["mode","color","outColor"]),c=_.defaults(c,{mode:"BELOW",color:"#202020",outColor:"#202020",level:0}),this.mode=_.indexOf(this.modes,c.mode),-1==this.mode)throw new Error("ColorClip: invalid mode");this.color=a.parseColorNorm(c.color),this.outColor=a.parseColorNorm(c.outColor),this.level=c.level,this.program=new a.ColorClipProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor({swapFrame:!0,fragmentShader:["uniform int u_mode;","uniform vec3 u_color;","uniform vec3 u_outColor;","uniform float u_level;","void main() {"," vec4 inColor4 = getSrcColor();"," vec3 inColor = inColor4.rgb;"," bool clip = false;"," if(u_mode == 0) {"," clip = all(lessThanEqual(inColor, u_color));"," }"," if(u_mode == 1) {"," clip = all(greaterThanEqual(inColor, u_color));"," }"," if(u_mode == 2) {"," clip = (distance(inColor, u_color) <= u_level*0.5);"," }"," if(clip) {"," setFragColor(vec4(u_outColor, inColor4.a));"," } else {"," setFragColor(inColor4);"," }","}"]})}a.ColorClip=a.defineClass(b,a.Component,{modes:["BELOW","ABOVE","NEAR"],componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.mode,this.color,this.outColor,this.level)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ColorClipProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b,d,e){this.setUniform("u_mode","1i",a),this.setUniform.apply(this,["u_color","3f"].concat(b)),this.setUniform.apply(this,["u_outColor","3f"].concat(d)),this.setUniform("u_level","1f",e),c.super.draw.call(this)}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]),c=_.defaults(c,{gridW:16,gridH:16,noGrid:!1,bFilter:!0,compat:!1,coord:"POLAR"});var d;if(!_.isObject(c.code))throw new Error("Invalid Dynamic movement code");d=c.code;var e=new a.ExprCodeGenerator(d,["x","y","r","d","b"]),f=e.generateCode(["init","onBeat","perFrame"],["perPixel"],["x","y","d","r"]);this.code=f[0],this.inited=!1,this.noGrid=c.noGrid,this.gridW=c.gridW,this.gridH=c.gridH,this.coordMode=c.coord,this.bFilter=c.bFilter,this.compat=c.compat,this.program=this.noGrid?new a.DMovProgramNG(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f[1]):new a.DMovProgram(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f[1]),b.super.constructor.apply(this,arguments)}function c(a,b,d,e,f){var g=[f,this.glslFilter(b,d),"void main() {",e?"__randSeed = v_position;":""," x = v_position.x*2.0-1.0;"," y = -(v_position.y*2.0-1.0);",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," setFragColor(vec4(filter(vec2(x, -y)), 1));","}"];c.super.constructor.call(this,{fragmentShader:g,swapFrame:!0})}function d(a,b,c,e,f){var g=["attribute vec2 a_position;","varying vec2 v_newPoint;","uniform int u_coordMode;",f,"void main() {",e?"__randSeed = a_position;":""," x = a_position.x;"," y = -a_position.y;",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," v_newPoint = vec2(x,-y);"," setPosition(a_position);","}"],h=["varying vec2 v_newPoint;",this.glslFilter(b,c),"void main() {"," setFragColor(vec4(filter(v_newPoint), 1));","}"];d.super.constructor.call(this,{fragmentShader:h,vertexShader:g,swapFrame:!0})}a.DynamicMovement=a.defineClass(b,a.Component,{componentName:"DynamicMovement",init:function(c,d,e){if(b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,e),!this.noGrid){for(var f=a.clamp(this.gridW,1,this.main.canvas.width),g=a.clamp(this.gridH,1,this.main.canvas.height),h=2*(f/this.main.canvas.width),i=2*(g/this.main.canvas.height),j=Math.ceil(this.main.canvas.width/f),k=Math.ceil(this.main.canvas.height/g),l=new Float32Array(2*6*j*k),m=0,n=-1,o=-1,p=0;k>p;p++){for(var q=0;j>q;q++){var r=Math.min(n+h,1),s=Math.min(o+i,1);l[m++]=n,l[m++]=o,l[m++]=r,l[m++]=o,l[m++]=n,l[m++]=s,l[m++]=r,l[m++]=o,l[m++]=r,l[m++]=s,l[m++]=n,l[m++]=s,n+=h}n=-1,o+=i}this.gridVertices=l,this.gridVerticesSize=m/2}},update:function(){var a=this.code;this.inited||(a.init(),this.inited=!0);var b=this.main.analyser.beat;a.b=b?1:0,a.perFrame(),b&&a.onBeat(),this.noGrid?this.program.run(this.parent.fm,null,this.code):this.program.run(this.parent.fm,null,this.code,this.gridVertices,this.gridVerticesSize)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}});var e={glslRectToPolar:function(a){return"POLAR"===a?["float ar = u_resolution.x/u_resolution.y;","x=x*ar;","d = distance(vec2(x, y), vec2(0,0))/sqrt(2.0);","r = mod(atan(y, x)+PI*0.5, 2.0*PI);"].join("\n"):""},glslPolarToRect:function(a){return"POLAR"===a?["d = d*sqrt(2.0);","x = d*sin(r)/ar;","y = -d*cos(r);"].join("\n"):""},glslFilter:function(a,b){return a&&!b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 cornoff = fract(coord/texel);"," vec2 corn = floor(coord/texel)*texel;"," vec3 tl = getSrcColorAtPos(corn).rgb;"," vec3 tr = getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb;"," vec3 bl = getSrcColorAtPos(corn + vec2(0, texel.y)).rgb;"," vec3 br = getSrcColorAtPos(corn + texel).rgb;"," vec3 pt = mix(tl, tr, cornoff.x);"," vec3 pb = mix(bl, br, cornoff.x);"," return mix(pt, pb, cornoff.y);","}"].join("\n"):a&&b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 corn = floor(coord/texel)*texel;"," ivec2 cornoff = (ivec2(fract(coord/texel)*255.0));"," ivec3 tl = ivec3(255.0 * getSrcColorAtPos(corn).rgb);"," ivec3 tr = ivec3(255.0 * getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb);"," ivec3 bl = ivec3(255.0 * getSrcColorAtPos(corn + vec2(0, texel.y)).rgb);"," ivec3 br = ivec3(255.0 * getSrcColorAtPos(corn + texel).rgb);"," #define bt(i, j) int((float(i)/255.0)*float(j))"," int a1 = bt(255-cornoff.x,255-cornoff.y);"," int a2 = bt(cornoff.x ,255-cornoff.y);"," int a3 = bt(255-cornoff.x,cornoff.y);"," int a4 = bt(cornoff.x ,cornoff.y);"," float r = float(bt(a1,tl.r) + bt(a2,tr.r) + bt(a3,bl.r) + bt(a4,br.r))/255.0;"," float g = float(bt(a1,tl.g) + bt(a2,tr.g) + bt(a3,bl.g) + bt(a4,br.g))/255.0;"," float b = float(bt(a1,tl.b) + bt(a2,tr.b) + bt(a3,bl.b) + bt(a4,br.b))/255.0;"," return vec3(r,g,b);","}"].join("\n"):["vec3 filter(vec2 point) {"," return getSrcColorAtPos((point+1.0)/2.0).rgb;","}"].join("\n")}};a.DMovProgramNG=a.defineClass(c,a.QuadBoxProgram,e,{draw:function(a){a.bindUniforms(this),c.super.draw.call(this)}}),a.DMovProgram=a.defineClass(d,a.ShaderProgram,e,{draw:function(a,b,c){a.bindUniforms(this),this.setVertexAttribArray("a_position",b,2,this.gl.FLOAT,!1,0,0),this.gl.drawArrays(this.gl.TRIANGLES,0,c)}}),b.ui={type:"DynamicMovement",disp:"Dynamic Movement",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPixel:{type:"string",title:"Per Point"}}},gridW:{type:"number",title:"Grid Width","default":16},gridH:{type:"number",title:"Grid Height","default":16},coord:{type:"string",title:"Coordinate System","enum":["POLAR","RECT"],"default":"POLAR"}},form:[{key:"code.init",type:"textarea"},{key:"code.onBeat",type:"textarea"},{key:"code.perFrame",type:"textarea"},{key:"code.perPixel",type:"textarea"},"gridW","gridH","coord"]}}(Webvs),function(a){function b(a){a=_.defaults(a,{bFilter:!0,coord:"POLAR",compat:!1}),b.super.constructor.call(this,{noGrid:!0,bFilter:a.bFilter,compat:a.compat,coord:a.coord,code:a.code}),this.options=a}a.Movement=a.defineClass(b,a.DynamicMovement)}(Webvs),function(a){function b(a){if(a=_.defaults(a,{channel:"RGB",onBeatRandom:!1}),this.channel=d.indexOf(a.channel),-1==this.channel)throw new Error("Invalid Channel");this.onBeatRandom=a.onBeatRandom,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["uniform int u_channel;","void main() {"," vec3 color = getSrcColor().rgb;",_.flatMap(d,function(a,b){return["if(u_channel == "+b+") {"," setFragColor(vec4(color."+a.toLowerCase()+",1));","}"]}).join("\n"),"}"]})}var d=["RGB","RBG","BRG","BGR","GBR","GRB"];a.ChannelShift=a.defineClass(b,a.Component,{componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.onBeatRandom&&this.main.analyser.beat&&(this.channel=Math.floor(Math.random()*d.length)),this.program.run(this.parent.fm,null,this.channel)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ChannelShiftProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_channel","1i",a),c.super.draw.call(this)}}),b.ui={disp:"Channel Shift",type:"ChannelShift",schema:{channel:{type:"string",title:"Channel","enum":d},onBeatRandom:{type:"boolean",title:"On beat random"}}}}(Webvs),function(a){function b(b){b=_.defaults(b,{color:"#ffffff",invert:!1,blendMode:"REPLACE"}),this.tone=a.parseColorNorm(b.color),this.invert=b.invert,this.program=new c(a.getBlendMode(b.blendMode))}function c(a){c.super.constructor.call(this,{outputBlendMode:a,swapFrame:!0,fragmentShader:["uniform vec3 u_tone;","uniform bool u_invert;","void main() {"," vec4 srcColor = getSrcColor();"," float depth = max(srcColor.r, max(srcColor.g, srcColor.b));"," if(u_invert) {"," depth = 1.0-depth;"," }"," setFragColor(vec4(depth*u_tone, 1));","}"]})}a.UniqueTone=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.tone,this.invert)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.UniqueToneProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b){this.setUniform.apply(this,["u_tone","3f"].concat(a)),this.setUniform("u_invert","1f",b?1:0),c.super.draw.call(this)}})}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code"]),d=_.defaults(d,{source:"SPECTRUM",drawMode:"LINES",colors:["#ffffff"]});var e;if(!_.isObject(d.code))throw new Error("Invalid superscope");e=d.code;var f=new a.ExprCodeGenerator(e,["n","v","i","x","y","b","red","green","blue"]),g=f.generateCode(["init","onBeat","perFrame","perPoint"],[],[]);this.code=g[0],this.code.n=100,this.spectrum="SPECTRUM"==d.source,this.dots="DOTS"==d.drawMode,this.colors=_.map(d.colors,a.parseColorNorm),this.currentColor=this.colors[0],this.maxStep=100,this.step=this.maxStep,this.colorId=0,this.colorStep=[0,0,0],this.thickness=d.thickness?d.thickness:1,this.inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_position;","attribute vec3 a_color;","varying vec3 v_color;","uniform float u_pointSize;","void main() {"," gl_PointSize = u_pointSize;"," setPosition(clamp(a_position, vec2(-1,-1), vec2(1,1)));"," v_color = a_color;","}"],fragmentShader:["varying vec3 v_color;","void main() {"," setFragColor(vec4(v_color, 1));","}"]})}a.SuperScope=a.defineClass(b,a.Component,{componentName:"SuperScope",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a),this.code.setup(c,this)},update:function(){this.gl;var a=this.code;this._stepColor(),a.red=this.currentColor[0],a.green=this.currentColor[1],a.blue=this.currentColor[2],this.inited||(a.init(),this.inited=!0);var b=this.main.analyser.beat;a.b=b?1:0,a.perFrame(),b&&a.onBeat();for(var c=Math.floor(a.n),d=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),e=d.length/c,f=0,g=0,h=new Float32Array(2*(this.dots?c:2*c-2)),i=new Float32Array(3*(this.dots?c:2*c-2)),j=0;c>j;j++){for(var k=0,l=0,m=Math.floor(j*e);(j+1)*e>m;m++,l++)k+=d[m];k/=l;var n=j/(c>1?c-1:1);a.i=n,a.v=k,a.perPoint(),h[f++]=a.x,h[f++]=-1*a.y,0===j||j==c-1||this.dots||(h[f++]=a.x,h[f++]=-1*a.y),this.dots?(i[g++]=a.red,i[g++]=a.green,i[g++]=a.blue):0!==j&&(i[g++]=a.red,i[g++]=a.green,i[g++]=a.blue,i[g++]=a.red,i[g++]=a.green,i[g++]=a.blue)}this.program.run(this.parent.fm,null,h,i,this.dots,this.thickness)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_stepColor:function(){var a;if(this.colors.length>1)if(this.step==this.maxStep){var b=this.colors[this.colorId];this.colorId=(this.colorId+1)%this.colors.length;var c=this.colors[this.colorId];for(a=0;3>a;a++)this.colorStep[a]=(c[a]-b[a])/this.maxStep;this.step=0,this.currentColor=b}else{for(a=0;3>a;a++)this.currentColor[a]+=this.colorStep[a];this.step++}}}),a.SuperScopeShader=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d){var e=this.gl;this.setUniform("u_pointSize","1f",d),this.setVertexAttribArray("a_position",a,2,e.FLOAT,!1,0,0),this.setVertexAttribArray("a_color",b,3,e.FLOAT,!1,0,0);var f;c||(f=e.getParameter(e.LINE_WIDTH),e.lineWidth(d)),e.drawArrays(c?e.POINTS:e.LINES,0,a.length/2),c||e.lineWidth(f)}}),b.ui={disp:"SuperScope",type:"SuperScope",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPoint:{type:"string",title:"Per Point"}}},source:{type:"string",title:"Source","default":"WAVEFORM","enum":["WAVEFORM","SPECTRUM"]},drawMode:{type:"string",title:"Draw Mode","default":"LINES","enum":["DOTS","LINES"]},colors:{type:"array",title:"Cycle Colors",items:{type:"string",format:"color","default":"#FFFFFF"}}}}}(Webvs),function(a){function b(a){a=_.defaults(a,{drawMode:"SOLID",source:"WAVEFORM",align:"CENTER",colors:["#ffffff"]});var c={};"SOLID"!=a.drawMode?(c.init="n=w;",c.perPoint={TOP:"x=i*2-1; y=-v/2-0.5;",CENTER:"x=i*2-1; y=-v/2;",BOTTOM:"x=i*2-1; y=v/2+0.5;"}[a.align]):(c.init="n=w*2;",c.perFrame="c=0;",c.perPoint="SPECTRUM"==a.source?{TOP:"x=i*2-1; y=if(c%2,0,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0.5,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0,v/2+0.5); c=c+1;"}[a.align]:{TOP:"x=i*2-1; y=if(c%2,-0.5,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0.5,v/2+0.5); c=c+1;"}[a.align]),b.super.constructor.call(this,{source:a.source,drawMode:"SOLID"==a.drawMode?"LINES":a.drawMode,colors:a.colors,code:c}),this.options=a}a.Simple=a.defineClass(b,a.SuperScope)}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code","imageSrc"]),d=_.defaults(d,{source:"SPECTRUM",resizing:!1,wrapAround:!1,colorFiltering:!0}),this.resizing=d.resizing,this.colorFiltering=d.colorFiltering,this.wrapAround=d.wrapAround,this.imageSrc=d.imageSrc;var e=new a.ExprCodeGenerator(d.code,["n","v","i","x","y","b","sizex","sizey","red","green","blue"]),f=e.generateCode(["init","onBeat","perFrame","perPoint"],[],[]);this.code=f[0],this.code.n=100,this.spectrum="SPECTRUM"==d.source,this._inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{vertexShader:["uniform bool u_colorFilter;","attribute vec2 a_texVertex;","attribute vec2 a_vertex;","attribute vec3 a_color;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," if(u_colorFilter) {"," v_color = a_color;"," }"," v_texVertex = a_texVertex;"," setPosition(a_vertex);","}"],fragmentShader:["uniform bool u_colorFilter;","uniform sampler2D u_image;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," vec3 outColor = texture2D(u_image, v_texVertex).rgb;"," if(u_colorFilter) {"," outColor = outColor*v_color;"," }"," setFragColor(vec4(outColor, 1));","}"]})}a.Texer=a.defineClass(b,a.Component,{componentName:"Texer",init:function(c,d,e){b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,this);var f=this,g=new Image;g.src=d.getResource(this.imageSrc);var h=new a.Promise;return g.onload=function(){f.imagewidth=g.width,f.imageHeight=g.height,f.texture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,f.texture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),h.resolve()},h},update:function(){function a(a,b,c,d,e,f,l){-1-c>a||a>1||-1-d>b||b>1||(g.push(a,b,a+c,b,a+c,b+d,a,b+d),h.push(0,0,1,0,1,1,0,1),j&&j.push(e,f,l,e,f,l,e,f,l,e,f,l),i.push(k+0,k+1,k+2,k+0,k+2,k+3),k+=4)}var b=this.code;this._inited||b.init();var c=this.main.analyser.beat;b.b=c?1:0,b.perFrame(),c&&b.onBeat();for(var d=Math.floor(b.n),e=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),f=e.length/d,g=[],h=[],i=[],j=this.colorFiltering?[]:null,k=0,l=2*(this.imagewidth/this.parent.fm.width),m=2*(this.imageHeight/this.parent.fm.height),n=0;d>n;n++){for(var o=0,p=0,q=Math.floor(n*f);(n+1)*f>q;q++,p++)o+=e[q];o/=p;var r=n/(d-1);b.i=r,b.v=o,b.sizex=1,b.sizey=1,b.red=1,b.green=1,b.blue=1,b.perPoint();var s=l,t=m;this.resizing&&(s*=b.sizex,t*=b.sizey);var u=b.x-s/2,v=-b.y-t/2;if(a(u,v,s,t,b.red,b.green,b.blue),this.wrapAround){var w=-1>u?2:u>1-s?-2:0,x=-1>v?2:v>1-t?-2:0;w&&a(w+u,v,s,t,b.red,b.green,b.blue),x&&a(u,x+v,s,t,b.red,b.green,b.blue),w&&x&&a(w+u,x+v,s,t,b.red,b.green,b.blue)}}this.program.run(this.parent.fm,null,new Float32Array(g),new Float32Array(h),new Uint16Array(i),j?new Float32Array(j):null,this.texture)},destroy:function(){b.super.destroy.call(this),this.gl.deleteTexture(this.texture),this.program.cleanup()}}),a.TexerProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_image","texture2D",e),this.setVertexAttribArray("a_vertex",a),this.setVertexAttribArray("a_texVertex",b),d?(this.setUniform("u_colorFilter","1f",1),this.setVertexAttribArray("a_color",d,3)):this.setUniform("u_colorFilter","1f",0),this.setElementArray(c),this.gl.drawElements(this.gl.TRIANGLES,c.length,this.gl.UNSIGNED_SHORT,0)}})}(Webvs),function(a){function b(c){c=_.defaults(c,{n:0,color:"#000000",blendMode:"REPLACE"}),this.n=c.n,this.color=a.parseColorNorm(c.color),this.outputBlendMode=a.blendModes[c.blendMode],this.prevBeat=!1,this.beatCount=0,this.program=new a.ClearScreenProgram(this.outputBlendMode),b.super.constructor.apply(this,arguments)}a.ClearScreen=a.defineClass(b,a.Component,{componentName:"ClearScreen",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){var a=!1;0===this.n?a=!0:(this.main.analyser.beat&&!this.prevBeat&&(this.beatCount++,this.beatCount==this.n&&(a=!0,this.beatCount=0)),this.prevBeat=this.main.analyser.beat),a&&this.program.run(this.parent.fm,null,this.color)},destroy:function(){this.program.cleanup()}}),b.ui={type:"ClearScreen",disp:"Clear Screen",schema:{n:{type:"number",title:"Clear on beat (0 = always clear)","default":0},color:{type:"string",title:"Clear color",format:"color","default":"#000000"},blendMode:{type:"string",title:"Blend Mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["src","x","y"]),this.x=c.x,this.y=c.y,this.src=c.src,this.program=new a.PictureProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_texVertex;","uniform vec2 u_pos;","uniform vec2 u_texRes;","varying vec2 v_texCoord;","void main() {"," v_texCoord = a_texVertex;"," setPosition(a_texVertex*(u_texRes/u_resolution)*vec2(2,-2)+u_pos);","}"],fragmentShader:["uniform sampler2D u_image;","varying vec2 v_texCoord;","void main() {"," setFragColor(texture2D(u_image, v_texCoord));","}"]})}a.Picture=a.defineClass(b,a.Component,{init:function(c,d,e){b.super.init.call(this,c,d,e),this.program.init(c);var f=this,g=new Image;g.src=d.getResource(this.src);var h=new a.Promise;return g.onload=function(){f.width=g.width,f.height=g.height,f.texture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,f.texture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),h.resolve()},h},update:function(){this.program.run(this.parent.fm,null,this.x,this.y,this.texture,this.width,this.height)},destroy:function(){this.program.cleanup(),this.gl.deleteTexture(this.texture)}}),a.PictureProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_pos","2f",a,-b),this.setUniform("u_texRes","2f",d,e),this.setUniform("u_image","texture2D",c),this.setVertexAttribArray("a_texVertex",new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}})}(Webvs); \ No newline at end of file +function FourierTransform(a,b){this.bufferSize=a,this.sampleRate=b,this.bandwidth=2/a*b/2,this.spectrum=new Float32Array(a/2),this.real=new Float32Array(a),this.imag=new Float32Array(a),this.peakBand=0,this.peak=0,this.getBandFrequency=function(a){return this.bandwidth*a+this.bandwidth/2},this.calculateSpectrum=function(){for(var b,c,d,e=this.spectrum,f=this.real,g=this.imag,h=2/this.bufferSize,i=Math.sqrt,j=0,k=a/2;k>j;j++)b=f[j],c=g[j],d=h*i(b*b+c*c),d>this.peak&&(this.peakBand=j,this.peak=d),e[j]=d}}function FFT(a,b){FourierTransform.call(this,a,b),this.reverseTable=new Uint32Array(a);for(var c,d=1,e=a>>1;a>d;){for(c=0;d>c;c++)this.reverseTable[c+d]=this.reverseTable[c]+e;d<<=1,e>>=1}for(this.sinTable=new Float32Array(a),this.cosTable=new Float32Array(a),c=0;a>c;c++)this.sinTable[c]=Math.sin(-Math.PI/c),this.cosTable[c]=Math.cos(-Math.PI/c)}function FourierTransform(a,b){this.bufferSize=a,this.sampleRate=b,this.bandwidth=2/a*b/2,this.spectrum=new Float32Array(a/2),this.real=new Float32Array(a),this.imag=new Float32Array(a),this.peakBand=0,this.peak=0,this.getBandFrequency=function(a){return this.bandwidth*a+this.bandwidth/2},this.calculateSpectrum=function(){for(var b,c,d,e=this.spectrum,f=this.real,g=this.imag,h=2/this.bufferSize,i=Math.sqrt,j=0,k=a/2;k>j;j++)b=f[j],c=g[j],d=h*i(b*b+c*c),d>this.peak&&(this.peakBand=j,this.peak=d),e[j]=d}}function FFT(a,b){FourierTransform.call(this,a,b),this.reverseTable=new Uint32Array(a);for(var c,d=1,e=a>>1;a>d;){for(c=0;d>c;c++)this.reverseTable[c+d]=this.reverseTable[c]+e;d<<=1,e>>=1}for(this.sinTable=new Float32Array(a),this.cosTable=new Float32Array(a),c=0;a>c;c++)this.sinTable[c]=Math.sin(-Math.PI/c),this.cosTable[c]=Math.cos(-Math.PI/c)}(function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=e.toString,k=e.hasOwnProperty,l=d.forEach,m=d.map,n=d.reduce,o=d.reduceRight,p=d.filter,q=d.every,r=d.some,s=d.indexOf,t=d.lastIndexOf,u=Array.isArray,v=Object.keys,w=f.bind,x=function(a){return a instanceof x?a:this instanceof x?(this._wrapped=a,void 0):new x(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):a._=x,x.VERSION="1.5.1";var y=x.each=x.forEach=function(a,b,d){if(null!=a)if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;f>e;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?void 0:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;gd||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;c.call(d,a[h])=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=x.max(x.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=x.pluck(arguments,""+c);return b},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var E=function(){};x.bind=function(a,b){var c,d;if(w&&a.bind===w)return w.apply(a,h.call(arguments,1));if(!x.isFunction(a))throw new TypeError;return c=h.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(h.call(arguments)));E.prototype=a.prototype;var e=new E;E.prototype=null;var f=a.apply(e,c.concat(h.call(arguments)));return Object(f)===f?f:e}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:new Date,g=null,f=a.apply(d,e)};return function(){var j=new Date;h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},x.debounce=function(a,b,c){var d,e=null;return function(){var f=this,g=arguments,h=function(){e=null,c||(d=a.apply(f,g))},i=c&&!e;return clearTimeout(e),e=setTimeout(h,b),i&&(d=a.apply(f,g)),d}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&b.push(c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var F=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(x.isFunction(g)&&g instanceof g&&x.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i=0,k=!0;if("[object Array]"==e){if(i=a.length,k=i==b.length)for(;i--&&(k=F(a[i],b[i],c,d)););}else{for(var l in a)if(x.has(a,l)&&(i++,!(k=x.has(b,l)&&F(a[l],b[l],c,d))))break;if(k){for(l in b)if(x.has(b,l)&&!i--)break;k=!i}}return c.pop(),d.pop(),k};x.isEqual=function(a,b){return F(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var G={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};G.unescape=x.invert(G.escape);var H={escape:new RegExp("["+x.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(G.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(H[a],function(b){return G[a][b]})}}),x.result=function(a,b){if(null==a)return void 0;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),M.call(this,c.apply(x,a))}})};var I=0;x.uniqueId=function(a){var b=++I+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=new RegExp([(c.escape||J).source,(c.interpolate||J).source,(c.evaluate||J).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(L,function(a){return"\\"+K[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var M=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],M.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return M.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),FFT.prototype.forward=function(a){var b=this.bufferSize,c=this.cosTable,d=this.sinTable,e=this.reverseTable,f=this.real,g=this.imag;this.spectrum;var h=Math.floor(Math.log(b)/Math.LN2);if(Math.pow(2,h)!==b)throw"Invalid buffer size, must be a power of 2.";if(b!==a.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+b+" Buffer Size: "+a.length;var i,j,k,l,m,n,o,p,q,r=1;for(q=0;b>q;q++)f[q]=a[e[q]],g[q]=0;for(;b>r;){i=c[r],j=d[r],k=1,l=0;for(var s=0;r>s;s++){for(q=s;b>q;)m=q+r,n=k*f[m]-l*g[m],o=k*g[m]+l*f[m],f[m]=f[q]-n,g[m]=g[q]-o,f[q]+=n,g[q]+=o,q+=r<<1;p=k,k=p*i-l*j,l=p*j+l*i}r<<=1}return this.calculateSpectrum()},function(){function a(){for(var a in this.sections)this.sections[a].condition()&&this.sections[a].callback.call(this)}var b=function(){this.audioAdapter=b._getAdapter(this),this.events={},this.sections=[],this.bind("update",a)};b.adapters={},b.prototype={load:function(a){return a instanceof HTMLElement?(this.source=a,"flash"===b.isSupported()&&(this.source={src:b._getMP3SrcFromAudio(a)})):(this.source=window.Audio?new Audio:{},this.source.src=b._makeSupportedPath(a.src,a.codecs)),this.audio=this.audioAdapter.load(this.source),this},play:function(){return this.audioAdapter.play(),this},pause:function(){return this.audioAdapter.pause(),this},setVolume:function(a){return this.audioAdapter.setVolume(a),this},createKick:function(a){return new b.Kick(this,a)},bind:function(a,b){return this.events[a]||(this.events[a]=[]),this.events[a].push(b),this},unbind:function(a){return this.events[a]&&delete this.events[a],this},trigger:function(a){var b=this;return this.events[a]&&this.events[a].forEach(function(a){a.call(b)}),this},getVolume:function(){return this.audioAdapter.getVolume()},getProgress:function(){return this.audioAdapter.getProgress()},getTime:function(){return this.audioAdapter.getTime()},getFrequency:function(a,b){var c=0;if(void 0!==b){for(var d=a;b>=d;d++)c+=this.getSpectrum()[d];return c/(b-a+1)}return this.getSpectrum()[a]},getWaveform:function(){return this.audioAdapter.getWaveform()},getSpectrum:function(){return this.audioAdapter.getSpectrum()},isLoaded:function(){return this.audioAdapter.isLoaded},isPlaying:function(){return this.audioAdapter.isPlaying},after:function(a,b){var c=this;return this.sections.push({condition:function(){return c.getTime()>a},callback:b}),this},before:function(a,b){var c=this;return this.sections.push({condition:function(){return c.getTime()a&&d.getTime()a&&!this.called},callback:function(){b.call(this),d.called=!0},called:!1}),d=this.sections[this.sections.length-1],this}},window.Dancer=b}(),function(a){function b(){var a=!!(navigator.vendor||"").match(/Apple/),b=navigator.userAgent.match(/Version\/([^ ]*)/);return b=b?parseFloat(b[1]):0,a&&6>=b}var c={mp3:"audio/mpeg;",ogg:'audio/ogg; codecs="vorbis"',wav:'audio/wav; codecs="1"',aac:'audio/mp4; codecs="mp4a.40.2"'},d=document.createElement("audio");a.options={},a.setOptions=function(b){for(var c in b)b.hasOwnProperty(c)&&(a.options[c]=b[c])},a.isSupported=function(){return window.Float32Array&&window.Uint32Array?b()||!window.AudioContext&&!window.webkitAudioContext?d&&d.mozSetup?"audiodata":FlashDetect.versionAtLeast(9)?"flash":"":"webaudio":null},a.canPlay=function(b){return d.canPlayType,!!("flash"===a.isSupported()?"mp3"===b.toLowerCase():d.canPlayType&&d.canPlayType(c[b.toLowerCase()]).replace(/no/,""))},a.addPlugin=function(b,c){void 0===a.prototype[b]&&(a.prototype[b]=c)},a._makeSupportedPath=function(b,c){if(!c)return b;for(var d=0;d=this.currentThreshold&&a>=this.threshold?(this.currentThreshold=a,this.onKick&&this.onKick.call(this.dancer,a)):(this.offKick&&this.offKick.call(this.dancer,a),this.currentThreshold-=this.decay)}},maxAmplitude:function(a){var b=0,c=this.dancer.getSpectrum();if(!a.length)return a=d;d++)c[d]>b&&(b=c[d]);return b}},window.Dancer.Kick=b}(),function(){function a(){this.source=this.context.createMediaElementSource(this.audio),this.source.connect(this.proc),this.source.connect(this.gain),this.gain.connect(this.context.destination),this.proc.connect(this.context.destination),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var b=2048,c=44100,d=function(a){this.dancer=a,this.audio=new Audio,this.context=window.AudioContext?new window.AudioContext:new window.webkitAudioContext};d.prototype={load:function(d){var e=this;return this.audio=d,this.isLoaded=!1,this.progress=0,this.proc=this.context.createJavaScriptNode(b/2,1,1),this.proc.onaudioprocess=function(a){e.update.call(e,a)},this.gain=this.context.createGainNode(),this.fft=new FFT(b/2,c),this.signal=new Float32Array(b/2),this.audio.readyState<3?this.audio.addEventListener("canplay",function(){a.call(e)}):a.call(e),this.audio.addEventListener("progress",function(a){a.currentTarget.duration&&(e.progress=a.currentTarget.seekable.end(0)/a.currentTarget.duration)}),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.gain.gain.value=a},getVolume:function(){return this.gain.gain.value},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(a){if(this.isPlaying&&this.isLoaded){var c,d=[],e=a.inputBuffer.numberOfChannels,f=b/e,g=function(a,b){return a[c]+b[c]};for(c=e;c--;)d.push(a.inputBuffer.getChannelData(c));for(c=0;f>c;c++)this.signal[c]=e>1?d.reduce(g(prev,curr))/e:d[0][c];this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.webkit=d}(),function(){function a(){this.fbLength=this.audio.mozFrameBufferLength,this.channels=this.audio.mozChannels,this.rate=this.audio.mozSampleRate,this.fft=new FFT(this.fbLength/this.channels,this.rate),this.signal=new Float32Array(this.fbLength/this.channels),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var b=function(a){this.dancer=a,this.audio=new Audio};b.prototype={load:function(b){var c=this;return this.audio=b,this.isLoaded=!1,this.progress=0,this.audio.readyState<3?this.audio.addEventListener("loadedmetadata",function(){a.call(c)},!1):a.call(c),this.audio.addEventListener("MozAudioAvailable",function(a){c.update(a)},!1),this.audio.addEventListener("progress",function(a){a.currentTarget.duration&&(c.progress=a.currentTarget.seekable.end(0)/a.currentTarget.duration)},!1),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.audio.volume=a},getVolume:function(){return this.audio.volume},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(a){if(this.isPlaying&&this.isLoaded){for(var b=0,c=this.fbLength/2;c>b;b++)this.signal[b]=(a.frameBuffer[2*b]+a.frameBuffer[2*b+1])/2;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.moz=b}(),function(){function a(){var a=this;f=!0,b(Dancer.options.flashJS,function(){soundManager=new SoundManager,soundManager.flashVersion=9,soundManager.flash9Options.useWaveformData=!0,soundManager.useWaveformData=!0,soundManager.useHighPerformance=!0,soundManager.useFastPolling=!0,soundManager.multiShot=!1,soundManager.debugMode=!1,soundManager.debugFlash=!1,soundManager.url=Dancer.options.flashSWF,soundManager.onready(function(){e=!0,a.load()}),soundManager.ontimeout(function(){console.error("Error loading SoundManager2.swf")}),soundManager.beginDelayedInit()})}function b(a,b){var c=document.createElement("script"),d=document.getElementsByTagName("script")[0];c.type="text/javascript",c.src=a,c.onload=b,d.parentNode.insertBefore(c,d)}var c=1024,d=44100,e=!1,f=!1,g=.93,h=function(a){this.dancer=a,this.wave_L=[],this.wave_R=[],this.spectrum=[],window.SM2_DEFER=!0};h.prototype={load:function(b){var e=this;return this.path=b?b.src:this.path,this.isLoaded=!1,this.progress=0,!window.soundManager&&!f&&a.call(this),window.soundManager&&(this.audio=soundManager.createSound({id:"dancer"+Math.random(),url:this.path,stream:!0,autoPlay:!1,autoLoad:!0,whileplaying:function(){e.update()},whileloading:function(){e.progress=this.bytesLoaded/this.bytesTotal},onload:function(){e.fft=new FFT(c,d),e.signal=new Float32Array(c),e.waveform=new Float32Array(c),e.isLoaded=!0,e.progress=1,e.dancer.trigger("loaded")}}),this.dancer.audio=this.audio),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(a){this.audio.setVolume(100*a)},getVolume:function(){return this.audio.volume/100},getProgress:function(){return this.progress},getWaveform:function(){return this.waveform},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.position/1e3},update:function(){if(this.isPlaying||this.isLoaded){this.wave_L=this.audio.waveformData.left,this.wave_R=this.audio.waveformData.right;for(var a,b=0,c=this.wave_L.length;c>b;b++)a=parseFloat(this.wave_L[b])+parseFloat(this.wave_R[b]),this.waveform[2*b]=a/2,this.waveform[2*b+1]=a/2,this.signal[2*b]=a*g,this.signal[2*b+1]=a*g;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.flash=h}(),FFT.prototype.forward=function(a){var b=this.bufferSize,c=this.cosTable,d=this.sinTable,e=this.reverseTable,f=this.real,g=this.imag;this.spectrum;var h=Math.floor(Math.log(b)/Math.LN2);if(Math.pow(2,h)!==b)throw"Invalid buffer size, must be a power of 2.";if(b!==a.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+b+" Buffer Size: "+a.length;var i,j,k,l,m,n,o,p,q,r=1;for(q=0;b>q;q++)f[q]=a[e[q]],g[q]=0;for(;b>r;){i=c[r],j=d[r],k=1,l=0;for(var s=0;r>s;s++){for(q=s;b>q;)m=q+r,n=k*f[m]-l*g[m],o=k*g[m]+l*f[m],f[m]=f[q]-n,g[m]=g[q]-o,f[q]+=n,g[q]+=o,q+=r<<1;p=k,k=p*i-l*j,l=p*j+l*i}r<<=1}return this.calculateSpectrum()};var FlashDetect=new function(){var a=this;a.installed=!1,a.raw="",a.major=-1,a.minor=-1,a.revision=-1,a.revisionStr="";var b=[{name:"ShockwaveFlash.ShockwaveFlash.7",version:function(a){return c(a)}},{name:"ShockwaveFlash.ShockwaveFlash.6",version:function(a){var b="6,0,21";try{a.AllowScriptAccess="always",b=c(a)}catch(d){}return b}},{name:"ShockwaveFlash.ShockwaveFlash",version:function(a){return c(a)}}],c=function(a){var b=-1;try{b=a.GetVariable("$version")}catch(c){}return b},d=function(a){var b=-1;try{b=new ActiveXObject(a)}catch(c){b={activeXError:!0}}return b},e=function(a){var b=a.split(",");return{raw:a,major:parseInt(b[0].split(" ")[1],10),minor:parseInt(b[1],10),revision:parseInt(b[2],10),revisionStr:b[2]}},f=function(a){var b=a.split(/ +/),c=b[2].split(/\./),d=b[3];return{raw:a,major:parseInt(c[0],10),minor:parseInt(c[1],10),revisionStr:d,revision:g(d)}},g=function(b){return parseInt(b.replace(/[a-zA-Z]/g,""),10)||a.revision};a.majorAtLeast=function(b){return a.major>=b},a.minorAtLeast=function(b){return a.minor>=b},a.revisionAtLeast=function(b){return a.revision>=b},a.versionAtLeast=function(){var b=[a.major,a.minor,a.revision],c=Math.min(b.length,arguments.length);for(i=0;c>i;i++){if(b[i]>=arguments[i]){if(c>i+1&&b[i]==arguments[i])continue;return!0}return!1}},a.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var c="application/x-shockwave-flash",g=navigator.mimeTypes;if(g&&g[c]&&g[c].enabledPlugin&&g[c].enabledPlugin.description){var h=g[c].enabledPlugin.description,i=f(h);a.raw=i.raw,a.major=i.major,a.minor=i.minor,a.revisionStr=i.revisionStr,a.revision=i.revision,a.installed=!0}}else if(-1==navigator.appVersion.indexOf("Mac")&&window.execScript)for(var h=-1,j=0;jb+1e3&&(f=Math.round(1e3*i/(j-b)),g=Math.min(g,f),h=Math.max(h,f),m.textContent=f+" FPS ("+g+"-"+h+")",t(n,Math.min(30,30-30*(f/100))),b=j,i=0),j},update:function(){a=this.end()}}};!function(a){var b={};a.Webvs=b,b.defineClass=function(a,b){return a.prototype=Object.create(b.prototype),a.prototype.constructor=a,a.super=b.prototype,_.chain(arguments).drop(2).each(function(b){_.extend(a.prototype,b)}),a},b.noop=function(){},b.checkRequiredOptions=function(a,b){for(var c in b){var d=b[c];if(!(d in a))throw new Error("Required option "+d+" not found")}},b.glslFloatRepr=function(a){return a+(0===a%1?".0":"")},b.parseColor=function(a){if(_.isArray(a)&&3==a.length)return a;if(_.isString(a)){var b;if(a=a.toLowerCase(),b=a.match(/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/))return _.chain(b).last(3).map(function(a){return parseInt(a,16)}).value();if(b=a.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/))return _.chain(b).last(3).map(function(a){return Math.min(parseInt(a,10),255) +}).value()}throw new Error("Invalid Color Format")},b.parseColorNorm=function(a){return _.map(b.parseColor(a),function(a){return a/255})},b.logShaderError=function(a,b){var c=a.split("\n"),d=c.length.toString().length,e=b.match(/(\d+):(\d+)/);e&&(e=[parseInt(e[1],10),parseInt(e[2],10)]);var f=_.map(c,function(a,c){var f,g=c+1+"";for(f=0;fd;d++)c.push(b.charAt(Math.floor(Math.random()*b.length)));return c.join("")},b.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)},b.getComponentClass=function(a){var c=b[a];if(!c)throw new Error("Unknown Component class "+a);return c}}(window),function(a){a.Resources={"avsres_texer_circle_edgeonly_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAMAAABFjsb+AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhFBMVEUAAAADAwMvLy9dXV1tbW0CAgJaWlrR0dH8/Pz+/v79/f1bW1sKCgqlpaXT09Nubm4xMTEeHh7S0tKCgoIGBgaBgYEuLi5sbGxeXl4cHBwbGxtvb29fX19ra2swMDDU1NQFBQV/f3+np6eoqKgLCwvQ0NBqamoEBAQyMjJhYWFxcXH///8GRExTAAAAAWJLR0QrJLnkCAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAK1JREFUGNN1kMkSgyAQRBViGMc1SpCYBYl7/v8Do2gocpBDF/Wqa3qmPe/w+YSeKPEdEpwZhBgCi4IfihNMs/ySZwUm8e5KoOTmx0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1YvM0xw7op/whuiP0yZiHLSEpUoH1zoT4GrucLN3OBu9x1mOTvCOspjrjn4froBkegClm06guAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTA2LTI5VDE5OjA5OjMyKzA2OjAw50C8rwAAAABJRU5ErkJggg==","avsres_texer_circle_sharp_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAe1BMVEUAAAAFBQVBQUGGhoaurq68vLyvr68GBgYBAQFNTU3Ozs78/Pz+/v7///+Kior6+vr9/f2Li4vR0dFCQkJDQ0OIiIiJiYmzs7PBwcG0tLRERETT09NRUVH7+/uQkJCRkZFTU1PU1NRUVFQHBwdHR0eMjIy1tbXDw8NISEjxdmZoAAAAAWJLR0QN9rRh9QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAJ5JREFUGNN9ke0SgiAUBUUrQbhA9qGpWGZa7/+EgZoCNu7PnTPALEGwAQqj3f4QhbHlMEkoAwBGE4LnIRfwQ3A0LbmEBXkc10SAjSBGxim4pObKE/UsPWt7YZ5lV20z8Mm0zVc2/7u9actX53JtC+lZWZj3lp4th0SVcqSqxg6106GeqqF6Wav7nBg/Gjn0lc0TW93bV9e/++7Tbn3YF1ESEZb9e6HrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0wNC0yOVQwMTo0OTozMCswNTowMPYYqoAAAAAASUVORK5CYII=","avsres_texer_circle_slightblur_13x13.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAABGdBTUEAALGPC/xhBQAA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Taf5lOZbmo9pvqb5HOd7D5xdp+8L+j6h75u/uj4BxUT7mSYYfpEAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTA0LTExVDAwOjM0OjU4KzA1OjAwAHKiyQAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_24x24.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABJJREFUCNdjYEAC8v9/UAUjAQD7uCWNIgeQwQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMTAtMDZUMjE6NTc6NDYrMDU6MDDg7pOkAAAAAElFTkSuQmCC","avsres_texer_square_edgeonly_28x28.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcAQMAAABIw03XAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABNJREFUCNdjYEAF8v//N9CPQAUArWA5f2D2DX0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTEwLTA2VDIxOjU4OjQ0KzA1OjAwhnrZAAAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_30x30.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeAQMAAAAB/jzhAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABRJREFUCNdjYEAF8v//PxgIAhUAAOmGR7lQ6SOhAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wNlQyMTo1OToxOCswNTowMOb41i4AAAAASUVORK5CYII=","avsres_texer_square_sharp_20x20.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABJJREFUCNdjYIAC+/9/qIqhAABLlCyJ9A7ihwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMDYtMjlUMTk6Mzg6MDQrMDU6MDBuiiynAAAAAElFTkSuQmCC","avsres_texer_square_sharp_32x32.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABVJREFUCNdjYMAB+P////9hCJM4AACQJX+BjmWyDAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDktMTAtMDhUMDE6NTM6NTYrMDU6MDBzUO7GAAAAAElFTkSuQmCC","avsres_texer_square_sharp_48x48.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4AQMAAACSSKldAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABZJREFUGNNjYCAA+P+DwIdReoBoAgAAldYe8LB8aUoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDA5LTEwLTA4VDAxOjUzOjI4KzA1OjAwKaqcggAAAABJRU5ErkJggg==","avsres_texer_square_sharp_60x60.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABEAQMAAAAC3QHxAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAABdJREFUKM9jYCAS8P+HgFHWKIuaLCIBAH8IpfBELmrmAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMTo1NDozMiswNTowMKOs2CsAAAAASUVORK5CYII=","avsres_texer_square_sharp_64x64.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQAQMAAAC032DuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABdJREFUKM9jYKAV+A8Fo8xR5lBk0gYAAMbE/hBbX3sVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODowMCswNjowML8mns0AAAAASUVORK5CYII=","avsres_texer_square_sharp_72x72.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUAQMAAAAmpYKCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABpJREFUKM9jYKASYP4PBX9G2aPsUTa12VQCABpBhZc9Qe3KAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjowMjoxNiswNjowMMbw5GAAAAAASUVORK5CYII=","avsres_texer_square_sharp_96x96.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwAQMAAAD8LmYIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAB1JREFUOMtjYBgo8B8JjHJHuaPcUe4od/BwBwYAAB86e71LirdOAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODo0NiswNjowMFi8pQ0AAAAASUVORK5CYII=","avsres_texer_square_sharp_250x250.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQoAAAEKAQMAAADQBYmKAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAADlJREFUaN7tykENAAAIBCD7p7KZFrgZwMGbKrK5taIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoivKpkCyUd+T92W3T7QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTEtMDEtMDVUMTg6NTk6NTQrMDU6MDBwiLErAAAAAElFTkSuQmCC"}}(Webvs),function(a){function b(){}a.AnalyserAdapter=a.defineClass(b,Object,{beat:!1,isPlaying:function(){return!1},getWaveform:function(){return new Float32Array(0)},getSpectrum:function(){return new Float32Array(0)}})}(Webvs),function(a){function b(a){this.dancer=a,this.beat=!1;var b=this;this.kick=a.createKick({onKick:function(){b.beat=!0},offKick:function(){b.beat=!1}}),this.kick.on()}a.DancerAdapter=a.defineClass(b,a.AnalyserAdapter,{isPlaying:function(){return this.dancer.isPlaying()},getWaveform:function(){return this.dancer.getWaveform()},getSpectrum:function(){return this.dancer.getSpectrum()}})}(Webvs),function(a){function b(b){if(a.checkRequiredOptions(b,["canvas","analyser"]),b=_.defaults(b,{showStat:!1}),this.canvas=b.canvas,this.analyser=b.analyser,this.isStarted=!1,b.showStat){var c=new Stats;c.setMode(0),c.domElement.style.position="absolute",c.domElement.style.right="5px",c.domElement.style.bottom="5px",document.body.appendChild(c.domElement),this.stats=c}this.resources={},this.rootComponent=new a.EffectList({id:"root"}),this._registerContextEvents(),this._initGl()}a.Main=a.defineClass(b,Object,{_registerContextEvents:function(){var a=this;this.canvas.addEventListener("webglcontextlost",function(b){b.preventDefault(),a.stop()}),this.canvas.addEventListener("webglcontextrestored",function(){a.resetCanvas()})},_initGl:function(){try{this.gl=this.canvas.getContext("experimental-webgl",{alpha:!1}),this.copier=new a.CopyProgram({dynamicBlend:!0}),this.copier.init(this.gl),this.resolution={width:this.canvas.width,height:this.canvas.height}}catch(b){throw new Error("Couldnt get webgl context"+b)}},loadPreset:function(b){b=_.clone(b),b.id="root";var c=new a.EffectList(b);this.stop(),this.rootComponent.destroy(),this.rootComponent=c,this.resources=b.resources||{}},resetCanvas:function(){this.stop();var b=this.rootComponent.getOptions();this.rootComponent.destroy(),this.copier.cleanup(),this._initGl(),this.rootComponent=new a.EffectList(b)},start:function(){if(!this.isStarted){var a=this,b=function(){a.analyser.isPlaying()&&a.rootComponent.update(),a.animReqId=requestAnimationFrame(b)};if(this.stats){var c=b;b=function(){a.stats.begin(),c.call(this,arguments),a.stats.end()}}this.rootComponent.componentInited||(this.registerBank={},this.bootTime=(new Date).getTime(),this.rootComponent.init(this.gl,this)),this.animReqId=requestAnimationFrame(b),this.isStarted=!0}},stop:function(){_.isUndefined(this.animReqId)||(cancelAnimationFrame(this.animReqId),this.isStarted=!1)},getPreset:function(){var a=this.rootComponent.getOptions();return a.resources=this.resources,a},addComponent:function(a,b,c){return b=_.clone(b),this.rootComponent.addComponent(a,b,c),res},updateComponent:function(b,c){if(c=_.clone(c),c.id=b,"root"==b){var d=this.rootComponent.detachAllComponents();return c=_.defaults(c,this.rootComponent.options),this.rootComponent.destroy(),this.rootComponent=new a.EffectList(c,d),this.rootComponent.init(this.gl,this),!0}return this.rootComponent.updateComponent(b,c)},removeComponent:function(a){var b=this.rootComponent.detachComponent(a);return b?(b.destroy(),!0):!1},moveComponent:function(a,b,c){var d=this.rootComponent.detachComponent(a);return d?this.rootComponent.addComponent(b,d,c):!1},getResource:function(b){var c;return c=this.resources[b],c||(c=a.Resources[b]),c||(c=b),c},setResource:function(a,b){this.resources[a]=b},traverse:function(a){this.rootComponent.traverse(a)}}),b.ui={leaf:!1,disp:"Main",schema:{name:{type:"string",title:"Name"},author:{type:"string",title:"Author"},description:{type:"string",title:"Description"},clearFrame:{type:"boolean",title:"Clear every frame","default":!1,required:!0}}}}(Webvs),function(a){function b(a){this.id=a.id,this.enabled=_.isUndefined(a.enabled)?!0:a.enabled,this.componentInited=!1,this.options=a}a.Component=a.defineClass(b,Object,{componentName:"Component",init:function(a,b,c){this.gl=a,this.main=b,this.parent=c,this.componentInited=!0},adoptOrInit:function(a,b,c){return this.componentInited?this.adopt(c):this.init(a,b,c)},adopt:function(a){this.parent=a},update:function(){},destroy:function(){},getOptions:function(){return this.options},getPath:function(){return _.isUndefined(this.parent)||_.isUndefined(this.id)?this.componentName+"#Main":this.parent.getIdString()+"/"+this.componentName+"#"+this.id}})}(Webvs),function(a){function b(a,c){b.super.constructor.call(this,a),this.components=[],_.each(c||a.components||[],function(a){this.addComponent(this.id,a)},this)}a.Container=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d);for(var e=0;e0&&this._frameCounter--,0!==this._frameCounter))&&(this.code.beat=this.main.analyser.beat?1:0,this.code.enabled=1,this.code.clear=this.clearFrame,this._inited||(this._inited=!0,this.code.init()),this.code.perFrame(),0!==this.code.enabled)){if(this.fm.setRenderTarget(),(this.clearFrame||this.first||this.code.clear)&&(a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT),this.first=!1),-1!==this.input){var c=this.parent.fm.getCurrentTexture();this.main.copier.run(this.fm,this.input,c)}for(var d=0;de;e++){var f=b.charAt(e);"\n"===f?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1)}a.offset+=c}function f(a){F.offsetH.offset&&(H=d(F),I=[]),I.push(a))}function g(){var a="program@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,i,j,k,l,m,n,o,p,q,r;if(p=d(F),q=d(F),g=x(),null!==g)if(i=h(),null!==i)if(j=x(),null!==j){for(k=[],r=d(F),59===b.charCodeAt(F.offset)?(l=";",e(F,1)):(l=null,0===G&&f('";"')),null!==l?(m=x(),null!==m?(n=h(),null!==n?(o=x(),null!==o?l=[l,m,n,o]:(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r));null!==l;)k.push(l),r=d(F),59===b.charCodeAt(F.offset)?(l=";",e(F,1)):(l=null,0===G&&f('";"')),null!==l?(m=x(),null!==m?(n=h(),null!==n?(o=x(),null!==o?l=[l,m,n,o]:(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r));null!==k?(59===b.charCodeAt(F.offset)?(l=";",e(F,1)):(l=null,0===G&&f('";"')),l=null!==l?l:"",null!==l?(m=x(),null!==m?g=[g,i,j,k,l,m]:(g=null,F=d(q))):(g=null,F=d(q))):(g=null,F=d(q))}else g=null,F=d(q);else g=null,F=d(q);else g=null,F=d(q);return null!==g&&(g=function(a,b,c,d){var e=[d[1]];return e=e.concat(_.map(d[3],function(a){return a[2]})),new Webvs.AstProgram(e)}(p.offset,p.line,p.column,g)),null===g&&(F=d(p)),J[a]={nextPos:d(F),result:g},g}function h(){var a="statement@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n;return l=d(F),n=d(F),g=s(),null!==g?(h=x(),null!==h?(61===b.charCodeAt(F.offset)?(i="=",e(F,1)):(i=null,0===G&&f('"="')),null!==i?(j=x(),null!==j?(k=m(),null!==k?g=[g,h,i,j,k]:(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d,e){return new Webvs.AstAssignment(d,e)}(l.offset,l.line,l.column,g[0],g[4])),null===g&&(F=d(l)),null===g&&(g=m()),J[a]={nextPos:d(F),result:g},g}function i(){var a="unary_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function j(){var a="additive_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function k(){var a="multiplicative_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 42===b.charCodeAt(F.offset)?(g="*",e(F,1)):(g=null,0===G&&f('"*"')),null===g&&(47===b.charCodeAt(F.offset)?(g="/",e(F,1)):(g=null,0===G&&f('"/"')),null===g&&(37===b.charCodeAt(F.offset)?(g="%",e(F,1)):(g=null,0===G&&f('"%"')))),J[a]={nextPos:d(F),result:g},g}function l(){var a="boolean_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 38===b.charCodeAt(F.offset)?(g="&",e(F,1)):(g=null,0===G&&f('"&"')),null===g&&(124===b.charCodeAt(F.offset)?(g="|",e(F,1)):(g=null,0===G&&f('"|"'))),J[a]={nextPos:d(F),result:g},g}function m(){var a="boolean_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,k,m;if(j=d(F),k=d(F),c=n(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(k))}else c=null,F=d(k);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function n(){var a="additive_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,k,l,m;if(k=d(F),l=d(F),c=o(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(k.offset,k.line,k.column,c[0],c[1])),null===c&&(F=d(k)),J[a]={nextPos:d(F),result:c},c}function o(){var a="multiplicative_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,l,m;if(j=d(F),l=d(F),c=p(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function p(){var a="unary@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h;return g=d(F),h=d(F),c=i(),null!==c?(e=x(),null!==e?(f=q(),null!==f?c=[c,e,f]:(c=null,F=d(h))):(c=null,F=d(h))):(c=null,F=d(h)),null!==c&&(c=function(a,b,c,d,e){return new Webvs.AstUnaryExpr(d,e)}(g.offset,g.line,g.column,c[0],c[2])),null===c&&(F=d(g)),null===c&&(c=q()),J[a]={nextPos:d(F),result:c},c}function q(){var a="func_call@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n,o,p,q,s,t;if(p=d(F),q=d(F),s=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(s))}else g=null,F=d(s);if(null!==g)if(h=x(),null!==h)if(40===b.charCodeAt(F.offset)?(i="(",e(F,1)):(i=null,0===G&&f('"("')),null!==i){for(s=d(F),j=[],t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==k;)j.push(k),t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==j?(k=x(),null!==k?(l=m(),null!==l?j=[j,k,l]:(j=null,F=d(s))):(j=null,F=d(s))):(j=null,F=d(s)),j=null!==j?j:"",null!==j?(k=x(),null!==k?(41===b.charCodeAt(F.offset)?(l=")",e(F,1)):(l=null,0===G&&f('")"')),null!==l?g=[g,h,i,j,k,l]:(g=null,F=d(q))):(g=null,F=d(q))):(g=null,F=d(q))}else g=null,F=d(q);else g=null,F=d(q);else g=null,F=d(q);return null!==g&&(g=function(a,b,c,d,e){var f=[];return _.each(e[0],function(a){f.push(a[1])}),f.push(e[2]),new Webvs.AstFuncCall(D(d),f)}(p.offset,p.line,p.column,g[0],g[3])),null===g&&(F=d(p)),null===g&&(g=r()),J[a]={nextPos:d(F),result:g},g}function r(){var a="primary_expr@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;return g=w(),null===g&&(g=u(),null===g&&(g=v(),null===g&&(g=t(),null===g&&(j=d(F),k=d(F),40===b.charCodeAt(F.offset)?(g="(",e(F,1)):(g=null,0===G&&f('"("')),null!==g?(h=m(),null!==h?(41===b.charCodeAt(F.offset)?(i=")",e(F,1)):(i=null,0===G&&f('")"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))):(g=null,F=d(k)),null!==g&&(g=function(a,b,c,d){return d}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)))))),J[a]={nextPos:d(F),result:g},g}function s(){var a="assignable@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c;return c=v(),null===c&&(c=t()),J[a]={nextPos:d(F),result:c},c}function t(){var a="identifier@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"ID")}(j.offset,j.line,j.column,g)),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function u(){var a="constant@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),36===b.charCodeAt(F.offset)?(g="$",e(F,1)):(g=null,0===G&&f('"$"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"CONST")}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function v(){var a="register@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(l=d(F),m=d(F),64===b.charCodeAt(F.offset)?(g="@",e(F,1)):(g=null,0===G&&f('"@"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(m))}else g=null,F=d(m);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_AT_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g[1])),null===g&&(F=d(l)),null===g&&(l=d(F),m=d(F),/^[rR]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[rR]")),null!==g?(/^[eE]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[eE]")),null!==h?(/^[gG]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[gG]")),null!==i?(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j?(/^[0-9]/.test(b.charAt(F.offset))?(k=b.charAt(F.offset),e(F,1)):(k=null,0===G&&f("[0-9]")),null!==k?g=[g,h,i,j,k]:(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g)),null===g&&(F=d(l))),J[a]={nextPos:d(F),result:g},g}function w(){var a="value@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m,n,o;for(m=d(F),n=d(F),g=[],/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));if(null!==g)if(46===b.charCodeAt(F.offset)?(h=".",e(F,1)):(h=null,0===G&&f('"."')),null!==h){if(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j)for(i=[];null!==j;)i.push(j),/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]"));else i=null;if(null!==i){if(o=d(F),/^[Ee]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[Ee]")),null!==j){if(/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]")),null!==l)for(k=[];null!==l;)k.push(l),/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]"));else k=null;null!==k?j=[j,k]:(j=null,F=d(o))}else j=null,F=d(o);j=null!==j?j:"",null!==j?g=[g,h,i,j]:(g=null,F=d(n))}else g=null,F=d(n)}else g=null,F=d(n);else g=null,F=d(n);if(null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseFloat(D(d)),"VALUE")}(m.offset,m.line,m.column,g)),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]"));else g=null;if(null!==g?(/^[hH]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[hH]")),null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),16),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));else g=null;null!==g?(/^[dD]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[dD]")),h=null!==h?h:"",null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),10),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m))}}return J[a]={nextPos:d(F),result:g},g}function x(){var a="__@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e;for(c=[],e=y(),null===e&&(e=z(),null===e&&(e=A()));null!==e;)c.push(e),e=y(),null===e&&(e=z(),null===e&&(e=A()));return J[a]={nextPos:d(F),result:c},c}function y(){var a="whiteSpace@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\t\x0B\f \xA0\uFEFF]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\t\\x0B\\f \\xA0\\uFEFF]")),J[a]={nextPos:d(F),result:g},g}function z(){var a="lineEnd@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\n\r\u2028\u2029]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\n\\r\\u2028\\u2029]")),J[a]={nextPos:d(F),result:g},g}function A(){var a="comment@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(k=d(F),"/*"===b.substr(F.offset,2)?(g="/*",e(F,2)):(g=null,0===G&&f('"/*"')),null!==g){for(h=[],l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?("*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))}else g=null,F=d(k);if(null===g)if(k=d(F),"//"===b.substr(F.offset,2)?(g="//",e(F,2)):(g=null,0===G&&f('"//"')),null!==g){for(h=[],l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return J[a]={nextPos:d(F),result:g},g}function B(a){a.sort();for(var b=null,c=[],d=0;dH.offset?F:H;throw new this.SyntaxError(B(I),M,L,N.line,N.column)}return K},toSource:function(){return this._source}};return b.SyntaxError=function(b,c,d,e,f){function g(b,c){var d,e;switch(b.length){case 0:d="end of input";break;case 1:d=b[0];break;default:d=b.slice(0,b.length-1).join(", ")+" or "+b[b.length-1]}return e=c?a(c):"end of input","Expected "+d+" but "+e+" found."}this.name="SyntaxError",this.expected=b,this.found=c,this.message=g(b,c),this.offset=d,this.line=e,this.column=f},b.SyntaxError.prototype=Error.prototype,b}(),function(a){function b(){}a.CodeInstance=a.defineClass(b,Object,{rand:function(a){return Math.floor(Math.random()*a)+1},gettime:function(a){switch(a){case 0:var b=(new Date).getTime();return(b-this._bootTime)/1e3;default:throw new Error("Invalid startTime mode for gettime call")}},getosc:function(a,b){for(var c=this._analyser.getWaveform(),d=Math.floor((a-b/2)*(c.length-1)),e=Math.floor((a+b/2)*(c.length-1)),f=0,g=d;e>=g;g++)f+=c[g];return f/(e-d+1)},bindUniforms:function(a){var b=this,c=_.difference(_.keys(this),this._treatAsNonUniform);if(_.each(c,function(c){var d=b[c];"number"==typeof d&&a.setUniform(c,"1f",d)}),_.each(this._registerUsages,function(b){a.setUniform(b,"1f",this._registerBank[b])}),this.hasRandom){var d=[Math.random()/100,Math.random()/100];a.setUniform("__randStep","2fv",d)}if(this.hasGettime){var e=((new Date).getTime()-this._bootTime)/1e3;a.setUniform("__gettime0","1f",e)}_.each(this._preCompute,function(b){var c=_.map(_.last(b,b.length-2),function(a){return _.isString(a)?"__REG"==a.substring(0,5)?this._registerBank[a]:this[a]:a}),d=this[b[0]].apply(this,c);a.setUniform(b[1],"1f",d)})},setup:function(a){this._registerBank=a.registerBank,this._bootTime=a.bootTime,this._analyser=a.analyser,this.w=a.canvas.width,this.h=a.canvas.height,_.each(this._registerUsages,function(b){_.has(a.registerBank,b)||(a.registerBank[b]=0)})}}),b.clone=function(a,b){a.cid=0;var c=[a];return b>1&&_.times(b-1,function(b){var d=_.clone(a);d.cid=b+1,c.push(d)}),c}}(Webvs),function(a){function b(a,b){this.codeSrc={};for(var c in a){var d=a[c];_.isArray(d)&&(d=d.join("\n")),d=d.trim(),""!==d&&(this.codeSrc[c]=d)}this.externalVars=_.union(b||[],["w","h","cid"]),this._parseSrc()}a.ExprCodeGenerator=a.defineClass(b,Object,{_parseSrc:function(){var b={},c=[],d={},e=[];for(var f in this.codeSrc)try{var g=this.codeSrc[f];b[f]=a.PegExprParser.parse(g);var h=[];this._getVars(b[f],c,h,e),d[f]=h}catch(i){throw new Error("Error parsing "+f+"("+i.line+":"+i.column+")"+" : "+i)}this.codeAst=b,this.funcUsages=d,this.instanceVars=_.uniq(this.externalVars.concat(c)),this.registerUsages=_.uniq(e)},generateJs:function(b){var c=new a.CodeInstance;_.each(this.instanceVars,function(a){c[a]=0});var d=_.intersection(_.keys(this.codeAst),b),e=_.difference(b,d);return _.each(d,function(a){var b=this.codeAst[a],d=this._generateJs(b);c[a]=new Function(d)},this),_.each(e,function(b){c[b]=a.noop}),c._registerUsages=this.registerUsages,c},generateGlsl:function(a,b,c){var d=[];b=b||[],_.each(this.instanceVars,function(a){var c="";_.contains(b,a)||(c="uniform "),d.push(c+"float "+a+";")});var e=_.intersection(_.keys(this.codeAst),a),f=_.difference(a,e),g=_.uniq(_.flatMap(e,function(a){return this.funcUsages[a]},this));_.each(g,function(a){var b=this.glslFuncCode[a];b&&d.push(b)},this);var h=[],i=[];return _.each(e,function(a){var b=this.codeAst[a],c=this._generateGlsl(b,h);i.push("void "+a+"() {"),i.push(c),i.push("}")},this),d=d.concat(_.map(h,function(a){return"uniform float "+a[1]+";"})),d=d.concat(i),_.each(f,function(a){d.push("void "+a+"() {}")}),c._preCompute=h,_.contains(e,"rand")&&(c.hasRandom=!0),_.contains(e,"gettime")&&(c.hasGettime=!0),c._treatAsNonUniform=b,d.join("\n")},funcArgLengths:{above:2,below:2,equal:2,pow:2,sqr:1,sqrt:1,invsqrt:1,floor:1,ceil:1,abs:1,"if":3,min:2,max:2,sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,log:1,band:2,bor:2,bnot:1,rand:1,gettime:1,getosc:3,select:{min:2}},jsMathFuncs:["min","max","sin","cos","abs","tan","asin","acos","atan","log","pow","sqrt","floor","ceil"],glslFuncCode:{rand:["uniform vec2 __randStep;","vec2 __randSeed;","float rand(float max) {"," __randCur += __randStep;"," float val = fract(sin(dot(__randSeed.xy ,vec2(12.9898,78.233))) * 43758.5453);"," return (floor(val*max)+1);","}"].join("\n"),gettime:["uniform float __gettime0;","int gettime(int startTime) {"," int time = 0;"," if(startTime == 0) {"," time = __gettime0;"," }"," return time;","}"].join("\n")},_checkFunc:function(a){var b=this.funcArgLengths[a.funcName];if(void 0===b)throw Error("Unknown function "+a.funcName);if(_.isNumber(b)){if(a.args.length!=b)throw Error(a.funcName+" accepts "+b+" arguments")}else if(b.min&&a.args.length",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"below":return["(",this._generateGlsl(b.args[0],c),"<",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"equal":return["(",this._generateGlsl(b.args[0],c),"==",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"if":return["(",this._generateGlsl(b.args[0],c),"!=0.0?",this._generateGlsl(b.args[1],c),":",this._generateGlsl(b.args[2],c),")"].join("");case"select":var d=this._generateGlsl(b.args[0],c),e=this,f=function(a,b){return 1==a.length?e._generateGlsl(a[0],c):["(("+d+" === "+b+")?","("+e._generateGlsl(a[0],c)+"):","("+f(_.last(a,a.length-1),b+1)+"))"].join("")};return f(_.last(b.args,b.args.length-1),0);case"sqr":return"(pow(("+this._generateGlsl(b.args[0],c)+"), 2))";case"band":return"(float(("+this._generateGlsl(b.args[0],c)+")&&("+this._generateGlsl(b.args[1],c)+")))";case"bor":return"(float(("+this._generateGlsl(b.args[0],c)+")||("+this._generateGlsl(b.args[1],c)+")))";case"bnot":return"(float(!("+this._generateGlsl(b.args[0],c)+")))";case"invsqrt":return"(1/sqrt("+this._generateGlsl(b.args[0],c)+"))";case"atan2":return"(atan(("+this._generateGlsl(b.args[0],c)+"),("+this._generateGlsl(b.args[1],c)+"))";case"getosc":var g=_.every(b.args,function(b){return b instanceof a.AstPrimaryExpr});if(!g)throw new Error("Non Pre-Computable arguments for getosc in shader code, use variables or constants");var h="__PC_"+b.funcName+"_"+j,i=[b.funcName,h].concat(_.map(b.args,function(a){return a.value})),j=_.indexOf(c,i);return-1==j&&(c.push(i),j=c.length-1),h;default:var k=_.map(b.args,function(a){return this._generateGlsl(a,c)},this).join(","),l=b.funcName;return _.contains(this.varArgFuncs,b.funcName)&&(l+=b.args.length),"("+l+"("+k+"))"}if(b instanceof a.AstAssignment)return this._generateGlsl(b.lhs,c)+"="+this._generateGlsl(b.expr,c);if(b instanceof a.AstProgram){var m=_.map(b.statements,function(a){return this._generateGlsl(a,c)},this);return m.join(";\n")+";"}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?a.glslFloatRepr(b.value):b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&("ID"===b.type||"REG"===b.type)?b.value:void 0},_generateJs:function(b){var c;if(b instanceof a.AstBinaryExpr)return"("+this._generateJs(b.leftOperand)+b.operator+this._generateJs(b.rightOperand)+")";if(b instanceof a.AstUnaryExpr)return"("+b.operator+this._generateJs(b.operand)+")";if(b instanceof a.AstFuncCall)switch(this._checkFunc(b),b.funcName){case"above":return["(",this._generateJs(b.args[0]),">",this._generateJs(b.args[1]),"?1:0)"].join("");case"below":return["(",this._generateJs(b.args[0]),"<",this._generateJs(b.args[1]),"?1:0)"].join("");case"equal":return["(",this._generateJs(b.args[0]),"==",this._generateJs(b.args[1]),"?1:0)"].join("");case"if":return["(",this._generateJs(b.args[0]),"!==0?",this._generateJs(b.args[1]),":",this._generateJs(b.args[2]),")"].join("");case"select":var d=["((function() {"];return d.push("switch("+this._generateJs(b.args[0])+") {"),_.each(_.last(b.args,b.args.length-1),function(a,b){d.push("case "+b+": return "+this._generateJs(a)+";")},this),d.push("default : throw new Error('Unknown selector value in select');"),d.push("}}).call(this))"),d.join("");case"sqr":return"(Math.pow(("+this._generateJs(b.args[0])+"),2))";case"band":return"((("+this._generateJs(b.args[0])+")&&("+this._generateJs(b.args[1])+"))?1:0)";case"bor":return"((("+this._generateJs(b.args[0])+")||("+this._generateJs(b.args[1])+"))?1:0)";case"bnot":return"((!("+this._generateJs(b.args[0])+"))?1:0)";case"invsqrt":return"(1/Math.sqrt("+this._generateJs(b.args[0])+"))";case"atan2":return"(Math.atan(("+this._generateJs(b.args[0])+")/("+this._generateJs(b.args[1])+")))";default:var e=_.map(b.args,function(a){return this._generateJs(a)},this).join(",");return c=_.contains(this.jsMathFuncs,b.funcName)?"Math.":"this.","("+c+b.funcName+"("+e+"))"}if(b instanceof a.AstAssignment)return this._generateJs(b.lhs)+"="+this._generateJs(b.expr);if(b instanceof a.AstProgram){var f=_.map(b.statements,function(a){return this._generateJs(a)},this);return f.join(";\n")}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?b.value.toString():b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&"ID"===b.type?"this."+b.value:b instanceof a.AstPrimaryExpr&&"REG"===b.type?'this._registerBank["'+b.value+'"]':void 0},_getVars:function(b,c,d,e){b instanceof a.AstBinaryExpr?(this._getVars(b.leftOperand,c,d,e),this._getVars(b.rightOperand,c,d,e)):b instanceof a.AstUnaryExpr?this._getVars(b.operand,c,d,e):b instanceof a.AstFuncCall?(d.push(b.funcName),_.each(b.args,function(a){this._getVars(a,c,d,e)},this)):b instanceof a.AstAssignment?(this._getVars(b.lhs,c,d,e),this._getVars(b.expr,c,d,e)):b instanceof a.AstProgram?_.each(b.statements,function(a){this._getVars(a,c,d,e)},this):b instanceof a.AstPrimaryExpr&&"ID"===b.type?c.push(b.value):b instanceof a.AstPrimaryExpr&&"REG"===b.type&&e.push(b.value) +},_translateConstants:function(a){switch(a){case"pi":return Math.PI;case"e":return Math.E;case"phi":return 1.6180339887;default:throw new Error("Unknown constant "+a)}}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]);var d=new a.ExprCodeGenerator(c.code,["b"]);this.code=d.generateJs(["init","onBeat","perFrame"]),this.inited=!1,b.super.constructor.apply(this,arguments)}a.GlobalVar=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.code.setup(c,this)},update:function(){var a=this.code;a.b=this.main.analyser.beat?1:0,this.inited||(a.init(),this.inited=!0),this.main.analyser.beat&&a.onBeat(),a.perFrame()}}),b.ui={disp:"Global Var",type:"GlobalVar",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"}}}}}}(Webvs),function(a){function b(c){if(c=_.defaults(c,{action:"SAVE",bufferId:1,blendMode:"REPLACE"}),this.blendMode=a.blendModes[c.blendMode],this.action=this.actions[c.action],!this.action)throw new Error("Unknown BufferSave action "+c.action);this.action==this.actions.SAVERESTORE?this._nextAction=this.actions.SAVE:this.action==this.actions.RESTORESAVE&&(this._nextAction=this.actions.RESTORE),this._bufferId="__BUFFERSAVE_"+c.bufferId,b.super.constructor.apply(this,arguments)}a.BufferSave=a.defineClass(b,a.Component,{actions:{SAVE:1,RESTORE:2,SAVERESTORE:3,RESTORESAVE:4},init:function(c,d,e){if(b.super.init.call(this,c,d,e),!d.registerBank[this._bufferId]){var f=new a.FrameBufferManager(d.canvas.width,d.canvas.height,c,d.copier,!0,1);d.registerBank[this._bufferId]=f}},update:function(){this.gl;var a,b=this.main.registerBank[this._bufferId];switch(this.action==this.actions.SAVERESTORE||this.action==this.RESTORESAVE?(a=this._nextAction,this._nextAction=this._nextAction==this.actions.SAVE?this.actions.RESTORE:this.actions.SAVE):a=this.action,a){case this.actions.SAVE:b.setRenderTarget(),this.main.copier.run(null,null,this.parent.fm.getCurrentTexture()),b.restoreRenderTarget();break;case this.actions.RESTORE:this.main.copier.run(this.parent.fm,this.blendMode,b.getCurrentTexture())}},destroy:function(){b.super.destroy.call(this),this.main.registerBank[this._bufferId].destroy()}}),b.ui={disp:"Buffer Save",type:"BufferSave",schema:{action:{type:"string",title:"Buffer save action","enum":["SAVE","RESTORE","SAVERESTORE","RESTORESAVE"]},bufferId:{type:"number",title:"Buffer Id","enum":[1,2,3,4,5,6,7,8]},blendMode:{type:"string",title:"Blend mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){c=_.defaults(c,{speed:1,color:"#000000"}),this.color=a.parseColorNorm(c.color),this.frameCount=0,this.maxFrameCount=Math.floor(1/c.speed),this.program=new a.ClearScreenProgram(a.AVERAGE),b.super.constructor.apply(this,arguments)}a.FadeOut=a.defineClass(b,a.Component,{componentName:"FadeOut",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.gl,this.frameCount++,this.frameCount==this.maxFrameCount&&(this.frameCount=0,this.program.run(this.parent.fm,null,this.color))},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.ui={type:"FadeOut",disp:"Fade Out",schema:{speed:{type:"number",title:"Speed",maximum:0,minimum:1,"default":1},color:{type:"string",title:"Fadeout color",format:"color","default":"#FFFFFF"}},form:[{key:"speed",type:"range",step:"0.05"},"color"]}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["kernel"]),c=_.defaults(c,{edgeMode:"EXTEND",bias:0});var d;if(c.kernel in b.kernels)d=b.kernels[c.kernel];else{if(!_.isArray(c.kernel)||1!==c.kernel.length%2)throw new Error("Invalid convolution kernel");d=c.kernel}var e=Math.floor(Math.sqrt(d.length));if(e*e!=d.length)throw new Error("Invalid convolution kernel");this.program=new a.ConvolutionProgram(d,e,c.edgeMode,c.scale,c.bias),b.super.constructor.apply(this,arguments)}function c(b,d,e,f,g){var h="";switch(e){case"WRAP":h="pos = vec2(pos.x<0?pos.x+1.0:pos.x%1, pos.y<0?pos.y+1.0:pos.y%1);";break;case"EXTEND":h="pos = clamp(pos, vec2(0,0), vec2(1,1));";break;default:throw new Error("Invalid edge mode")}var i,j,k=[],l=Math.floor(d/2);for(i=0;d>i;i++)for(j=0;d>j;j++){var m=b[i*d+j];0!==m&&(k.push("pos = v_position + texel * vec2("+(i-l)+","+(j-l)+");"),k.push(h),k.push("colorSum += texture2D(u_srcTexture, pos) * "+a.glslFloatRepr(m)+";"))}_.isUndefined(f)&&(f=_.reduce(b,function(a,b){return a+b},0)),c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["void main() {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 pos;"," vec4 colorSum = vec4(0,0,0,0);",k.join("\n")," setFragColor(vec4(((colorSum+"+a.glslFloatRepr(g)+") / "+a.glslFloatRepr(f)+").rgb, 1.0));","}"]})}a.Convolution=a.defineClass(b,a.Component,{componentName:"Convolution",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.kernels={normal:[0,0,0,0,1,0,0,0,0],gaussianBlur:[.045,.122,.045,.122,.332,.122,.045,.122,.045],unsharpen:[-1,-1,-1,-1,9,-1,-1,-1,-1],emboss:[-2,-1,0,-1,1,1,0,1,2],blur:[1,1,1,1,1,1,1,1,1]},a.ConvolutionProgram=a.defineClass(c,a.QuadBoxProgram)}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["maps"]),c=_.defaults(c,{key:"RED",output:"REPLACE",mapCycleMode:"SINGLE"}),this.maps=c.maps,this.currentMap=0,this.mapCycleMode=this.mapCycleModes[c.mapCycleMode],!this.mapCycleMode)throw new Error("Unknown mapCycleMode "+c.mapCycleMode);this.program=new a.ColorMapProgram(c.key,a.getBlendMode(c.output)),b.super.constructor.apply(this,arguments)}function c(a,b){var d="";switch(a){case"RED":d="srcColor.r";break;case"GREEN":d="srcColor.g";break;case"BLUE":d="srcColor.b";break;case"(R+G+B)/2":d="mod((srcColor.r+srcColor.g+srcColor.b)/2.0, 1.0)";break;case"(R+G+B)/3":d="(srcColor.r+srcColor.g+srcColor.b)/3.0";break;case"MAX":d="max(srcColor.r, max(srcColor.g, srcColor.b))";break;default:throw new Error("Unknown colormap key function "+options.key)}c.super.constructor.call(this,{outputBlendMode:b,swapFrame:!0,fragmentShader:["uniform sampler2D u_colorMap;","void main() {"," vec4 srcColor = getSrcColor();"," setFragColor(texture2D(u_colorMap, vec2(("+d+"), 0)));","}"]})}a.ColorMap=a.defineClass(b,a.Component,{mapCycleModes:{SINGLE:1,ONBEATRANDOM:2,ONBEATSEQUENTIAL:3},init:function(a,c,d){b.super.init.call(this,a,c,d),this.colorMaps=_.map(this.maps,function(a){return this._buildColorMap(a)},this),this.currentMap=0,this.program.init(a)},update:function(){if(this.main.analyser.beat)switch(this.mapCycleMode){case this.mapCycleModes.ONBEATRANDOM:this.currentMap=Math.floor(Math.random()*this.colorMaps.length);break;case this.mapCycleModes.ONBEATSEQUENTIAL:this.currentMap=(this.currentMap+1)%this.colorMaps.length}this.program.run(this.parent.fm,null,this.colorMaps[this.currentMap])},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_buildColorMap:function(b){var c=this.gl;b=_.sortBy(b,function(a){return a.index});var d=_.map(b,function(a){return a.index});if(_.uniq(d).length!=d.length)throw new Error("map cannot have repeated indices");b=_.map(b,function(b){var c=a.parseColor(b.color);return{color:c,index:b.index}});var e=_.first(b);0!==e.index&&b.splice(0,0,{color:e.color,index:0});var f=_.last(b);255!==f.index&&b.push({color:f.color,index:255});var g=new Uint8Array(768),h=0,i=_.zip(_.first(b,b.length-1),_.last(b,b.length-1));_.each(i,function(a){var b=a[0],c=a[1],d=c.index-b.index;_.times(d,function(a){g[h++]=Math.floor((b.color[0]*(255-a)+c.color[0]*a)/255),g[h++]=Math.floor((b.color[1]*(255-a)+c.color[1]*a)/255),g[h++]=Math.floor((b.color[2]*(255-a)+c.color[2]*a)/255)})}),g[h++]=f.color[0],g[h++]=f.color[1],g[h++]=f.color[2];var j=c.createTexture();return c.bindTexture(c.TEXTURE_2D,j),c.texImage2D(c.TEXTURE_2D,0,c.RGB,256,1,0,c.RGB,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),j}}),a.ColorMapProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_colorMap","texture2D",a),c.super.draw.call(this)}}),b.ui={disp:"Color Map",type:"ColorMap",schema:{maps:{type:"array",items:{type:"array",title:"Map",items:{type:"object",properties:{color:{type:"string",title:"Color",format:"color","default":"#FFFFFF"},index:{type:"number",title:"Index",minimum:0,maximum:255}}}}},key:{type:"string",title:"Map key","enum":["RED","GREEN","BLUE","(R+G+B)/2","(R+G+B)/3","MAX"],"default":"RED"},mapCycleMode:{type:"string",title:"Map Cycle Mode","enum":["SINGLE","ONBEATRANDOM","ONBEATSEQUENTIAL"],"default":"SINGLE"},output:{type:"string",title:"Output blend mode","enum":_.keys(a.blendModes),"default":"REPLACE"}}}}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["mode","color","outColor"]),c=_.defaults(c,{mode:"BELOW",color:"#202020",outColor:"#202020",level:0}),this.mode=_.indexOf(this.modes,c.mode),-1==this.mode)throw new Error("ColorClip: invalid mode");this.color=a.parseColorNorm(c.color),this.outColor=a.parseColorNorm(c.outColor),this.level=c.level,this.program=new a.ColorClipProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor({swapFrame:!0,fragmentShader:["uniform int u_mode;","uniform vec3 u_color;","uniform vec3 u_outColor;","uniform float u_level;","void main() {"," vec4 inColor4 = getSrcColor();"," vec3 inColor = inColor4.rgb;"," bool clip = false;"," if(u_mode == 0) {"," clip = all(lessThanEqual(inColor, u_color));"," }"," if(u_mode == 1) {"," clip = all(greaterThanEqual(inColor, u_color));"," }"," if(u_mode == 2) {"," clip = (distance(inColor, u_color) <= u_level*0.5);"," }"," if(clip) {"," setFragColor(vec4(u_outColor, inColor4.a));"," } else {"," setFragColor(inColor4);"," }","}"]})}a.ColorClip=a.defineClass(b,a.Component,{modes:["BELOW","ABOVE","NEAR"],componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.mode,this.color,this.outColor,this.level)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ColorClipProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b,d,e){this.setUniform("u_mode","1i",a),this.setUniform.apply(this,["u_color","3f"].concat(b)),this.setUniform.apply(this,["u_outColor","3f"].concat(d)),this.setUniform("u_level","1f",e),c.super.draw.call(this)}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]),c=_.defaults(c,{gridW:16,gridH:16,noGrid:!1,bFilter:!0,compat:!1,coord:"POLAR"});var d;if(!_.isObject(c.code))throw new Error("Invalid Dynamic movement code");d=c.code;var e=new a.ExprCodeGenerator(d,["x","y","r","d","b"]);this.code=e.generateJs(["init","onBeat","perFrame"]);var f=e.generateGlsl(["perPixel"],["x","y","d","r"],this.code);this.inited=!1,this.noGrid=c.noGrid,this.gridW=c.gridW,this.gridH=c.gridH,this.coordMode=c.coord,this.bFilter=c.bFilter,this.compat=c.compat,this.program=this.noGrid?new a.DMovProgramNG(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f):new a.DMovProgram(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f),b.super.constructor.apply(this,arguments)}function c(a,b,d,e,f){var g=[f,this.glslFilter(b,d),"void main() {",e?"__randSeed = v_position;":""," x = v_position.x*2.0-1.0;"," y = -(v_position.y*2.0-1.0);",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," setFragColor(vec4(filter(vec2(x, -y)), 1));","}"];c.super.constructor.call(this,{fragmentShader:g,swapFrame:!0})}function d(a,b,c,e,f){var g=["attribute vec2 a_position;","varying vec2 v_newPoint;","uniform int u_coordMode;",f,"void main() {",e?"__randSeed = a_position;":""," x = a_position.x;"," y = -a_position.y;",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," v_newPoint = vec2(x,-y);"," setPosition(a_position);","}"],h=["varying vec2 v_newPoint;",this.glslFilter(b,c),"void main() {"," setFragColor(vec4(filter(v_newPoint), 1));","}"];d.super.constructor.call(this,{fragmentShader:h,vertexShader:g,swapFrame:!0})}a.DynamicMovement=a.defineClass(b,a.Component,{componentName:"DynamicMovement",init:function(c,d,e){if(b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,e),!this.noGrid){for(var f=a.clamp(this.gridW,1,this.main.canvas.width),g=a.clamp(this.gridH,1,this.main.canvas.height),h=2*(f/this.main.canvas.width),i=2*(g/this.main.canvas.height),j=Math.ceil(this.main.canvas.width/f),k=Math.ceil(this.main.canvas.height/g),l=new Float32Array(2*6*j*k),m=0,n=-1,o=-1,p=0;k>p;p++){for(var q=0;j>q;q++){var r=Math.min(n+h,1),s=Math.min(o+i,1);l[m++]=n,l[m++]=o,l[m++]=r,l[m++]=o,l[m++]=n,l[m++]=s,l[m++]=r,l[m++]=o,l[m++]=r,l[m++]=s,l[m++]=n,l[m++]=s,n+=h}n=-1,o+=i}this.gridVertices=l,this.gridVerticesSize=m/2}},update:function(){var a=this.code;this.inited||(a.init(),this.inited=!0);var b=this.main.analyser.beat;a.b=b?1:0,a.perFrame(),b&&a.onBeat(),this.noGrid?this.program.run(this.parent.fm,null,this.code):this.program.run(this.parent.fm,null,this.code,this.gridVertices,this.gridVerticesSize)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}});var e={glslRectToPolar:function(a){return"POLAR"===a?["float ar = u_resolution.x/u_resolution.y;","x=x*ar;","d = distance(vec2(x, y), vec2(0,0))/sqrt(2.0);","r = mod(atan(y, x)+PI*0.5, 2.0*PI);"].join("\n"):""},glslPolarToRect:function(a){return"POLAR"===a?["d = d*sqrt(2.0);","x = d*sin(r)/ar;","y = -d*cos(r);"].join("\n"):""},glslFilter:function(a,b){return a&&!b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 cornoff = fract(coord/texel);"," vec2 corn = floor(coord/texel)*texel;"," vec3 tl = getSrcColorAtPos(corn).rgb;"," vec3 tr = getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb;"," vec3 bl = getSrcColorAtPos(corn + vec2(0, texel.y)).rgb;"," vec3 br = getSrcColorAtPos(corn + texel).rgb;"," vec3 pt = mix(tl, tr, cornoff.x);"," vec3 pb = mix(bl, br, cornoff.x);"," return mix(pt, pb, cornoff.y);","}"].join("\n"):a&&b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 corn = floor(coord/texel)*texel;"," ivec2 cornoff = (ivec2(fract(coord/texel)*255.0));"," ivec3 tl = ivec3(255.0 * getSrcColorAtPos(corn).rgb);"," ivec3 tr = ivec3(255.0 * getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb);"," ivec3 bl = ivec3(255.0 * getSrcColorAtPos(corn + vec2(0, texel.y)).rgb);"," ivec3 br = ivec3(255.0 * getSrcColorAtPos(corn + texel).rgb);"," #define bt(i, j) int((float(i)/255.0)*float(j))"," int a1 = bt(255-cornoff.x,255-cornoff.y);"," int a2 = bt(cornoff.x ,255-cornoff.y);"," int a3 = bt(255-cornoff.x,cornoff.y);"," int a4 = bt(cornoff.x ,cornoff.y);"," float r = float(bt(a1,tl.r) + bt(a2,tr.r) + bt(a3,bl.r) + bt(a4,br.r))/255.0;"," float g = float(bt(a1,tl.g) + bt(a2,tr.g) + bt(a3,bl.g) + bt(a4,br.g))/255.0;"," float b = float(bt(a1,tl.b) + bt(a2,tr.b) + bt(a3,bl.b) + bt(a4,br.b))/255.0;"," return vec3(r,g,b);","}"].join("\n"):["vec3 filter(vec2 point) {"," return getSrcColorAtPos((point+1.0)/2.0).rgb;","}"].join("\n")}};a.DMovProgramNG=a.defineClass(c,a.QuadBoxProgram,e,{draw:function(a){a.bindUniforms(this),c.super.draw.call(this)}}),a.DMovProgram=a.defineClass(d,a.ShaderProgram,e,{draw:function(a,b,c){a.bindUniforms(this),this.setVertexAttribArray("a_position",b,2,this.gl.FLOAT,!1,0,0),this.gl.drawArrays(this.gl.TRIANGLES,0,c)}}),b.ui={type:"DynamicMovement",disp:"Dynamic Movement",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPixel:{type:"string",title:"Per Point"}}},gridW:{type:"number",title:"Grid Width","default":16},gridH:{type:"number",title:"Grid Height","default":16},coord:{type:"string",title:"Coordinate System","enum":["POLAR","RECT"],"default":"POLAR"}},form:[{key:"code.init",type:"textarea"},{key:"code.onBeat",type:"textarea"},{key:"code.perFrame",type:"textarea"},{key:"code.perPixel",type:"textarea"},"gridW","gridH","coord"]}}(Webvs),function(a){function b(a){a=_.defaults(a,{bFilter:!0,coord:"POLAR",compat:!1}),b.super.constructor.call(this,{noGrid:!0,bFilter:a.bFilter,compat:a.compat,coord:a.coord,code:a.code}),this.options=a}a.Movement=a.defineClass(b,a.DynamicMovement)}(Webvs),function(a){function b(a){if(a=_.defaults(a,{channel:"RGB",onBeatRandom:!1}),this.channel=d.indexOf(a.channel),-1==this.channel)throw new Error("Invalid Channel");this.onBeatRandom=a.onBeatRandom,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["uniform int u_channel;","void main() {"," vec3 color = getSrcColor().rgb;",_.flatMap(d,function(a,b){return["if(u_channel == "+b+") {"," setFragColor(vec4(color."+a.toLowerCase()+",1));","}"]}).join("\n"),"}"]})}var d=["RGB","RBG","BRG","BGR","GBR","GRB"];a.ChannelShift=a.defineClass(b,a.Component,{componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.onBeatRandom&&this.main.analyser.beat&&(this.channel=Math.floor(Math.random()*d.length)),this.program.run(this.parent.fm,null,this.channel)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ChannelShiftProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_channel","1i",a),c.super.draw.call(this)}}),b.ui={disp:"Channel Shift",type:"ChannelShift",schema:{channel:{type:"string",title:"Channel","enum":d},onBeatRandom:{type:"boolean",title:"On beat random"}}}}(Webvs),function(a){function b(b){b=_.defaults(b,{color:"#ffffff",invert:!1,blendMode:"REPLACE"}),this.tone=a.parseColorNorm(b.color),this.invert=b.invert,this.program=new c(a.getBlendMode(b.blendMode))}function c(a){c.super.constructor.call(this,{outputBlendMode:a,swapFrame:!0,fragmentShader:["uniform vec3 u_tone;","uniform bool u_invert;","void main() {"," vec4 srcColor = getSrcColor();"," float depth = max(srcColor.r, max(srcColor.g, srcColor.b));"," if(u_invert) {"," depth = 1.0-depth;"," }"," setFragColor(vec4(depth*u_tone, 1));","}"]})}a.UniqueTone=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.tone,this.invert)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.UniqueToneProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b){this.setUniform.apply(this,["u_tone","3f"].concat(a)),this.setUniform("u_invert","1f",b?1:0),c.super.draw.call(this)}})}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code"]),d=_.defaults(d,{source:"SPECTRUM",drawMode:"LINES",colors:["#ffffff"]});var e;if(!_.isObject(d.code))throw new Error("Invalid superscope");e=d.code;var f=new a.ExprCodeGenerator(e,["n","v","i","x","y","b","red","green","blue"]);this.code=f.generateJs(["init","onBeat","perFrame","perPoint"]),this.code.n=100,this.clone=d.clone||1,this.spectrum="SPECTRUM"==d.source,this.dots="DOTS"==d.drawMode,this.colors=_.map(d.colors,a.parseColorNorm),this.currentColor=[],this.maxStep=100,this.step=this.maxStep,this.colorId=0,this.colorStep=[0,0,0],this.thickness=d.thickness?d.thickness:1,this.inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_position;","attribute vec3 a_color;","varying vec3 v_color;","uniform float u_pointSize;","void main() {"," gl_PointSize = u_pointSize;"," setPosition(clamp(a_position, vec2(-1,-1), vec2(1,1)));"," v_color = a_color;","}"],fragmentShader:["varying vec3 v_color;","void main() {"," setFragColor(vec4(v_color, 1));","}"]})}a.SuperScope=a.defineClass(b,a.Component,{componentName:"SuperScope",init:function(c,d,e){b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,this),this.code=a.CodeInstance.clone(this.code,this.clone)},update:function(){this._stepColor(),_.each(this.code,function(a){this.drawScope(a,!this.inited)},this),this.inited=!0},drawScope:function(a,b){this.gl,a.red=this.currentColor[0],a.green=this.currentColor[1],a.blue=this.currentColor[2],b&&a.init();var c=this.main.analyser.beat;a.b=c?1:0,a.perFrame(),c&&a.onBeat();for(var d=Math.floor(a.n),e=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),f=e.length/d,g=0,h=0,i=new Float32Array(2*(this.dots?d:2*d-2)),j=new Float32Array(3*(this.dots?d:2*d-2)),k=0;d>k;k++){for(var l=0,m=0,n=Math.floor(k*f);(k+1)*f>n;n++,m++)l+=e[n];l/=m;var o=k/(d>1?d-1:1);a.i=o,a.v=l,a.perPoint(),i[g++]=a.x,i[g++]=-1*a.y,0===k||k==d-1||this.dots||(i[g++]=a.x,i[g++]=-1*a.y),this.dots?(j[h++]=a.red,j[h++]=a.green,j[h++]=a.blue):0!==k&&(j[h++]=a.red,j[h++]=a.green,j[h++]=a.blue,j[h++]=a.red,j[h++]=a.green,j[h++]=a.blue)}this.program.run(this.parent.fm,null,i,j,this.dots,this.thickness)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_stepColor:function(){var a;if(this.colors.length>1)if(this.step==this.maxStep){var b=this.colors[this.colorId];this.colorId=(this.colorId+1)%this.colors.length;var c=this.colors[this.colorId];for(a=0;3>a;a++)this.colorStep[a]=(c[a]-b[a])/this.maxStep;for(this.step=0,a=0;3>a;a++)this.currentColor[a]=b[a]}else{for(a=0;3>a;a++)this.currentColor[a]+=this.colorStep[a];this.step++}else this.currentColor=this.colors[0]}}),a.SuperScopeShader=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d){var e=this.gl;this.setUniform("u_pointSize","1f",d),this.setVertexAttribArray("a_position",a,2,e.FLOAT,!1,0,0),this.setVertexAttribArray("a_color",b,3,e.FLOAT,!1,0,0);var f;c||(f=e.getParameter(e.LINE_WIDTH),e.lineWidth(d)),e.drawArrays(c?e.POINTS:e.LINES,0,a.length/2),c||e.lineWidth(f)}}),b.ui={disp:"SuperScope",type:"SuperScope",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPoint:{type:"string",title:"Per Point"}}},source:{type:"string",title:"Source","default":"WAVEFORM","enum":["WAVEFORM","SPECTRUM"]},drawMode:{type:"string",title:"Draw Mode","default":"LINES","enum":["DOTS","LINES"]},colors:{type:"array",title:"Cycle Colors",items:{type:"string",format:"color","default":"#FFFFFF"}}}}}(Webvs),function(a){function b(a){a=_.defaults(a,{drawMode:"SOLID",source:"WAVEFORM",align:"CENTER",colors:["#ffffff"]});var c={};"SOLID"!=a.drawMode?(c.init="n=w;",c.perPoint={TOP:"x=i*2-1; y=-v/2-0.5;",CENTER:"x=i*2-1; y=-v/2;",BOTTOM:"x=i*2-1; y=v/2+0.5;"}[a.align]):(c.init="n=w*2;",c.perFrame="c=0;",c.perPoint="SPECTRUM"==a.source?{TOP:"x=i*2-1; y=if(c%2,0,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0.5,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0,v/2+0.5); c=c+1;"}[a.align]:{TOP:"x=i*2-1; y=if(c%2,-0.5,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0.5,v/2+0.5); c=c+1;"}[a.align]),b.super.constructor.call(this,{source:a.source,drawMode:"SOLID"==a.drawMode?"LINES":a.drawMode,colors:a.colors,code:c}),this.options=a}a.Simple=a.defineClass(b,a.SuperScope)}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code","imageSrc"]),d=_.defaults(d,{source:"SPECTRUM",resizing:!1,wrapAround:!1,colorFiltering:!0}),this.resizing=d.resizing,this.colorFiltering=d.colorFiltering,this.wrapAround=d.wrapAround,this.imageSrc=d.imageSrc;var e=new a.ExprCodeGenerator(d.code,["n","v","i","x","y","b","sizex","sizey","red","green","blue"]);this.code=e.generateJs(["init","onBeat","perFrame","perPoint"]),this.code.n=100,this.spectrum="SPECTRUM"==d.source,this._inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{vertexShader:["uniform bool u_colorFilter;","attribute vec2 a_texVertex;","attribute vec2 a_vertex;","attribute vec3 a_color;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," if(u_colorFilter) {"," v_color = a_color;"," }"," v_texVertex = a_texVertex;"," setPosition(a_vertex);","}"],fragmentShader:["uniform bool u_colorFilter;","uniform sampler2D u_image;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," vec3 outColor = texture2D(u_image, v_texVertex).rgb;"," if(u_colorFilter) {"," outColor = outColor*v_color;"," }"," setFragColor(vec4(outColor, 1));","}"]})}a.Texer=a.defineClass(b,a.Component,{componentName:"Texer",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a),this.code.setup(c,this);var e=new Image;e.src=c.getResource(this.imageSrc),this.imagewidth=e.width,this.imageHeight=e.height,this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)},update:function(){function a(a,b,c,d,e,f,l){-1-c>a||a>1||-1-d>b||b>1||(g.push(a,b,a+c,b,a+c,b+d,a,b+d),h.push(0,0,1,0,1,1,0,1),j&&j.push(e,f,l,e,f,l,e,f,l,e,f,l),i.push(k+0,k+1,k+2,k+0,k+2,k+3),k+=4)}var b=this.code;this._inited||b.init();var c=this.main.analyser.beat;b.b=c?1:0,b.perFrame(),c&&b.onBeat();for(var d=Math.floor(b.n),e=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),f=e.length/d,g=[],h=[],i=[],j=this.colorFiltering?[]:null,k=0,l=2*(this.imagewidth/this.parent.fm.width),m=2*(this.imageHeight/this.parent.fm.height),n=0;d>n;n++){for(var o=0,p=0,q=Math.floor(n*f);(n+1)*f>q;q++,p++)o+=e[q];o/=p;var r=n/(d-1);b.i=r,b.v=o,b.sizex=1,b.sizey=1,b.red=1,b.green=1,b.blue=1,b.perPoint();var s=l,t=m;this.resizing&&(s*=b.sizex,t*=b.sizey);var u=b.x-s/2,v=-b.y-t/2;if(a(u,v,s,t,b.red,b.green,b.blue),this.wrapAround){var w=-1>u?2:u>1-s?-2:0,x=-1>v?2:v>1-t?-2:0;w&&a(w+u,v,s,t,b.red,b.green,b.blue),x&&a(u,x+v,s,t,b.red,b.green,b.blue),w&&x&&a(w+u,x+v,s,t,b.red,b.green,b.blue)}}this.program.run(this.parent.fm,null,new Float32Array(g),new Float32Array(h),new Uint16Array(i),j?new Float32Array(j):null,this.texture)},destroy:function(){b.super.destroy.call(this),this.gl.deleteTexture(this.texture),this.program.cleanup()}}),a.TexerProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_image","texture2D",e),this.setVertexAttribArray("a_vertex",a),this.setVertexAttribArray("a_texVertex",b),d?(this.setUniform("u_colorFilter","1f",1),this.setVertexAttribArray("a_color",d,3)):this.setUniform("u_colorFilter","1f",0),this.setElementArray(c),this.gl.drawElements(this.gl.TRIANGLES,c.length,this.gl.UNSIGNED_SHORT,0)}})}(Webvs),function(a){function b(c){c=_.defaults(c,{n:0,color:"#000000",blendMode:"REPLACE"}),this.n=c.n,this.color=a.parseColorNorm(c.color),this.outputBlendMode=a.blendModes[c.blendMode],this.prevBeat=!1,this.beatCount=0,this.program=new a.ClearScreenProgram(this.outputBlendMode),b.super.constructor.apply(this,arguments)}a.ClearScreen=a.defineClass(b,a.Component,{componentName:"ClearScreen",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){var a=!1;0===this.n?a=!0:(this.main.analyser.beat&&!this.prevBeat&&(this.beatCount++,this.beatCount==this.n&&(a=!0,this.beatCount=0)),this.prevBeat=this.main.analyser.beat),a&&this.program.run(this.parent.fm,null,this.color)},destroy:function(){this.program.cleanup()}}),b.ui={type:"ClearScreen",disp:"Clear Screen",schema:{n:{type:"number",title:"Clear on beat (0 = always clear)","default":0},color:{type:"string",title:"Clear color",format:"color","default":"#000000"},blendMode:{type:"string",title:"Blend Mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["src","x","y"]),this.x=c.x,this.y=c.y,this.src=c.src,this.program=new a.PictureProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_texVertex;","uniform vec2 u_pos;","uniform vec2 u_texRes;","varying vec2 v_texCoord;","void main() {"," v_texCoord = a_texVertex;"," setPosition(a_texVertex*(u_texRes/u_resolution)*vec2(2,-2)+u_pos);","}"],fragmentShader:["uniform sampler2D u_image;","varying vec2 v_texCoord;","void main() {"," setFragColor(texture2D(u_image, v_texCoord));","}"]})}a.Picture=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a);var e=new Image;e.src=c.getResource(this.src),this.width=e.width,this.height=e.height,this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)},update:function(){this.program.run(this.parent.fm,null,this.x,this.y,this.texture,this.width,this.height)},destroy:function(){this.program.cleanup(),this.gl.deleteTexture(this.texture)}}),a.PictureProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_pos","2f",a,-b),this.setUniform("u_texRes","2f",d,e),this.setUniform("u_image","texture2D",c),this.setVertexAttribArray("a_texVertex",new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}})}(Webvs); \ No newline at end of file diff --git a/dist/webvs.min.js b/dist/webvs.min.js index 6fad237..c579806 100644 --- a/dist/webvs.min.js +++ b/dist/webvs.min.js @@ -1,3 +1,3 @@ -!function(a){var b={};a.Webvs=b,b.defineClass=function(a,b){return a.prototype=Object.create(b.prototype),a.prototype.constructor=a,a.super=b.prototype,_.chain(arguments).drop(2).each(function(b){_.extend(a.prototype,b)}),a},b.noop=function(){},b.checkRequiredOptions=function(a,b){for(var c in b){var d=b[c];if(!(d in a))throw new Error("Required option "+d+"not found")}},b.glslFloatRepr=function(a){return a+(0===a%1?".0":"")},b.parseColor=function(a){if(_.isArray(a)&&3==a.length)return a;if(_.isString(a)){var b;if(a=a.toLowerCase(),b=a.match(/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/))return _.chain(b).last(3).map(function(a){return parseInt(a,16)}).value();if(b=a.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/))return _.chain(b).last(3).map(function(a){return Math.min(parseInt(a,10),255)}).value()}throw new Error("Invalid Color Format")},b.parseColorNorm=function(a){return _.map(b.parseColor(a),function(a){return a/255})},b.logShaderError=function(a,b){var c=a.split("\n"),d=c.length.toString().length,e=b.match(/(\d+):(\d+)/);e&&(e=[parseInt(e[1],10),parseInt(e[2],10)]);var f=_.map(c,function(a,c){var f,g=c+1+"";for(f=0;fd;d++)c.push(b.charAt(Math.floor(Math.random()*b.length)));return c.join("")},b.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)}}(window),function(a){a.Resources={"avsres_texer_circle_edgeonly_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAMAAABFjsb+AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhFBMVEUAAAADAwMvLy9dXV1tbW0CAgJaWlrR0dH8/Pz+/v79/f1bW1sKCgqlpaXT09Nubm4xMTEeHh7S0tKCgoIGBgaBgYEuLi5sbGxeXl4cHBwbGxtvb29fX19ra2swMDDU1NQFBQV/f3+np6eoqKgLCwvQ0NBqamoEBAQyMjJhYWFxcXH///8GRExTAAAAAWJLR0QrJLnkCAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAK1JREFUGNN1kMkSgyAQRBViGMc1SpCYBYl7/v8Do2gocpBDF/Wqa3qmPe/w+YSeKPEdEpwZhBgCi4IfihNMs/ySZwUm8e5KoOTmx0tINmeEpZ1yxciMTwtuGS/SNUhA5cRVQBaVSBwmUC6a4c1hNd6NT/z5HosSeDrsCa81V7HGooYpcyBFbZlGut3xBr1t2Gho9x66FvtB1GLose1sU1KZXpR02xqn+TNP43HBX4kJCUk5wyykAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxK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4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0wNC0yOVQwMTo0OTozMCswNTowMPYYqoAAAAAASUVORK5CYII=","avsres_texer_circle_fade_13x13.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA9lBMVEUAAAADAwMGBgYICAgCAgIKCgoVFRUeHh4hISEdHR0JCQkODg4jIyM4ODhISEhNTU1HR0c3NzcNDQ0LCwskJCRGRkZoaGh/f3+Hh4d+fn5lZWVEREQXFxc6OjppaWmSkpKtra22trarq6uPj49mZmYHBwcgICBLS0uCgoKurq7Kysrd3d3JycmsrKxRUVGMjIy4uLjf39/+/v63t7eIiIhMTEyDg4Ovr6/MzMzLy8uAgIBJSUkEBAQYGBg8PDxsbGyVlZWwsLC5ubmTk5M5OTkWFhYMDAwmJiZKSkqEhIRqamoQEBA9PT1SUlI7OzsPDw8BAQH///+Cg4ycAAAAAWJLR0RRlGl8KgAAAAlwSFlzAAALEgAACxIB0t1+/AAAAKRJREFUCNcljukWgVAAhO9tvRKVEhGyhISEspWsZef9n0bL/Jo5c+bMB0AsiOEYBJkIkqJRjmKINOTZQpHjBVRKoiiV5UpVqdURGW/URrOltTvdnkBBoPcHQ2NkjidKkcYAI02tmT03F0sO4UBHjrta2xttu4s7z98Hh+PJOMuXa/wZRrfgbrkPnhUTkGf04t7OR/qm9zD0kYRUkcjQfh7O6F7i/uybEULrc6ImAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wN1QwMzoxNzoxMiswNjowMNF3hcgAAAAASUVORK5CYII=","avsres_texer_circle_heavyblur_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSU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Aw50C8rwAAAABJRU5ErkJggg==","avsres_texer_circle_sharp_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAe1BMVEUAAAAFBQVBQUGGhoaurq68vLyvr68GBgYBAQFNTU3Ozs78/Pz+/v7///+Kior6+vr9/f2Li4vR0dFCQkJDQ0OIiIiJiYmzs7PBwcG0tLRERETT09NRUVH7+/uQkJCRkZFTU1PU1NRUVFQHBwdHR0eMjIy1tbXDw8NISEjxdmZoAAAAAWJLR0QN9rRh9QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAJ5JREFUGNN9ke0SgiAUBUUrQbhA9qGpWGZa7/+EgZoCNu7PnTPALEGwAQqj3f4QhbHlMEkoAwBGE4LnIRfwQ3A0LbmEBXkc10SAjSBGxim4pObKE/UsPWt7YZ5lV20z8Mm0zVc2/7u9actX53JtC+lZWZj3lp4th0SVcqSqxg6106GeqqF6Wav7nBg/Gjn0lc0TW93bV9e/++7Tbn3YF1ESEZb9e6HrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0wNC0yOVQwMTo0OTozMCswNTowMPYYqoAAAAAASUVORK5CYII=","avsres_texer_circle_slightblur_13x13.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAASFBMVEUAAAABAQEODg4jIyMtLS0EBARsbGyZmZmoqKiKiorT09Py8vL4+Pj7+/v+/v7///8kJCRtbW3U1NSLi4uampqpqakPDw8uLi7NF0qwAAAAAWJLR0QPGLoA2QAAAAlwSFlzAAAL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ErkJggg==","avsres_texer_square_edgeonly_24x24.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABJJREFUCNdjYEAC8v9/UAUjAQD7uCWNIgeQwQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMTAtMDZUMjE6NTc6NDYrMDU6MDDg7pOkAAAAAElFTkSuQmCC","avsres_texer_square_edgeonly_28x28.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcAQMAAABIw03XAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABNJREFUCNdjYEAF8v//N9CPQAUArWA5f2D2DX0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTEwLTA2VDIxOjU4OjQ0KzA1OjAwhnrZAAAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_30x30.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeAQMAAAAB/jzhAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABRJREFUCNdjYEAF8v//PxgIAhUAAOmGR7lQ6SOhAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wNlQyMTo1OToxOCswNTowMOb41i4AAAAASUVORK5CYII=","avsres_texer_square_sharp_20x20.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABJJREFUCNdjYIAC+/9/qIqhAABLlCyJ9A7ihwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMDYtMjlUMTk6Mzg6MDQrMDU6MDBuiiynAAAAAElFTkSuQmCC","avsres_texer_square_sharp_32x32.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABVJREFUCNdjYMAB+P////9hCJM4AACQJX+BjmWyDAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDktMTAtMDhUMDE6NTM6NTYrMDU6MDBzUO7GAAAAAElFTkSuQmCC","avsres_texer_square_sharp_48x48.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4AQMAAACSSKldAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABZJREFUGNNjYCAA+P+DwIdReoBoAgAAldYe8LB8aUoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDA5LTEwLTA4VDAxOjUzOjI4KzA1OjAwKaqcggAAAABJRU5ErkJggg==","avsres_texer_square_sharp_60x60.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABEAQMAAAAC3QHxAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAABdJREFUKM9jYCAS8P+HgFHWKIuaLCIBAH8IpfBELmrmAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMTo1NDozMiswNTowMKOs2CsAAAAASUVORK5CYII=","avsres_texer_square_sharp_64x64.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQAQMAAAC032DuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABdJREFUKM9jYKAV+A8Fo8xR5lBk0gYAAMbE/hBbX3sVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODowMCswNjowML8mns0AAAAASUVORK5CYII=","avsres_texer_square_sharp_72x72.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUAQMAAAAmpYKCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABpJREFUKM9jYKASYP4PBX9G2aPsUTa12VQCABpBhZc9Qe3KAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjowMjoxNiswNjowMMbw5GAAAAAASUVORK5CYII=","avsres_texer_square_sharp_96x96.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwAQMAAAD8LmYIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAB1JREFUOMtjYBgo8B8JjHJHuaPcUe4od/BwBwYAAB86e71LirdOAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODo0NiswNjowMFi8pQ0AAAAASUVORK5CYII=","avsres_texer_square_sharp_250x250.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQoAAAEKAQMAAADQBYmKAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAADlJREFUaN7tykENAAAIBCD7p7KZFrgZwMGbKrK5taIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoivKpkCyUd+T92W3T7QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTEtMDEtMDVUMTg6NTk6NTQrMDU6MDBwiLErAAAAAElFTkSuQmCC"}}(Webvs),function(a){function b(){}a.AnalyserAdapter=a.defineClass(b,Object,{beat:!1,isPlaying:function(){return!1},getWaveform:function(){return new Float32Array(0)},getSpectrum:function(){return new Float32Array(0)}})}(Webvs),function(a){function b(a){this.dancer=a,this.beat=!1;var b=this;this.kick=a.createKick({onKick:function(){b.beat=!0},offKick:function(){b.beat=!1}}),this.kick.on()}a.DancerAdapter=a.defineClass(b,a.AnalyserAdapter,{isPlaying:function(){return this.dancer.isPlaying()},getWaveform:function(){return this.dancer.getWaveform()},getSpectrum:function(){return this.dancer.getSpectrum()}})}(Webvs),function(a){function b(b){if(a.checkRequiredOptions(b,["canvas","analyser"]),b=_.defaults(b,{showStat:!1}),this.canvas=b.canvas,this.analyser=b.analyser,this.isStarted=!1,b.showStat){var c=new Stats;c.setMode(0),c.domElement.style.position="absolute",c.domElement.style.right="5px",c.domElement.style.bottom="5px",document.body.appendChild(c.domElement),this.stats=c}this.resources={},this.rootComponent=new a.EffectList({id:"root"}),this._registerContextEvents(),this._initGl()}a.Main=a.defineClass(b,Object,{_registerContextEvents:function(){var a=this;this.canvas.addEventListener("webglcontextlost",function(b){b.preventDefault(),a.stop()}),this.canvas.addEventListener("webglcontextrestored",function(){a.resetCanvas()})},_initGl:function(){try{this.gl=this.canvas.getContext("experimental-webgl",{alpha:!1}),this.copier=new a.CopyProgram({dynamicBlend:!0}),this.copier.init(this.gl),this.resolution={width:this.canvas.width,height:this.canvas.height}}catch(b){throw new Error("Couldnt get webgl context"+b)}},loadPreset:function(b){b=_.clone(b),b.id="root";var c=new a.EffectList(b);this.stop(),this.rootComponent.destroy(),this.rootComponent=c,this.resources=b.resources||{}},resetCanvas:function(){this.stop();var b=this.rootComponent.getOptions();this.rootComponent.destroy(),this.copier.cleanup(),this._initGl(),this.rootComponent=new a.EffectList(b)},start:function(){if(!this.isStarted){var a=this.rootComponent,b=this,c=function(){b.analyser.isPlaying()&&a.update(),b.animReqId=requestAnimationFrame(c)};if(this.stats){var d=c;c=function(){b.stats.begin(),d.call(this,arguments),b.stats.end()}}if(a.componentInited)this.animReqId=requestAnimationFrame(c);else{this.registerBank={},this.bootTime=(new Date).getTime();var e=a.init(this.gl,this);e.onResolve(function(){b.animReqId=requestAnimationFrame(c)})}this.isStarted=!0}},stop:function(){_.isUndefined(this.animReqId)||(cancelAnimationFrame(this.animReqId),this.isStarted=!1)},getPreset:function(){var a=this.rootComponent.getOptions();return a.resources=this.resources,a},addComponent:function(a,b,c){this.stop(),b=_.clone(b);var d=this.rootComponent.addComponent(a,b,c);if(d){var e=this;return d[1].onResolve(function(){e.start()}),d[0]}},updateComponent:function(a,b){this.stop();var c=this;if(b=_.clone(b),"root"==a){var d=this.rootComponent.detachAllComponents(),e=this.rootComponent.preset;return this.rootComponent.destroy(),this.rootComponent=new EffectList(e,d),_.each(d,function(a){a.destroyPool()}),c.start(),!0}var f=this.rootComponent.updateComponent();return f?(promises.onResolve(function(){c.start()}),!0):!1},removeComponent:function(a){var b=this.rootComponent.detachComponent(a);return b?(b.destroyPool(),!0):!1},moveComponent:function(a,b){var c=this.rootComponent.detachComponent(a);if(c){var d=this.rootComponent.addComponent(b,c);if(c.destroyPool(),d)return!0}return!1},getResource:function(b){var c;return c=this.resources[b],c||(c=a.Resources[b]),c||(c=b),c},setResource:function(a,b){this.resources[a]=b},traverse:function(a){this.rootComponent.traverse(a)}}),b.ui={leaf:!1,disp:"Main",schema:{name:{type:"string",title:"Name"},author:{type:"string",title:"Author"},description:{type:"string",title:"Description"},clearFrame:{type:"boolean",title:"Clear every frame","default":!1,required:!0}}}}(Webvs),function(a){function b(a){this.id=a.id,this.enabled=_.isUndefined(a.enabled)?!0:a.enabled,this.componentInited=!1,this.options=a}a.Component=a.defineClass(b,Object,{componentName:"Component",init:function(a,b,c){this.gl=a,this.main=b,this.parent=c,this.componentInited=!0},adoptOrInit:function(a,b,c){return this.componentInited?this.adopt(c):this.init(a,b,c)},adopt:function(a){this.parent=a},update:function(){},destroy:function(){},getOptions:function(){return this.options},getPath:function(){return _.isUndefined(this.parent)||_.isUndefined(this.id)?this.componentName+"#Main":this.parent.getIdString()+"/"+this.componentName+"#"+this.id}})}(Webvs),function(a){function b(a,c){b.super.constructor.call(this,a),this.components=[],this._containerInited=!1,_.each(c||a.components||[],function(a){this.addComponent(this.id,a)},this)}function c(a,b){this.options=a,this.pool=b||[]}function d(a,b,c){if(b.call(c,a),a.__clones)for(var d=0;d0?this.pool.pop():c.makeComponent(this.options,a)},destroyPool:function(){_.each(this.pool,function(a){d(a,function(a){a.destroy()})}),this.pool=[]}}),c.makeComponent=function(b,c){var d=a[b.type];if(!d)throw new Error("Unknown Component class "+b.type);var e=new d(b,c),f=_.isNumber(b.clone)?b.clone:1;if(f--,f){var g=[];_.times(f,function(a){var e=new d(b,c);e.cloneId=a+1,g.push(e)}),e.cloneId=0,e.__clones=g}return e},c.merge=function(a){var b=[];return _.each(a,function(a){b=b.concat(a.pool)}),new c(a[0].options,b)}}(Webvs),function(a){function b(c){c=_.defaults(c,{output:"REPLACE",input:"IGNORE",clearFrame:!1,enableOnBeat:!1,enableOnBeatFor:1}),this.output="IGNORE"==c.output?-1:a.blendModes[c.output],this.input="IGNORE"==c.input?-1:a.blendModes[c.input],this.clearFrame=c.clearFrame,this.enableOnBeat=c.enableOnBeat,this.enableOnBeatFor=c.enableOnBeatFor,this.first=!0,this._frameCounter=0,this._inited=!1;var d=new a.ExprCodeGenerator(c.code,["beat","enabled","clear","w","h","cid"]),e=d.generateCode(["init","perFrame"],[],[]);this.code=e[0],b.super.constructor.apply(this,arguments)}a.EffectList=a.defineClass(b,a.Container,{componentName:"EffectList",init:function(c,d,e){var f=b.super.init.call(this,c,d,e);return this.code.setup(d,this),this.fm=new a.FrameBufferManager(d.canvas.width,d.canvas.height,c,d.copier),f},update:function(){b.super.update.call(this);var a=this.gl;if((!this.enableOnBeat||(this.main.analyser.beat?this._frameCounter=this.enableOnBeatFor:this._frameCounter>0&&this._frameCounter--,0!==this._frameCounter))&&(this.code.beat=this.main.analyser.beat?1:0,this.code.enabled=1,this.code.clear=this.clearFrame,this._inited||(this._inited=!0,this.code.init()),this.code.perFrame(),0!==this.code.enabled)){if(this.fm.setRenderTarget(),(this.clearFrame||this.first||this.code.clear)&&(a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT),this.first=!1),-1!==this.input){var c=this.parent.fm.getCurrentTexture();this.main.copier.run(this.fm,this.input,c)}this.iterChildren(function(a){a.enabled&&a.update()}),this.fm.restoreRenderTarget(),-1!=this.output&&(this.parent?this.main.copier.run(this.parent.fm,this.output,this.fm.getCurrentTexture()):this.main.copier.run(null,null,this.fm.getCurrentTexture()))}},destroy:function(){b.super.destroy.call(this),this.fm&&this.fm.destroy()}}),b.ui={disp:"Effect List",type:"EffectList",leaf:!1,schema:{clearFrame:{type:"boolean",title:"Clear Frame","default":!1,required:!0},enableOnBeat:{type:"boolean",title:"Enable on beat","default":!1},enableOnBeatFor:{type:"number",title:"Enable on beat for frames","default":1},output:{type:"string",title:"Output","default":"REPLACE","enum":_.keys(a.blendModes)},input:{type:"string",title:"Input","default":"IGNORE","enum":_.union(_.keys(a.blendModes),["IGNORE"])}}}}(Webvs),function(a){function b(b){b=_.defaults(b,{forceShaderBlend:!1,outputBlendMode:a.REPLACE,varyingPos:!1,dynamicBlend:!1,swapFrame:!1,copyOnSwap:!1});var c=["precision mediump float;","uniform vec2 u_resolution;","#define PI "+Math.PI],d=_.clone(c);if(_.isFunction(b.draw)&&(this.draw=b.draw),this.copyOnSwap=b.copyOnSwap,this.varyingPos=b.varyingPos,this.dynamicBlend=b.dynamicBlend,this.outputBlendMode=b.outputBlendMode,b.swapFrame||this.dynamicBlend||b.forceShaderBlend||!_.contains(this.glBlendModes,this.outputBlendMode)?(this.swapFrame=!0,this.glBlendMode=!1,this.varyingPos=!0):(this.swapFrame=!1,this.glBlendMode=!0),this.varyingPos?(c.push("varying vec2 v_position;"),d.push("varying vec2 v_position;","#define setPosition(pos) (v_position = (((pos)+1.0)/2.0),gl_Position = vec4((pos), 0, 1))")):d.push("#define setPosition(pos) (gl_Position = vec4((pos), 0, 1))"),this.swapFrame&&(d.push("uniform sampler2D u_srcTexture;","#define getSrcColorAtPos(pos) (texture2D(u_srcTexture, pos))"),c.push("uniform sampler2D u_srcTexture;","#define getSrcColor() (texture2D(u_srcTexture, v_position))","#define getSrcColorAtPos(pos) (texture2D(u_srcTexture, pos))")),this.dynamicBlend)c.push("uniform int u_blendMode;","void setFragColor(vec4 color) {"),_.each(this.blendEqs,function(a,b){c.push(" if(u_blendMode == "+b+") {"," gl_FragColor = ("+a+");"," }")}),c.push("}");else{var e=this.blendEqs[this.glBlendMode?a.REPLACE:this.outputBlendMode];if(_.isUndefined(e))throw new Error("Blend Mode "+this.outputBlendMode+" not supported");c.push("#define setFragColor(color) (gl_FragColor = ("+e+"))")}this.fragmentSrc=c.join("\n")+"\n"+b.fragmentShader.join("\n"),this.vertexSrc=d.join("\n")+"\n"+b.vertexShader.join("\n"),this._locations={},this._textureVars=[],this._arrBuffers={}}a.ShaderProgram=a.defineClass(b,Object,{glBlendModes:[a.REPLACE,a.AVERAGE,a.ADDITIVE,a.SUBTRACTIVE1,a.SUBTRACTIVE2,a.MULTIPLY],blendEqs:_.object([[a.REPLACE,"color"],[a.MAXIMUM,"max(color, texture2D(u_srcTexture, v_position))"],[a.AVERAGE,"(color+texture2D(u_srcTexture, v_position))/2.0"],[a.ADDITIVE,"color+texture2D(u_srcTexture, v_position)"],[a.SUBTRACTIVE1,"texture2D(u_srcTexture, v_position)-color"],[a.SUBTRACTIVE2,"color-texture2D(u_srcTexture, v_position)"],[a.MULTIPLY,"color*texture2D(u_srcTexture, v_position)"]]),init:function(a){this.gl=a;try{this._compileProgram(this.vertexSrc,this.fragmentSrc)}catch(b){throw b -}},setOutputBlendMode:function(a){this.outputBlendMode=a},run:function(b,c){var d=this.gl,e=d.getParameter(d.CURRENT_PROGRAM);if(d.useProgram(this.program),b&&(this.setUniform("u_resolution","2f",b.width,b.height),this.swapFrame&&(this.setUniform("u_srcTexture","texture2D",b.getCurrentTexture()),b.swapAttachment(),this.copyOnSwap&&b.copyOver())),c&&!this.dynamicBlend)throw new Error("Cannot set blendmode at runtime. Use dynamicBlend");c=c||this.outputBlendMode,this.dynamicBlend&&this.setUniform("u_blendMode","1i",c),this.glBlendMode&&c!=a.REPLACE?(d.enable(d.BLEND),this._setGlBlendMode(d,c)):d.disable(d.BLEND),this.draw.apply(this,_.drop(arguments,2)),d.disable(d.BLEND),d.useProgram(e)},draw:function(){},_compileProgram:function(a,b){var c=this.gl,d=this._compileShader(a,c.VERTEX_SHADER),e=this._compileShader(b,c.FRAGMENT_SHADER),f=c.createProgram();if(c.attachShader(f,d),c.attachShader(f,e),c.linkProgram(f),!c.getProgramParameter(f,c.LINK_STATUS))throw new Error("Program link Error: "+c.getProgramInfoLog(f));this.vertex=d,this.fragment=e,this.program=f},_compileShader:function(b,c){var d=this.gl,e=d.createShader(c);if(d.shaderSource(e,b),d.compileShader(e),!d.getShaderParameter(e,d.COMPILE_STATUS))throw a.logShaderError(b,d.getShaderInfoLog(e)),new Error("Shader compilation Error: "+d.getShaderInfoLog(e));return e},_setGlBlendMode:function(b,c){switch(c){case a.ADDITIVE:b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_ADD);break;case a.SUBTRACTIVE1:b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_REVERSE_SUBTRACT);break;case a.SUBTRACTIVE2:b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_SUBTRACT);break;case a.MULTIPLY:b.blendFunc(b.DST_COLOR,b.ZERO),b.blendEquation(b.FUNC_ADD);break;case a.AVERAGE:b.blendColor(.5,.5,.5,1),b.blendFunc(b.CONSTANT_COLOR,b.CONSTANT_COLOR),b.blendEquation(b.FUNC_ADD);break;default:throw new Error("Invalid blend mode")}},getLocation:function(a,b){var c=this._locations[a];return _.isUndefined(c)&&(c=b?this.gl.getAttribLocation(this.program,a):this.gl.getUniformLocation(this.program,a),this._locations[a]=c),c},getTextureId:function(a){var b=_.indexOf(this._textureVars,a);return-1===b&&(this._textureVars.push(a),b=this._textureVars.length-1),b},setUniform:function(a,b,c){var d=this.getLocation(a),e=this.gl;switch(b){case"texture2D":var f=this.getTextureId(a);e.activeTexture(e["TEXTURE"+f]),e.bindTexture(e.TEXTURE_2D,c),e.uniform1i(d,f);break;case"1f":case"2f":case"3f":case"4f":case"1i":case"2i":case"3i":case"4i":var g=[d].concat(_.drop(arguments,2));e["uniform"+b].apply(e,g);break;case"1fv":case"2fv":case"3fv":case"4fv":case"1iv":case"2iv":case"3iv":case"4iv":e["uniform"+b].apply(e,d,c)}},setVertexAttribArray:function(a,b,c,d,e,f,g){var h=this.gl;c=c||2,d=d||h.FLOAT,e=e||!1,f=f||0,g=g||0;var i=this._arrBuffers[a];_.isUndefined(i)&&(i=h.createBuffer(),this._arrBuffers[a]=i);var j=this.getLocation(a,!0);h.bindBuffer(h.ARRAY_BUFFER,i),h.bufferData(h.ARRAY_BUFFER,b,h.STATIC_DRAW),h.enableVertexAttribArray(j),h.vertexAttribPointer(j,c,d,e,f,g)},setElementArray:function(a){var b=this.gl,c=this._arrBuffers.__indexBuffer;_.isUndefined(c)&&(c=b.createBuffer(),this._arrBuffers.__indexBuffer=c),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c),b.bufferData(b.ELEMENT_ARRAY_BUFFER,a,b.STATIC_DRAW)},cleanup:function(){var a=this.gl;_.each(this._buffers,function(b){a.deleteBuffer(b)},this),a.deleteProgram(this.program),a.deleteShader(this.vertexShader),a.deleteShader(this.fragmentShader)}})}(Webvs),function(a){function b(a){a=_.defaults(a,{vertexShader:["attribute vec2 a_position;","void main() {"," setPosition(a_position);","}"],varyingPos:!0}),b.super.constructor.call(this,a)}a.QuadBoxProgram=a.defineClass(b,a.ShaderProgram,{draw:function(){this.setVertexAttribArray("a_position",new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1])),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}})}(Webvs),function(a){function b(a){a=_.defaults(a||{},{fragmentShader:["uniform sampler2D u_copySource;","void main() {"," setFragColor(texture2D(u_copySource, v_position));","}"]}),b.super.constructor.call(this,a)}a.CopyProgram=a.defineClass(b,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_copySource","texture2D",a),b.super.draw.call(this)}})}(Webvs),function(a){function b(a,b,c,d,e){this.gl=c,this.width=a,this.height=b,this.copier=d,this.texCount=e||2,this._initFrameBuffers()}a.FrameBufferManager=a.defineClass(b,Object,{_initFrameBuffers:function(){for(var a=this.gl,b=a.createFramebuffer(),c=[],d=0;de;e++){var f=b.charAt(e);"\n"===f?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1)}a.offset+=c}function f(a){F.offsetH.offset&&(H=d(F),I=[]),I.push(a))}function g(){var a="program@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,i,j,k,l,m,n,o,p,q;if(o=d(F),p=d(F),g=h(),null!==g)if(i=x(),null!==i){for(j=[],q=d(F),59===b.charCodeAt(F.offset)?(k=";",e(F,1)):(k=null,0===G&&f('";"')),null!==k?(l=x(),null!==l?(m=h(),null!==m?(n=x(),null!==n?k=[k,l,m,n]:(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q));null!==k;)j.push(k),q=d(F),59===b.charCodeAt(F.offset)?(k=";",e(F,1)):(k=null,0===G&&f('";"')),null!==k?(l=x(),null!==l?(m=h(),null!==m?(n=x(),null!==n?k=[k,l,m,n]:(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q))):(k=null,F=d(q));null!==j?(59===b.charCodeAt(F.offset)?(k=";",e(F,1)):(k=null,0===G&&f('";"')),k=null!==k?k:"",null!==k?g=[g,i,j,k]:(g=null,F=d(p))):(g=null,F=d(p))}else g=null,F=d(p);else g=null,F=d(p);return null!==g&&(g=function(a,b,c,d){var e=[d[0]];return e=e.concat(_.map(d[2],function(a){return a[2]})),new Webvs.AstProgram(e)}(o.offset,o.line,o.column,g)),null===g&&(F=d(o)),J[a]={nextPos:d(F),result:g},g}function h(){var a="statement@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n;return l=d(F),n=d(F),g=s(),null!==g?(h=x(),null!==h?(61===b.charCodeAt(F.offset)?(i="=",e(F,1)):(i=null,0===G&&f('"="')),null!==i?(j=x(),null!==j?(k=m(),null!==k?g=[g,h,i,j,k]:(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d,e){return new Webvs.AstAssignment(d,e)}(l.offset,l.line,l.column,g[0],g[4])),null===g&&(F=d(l)),null===g&&(g=m()),J[a]={nextPos:d(F),result:g},g}function i(){var a="unary_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function j(){var a="additive_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function k(){var a="multiplicative_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 42===b.charCodeAt(F.offset)?(g="*",e(F,1)):(g=null,0===G&&f('"*"')),null===g&&(47===b.charCodeAt(F.offset)?(g="/",e(F,1)):(g=null,0===G&&f('"/"')),null===g&&(37===b.charCodeAt(F.offset)?(g="%",e(F,1)):(g=null,0===G&&f('"%"')))),J[a]={nextPos:d(F),result:g},g}function l(){var a="boolean_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 38===b.charCodeAt(F.offset)?(g="&",e(F,1)):(g=null,0===G&&f('"&"')),null===g&&(124===b.charCodeAt(F.offset)?(g="|",e(F,1)):(g=null,0===G&&f('"|"'))),J[a]={nextPos:d(F),result:g},g}function m(){var a="boolean_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,k,m;if(j=d(F),k=d(F),c=n(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(k))}else c=null,F=d(k);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function n(){var a="additive_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,k,l,m;if(k=d(F),l=d(F),c=o(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(k.offset,k.line,k.column,c[0],c[1])),null===c&&(F=d(k)),J[a]={nextPos:d(F),result:c},c}function o(){var a="multiplicative_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,l,m;if(j=d(F),l=d(F),c=p(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function p(){var a="unary@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h;return g=d(F),h=d(F),c=i(),null!==c?(e=x(),null!==e?(f=q(),null!==f?c=[c,e,f]:(c=null,F=d(h))):(c=null,F=d(h))):(c=null,F=d(h)),null!==c&&(c=function(a,b,c,d,e){return new Webvs.AstUnaryExpr(d,e)}(g.offset,g.line,g.column,c[0],c[2])),null===c&&(F=d(g)),null===c&&(c=q()),J[a]={nextPos:d(F),result:c},c}function q(){var a="func_call@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n,o,p,q,s,t;if(p=d(F),q=d(F),s=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(s))}else g=null,F=d(s);if(null!==g)if(h=x(),null!==h)if(40===b.charCodeAt(F.offset)?(i="(",e(F,1)):(i=null,0===G&&f('"("')),null!==i){for(s=d(F),j=[],t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==k;)j.push(k),t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==j?(k=x(),null!==k?(l=m(),null!==l?j=[j,k,l]:(j=null,F=d(s))):(j=null,F=d(s))):(j=null,F=d(s)),j=null!==j?j:"",null!==j?(k=x(),null!==k?(41===b.charCodeAt(F.offset)?(l=")",e(F,1)):(l=null,0===G&&f('")"')),null!==l?g=[g,h,i,j,k,l]:(g=null,F=d(q))):(g=null,F=d(q))):(g=null,F=d(q))}else g=null,F=d(q);else g=null,F=d(q);else g=null,F=d(q);return null!==g&&(g=function(a,b,c,d,e){var f=[];return _.each(e[0],function(a){f.push(a[1])}),f.push(e[2]),new Webvs.AstFuncCall(D(d),f)}(p.offset,p.line,p.column,g[0],g[3])),null===g&&(F=d(p)),null===g&&(g=r()),J[a]={nextPos:d(F),result:g},g}function r(){var a="primary_expr@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;return g=w(),null===g&&(g=u(),null===g&&(g=v(),null===g&&(g=t(),null===g&&(j=d(F),k=d(F),40===b.charCodeAt(F.offset)?(g="(",e(F,1)):(g=null,0===G&&f('"("')),null!==g?(h=m(),null!==h?(41===b.charCodeAt(F.offset)?(i=")",e(F,1)):(i=null,0===G&&f('")"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))):(g=null,F=d(k)),null!==g&&(g=function(a,b,c,d){return d}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)))))),J[a]={nextPos:d(F),result:g},g}function s(){var a="assignable@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c;return c=v(),null===c&&(c=t()),J[a]={nextPos:d(F),result:c},c}function t(){var a="identifier@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"ID")}(j.offset,j.line,j.column,g)),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function u(){var a="constant@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),36===b.charCodeAt(F.offset)?(g="$",e(F,1)):(g=null,0===G&&f('"$"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"CONST")}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function v(){var a="register@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(l=d(F),m=d(F),64===b.charCodeAt(F.offset)?(g="@",e(F,1)):(g=null,0===G&&f('"@"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(m))}else g=null,F=d(m);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_AT_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g[1])),null===g&&(F=d(l)),null===g&&(l=d(F),m=d(F),/^[rR]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[rR]")),null!==g?(/^[eE]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[eE]")),null!==h?(/^[gG]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[gG]")),null!==i?(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j?(/^[0-9]/.test(b.charAt(F.offset))?(k=b.charAt(F.offset),e(F,1)):(k=null,0===G&&f("[0-9]")),null!==k?g=[g,h,i,j,k]:(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g)),null===g&&(F=d(l))),J[a]={nextPos:d(F),result:g},g}function w(){var a="value@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m,n,o;for(m=d(F),n=d(F),g=[],/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));if(null!==g)if(46===b.charCodeAt(F.offset)?(h=".",e(F,1)):(h=null,0===G&&f('"."')),null!==h){if(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j)for(i=[];null!==j;)i.push(j),/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]"));else i=null;if(null!==i){if(o=d(F),/^[Ee]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[Ee]")),null!==j){if(/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]")),null!==l)for(k=[];null!==l;)k.push(l),/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]"));else k=null;null!==k?j=[j,k]:(j=null,F=d(o))}else j=null,F=d(o);j=null!==j?j:"",null!==j?g=[g,h,i,j]:(g=null,F=d(n))}else g=null,F=d(n)}else g=null,F=d(n);else g=null,F=d(n);if(null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseFloat(D(d)),"VALUE")}(m.offset,m.line,m.column,g)),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]"));else g=null;if(null!==g?(/^[hH]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[hH]")),null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),16),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));else g=null;null!==g?(/^[dD]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[dD]")),h=null!==h?h:"",null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),10),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m))}}return J[a]={nextPos:d(F),result:g},g}function x(){var a="__@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e;for(c=[],e=y(),null===e&&(e=z(),null===e&&(e=A()));null!==e;)c.push(e),e=y(),null===e&&(e=z(),null===e&&(e=A()));return J[a]={nextPos:d(F),result:c},c}function y(){var a="whiteSpace@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\t\x0B\f \xA0\uFEFF]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\t\\x0B\\f \\xA0\\uFEFF]")),J[a]={nextPos:d(F),result:g},g}function z(){var a="lineEnd@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\n\r\u2028\u2029]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\n\\r\\u2028\\u2029]")),J[a]={nextPos:d(F),result:g},g}function A(){var a="comment@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(k=d(F),"/*"===b.substr(F.offset,2)?(g="/*",e(F,2)):(g=null,0===G&&f('"/*"')),null!==g){for(h=[],l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?("*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))}else g=null,F=d(k);if(null===g)if(k=d(F),"//"===b.substr(F.offset,2)?(g="//",e(F,2)):(g=null,0===G&&f('"//"')),null!==g){for(h=[],l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return J[a]={nextPos:d(F),result:g},g}function B(a){a.sort();for(var b=null,c=[],d=0;dH.offset?F:H;throw new this.SyntaxError(B(I),M,L,N.line,N.column)}return K},toSource:function(){return this._source}};return b.SyntaxError=function(b,c,d,e,f){function g(b,c){var d,e;switch(b.length){case 0:d="end of input";break;case 1:d=b[0];break;default:d=b.slice(0,b.length-1).join(", ")+" or "+b[b.length-1]}return e=c?a(c):"end of input","Expected "+d+" but "+e+" found."}this.name="SyntaxError",this.expected=b,this.found=c,this.message=g(b,c),this.offset=d,this.line=e,this.column=f},b.SyntaxError.prototype=Error.prototype,b}(),function(a){function b(){}a.CodeInstance=a.defineClass(b,Object,{rand:function(a){return Math.floor(Math.random()*a)+1},gettime:function(a){switch(a){case 0:var b=(new Date).getTime();return(b-this._bootTime)/1e3;default:throw new Error("Invalid startTime mode for gettime call")}},getosc:function(a,b){for(var c=this._analyser.getWaveform(),d=Math.floor((a-b/2)*(c.length-1)),e=Math.floor((a+b/2)*(c.length-1)),f=0,g=d;e>=g;g++)f+=c[g];return f/(e-d+1)},bindUniforms:function(a){var b=this,c=_.difference(_.keys(this),this._treatAsNonUniform);if(_.each(c,function(c){var d=b[c];"number"==typeof d&&a.setUniform(c,"1f",d)}),_.each(this._registerUsages,function(b){a.setUniform(b,"1f",this._registerBank[b])}),this.hasRandom){var d=[Math.random()/100,Math.random()/100];a.setUniform("__randStep","2fv",d)}if(this.hasGettime){var e=((new Date).getTime()-this._bootTime)/1e3;a.setUniform("__gettime0","1f",e)}_.each(this._preCompute,function(b){var c=_.map(_.last(b,b.length-2),function(a){return _.isString(a)?"__REG"==a.substring(0,5)?this._registerBank[a]:this[a]:a}),d=this[b[0]].apply(this,c);a.setUniform(b[1],"1f",d)})},setup:function(a,b){this._registerBank=a.registerBank,this._bootTime=a.bootTime,this._analyser=a.analyser,this.w=a.canvas.width,this.h=a.canvas.height,this.cid=b.cloneId||0,_.each(this._registerUsages,function(b){_.has(a.registerBank,b)||(a.registerBank[b]=0)})}})}(Webvs),function(a){function b(a,b){this.codeSrc=a,this.externalVars=_.union(b||[],["w","h","cid"]),this._parseSrc()}a.ExprCodeGenerator=a.defineClass(b,Object,{_parseSrc:function(){var b={},c=[],d={},e=[];for(var f in this.codeSrc)try{var g=this.codeSrc[f];_.isArray(g)&&(g=g.join("\n")),b[f]=a.PegExprParser.parse(g);var h=[];this._getVars(b[f],c,h,e),d[f]=h}catch(i){throw new Error("Error parsing "+f+"("+i.line+":"+i.column+")"+" : "+i)}this.codeAst=b,this.funcUsages=d,this.instanceVars=_.uniq(this.externalVars.concat(c)),this.registerUsages=_.uniq(e)},generateCode:function(b,c,d){var e=new a.CodeInstance,f=this,g=[];_.each(this.instanceVars,function(a){e[a]=0;var b="";_.contains(d,a)||(b="uniform "),g.push(b+"float "+a+";")});var h=_.intersection(_.keys(this.codeAst),b),i=_.difference(b,h);_.each(h,function(a){var b=f.codeAst[a],c=f._generateJs(b);e[a]=new Function(c)}),_.each(i,function(b){e[b]=a.noop});var j=_.intersection(_.keys(this.codeAst),c),k=_.difference(c,j),l=_.uniq(_.flatMap(j,function(a){return f.funcUsages[a]}));_.each(l,function(a){var b=f.glslFuncCode[a];b&&g.push(b)});var m=[],n=[];return _.each(j,function(a){var b=f.codeAst[a],c=f._generateGlsl(b,m);n.push("void "+a+"() {"),n.push(c),n.push("}")}),g=g.concat(_.map(m,function(a){return"uniform float "+a[1]+";"})),g=g.concat(n),e._preCompute=m,_.each(k,function(a){g.push("void "+a+"() {}")}),_.contains(j,"rand")&&(e.hasRandom=!0),_.contains(j,"gettime")&&(e.hasGettime=!0),e._treatAsNonUniform=d,e._registerUsages=this.registerUsages,[e,g.join("")]},funcArgLengths:{above:2,below:2,equal:2,pow:2,sqr:1,sqrt:1,invsqrt:1,floor:1,ceil:1,abs:1,"if":3,min:2,max:2,sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,log:1,band:2,bor:2,bnot:1,rand:1,gettime:1,getosc:3,select:{min:2}},jsMathFuncs:["min","max","sin","cos","abs","tan","asin","acos","atan","log","pow","sqrt","floor","ceil"],glslFuncCode:{rand:["uniform vec2 __randStep;","vec2 __randSeed;","float rand(float max) {"," __randCur += __randStep;"," float val = fract(sin(dot(__randSeed.xy ,vec2(12.9898,78.233))) * 43758.5453);"," return (floor(val*max)+1);","}"].join("\n"),gettime:["uniform float __gettime0;","int gettime(int startTime) {"," int time = 0;"," if(startTime == 0) {"," time = __gettime0;"," }"," return time;","}"].join("\n")},_checkFunc:function(a){var b=this.funcArgLengths[a.funcName];if(void 0===b)throw Error("Unknown function "+a.funcName);if(_.isNumber(b)){if(a.args.length!=b)throw Error(a.funcName+" accepts "+b+" arguments")}else if(b.min&&a.args.length",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"below":return["(",this._generateGlsl(b.args[0],c),"<",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"equal":return["(",this._generateGlsl(b.args[0],c),"==",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"if":return["(",this._generateGlsl(b.args[0],c),"!=0.0?",this._generateGlsl(b.args[1],c),":",this._generateGlsl(b.args[2],c),")"].join("");case"select":var e=this._generateGlsl(b.args[0],c),f=function(a,b){return 1==a.length?d._generateGlsl(a[0],c):["(("+e+" === "+b+")?","("+d._generateGlsl(a[0],c)+"):","("+f(_.last(a,a.length-1),b+1)+"))"].join("")};return f(_.last(b.args,b.args.length-1),0);case"sqr":return"(pow(("+this._generateGlsl(b.args[0],c)+"), 2))";case"band":return"(float(("+this._generateGlsl(b.args[0],c)+")&&("+this._generateGlsl(b.args[1],c)+")))";case"bor":return"(float(("+this._generateGlsl(b.args[0],c)+")||("+this._generateGlsl(b.args[1],c)+")))";case"bnot":return"(float(!("+this._generateGlsl(b.args[0],c)+")))";case"invsqrt":return"(1/sqrt("+this._generateGlsl(b.args[0],c)+"))";case"atan2":return"(atan(("+this._generateGlsl(b.args[0],c)+"),("+this._generateGlsl(b.args[1],c)+"))";case"getosc":var g=_.every(b.args,function(b){return b instanceof a.AstPrimaryExpr});if(!g)throw new Error("Non Pre-Computable arguments for getosc in shader code, use variables or constants");var h="__PC_"+b.funcName+"_"+j,i=[b.funcName,h].concat(_.map(b.args,function(a){return a.value})),j=_.indexOf(c,i);return-1==j&&(c.push(i),j=c.length-1),h;default:var k=_.map(b.args,function(a){return d._generateGlsl(a,c)}).join(","),l=b.funcName;return _.contains(this.varArgFuncs,b.funcName)&&(l+=b.args.length),"("+l+"("+k+"))"}if(b instanceof a.AstAssignment)return this._generateGlsl(b.lhs,c)+"="+this._generateGlsl(b.expr,c);if(b instanceof a.AstProgram){var m=_.map(b.statements,function(a){return d._generateGlsl(a,c)});return m.join(";\n")+";"}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?a.glslFloatRepr(b.value):b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&("ID"===b.type||"REG"===b.type)?b.value:void 0},_generateJs:function(b){var c,d=this;if(b instanceof a.AstBinaryExpr)return"("+this._generateJs(b.leftOperand)+b.operator+this._generateJs(b.rightOperand)+")";if(b instanceof a.AstUnaryExpr)return"("+b.operator+this._generateJs(b.operand)+")";if(b instanceof a.AstFuncCall)switch(this._checkFunc(b),b.funcName){case"above":return["(",this._generateJs(b.args[0]),">",this._generateJs(b.args[1]),"?1:0)"].join("");case"below":return["(",this._generateJs(b.args[0]),"<",this._generateJs(b.args[1]),"?1:0)"].join("");case"equal":return["(",this._generateJs(b.args[0]),"==",this._generateJs(b.args[1]),"?1:0)"].join("");case"if":return["(",this._generateJs(b.args[0]),"!==0?",this._generateJs(b.args[1]),":",this._generateJs(b.args[2]),")"].join("");case"select":var e=["((function() {"];return e.push("switch("+this._generateJs(b.args[0])+") {"),_.each(_.last(b.args,b.args.length-1),function(a,b){e.push("case "+b+": return "+this._generateJs(a)+";")},this),e.push("default : throw new Error('Unknown selector value in select');"),e.push("}}).call(this))"),e.join("");case"sqr":return"(Math.pow(("+this._generateJs(b.args[0])+"),2))";case"band":return"((("+this._generateJs(b.args[0])+")&&("+this._generateJs(b.args[1])+"))?1:0)"; -case"bor":return"((("+this._generateJs(b.args[0])+")||("+this._generateJs(b.args[1])+"))?1:0)";case"bnot":return"((!("+this._generateJs(b.args[0])+"))?1:0)";case"invsqrt":return"(1/Math.sqrt("+this._generateJs(b.args[0])+"))";case"atan2":return"(Math.atan(("+this._generateJs(b.args[0])+")/("+this._generateJs(b.args[1])+")))";default:var f=_.map(b.args,function(a){return d._generateJs(a)}).join(",");return c=_.contains(this.jsMathFuncs,b.funcName)?"Math.":"this.","("+c+b.funcName+"("+f+"))"}if(b instanceof a.AstAssignment)return this._generateJs(b.lhs)+"="+this._generateJs(b.expr);if(b instanceof a.AstProgram){var g=_.map(b.statements,function(a){return d._generateJs(a)});return g.join(";\n")}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?b.value.toString():b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&"ID"===b.type?"this."+b.value:b instanceof a.AstPrimaryExpr&&"REG"===b.type?'this._registerBank["'+b.value+'"]':void 0},_getVars:function(b,c,d,e){var f=this;b instanceof a.AstBinaryExpr?(this._getVars(b.leftOperand,c,d,e),this._getVars(b.rightOperand,c,d,e)):b instanceof a.AstUnaryExpr?this._getVars(b.operand,c,d,e):b instanceof a.AstFuncCall?(d.push(b.funcName),_.each(b.args,function(a){f._getVars(a,c,d,e)})):b instanceof a.AstAssignment?(this._getVars(b.lhs,c,d,e),this._getVars(b.expr,c,d,e)):b instanceof a.AstProgram?_.each(b.statements,function(a){f._getVars(a,c,d,e)}):b instanceof a.AstPrimaryExpr&&"ID"===b.type?c.push(b.value):b instanceof a.AstPrimaryExpr&&"REG"===b.type&&e.push(b.value)},_translateConstants:function(a){switch(a){case"pi":return Math.PI;case"e":return Math.E;case"phi":return 1.6180339887;default:throw new Error("Unknown constant "+a)}}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]);var d=new a.ExprCodeGenerator(c.code,["b"]),e=d.generateCode(["init","onBeat","perFrame"],[],[]);this.code=e[0],this.inited=!1,b.super.constructor.apply(this,arguments)}a.GlobalVar=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.code.setup(c,this)},update:function(){var a=this.code;a.b=this.main.analyser.beat?1:0,this.inited||(a.init(),this.inited=!0),this.main.analyser.beat&&a.onBeat(),a.perFrame()}}),b.ui={disp:"Global Var",type:"GlobalVar",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"}}}}}}(Webvs),function(a){function b(c){if(c=_.defaults(c,{action:"SAVE",bufferId:1,blendMode:"REPLACE"}),this.blendMode=a.blendModes[c.blendMode],this.action=this.actions[c.action],!this.action)throw new Error("Unknown BufferSave action "+c.action);this.action==this.actions.SAVERESTORE?this._nextAction=this.actions.SAVE:this.action==this.actions.RESTORESAVE&&(this._nextAction=this.actions.RESTORE),this._bufferId="__BUFFERSAVE_"+c.bufferId,b.super.constructor.apply(this,arguments)}a.BufferSave=a.defineClass(b,a.Component,{actions:{SAVE:1,RESTORE:2,SAVERESTORE:3,RESTORESAVE:4},init:function(c,d,e){if(b.super.init.call(this,c,d,e),!d.registerBank[this._bufferId]){var f=new a.FrameBufferManager(d.canvas.width,d.canvas.height,c,d.copier,1);d.registerBank[this._bufferId]=f}},update:function(){this.gl;var a,b=this.main.registerBank[this._bufferId];switch(this.action==this.actions.SAVERESTORE||this.action==this.RESTORESAVE?(a=this._nextAction,this._nextAction=this._nextAction==this.actions.SAVE?this.actions.RESTORE:this.actions.SAVE):a=this.action,a){case this.actions.SAVE:b.setRenderTarget(),this.main.copier.run(null,null,this.parent.fm.getCurrentTexture()),b.restoreRenderTarget();break;case this.actions.RESTORE:this.main.copier.run(this.parent.fm,this.blendMode,b.getCurrentTexture())}},destroy:function(){b.super.destroy.call(this),this.main.registerBank[this._bufferId].destroy()}}),b.ui={disp:"Buffer Save",type:"BufferSave",schema:{action:{type:"string",title:"Buffer save action","enum":["SAVE","RESTORE","SAVERESTORE","RESTORESAVE"]},bufferId:{type:"number",title:"Buffer Id","enum":[1,2,3,4,5,6,7,8]},blendMode:{type:"string",title:"Blend mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){c=_.defaults(c,{speed:1,color:"#000000"}),this.color=a.parseColorNorm(c.color),this.frameCount=0,this.maxFrameCount=Math.floor(1/c.speed),this.program=new a.ClearScreenProgram(a.AVERAGE),b.super.constructor.apply(this,arguments)}a.FadeOut=a.defineClass(b,a.Component,{componentName:"FadeOut",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.gl,this.frameCount++,this.frameCount==this.maxFrameCount&&(this.frameCount=0,this.program.run(this.parent.fm,null,this.color))},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.ui={type:"FadeOut",disp:"Fade Out",schema:{speed:{type:"number",title:"Speed",maximum:0,minimum:1,"default":1},color:{type:"string",title:"Fadeout color",format:"color","default":"#FFFFFF"}},form:[{key:"speed",type:"range",step:"0.05"},"color"]}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["kernel"]),c=_.defaults(c,{edgeMode:"EXTEND",bias:0});var d;if(c.kernel in b.kernels)d=b.kernels[c.kernel];else{if(!_.isArray(c.kernel)||1!==c.kernel.length%2)throw new Error("Invalid convolution kernel");d=c.kernel}var e=Math.floor(Math.sqrt(d.length));if(e*e!=d.length)throw new Error("Invalid convolution kernel");this.program=new a.ConvolutionProgram(d,e,c.edgeMode,c.scale,c.bias),b.super.constructor.apply(this,arguments)}function c(b,d,e,f,g){var h="";switch(e){case"WRAP":h="pos = vec2(pos.x<0?pos.x+1.0:pos.x%1, pos.y<0?pos.y+1.0:pos.y%1);";break;case"EXTEND":h="pos = clamp(pos, vec2(0,0), vec2(1,1));";break;default:throw new Error("Invalid edge mode")}var i,j,k=[],l=Math.floor(d/2);for(i=0;d>i;i++)for(j=0;d>j;j++){var m=b[i*d+j];0!==m&&(k.push("pos = v_position + texel * vec2("+(i-l)+","+(j-l)+");"),k.push(h),k.push("colorSum += texture2D(u_srcTexture, pos) * "+a.glslFloatRepr(m)+";"))}_.isUndefined(f)&&(f=_.reduce(b,function(a,b){return a+b},0)),c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["void main() {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 pos;"," vec4 colorSum = vec4(0,0,0,0);",k.join("\n")," setFragColor(vec4(((colorSum+"+a.glslFloatRepr(g)+") / "+a.glslFloatRepr(f)+").rgb, 1.0));","}"]})}a.Convolution=a.defineClass(b,a.Component,{componentName:"Convolution",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.kernels={normal:[0,0,0,0,1,0,0,0,0],gaussianBlur:[.045,.122,.045,.122,.332,.122,.045,.122,.045],unsharpen:[-1,-1,-1,-1,9,-1,-1,-1,-1],emboss:[-2,-1,0,-1,1,1,0,1,2],blur:[1,1,1,1,1,1,1,1,1]},a.ConvolutionProgram=a.defineClass(c,a.QuadBoxProgram)}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["maps"]),c=_.defaults(c,{key:"RED",output:"REPLACE",mapCycleMode:"SINGLE"}),this.maps=c.maps,this.currentMap=0,this.mapCycleMode=this.mapCycleModes[c.mapCycleMode],!this.mapCycleMode)throw new Error("Unknown mapCycleMode "+c.mapCycleMode);this.program=new a.ColorMapProgram(c.key,a.getBlendMode(c.output)),b.super.constructor.apply(this,arguments)}function c(a,b){var d="";switch(a){case"RED":d="srcColor.r";break;case"GREEN":d="srcColor.g";break;case"BLUE":d="srcColor.b";break;case"(R+G+B)/2":d="mod((srcColor.r+srcColor.g+srcColor.b)/2.0, 1.0)";break;case"(R+G+B)/3":d="(srcColor.r+srcColor.g+srcColor.b)/3.0";break;case"MAX":d="max(srcColor.r, max(srcColor.g, srcColor.b))";break;default:throw new Error("Unknown colormap key function "+options.key)}c.super.constructor.call(this,{outputBlendMode:b,swapFrame:!0,fragmentShader:["uniform sampler2D u_colorMap;","void main() {"," vec4 srcColor = getSrcColor();"," setFragColor(texture2D(u_colorMap, vec2(("+d+"), 0)));","}"]})}a.ColorMap=a.defineClass(b,a.Component,{mapCycleModes:{SINGLE:1,ONBEATRANDOM:2,ONBEATSEQUENTIAL:3},init:function(a,c,d){b.super.init.call(this,a,c,d),this.colorMaps=_.map(this.maps,function(a){return this._buildColorMap(a)},this),this.currentMap=0,this.program.init(a)},update:function(){if(this.main.analyser.beat)switch(this.mapCycleMode){case this.mapCycleModes.ONBEATRANDOM:this.currentMap=Math.floor(Math.random()*this.colorMaps.length);break;case this.mapCycleModes.ONBEATSEQUENTIAL:this.currentMap=(this.currentMap+1)%this.colorMaps.length}this.program.run(this.parent.fm,null,this.colorMaps[this.currentMap])},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_buildColorMap:function(b){var c=this.gl;b=_.sortBy(b,function(a){return a.index});var d=_.map(b,function(a){return a.index});if(_.uniq(d).length!=d.length)throw new Error("map cannot have repeated indices");b=_.map(b,function(b){var c=a.parseColor(b.color);return{color:c,index:b.index}});var e=_.first(b);0!==e.index&&b.splice(0,0,{color:e.color,index:0});var f=_.last(b);255!==f.index&&b.push({color:f.color,index:255});var g=new Uint8Array(768),h=0,i=_.zip(_.first(b,b.length-1),_.last(b,b.length-1));_.each(i,function(a){var b=a[0],c=a[1],d=c.index-b.index;_.times(d,function(a){g[h++]=Math.floor((b.color[0]*(255-a)+c.color[0]*a)/255),g[h++]=Math.floor((b.color[1]*(255-a)+c.color[1]*a)/255),g[h++]=Math.floor((b.color[2]*(255-a)+c.color[2]*a)/255)})}),g[h++]=f.color[0],g[h++]=f.color[1],g[h++]=f.color[2];var j=c.createTexture();return c.bindTexture(c.TEXTURE_2D,j),c.texImage2D(c.TEXTURE_2D,0,c.RGB,256,1,0,c.RGB,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),j}}),a.ColorMapProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_colorMap","texture2D",a),c.super.draw.call(this)}}),b.ui={disp:"Color Map",type:"ColorMap",schema:{maps:{type:"array",items:{type:"array",title:"Map",items:{type:"object",properties:{color:{type:"string",title:"Color",format:"color","default":"#FFFFFF"},index:{type:"number",title:"Index",minimum:0,maximum:255}}}}},key:{type:"string",title:"Map key","enum":["RED","GREEN","BLUE","(R+G+B)/2","(R+G+B)/3","MAX"],"default":"RED"},mapCycleMode:{type:"string",title:"Map Cycle Mode","enum":["SINGLE","ONBEATRANDOM","ONBEATSEQUENTIAL"],"default":"SINGLE"},output:{type:"string",title:"Output blend mode","enum":_.keys(a.blendModes),"default":"REPLACE"}}}}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["mode","color","outColor"]),c=_.defaults(c,{mode:"BELOW",color:"#202020",outColor:"#202020",level:0}),this.mode=_.indexOf(this.modes,c.mode),-1==this.mode)throw new Error("ColorClip: invalid mode");this.color=a.parseColorNorm(c.color),this.outColor=a.parseColorNorm(c.outColor),this.level=c.level,this.program=new a.ColorClipProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor({swapFrame:!0,fragmentShader:["uniform int u_mode;","uniform vec3 u_color;","uniform vec3 u_outColor;","uniform float u_level;","void main() {"," vec4 inColor4 = getSrcColor();"," vec3 inColor = inColor4.rgb;"," bool clip = false;"," if(u_mode == 0) {"," clip = all(lessThanEqual(inColor, u_color));"," }"," if(u_mode == 1) {"," clip = all(greaterThanEqual(inColor, u_color));"," }"," if(u_mode == 2) {"," clip = (distance(inColor, u_color) <= u_level*0.5);"," }"," if(clip) {"," setFragColor(vec4(u_outColor, inColor4.a));"," } else {"," setFragColor(inColor4);"," }","}"]})}a.ColorClip=a.defineClass(b,a.Component,{modes:["BELOW","ABOVE","NEAR"],componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.mode,this.color,this.outColor,this.level)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ColorClipProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b,d,e){this.setUniform("u_mode","1i",a),this.setUniform.apply(this,["u_color","3f"].concat(b)),this.setUniform.apply(this,["u_outColor","3f"].concat(d)),this.setUniform("u_level","1f",e),c.super.draw.call(this)}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]),c=_.defaults(c,{gridW:16,gridH:16,noGrid:!1,bFilter:!0,compat:!1,coord:"POLAR"});var d;if(!_.isObject(c.code))throw new Error("Invalid Dynamic movement code");d=c.code;var e=new a.ExprCodeGenerator(d,["x","y","r","d","b"]),f=e.generateCode(["init","onBeat","perFrame"],["perPixel"],["x","y","d","r"]);this.code=f[0],this.inited=!1,this.noGrid=c.noGrid,this.gridW=c.gridW,this.gridH=c.gridH,this.coordMode=c.coord,this.bFilter=c.bFilter,this.compat=c.compat,this.program=this.noGrid?new a.DMovProgramNG(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f[1]):new a.DMovProgram(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f[1]),b.super.constructor.apply(this,arguments)}function c(a,b,d,e,f){var g=[f,this.glslFilter(b,d),"void main() {",e?"__randSeed = v_position;":""," x = v_position.x*2.0-1.0;"," y = -(v_position.y*2.0-1.0);",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," setFragColor(vec4(filter(vec2(x, -y)), 1));","}"];c.super.constructor.call(this,{fragmentShader:g,swapFrame:!0})}function d(a,b,c,e,f){var g=["attribute vec2 a_position;","varying vec2 v_newPoint;","uniform int u_coordMode;",f,"void main() {",e?"__randSeed = a_position;":""," x = a_position.x;"," y = -a_position.y;",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," v_newPoint = vec2(x,-y);"," setPosition(a_position);","}"],h=["varying vec2 v_newPoint;",this.glslFilter(b,c),"void main() {"," setFragColor(vec4(filter(v_newPoint), 1));","}"];d.super.constructor.call(this,{fragmentShader:h,vertexShader:g,swapFrame:!0})}a.DynamicMovement=a.defineClass(b,a.Component,{componentName:"DynamicMovement",init:function(c,d,e){if(b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,e),!this.noGrid){for(var f=a.clamp(this.gridW,1,this.main.canvas.width),g=a.clamp(this.gridH,1,this.main.canvas.height),h=2*(f/this.main.canvas.width),i=2*(g/this.main.canvas.height),j=Math.ceil(this.main.canvas.width/f),k=Math.ceil(this.main.canvas.height/g),l=new Float32Array(2*6*j*k),m=0,n=-1,o=-1,p=0;k>p;p++){for(var q=0;j>q;q++){var r=Math.min(n+h,1),s=Math.min(o+i,1);l[m++]=n,l[m++]=o,l[m++]=r,l[m++]=o,l[m++]=n,l[m++]=s,l[m++]=r,l[m++]=o,l[m++]=r,l[m++]=s,l[m++]=n,l[m++]=s,n+=h}n=-1,o+=i}this.gridVertices=l,this.gridVerticesSize=m/2}},update:function(){var a=this.code;this.inited||(a.init(),this.inited=!0);var b=this.main.analyser.beat;a.b=b?1:0,a.perFrame(),b&&a.onBeat(),this.noGrid?this.program.run(this.parent.fm,null,this.code):this.program.run(this.parent.fm,null,this.code,this.gridVertices,this.gridVerticesSize)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}});var e={glslRectToPolar:function(a){return"POLAR"===a?["float ar = u_resolution.x/u_resolution.y;","x=x*ar;","d = distance(vec2(x, y), vec2(0,0))/sqrt(2.0);","r = mod(atan(y, x)+PI*0.5, 2.0*PI);"].join("\n"):""},glslPolarToRect:function(a){return"POLAR"===a?["d = d*sqrt(2.0);","x = d*sin(r)/ar;","y = -d*cos(r);"].join("\n"):""},glslFilter:function(a,b){return a&&!b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 cornoff = fract(coord/texel);"," vec2 corn = floor(coord/texel)*texel;"," vec3 tl = getSrcColorAtPos(corn).rgb;"," vec3 tr = getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb;"," vec3 bl = getSrcColorAtPos(corn + vec2(0, texel.y)).rgb;"," vec3 br = getSrcColorAtPos(corn + texel).rgb;"," vec3 pt = mix(tl, tr, cornoff.x);"," vec3 pb = mix(bl, br, cornoff.x);"," return mix(pt, pb, cornoff.y);","}"].join("\n"):a&&b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 corn = floor(coord/texel)*texel;"," ivec2 cornoff = (ivec2(fract(coord/texel)*255.0));"," ivec3 tl = ivec3(255.0 * getSrcColorAtPos(corn).rgb);"," ivec3 tr = ivec3(255.0 * getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb);"," ivec3 bl = ivec3(255.0 * getSrcColorAtPos(corn + vec2(0, texel.y)).rgb);"," ivec3 br = ivec3(255.0 * getSrcColorAtPos(corn + texel).rgb);"," #define bt(i, j) int((float(i)/255.0)*float(j))"," int a1 = bt(255-cornoff.x,255-cornoff.y);"," int a2 = bt(cornoff.x ,255-cornoff.y);"," int a3 = bt(255-cornoff.x,cornoff.y);"," int a4 = bt(cornoff.x ,cornoff.y);"," float r = float(bt(a1,tl.r) + bt(a2,tr.r) + bt(a3,bl.r) + bt(a4,br.r))/255.0;"," float g = float(bt(a1,tl.g) + bt(a2,tr.g) + bt(a3,bl.g) + bt(a4,br.g))/255.0;"," float b = float(bt(a1,tl.b) + bt(a2,tr.b) + bt(a3,bl.b) + bt(a4,br.b))/255.0;"," return vec3(r,g,b);","}"].join("\n"):["vec3 filter(vec2 point) {"," return getSrcColorAtPos((point+1.0)/2.0).rgb;","}"].join("\n")}};a.DMovProgramNG=a.defineClass(c,a.QuadBoxProgram,e,{draw:function(a){a.bindUniforms(this),c.super.draw.call(this)}}),a.DMovProgram=a.defineClass(d,a.ShaderProgram,e,{draw:function(a,b,c){a.bindUniforms(this),this.setVertexAttribArray("a_position",b,2,this.gl.FLOAT,!1,0,0),this.gl.drawArrays(this.gl.TRIANGLES,0,c)}}),b.ui={type:"DynamicMovement",disp:"Dynamic Movement",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPixel:{type:"string",title:"Per Point"}}},gridW:{type:"number",title:"Grid Width","default":16},gridH:{type:"number",title:"Grid Height","default":16},coord:{type:"string",title:"Coordinate System","enum":["POLAR","RECT"],"default":"POLAR"}},form:[{key:"code.init",type:"textarea"},{key:"code.onBeat",type:"textarea"},{key:"code.perFrame",type:"textarea"},{key:"code.perPixel",type:"textarea"},"gridW","gridH","coord"]}}(Webvs),function(a){function b(a){a=_.defaults(a,{bFilter:!0,coord:"POLAR",compat:!1}),b.super.constructor.call(this,{noGrid:!0,bFilter:a.bFilter,compat:a.compat,coord:a.coord,code:a.code}),this.options=a}a.Movement=a.defineClass(b,a.DynamicMovement)}(Webvs),function(a){function b(a){if(a=_.defaults(a,{channel:"RGB",onBeatRandom:!1}),this.channel=d.indexOf(a.channel),-1==this.channel)throw new Error("Invalid Channel");this.onBeatRandom=a.onBeatRandom,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["uniform int u_channel;","void main() {"," vec3 color = getSrcColor().rgb;",_.flatMap(d,function(a,b){return["if(u_channel == "+b+") {"," setFragColor(vec4(color."+a.toLowerCase()+",1));","}"]}).join("\n"),"}"]})}var d=["RGB","RBG","BRG","BGR","GBR","GRB"];a.ChannelShift=a.defineClass(b,a.Component,{componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.onBeatRandom&&this.main.analyser.beat&&(this.channel=Math.floor(Math.random()*d.length)),this.program.run(this.parent.fm,null,this.channel)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ChannelShiftProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_channel","1i",a),c.super.draw.call(this)}}),b.ui={disp:"Channel Shift",type:"ChannelShift",schema:{channel:{type:"string",title:"Channel","enum":d},onBeatRandom:{type:"boolean",title:"On beat random"}}}}(Webvs),function(a){function b(b){b=_.defaults(b,{color:"#ffffff",invert:!1,blendMode:"REPLACE"}),this.tone=a.parseColorNorm(b.color),this.invert=b.invert,this.program=new c(a.getBlendMode(b.blendMode))}function c(a){c.super.constructor.call(this,{outputBlendMode:a,swapFrame:!0,fragmentShader:["uniform vec3 u_tone;","uniform bool u_invert;","void main() {"," vec4 srcColor = getSrcColor();"," float depth = max(srcColor.r, max(srcColor.g, srcColor.b));"," if(u_invert) {"," depth = 1.0-depth;"," }"," setFragColor(vec4(depth*u_tone, 1));","}"]})}a.UniqueTone=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.tone,this.invert)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.UniqueToneProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b){this.setUniform.apply(this,["u_tone","3f"].concat(a)),this.setUniform("u_invert","1f",b?1:0),c.super.draw.call(this)}})}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code"]),d=_.defaults(d,{source:"SPECTRUM",drawMode:"LINES",colors:["#ffffff"]});var e;if(!_.isObject(d.code))throw new Error("Invalid superscope");e=d.code;var f=new a.ExprCodeGenerator(e,["n","v","i","x","y","b","red","green","blue"]),g=f.generateCode(["init","onBeat","perFrame","perPoint"],[],[]);this.code=g[0],this.code.n=100,this.spectrum="SPECTRUM"==d.source,this.dots="DOTS"==d.drawMode,this.colors=_.map(d.colors,a.parseColorNorm),this.currentColor=this.colors[0],this.maxStep=100,this.step=this.maxStep,this.colorId=0,this.colorStep=[0,0,0],this.thickness=d.thickness?d.thickness:1,this.inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_position;","attribute vec3 a_color;","varying vec3 v_color;","uniform float u_pointSize;","void main() {"," gl_PointSize = u_pointSize;"," setPosition(clamp(a_position, vec2(-1,-1), vec2(1,1)));"," v_color = a_color;","}"],fragmentShader:["varying vec3 v_color;","void main() {"," setFragColor(vec4(v_color, 1));","}"]})}a.SuperScope=a.defineClass(b,a.Component,{componentName:"SuperScope",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a),this.code.setup(c,this)},update:function(){this.gl;var a=this.code;this._stepColor(),a.red=this.currentColor[0],a.green=this.currentColor[1],a.blue=this.currentColor[2],this.inited||(a.init(),this.inited=!0);var b=this.main.analyser.beat;a.b=b?1:0,a.perFrame(),b&&a.onBeat();for(var c=Math.floor(a.n),d=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),e=d.length/c,f=0,g=0,h=new Float32Array(2*(this.dots?c:2*c-2)),i=new Float32Array(3*(this.dots?c:2*c-2)),j=0;c>j;j++){for(var k=0,l=0,m=Math.floor(j*e);(j+1)*e>m;m++,l++)k+=d[m];k/=l;var n=j/(c>1?c-1:1);a.i=n,a.v=k,a.perPoint(),h[f++]=a.x,h[f++]=-1*a.y,0===j||j==c-1||this.dots||(h[f++]=a.x,h[f++]=-1*a.y),this.dots?(i[g++]=a.red,i[g++]=a.green,i[g++]=a.blue):0!==j&&(i[g++]=a.red,i[g++]=a.green,i[g++]=a.blue,i[g++]=a.red,i[g++]=a.green,i[g++]=a.blue)}this.program.run(this.parent.fm,null,h,i,this.dots,this.thickness)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_stepColor:function(){var a;if(this.colors.length>1)if(this.step==this.maxStep){var b=this.colors[this.colorId];this.colorId=(this.colorId+1)%this.colors.length;var c=this.colors[this.colorId];for(a=0;3>a;a++)this.colorStep[a]=(c[a]-b[a])/this.maxStep;this.step=0,this.currentColor=b}else{for(a=0;3>a;a++)this.currentColor[a]+=this.colorStep[a];this.step++}}}),a.SuperScopeShader=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d){var e=this.gl;this.setUniform("u_pointSize","1f",d),this.setVertexAttribArray("a_position",a,2,e.FLOAT,!1,0,0),this.setVertexAttribArray("a_color",b,3,e.FLOAT,!1,0,0);var f;c||(f=e.getParameter(e.LINE_WIDTH),e.lineWidth(d)),e.drawArrays(c?e.POINTS:e.LINES,0,a.length/2),c||e.lineWidth(f)}}),b.ui={disp:"SuperScope",type:"SuperScope",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPoint:{type:"string",title:"Per Point"}}},source:{type:"string",title:"Source","default":"WAVEFORM","enum":["WAVEFORM","SPECTRUM"]},drawMode:{type:"string",title:"Draw Mode","default":"LINES","enum":["DOTS","LINES"]},colors:{type:"array",title:"Cycle Colors",items:{type:"string",format:"color","default":"#FFFFFF"}}}}}(Webvs),function(a){function b(a){a=_.defaults(a,{drawMode:"SOLID",source:"WAVEFORM",align:"CENTER",colors:["#ffffff"]});var c={};"SOLID"!=a.drawMode?(c.init="n=w;",c.perPoint={TOP:"x=i*2-1; y=-v/2-0.5;",CENTER:"x=i*2-1; y=-v/2;",BOTTOM:"x=i*2-1; y=v/2+0.5;"}[a.align]):(c.init="n=w*2;",c.perFrame="c=0;",c.perPoint="SPECTRUM"==a.source?{TOP:"x=i*2-1; y=if(c%2,0,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0.5,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0,v/2+0.5); c=c+1;"}[a.align]:{TOP:"x=i*2-1; y=if(c%2,-0.5,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0.5,v/2+0.5); c=c+1;"}[a.align]),b.super.constructor.call(this,{source:a.source,drawMode:"SOLID"==a.drawMode?"LINES":a.drawMode,colors:a.colors,code:c}),this.options=a}a.Simple=a.defineClass(b,a.SuperScope)}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code","imageSrc"]),d=_.defaults(d,{source:"SPECTRUM",resizing:!1,wrapAround:!1,colorFiltering:!0}),this.resizing=d.resizing,this.colorFiltering=d.colorFiltering,this.wrapAround=d.wrapAround,this.imageSrc=d.imageSrc;var e=new a.ExprCodeGenerator(d.code,["n","v","i","x","y","b","sizex","sizey","red","green","blue"]),f=e.generateCode(["init","onBeat","perFrame","perPoint"],[],[]);this.code=f[0],this.code.n=100,this.spectrum="SPECTRUM"==d.source,this._inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{vertexShader:["uniform bool u_colorFilter;","attribute vec2 a_texVertex;","attribute vec2 a_vertex;","attribute vec3 a_color;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," if(u_colorFilter) {"," v_color = a_color;"," }"," v_texVertex = a_texVertex;"," setPosition(a_vertex);","}"],fragmentShader:["uniform bool u_colorFilter;","uniform sampler2D u_image;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," vec3 outColor = texture2D(u_image, v_texVertex).rgb;"," if(u_colorFilter) {"," outColor = outColor*v_color;"," }"," setFragColor(vec4(outColor, 1));","}"]})}a.Texer=a.defineClass(b,a.Component,{componentName:"Texer",init:function(c,d,e){b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,this);var f=this,g=new Image;g.src=d.getResource(this.imageSrc);var h=new a.Promise;return g.onload=function(){f.imagewidth=g.width,f.imageHeight=g.height,f.texture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,f.texture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),h.resolve()},h},update:function(){function a(a,b,c,d,e,f,l){-1-c>a||a>1||-1-d>b||b>1||(g.push(a,b,a+c,b,a+c,b+d,a,b+d),h.push(0,0,1,0,1,1,0,1),j&&j.push(e,f,l,e,f,l,e,f,l,e,f,l),i.push(k+0,k+1,k+2,k+0,k+2,k+3),k+=4)}var b=this.code;this._inited||b.init();var c=this.main.analyser.beat;b.b=c?1:0,b.perFrame(),c&&b.onBeat();for(var d=Math.floor(b.n),e=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),f=e.length/d,g=[],h=[],i=[],j=this.colorFiltering?[]:null,k=0,l=2*(this.imagewidth/this.parent.fm.width),m=2*(this.imageHeight/this.parent.fm.height),n=0;d>n;n++){for(var o=0,p=0,q=Math.floor(n*f);(n+1)*f>q;q++,p++)o+=e[q];o/=p;var r=n/(d-1);b.i=r,b.v=o,b.sizex=1,b.sizey=1,b.red=1,b.green=1,b.blue=1,b.perPoint();var s=l,t=m;this.resizing&&(s*=b.sizex,t*=b.sizey);var u=b.x-s/2,v=-b.y-t/2;if(a(u,v,s,t,b.red,b.green,b.blue),this.wrapAround){var w=-1>u?2:u>1-s?-2:0,x=-1>v?2:v>1-t?-2:0;w&&a(w+u,v,s,t,b.red,b.green,b.blue),x&&a(u,x+v,s,t,b.red,b.green,b.blue),w&&x&&a(w+u,x+v,s,t,b.red,b.green,b.blue)}}this.program.run(this.parent.fm,null,new Float32Array(g),new Float32Array(h),new Uint16Array(i),j?new Float32Array(j):null,this.texture)},destroy:function(){b.super.destroy.call(this),this.gl.deleteTexture(this.texture),this.program.cleanup()}}),a.TexerProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_image","texture2D",e),this.setVertexAttribArray("a_vertex",a),this.setVertexAttribArray("a_texVertex",b),d?(this.setUniform("u_colorFilter","1f",1),this.setVertexAttribArray("a_color",d,3)):this.setUniform("u_colorFilter","1f",0),this.setElementArray(c),this.gl.drawElements(this.gl.TRIANGLES,c.length,this.gl.UNSIGNED_SHORT,0)}})}(Webvs),function(a){function b(c){c=_.defaults(c,{n:0,color:"#000000",blendMode:"REPLACE"}),this.n=c.n,this.color=a.parseColorNorm(c.color),this.outputBlendMode=a.blendModes[c.blendMode],this.prevBeat=!1,this.beatCount=0,this.program=new a.ClearScreenProgram(this.outputBlendMode),b.super.constructor.apply(this,arguments)}a.ClearScreen=a.defineClass(b,a.Component,{componentName:"ClearScreen",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){var a=!1;0===this.n?a=!0:(this.main.analyser.beat&&!this.prevBeat&&(this.beatCount++,this.beatCount==this.n&&(a=!0,this.beatCount=0)),this.prevBeat=this.main.analyser.beat),a&&this.program.run(this.parent.fm,null,this.color)},destroy:function(){this.program.cleanup()}}),b.ui={type:"ClearScreen",disp:"Clear Screen",schema:{n:{type:"number",title:"Clear on beat (0 = always clear)","default":0},color:{type:"string",title:"Clear color",format:"color","default":"#000000"},blendMode:{type:"string",title:"Blend Mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["src","x","y"]),this.x=c.x,this.y=c.y,this.src=c.src,this.program=new a.PictureProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_texVertex;","uniform vec2 u_pos;","uniform vec2 u_texRes;","varying vec2 v_texCoord;","void main() {"," v_texCoord = a_texVertex;"," setPosition(a_texVertex*(u_texRes/u_resolution)*vec2(2,-2)+u_pos);","}"],fragmentShader:["uniform sampler2D u_image;","varying vec2 v_texCoord;","void main() {"," setFragColor(texture2D(u_image, v_texCoord));","}"]})}a.Picture=a.defineClass(b,a.Component,{init:function(c,d,e){b.super.init.call(this,c,d,e),this.program.init(c);var f=this,g=new Image;g.src=d.getResource(this.src);var h=new a.Promise;return g.onload=function(){f.width=g.width,f.height=g.height,f.texture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,f.texture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),h.resolve()},h},update:function(){this.program.run(this.parent.fm,null,this.x,this.y,this.texture,this.width,this.height)},destroy:function(){this.program.cleanup(),this.gl.deleteTexture(this.texture)}}),a.PictureProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_pos","2f",a,-b),this.setUniform("u_texRes","2f",d,e),this.setUniform("u_image","texture2D",c),this.setVertexAttribArray("a_texVertex",new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}})}(Webvs); \ No newline at end of file +!function(a){var b={};a.Webvs=b,b.defineClass=function(a,b){return a.prototype=Object.create(b.prototype),a.prototype.constructor=a,a.super=b.prototype,_.chain(arguments).drop(2).each(function(b){_.extend(a.prototype,b)}),a},b.noop=function(){},b.checkRequiredOptions=function(a,b){for(var c in b){var d=b[c];if(!(d in a))throw new Error("Required option "+d+" not found")}},b.glslFloatRepr=function(a){return a+(0===a%1?".0":"")},b.parseColor=function(a){if(_.isArray(a)&&3==a.length)return a;if(_.isString(a)){var b;if(a=a.toLowerCase(),b=a.match(/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/))return _.chain(b).last(3).map(function(a){return parseInt(a,16)}).value();if(b=a.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/))return _.chain(b).last(3).map(function(a){return Math.min(parseInt(a,10),255)}).value()}throw new Error("Invalid Color Format")},b.parseColorNorm=function(a){return _.map(b.parseColor(a),function(a){return a/255})},b.logShaderError=function(a,b){var c=a.split("\n"),d=c.length.toString().length,e=b.match(/(\d+):(\d+)/);e&&(e=[parseInt(e[1],10),parseInt(e[2],10)]);var f=_.map(c,function(a,c){var f,g=c+1+"";for(f=0;fd;d++)c.push(b.charAt(Math.floor(Math.random()*b.length)));return c.join("")},b.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)},b.getComponentClass=function(a){var c=b[a];if(!c)throw new Error("Unknown Component class "+a);return c}}(window),function(a){a.Resources={"avsres_texer_circle_edgeonly_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAMAAABFjsb+AA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NjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMTAtMDZUMjI6MDc6NDYrMDY6MDA+xvzGAAAAAElFTkSuQmCC","avsres_texer_circle_sharp_09x09.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAMAAACecocUAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAOVBMVEUAAAACAgJhYWG+vr7b29tiYmKoqKj+/v7///9jY2PBwcHf39/CwsJlZWUDAwOsrKxmZmbDw8Pg4ODJk53hAAAAAWJLR0QIht6VegAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAElJREFUCNdVzUsSwCAIA1CtVakfUO9/WINlY1YvM0xw7op/whuiP0yZiHLSEpUoH1zoT4GrucLN3OBu9x1mOTvCOspjrjn4froBkegClm06guAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTA2LTI5VDE5OjA5OjMyKzA2OjAw50C8rwAAAABJRU5ErkJggg==","avsres_texer_circle_sharp_19x19.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAe1BMVEUAAAAFBQVBQUGGhoaurq68vLyvr68GBgYBAQFNTU3Ozs78/Pz+/v7///+Kior6+vr9/f2Li4vR0dFCQkJDQ0OIiIiJiYmzs7PBwcG0tLRERETT09NRUVH7+/uQkJCRkZFTU1PU1NRUVFQHBwdHR0eMjIy1tbXDw8NISEjxdmZoAAAAAWJLR0QN9rRh9QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAJ5JREFUGNN9ke0SgiAUBUUrQbhA9qGpWGZa7/+EgZoCNu7PnTPALEGwAQqj3f4QhbHlMEkoAwBGE4LnIRfwQ3A0LbmEBXkc10SAjSBGxim4pObKE/UsPWt7YZ5lV20z8Mm0zVc2/7u9actX53JtC+lZWZj3lp4th0SVcqSqxg6106GeqqF6Wav7nBg/Gjn0lc0TW93bV9e/++7Tbn3YF1ESEZb9e6HrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0wNC0yOVQwMTo0OTozMCswNTowMPYYqoAAAAAASUVORK5CYII=","avsres_texer_circle_slightblur_13x13.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAASFBMVEUAAAABAQEODg4jIyMtLS0EBARsbGyZmZmoqKiKiorT09Py8vL4+Pj7+/v+/v7///8kJCRtbW3U1NSLi4uampqpqakPDw8uLi7NF0qwAAAAAWJLR0QPGLoA2QAAAAlwSFlzAAALEgAACxIB0t1+/AAAAGhJREFUCNdljkcOwCAMBCmmF9NC/v/TGJBySHwbjXbXjH2PCwlS8AMKtLFGg9oGnA8xeAfLCu1Txpy8FkTShIyIORhJBDbiumiBqLyurFxtO9d2jkNv1Nn67qS9Oq5Rzx7ZWe4y+e/HB1hhBEsscYLrAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wNlQyMTozODowMCswNTowMB7KOaoAAAAASUVORK5CYII=","avsres_texer_circle_slightblur_21x21.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6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EI2ygh4BK1BltAKjECREVxAIQSH4MTvSfpvKhpQe8/J8efY0vNu979+Y90dzXr2/b6Y9eH7g+1l73pwfXb94PqL68n1k7t8l8ub7YPv75JXAT3PA0PVLfBQdQtMVTfAiueAQ92z5DngY90NMDR6lDwLTI2+ATZ4Bji0epY8A2zxtsCp2aPkbYGp2U+StwEO7Z4lbwNs867AqdNX4FOnv0peKYvkXYBjr2fJuwB7vBU4dXuUvBWYun2RvB/g2O9Z8r6Ae8k7AyfRo+SdgUn0RfK+gaPqubUzWmBQvXCn36frIx/dH7y/k+jxhv+Xng96vuj5pOcb348+MN70ftL7TfsD7S+0P+H+1gOu+yPtr7Q/0/5O5wOdL3g+tYHX843ORzpf6Xym853mA5wvguTxfEPzEc1XNJ/RfIfzYQ2cTaf5lOZbmo9pvqb5HOd7D5xdp+8L+j6h75u/uj4BxUT7mSYYfpEAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTA0LTExVDAwOjM0OjU4KzA1OjAwAHKiyQAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_24x24.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABJJREFUCNdjYEAC8v9/UAUjAQD7uCWNIgeQwQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMTAtMDZUMjE6NTc6NDYrMDU6MDDg7pOkAAAAAElFTkSuQmCC","avsres_texer_square_edgeonly_28x28.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcAQMAAABIw03XAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABNJREFUCNdjYEAF8v//N9CPQAUArWA5f2D2DX0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDAzLTEwLTA2VDIxOjU4OjQ0KzA1OjAwhnrZAAAAAABJRU5ErkJggg==","avsres_texer_square_edgeonly_30x30.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeAQMAAAAB/jzhAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX///8AAABVwtN+AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABRJREFUCNdjYEAF8v//PxgIAhUAAOmGR7lQ6SOhAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwMy0xMC0wNlQyMTo1OToxOCswNTowMOb41i4AAAAASUVORK5CYII=","avsres_texer_square_sharp_20x20.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAQMAAADaua+7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABJJREFUCNdjYIAC+/9/qIqhAABLlCyJ9A7ihwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDMtMDYtMjlUMTk6Mzg6MDQrMDU6MDBuiiynAAAAAElFTkSuQmCC","avsres_texer_square_sharp_32x32.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABVJREFUCNdjYMAB+P////9hCJM4AACQJX+BjmWyDAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDktMTAtMDhUMDE6NTM6NTYrMDU6MDBzUO7GAAAAAElFTkSuQmCC","avsres_texer_square_sharp_48x48.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4AQMAAACSSKldAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABZJREFUGNNjYCAA+P+DwIdReoBoAgAAldYe8LB8aUoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMTAtMjNUMTg6MDk6NDErMDY6MDDn3a6/AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDA5LTEwLTA4VDAxOjUzOjI4KzA1OjAwKaqcggAAAABJRU5ErkJggg==","avsres_texer_square_sharp_60x60.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABEAQMAAAAC3QHxAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAABdJREFUKM9jYCAS8P+HgFHWKIuaLCIBAH8IpfBELmrmAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMTo1NDozMiswNTowMKOs2CsAAAAASUVORK5CYII=","avsres_texer_square_sharp_64x64.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQAQMAAAC032DuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABdJREFUKM9jYKAV+A8Fo8xR5lBk0gYAAMbE/hBbX3sVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODowMCswNjowML8mns0AAAAASUVORK5CYII=","avsres_texer_square_sharp_72x72.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUAQMAAAAmpYKCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABpJREFUKM9jYKASYP4PBX9G2aPsUTa12VQCABpBhZc9Qe3KAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjowMjoxNiswNjowMMbw5GAAAAAASUVORK5CYII=","avsres_texer_square_sharp_96x96.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwAQMAAAD8LmYIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAB1JREFUOMtjYBgo8B8JjHJHuaPcUe4od/BwBwYAAB86e71LirdOAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTEwLTIzVDE4OjA5OjQxKzA2OjAw592uvwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAwOS0xMC0wOFQwMjoxODo0NiswNjowMFi8pQ0AAAAASUVORK5CYII=","avsres_texer_square_sharp_250x250.bmp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQoAAAEKAQMAAADQBYmKAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAD///+l2Z/dAAAAAWJLR0QB/wIt3gAAAAlwSFlzAAALEgAACxIB0t1+/AAAADlJREFUaN7tykENAAAIBCD7p7KZFrgZwMGbKrK5taIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoivKpkCyUd+T92W3T7QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMy0xMC0yM1QxODowOTo0MSswNjowMOfdrr8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTEtMDEtMDVUMTg6NTk6NTQrMDU6MDBwiLErAAAAAElFTkSuQmCC"}}(Webvs),function(a){function b(){}a.AnalyserAdapter=a.defineClass(b,Object,{beat:!1,isPlaying:function(){return!1},getWaveform:function(){return new Float32Array(0)},getSpectrum:function(){return new Float32Array(0)}})}(Webvs),function(a){function b(a){this.dancer=a,this.beat=!1;var b=this;this.kick=a.createKick({onKick:function(){b.beat=!0},offKick:function(){b.beat=!1}}),this.kick.on()}a.DancerAdapter=a.defineClass(b,a.AnalyserAdapter,{isPlaying:function(){return this.dancer.isPlaying()},getWaveform:function(){return this.dancer.getWaveform()},getSpectrum:function(){return this.dancer.getSpectrum()}})}(Webvs),function(a){function b(b){if(a.checkRequiredOptions(b,["canvas","analyser"]),b=_.defaults(b,{showStat:!1}),this.canvas=b.canvas,this.analyser=b.analyser,this.isStarted=!1,b.showStat){var c=new Stats;c.setMode(0),c.domElement.style.position="absolute",c.domElement.style.right="5px",c.domElement.style.bottom="5px",document.body.appendChild(c.domElement),this.stats=c}this.resources={},this.rootComponent=new a.EffectList({id:"root"}),this._registerContextEvents(),this._initGl()}a.Main=a.defineClass(b,Object,{_registerContextEvents:function(){var a=this;this.canvas.addEventListener("webglcontextlost",function(b){b.preventDefault(),a.stop()}),this.canvas.addEventListener("webglcontextrestored",function(){a.resetCanvas()})},_initGl:function(){try{this.gl=this.canvas.getContext("experimental-webgl",{alpha:!1}),this.copier=new a.CopyProgram({dynamicBlend:!0}),this.copier.init(this.gl),this.resolution={width:this.canvas.width,height:this.canvas.height}}catch(b){throw new Error("Couldnt get webgl context"+b)}},loadPreset:function(b){b=_.clone(b),b.id="root";var c=new a.EffectList(b);this.stop(),this.rootComponent.destroy(),this.rootComponent=c,this.resources=b.resources||{}},resetCanvas:function(){this.stop();var b=this.rootComponent.getOptions();this.rootComponent.destroy(),this.copier.cleanup(),this._initGl(),this.rootComponent=new a.EffectList(b)},start:function(){if(!this.isStarted){var a=this,b=function(){a.analyser.isPlaying()&&a.rootComponent.update(),a.animReqId=requestAnimationFrame(b)};if(this.stats){var c=b;b=function(){a.stats.begin(),c.call(this,arguments),a.stats.end()}}this.rootComponent.componentInited||(this.registerBank={},this.bootTime=(new Date).getTime(),this.rootComponent.init(this.gl,this)),this.animReqId=requestAnimationFrame(b),this.isStarted=!0}},stop:function(){_.isUndefined(this.animReqId)||(cancelAnimationFrame(this.animReqId),this.isStarted=!1)},getPreset:function(){var a=this.rootComponent.getOptions();return a.resources=this.resources,a},addComponent:function(a,b,c){return b=_.clone(b),this.rootComponent.addComponent(a,b,c),res},updateComponent:function(b,c){if(c=_.clone(c),c.id=b,"root"==b){var d=this.rootComponent.detachAllComponents();return c=_.defaults(c,this.rootComponent.options),this.rootComponent.destroy(),this.rootComponent=new a.EffectList(c,d),this.rootComponent.init(this.gl,this),!0}return this.rootComponent.updateComponent(b,c)},removeComponent:function(a){var b=this.rootComponent.detachComponent(a);return b?(b.destroy(),!0):!1},moveComponent:function(a,b,c){var d=this.rootComponent.detachComponent(a);return d?this.rootComponent.addComponent(b,d,c):!1},getResource:function(b){var c;return c=this.resources[b],c||(c=a.Resources[b]),c||(c=b),c},setResource:function(a,b){this.resources[a]=b},traverse:function(a){this.rootComponent.traverse(a)}}),b.ui={leaf:!1,disp:"Main",schema:{name:{type:"string",title:"Name"},author:{type:"string",title:"Author"},description:{type:"string",title:"Description"},clearFrame:{type:"boolean",title:"Clear every frame","default":!1,required:!0}}}}(Webvs),function(a){function b(a){this.id=a.id,this.enabled=_.isUndefined(a.enabled)?!0:a.enabled,this.componentInited=!1,this.options=a}a.Component=a.defineClass(b,Object,{componentName:"Component",init:function(a,b,c){this.gl=a,this.main=b,this.parent=c,this.componentInited=!0},adoptOrInit:function(a,b,c){return this.componentInited?this.adopt(c):this.init(a,b,c)},adopt:function(a){this.parent=a},update:function(){},destroy:function(){},getOptions:function(){return this.options},getPath:function(){return _.isUndefined(this.parent)||_.isUndefined(this.id)?this.componentName+"#Main":this.parent.getIdString()+"/"+this.componentName+"#"+this.id}})}(Webvs),function(a){function b(a,c){b.super.constructor.call(this,a),this.components=[],_.each(c||a.components||[],function(a){this.addComponent(this.id,a)},this)}a.Container=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d);for(var e=0;e0&&this._frameCounter--,0!==this._frameCounter))&&(this.code.beat=this.main.analyser.beat?1:0,this.code.enabled=1,this.code.clear=this.clearFrame,this._inited||(this._inited=!0,this.code.init()),this.code.perFrame(),0!==this.code.enabled)){if(this.fm.setRenderTarget(),(this.clearFrame||this.first||this.code.clear)&&(a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT),this.first=!1),-1!==this.input){var c=this.parent.fm.getCurrentTexture();this.main.copier.run(this.fm,this.input,c)}for(var d=0;de;e++){var f=b.charAt(e);"\n"===f?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1)}a.offset+=c}function f(a){F.offsetH.offset&&(H=d(F),I=[]),I.push(a))}function g(){var a="program@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,i,j,k,l,m,n,o,p,q,r;if(p=d(F),q=d(F),g=x(),null!==g)if(i=h(),null!==i)if(j=x(),null!==j){for(k=[],r=d(F),59===b.charCodeAt(F.offset)?(l=";",e(F,1)):(l=null,0===G&&f('";"')),null!==l?(m=x(),null!==m?(n=h(),null!==n?(o=x(),null!==o?l=[l,m,n,o]:(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r));null!==l;)k.push(l),r=d(F),59===b.charCodeAt(F.offset)?(l=";",e(F,1)):(l=null,0===G&&f('";"')),null!==l?(m=x(),null!==m?(n=h(),null!==n?(o=x(),null!==o?l=[l,m,n,o]:(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r))):(l=null,F=d(r));null!==k?(59===b.charCodeAt(F.offset)?(l=";",e(F,1)):(l=null,0===G&&f('";"')),l=null!==l?l:"",null!==l?(m=x(),null!==m?g=[g,i,j,k,l,m]:(g=null,F=d(q))):(g=null,F=d(q))):(g=null,F=d(q))}else g=null,F=d(q);else g=null,F=d(q);else g=null,F=d(q);return null!==g&&(g=function(a,b,c,d){var e=[d[1]];return e=e.concat(_.map(d[3],function(a){return a[2]})),new Webvs.AstProgram(e)}(p.offset,p.line,p.column,g)),null===g&&(F=d(p)),J[a]={nextPos:d(F),result:g},g}function h(){var a="statement@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n;return l=d(F),n=d(F),g=s(),null!==g?(h=x(),null!==h?(61===b.charCodeAt(F.offset)?(i="=",e(F,1)):(i=null,0===G&&f('"="')),null!==i?(j=x(),null!==j?(k=m(),null!==k?g=[g,h,i,j,k]:(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d,e){return new Webvs.AstAssignment(d,e)}(l.offset,l.line,l.column,g[0],g[4])),null===g&&(F=d(l)),null===g&&(g=m()),J[a]={nextPos:d(F),result:g},g}function i(){var a="unary_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function j(){var a="additive_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 43===b.charCodeAt(F.offset)?(g="+",e(F,1)):(g=null,0===G&&f('"+"')),null===g&&(45===b.charCodeAt(F.offset)?(g="-",e(F,1)):(g=null,0===G&&f('"-"'))),J[a]={nextPos:d(F),result:g},g}function k(){var a="multiplicative_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 42===b.charCodeAt(F.offset)?(g="*",e(F,1)):(g=null,0===G&&f('"*"')),null===g&&(47===b.charCodeAt(F.offset)?(g="/",e(F,1)):(g=null,0===G&&f('"/"')),null===g&&(37===b.charCodeAt(F.offset)?(g="%",e(F,1)):(g=null,0===G&&f('"%"')))),J[a]={nextPos:d(F),result:g},g}function l(){var a="boolean_ops@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return 38===b.charCodeAt(F.offset)?(g="&",e(F,1)):(g=null,0===G&&f('"&"')),null===g&&(124===b.charCodeAt(F.offset)?(g="|",e(F,1)):(g=null,0===G&&f('"|"'))),J[a]={nextPos:d(F),result:g},g}function m(){var a="boolean_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,k,m;if(j=d(F),k=d(F),c=n(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=l(),null!==g?(h=x(),null!==h?(i=n(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(k))}else c=null,F=d(k);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function n(){var a="additive_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,k,l,m;if(k=d(F),l=d(F),c=o(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=j(),null!==g?(h=x(),null!==h?(i=o(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(k.offset,k.line,k.column,c[0],c[1])),null===c&&(F=d(k)),J[a]={nextPos:d(F),result:c},c}function o(){var a="multiplicative_expr@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h,i,j,l,m;if(j=d(F),l=d(F),c=p(),null!==c){for(e=[],m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==f;)e.push(f),m=d(F),f=x(),null!==f?(g=k(),null!==g?(h=x(),null!==h?(i=p(),null!==i?f=[f,g,h,i]:(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m))):(f=null,F=d(m));null!==e?c=[c,e]:(c=null,F=d(l))}else c=null,F=d(l);return null!==c&&(c=function(a,b,c,d,e){return C(d,e)}(j.offset,j.line,j.column,c[0],c[1])),null===c&&(F=d(j)),J[a]={nextPos:d(F),result:c},c}function p(){var a="unary@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e,f,g,h;return g=d(F),h=d(F),c=i(),null!==c?(e=x(),null!==e?(f=q(),null!==f?c=[c,e,f]:(c=null,F=d(h))):(c=null,F=d(h))):(c=null,F=d(h)),null!==c&&(c=function(a,b,c,d,e){return new Webvs.AstUnaryExpr(d,e)}(g.offset,g.line,g.column,c[0],c[2])),null===c&&(F=d(g)),null===c&&(c=q()),J[a]={nextPos:d(F),result:c},c}function q(){var a="func_call@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,n,o,p,q,s,t;if(p=d(F),q=d(F),s=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(s))}else g=null,F=d(s);if(null!==g)if(h=x(),null!==h)if(40===b.charCodeAt(F.offset)?(i="(",e(F,1)):(i=null,0===G&&f('"("')),null!==i){for(s=d(F),j=[],t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==k;)j.push(k),t=d(F),k=x(),null!==k?(l=m(),null!==l?(n=x(),null!==n?(44===b.charCodeAt(F.offset)?(o=",",e(F,1)):(o=null,0===G&&f('","')),null!==o?k=[k,l,n,o]:(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t))):(k=null,F=d(t));null!==j?(k=x(),null!==k?(l=m(),null!==l?j=[j,k,l]:(j=null,F=d(s))):(j=null,F=d(s))):(j=null,F=d(s)),j=null!==j?j:"",null!==j?(k=x(),null!==k?(41===b.charCodeAt(F.offset)?(l=")",e(F,1)):(l=null,0===G&&f('")"')),null!==l?g=[g,h,i,j,k,l]:(g=null,F=d(q))):(g=null,F=d(q))):(g=null,F=d(q))}else g=null,F=d(q);else g=null,F=d(q);else g=null,F=d(q);return null!==g&&(g=function(a,b,c,d,e){var f=[];return _.each(e[0],function(a){f.push(a[1])}),f.push(e[2]),new Webvs.AstFuncCall(D(d),f)}(p.offset,p.line,p.column,g[0],g[3])),null===g&&(F=d(p)),null===g&&(g=r()),J[a]={nextPos:d(F),result:g},g}function r(){var a="primary_expr@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;return g=w(),null===g&&(g=u(),null===g&&(g=v(),null===g&&(g=t(),null===g&&(j=d(F),k=d(F),40===b.charCodeAt(F.offset)?(g="(",e(F,1)):(g=null,0===G&&f('"("')),null!==g?(h=m(),null!==h?(41===b.charCodeAt(F.offset)?(i=")",e(F,1)):(i=null,0===G&&f('")"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))):(g=null,F=d(k)),null!==g&&(g=function(a,b,c,d){return d}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)))))),J[a]={nextPos:d(F),result:g},g}function s(){var a="assignable@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c;return c=v(),null===c&&(c=t()),J[a]={nextPos:d(F),result:c},c}function t(){var a="identifier@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),/^[a-zA-Z_]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[a-zA-Z_]")),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"ID")}(j.offset,j.line,j.column,g)),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function u(){var a="constant@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k;if(j=d(F),k=d(F),36===b.charCodeAt(F.offset)?(g="$",e(F,1)):(g=null,0===G&&f('"$"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(D(d).toLowerCase(),"CONST")}(j.offset,j.line,j.column,g[1])),null===g&&(F=d(j)),J[a]={nextPos:d(F),result:g},g}function v(){var a="register@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(l=d(F),m=d(F),64===b.charCodeAt(F.offset)?(g="@",e(F,1)):(g=null,0===G&&f('"@"')),null!==g){for(h=[],/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==i;)h.push(i),/^[a-zA-Z_0-9]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[a-zA-Z_0-9]"));null!==h?g=[g,h]:(g=null,F=d(m))}else g=null,F=d(m);return null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_AT_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g[1])),null===g&&(F=d(l)),null===g&&(l=d(F),m=d(F),/^[rR]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[rR]")),null!==g?(/^[eE]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[eE]")),null!==h?(/^[gG]/.test(b.charAt(F.offset))?(i=b.charAt(F.offset),e(F,1)):(i=null,0===G&&f("[gG]")),null!==i?(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j?(/^[0-9]/.test(b.charAt(F.offset))?(k=b.charAt(F.offset),e(F,1)):(k=null,0===G&&f("[0-9]")),null!==k?g=[g,h,i,j,k]:(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m))):(g=null,F=d(m)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr("__REG_"+D(d).toLowerCase(),"REG")}(l.offset,l.line,l.column,g)),null===g&&(F=d(l))),J[a]={nextPos:d(F),result:g},g}function w(){var a="value@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m,n,o;for(m=d(F),n=d(F),g=[],/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));if(null!==g)if(46===b.charCodeAt(F.offset)?(h=".",e(F,1)):(h=null,0===G&&f('"."')),null!==h){if(/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]")),null!==j)for(i=[];null!==j;)i.push(j),/^[0-9]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[0-9]"));else i=null;if(null!==i){if(o=d(F),/^[Ee]/.test(b.charAt(F.offset))?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("[Ee]")),null!==j){if(/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]")),null!==l)for(k=[];null!==l;)k.push(l),/^[0-9]/.test(b.charAt(F.offset))?(l=b.charAt(F.offset),e(F,1)):(l=null,0===G&&f("[0-9]"));else k=null;null!==k?j=[j,k]:(j=null,F=d(o))}else j=null,F=d(o);j=null!==j?j:"",null!==j?g=[g,h,i,j]:(g=null,F=d(n))}else g=null,F=d(n)}else g=null,F=d(n);else g=null,F=d(n);if(null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseFloat(D(d)),"VALUE")}(m.offset,m.line,m.column,g)),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[a-fA-F0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[a-fA-F0-9]"));else g=null;if(null!==g?(/^[hH]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[hH]")),null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),16),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m)),null===g){if(m=d(F),n=d(F),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]")),null!==h)for(g=[];null!==h;)g.push(h),/^[0-9]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[0-9]"));else g=null;null!==g?(/^[dD]/.test(b.charAt(F.offset))?(h=b.charAt(F.offset),e(F,1)):(h=null,0===G&&f("[dD]")),h=null!==h?h:"",null!==h?g=[g,h]:(g=null,F=d(n))):(g=null,F=d(n)),null!==g&&(g=function(a,b,c,d){return new Webvs.AstPrimaryExpr(parseInt(D(d),10),"VALUE")}(m.offset,m.line,m.column,g[0])),null===g&&(F=d(m))}}return J[a]={nextPos:d(F),result:g},g}function x(){var a="__@"+F.offset,b=J[a];if(b)return F=d(b.nextPos),b.result;var c,e;for(c=[],e=y(),null===e&&(e=z(),null===e&&(e=A()));null!==e;)c.push(e),e=y(),null===e&&(e=z(),null===e&&(e=A()));return J[a]={nextPos:d(F),result:c},c}function y(){var a="whiteSpace@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\t\x0B\f \xA0\uFEFF]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\t\\x0B\\f \\xA0\\uFEFF]")),J[a]={nextPos:d(F),result:g},g}function z(){var a="lineEnd@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g;return/^[\n\r\u2028\u2029]/.test(b.charAt(F.offset))?(g=b.charAt(F.offset),e(F,1)):(g=null,0===G&&f("[\\n\\r\\u2028\\u2029]")),J[a]={nextPos:d(F),result:g},g}function A(){var a="comment@"+F.offset,c=J[a];if(c)return F=d(c.nextPos),c.result;var g,h,i,j,k,l,m;if(k=d(F),"/*"===b.substr(F.offset,2)?(g="/*",e(F,2)):(g=null,0===G&&f('"/*"')),null!==g){for(h=[],l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,"*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?("*/"===b.substr(F.offset,2)?(i="*/",e(F,2)):(i=null,0===G&&f('"*/"')),null!==i?g=[g,h,i]:(g=null,F=d(k))):(g=null,F=d(k))}else g=null,F=d(k);if(null===g)if(k=d(F),"//"===b.substr(F.offset,2)?(g="//",e(F,2)):(g=null,0===G&&f('"//"')),null!==g){for(h=[],l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==i;)h.push(i),l=d(F),m=d(F),G++,i=z(),G--,null===i?i="":(i=null,F=d(m)),null!==i?(b.length>F.offset?(j=b.charAt(F.offset),e(F,1)):(j=null,0===G&&f("any character")),null!==j?i=[i,j]:(i=null,F=d(l))):(i=null,F=d(l));null!==h?g=[g,h]:(g=null,F=d(k))}else g=null,F=d(k);return J[a]={nextPos:d(F),result:g},g}function B(a){a.sort();for(var b=null,c=[],d=0;dH.offset?F:H;throw new this.SyntaxError(B(I),M,L,N.line,N.column)}return K},toSource:function(){return this._source}};return b.SyntaxError=function(b,c,d,e,f){function g(b,c){var d,e;switch(b.length){case 0:d="end of input";break;case 1:d=b[0];break;default:d=b.slice(0,b.length-1).join(", ")+" or "+b[b.length-1]}return e=c?a(c):"end of input","Expected "+d+" but "+e+" found."}this.name="SyntaxError",this.expected=b,this.found=c,this.message=g(b,c),this.offset=d,this.line=e,this.column=f},b.SyntaxError.prototype=Error.prototype,b}(),function(a){function b(){}a.CodeInstance=a.defineClass(b,Object,{rand:function(a){return Math.floor(Math.random()*a)+1},gettime:function(a){switch(a){case 0:var b=(new Date).getTime();return(b-this._bootTime)/1e3;default:throw new Error("Invalid startTime mode for gettime call")}},getosc:function(a,b){for(var c=this._analyser.getWaveform(),d=Math.floor((a-b/2)*(c.length-1)),e=Math.floor((a+b/2)*(c.length-1)),f=0,g=d;e>=g;g++)f+=c[g];return f/(e-d+1)},bindUniforms:function(a){var b=this,c=_.difference(_.keys(this),this._treatAsNonUniform);if(_.each(c,function(c){var d=b[c];"number"==typeof d&&a.setUniform(c,"1f",d)}),_.each(this._registerUsages,function(b){a.setUniform(b,"1f",this._registerBank[b])}),this.hasRandom){var d=[Math.random()/100,Math.random()/100];a.setUniform("__randStep","2fv",d)}if(this.hasGettime){var e=((new Date).getTime()-this._bootTime)/1e3;a.setUniform("__gettime0","1f",e)}_.each(this._preCompute,function(b){var c=_.map(_.last(b,b.length-2),function(a){return _.isString(a)?"__REG"==a.substring(0,5)?this._registerBank[a]:this[a]:a}),d=this[b[0]].apply(this,c);a.setUniform(b[1],"1f",d)})},setup:function(a){this._registerBank=a.registerBank,this._bootTime=a.bootTime,this._analyser=a.analyser,this.w=a.canvas.width,this.h=a.canvas.height,_.each(this._registerUsages,function(b){_.has(a.registerBank,b)||(a.registerBank[b]=0)})}}),b.clone=function(a,b){a.cid=0;var c=[a];return b>1&&_.times(b-1,function(b){var d=_.clone(a);d.cid=b+1,c.push(d)}),c}}(Webvs),function(a){function b(a,b){this.codeSrc={};for(var c in a){var d=a[c];_.isArray(d)&&(d=d.join("\n")),d=d.trim(),""!==d&&(this.codeSrc[c]=d)}this.externalVars=_.union(b||[],["w","h","cid"]),this._parseSrc()}a.ExprCodeGenerator=a.defineClass(b,Object,{_parseSrc:function(){var b={},c=[],d={},e=[];for(var f in this.codeSrc)try{var g=this.codeSrc[f];b[f]=a.PegExprParser.parse(g);var h=[];this._getVars(b[f],c,h,e),d[f]=h}catch(i){throw new Error("Error parsing "+f+"("+i.line+":"+i.column+")"+" : "+i)}this.codeAst=b,this.funcUsages=d,this.instanceVars=_.uniq(this.externalVars.concat(c)),this.registerUsages=_.uniq(e)},generateJs:function(b){var c=new a.CodeInstance;_.each(this.instanceVars,function(a){c[a]=0});var d=_.intersection(_.keys(this.codeAst),b),e=_.difference(b,d);return _.each(d,function(a){var b=this.codeAst[a],d=this._generateJs(b);c[a]=new Function(d)},this),_.each(e,function(b){c[b]=a.noop}),c._registerUsages=this.registerUsages,c},generateGlsl:function(a,b,c){var d=[];b=b||[],_.each(this.instanceVars,function(a){var c="";_.contains(b,a)||(c="uniform "),d.push(c+"float "+a+";")});var e=_.intersection(_.keys(this.codeAst),a),f=_.difference(a,e),g=_.uniq(_.flatMap(e,function(a){return this.funcUsages[a]},this));_.each(g,function(a){var b=this.glslFuncCode[a];b&&d.push(b)},this);var h=[],i=[];return _.each(e,function(a){var b=this.codeAst[a],c=this._generateGlsl(b,h);i.push("void "+a+"() {"),i.push(c),i.push("}")},this),d=d.concat(_.map(h,function(a){return"uniform float "+a[1]+";"})),d=d.concat(i),_.each(f,function(a){d.push("void "+a+"() {}")}),c._preCompute=h,_.contains(e,"rand")&&(c.hasRandom=!0),_.contains(e,"gettime")&&(c.hasGettime=!0),c._treatAsNonUniform=b,d.join("\n")},funcArgLengths:{above:2,below:2,equal:2,pow:2,sqr:1,sqrt:1,invsqrt:1,floor:1,ceil:1,abs:1,"if":3,min:2,max:2,sin:1,cos:1,tan:1,asin:1,acos:1,atan:1,atan2:2,log:1,band:2,bor:2,bnot:1,rand:1,gettime:1,getosc:3,select:{min:2}},jsMathFuncs:["min","max","sin","cos","abs","tan","asin","acos","atan","log","pow","sqrt","floor","ceil"],glslFuncCode:{rand:["uniform vec2 __randStep;","vec2 __randSeed;","float rand(float max) {"," __randCur += __randStep;"," float val = fract(sin(dot(__randSeed.xy ,vec2(12.9898,78.233))) * 43758.5453);"," return (floor(val*max)+1);","}"].join("\n"),gettime:["uniform float __gettime0;","int gettime(int startTime) {"," int time = 0;"," if(startTime == 0) {"," time = __gettime0;"," }"," return time;","}"].join("\n")},_checkFunc:function(a){var b=this.funcArgLengths[a.funcName];if(void 0===b)throw Error("Unknown function "+a.funcName);if(_.isNumber(b)){if(a.args.length!=b)throw Error(a.funcName+" accepts "+b+" arguments")}else if(b.min&&a.args.length",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"below":return["(",this._generateGlsl(b.args[0],c),"<",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"equal":return["(",this._generateGlsl(b.args[0],c),"==",this._generateGlsl(b.args[1],c),"?1.0:0.0)"].join("");case"if":return["(",this._generateGlsl(b.args[0],c),"!=0.0?",this._generateGlsl(b.args[1],c),":",this._generateGlsl(b.args[2],c),")"].join("");case"select":var d=this._generateGlsl(b.args[0],c),e=this,f=function(a,b){return 1==a.length?e._generateGlsl(a[0],c):["(("+d+" === "+b+")?","("+e._generateGlsl(a[0],c)+"):","("+f(_.last(a,a.length-1),b+1)+"))"].join("")};return f(_.last(b.args,b.args.length-1),0);case"sqr":return"(pow(("+this._generateGlsl(b.args[0],c)+"), 2))";case"band":return"(float(("+this._generateGlsl(b.args[0],c)+")&&("+this._generateGlsl(b.args[1],c)+")))";case"bor":return"(float(("+this._generateGlsl(b.args[0],c)+")||("+this._generateGlsl(b.args[1],c)+")))";case"bnot":return"(float(!("+this._generateGlsl(b.args[0],c)+")))";case"invsqrt":return"(1/sqrt("+this._generateGlsl(b.args[0],c)+"))";case"atan2":return"(atan(("+this._generateGlsl(b.args[0],c)+"),("+this._generateGlsl(b.args[1],c)+"))";case"getosc":var g=_.every(b.args,function(b){return b instanceof a.AstPrimaryExpr});if(!g)throw new Error("Non Pre-Computable arguments for getosc in shader code, use variables or constants");var h="__PC_"+b.funcName+"_"+j,i=[b.funcName,h].concat(_.map(b.args,function(a){return a.value})),j=_.indexOf(c,i);return-1==j&&(c.push(i),j=c.length-1),h;default:var k=_.map(b.args,function(a){return this._generateGlsl(a,c)},this).join(","),l=b.funcName;return _.contains(this.varArgFuncs,b.funcName)&&(l+=b.args.length),"("+l+"("+k+"))"}if(b instanceof a.AstAssignment)return this._generateGlsl(b.lhs,c)+"="+this._generateGlsl(b.expr,c);if(b instanceof a.AstProgram){var m=_.map(b.statements,function(a){return this._generateGlsl(a,c)},this);return m.join(";\n")+";"}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?a.glslFloatRepr(b.value):b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&("ID"===b.type||"REG"===b.type)?b.value:void 0},_generateJs:function(b){var c;if(b instanceof a.AstBinaryExpr)return"("+this._generateJs(b.leftOperand)+b.operator+this._generateJs(b.rightOperand)+")";if(b instanceof a.AstUnaryExpr)return"("+b.operator+this._generateJs(b.operand)+")";if(b instanceof a.AstFuncCall)switch(this._checkFunc(b),b.funcName){case"above":return["(",this._generateJs(b.args[0]),">",this._generateJs(b.args[1]),"?1:0)"].join("");case"below":return["(",this._generateJs(b.args[0]),"<",this._generateJs(b.args[1]),"?1:0)"].join("");case"equal":return["(",this._generateJs(b.args[0]),"==",this._generateJs(b.args[1]),"?1:0)"].join("");case"if":return["(",this._generateJs(b.args[0]),"!==0?",this._generateJs(b.args[1]),":",this._generateJs(b.args[2]),")"].join("");case"select":var d=["((function() {"];return d.push("switch("+this._generateJs(b.args[0])+") {"),_.each(_.last(b.args,b.args.length-1),function(a,b){d.push("case "+b+": return "+this._generateJs(a)+";")},this),d.push("default : throw new Error('Unknown selector value in select');"),d.push("}}).call(this))"),d.join("");case"sqr":return"(Math.pow(("+this._generateJs(b.args[0])+"),2))";case"band":return"((("+this._generateJs(b.args[0])+")&&("+this._generateJs(b.args[1])+"))?1:0)";case"bor":return"((("+this._generateJs(b.args[0])+")||("+this._generateJs(b.args[1])+"))?1:0)";case"bnot":return"((!("+this._generateJs(b.args[0])+"))?1:0)";case"invsqrt":return"(1/Math.sqrt("+this._generateJs(b.args[0])+"))";case"atan2":return"(Math.atan(("+this._generateJs(b.args[0])+")/("+this._generateJs(b.args[1])+")))";default:var e=_.map(b.args,function(a){return this._generateJs(a)},this).join(",");return c=_.contains(this.jsMathFuncs,b.funcName)?"Math.":"this.","("+c+b.funcName+"("+e+"))"}if(b instanceof a.AstAssignment)return this._generateJs(b.lhs)+"="+this._generateJs(b.expr);if(b instanceof a.AstProgram){var f=_.map(b.statements,function(a){return this._generateJs(a)},this);return f.join(";\n")}return b instanceof a.AstPrimaryExpr&&"VALUE"===b.type?b.value.toString():b instanceof a.AstPrimaryExpr&&"CONST"===b.type?this._translateConstants(b.value).toString():b instanceof a.AstPrimaryExpr&&"ID"===b.type?"this."+b.value:b instanceof a.AstPrimaryExpr&&"REG"===b.type?'this._registerBank["'+b.value+'"]':void 0 +},_getVars:function(b,c,d,e){b instanceof a.AstBinaryExpr?(this._getVars(b.leftOperand,c,d,e),this._getVars(b.rightOperand,c,d,e)):b instanceof a.AstUnaryExpr?this._getVars(b.operand,c,d,e):b instanceof a.AstFuncCall?(d.push(b.funcName),_.each(b.args,function(a){this._getVars(a,c,d,e)},this)):b instanceof a.AstAssignment?(this._getVars(b.lhs,c,d,e),this._getVars(b.expr,c,d,e)):b instanceof a.AstProgram?_.each(b.statements,function(a){this._getVars(a,c,d,e)},this):b instanceof a.AstPrimaryExpr&&"ID"===b.type?c.push(b.value):b instanceof a.AstPrimaryExpr&&"REG"===b.type&&e.push(b.value)},_translateConstants:function(a){switch(a){case"pi":return Math.PI;case"e":return Math.E;case"phi":return 1.6180339887;default:throw new Error("Unknown constant "+a)}}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]);var d=new a.ExprCodeGenerator(c.code,["b"]);this.code=d.generateJs(["init","onBeat","perFrame"]),this.inited=!1,b.super.constructor.apply(this,arguments)}a.GlobalVar=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.code.setup(c,this)},update:function(){var a=this.code;a.b=this.main.analyser.beat?1:0,this.inited||(a.init(),this.inited=!0),this.main.analyser.beat&&a.onBeat(),a.perFrame()}}),b.ui={disp:"Global Var",type:"GlobalVar",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"}}}}}}(Webvs),function(a){function b(c){if(c=_.defaults(c,{action:"SAVE",bufferId:1,blendMode:"REPLACE"}),this.blendMode=a.blendModes[c.blendMode],this.action=this.actions[c.action],!this.action)throw new Error("Unknown BufferSave action "+c.action);this.action==this.actions.SAVERESTORE?this._nextAction=this.actions.SAVE:this.action==this.actions.RESTORESAVE&&(this._nextAction=this.actions.RESTORE),this._bufferId="__BUFFERSAVE_"+c.bufferId,b.super.constructor.apply(this,arguments)}a.BufferSave=a.defineClass(b,a.Component,{actions:{SAVE:1,RESTORE:2,SAVERESTORE:3,RESTORESAVE:4},init:function(c,d,e){if(b.super.init.call(this,c,d,e),!d.registerBank[this._bufferId]){var f=new a.FrameBufferManager(d.canvas.width,d.canvas.height,c,d.copier,!0,1);d.registerBank[this._bufferId]=f}},update:function(){this.gl;var a,b=this.main.registerBank[this._bufferId];switch(this.action==this.actions.SAVERESTORE||this.action==this.RESTORESAVE?(a=this._nextAction,this._nextAction=this._nextAction==this.actions.SAVE?this.actions.RESTORE:this.actions.SAVE):a=this.action,a){case this.actions.SAVE:b.setRenderTarget(),this.main.copier.run(null,null,this.parent.fm.getCurrentTexture()),b.restoreRenderTarget();break;case this.actions.RESTORE:this.main.copier.run(this.parent.fm,this.blendMode,b.getCurrentTexture())}},destroy:function(){b.super.destroy.call(this),this.main.registerBank[this._bufferId].destroy()}}),b.ui={disp:"Buffer Save",type:"BufferSave",schema:{action:{type:"string",title:"Buffer save action","enum":["SAVE","RESTORE","SAVERESTORE","RESTORESAVE"]},bufferId:{type:"number",title:"Buffer Id","enum":[1,2,3,4,5,6,7,8]},blendMode:{type:"string",title:"Blend mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){c=_.defaults(c,{speed:1,color:"#000000"}),this.color=a.parseColorNorm(c.color),this.frameCount=0,this.maxFrameCount=Math.floor(1/c.speed),this.program=new a.ClearScreenProgram(a.AVERAGE),b.super.constructor.apply(this,arguments)}a.FadeOut=a.defineClass(b,a.Component,{componentName:"FadeOut",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.gl,this.frameCount++,this.frameCount==this.maxFrameCount&&(this.frameCount=0,this.program.run(this.parent.fm,null,this.color))},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.ui={type:"FadeOut",disp:"Fade Out",schema:{speed:{type:"number",title:"Speed",maximum:0,minimum:1,"default":1},color:{type:"string",title:"Fadeout color",format:"color","default":"#FFFFFF"}},form:[{key:"speed",type:"range",step:"0.05"},"color"]}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["kernel"]),c=_.defaults(c,{edgeMode:"EXTEND",bias:0});var d;if(c.kernel in b.kernels)d=b.kernels[c.kernel];else{if(!_.isArray(c.kernel)||1!==c.kernel.length%2)throw new Error("Invalid convolution kernel");d=c.kernel}var e=Math.floor(Math.sqrt(d.length));if(e*e!=d.length)throw new Error("Invalid convolution kernel");this.program=new a.ConvolutionProgram(d,e,c.edgeMode,c.scale,c.bias),b.super.constructor.apply(this,arguments)}function c(b,d,e,f,g){var h="";switch(e){case"WRAP":h="pos = vec2(pos.x<0?pos.x+1.0:pos.x%1, pos.y<0?pos.y+1.0:pos.y%1);";break;case"EXTEND":h="pos = clamp(pos, vec2(0,0), vec2(1,1));";break;default:throw new Error("Invalid edge mode")}var i,j,k=[],l=Math.floor(d/2);for(i=0;d>i;i++)for(j=0;d>j;j++){var m=b[i*d+j];0!==m&&(k.push("pos = v_position + texel * vec2("+(i-l)+","+(j-l)+");"),k.push(h),k.push("colorSum += texture2D(u_srcTexture, pos) * "+a.glslFloatRepr(m)+";"))}_.isUndefined(f)&&(f=_.reduce(b,function(a,b){return a+b},0)),c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["void main() {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 pos;"," vec4 colorSum = vec4(0,0,0,0);",k.join("\n")," setFragColor(vec4(((colorSum+"+a.glslFloatRepr(g)+") / "+a.glslFloatRepr(f)+").rgb, 1.0));","}"]})}a.Convolution=a.defineClass(b,a.Component,{componentName:"Convolution",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),b.kernels={normal:[0,0,0,0,1,0,0,0,0],gaussianBlur:[.045,.122,.045,.122,.332,.122,.045,.122,.045],unsharpen:[-1,-1,-1,-1,9,-1,-1,-1,-1],emboss:[-2,-1,0,-1,1,1,0,1,2],blur:[1,1,1,1,1,1,1,1,1]},a.ConvolutionProgram=a.defineClass(c,a.QuadBoxProgram)}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["maps"]),c=_.defaults(c,{key:"RED",output:"REPLACE",mapCycleMode:"SINGLE"}),this.maps=c.maps,this.currentMap=0,this.mapCycleMode=this.mapCycleModes[c.mapCycleMode],!this.mapCycleMode)throw new Error("Unknown mapCycleMode "+c.mapCycleMode);this.program=new a.ColorMapProgram(c.key,a.getBlendMode(c.output)),b.super.constructor.apply(this,arguments)}function c(a,b){var d="";switch(a){case"RED":d="srcColor.r";break;case"GREEN":d="srcColor.g";break;case"BLUE":d="srcColor.b";break;case"(R+G+B)/2":d="mod((srcColor.r+srcColor.g+srcColor.b)/2.0, 1.0)";break;case"(R+G+B)/3":d="(srcColor.r+srcColor.g+srcColor.b)/3.0";break;case"MAX":d="max(srcColor.r, max(srcColor.g, srcColor.b))";break;default:throw new Error("Unknown colormap key function "+options.key)}c.super.constructor.call(this,{outputBlendMode:b,swapFrame:!0,fragmentShader:["uniform sampler2D u_colorMap;","void main() {"," vec4 srcColor = getSrcColor();"," setFragColor(texture2D(u_colorMap, vec2(("+d+"), 0)));","}"]})}a.ColorMap=a.defineClass(b,a.Component,{mapCycleModes:{SINGLE:1,ONBEATRANDOM:2,ONBEATSEQUENTIAL:3},init:function(a,c,d){b.super.init.call(this,a,c,d),this.colorMaps=_.map(this.maps,function(a){return this._buildColorMap(a)},this),this.currentMap=0,this.program.init(a)},update:function(){if(this.main.analyser.beat)switch(this.mapCycleMode){case this.mapCycleModes.ONBEATRANDOM:this.currentMap=Math.floor(Math.random()*this.colorMaps.length);break;case this.mapCycleModes.ONBEATSEQUENTIAL:this.currentMap=(this.currentMap+1)%this.colorMaps.length}this.program.run(this.parent.fm,null,this.colorMaps[this.currentMap])},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_buildColorMap:function(b){var c=this.gl;b=_.sortBy(b,function(a){return a.index});var d=_.map(b,function(a){return a.index});if(_.uniq(d).length!=d.length)throw new Error("map cannot have repeated indices");b=_.map(b,function(b){var c=a.parseColor(b.color);return{color:c,index:b.index}});var e=_.first(b);0!==e.index&&b.splice(0,0,{color:e.color,index:0});var f=_.last(b);255!==f.index&&b.push({color:f.color,index:255});var g=new Uint8Array(768),h=0,i=_.zip(_.first(b,b.length-1),_.last(b,b.length-1));_.each(i,function(a){var b=a[0],c=a[1],d=c.index-b.index;_.times(d,function(a){g[h++]=Math.floor((b.color[0]*(255-a)+c.color[0]*a)/255),g[h++]=Math.floor((b.color[1]*(255-a)+c.color[1]*a)/255),g[h++]=Math.floor((b.color[2]*(255-a)+c.color[2]*a)/255)})}),g[h++]=f.color[0],g[h++]=f.color[1],g[h++]=f.color[2];var j=c.createTexture();return c.bindTexture(c.TEXTURE_2D,j),c.texImage2D(c.TEXTURE_2D,0,c.RGB,256,1,0,c.RGB,c.UNSIGNED_BYTE,g),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),j}}),a.ColorMapProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_colorMap","texture2D",a),c.super.draw.call(this)}}),b.ui={disp:"Color Map",type:"ColorMap",schema:{maps:{type:"array",items:{type:"array",title:"Map",items:{type:"object",properties:{color:{type:"string",title:"Color",format:"color","default":"#FFFFFF"},index:{type:"number",title:"Index",minimum:0,maximum:255}}}}},key:{type:"string",title:"Map key","enum":["RED","GREEN","BLUE","(R+G+B)/2","(R+G+B)/3","MAX"],"default":"RED"},mapCycleMode:{type:"string",title:"Map Cycle Mode","enum":["SINGLE","ONBEATRANDOM","ONBEATSEQUENTIAL"],"default":"SINGLE"},output:{type:"string",title:"Output blend mode","enum":_.keys(a.blendModes),"default":"REPLACE"}}}}(Webvs),function(a){function b(c){if(a.checkRequiredOptions(c,["mode","color","outColor"]),c=_.defaults(c,{mode:"BELOW",color:"#202020",outColor:"#202020",level:0}),this.mode=_.indexOf(this.modes,c.mode),-1==this.mode)throw new Error("ColorClip: invalid mode");this.color=a.parseColorNorm(c.color),this.outColor=a.parseColorNorm(c.outColor),this.level=c.level,this.program=new a.ColorClipProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor({swapFrame:!0,fragmentShader:["uniform int u_mode;","uniform vec3 u_color;","uniform vec3 u_outColor;","uniform float u_level;","void main() {"," vec4 inColor4 = getSrcColor();"," vec3 inColor = inColor4.rgb;"," bool clip = false;"," if(u_mode == 0) {"," clip = all(lessThanEqual(inColor, u_color));"," }"," if(u_mode == 1) {"," clip = all(greaterThanEqual(inColor, u_color));"," }"," if(u_mode == 2) {"," clip = (distance(inColor, u_color) <= u_level*0.5);"," }"," if(clip) {"," setFragColor(vec4(u_outColor, inColor4.a));"," } else {"," setFragColor(inColor4);"," }","}"]})}a.ColorClip=a.defineClass(b,a.Component,{modes:["BELOW","ABOVE","NEAR"],componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.mode,this.color,this.outColor,this.level)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ColorClipProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b,d,e){this.setUniform("u_mode","1i",a),this.setUniform.apply(this,["u_color","3f"].concat(b)),this.setUniform.apply(this,["u_outColor","3f"].concat(d)),this.setUniform("u_level","1f",e),c.super.draw.call(this)}})}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["code"]),c=_.defaults(c,{gridW:16,gridH:16,noGrid:!1,bFilter:!0,compat:!1,coord:"POLAR"});var d;if(!_.isObject(c.code))throw new Error("Invalid Dynamic movement code");d=c.code;var e=new a.ExprCodeGenerator(d,["x","y","r","d","b"]);this.code=e.generateJs(["init","onBeat","perFrame"]);var f=e.generateGlsl(["perPixel"],["x","y","d","r"],this.code);this.inited=!1,this.noGrid=c.noGrid,this.gridW=c.gridW,this.gridH=c.gridH,this.coordMode=c.coord,this.bFilter=c.bFilter,this.compat=c.compat,this.program=this.noGrid?new a.DMovProgramNG(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f):new a.DMovProgram(this.coordMode,this.bFilter,this.compat,this.code.hasRandom,f),b.super.constructor.apply(this,arguments)}function c(a,b,d,e,f){var g=[f,this.glslFilter(b,d),"void main() {",e?"__randSeed = v_position;":""," x = v_position.x*2.0-1.0;"," y = -(v_position.y*2.0-1.0);",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," setFragColor(vec4(filter(vec2(x, -y)), 1));","}"];c.super.constructor.call(this,{fragmentShader:g,swapFrame:!0})}function d(a,b,c,e,f){var g=["attribute vec2 a_position;","varying vec2 v_newPoint;","uniform int u_coordMode;",f,"void main() {",e?"__randSeed = a_position;":""," x = a_position.x;"," y = -a_position.y;",this.glslRectToPolar(a)," perPixel();",this.glslPolarToRect(a)," v_newPoint = vec2(x,-y);"," setPosition(a_position);","}"],h=["varying vec2 v_newPoint;",this.glslFilter(b,c),"void main() {"," setFragColor(vec4(filter(v_newPoint), 1));","}"];d.super.constructor.call(this,{fragmentShader:h,vertexShader:g,swapFrame:!0})}a.DynamicMovement=a.defineClass(b,a.Component,{componentName:"DynamicMovement",init:function(c,d,e){if(b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,e),!this.noGrid){for(var f=a.clamp(this.gridW,1,this.main.canvas.width),g=a.clamp(this.gridH,1,this.main.canvas.height),h=2*(f/this.main.canvas.width),i=2*(g/this.main.canvas.height),j=Math.ceil(this.main.canvas.width/f),k=Math.ceil(this.main.canvas.height/g),l=new Float32Array(2*6*j*k),m=0,n=-1,o=-1,p=0;k>p;p++){for(var q=0;j>q;q++){var r=Math.min(n+h,1),s=Math.min(o+i,1);l[m++]=n,l[m++]=o,l[m++]=r,l[m++]=o,l[m++]=n,l[m++]=s,l[m++]=r,l[m++]=o,l[m++]=r,l[m++]=s,l[m++]=n,l[m++]=s,n+=h}n=-1,o+=i}this.gridVertices=l,this.gridVerticesSize=m/2}},update:function(){var a=this.code;this.inited||(a.init(),this.inited=!0);var b=this.main.analyser.beat;a.b=b?1:0,a.perFrame(),b&&a.onBeat(),this.noGrid?this.program.run(this.parent.fm,null,this.code):this.program.run(this.parent.fm,null,this.code,this.gridVertices,this.gridVerticesSize)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}});var e={glslRectToPolar:function(a){return"POLAR"===a?["float ar = u_resolution.x/u_resolution.y;","x=x*ar;","d = distance(vec2(x, y), vec2(0,0))/sqrt(2.0);","r = mod(atan(y, x)+PI*0.5, 2.0*PI);"].join("\n"):""},glslPolarToRect:function(a){return"POLAR"===a?["d = d*sqrt(2.0);","x = d*sin(r)/ar;","y = -d*cos(r);"].join("\n"):""},glslFilter:function(a,b){return a&&!b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 cornoff = fract(coord/texel);"," vec2 corn = floor(coord/texel)*texel;"," vec3 tl = getSrcColorAtPos(corn).rgb;"," vec3 tr = getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb;"," vec3 bl = getSrcColorAtPos(corn + vec2(0, texel.y)).rgb;"," vec3 br = getSrcColorAtPos(corn + texel).rgb;"," vec3 pt = mix(tl, tr, cornoff.x);"," vec3 pb = mix(bl, br, cornoff.x);"," return mix(pt, pb, cornoff.y);","}"].join("\n"):a&&b?["vec3 filter(vec2 point) {"," vec2 texel = 1.0/(u_resolution-vec2(1,1));"," vec2 coord = (point+1.0)/2.0;"," vec2 corn = floor(coord/texel)*texel;"," ivec2 cornoff = (ivec2(fract(coord/texel)*255.0));"," ivec3 tl = ivec3(255.0 * getSrcColorAtPos(corn).rgb);"," ivec3 tr = ivec3(255.0 * getSrcColorAtPos(corn + vec2(texel.x, 0)).rgb);"," ivec3 bl = ivec3(255.0 * getSrcColorAtPos(corn + vec2(0, texel.y)).rgb);"," ivec3 br = ivec3(255.0 * getSrcColorAtPos(corn + texel).rgb);"," #define bt(i, j) int((float(i)/255.0)*float(j))"," int a1 = bt(255-cornoff.x,255-cornoff.y);"," int a2 = bt(cornoff.x ,255-cornoff.y);"," int a3 = bt(255-cornoff.x,cornoff.y);"," int a4 = bt(cornoff.x ,cornoff.y);"," float r = float(bt(a1,tl.r) + bt(a2,tr.r) + bt(a3,bl.r) + bt(a4,br.r))/255.0;"," float g = float(bt(a1,tl.g) + bt(a2,tr.g) + bt(a3,bl.g) + bt(a4,br.g))/255.0;"," float b = float(bt(a1,tl.b) + bt(a2,tr.b) + bt(a3,bl.b) + bt(a4,br.b))/255.0;"," return vec3(r,g,b);","}"].join("\n"):["vec3 filter(vec2 point) {"," return getSrcColorAtPos((point+1.0)/2.0).rgb;","}"].join("\n")}};a.DMovProgramNG=a.defineClass(c,a.QuadBoxProgram,e,{draw:function(a){a.bindUniforms(this),c.super.draw.call(this)}}),a.DMovProgram=a.defineClass(d,a.ShaderProgram,e,{draw:function(a,b,c){a.bindUniforms(this),this.setVertexAttribArray("a_position",b,2,this.gl.FLOAT,!1,0,0),this.gl.drawArrays(this.gl.TRIANGLES,0,c)}}),b.ui={type:"DynamicMovement",disp:"Dynamic Movement",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPixel:{type:"string",title:"Per Point"}}},gridW:{type:"number",title:"Grid Width","default":16},gridH:{type:"number",title:"Grid Height","default":16},coord:{type:"string",title:"Coordinate System","enum":["POLAR","RECT"],"default":"POLAR"}},form:[{key:"code.init",type:"textarea"},{key:"code.onBeat",type:"textarea"},{key:"code.perFrame",type:"textarea"},{key:"code.perPixel",type:"textarea"},"gridW","gridH","coord"]}}(Webvs),function(a){function b(a){a=_.defaults(a,{bFilter:!0,coord:"POLAR",compat:!1}),b.super.constructor.call(this,{noGrid:!0,bFilter:a.bFilter,compat:a.compat,coord:a.coord,code:a.code}),this.options=a}a.Movement=a.defineClass(b,a.DynamicMovement)}(Webvs),function(a){function b(a){if(a=_.defaults(a,{channel:"RGB",onBeatRandom:!1}),this.channel=d.indexOf(a.channel),-1==this.channel)throw new Error("Invalid Channel");this.onBeatRandom=a.onBeatRandom,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{swapFrame:!0,fragmentShader:["uniform int u_channel;","void main() {"," vec3 color = getSrcColor().rgb;",_.flatMap(d,function(a,b){return["if(u_channel == "+b+") {"," setFragColor(vec4(color."+a.toLowerCase()+",1));","}"]}).join("\n"),"}"]})}var d=["RGB","RBG","BRG","BGR","GBR","GRB"];a.ChannelShift=a.defineClass(b,a.Component,{componentName:"ChannelShift",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.onBeatRandom&&this.main.analyser.beat&&(this.channel=Math.floor(Math.random()*d.length)),this.program.run(this.parent.fm,null,this.channel)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.ChannelShiftProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a){this.setUniform("u_channel","1i",a),c.super.draw.call(this)}}),b.ui={disp:"Channel Shift",type:"ChannelShift",schema:{channel:{type:"string",title:"Channel","enum":d},onBeatRandom:{type:"boolean",title:"On beat random"}}}}(Webvs),function(a){function b(b){b=_.defaults(b,{color:"#ffffff",invert:!1,blendMode:"REPLACE"}),this.tone=a.parseColorNorm(b.color),this.invert=b.invert,this.program=new c(a.getBlendMode(b.blendMode))}function c(a){c.super.constructor.call(this,{outputBlendMode:a,swapFrame:!0,fragmentShader:["uniform vec3 u_tone;","uniform bool u_invert;","void main() {"," vec4 srcColor = getSrcColor();"," float depth = max(srcColor.r, max(srcColor.g, srcColor.b));"," if(u_invert) {"," depth = 1.0-depth;"," }"," setFragColor(vec4(depth*u_tone, 1));","}"]})}a.UniqueTone=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){this.program.run(this.parent.fm,null,this.tone,this.invert)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()}}),a.UniqueToneProgram=a.defineClass(c,a.QuadBoxProgram,{draw:function(a,b){this.setUniform.apply(this,["u_tone","3f"].concat(a)),this.setUniform("u_invert","1f",b?1:0),c.super.draw.call(this)}})}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code"]),d=_.defaults(d,{source:"SPECTRUM",drawMode:"LINES",colors:["#ffffff"]});var e;if(!_.isObject(d.code))throw new Error("Invalid superscope");e=d.code;var f=new a.ExprCodeGenerator(e,["n","v","i","x","y","b","red","green","blue"]);this.code=f.generateJs(["init","onBeat","perFrame","perPoint"]),this.code.n=100,this.clone=d.clone||1,this.spectrum="SPECTRUM"==d.source,this.dots="DOTS"==d.drawMode,this.colors=_.map(d.colors,a.parseColorNorm),this.currentColor=[],this.maxStep=100,this.step=this.maxStep,this.colorId=0,this.colorStep=[0,0,0],this.thickness=d.thickness?d.thickness:1,this.inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_position;","attribute vec3 a_color;","varying vec3 v_color;","uniform float u_pointSize;","void main() {"," gl_PointSize = u_pointSize;"," setPosition(clamp(a_position, vec2(-1,-1), vec2(1,1)));"," v_color = a_color;","}"],fragmentShader:["varying vec3 v_color;","void main() {"," setFragColor(vec4(v_color, 1));","}"]})}a.SuperScope=a.defineClass(b,a.Component,{componentName:"SuperScope",init:function(c,d,e){b.super.init.call(this,c,d,e),this.program.init(c),this.code.setup(d,this),this.code=a.CodeInstance.clone(this.code,this.clone)},update:function(){this._stepColor(),_.each(this.code,function(a){this.drawScope(a,!this.inited)},this),this.inited=!0},drawScope:function(a,b){this.gl,a.red=this.currentColor[0],a.green=this.currentColor[1],a.blue=this.currentColor[2],b&&a.init();var c=this.main.analyser.beat;a.b=c?1:0,a.perFrame(),c&&a.onBeat();for(var d=Math.floor(a.n),e=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),f=e.length/d,g=0,h=0,i=new Float32Array(2*(this.dots?d:2*d-2)),j=new Float32Array(3*(this.dots?d:2*d-2)),k=0;d>k;k++){for(var l=0,m=0,n=Math.floor(k*f);(k+1)*f>n;n++,m++)l+=e[n];l/=m;var o=k/(d>1?d-1:1);a.i=o,a.v=l,a.perPoint(),i[g++]=a.x,i[g++]=-1*a.y,0===k||k==d-1||this.dots||(i[g++]=a.x,i[g++]=-1*a.y),this.dots?(j[h++]=a.red,j[h++]=a.green,j[h++]=a.blue):0!==k&&(j[h++]=a.red,j[h++]=a.green,j[h++]=a.blue,j[h++]=a.red,j[h++]=a.green,j[h++]=a.blue)}this.program.run(this.parent.fm,null,i,j,this.dots,this.thickness)},destroy:function(){b.super.destroy.call(this),this.program.cleanup()},_stepColor:function(){var a;if(this.colors.length>1)if(this.step==this.maxStep){var b=this.colors[this.colorId];this.colorId=(this.colorId+1)%this.colors.length;var c=this.colors[this.colorId];for(a=0;3>a;a++)this.colorStep[a]=(c[a]-b[a])/this.maxStep;for(this.step=0,a=0;3>a;a++)this.currentColor[a]=b[a]}else{for(a=0;3>a;a++)this.currentColor[a]+=this.colorStep[a];this.step++}else this.currentColor=this.colors[0]}}),a.SuperScopeShader=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d){var e=this.gl;this.setUniform("u_pointSize","1f",d),this.setVertexAttribArray("a_position",a,2,e.FLOAT,!1,0,0),this.setVertexAttribArray("a_color",b,3,e.FLOAT,!1,0,0);var f;c||(f=e.getParameter(e.LINE_WIDTH),e.lineWidth(d)),e.drawArrays(c?e.POINTS:e.LINES,0,a.length/2),c||e.lineWidth(f)}}),b.ui={disp:"SuperScope",type:"SuperScope",schema:{code:{type:"object",title:"Code","default":{},properties:{init:{type:"string",title:"Init"},onBeat:{type:"string",title:"On Beat"},perFrame:{type:"string",title:"Per Frame"},perPoint:{type:"string",title:"Per Point"}}},source:{type:"string",title:"Source","default":"WAVEFORM","enum":["WAVEFORM","SPECTRUM"]},drawMode:{type:"string",title:"Draw Mode","default":"LINES","enum":["DOTS","LINES"]},colors:{type:"array",title:"Cycle Colors",items:{type:"string",format:"color","default":"#FFFFFF"}}}}}(Webvs),function(a){function b(a){a=_.defaults(a,{drawMode:"SOLID",source:"WAVEFORM",align:"CENTER",colors:["#ffffff"]});var c={};"SOLID"!=a.drawMode?(c.init="n=w;",c.perPoint={TOP:"x=i*2-1; y=-v/2-0.5;",CENTER:"x=i*2-1; y=-v/2;",BOTTOM:"x=i*2-1; y=v/2+0.5;"}[a.align]):(c.init="n=w*2;",c.perFrame="c=0;",c.perPoint="SPECTRUM"==a.source?{TOP:"x=i*2-1; y=if(c%2,0,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0.5,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0,v/2+0.5); c=c+1;"}[a.align]:{TOP:"x=i*2-1; y=if(c%2,-0.5,-v/2-0.5); c=c+1;",CENTER:"x=i*2-1; y=if(c%2,0,-v/2); c=c+1;",BOTTOM:"x=i*2-1; y=if(c%2,0.5,v/2+0.5); c=c+1;"}[a.align]),b.super.constructor.call(this,{source:a.source,drawMode:"SOLID"==a.drawMode?"LINES":a.drawMode,colors:a.colors,code:c}),this.options=a}a.Simple=a.defineClass(b,a.SuperScope)}(Webvs),function(a){function b(d){a.checkRequiredOptions(d,["code","imageSrc"]),d=_.defaults(d,{source:"SPECTRUM",resizing:!1,wrapAround:!1,colorFiltering:!0}),this.resizing=d.resizing,this.colorFiltering=d.colorFiltering,this.wrapAround=d.wrapAround,this.imageSrc=d.imageSrc;var e=new a.ExprCodeGenerator(d.code,["n","v","i","x","y","b","sizex","sizey","red","green","blue"]);this.code=e.generateJs(["init","onBeat","perFrame","perPoint"]),this.code.n=100,this.spectrum="SPECTRUM"==d.source,this._inited=!1,this.program=new c,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{vertexShader:["uniform bool u_colorFilter;","attribute vec2 a_texVertex;","attribute vec2 a_vertex;","attribute vec3 a_color;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," if(u_colorFilter) {"," v_color = a_color;"," }"," v_texVertex = a_texVertex;"," setPosition(a_vertex);","}"],fragmentShader:["uniform bool u_colorFilter;","uniform sampler2D u_image;","varying vec2 v_texVertex;","varying vec3 v_color;","void main() {"," vec3 outColor = texture2D(u_image, v_texVertex).rgb;"," if(u_colorFilter) {"," outColor = outColor*v_color;"," }"," setFragColor(vec4(outColor, 1));","}"]})}a.Texer=a.defineClass(b,a.Component,{componentName:"Texer",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a),this.code.setup(c,this);var e=new Image;e.src=c.getResource(this.imageSrc),this.imagewidth=e.width,this.imageHeight=e.height,this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)},update:function(){function a(a,b,c,d,e,f,l){-1-c>a||a>1||-1-d>b||b>1||(g.push(a,b,a+c,b,a+c,b+d,a,b+d),h.push(0,0,1,0,1,1,0,1),j&&j.push(e,f,l,e,f,l,e,f,l,e,f,l),i.push(k+0,k+1,k+2,k+0,k+2,k+3),k+=4)}var b=this.code;this._inited||b.init();var c=this.main.analyser.beat;b.b=c?1:0,b.perFrame(),c&&b.onBeat();for(var d=Math.floor(b.n),e=this.spectrum?this.main.analyser.getSpectrum():this.main.analyser.getWaveform(),f=e.length/d,g=[],h=[],i=[],j=this.colorFiltering?[]:null,k=0,l=2*(this.imagewidth/this.parent.fm.width),m=2*(this.imageHeight/this.parent.fm.height),n=0;d>n;n++){for(var o=0,p=0,q=Math.floor(n*f);(n+1)*f>q;q++,p++)o+=e[q];o/=p;var r=n/(d-1);b.i=r,b.v=o,b.sizex=1,b.sizey=1,b.red=1,b.green=1,b.blue=1,b.perPoint();var s=l,t=m;this.resizing&&(s*=b.sizex,t*=b.sizey);var u=b.x-s/2,v=-b.y-t/2;if(a(u,v,s,t,b.red,b.green,b.blue),this.wrapAround){var w=-1>u?2:u>1-s?-2:0,x=-1>v?2:v>1-t?-2:0;w&&a(w+u,v,s,t,b.red,b.green,b.blue),x&&a(u,x+v,s,t,b.red,b.green,b.blue),w&&x&&a(w+u,x+v,s,t,b.red,b.green,b.blue)}}this.program.run(this.parent.fm,null,new Float32Array(g),new Float32Array(h),new Uint16Array(i),j?new Float32Array(j):null,this.texture)},destroy:function(){b.super.destroy.call(this),this.gl.deleteTexture(this.texture),this.program.cleanup()}}),a.TexerProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_image","texture2D",e),this.setVertexAttribArray("a_vertex",a),this.setVertexAttribArray("a_texVertex",b),d?(this.setUniform("u_colorFilter","1f",1),this.setVertexAttribArray("a_color",d,3)):this.setUniform("u_colorFilter","1f",0),this.setElementArray(c),this.gl.drawElements(this.gl.TRIANGLES,c.length,this.gl.UNSIGNED_SHORT,0)}})}(Webvs),function(a){function b(c){c=_.defaults(c,{n:0,color:"#000000",blendMode:"REPLACE"}),this.n=c.n,this.color=a.parseColorNorm(c.color),this.outputBlendMode=a.blendModes[c.blendMode],this.prevBeat=!1,this.beatCount=0,this.program=new a.ClearScreenProgram(this.outputBlendMode),b.super.constructor.apply(this,arguments)}a.ClearScreen=a.defineClass(b,a.Component,{componentName:"ClearScreen",init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a)},update:function(){var a=!1;0===this.n?a=!0:(this.main.analyser.beat&&!this.prevBeat&&(this.beatCount++,this.beatCount==this.n&&(a=!0,this.beatCount=0)),this.prevBeat=this.main.analyser.beat),a&&this.program.run(this.parent.fm,null,this.color)},destroy:function(){this.program.cleanup()}}),b.ui={type:"ClearScreen",disp:"Clear Screen",schema:{n:{type:"number",title:"Clear on beat (0 = always clear)","default":0},color:{type:"string",title:"Clear color",format:"color","default":"#000000"},blendMode:{type:"string",title:"Blend Mode","enum":_.keys(a.blendModes)}}}}(Webvs),function(a){function b(c){a.checkRequiredOptions(c,["src","x","y"]),this.x=c.x,this.y=c.y,this.src=c.src,this.program=new a.PictureProgram,b.super.constructor.apply(this,arguments)}function c(){c.super.constructor.call(this,{copyOnSwap:!0,vertexShader:["attribute vec2 a_texVertex;","uniform vec2 u_pos;","uniform vec2 u_texRes;","varying vec2 v_texCoord;","void main() {"," v_texCoord = a_texVertex;"," setPosition(a_texVertex*(u_texRes/u_resolution)*vec2(2,-2)+u_pos);","}"],fragmentShader:["uniform sampler2D u_image;","varying vec2 v_texCoord;","void main() {"," setFragColor(texture2D(u_image, v_texCoord));","}"]})}a.Picture=a.defineClass(b,a.Component,{init:function(a,c,d){b.super.init.call(this,a,c,d),this.program.init(a);var e=new Image;e.src=c.getResource(this.src),this.width=e.width,this.height=e.height,this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)},update:function(){this.program.run(this.parent.fm,null,this.x,this.y,this.texture,this.width,this.height)},destroy:function(){this.program.cleanup(),this.gl.deleteTexture(this.texture)}}),a.PictureProgram=a.defineClass(c,a.ShaderProgram,{draw:function(a,b,c,d,e){this.setUniform("u_pos","2f",a,-b),this.setUniform("u_texRes","2f",d,e),this.setUniform("u_image","texture2D",c),this.setVertexAttribArray("a_texVertex",new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}})}(Webvs); \ No newline at end of file