-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdms-compiler.js
8 lines (8 loc) · 47.8 KB
/
dms-compiler.js
1
2
3
4
5
6
7
8
var Compiler=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){const n=r(1),{renameIdentifier:i}=r(8);class o{constructor(t){this.src=t,this.ast=n(t)}compileFork(t){let e={"@fork":t.conditions.map(t=>{let e=this.compile(t.body);return t.condition&&(e.if=this.compile(t.condition)),e})};return t.scheme&&(e.scheme=this.compileObject(t.scheme)),e}compileInput(t){i(t.fork,t.result.name,"_nlu");let e=this.compileFork(t.fork);return e.await=["input"],e}compileAwait(t){let e=this.compile(t.body);return e.await=this.compile(t.condition),e}compileOnce(t){let e=this.compile(t.body);return e.once=!0,e}compileAct(t){return{"@act":this.compile(t.value)}}compileHop(t){return{"@hop":this.compile(t.value)}}compilePop(t){return{"@pop":this.compile(t.value)}}compileStatementList(t){return{"@do":t.list.map(t=>this.compile(t))}}compileLiteral(t){return"string"==typeof t.value?"`"+t.value+"`":t.value}compileArray(t){return["",...t.elements.map(t=>this.compile(t))].reduce((t,e)=>e&&e.__spread?[...t,...e.elements]:(t.push(e),t),[])}compileSpread(t){return{...t,__spread:!0}}compileStringArray(t){return["",...t.elements.map(t=>"`"+this.compile(t)+"`")]}compileEditReference(t,e){return["`edit`",this.compile(t.target),this.compile(e),...t.keys.map(t=>this.compile(t))]}compileObject(t){return t.properties.reduce((t,e)=>(t[this.compileLiteral(e.name)]=this.compile(e.value),t),{})}compileSet(t){let e,r;return"Identifier"===t.target.type?(e="`"+t.target.name+"`",r=this.compile(t.value)):"EditReference"===t.target.type?(e="`"+this.compile(t.target.target)+"`",r=this.compileEditReference(t.target,t.value)):(e=this.compileStringArray(t.target),2==e.length&&(e=e[1]),r=this.compile(t.value)),{"@set":e,val:r}}compileRun(t){let e=null;return t.result&&(t.fork?i(t.fork,t.result.name,"_return"):t.fork={type:"Fork",conditions:[{type:"ForkBranch",body:{type:"StatementList",list:[{type:"Set",target:{type:"CSArray",elements:[{type:"Identifier",name:t.result.name}]},value:{type:"Identifier",name:"_return"}}]}}]},e=this.compileFork(t.fork),e.await=["return"]),{"@do":[{"@run":this.compile(t.name),args:["",...t.args.map(t=>this.compile(t))]},e].filter(Boolean)}}compileUse(t){return{"@use":this.compile(t.name),import:["",...t.imports.map(t=>this.compile(t))]}}compileDef(t){return{"@def":["","`"+this.compile(t.name)+"`",...t.args.map(t=>"`"+t.name+"`")],val:this.compile(t.body)}}compileBinOp(t){return["is"==t.op?"==":t.op,this.compile(t.left),this.compile(t.right)]}compileUnaryOp(t){return[t.op,this.compile(t.target)]}compileFunCall(t){if("Identifier"===t.callee.type)switch(t.callee.name){case"exists":return["?",this.compile(t.args[0])];case"pref":return function(t,e){let r=t.args.length>1?t.args[1].elements.map(t=>{if("string"!=typeof t.value)throw new Error("pref array must only contain strings");return t.value}):t.args[0].properties.map(t=>t.name.value);function n(t,e){let{value:r}=t;if("boolean"==typeof r)return{...t,value:!r};if("number"==typeof r){let n=0===r?1:3*r;return{...t,value:"up"===e?r+n:r-n}}}function i(t,e){return{...t,properties:t.properties.map(t=>{if("boolean"!=typeof t.value.value&&"number"!=typeof t.value.value)throw new Error("pref must be passed an object with static true/false values or numbers");return r.includes(t.name.value)?{...t,value:n(t.value,e)}:t})}}return t.args[0].properties.find(t=>"number"==typeof t.value.value)?e({type:"Spread",elements:[["",e(t.args[0]),e(i(t.args[0],"up"))],["",e(t.args[0]),e(i(t.args[0],"down"))]]}):["",e(t.args[0]),e(i(t.args[0]))]}(t,this.compile.bind(this))}return[this.compile(t.callee),...t.args.map(t=>this.compile(t))]}compileMember(t){return["get",this.compile(t.property),this.compile(t.target)]}compileIdentifier(t){return"null"===t.name?null:t.name}compileProgram(t){return this.compile(t.body)}compile(t){if(!t||!t.type)throw new Error("Invalid node: "+JSON.stringify(t));let e=this["compile"+t.type];if(!e)throw new Error("Unknown node type: "+JSON.stringify(t));return e.call(this,t)}getSource(){return this.compile(this.ast)}}t.exports=function(t){let e=new o(t).getSource();return e["@do"]&&1===e["@do"].length&&e["@do"][0]["@fork"]&&1===e["@do"][0]["@fork"].length?e["@do"][0]["@fork"][0]:e}},function(t,e,r){const n=r(2);function i(t){let e={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};return t.replace(/\\(u[0-9a-fA-F]{4}|[^u])/,(t,r)=>{let n=r.charAt(0),i=r.slice(1);return"u"===n?String.fromCharCode(parseInt(i,16)):e.hasOwnProperty(n)?e[n]:n})}let o=n.createLanguage({Whitespace:t=>n.regex(/^(\s*(\/\/.*)?\s*)*/),Scheme:t=>n.seq(n.string("#"),t.Object,n.optWhitespace).map(t=>t[1]).fallback(""),If:t=>n.seq(t.Scheme,n.string("if"),n.whitespace,t.Expression,n.optWhitespace,t.Block,n.seq(t.Whitespace,n.string("else"),t.Whitespace).then(t.Block.or(t.If)).fallback("")).map(t=>{let e=[{type:"ForkBranch",condition:t[3],body:t[5]}];return""!==t[6]&&(e="Fork"===t[6].type?[...e,...t[6].conditions]:[...e,{type:"ForkBranch",condition:null,body:t[6]}]),{type:"Fork",scheme:t[0],conditions:e}}),Fork:t=>n.seq(t.Scheme,n.string("fork"),n.optWhitespace,n.string("{"),t.Condition.many(),n.string("}")).map(t=>({type:"Fork",scheme:t[0],conditions:t[4].map(t=>{if("_"!==t[0]&&t[0][0])throw new Error(t[0][0]);return{type:"ForkBranch",condition:"_"===t[0]?null:t[0][1],body:t[1]}})})),Condition:t=>n.seq(n.string("_").or(n.seq(n.string("if").then(n((t,e)=>n.makeSuccess(e,function(t,e,r){let n=e+t.slice(e).indexOf("\n"),i=t.slice(0,n).split("\n");return r+"\n Line "+i.length+": "+i[i.length-1].replace(/^\s*/,"")+"\n"}(t,e,"conditions do not need an `if`, remove it: ")))).skip(n.optWhitespace).fallback(null),t.Expression)).trim(t.Whitespace),t.Block.trim(t.Whitespace)),Input:t=>n.seq(n.string("input"),n.optWhitespace,n.string("->"),n.optWhitespace,t.Symbol,n.optWhitespace,n.string("{"),n.seq(n.string("_").or(t.Expression).trim(t.Whitespace),t.Block.trim(t.Whitespace)).many(),n.string("}")).map(t=>({type:"Input",result:t[4],fork:{type:"Fork",conditions:t[7].map(t=>({type:"ForkBranch",condition:"_"===t[0]?null:t[0],body:t[1]}))}})),Await:t=>n.seq(n.string("await"),n.whitespace,t.Expression,n.optWhitespace,t.Block).map(t=>({type:"Await",condition:t[2],body:t[4]})),Once:t=>n.seq(n.string("once"),n.optWhitespace,t.Block).map(t=>({type:"Once",body:t[2]})),Act:t=>n.seq(n.string("act"),n.whitespace,t.Expression).map(t=>({type:"Act",value:t[2]})),Hop:t=>n.seq(n.string("hop"),n.whitespace,t.Expression).map(t=>({type:"Hop",value:t[2]})),Pop:t=>n.seq(n.string("pop"),n.whitespace,t.Expression).map(t=>({type:"Pop",value:t[2]})),Set:t=>n.seq(n.alt(t.EditReference,t.CSArray),n.optWhitespace,n.string("="),n.optWhitespace,t.Expression).map(t=>({type:"Set",target:t[0],value:t[4]})),Run:t=>n.seq(n.string("run").skip(n.optWhitespace),t.Expression.skip(n.optWhitespace),n.seq(n.string("("),t.Expression.sepBy(n.string(",")),n.string(")").trim(n.optWhitespace),n.seq(n.string("->"),t.Symbol.trim(n.optWhitespace),n.seq(n.string("{"),t.Condition.many(),n.string("}")).fallback(null)).fallback(null)).fallback(null)).map(t=>{let e=t[2],r=e&&e[3],n=e&&r&&r[2];return{type:"Run",name:t[1],args:e?e[1]:[],result:e&&r&&r[1],fork:n&&{type:"Fork",conditions:n[1].map(t=>({type:"ForkBranch",condition:"_"===t[0]?null:t[0][1],body:t[1]}))}}}),Use:t=>n.seq(n.string("use"),n.whitespace,t.String,n.whitespace,n.string("import"),t.Symbol.trim(n.optWhitespace).sepBy(n.string(","))).map(t=>({type:"Use",name:t[2],imports:t[5].map(t=>({type:"Literal",value:t.name}))})),Def:t=>n.seq(n.string("def"),n.whitespace,t.Symbol,n.optWhitespace,n.string("("),t.Symbol.trim(n.optWhitespace).sepBy(n.string(",")),n.string(")"),n.optWhitespace,t.Block).map(t=>({type:"Def",name:t[2],args:t[5],body:t[8]})),Boolean:t=>n.alt(n.string("true"),n.string("false")).map(t=>({type:"Literal",value:"true"===t})),String:t=>n.regexp(/"((?:\\.|.)*?)"/,1).map(i).desc("string").map(t=>({type:"Literal",value:t})),NoQuoteObjectKey:t=>n.regexp(/[a-zA-Z0-9_]*/).map(i).desc("NoQuoteObjectKey").map(t=>({type:"Literal",value:t.toString()})),Number:t=>n.regexp(/(-?)[0-9.]+/).map(Number).desc("number").map(t=>({type:"Literal",value:t})),EditReference:t=>n.seq(t.Symbol,t.MemberPostFix.atLeast(1)).map(([t,e])=>({type:"EditReference",target:t,keys:e.reduce((t,e)=>(t.push(e.property),t),[])})),CSArray:t=>n.seq(t.Whitespace,t.Expression,t.Whitespace).sepBy(n.string(",")).map(t=>({type:"CSArray",elements:t.map(t=>t[1])})),Array:t=>n.string("[").then(n.seq(t.Whitespace,t.Expression,t.Whitespace).sepBy(n.string(","))).map(t=>({type:"Array",elements:t.map(t=>t[1])})).skip(n.string("]")),Object:t=>n.string("{").then(n.seq(t.Whitespace,n.alt(t.String,t.NoQuoteObjectKey),n.optWhitespace,n.string(":"),t.Whitespace,t.Expression,t.Whitespace).sepBy(n.string(","))).map(t=>({type:"Object",properties:t.map(t=>({type:"Property",name:t[1],value:t[5]}))})).skip(n.string("}")),Symbol:function(){return n.regexp(/[a-zA-Z_][a-zA-Z0-9_]*/).desc("symbol").map(t=>({type:"Identifier",name:t}))},BinOp:t=>[n.alt(n.string("*").trim(t.Whitespace),n.string("/").trim(t.Whitespace)),n.alt(n.string("++").trim(t.Whitespace),n.string("+").trim(t.Whitespace),n.string("-").trim(t.Whitespace),n.string("%").trim(t.Whitespace)),n.alt(n.string("<=").trim(t.Whitespace),n.string(">=").trim(t.Whitespace),n.string("==").trim(t.Whitespace),n.string("<").trim(t.Whitespace),n.string(">").trim(t.Whitespace),n.string("!=").trim(t.Whitespace)),n.string("in").skip(n.whitespace).trim(t.Whitespace),n.string("is").skip(n.whitespace).trim(t.Whitespace),n.string("||").trim(t.Whitespace),n.string("&&").trim(t.Whitespace)].reduce((t,e)=>{return r=e,i=t,n.seqMap(i,n.seq(r,i).many(),(t,e)=>e.reduce((t,e)=>{let[r,n]=e;return{type:"BinOp",op:r,left:t,right:n}},t));var r,i},t.UnaryOp),UnaryOp:t=>n.seq(n.string("!").trim(n.optWhitespace),t.Primary).map(t=>({type:"UnaryOp",op:"!",target:t[1]})).or(t.Primary),FunCallPostFix:t=>n.seq(n.string("("),t.Expression.sepBy(n.string(",")),n.string(")")).map(t=>({type:"FunCall",callee:null,args:t[1]})),MemberPostFix:t=>n.seq(n.string("["),t.Expression.trim(t.Whitespace),n.string("]")).map(t=>({type:"Member",target:null,property:t[1]})),Primary:t=>n.seq(n.alt(t.String,t.Number,t.Boolean,t.Object,t.Array,t.Symbol,n.seq(n.string("("),t.Whitespace,t.Expression,t.Whitespace,n.string(")")).map(t=>t[2])),n.alt(t.MemberPostFix,t.FunCallPostFix).many()).map(([t,e])=>e.reduce((t,e)=>"Member"===e.type?{...e,target:t}:"FunCall"===e.type?{...e,callee:t}:void 0,t)),Expression:t=>t.BinOp.trim(t.Whitespace),Statement:t=>n.alt(t.If,t.Fork,t.Input,t.Await,t.Once,t.Act,t.Hop,t.Pop,t.Set,t.Run,t.Use,t.Def),StatementList:t=>t.Statement.trim(t.Whitespace).many().map(t=>({type:"StatementList",list:t.map(t=>t)})),Block:t=>n.string("{").trim(t.Whitespace).then(t.StatementList).skip(n.string("}").trim(t.Whitespace)),Program:t=>t.StatementList.map(t=>({type:"Program",body:t})),Test:t=>t.Whitespace});t.exports=function(t){return o.Program.tryParse(t)}},function(t,e,r){(function(e){"undefined"!=typeof self&&self,t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,r,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this._=t}var o=i.prototype;function u(t,e){for(var r=0;r<t;r++)e(r)}function a(t,e,r){return function(t,e){u(e.length,(function(r){t(e[r],r,e)}))}((function(r,n,i){e=t(e,r,n,i)}),r),e}function s(t,e){return a((function(e,r,n,i){return e.concat([t(r,n,i)])}),[],e)}function f(t,r){var n={v:0,buf:r};return u(t,(function(){var t;n={v:n.v<<1|(t=n.buf,t[0]>>7),buf:function(t){var r=a((function(t,r,n,i){return t.concat(n===i.length-1?e.from([r,0]).readUInt16BE(0):i.readUInt16BE(n))}),[],t);return e.from(s((function(t){return(t<<1&65535)>>8}),r))}(n.buf)}})),n}function c(){return void 0!==e}function p(){if(!c())throw new Error("Buffer global does not exist; please consider using https://github.com/feross/buffer if you are running Parsimmon in a browser.")}function l(t){p();var e=a((function(t,e){return t+e}),0,t);if(e%8!=0)throw new Error("The bits ["+t.join(", ")+"] add up to "+e+" which is not an even number of bytes; the total should be divisible by 8");var r,n=e/8,o=(r=function(t){return t>48},a((function(t,e){return t||(r(e)?e:t)}),null,t));if(o)throw new Error(o+" bit range requested exceeds 48 bit (6 byte) Number max.");return new i((function(e,r){var i=n+r;return i>e.length?_(r,n.toString()+" bytes"):A(i,a((function(t,e){var r=f(e,t.buf);return{coll:t.coll.concat(r.v),buf:r.buf}}),{coll:[],buf:e.slice(r,i)},t).coll)}))}function h(t,e){return p(),new i((function(r,n){return n+e>r.length?_(n,e+" bytes for "+t):A(n+e,r.slice(n,n+e))}))}function g(t,e){if("number"!=typeof(r=e)||Math.floor(r)!==r||e<0||e>6)throw new Error(t+" requires integer length in range [0, 6].");var r}function m(t){return g("uintBE",t),h("uintBE("+t+")",t).map((function(e){return e.readUIntBE(0,t)}))}function y(t){return g("uintLE",t),h("uintLE("+t+")",t).map((function(e){return e.readUIntLE(0,t)}))}function d(t){return g("intBE",t),h("intBE("+t+")",t).map((function(e){return e.readIntBE(0,t)}))}function v(t){return g("intLE",t),h("intLE("+t+")",t).map((function(e){return e.readIntLE(0,t)}))}function w(t){return t instanceof i}function b(t){return"[object Array]"==={}.toString.call(t)}function E(t){return c()&&e.isBuffer(t)}function A(t,e){return{status:!0,index:t,value:e,furthest:-1,expected:[]}}function _(t,e){return b(e)||(e=[e]),{status:!1,index:-1,value:null,furthest:t,expected:e}}function B(t,e){if(!e)return t;if(t.furthest>e.furthest)return t;var r=t.furthest===e.furthest?function(t,e){for(var r={},n=0;n<t.length;n++)r[t[n]]=!0;for(var i=0;i<e.length;i++)r[e[i]]=!0;var o=[];for(var u in r)({}).hasOwnProperty.call(r,u)&&o.push(u);return o.sort(),o}(t.expected,e.expected):e.expected;return{status:t.status,index:t.index,value:t.value,furthest:e.furthest,expected:r}}function S(t,e){if(E(t))return{offset:e,line:-1,column:-1};var r=t.slice(0,e).split("\n");return{offset:e,line:r.length,column:r[r.length-1].length+1}}function x(t){if(!w(t))throw new Error("not a parser: "+t)}function P(t,e){return"string"==typeof t?t.charAt(e):t[e]}function R(t){if("number"!=typeof t)throw new Error("not a number: "+t)}function O(t){if("function"!=typeof t)throw new Error("not a function: "+t)}function k(t){if("string"!=typeof t)throw new Error("not a string: "+t)}function L(t,e){return new Array(e+1).join(t)}function U(t,e,r){var n=e-t.length;return n<=0?t:L(r,n)+t}function I(t,e,r,n){return{from:t-e>0?t-e:0,to:t+r>n?n:t+r}}function T(t,e){var r,n,i,o,u,f=e.index,c=f.offset,p=1;if(c===t.length)return"Got the end of the input";if(E(t)){var l=c-c%8,h=c-l,g=I(l,40,40,t.length),m=s((function(t){return s((function(t){return U(t.toString(16),2,"0")}),t)}),function(t,e){var r=t.length,n=[],i=0;if(r<=8)return[t.slice()];for(var o=0;o<r;o++)n[i]||n.push([]),n[i].push(t[o]),(o+1)%8==0&&i++;return n}(t.slice(g.from,g.to).toJSON().data));o=function(t){return 0===t.from&&1===t.to?{from:t.from,to:t.to}:{from:t.from/8,to:Math.floor(t.to/8)}}(g),n=l/8,r=3*h,h>=4&&(r+=1),p=2,i=s((function(t){return t.length<=4?t.join(" "):t.slice(0,4).join(" ")+" "+t.slice(4).join(" ")}),m),(u=(8*(o.to>0?o.to-1:o.to)).toString(16).length)<2&&(u=2)}else{var y=t.split(/\r\n|[\n\r\u2028\u2029]/);r=f.column-1,n=f.line-1,o=I(n,2,3,y.length),i=y.slice(o.from,o.to),u=o.to.toString().length}var d=n-o.from;return E(t)&&(u=(8*(o.to>0?o.to-1:o.to)).toString(16).length)<2&&(u=2),a((function(e,n,i){var a,s=i===d,f=s?"> ":" ";return a=E(t)?U((8*(o.from+i)).toString(16),u,"0"):U((o.from+i+1).toString(),u," "),[].concat(e,[f+a+" | "+n],s?[" "+L(" ",u)+" | "+U("",r," ")+L("^",p)]:[])}),[],i).join("\n")}function W(t,e){return["\n","-- PARSING FAILED "+L("-",50),"\n\n",T(t,e),"\n\n",(r=e.expected,1===r.length?"Expected:\n\n"+r[0]:"Expected one of the following: \n\n"+r.join(", ")),"\n"].join("");var r}function M(t){var e=""+t;return e.slice(e.lastIndexOf("/")+1)}function j(){for(var t=[].slice.call(arguments),e=t.length,r=0;r<e;r+=1)x(t[r]);return i((function(r,n){for(var i,o=new Array(e),u=0;u<e;u+=1){if(!(i=B(t[u]._(r,n),i)).status)return i;o[u]=i.value,n=i.index}return B(A(n,o),i)}))}function C(){var t=[].slice.call(arguments);if(0===t.length)throw new Error("seqMap needs at least one argument");var e=t.pop();return O(e),j.apply(null,t).map((function(t){return e.apply(null,t)}))}function Y(){var t=[].slice.call(arguments),e=t.length;if(0===e)return H("zero alternates");for(var r=0;r<e;r+=1)x(t[r]);return i((function(e,r){for(var n,i=0;i<t.length;i+=1)if((n=B(t[i]._(e,r),n)).status)return n;return n}))}function q(t,e){return F(t,e).or(z([]))}function F(t,e){return x(t),x(e),C(t,e.then(t).many(),(function(t,e){return[t].concat(e)}))}function D(t){k(t);var e="'"+t+"'";return i((function(r,n){var i=n+t.length,o=r.slice(n,i);return o===t?A(i,o):_(n,e)}))}function N(t,e){!function(t){if(!(t instanceof RegExp))throw new Error("not a regexp: "+t);for(var e=M(t),r=0;r<e.length;r++){var n=e.charAt(r);if("i"!==n&&"m"!==n&&"u"!==n)throw new Error('unsupported regexp flag "'+n+'": '+t)}}(t),arguments.length>=2?R(e):e=0;var r=function(t){return RegExp("^(?:"+t.source+")",M(t))}(t),n=""+t;return i((function(t,i){var o=r.exec(t.slice(i));if(o){if(0<=e&&e<=o.length){var u=o[0],a=o[e];return A(i+u.length,a)}return _(i,"valid match group (0 to "+o.length+") in "+n)}return _(i,n)}))}function z(t){return i((function(e,r){return A(r,t)}))}function H(t){return i((function(e,r){return _(r,t)}))}function J(t){if(w(t))return i((function(e,r){var n=t._(e,r);return n.index=r,n.value="",n}));if("string"==typeof t)return J(D(t));if(t instanceof RegExp)return J(N(t));throw new Error("not a string, regexp, or parser: "+t)}function Z(t){return x(t),i((function(e,r){var n=t._(e,r),i=e.slice(r,n.index);return n.status?_(r,'not "'+i+'"'):A(r,null)}))}function K(t){return O(t),i((function(e,r){var n=P(e,r);return r<e.length&&t(n)?A(r+1,n):_(r,"a character/byte matching "+t)}))}function Q(t,e){arguments.length<2&&(e=t,t=void 0);var r=i((function(t,n){return r._=e()._,r._(t,n)}));return t?r.desc(t):r}function V(){return H("fantasy-land/empty")}o.parse=function(t){if("string"!=typeof t&&!E(t))throw new Error(".parse must be called with a string or Buffer as its argument");var e=this.skip(tt)._(t,0);return e.status?{status:!0,value:e.value}:{status:!1,index:S(t,e.furthest),expected:e.expected}},o.tryParse=function(t){var e=this.parse(t);if(e.status)return e.value;var r=W(t,e),n=new Error(r);throw n.type="ParsimmonError",n.result=e,n},o.or=function(t){return Y(this,t)},o.trim=function(t){return this.wrap(t,t)},o.wrap=function(t,e){return C(t,this,e,(function(t,e){return e}))},o.thru=function(t){return t(this)},o.then=function(t){return x(t),j(this,t).map((function(t){return t[1]}))},o.many=function(){var t=this;return i((function(e,r){for(var n=[],i=void 0;;){if(!(i=B(t._(e,r),i)).status)return B(A(r,n),i);if(r===i.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");r=i.index,n.push(i.value)}}))},o.tieWith=function(t){return k(t),this.map((function(e){if(function(t){if(!b(t))throw new Error("not an array: "+t)}(e),e.length){k(e[0]);for(var r=e[0],n=1;n<e.length;n++)k(e[n]),r+=t+e[n];return r}return""}))},o.tie=function(){return this.tieWith("")},o.times=function(t,e){var r=this;return arguments.length<2&&(e=t),R(t),R(e),i((function(n,i){for(var o=[],u=void 0,a=void 0,s=0;s<t;s+=1){if(a=B(u=r._(n,i),a),!u.status)return a;i=u.index,o.push(u.value)}for(;s<e&&(a=B(u=r._(n,i),a),u.status);s+=1)i=u.index,o.push(u.value);return B(A(i,o),a)}))},o.result=function(t){return this.map((function(){return t}))},o.atMost=function(t){return this.times(0,t)},o.atLeast=function(t){return C(this.times(t),this.many(),(function(t,e){return t.concat(e)}))},o.map=function(t){O(t);var e=this;return i((function(r,n){var i=e._(r,n);return i.status?B(A(i.index,t(i.value)),i):i}))},o.contramap=function(t){O(t);var e=this;return i((function(r,n){var i=e.parse(t(r.slice(n)));return i.status?A(n+r.length,i.value):i}))},o.promap=function(t,e){return O(t),O(e),this.contramap(t).map(e)},o.skip=function(t){return j(this,t).map((function(t){return t[0]}))},o.mark=function(){return C(G,this,G,(function(t,e,r){return{start:t,value:e,end:r}}))},o.node=function(t){return C(G,this,G,(function(e,r,n){return{name:t,value:r,start:e,end:n}}))},o.sepBy=function(t){return q(this,t)},o.sepBy1=function(t){return F(this,t)},o.lookahead=function(t){return this.skip(J(t))},o.notFollowedBy=function(t){return this.skip(Z(t))},o.desc=function(t){b(t)||(t=[t]);var e=this;return i((function(r,n){var i=e._(r,n);return i.status||(i.expected=t),i}))},o.fallback=function(t){return this.or(z(t))},o.ap=function(t){return C(t,this,(function(t,e){return t(e)}))},o.chain=function(t){var e=this;return i((function(r,n){var i=e._(r,n);return i.status?B(t(i.value)._(r,i.index),i):i}))},o.concat=o.or,o.empty=V,o.of=z,o["fantasy-land/ap"]=o.ap,o["fantasy-land/chain"]=o.chain,o["fantasy-land/concat"]=o.concat,o["fantasy-land/empty"]=o.empty,o["fantasy-land/of"]=o.of,o["fantasy-land/map"]=o.map;var G=i((function(t,e){return A(e,S(t,e))})),X=i((function(t,e){return e>=t.length?_(e,"any character/byte"):A(e+1,P(t,e))})),$=i((function(t,e){return A(t.length,t.slice(e))})),tt=i((function(t,e){return e<t.length?_(e,"EOF"):A(e,null)})),et=N(/[0-9]/).desc("a digit"),rt=N(/[0-9]*/).desc("optional digits"),nt=N(/[a-z]/i).desc("a letter"),it=N(/[a-z]*/i).desc("optional letters"),ot=N(/\s*/).desc("optional whitespace"),ut=N(/\s+/).desc("whitespace"),at=D("\r"),st=D("\n"),ft=D("\r\n"),ct=Y(ft,st,at).desc("newline"),pt=Y(ct,tt);i.all=$,i.alt=Y,i.any=X,i.cr=at,i.createLanguage=function(t){var e={};for(var r in t)({}).hasOwnProperty.call(t,r)&&function(r){e[r]=Q((function(){return t[r](e)}))}(r);return e},i.crlf=ft,i.custom=function(t){return i(t(A,_))},i.digit=et,i.digits=rt,i.empty=V,i.end=pt,i.eof=tt,i.fail=H,i.formatError=W,i.index=G,i.isParser=w,i.lazy=Q,i.letter=nt,i.letters=it,i.lf=st,i.lookahead=J,i.makeFailure=_,i.makeSuccess=A,i.newline=ct,i.noneOf=function(t){return K((function(e){return t.indexOf(e)<0})).desc("none of '"+t+"'")},i.notFollowedBy=Z,i.of=z,i.oneOf=function(t){for(var e=t.split(""),r=0;r<e.length;r++)e[r]="'"+e[r]+"'";return K((function(e){return t.indexOf(e)>=0})).desc(e)},i.optWhitespace=ot,i.Parser=i,i.range=function(t,e){return K((function(r){return t<=r&&r<=e})).desc(t+"-"+e)},i.regex=N,i.regexp=N,i.sepBy=q,i.sepBy1=F,i.seq=j,i.seqMap=C,i.seqObj=function(){for(var t,e={},r=0,n=(t=arguments,Array.prototype.slice.call(t)),o=n.length,u=0;u<o;u+=1){var a=n[u];if(!w(a)){if(b(a)&&2===a.length&&"string"==typeof a[0]&&w(a[1])){var s=a[0];if(Object.prototype.hasOwnProperty.call(e,s))throw new Error("seqObj: duplicate key "+s);e[s]=!0,r++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(0===r)throw new Error("seqObj expects at least one named parser, found zero");return i((function(t,e){for(var r,i={},u=0;u<o;u+=1){var a,s;if(b(n[u])?(a=n[u][0],s=n[u][1]):(a=null,s=n[u]),!(r=B(s._(t,e),r)).status)return r;a&&(i[a]=r.value),e=r.index}return B(A(e,i),r)}))},i.string=D,i.succeed=z,i.takeWhile=function(t){return O(t),i((function(e,r){for(var n=r;n<e.length&&t(P(e,n));)n++;return A(n,e.slice(r,n))}))},i.test=K,i.whitespace=ut,i["fantasy-land/empty"]=V,i["fantasy-land/of"]=z,i.Binary={bitSeq:l,bitSeqObj:function(t){p();var e={},r=0,n=s((function(t){if(b(t)){var n=t;if(2!==n.length)throw new Error("["+n.join(", ")+"] should be length 2, got length "+n.length);if(k(n[0]),R(n[1]),Object.prototype.hasOwnProperty.call(e,n[0]))throw new Error("duplicate key in bitSeqObj: "+n[0]);return e[n[0]]=!0,r++,n}return R(t),[null,t]}),t);if(r<1)throw new Error("bitSeqObj expects at least one named pair, got ["+t.join(", ")+"]");var i=s((function(t){return t[0]}),n);return l(s((function(t){return t[1]}),n)).map((function(t){return a((function(t,e){return null!==e[0]&&(t[e[0]]=e[1]),t}),{},s((function(e,r){return[e,t[r]]}),i))}))},byte:function(t){if(p(),R(t),t>255)throw new Error("Value specified to byte constructor ("+t+"=0x"+t.toString(16)+") is larger in value than a single byte.");var e=(t>15?"0x":"0x0")+t.toString(16);return i((function(r,n){var i=P(r,n);return i===t?A(n+1,i):_(n,e)}))},buffer:function(t){return h("buffer",t).map((function(t){return e.from(t)}))},encodedString:function(t,e){return h("string",e).map((function(e){return e.toString(t)}))},uintBE:m,uint8BE:m(1),uint16BE:m(2),uint32BE:m(4),uintLE:y,uint8LE:y(1),uint16LE:y(2),uint32LE:y(4),intBE:d,int8BE:d(1),int16BE:d(2),int32BE:d(4),intLE:v,int8LE:v(1),int16LE:v(2),int32LE:v(4),floatBE:h("floatBE",4).map((function(t){return t.readFloatBE(0)})),floatLE:h("floatLE",4).map((function(t){return t.readFloatLE(0)})),doubleBE:h("doubleBE",8).map((function(t){return t.readDoubleBE(0)})),doubleLE:h("doubleLE",8).map((function(t){return t.readDoubleLE(0)}))},t.exports=i}])}).call(this,r(3).Buffer)},function(t,e,r){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var n=r(5),i=r(6),o=r(7);function u(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=s.prototype:(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return p(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);s.TYPED_ARRAY_SUPPORT?(t=e).__proto__=s.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(s.isBuffer(e)){var r=0|h(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function p(t,e){if(c(e),t=a(t,e<0?0:0|h(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|h(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function g(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,u=1,a=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,a/=2,s/=2,r/=2}function f(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(i){var c=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===s)return c*u}else-1!==c&&(o-=o-c),c=-1}else for(r+s>a&&(r=a-s),o=r;o>=0;o--){for(var p=!0,l=0;l<s;l++)if(f(t,o+l)!==f(e,l)){p=!1;break}if(p)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var a=parseInt(e.substr(2*u,2),16);if(isNaN(a))return u;t[r+u]=a}return u}function b(t,e,r,n){return D(q(e,t.length-r),t,r,n)}function E(t,e,r,n){return D(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return E(t,e,r,n)}function _(t,e,r,n){return D(F(e),t,r,n)}function B(t,e,r,n){return D(function(t,e){for(var r,n,i,o=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,u,a,s,f=t[i],c=null,p=f>239?4:f>223?3:f>191?2:1;if(i+p<=r)switch(p){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&f)<<6|63&o)>127&&(c=s);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(s=(15&f)<<12|(63&o)<<6|63&u)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:o=t[i+1],u=t[i+2],a=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&a)&&(s=(15&f)<<18|(63&o)<<12|(63&u)<<6|63&a)>65535&&s<1114112&&(c=s)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=p}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=s,e.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=u(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return f(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},s.allocUnsafe=function(t){return p(null,t)},s.allocUnsafeSlow=function(t){return p(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var u=t[r];if(!s.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,i),i+=u.length}return n},s.byteLength=g,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):m.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),u=(r>>>=0)-(e>>>=0),a=Math.min(o,u),f=this.slice(n,i),c=t.slice(e,r),p=0;p<a;++p)if(f[p]!==c[p]){o=f[p],u=c[p];break}return o<u?-1:u<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function O(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Y(t[o]);return i}function k(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function I(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function T(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function W(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,o){return o||W(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return o||W(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),s.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=s.prototype;else{var i=e-t;r=new s(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},s.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||U(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||U(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):T(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):T(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);U(this,t,e,r,i-1,-i)}var o=0,u=1,a=0;for(this[e]=255&t;++o<r&&(u*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/u>>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);U(this,t,e,r,i-1,-i)}var o=r-1,u=1,a=0;for(this[e+o]=255&t;--o>=0&&(u*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/u>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):T(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):T(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var u=s.isBuffer(t)?t:q(new s(t,n).toString()),a=u.length;for(o=0;o<r-e;++o)this[o+e]=u[o%a]}return this};var C=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function D(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(4))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=f(t),u=n[0],a=n[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,u,a)),c=0,p=a>0?u-4:u;for(r=0;r<p;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],s[c++]=e>>16&255,s[c++]=e>>8&255,s[c++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,s[c++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,s[c++]=e>>8&255,s[c++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],u=0,a=r-i;u<a;u+=16383)o.push(c(t,u,u+16383>a?a:u+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=u.length;a<s;++a)n[a]=u[a],i[u.charCodeAt(a)]=a;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,u=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),u.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return u.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,u,a=8*i-n-1,s=(1<<a)-1,f=s>>1,c=-7,p=r?i-1:0,l=r?-1:1,h=t[e+p];for(p+=l,o=h&(1<<-c)-1,h>>=-c,c+=a;c>0;o=256*o+t[e+p],p+=l,c-=8);for(u=o&(1<<-c)-1,o>>=-c,c+=n;c>0;u=256*u+t[e+p],p+=l,c-=8);if(0===o)o=1-f;else{if(o===s)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,n),o-=f}return(h?-1:1)*u*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var u,a,s,f=8*o-i-1,c=(1<<f)-1,p=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,g=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-u))<1&&(u--,s*=2),(e+=u+p>=1?l/s:l*Math.pow(2,1-p))*s>=2&&(u++,s/=2),u+p>=c?(a=0,u=c):u+p>=1?(a=(e*s-1)*Math.pow(2,i),u+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),u=0));i>=8;t[r+h]=255&a,h+=g,a/=256,i-=8);for(u=u<<i|a,f+=i;f>0;t[r+h]=255&u,h+=g,u/=256,f-=8);t[r+h-g]|=128*m}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){function r(t,e){e(t),Object.keys(t).forEach(n=>{let i=t[n];i&&(Array.isArray(i)?i.forEach(t=>r(t,e)):t[n].type&&r(t[n],e))})}t.exports={traverse:r,renameIdentifier:function(t,e,n){r(t,t=>{"Identifier"===t.type&&t.name==e&&(t.name=n)})}}}]);