Socket
Socket
Sign inDemoInstall

@atomiix/atomiix

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomiix/atomiix - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

2

lib/atomiix.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.atomiix=t():e.atomiix=t()}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var r,a,i;a=[t],void 0===(i="function"==typeof(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i={lang:{isNullOrUndefined:function(e){return null==e}},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}},o=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),u=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),c=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),s=function(){function e(t){n(this,e),this.options=i.extend({},{languageName:"unnamedlanguage"},t),this.tokenTypes=[]}return t(e,[{key:"addTokenType",value:function(e){if(!e.name)throw new o("Token types must have a 'name' property");if(!e.regexp&&!e.consume)throw new o("Token types must have a 'regexp' property or a 'consume' function");if(e.regexp&&!(e.regexp instanceof RegExp))throw new o("Token types 'regexp' property must be an instance of RegExp");if(e.consume&&"function"!=typeof e.consume)throw new o("Token types 'consume' property must be a function");if(e.interpret&&"function"!=typeof e.interpret)throw new o("Token types 'interpret' property must be a function");this.tokenTypes.push(e)}},{key:"tokenize",value:function(e){if(void 0===e)throw new u("No content provided");if(0===this.tokenTypes.length)throw new u("No token types defined");for(var t,n,r=[],a=e,o=new l,c=this.tokenTypes.length;a.length>0;){for(var s=!1,f=0;f<c;f++){var p=this.tokenTypes[f];if(n=void 0,p.consume){if(!(n=p.consume(a)).success)continue;if(0!==a.indexOf(n.consumed))throw new u("The consume function for "+p.name+" failed to return the start of the remaining content at "+o.line+"."+o.character+" and instead returned "+n.consumed);s=!0,t=n.consumed}else{var h=p.regexp.exec(a);if(!h)continue;if(0!==h.index)continue;s=!0,t=h[0]}var m={content:e=p.interpret?p.interpret(t):n&&!i.lang.isNullOrUndefined(n.content)?n.content:t,type:p.name,line:o.line,character:o.character};p.ignore||r.push(m),a=a.substring(t.length),o.consume(t)}if(!s){var d=a.substring(0,15),y=d.replace("\r","\\r").replace("\t","\\t").replace("\n","\\n");throw new u("No viable alternative at "+o.line+"."+o.character+": '"+y+"...'")}}return r}}]),e}(),f=function(){function e(){n(this,e)}return t(e,null,[{key:"constant",value:function(e,t,n){return n=n||["keyword"],{name:t,regexp:new RegExp("^"+(r=e,r.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"))),role:n};var r}},{key:"floatingPoint",value:function(){return{name:"floating point",regexp:/(^-?\d*\.\d+)/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}}},{key:"integer",value:function(){return{name:"integer",regexp:/^-?\d+/,role:["constant","numeric"],interpret:function(e){return parseInt(e)}}}},{key:"whitespace",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t]+/}}},{key:"whitespaceWithNewlines",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t\r\n]+/}}},{key:"real",value:function(){return{name:"real number",regexp:/^X/,role:["constant","numeric"]}}},{key:"comma",value:function(){return this.constant(",","comma",["punctuation"])}},{key:"period",value:function(){return this.constant(".","period",["punctuation"])}},{key:"star",value:function(){return this.constant("*","star",["punctuation"])}},{key:"colon",value:function(){return this.constant(":","colon",["punctuation"])}},{key:"openParen",value:function(){return this.constant("(","open paren",["punctuation"])}},{key:"closeParen",value:function(){return this.constant(")","close paren",["punctuation"])}},{key:"openBracket",value:function(){return this.constant("{","open bracket",["punctuation"])}},{key:"closeBracket",value:function(){return this.constant("}","close bracket",["punctuation"])}},{key:"openSquareBracket",value:function(){return this.constant("[","open square bracket",["punctuation"])}},{key:"closeSquareBracket",value:function(){return this.constant("]","close square bracket",["punctuation"])}},{key:"JsonString",value:function(){return{name:"string",regexp:/"(?:[^"\\]|\\.)*"/,consume:function(e){var t={success:!1};if(0!==e.indexOf('"'))return t;var n,r="",a=1,i=!1;do{switch(n=e[a],a+=1,n){case'"':i=!0;break;case"\\":var o=e[a];switch(a+=1,o){case'"':return t;case"t":r+="\t";break;case"r":r+="\r";break;case"n":r+="\n";break;case"u":var u=e.substr(a,4);if(4==u.length&&/\d{4}/.test(u)){a+=4;var c=parseInt(u,10),s=String.fromCharCode(c);r+=s}else r+="\\u";break;default:return t}break;default:r+=n}}while(!i);var f=e.substring(0,a),p={success:!0,consumed:f,content:r};return p}}}}]),e}(),p=function(){function e(){n(this,e)}return t(e,[{key:"initialize",value:function(e){if(!e)throw new c("No tokens provided to the parser");if(!(e instanceof Array))throw new c("A non-array was provided to the parser instead of a token array");this.tokens=e}},{key:"la1",value:function(e){if(this.eof())throw new c("No tokens available");return this.tokens[0].type==e}},{key:"match",value:function(e){if(this.eof())throw new c("Expected "+e+" but found EOF");if(!this.la1(e))throw new c("Expected "+e+" but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character);return this.tokens.shift()}},{key:"eof",value:function(){return 0===this.tokens.length}},{key:"expectEof",value:function(){if(!this.eof())throw new c("Expected EOF but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character)}}]),e}(),l=function(){function e(){n(this,e),this.line=1,this.character=1,this.justSeenSlashR=!1}return t(e,[{key:"consume",value:function(e){for(var t=0,n=e.length;t<n;t++)"\r"==e[t]?(this.line+=1,this.character=1,this.justSeenSlashR=!0):"\n"==e[t]?(this.justSeenSlashR||(this.line+=1),this.character=1,this.justSeenSlashR=!1):(this.character+=1,this.justSeenSlashR=!1)}}]),e}();e.PatternDefinitionException=o,e.LexerException=u,e.ParserException=c,e.Lexer=s,e.StandardTokenTypes=f,e.Parser=p,e.LineTracker=l})?r.apply(t,a):r)||(e.exports=i)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MARKTEXT",function(){return Le}),n.d(r,"UNMARKTEXT",function(){return _e}),n.d(r,"REPLACETEXT",function(){return Fe}),n.d(r,"REPLACELINE",function(){return De}),n.d(r,"DISPLAYINFO",function(){return Ue});var a=n(0),i=a.StandardTokenTypes,o=new a.Lexer({languageName:"atomiix"});o.addTokenType(i.whitespace()),o.addTokenType({name:"newline",regexp:/^\n[ \n]*/}),o.addTokenType({name:"comment",ignore:!0,regexp:/^\/\/[^\n]*/}),o.addTokenType(i.constant("->","play arrow")),o.addTokenType(i.constant(">>","double right arrow")),o.addTokenType(i.constant("<<","double left arrow")),o.addTokenType(i.constant("))","increase amplitude")),o.addTokenType(i.constant("((","decrease amplitude")),o.addTokenType(i.constant(":","colon")),o.addTokenType({name:"sustain multiplier",regexp:/^[_~]/}),o.addTokenType(i.openParen()),o.addTokenType(i.closeParen()),o.addTokenType({name:"operator",regexp:/^[*\/+\-!@]+/}),o.addTokenType({name:"beat",regexp:/^\d+(\.\d+)?b/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"number",regexp:/^\d+(\.\d+)?/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"identifier",regexp:/^[a-zA-Z][a-zA-Z0-9]*/}),o.addTokenType({name:"score",regexp:/^[{[\\|][a-zA-Z0-9 ]*[}\]\\|]/}),o.addTokenType({name:"score modifier",regexp:/^[<\\^][0-9]*[>\\^]/});var u=o,c="PROGRAM",s="PLAY",f="ADDFXCHAIN",p="RMFXCHAIN",l="INCRAMP",h="DECRAMP",m="COMMAND",d="FUTURE",y="GROUP",g="AGENT",v="SCORE",b="PERCUSSIVE",w="MELODIC",k="CONCRETE",T="SCOREOPERATOR",E="SCOREMODIFIER",x="PANNING",S="SUSTAIN",O="ATTACK",P="EFFECT",A="BEAT",N="NUMBER",C="STRING";function M(e){return{type:c,statements:e}}function j(e){return{type:l,agent:e}}function R(e){return{type:h,agent:e}}function I(e,t,n,r,a,i,o,u,c){return{type:v,scoreType:e,instrument:t,values:n,durations:r,offset:a,modifiers:i,scoreString:o,line:u,position:c}}function L(e){return{type:P,name:e}}function _(e,t){return{type:A,value:e,modifier:t}}function F(e,t){return{type:N,value:e,modifier:t}}function D(e,t,n){var r=t.content,i=r.charAt(0),o=r.slice(-1),u=!1;switch(i){case"|":u="|"===o;break;case"[":u="]"===o;break;case"{":u="}"===o}if(!u)throw new a.ParserException("Score delimiters don't match. Starts with ".concat(i," but ends with ").concat(o));var c,s=r.slice(1,-1);switch(i){case"|":if(e)throw new a.ParserException("Percussive score shouldn't have instrument: ".concat(e));return c=U(s),I(b,null,c.chars,c.durations,c.offset,n,r,t.line-1,t.character-1);case"[":if(!e)throw new a.ParserException("Melodic score should have an instrument");return c=U(s),I(w,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);case"{":if(!e)throw new a.ParserException("Concrete score should have an instrument");return c=U(s),I(k,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);default:throw new a.ParserException("".concat(i," is not a supported score delimiters"))}}function U(e){for(var t=[],n=[],r=0,a="",i=0,o=0;o<e.length;o+=1){var u=e[o];" "!==u?(""===a?r=i:(t.push(a),n.push(i)),a=u,i=1):i+=1}return""!=a&&(t.push(a),n.push(i)),{chars:t,durations:n,offset:r}}function X(e){var t,n=e.charAt(0),r=e.slice(-1),i=!1;switch(n){case"<":t=x,i=">"===r;break;case"^":t=O,i="^"===r}if(!i)throw new a.ParserException("Score modifier delimiters don't match. Starts with ".concat(n," but ends with ").concat(r));return function(e,t){return{type:E,modifierType:e,values:t}}(t,e.slice(1,-1).split("").map(function(e){return parseInt(e,10)}))}var G=new a.Parser;function z(e){return t=e.content,n=e.line-1,r=e.character-1,{type:g,name:t,line:n,position:r};var t,n,r}G.parse=function(e){var t=u.tokenize(e);return this.initialize(t),this.program()},G.program=function(){for(var e=[];!this.eof();)this.la1("newline")?this.match("newline"):e.push(this.statement());return M(e)},G.statement=function(){var e=this.match("identifier");if(!this.eof()&&this.la1("play arrow")){this.match("play arrow");var t=this.score();return function(e,t){return{type:s,agent:e,score:t}}(z(e),t)}if(!this.eof()&&this.la1("double right arrow"))return this.addEffectsChain(z(e));if(!this.eof()&&this.la1("double left arrow"))return this.removeEffectsChain(z(e));if(!this.eof()&&this.la1("increase amplitude"))return this.match("increase amplitude"),j(z(e));if(!this.eof()&&this.la1("decrease amplitude"))return this.match("decrease amplitude"),R(z(e));switch(e.content){case"group":return this.group(e);case"future":return this.future(e);case"sequence":throw new a.ParserException("No support for sequence yet");default:return this.command(e)}},G.score=function(){var e="";return this.la1("identifier")&&(e=this.match("identifier").content),D(e,this.match("score"),this.scoreModifiers())},G.scoreModifiers=function(){for(var e=[];!this.eof()&&!this.la1("newline");)if(this.la1("operator")){var t=this.scoreOperator();e.push(t)}else if(this.la1("score modifier")){var n=X(this.match("score modifier").content);e.push(n)}else{if(!this.la1("open paren"))throw new a.ParserException("Unexpected token: Expecting operator or score modifier");var r=this.sustainModifier();e.push(r)}return e},G.sustainModifier=function(){var e=null;this.match("open paren");var t=this.match("number").content;return this.la1("sustain multiplier")&&(this.match("sustain multiplier"),e=this.match("number").content),this.match("close paren"),function(e,t){return{type:E,modifierType:S,noteLength:e,multiplier:t}}(t,e)},G.scoreOperator=function(){return function(e,t){return{type:T,operator:e,value:t}}(this.match("operator").content,this.match("number").content)},G.addEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double right arrow");){this.match("double right arrow");var n=this.match("identifier").content;t.push(L(n))}return function(e,t){return{type:f,agent:e,effects:t}}(e,t)},G.removeEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double left arrow")&&(this.match("double left arrow"),!this.eof()&&this.la1("identifier")||0!==t.length);){var n=this.match("identifier").content;t.push(L(n))}return function(e,t){return{type:p,agent:e,effects:t}}(e,t)},G.future=function(e){var t,n;if(this.la1("number")){var r,a=this.match("number").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t=F(a,r)}else if(this.la1("beat")){var i,o=this.match("beat").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),i=this.match("number").content),t=_(o,i)}if(this.match("double right arrow"),this.la1("increase amplitude"))this.match("increase amplitude"),n=j(z(this.match("identifier")));else if(this.la1("decrease amplitude")){this.match("decrease amplitude"),n=R(z(this.match("identifier")))}else if(this.la1("identifier")){var u=this.match("identifier");n=this.command(u)}return function(e,t,n){return{type:d,timing:e,command:t,line:n}}(t,n,e.line-1)},G.command=function(e){for(var t=[];!this.eof()&&!this.la1("newline");)if(this.la1("number")){var n=this.match("number").content,r=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t.push(F(n,r))}else if(this.la1("beat")){var i=this.match("beat").content,o=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),o=this.match("number").content),t.push(_(i,o))}else{if(!this.la1("identifier"))throw new a.ParserException("Expected number or string");var u=this.match("identifier").content;t.push({type:C,value:u})}return function(e,t,n,r){return{type:m,name:e,args:t,line:n,position:r}}(e.content,t,e.line-1,e.character-1)},G.group=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException("Expected agent name");t.push(this.match("identifier").content)}return function(e,t){return{type:y,name:e,agents:t}}(e,t)};var B=G,K={names:{major:"major",minor:"minor",melodicMinor:"melMi",harmonicMinor:"harMi",diminished:"dimin",wholeTone:"whlTn",blues:"blues",minorPentatonic:"minPn",majorPentatonic:"majPn",hungarianMinor:"hngMi",persian:"persn",hirojoshi:"hiroj",arabian:"arabn"},notes:{major:[0,0,2,4,5,7,9,11,12,14],minor:[0,0,2,3,5,7,8,10,12,14],melMi:[0,0,2,3,5,7,9,11,13,14],harMi:[0,0,2,3,5,7,8,11,12,14],dimin:[0,0,2,3,5,6,8,9,11,12],whlTn:[0,0,2,4,6,8,10,12,14,16],blues:[0,0,3,5,6,7,10,12,15,17],minPn:[0,0,3,5,7,10,12,15,17,19],majPn:[0,0,2,4,7,9,12,14,16,19],hngMi:[0,0,2,3,6,7,8,11,12,14],persn:[0,0,1,4,5,6,8,11,12,13],hiroj:[0,0,2,3,7,8,12,14,15,19],arabn:[0,0,2,4,5,6,8,10,12,14]}},q="AtomiixRuntimeError",Y="AtomiixOSCError",H="EDITORACTION",Z="AUDIOACTION",V="INBOUNDACTION",$="AGENTMETHOD",J="FREEAGENT",W="NAPAGENT",Q="ADDAGENTFX",ee="RMAGENTFX",te="SETAGENTAMP",ne="SETTEMPO",re="FUTURECALLBACK",ae="PLAYPERCUSSIVE",ie="PLAYMELODIC",oe="PLAYCONCRETE";function ue(e,t){return{type:Z,actionType:$,agent:e,method:t}}function ce(e){return{type:Z,actionType:J,agent:e}}function se(e,t){return{type:Z,actionType:Q,agent:e,fxList:t}}function fe(e,t){return{type:Z,actionType:ee,agent:e,fxList:t}}function pe(e,t){return{type:Z,actionType:te,agent:e,amplitude:t}}function le(e,t,n,r){return{type:Z,actionType:re,time:e,timeType:t,repeats:n,callbackID:r}}function he(e,t){return{type:Z,actionType:ae,agent:e,notes:t.notes,durations:t.durations,instruments:t.instruments,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function me(e,t){return{type:Z,actionType:ie,agent:e,notes:t.notes,durations:t.durations,instrument:t.instrument,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function de(e,t){return{type:Z,actionType:oe,agent:e,pitch:t.pitch,amplitudes:t.amplitudes,durations:t.durations,instrument:t.instrument,panning:t.panning,offset:t.offset,repeats:t.repeats}}function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function be(e,t,n){return t&&ve(e.prototype,t),n&&ve(e,n),e}function we(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?ke(e):t}function ke(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Te(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Se(e,t)}function Ee(e){var t="function"==typeof Map?new Map:void 0;return(Ee=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return xe(e,arguments,Oe(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Se(r,e)})(e)}function xe(e,t,n){return(xe=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&Se(a,n.prototype),a}).apply(null,arguments)}function Se(e,t){return(Se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Oe(e){return(Oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=function(e){function t(e,n,r){var a;return ge(this,t),(a=we(this,Oe(t).call(this,e))).name=q,a.lineNumber=n,a.inCallback=r,a.setLineNumber=a.setLineNumber.bind(ke(a)),a.setCallbackStatus=a.setCallbackStatus.bind(ke(a)),a.formattedMessage=a.formattedMessage.bind(ke(a)),a}return Te(t,Ee(Error)),be(t,[{key:"setLineNumber",value:function(e){this.lineNumber=e}},{key:"setCallbackStatus",value:function(e){this.inCallback=e}},{key:"formattedMessage",value:function(){var e="";void 0!==this.lineNumber&&(e=" on line ".concat(this.lineNumber));var t="";return this.inCallback&&(t=" in callback"),"Error".concat(t).concat(e,": ").concat(this.message)}}]),t}(),Ae=function(e){function t(e){var n;return ge(this,t),(n=we(this,Oe(t).call(this,e))).name=Y,n.formattedMessage=n.formattedMessage.bind(ke(n)),n}return Te(t,Ee(Error)),be(t,[{key:"formattedMessage",value:function(){return"OSCError: ".concat(this.message)}}]),t}();function Ne(e,t,n){if(t.length<n)throw new Pe("".concat(e," expected at least ").concat(n," arguments"))}function Ce(e,t){if(t.type!==C)throw new Pe("".concat(e," expected String but got ").concat(t.type));return t.value}function Me(e,t){if(t.type!==N)throw new Pe("".concat(e," expected Number but got ").concat(t.type));return t.value}function je(e,t,n){return void 0===t?n:Me(e,t)}function Re(e,t,n){var r=[];return e.groups[t]?(e.groups[t].forEach(function(t){r=r.concat(n(e,t))}),r):n(e,t)}function Ie(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Ce(n,r[0]),i=K.names[a];i?e.scale=i:e.logger.warn("".concat(n,": ").concat(a," is not a valid scale name"))}var Le="MARKTEXT",_e="UNMARKTEXT",Fe="REPLACETEXT",De="REPLACELINE",Ue="DISPLAYINFO";function Xe(e,t,n){var r=[],a=Ke(e,t),i=a.score,o=n(i);r.push(function(e,t){return{type:H,actionType:Fe,group:e,sections:{score:t}}}(t,o));var u={content:o,line:i.line,character:i.position},c=D(i.instrument,u,i.modifiers);return a.score=c,a.playing&&(r=r.concat(Ve(e,t))),r}var Ge=/^[A-Z]/,ze=/^[a-z]/;var Be={doze:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Re(e,Ce(n,r[0]),function(e,t){var r=[],a=Ke(e,t);return a&&(a.playing=!1,r.push(ue(t,n))),r})},wake:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Re(e,Ce(n,r[0]),function(e,t){var r=[],a=Ke(e,t);return a&&(a.playing=!1,r.push(ue(t,n))),r})},nap:function(e,t){var n=t.name,r=t.args;Ne(n,r,2);var a=Ce(n,r[0]),i=r[1],o=i.value,u=i.type===A?"beats":"seconds",c=i.modifier||1;return Re(e,a,function(e,t){var n=[],r=Ke(e,t);return r&&(r.playing=!1,n.push(function(e,t,n,r){return{type:Z,actionType:W,agent:e,time:t,timeType:n,repeats:r}}(t,o,u,c))),n})},kill:function(e,t){return Ne(t.name,t.args,0),Object.keys(e.agents).map(function(t){return e.agents[t].playing=!1,ce(t)})},scale:Ie,scalepush:function(e,t){Ie(e,t);var n=[];return Object.keys(e.agents).forEach(function(t){Ke(e,t).playing&&(n=n.concat(Ve(e,t)))}),n},tonic:function(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Me(n,r[0]);e.tonic=Math.floor(a)},tempo:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),function(e,t){return{type:Z,actionType:ne,tempo:e,glide:t}}(Me(n,r[0]),r[0].modifier)},shake:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").sort(function(){return.5-Math.random()}).join("")+r})},reverse:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").reverse().join("")+r})},shiftr:function(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Ce(n,r[0]),i=je(n,r[1],1);return Xe(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.slice(0,-i);return n+a.substr(a.length-i)+o+r})},shiftl:function(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Ce(n,r[0]),i=je(n,r[1],1);return Xe(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.substr(0,i);return n+a.slice(i)+o+r})},up:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toUpperCase()})},down:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toLowerCase()})},yoyo:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return Ge.test(e)?e.toLowerCase():ze.test(e)?e.toUpperCase():e}).join("")+r})},grid:function(e,t,n){var r=t.name,a=t.args,i=t.line,o=[];Ne(r,a,1);var u=Math.floor(Me(r,a[0])),c=Math.floor(70/u),s=" |"+(" ".repeat(u-1)+"|").repeat(c);return o.push({type:H,actionType:De,line:i+n,text:s}),o},remind:function(){var e,t=Object.keys(Be).join("\n");return[(e=t,{type:H,actionType:Ue,info:e})]}};function Ke(e,t){var n=e.agents[t];if(!n)throw new Pe("No agent called ".concat(t));return n}function qe(e,t,n,r){if(e.groups[t.name])throw new Pe("".concat(t.name," is already the name of a group"));var a,i,o,u,c,s,f=[];return t.line=t.line+r,n.line=n.line+r,e.agents[t.name]={agent:t,score:n,playing:!0,amplitude:.5},f.push((a=t.name,i=t.line,o=t.position,u=t.position+t.name.length,c=n.position,s=n.position+n.scoreString.length,{type:H,actionType:Le,group:a,sections:{agent:{line:i,start:o,finish:u},score:{line:i,start:c,finish:s}}})),f}function Ye(e,t){var n=[],r=e.agents[t];return r&&(n.push(function(e){return{type:H,actionType:_e,group:e}}(r.agent.name)),delete e.agents[t]),n}function He(e,t){switch(t.type){case s:return t.agent;default:return null}}function Ze(e,t){var n=function(e,t){for(var n=[],r=0;r<t.statements.length;r+=1){var a=He(0,t.statements[r]);a&&n.push(a.name)}return{agentNames:n}}(0,t).agentNames,r=[];return n.forEach(function(t){r.push(ce(t)),r=r.concat(Ye(e,t))}),r}function Ve(e,t){var n=e.agents[t];if(!n)throw new Pe("No agent called ".concat(t));return Qe(e,n.agent,n.score)}function $e(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],a=0;a<t.statements.length;a+=1){var i=t.statements[a],o=void 0;try{o=Je(e,i,n)}catch(e){if(e.name===q)throw e.setLineNumber(n+a),e}o&&(r=r.concat(o))}return r}function Je(e,t,n){switch(t.type){case s:return function(e,t,n){var r=t.agent,a=t.score,i=[];a.durations.length>0?i=(i=i.concat(Qe(e,r,a))).concat(qe(e,r,a,n)):(i.push(ce(r.name)),i=i.concat(Ye(e,r.name)));return i}(e,t,n);case f:return a=(r=t).agent,i=r.effects,[se(a.name,i.map(function(e){return e.name}))];case p:return function(e,t){var n=t.agent,r=t.effects;return[fe(n.name,r.map(function(e){return e.name}))]}(0,t);case l:return We(e,t,.1);case h:return We(e,t,-.1);case m:return function(e,t,n){var r=t.name,a=e.stdlib[r];if(!a)throw new Pe("".concat(r," is not an existing command"));return a(e,t,n)}(e,t,n);case d:return function(e,t,n){var r=Math.random().toString(36).substring(7)+e.lastCallbackID;e.lastCallbackID+=1,e.callbacks[r]={command:M([t.command]),line:t.line+n};var a="seconds";t.timing.type===A&&(a="beats");var i=1;t.timing.modifier&&(i=t.timing.modifier);return[le(t.timing.value,a,i,r)]}(e,t,n);case y:return function(e,t){var n=t.name,r=t.agents;if(e.agents[n])throw new Pe("".concat(n," is already the name of an agent"));if(e.groups[n])throw new Pe("".concat(n," is already the name of a group"));var a=r.map(function(t){return Ke(e,t),t});return e.groups[n]=a,[]}(e,t);default:throw new Pe("".concat(t.type," is not a supported statement type"))}var r,a,i}function We(e,t,n){var r=t.agent,a=e.agents[r.name];if(a)return a.amplitude=a.amplitude+n,[pe(r.name,a.amplitude)]}function Qe(e,t,n){var r=n.scoreType;switch(r){case b:return function(e,t,n){var r=et(e,[60],n.durations,n.modifiers),a=r.notes,i=r.durations,o=r.sustain,u=r.attack,c=r.panning,s=r.repeats,f=n.values,p=n.offset/4,l=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:b,notes:e,durations:t,instruments:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(a,i,f,o,u,c,p,s);return[he(t.name,l)]}(e,t,n);case w:return function(e,t,n){var r=n.values.map(function(t){return function(e,t){return e.tonic+K.notes[e.scale][t]}(e,t)}),a=et(e,r,n.durations,n.modifiers),i=a.notes,o=a.durations,u=a.sustain,c=a.attack,s=a.panning,f=a.repeats,p=n.instrument,l=n.offset/4,h=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:w,notes:e,durations:t,instrument:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(i,o,p,u,c,s,l,f);return[me(t.name,h)]}(e,t,n);case k:return function(e,t,n){var r=et(e,[],n.durations,n.modifiers),a=r.durations,i=r.panning,o=r.repeats,u=n.values.map(function(e){return e/10}),c=n.instrument,s=n.offset/4,f=function(e,t,n,r,a,i,o){return{type:v,scoreType:k,pitch:e,amplitudes:t,durations:n,instrument:r,panning:a,offset:i,repeats:o}}(60,u,a,c,i,s,o);return[de(t.name,f)]}(e,t,n);default:throw new Pe("".concat(r," is not a supported score type"))}}function et(e,t,n,r){for(var a=t,i=n,o=[.25],u=[5],c=[0],s=1,f=0,p="inf",l=function(e){var t=r[e];if(t.type===E)switch(t.modifierType){case x:c=t.values.map(function(e){return(e-1)/4-1});break;case S:o=[1/t.noteLength*(t.multiplier||1)];break;case O:u=t.values}else if(t.type===T)switch(t.operator){case"+":a=a.map(function(e){return e+t.value});break;case"-":a=a.map(function(e){return e-t.value});break;case"*":s=t.value;break;case"/":s=1/t.value;break;case"!":f=t.value;break;case"@":p=t.value}},h=0;h<r.length;h+=1)l(h);return i[i.length-1]+=f,i=i.map(function(e){return e/4}).map(function(e){return e*s}),u=u.map(function(e){return e/9}),{notes:a,durations:i,sustain:o,attack:u,panning:c,silences:f,timestretch:s,repeats:p}}var tt="AGENTFINISHED",nt="CALLBACKTRIGGER";function rt(e,t){switch(t.actionType){case tt:return function(e,t){var n=t.name;return e.logger.info("Marking agent ".concat(n," as finished")),function(e,t){var n=e.agents[t];n&&(n.playing=!1)}(e,n),[]}(e,t);case nt:return function(e,t){var n=t.callbackId,r=t.remaining,a=[],i=e.callbacks[n];if(!i)return e.logger.error("Error: no callback with id ".concat(n)),a;try{a=$e(e,i.command,null)}catch(e){if(e.name===q)throw e.setCallbackStatus(!0),e.setLineNumber(void 0),e}r<1&&delete e.callbacks[n];return a}(e,t);default:e.logger.warning("".concat(t.actionType," is an unknown action type"))}return[]}var at={playPattern:"/play/pattern",command:"/command",agentAmplitude:"/agent/amplitude",addFX:"/agent/effects/add",rmFX:"/agent/effects/remove",tempo:"/tempo",callback:"/callback"};function it(e,t){switch(t.actionType){case $:return n=e.command,a=(r=t).agent,i=r.method,ct(n,[{type:"string",value:i},{type:"string",value:a}]);case J:return function(e,t){var n=t.agent;return ct(e,[{type:"string",value:"free"},{type:"string",value:n}])}(e.command,t);case W:return function(e,t){var n=t.agent,r=t.time,a=t.timeType,i=t.repeats;return ct(e,[{type:"string",value:"nap"},{type:"string",value:n},{type:"float",value:r},{type:"string",value:a},{type:"integer",value:i}])}(e.command,t);case Q:return function(e,t){var n=t.agent,r=t.fxList;return ct(e,[{type:"string",value:n},{type:"array",value:r}])}(e.addFX,t);case ee:return function(e,t){var n=t.agent,r=t.fxList;return ct(e,[{type:"string",value:n},{type:"array",value:r}])}(e.rmFX,t);case te:return function(e,t){var n=t.agent,r=t.amplitude;return ct(e,[{type:"string",value:n},{type:"float",value:r}])}(e.agentAmplitude,t);case ne:return function(e,t){var n=t.tempo,r=t.glide,a=[{type:"float",value:n}];r&&a.push({type:"float",value:r});return ct(e,a)}(e.tempo,t);case re:return function(e,t){var n=t.time,r=t.timeType,a=t.repeats,i=t.callbackID;return ct(e,[{type:"float",value:n},{type:"string",value:r},{type:"integer",value:a},{type:"string",value:i}])}(e.callback,t);case ae:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"percussive"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"array",value:t.instruments},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return ct(e,r)}(e.playPattern,t);case ie:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"melodic"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return ct(e,r)}(e.playPattern,t);case oe:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"concrete"},{type:"string",value:t.agent},{type:"integer",value:t.pitch},{type:"array",value:t.amplitudes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return ct(e,r)}(e.playPattern,t)}var n,r,a,i}var ot={agentFinished:"/finished",callback:"/callback"};function ut(e,t){switch(t.address){case e.agentFinished:return function(e){return t=st(e,0),{type:V,actionType:tt,name:t};var t}(t);case e.callback:return function(e){var t=st(e,0),n=function(e,t){var n=e.args[t];if("float"!==n.type&&"integer"!==n.type)throw new Ae("Expected Float or Integer but got ".concat(n.type));return n.value}(e,1);return function(e,t){return{type:V,actionType:nt,callbackId:e,remaining:t}}(t,n)}(t);default:throw new Ae("".concat(t.address," is not a valid incoming address"))}}function ct(e,t){return{oscType:"message",address:e,args:t}}function st(e,t){var n=e.args[t];if("string"!==n.type)throw new Ae("Expected String but got ".concat(n.type));return n.value}function ft(e){var t={audio:[],editor:[]};return e.forEach(function(e){e.type===Z?t.audio.push(e):e.type===H&&t.editor.push(e)}),t}function pt(e,t){switch(t.name){case q:case Y:e.logger.error(t.formattedMessage())}return{audio:[],editor:[]}}t.default={editorActions:r,init:function(e){var t=e||{info:console.log,warn:console.log,error:console.log};return{scale:K.names.major,tonic:60,bpm:120,stdlib:Be,agents:{},groups:{},callbacks:{},lastCallbackID:0,logger:t}},evaluate:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;try{return ft($e(e,B.parse(t),n))}catch(t){return pt(e,t)}},free:function(e,t){try{return ft(Ze(e,B.parse(t)))}catch(t){return pt(e,t)}},handleAction:rt,incomingAction:function(e,t){try{return ft(rt(e,t))}catch(t){return pt(e,t)}},actionToOSC:function(e){return e.map(function(e){return it(at,e)})},oscToAction:function(e){return ut(ot,e)}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.atomiix=t():e.atomiix=t()}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var r,a,i;a=[t],void 0===(i="function"==typeof(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i={lang:{isNullOrUndefined:function(e){return null==e}},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}},o=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),u=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),c=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),s=function(){function e(t){n(this,e),this.options=i.extend({},{languageName:"unnamedlanguage"},t),this.tokenTypes=[]}return t(e,[{key:"addTokenType",value:function(e){if(!e.name)throw new o("Token types must have a 'name' property");if(!e.regexp&&!e.consume)throw new o("Token types must have a 'regexp' property or a 'consume' function");if(e.regexp&&!(e.regexp instanceof RegExp))throw new o("Token types 'regexp' property must be an instance of RegExp");if(e.consume&&"function"!=typeof e.consume)throw new o("Token types 'consume' property must be a function");if(e.interpret&&"function"!=typeof e.interpret)throw new o("Token types 'interpret' property must be a function");this.tokenTypes.push(e)}},{key:"tokenize",value:function(e){if(void 0===e)throw new u("No content provided");if(0===this.tokenTypes.length)throw new u("No token types defined");for(var t,n,r=[],a=e,o=new l,c=this.tokenTypes.length;a.length>0;){for(var s=!1,f=0;f<c;f++){var p=this.tokenTypes[f];if(n=void 0,p.consume){if(!(n=p.consume(a)).success)continue;if(0!==a.indexOf(n.consumed))throw new u("The consume function for "+p.name+" failed to return the start of the remaining content at "+o.line+"."+o.character+" and instead returned "+n.consumed);s=!0,t=n.consumed}else{var h=p.regexp.exec(a);if(!h)continue;if(0!==h.index)continue;s=!0,t=h[0]}var m={content:e=p.interpret?p.interpret(t):n&&!i.lang.isNullOrUndefined(n.content)?n.content:t,type:p.name,line:o.line,character:o.character};p.ignore||r.push(m),a=a.substring(t.length),o.consume(t)}if(!s){var d=a.substring(0,15),y=d.replace("\r","\\r").replace("\t","\\t").replace("\n","\\n");throw new u("No viable alternative at "+o.line+"."+o.character+": '"+y+"...'")}}return r}}]),e}(),f=function(){function e(){n(this,e)}return t(e,null,[{key:"constant",value:function(e,t,n){return n=n||["keyword"],{name:t,regexp:new RegExp("^"+(r=e,r.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"))),role:n};var r}},{key:"floatingPoint",value:function(){return{name:"floating point",regexp:/(^-?\d*\.\d+)/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}}},{key:"integer",value:function(){return{name:"integer",regexp:/^-?\d+/,role:["constant","numeric"],interpret:function(e){return parseInt(e)}}}},{key:"whitespace",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t]+/}}},{key:"whitespaceWithNewlines",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t\r\n]+/}}},{key:"real",value:function(){return{name:"real number",regexp:/^X/,role:["constant","numeric"]}}},{key:"comma",value:function(){return this.constant(",","comma",["punctuation"])}},{key:"period",value:function(){return this.constant(".","period",["punctuation"])}},{key:"star",value:function(){return this.constant("*","star",["punctuation"])}},{key:"colon",value:function(){return this.constant(":","colon",["punctuation"])}},{key:"openParen",value:function(){return this.constant("(","open paren",["punctuation"])}},{key:"closeParen",value:function(){return this.constant(")","close paren",["punctuation"])}},{key:"openBracket",value:function(){return this.constant("{","open bracket",["punctuation"])}},{key:"closeBracket",value:function(){return this.constant("}","close bracket",["punctuation"])}},{key:"openSquareBracket",value:function(){return this.constant("[","open square bracket",["punctuation"])}},{key:"closeSquareBracket",value:function(){return this.constant("]","close square bracket",["punctuation"])}},{key:"JsonString",value:function(){return{name:"string",regexp:/"(?:[^"\\]|\\.)*"/,consume:function(e){var t={success:!1};if(0!==e.indexOf('"'))return t;var n,r="",a=1,i=!1;do{switch(n=e[a],a+=1,n){case'"':i=!0;break;case"\\":var o=e[a];switch(a+=1,o){case'"':return t;case"t":r+="\t";break;case"r":r+="\r";break;case"n":r+="\n";break;case"u":var u=e.substr(a,4);if(4==u.length&&/\d{4}/.test(u)){a+=4;var c=parseInt(u,10),s=String.fromCharCode(c);r+=s}else r+="\\u";break;default:return t}break;default:r+=n}}while(!i);var f=e.substring(0,a),p={success:!0,consumed:f,content:r};return p}}}}]),e}(),p=function(){function e(){n(this,e)}return t(e,[{key:"initialize",value:function(e){if(!e)throw new c("No tokens provided to the parser");if(!(e instanceof Array))throw new c("A non-array was provided to the parser instead of a token array");this.tokens=e}},{key:"la1",value:function(e){if(this.eof())throw new c("No tokens available");return this.tokens[0].type==e}},{key:"match",value:function(e){if(this.eof())throw new c("Expected "+e+" but found EOF");if(!this.la1(e))throw new c("Expected "+e+" but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character);return this.tokens.shift()}},{key:"eof",value:function(){return 0===this.tokens.length}},{key:"expectEof",value:function(){if(!this.eof())throw new c("Expected EOF but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character)}}]),e}(),l=function(){function e(){n(this,e),this.line=1,this.character=1,this.justSeenSlashR=!1}return t(e,[{key:"consume",value:function(e){for(var t=0,n=e.length;t<n;t++)"\r"==e[t]?(this.line+=1,this.character=1,this.justSeenSlashR=!0):"\n"==e[t]?(this.justSeenSlashR||(this.line+=1),this.character=1,this.justSeenSlashR=!1):(this.character+=1,this.justSeenSlashR=!1)}}]),e}();e.PatternDefinitionException=o,e.LexerException=u,e.ParserException=c,e.Lexer=s,e.StandardTokenTypes=f,e.Parser=p,e.LineTracker=l})?r.apply(t,a):r)||(e.exports=i)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MARKTEXT",function(){return Le}),n.d(r,"UNMARKTEXT",function(){return _e}),n.d(r,"REPLACETEXT",function(){return Fe}),n.d(r,"REPLACELINE",function(){return De}),n.d(r,"DISPLAYINFO",function(){return Ue});var a=n(0),i=a.StandardTokenTypes,o=new a.Lexer({languageName:"atomiix"});o.addTokenType(i.whitespace()),o.addTokenType({name:"newline",regexp:/^\n[ \n]*/}),o.addTokenType({name:"comment",ignore:!0,regexp:/^\/\/[^\n]*/}),o.addTokenType(i.constant("->","play arrow")),o.addTokenType(i.constant(">>","double right arrow")),o.addTokenType(i.constant("<<","double left arrow")),o.addTokenType(i.constant("))","increase amplitude")),o.addTokenType(i.constant("((","decrease amplitude")),o.addTokenType(i.constant(":","colon")),o.addTokenType({name:"sustain multiplier",regexp:/^[_~]/}),o.addTokenType(i.openParen()),o.addTokenType(i.closeParen()),o.addTokenType({name:"operator",regexp:/^[*\/+\-!@]+/}),o.addTokenType({name:"beat",regexp:/^\d+(\.\d+)?b/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"number",regexp:/^\d+(\.\d+)?/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"identifier",regexp:/^[a-zA-Z][a-zA-Z0-9]*/}),o.addTokenType({name:"score",regexp:/^[{[\\|][a-zA-Z0-9 ]*[}\]\\|]/}),o.addTokenType({name:"score modifier",regexp:/^[<\\^][0-9]*[>\\^]/});var u=o,c="PROGRAM",s="PLAY",f="ADDFXCHAIN",p="RMFXCHAIN",l="INCRAMP",h="DECRAMP",m="COMMAND",d="FUTURE",y="GROUP",g="AGENT",v="SCORE",b="PERCUSSIVE",w="MELODIC",k="CONCRETE",T="SCOREOPERATOR",E="SCOREMODIFIER",x="PANNING",S="SUSTAIN",O="ATTACK",P="EFFECT",A="BEAT",N="NUMBER",C="STRING";function M(e){return{type:c,statements:e}}function j(e){return{type:l,agent:e}}function R(e){return{type:h,agent:e}}function I(e,t,n,r,a,i,o,u,c){return{type:v,scoreType:e,instrument:t,values:n,durations:r,offset:a,modifiers:i,scoreString:o,line:u,position:c}}function L(e){return{type:P,name:e}}function _(e,t){return{type:A,value:e,modifier:t}}function F(e,t){return{type:N,value:e,modifier:t}}function D(e,t,n){var r=t.content,i=r.charAt(0),o=r.slice(-1),u=!1;switch(i){case"|":u="|"===o;break;case"[":u="]"===o;break;case"{":u="}"===o}if(!u)throw new a.ParserException("Score delimiters don't match. Starts with ".concat(i," but ends with ").concat(o));var c,s=r.slice(1,-1);switch(i){case"|":if(e)throw new a.ParserException("Percussive score shouldn't have instrument: ".concat(e));return c=U(s),I(b,null,c.chars,c.durations,c.offset,n,r,t.line-1,t.character-1);case"[":if(!e)throw new a.ParserException("Melodic score should have an instrument");return c=U(s),I(w,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);case"{":if(!e)throw new a.ParserException("Concrete score should have an instrument");return c=U(s),I(k,e,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,n,r,t.line-1,t.character-1);default:throw new a.ParserException("".concat(i," is not a supported score delimiters"))}}function U(e){for(var t=[],n=[],r=0,a="",i=0,o=0;o<e.length;o+=1){var u=e[o];" "!==u?(""===a?r=i:(t.push(a),n.push(i)),a=u,i=1):i+=1}return""!=a&&(t.push(a),n.push(i+r)),{chars:t,durations:n,offset:r}}function X(e){var t,n=e.charAt(0),r=e.slice(-1),i=!1;switch(n){case"<":t=x,i=">"===r;break;case"^":t=O,i="^"===r}if(!i)throw new a.ParserException("Score modifier delimiters don't match. Starts with ".concat(n," but ends with ").concat(r));return function(e,t){return{type:E,modifierType:e,values:t}}(t,e.slice(1,-1).split("").map(function(e){return parseInt(e,10)}))}var G=new a.Parser;function z(e){return t=e.content,n=e.line-1,r=e.character-1,{type:g,name:t,line:n,position:r};var t,n,r}G.parse=function(e){var t=u.tokenize(e);return this.initialize(t),this.program()},G.program=function(){for(var e=[];!this.eof();)this.la1("newline")?this.match("newline"):e.push(this.statement());return M(e)},G.statement=function(){var e=this.match("identifier");if(!this.eof()&&this.la1("play arrow")){this.match("play arrow");var t=this.score();return function(e,t){return{type:s,agent:e,score:t}}(z(e),t)}if(!this.eof()&&this.la1("double right arrow"))return this.addEffectsChain(z(e));if(!this.eof()&&this.la1("double left arrow"))return this.removeEffectsChain(z(e));if(!this.eof()&&this.la1("increase amplitude"))return this.match("increase amplitude"),j(z(e));if(!this.eof()&&this.la1("decrease amplitude"))return this.match("decrease amplitude"),R(z(e));switch(e.content){case"group":return this.group(e);case"future":return this.future(e);case"sequence":throw new a.ParserException("No support for sequence yet");default:return this.command(e)}},G.score=function(){var e="";return this.la1("identifier")&&(e=this.match("identifier").content),D(e,this.match("score"),this.scoreModifiers())},G.scoreModifiers=function(){for(var e=[];!this.eof()&&!this.la1("newline");)if(this.la1("operator")){var t=this.scoreOperator();e.push(t)}else if(this.la1("score modifier")){var n=X(this.match("score modifier").content);e.push(n)}else{if(!this.la1("open paren"))throw new a.ParserException("Unexpected token: Expecting operator or score modifier");var r=this.sustainModifier();e.push(r)}return e},G.sustainModifier=function(){var e=null;this.match("open paren");var t=this.match("number").content;return this.la1("sustain multiplier")&&(this.match("sustain multiplier"),e=this.match("number").content),this.match("close paren"),function(e,t){return{type:E,modifierType:S,noteLength:e,multiplier:t}}(t,e)},G.scoreOperator=function(){return function(e,t){return{type:T,operator:e,value:t}}(this.match("operator").content,this.match("number").content)},G.addEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double right arrow");){this.match("double right arrow");var n=this.match("identifier").content;t.push(L(n))}return function(e,t){return{type:f,agent:e,effects:t}}(e,t)},G.removeEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double left arrow")&&(this.match("double left arrow"),!this.eof()&&this.la1("identifier")||0!==t.length);){var n=this.match("identifier").content;t.push(L(n))}return function(e,t){return{type:p,agent:e,effects:t}}(e,t)},G.future=function(e){var t,n;if(this.la1("number")){var r,a=this.match("number").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t=F(a,r)}else if(this.la1("beat")){var i,o=this.match("beat").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),i=this.match("number").content),t=_(o,i)}if(this.match("double right arrow"),this.la1("increase amplitude"))this.match("increase amplitude"),n=j(z(this.match("identifier")));else if(this.la1("decrease amplitude")){this.match("decrease amplitude"),n=R(z(this.match("identifier")))}else if(this.la1("identifier")){var u=this.match("identifier");n=this.command(u)}return function(e,t,n){return{type:d,timing:e,command:t,line:n}}(t,n,e.line-1)},G.command=function(e){for(var t=[];!this.eof()&&!this.la1("newline");)if(this.la1("number")){var n=this.match("number").content,r=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t.push(F(n,r))}else if(this.la1("beat")){var i=this.match("beat").content,o=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),o=this.match("number").content),t.push(_(i,o))}else{if(!this.la1("identifier"))throw new a.ParserException("Expected number or string");var u=this.match("identifier").content;t.push({type:C,value:u})}return function(e,t,n,r){return{type:m,name:e,args:t,line:n,position:r}}(e.content,t,e.line-1,e.character-1)},G.group=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException("Expected agent name");t.push(this.match("identifier").content)}return function(e,t){return{type:y,name:e,agents:t}}(e,t)};var B=G,K={names:{major:"major",minor:"minor",melodicMinor:"melMi",harmonicMinor:"harMi",diminished:"dimin",wholeTone:"whlTn",blues:"blues",minorPentatonic:"minPn",majorPentatonic:"majPn",hungarianMinor:"hngMi",persian:"persn",hirojoshi:"hiroj",arabian:"arabn"},notes:{major:[0,0,2,4,5,7,9,11,12,14],minor:[0,0,2,3,5,7,8,10,12,14],melMi:[0,0,2,3,5,7,9,11,13,14],harMi:[0,0,2,3,5,7,8,11,12,14],dimin:[0,0,2,3,5,6,8,9,11,12],whlTn:[0,0,2,4,6,8,10,12,14,16],blues:[0,0,3,5,6,7,10,12,15,17],minPn:[0,0,3,5,7,10,12,15,17,19],majPn:[0,0,2,4,7,9,12,14,16,19],hngMi:[0,0,2,3,6,7,8,11,12,14],persn:[0,0,1,4,5,6,8,11,12,13],hiroj:[0,0,2,3,7,8,12,14,15,19],arabn:[0,0,2,4,5,6,8,10,12,14]}},q="AtomiixRuntimeError",Y="AtomiixOSCError",H="EDITORACTION",Z="AUDIOACTION",V="INBOUNDACTION",$="AGENTMETHOD",J="FREEAGENT",W="NAPAGENT",Q="ADDAGENTFX",ee="RMAGENTFX",te="SETAGENTAMP",ne="SETTEMPO",re="FUTURECALLBACK",ae="PLAYPERCUSSIVE",ie="PLAYMELODIC",oe="PLAYCONCRETE";function ue(e,t){return{type:Z,actionType:$,agent:e,method:t}}function ce(e){return{type:Z,actionType:J,agent:e}}function se(e,t){return{type:Z,actionType:Q,agent:e,fxList:t}}function fe(e,t){return{type:Z,actionType:ee,agent:e,fxList:t}}function pe(e,t){return{type:Z,actionType:te,agent:e,amplitude:t}}function le(e,t,n,r){return{type:Z,actionType:re,time:e,timeType:t,repeats:n,callbackID:r}}function he(e,t){return{type:Z,actionType:ae,agent:e,notes:t.notes,durations:t.durations,instruments:t.instruments,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function me(e,t){return{type:Z,actionType:ie,agent:e,notes:t.notes,durations:t.durations,instrument:t.instrument,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function de(e,t){return{type:Z,actionType:oe,agent:e,pitch:t.pitch,amplitudes:t.amplitudes,durations:t.durations,instrument:t.instrument,panning:t.panning,offset:t.offset,repeats:t.repeats}}function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function be(e,t,n){return t&&ve(e.prototype,t),n&&ve(e,n),e}function we(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?ke(e):t}function ke(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Te(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Se(e,t)}function Ee(e){var t="function"==typeof Map?new Map:void 0;return(Ee=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return xe(e,arguments,Oe(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Se(r,e)})(e)}function xe(e,t,n){return(xe=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&Se(a,n.prototype),a}).apply(null,arguments)}function Se(e,t){return(Se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Oe(e){return(Oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=function(e){function t(e,n,r){var a;return ge(this,t),(a=we(this,Oe(t).call(this,e))).name=q,a.lineNumber=n,a.inCallback=r,a.setLineNumber=a.setLineNumber.bind(ke(a)),a.setCallbackStatus=a.setCallbackStatus.bind(ke(a)),a.formattedMessage=a.formattedMessage.bind(ke(a)),a}return Te(t,Ee(Error)),be(t,[{key:"setLineNumber",value:function(e){this.lineNumber=e}},{key:"setCallbackStatus",value:function(e){this.inCallback=e}},{key:"formattedMessage",value:function(){var e="";void 0!==this.lineNumber&&(e=" on line ".concat(this.lineNumber));var t="";return this.inCallback&&(t=" in callback"),"Error".concat(t).concat(e,": ").concat(this.message)}}]),t}(),Ae=function(e){function t(e){var n;return ge(this,t),(n=we(this,Oe(t).call(this,e))).name=Y,n.formattedMessage=n.formattedMessage.bind(ke(n)),n}return Te(t,Ee(Error)),be(t,[{key:"formattedMessage",value:function(){return"OSCError: ".concat(this.message)}}]),t}();function Ne(e,t,n){if(t.length<n)throw new Pe("".concat(e," expected at least ").concat(n," arguments"))}function Ce(e,t){if(t.type!==C)throw new Pe("".concat(e," expected String but got ").concat(t.type));return t.value}function Me(e,t){if(t.type!==N)throw new Pe("".concat(e," expected Number but got ").concat(t.type));return t.value}function je(e,t,n){return void 0===t?n:Me(e,t)}function Re(e,t,n){var r=[];return e.groups[t]?(e.groups[t].forEach(function(t){r=r.concat(n(e,t))}),r):n(e,t)}function Ie(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Ce(n,r[0]),i=K.names[a];i?e.scale=i:e.logger.warn("".concat(n,": ").concat(a," is not a valid scale name"))}var Le="MARKTEXT",_e="UNMARKTEXT",Fe="REPLACETEXT",De="REPLACELINE",Ue="DISPLAYINFO";function Xe(e,t,n){var r=[],a=Ke(e,t),i=a.score,o=n(i);r.push(function(e,t){return{type:H,actionType:Fe,group:e,sections:{score:t}}}(t,o));var u={content:o,line:i.line,character:i.position},c=D(i.instrument,u,i.modifiers);return a.score=c,a.playing&&(r=r.concat(Ve(e,t))),r}var Ge=/^[A-Z]/,ze=/^[a-z]/;var Be={doze:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Re(e,Ce(n,r[0]),function(e,t){var r=[],a=Ke(e,t);return a&&(a.playing=!1,r.push(ue(t,n))),r})},wake:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Re(e,Ce(n,r[0]),function(e,t){var r=[],a=Ke(e,t);return a&&(a.playing=!1,r.push(ue(t,n))),r})},nap:function(e,t){var n=t.name,r=t.args;Ne(n,r,2);var a=Ce(n,r[0]),i=r[1],o=i.value,u=i.type===A?"beats":"seconds",c=i.modifier||1;return Re(e,a,function(e,t){var n=[],r=Ke(e,t);return r&&(r.playing=!1,n.push(function(e,t,n,r){return{type:Z,actionType:W,agent:e,time:t,timeType:n,repeats:r}}(t,o,u,c))),n})},kill:function(e,t){return Ne(t.name,t.args,0),Object.keys(e.agents).map(function(t){return e.agents[t].playing=!1,ce(t)})},scale:Ie,scalepush:function(e,t){Ie(e,t);var n=[];return Object.keys(e.agents).forEach(function(t){Ke(e,t).playing&&(n=n.concat(Ve(e,t)))}),n},tonic:function(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Me(n,r[0]);e.tonic=Math.floor(a)},tempo:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),function(e,t){return{type:Z,actionType:ne,tempo:e,glide:t}}(Me(n,r[0]),r[0].modifier)},shake:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").sort(function(){return.5-Math.random()}).join("")+r})},reverse:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").reverse().join("")+r})},shiftr:function(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Ce(n,r[0]),i=je(n,r[1],1);return Xe(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.slice(0,-i);return n+a.substr(a.length-i)+o+r})},shiftl:function(e,t){var n=t.name,r=t.args;Ne(n,r,1);var a=Ce(n,r[0]),i=je(n,r[1],1);return Xe(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.substr(0,i);return n+a.slice(i)+o+r})},up:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toUpperCase()})},down:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){return e.scoreType!=b?e.scoreString:e.scoreString.toLowerCase()})},yoyo:function(e,t){var n=t.name,r=t.args;return Ne(n,r,1),Xe(e,Ce(n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return Ge.test(e)?e.toLowerCase():ze.test(e)?e.toUpperCase():e}).join("")+r})},grid:function(e,t,n){var r=t.name,a=t.args,i=t.line,o=[];Ne(r,a,1);var u=Math.floor(Me(r,a[0])),c=Math.floor(70/u),s=" |"+(" ".repeat(u-1)+"|").repeat(c);return o.push({type:H,actionType:De,line:i+n,text:s}),o},remind:function(){var e,t=Object.keys(Be).join("\n");return[(e=t,{type:H,actionType:Ue,info:e})]}};function Ke(e,t){var n=e.agents[t];if(!n)throw new Pe("No agent called ".concat(t));return n}function qe(e,t,n,r){if(e.groups[t.name])throw new Pe("".concat(t.name," is already the name of a group"));var a,i,o,u,c,s,f=[];return t.line=t.line+r,n.line=n.line+r,e.agents[t.name]={agent:t,score:n,playing:!0,amplitude:.5},f.push((a=t.name,i=t.line,o=t.position,u=t.position+t.name.length,c=n.position,s=n.position+n.scoreString.length,{type:H,actionType:Le,group:a,sections:{agent:{line:i,start:o,finish:u},score:{line:i,start:c,finish:s}}})),f}function Ye(e,t){var n=[],r=e.agents[t];return r&&(n.push(function(e){return{type:H,actionType:_e,group:e}}(r.agent.name)),delete e.agents[t]),n}function He(e,t){switch(t.type){case s:return t.agent;default:return null}}function Ze(e,t){var n=function(e,t){for(var n=[],r=0;r<t.statements.length;r+=1){var a=He(0,t.statements[r]);a&&n.push(a.name)}return{agentNames:n}}(0,t).agentNames,r=[];return n.forEach(function(t){r.push(ce(t)),r=r.concat(Ye(e,t))}),r}function Ve(e,t){var n=e.agents[t];if(!n)throw new Pe("No agent called ".concat(t));return Qe(e,n.agent,n.score)}function $e(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],a=0;a<t.statements.length;a+=1){var i=t.statements[a],o=void 0;try{o=Je(e,i,n)}catch(e){if(e.name===q)throw e.setLineNumber(n+a),e}o&&(r=r.concat(o))}return r}function Je(e,t,n){switch(t.type){case s:return function(e,t,n){var r=t.agent,a=t.score,i=[];a.durations.length>0?i=(i=i.concat(Qe(e,r,a))).concat(qe(e,r,a,n)):(i.push(ce(r.name)),i=i.concat(Ye(e,r.name)));return i}(e,t,n);case f:return a=(r=t).agent,i=r.effects,[se(a.name,i.map(function(e){return e.name}))];case p:return function(e,t){var n=t.agent,r=t.effects;return[fe(n.name,r.map(function(e){return e.name}))]}(0,t);case l:return We(e,t,.1);case h:return We(e,t,-.1);case m:return function(e,t,n){var r=t.name,a=e.stdlib[r];if(!a)throw new Pe("".concat(r," is not an existing command"));return a(e,t,n)}(e,t,n);case d:return function(e,t,n){var r=Math.random().toString(36).substring(7)+e.lastCallbackID;e.lastCallbackID+=1,e.callbacks[r]={command:M([t.command]),line:t.line+n};var a="seconds";t.timing.type===A&&(a="beats");var i=1;t.timing.modifier&&(i=t.timing.modifier);return[le(t.timing.value,a,i,r)]}(e,t,n);case y:return function(e,t){var n=t.name,r=t.agents;if(e.agents[n])throw new Pe("".concat(n," is already the name of an agent"));if(e.groups[n])throw new Pe("".concat(n," is already the name of a group"));var a=r.map(function(t){return Ke(e,t),t});return e.groups[n]=a,[]}(e,t);default:throw new Pe("".concat(t.type," is not a supported statement type"))}var r,a,i}function We(e,t,n){var r=t.agent,a=e.agents[r.name];if(a)return a.amplitude=a.amplitude+n,[pe(r.name,a.amplitude)]}function Qe(e,t,n){var r=n.scoreType;switch(r){case b:return function(e,t,n){var r=et(e,[60],n.durations,n.modifiers),a=r.notes,i=r.durations,o=r.sustain,u=r.attack,c=r.panning,s=r.repeats,f=n.values,p=n.offset/4,l=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:b,notes:e,durations:t,instruments:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(a,i,f,o,u,c,p,s);return[he(t.name,l)]}(e,t,n);case w:return function(e,t,n){var r=n.values.map(function(t){return function(e,t){return e.tonic+K.notes[e.scale][t]}(e,t)}),a=et(e,r,n.durations,n.modifiers),i=a.notes,o=a.durations,u=a.sustain,c=a.attack,s=a.panning,f=a.repeats,p=n.instrument,l=n.offset/4,h=function(e,t,n,r,a,i,o,u){return{type:v,scoreType:w,notes:e,durations:t,instrument:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(i,o,p,u,c,s,l,f);return[me(t.name,h)]}(e,t,n);case k:return function(e,t,n){var r=et(e,[],n.durations,n.modifiers),a=r.durations,i=r.panning,o=r.repeats,u=n.values.map(function(e){return e/10}),c=n.instrument,s=n.offset/4,f=function(e,t,n,r,a,i,o){return{type:v,scoreType:k,pitch:e,amplitudes:t,durations:n,instrument:r,panning:a,offset:i,repeats:o}}(60,u,a,c,i,s,o);return[de(t.name,f)]}(e,t,n);default:throw new Pe("".concat(r," is not a supported score type"))}}function et(e,t,n,r){for(var a=t,i=n,o=[.25],u=[5],c=[0],s=1,f=0,p="inf",l=function(e){var t=r[e];if(t.type===E)switch(t.modifierType){case x:c=t.values.map(function(e){return(e-1)/4-1});break;case S:o=[1/t.noteLength*(t.multiplier||1)];break;case O:u=t.values}else if(t.type===T)switch(t.operator){case"+":a=a.map(function(e){return e+t.value});break;case"-":a=a.map(function(e){return e-t.value});break;case"*":s=t.value;break;case"/":s=1/t.value;break;case"!":f=t.value;break;case"@":p=t.value}},h=0;h<r.length;h+=1)l(h);return i[i.length-1]+=f,i=i.map(function(e){return e/4}).map(function(e){return e*s}),u=u.map(function(e){return e/9}),{notes:a,durations:i,sustain:o,attack:u,panning:c,silences:f,timestretch:s,repeats:p}}var tt="AGENTFINISHED",nt="CALLBACKTRIGGER";function rt(e,t){switch(t.actionType){case tt:return function(e,t){var n=t.name;return e.logger.info("Marking agent ".concat(n," as finished")),function(e,t){var n=e.agents[t];n&&(n.playing=!1)}(e,n),[]}(e,t);case nt:return function(e,t){var n=t.callbackId,r=t.remaining,a=[],i=e.callbacks[n];if(!i)return e.logger.error("Error: no callback with id ".concat(n)),a;try{a=$e(e,i.command,null)}catch(e){if(e.name===q)throw e.setCallbackStatus(!0),e.setLineNumber(void 0),e}r<1&&delete e.callbacks[n];return a}(e,t);default:e.logger.warning("".concat(t.actionType," is an unknown action type"))}return[]}var at={playPattern:"/play/pattern",command:"/command",agentAmplitude:"/agent/amplitude",addFX:"/agent/effects/add",rmFX:"/agent/effects/remove",tempo:"/tempo",callback:"/callback"};function it(e,t){switch(t.actionType){case $:return n=e.command,a=(r=t).agent,i=r.method,ct(n,[{type:"string",value:i},{type:"string",value:a}]);case J:return function(e,t){var n=t.agent;return ct(e,[{type:"string",value:"free"},{type:"string",value:n}])}(e.command,t);case W:return function(e,t){var n=t.agent,r=t.time,a=t.timeType,i=t.repeats;return ct(e,[{type:"string",value:"nap"},{type:"string",value:n},{type:"float",value:r},{type:"string",value:a},{type:"integer",value:i}])}(e.command,t);case Q:return function(e,t){var n=t.agent,r=t.fxList;return ct(e,[{type:"string",value:n},{type:"array",value:r}])}(e.addFX,t);case ee:return function(e,t){var n=t.agent,r=t.fxList;return ct(e,[{type:"string",value:n},{type:"array",value:r}])}(e.rmFX,t);case te:return function(e,t){var n=t.agent,r=t.amplitude;return ct(e,[{type:"string",value:n},{type:"float",value:r}])}(e.agentAmplitude,t);case ne:return function(e,t){var n=t.tempo,r=t.glide,a=[{type:"float",value:n}];r&&a.push({type:"float",value:r});return ct(e,a)}(e.tempo,t);case re:return function(e,t){var n=t.time,r=t.timeType,a=t.repeats,i=t.callbackID;return ct(e,[{type:"float",value:n},{type:"string",value:r},{type:"integer",value:a},{type:"string",value:i}])}(e.callback,t);case ae:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"percussive"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"array",value:t.instruments},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return ct(e,r)}(e.playPattern,t);case ie:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"melodic"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return ct(e,r)}(e.playPattern,t);case oe:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"concrete"},{type:"string",value:t.agent},{type:"integer",value:t.pitch},{type:"array",value:t.amplitudes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.panning},{type:"integer",value:t.offset},n];return ct(e,r)}(e.playPattern,t)}var n,r,a,i}var ot={agentFinished:"/finished",callback:"/callback"};function ut(e,t){switch(t.address){case e.agentFinished:return function(e){return t=st(e,0),{type:V,actionType:tt,name:t};var t}(t);case e.callback:return function(e){var t=st(e,0),n=function(e,t){var n=e.args[t];if("float"!==n.type&&"integer"!==n.type)throw new Ae("Expected Float or Integer but got ".concat(n.type));return n.value}(e,1);return function(e,t){return{type:V,actionType:nt,callbackId:e,remaining:t}}(t,n)}(t);default:throw new Ae("".concat(t.address," is not a valid incoming address"))}}function ct(e,t){return{oscType:"message",address:e,args:t}}function st(e,t){var n=e.args[t];if("string"!==n.type)throw new Ae("Expected String but got ".concat(n.type));return n.value}function ft(e){var t={audio:[],editor:[]};return e.forEach(function(e){e.type===Z?t.audio.push(e):e.type===H&&t.editor.push(e)}),t}function pt(e,t){switch(t.name){case q:case Y:e.logger.error(t.formattedMessage())}return{audio:[],editor:[]}}t.default={editorActions:r,init:function(e){var t=e||{info:console.log,warn:console.log,error:console.log};return{scale:K.names.major,tonic:60,bpm:120,stdlib:Be,agents:{},groups:{},callbacks:{},lastCallbackID:0,logger:t}},evaluate:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;try{return ft($e(e,B.parse(t),n))}catch(t){return pt(e,t)}},free:function(e,t){try{return ft(Ze(e,B.parse(t)))}catch(t){return pt(e,t)}},handleAction:rt,incomingAction:function(e,t){try{return ft(rt(e,t))}catch(t){return pt(e,t)}},actionToOSC:function(e){return e.map(function(e){return it(at,e)})},oscToAction:function(e){return ut(ot,e)}}}])});
//# sourceMappingURL=atomiix.min.js.map
{
"name": "@atomiix/atomiix",
"version": "1.1.1",
"version": "1.1.2",
"description": "A live coding language based on Ixilang",

@@ -5,0 +5,0 @@ "main": "lib/atomiix.min.js",

@@ -15,3 +15,3 @@ import atomiix from './index.js';

[60],
[2 / 4, 3 / 4, 9 / 4],
[2 / 4, 3 / 4, 11 / 4],
['a', 'b', 'c'],

@@ -38,3 +38,3 @@ [0.25],

[0.2, 0.6],
[3 / 4, 1 / 4],
[3 / 4, 2 / 4],
'sea',

@@ -83,3 +83,3 @@ [-0.5, 0.5],

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -107,3 +107,3 @@ [0.25],

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -131,3 +131,3 @@ [0.25],

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -155,3 +155,3 @@ [0.25],

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -158,0 +158,0 @@ [0.25],

@@ -115,3 +115,5 @@ import { ParserException } from 'canto34';

chars.push(current);
durations.push(spaces);
// add the duration of any beginning
// spaces to the final chars duration
durations.push(spaces + offset);
}

@@ -118,0 +120,0 @@ return {

@@ -13,3 +13,3 @@ import { scoreParser, scoreModifierParser } from './scoreParser';

['a', 'b', 'c', 'd'],
[2, 3, 1, 3],
[2, 3, 1, 5],
2,

@@ -31,3 +31,3 @@ [],

[1, 3, 5, 7],
[2, 3, 1, 3],
[2, 3, 1, 5],
2,

@@ -49,3 +49,3 @@ [],

[1, 3, 5, 7],
[2, 3, 1, 3],
[2, 3, 1, 5],
2,

@@ -52,0 +52,0 @@ [],

@@ -14,3 +14,3 @@ import atomiix from '../../index.js';

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -51,3 +51,3 @@ [0.25],

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -63,3 +63,3 @@ [0.25],

[60],
[3 / 4, 2 / 4, 2 / 4],
[3 / 4, 2 / 4, 3 / 4],
['c', 'a', 'b'],

@@ -89,3 +89,3 @@ [0.25],

[60],
[2 / 4, 3 / 4, 1 / 4],
[2 / 4, 3 / 4, 3 / 4],
['a', 'b', 'c'],

@@ -92,0 +92,0 @@ [0.25],

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc