UNPKG

imba

Version:

Intuitive and powerful language for building webapps that fly

1 lines 361 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.imbac=e():t.imbac=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(r,s,function(e){return t[e]}.bind(null,s));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e){var n={},r=e.TOK={};function s(t,e,n,r){return this._type=t,this._value=e,this._loc=null!=n?n:-1,this._len=r||0,this._meta=null,this.generated=!1,this.newLine=!1,this.spaced=!1,this.call=!1,this}r.TERMINATOR=1,r.IDENTIFIER=r.IVAR=2,r.CONST=3,r.VAR=4,r.IF=5,r.ELSE=6,r.DEF=7,e.Token=s,s.prototype.type=function(){return this._type},s.prototype.value=function(){return this._value},s.prototype.traverse=function(){},s.prototype.c=function(){return""+this._value},s.prototype.toString=function(){return this._value},s.prototype.charAt=function(t){return this._value.charAt(t)},s.prototype.slice=function(t){return this._value.slice(t)},s.prototype.region=function(){return[this._loc,this._loc+(this._len||this._value.length)]},s.prototype.sourceMapMarker=function(){return-1==this._loc?":":"%$"+this._loc+"$%"},e.lex=n.lex=function(){var t,e=this.tokens[this.pos++];return e?(t=e._type,this.yytext=e):t="",t},e.token=n.token=function(t,e){return new s(t,e,-1,0)},e.typ=n.typ=function(t){return t._type},e.val=n.val=function(t){return t._value},e.line=n.line=function(t){return t._line},e.loc=n.loc=function(t){return t._loc},e.setTyp=n.setTyp=function(t,e){return t._type=e},e.setVal=n.setVal=function(t,e){return t._value=e},e.setLine=n.setLine=function(t,e){return t._line=e},e.setLoc=n.setLoc=function(t,e){return t._loc=e};var i=e.LBRACKET=new s("{","{",0,0,0),o=e.RBRACKET=new s("}","}",0,0,0),a=e.LPAREN=new s("(","(",0,0,0),c=e.RPAREN=new s(")",")",0,0,0);i.generated=!0,o.generated=!0,a.generated=!0,c.generated=!0,e.INDENT=new s("INDENT","2",0,0,0),e.OUTDENT=new s("OUTDENT","2",0,0,0)},function(t,e,n){function r(t){return t?t.toArray?t.toArray():t:[]}var s={},i=n(5),o={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},a=e.ansi={bold:function(t){return""+t+""},red:function(t){return""+t+""},green:function(t){return""+t+""},yellow:function(t){return""+t+""},gray:function(t){return""+t+""},white:function(t){return""+t+""},f:function(t,e){var n=o[t];return"["+n[0]+"m"+e+"["+n[1]+"m"}};a.warn=a.yellow,a.error=a.red,e.brace=s.brace=function(t){return t.match(/\n/)?"{"+t+"\n}":"{\n"+t+"\n}"},e.normalizeIndentation=s.normalizeIndentation=function(t){for(var e,n,r=/\n+([^\n\S]*)/g,s=null;e=r.exec(t);){var i=e[1];(null===s||0<(n=i.length)&&n<s.length)&&(s=i)}return s&&(t=t.replace(RegExp("\\n"+s,"g"),"\n")),t},e.flatten=s.flatten=function(t){var e=[];return t.forEach((function(t){return t instanceof Array?e.push.apply(e,s.flatten(t)):e.push(t)})),e},e.pascalCase=s.pascalCase=function(t){return t.replace(/(^|[\-\_\s])(\w)/g,(function(t,e,n){return n.toUpperCase()}))},e.camelCase=s.camelCase=function(t){return(t=String(t)).replace(/([\-\_\s])(\w)/g,(function(t,e,n){return n.toUpperCase()}))},e.dashToCamelCase=s.dashToCamelCase=function(t){return(t=String(t)).indexOf("-")>=0&&(t=t.replace(/([\-\s])(\w)/g,(function(t,e,n){return n.toUpperCase()}))),t},e.snakeCase=s.snakeCase=function(t){return(t=t.replace(/([\-\s])(\w)/g,"_")).replace(/()([A-Z])/g,"_$1",(function(t,e,n){return n.toUpperCase()}))},e.setterSym=s.setterSym=function(t){return s.dashToCamelCase("set-"+t)},e.quote=s.quote=function(t){return'"'+t+'"'},e.singlequote=s.singlequote=function(t){return"'"+t+"'"},e.symbolize=s.symbolize=function(t){return"="==(t=String(t)).charAt(t.length-1)&&(t="set"+t[0].toUpperCase()+t.slice(1,-1)),t.indexOf("-")>=0&&(t=t.replace(/([\-\s])(\w)/g,(function(t,e,n){return n.toUpperCase()}))),t},e.indent=s.indent=function(t){return String(t).replace(/^/g,"\t").replace(/\n/g,"\n\t").replace(/\n\t$/g,"\n")},e.bracketize=s.bracketize=function(t,e){return void 0===e&&(e=!0),e&&(t="\n"+s.indent(t)+"\n"),"{"+t+"}"},e.parenthesize=s.parenthesize=function(t){return"("+String(t)+")"},e.unionOfLocations=s.unionOfLocations=function(){for(var t=arguments,e=t.length,n=new Array(e>0?e:0);e>0;)n[e-1]=t[--e];for(var s,i=1/0,o=-1/0,a=0,c=r(n),p=c.length;a<p;a++)(s=c[a])&&null!=s._loc&&(s=s._loc),s&&s.loc instanceof Function&&(s=s.loc()),s instanceof Array?(i>s[0]&&(i=s[0]),o<s[0]&&(o=s[1])):("number"==typeof s||s instanceof Number)&&(i>s&&(i=s),o<s&&(o=s));return[i,o]},e.locationToLineColMap=s.locationToLineColMap=function(t){t.split(/\n/g);for(var e,n=[],r=0,s=0,i=0;e=t[r];)n[r]=[i,s],"\n"==e?(i++,s=0):s++,r++;return n},e.markLineColForTokens=s.markLineColForTokens=function(t,e){return s},e.parseArgs=s.parseArgs=function(t,e){var n;void 0===e&&(e={});var i=e.alias||(e.alias={}),o=e.groups||(e.groups=[]),a=e.schema||{};a.main={};var c={};t=t||process.argv.slice(2);for(var p,h=null,u=0;u<t.length;){var l=t[u];if(u++,p=l.match(/^\-([a-zA-Z]+)$/)){h=null;for(var f,_=p[1].split(""),y=0,d=r(_),v=d.length;y<v;y++){var g=i[f=d[y]]||f;_[y]=g,c[g]=!0}1==_.length&&(h=_)}else if(p=l.match(/^\-\-([a-z0-9\-\_A-Z]+)$/)){var m=!0;0==(g=p[1]).indexOf("no-")&&(g=g.substr(3),m=!1);for(var b,T=0,E=r(o),k=E.length;T<k;T++)b=E[T],g.substr(0,b.length)==b&&console.log("should be part of group");c[g=s.dashToCamelCase(g)]=m,h=g}else{var w=a[h];h&&a[h]||(h="main"),l.match(/^\d+$/)&&(l=parseInt(l)),1==(m=c[h])||0==m?c[h]=l:"string"==typeof m||m instanceof String||"number"==typeof m||m instanceof Number?c[h]=[m].concat(l):m instanceof Array?m.push(l):c[h]=l,w&&w.multi||(h="main")}}return("string"==typeof(n=c.env)||n instanceof String)&&(c["ENV_"+c.env]=!0),c},e.printExcerpt=s.printExcerpt=function(t,e,n){n&&n.constructor===Object||(n={});for(var r=void 0!==n.hl&&n.hl,i=void 0===n.gutter||n.gutter,o=(void 0!==n.type&&n.type,void 0!==n.pad?n.pad:2),c=t.split(/\n/g),p=s.locationToLineColMap(t)[e[0]]||[0,0],h=p[0],u=(p[1],c[h],Math.max(0,h-o)),l=Math.min(u+o+1+o,c.length),f=h-u,_=u,y=[];_<l;)y.push(c[_++]);var d=y;return i&&(d=d.map((function(t,e){for(var n,s=""+(u+e+1);s.length<String(l).length;)s=" "+s;return e==f?(n=" -> "+s+" | "+t,r&&(n=a.f(r,n))):(n=" "+s+" | "+t,r&&(n=a.f("gray",n))),n}))),d.join("\n")},e.printWarning=s.printWarning=function(t,e){return e.message+"\n"+s.printExcerpt(t,e.loc,{hl:"whiteBright",type:"warn",pad:1})},e.identifierForPath=s.identifierForPath=function(t){var e=i.create();return e.update(t),e.hex().slice(0,8)}},function(t,e){for(var n,r=e.BALANCED_PAIRS=[["(",")"],["[","]"],["{","}"],["{{","}}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"],["TAG_START","TAG_END"],["BLOCK_PARAM_START","BLOCK_PARAM_END"]],s=e.INVERSES={},i=0,o=r.length;i<o;i++){var a=(n=r[i])[0],c=n[1];s[c]=a,s[a]=c}e.ALL_KEYWORDS=["true","false","null","this","delete","typeof","in","instanceof","throw","break","continue","debugger","if","else","switch","for","while","do","try","catch","finally","class","extends","super","return","undefined","then","unless","until","loop","of","by","when","def","tag","do","elif","begin","var","let","self","await","import","and","or","is","isnt","not","yes","no","isa","case","nil","require"],e.TOK={TERMINATOR:"TERMINATOR",INDENT:"INDENT",OUTDENT:"OUTDENT",DEF_BODY:"DEF_BODY",THEN:"THEN",CATCH:"CATCH"},e.OPERATOR_ALIASES={and:"&&",or:"||",is:"==",isnt:"!=",isa:"instanceof"},e.HEREGEX_OMIT=/\s+(?:#.*)?/g,e.HEREGEX=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/},function(t,e,n){var r=n(1);function s(t,e){this.error=t,this.message=t.message,this.filename=t.filename,this.line=t.line,this._options=e||{}}!function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t}(s,Error),e.ImbaParseError=s,s.wrap=function(t){return new s(t)},s.prototype.set=function(t){this._options||(this._options={});for(var e,n,r=0,s=Object.keys(t),i=s.length;r<i;r++)e=t[n=s[r]],this._options[n]=e;return this},s.prototype.start=function(){for(var t=this._options,e=t.pos-1,n=t.tokens&&t.tokens[e];n&&-1==n._loc;)n=t.tokens[--e];return n},s.prototype.desc=function(){var t=this._options,e=this.message;return t.token&&-1==t.token._loc?"Syntax Error":e},s.prototype.loc=function(){var t;return(t=this.start())&&t.region&&t.region()},s.prototype.toJSON=function(){return this._options,this.start(),{warn:!0,message:this.desc(),loc:this.loc()}},s.prototype.excerpt=function(t){t&&t.constructor===Object||(t={});for(var e=void 0===t.gutter||t.gutter,n=void 0!==t.colors&&t.colors,s=void 0===t.details||t.details,i=this._code,o=this.loc(),a=i.split(/\n/g),c=r.locationToLineColMap(i)[o[0]]||[0,0],p=c[0],h=(c[1],a[p],Math.max(0,p-2)),u=Math.min(h+5,a.length),l=p-h,f=h,_=[];f<u;)_.push(a[f++]);var y=_;return e&&(y=y.map((function(t,e){for(var n=""+(h+e+1);n.length<String(u).length;)n=" "+n;return e==l?" -> "+n+" | "+t:" "+n+" | "+t}))),n&&(y[l]=r.ansi.red(r.ansi.bold(y[l]))),s&&y.unshift(this.message),y.join("\n")},s.prototype.prettyMessage=function(){return this.excerpt()}},function(t,e,n){var r={},s=(n(0),n(1),n(7)),i=n(8),o=e.parser=n(9).parser,a=n(10),c=n(3).ImbaParseError,p=e.lex=new s.Lexer,h=e.Rewriter=i.Rewriter;i=new h,o.lexer=p.jisonBridge(),o.yy=a,e.tokenize=r.tokenize=function(t,e){void 0===e&&(e={});try{e.profile&&console.time("tokenize"),e._source=t,p.reset();var n=p.tokenize(t,e);return e.profile&&console.timeEnd("tokenize"),!1!==e.rewrite&&(n=i.rewrite(n,e)),n}catch(t){throw t}},e.rewrite=r.rewrite=function(t,e){void 0===e&&(e={});try{e.profile&&console.time("rewrite"),t=i.rewrite(t,e),e.profile&&console.timeEnd("rewrite")}catch(t){throw t}return t},e.parse=r.parse=function(t,e){void 0===e&&(e={});var n=t instanceof Array?t:r.tokenize(t,e);try{return n!=t&&(e._source||(e._source=t)),e._tokens=n,o.parse(n)}catch(n){throw n._code=t,e.filename&&(n._filename=e.filename),n}},e.compile=r.compile=function(t,e){void 0===e&&(e={});try{if(!/\S/.test(t))return{js:"",toString:function(){return this.js}};var n=r.tokenize(t,e);return r.parse(n,e).compile(e)}catch(n){throw n._code=t,e.filename&&(n._filename=e.filename),e.evaling?(console.log("error compiling "+e.filename),n.excerpt?console.log(" "+n.excerpt({colors:!0})):(console.log(" "+n.message),console.log(" in file "+n._filename),n.stack&&console.log(n.stack))):console.log("error compiling "+e.filename),n}},e.analyze=r.analyze=function(t,e){var n;void 0===e&&(e={});try{n=r.parse(t,e).analyze(e)}catch(t){if(!(t instanceof c)){if(!t.lexer)throw t;t=new c(t,{tokens:t.lexer.tokens,pos:t.lexer.pos})}n={warnings:[t]}}return n}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(){"use strict";var root="object"==typeof window?window:{},NODE_JS=!root.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS&&(root=global);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(6),HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(t){return function(e){return new Sha1(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Sha1},t.update=function(e){return t.create().update(e)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("sha1").update(t,"utf8").digest("hex");if(t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(void 0===t.length)return method(t);return crypto.createHash("sha1").update(new Buffer(t)).digest("hex")};return nodeMethod};function Sha1(t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Sha1.prototype.update=function(t){if(!this.finalized){var e="string"!=typeof t;e&&t.constructor===root.ArrayBuffer&&(t=new Uint8Array(t));for(var n,r,s=0,i=t.length||0,o=this.blocks;s<i;){if(this.hashed&&(this.hashed=!1,o[0]=this.block,o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),e)for(r=this.start;s<i&&r<64;++s)o[r>>2]|=t[s]<<SHIFT[3&r++];else for(r=this.start;s<i&&r<64;++s)(n=t.charCodeAt(s))<128?o[r>>2]|=n<<SHIFT[3&r++]:n<2048?(o[r>>2]|=(192|n>>6)<<SHIFT[3&r++],o[r>>2]|=(128|63&n)<<SHIFT[3&r++]):n<55296||n>=57344?(o[r>>2]|=(224|n>>12)<<SHIFT[3&r++],o[r>>2]|=(128|n>>6&63)<<SHIFT[3&r++],o[r>>2]|=(128|63&n)<<SHIFT[3&r++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++s)),o[r>>2]|=(240|n>>18)<<SHIFT[3&r++],o[r>>2]|=(128|n>>12&63)<<SHIFT[3&r++],o[r>>2]|=(128|n>>6&63)<<SHIFT[3&r++],o[r>>2]|=(128|63&n)<<SHIFT[3&r++]);this.lastByteIndex=r,this.bytes+=r-this.start,r>=64?(this.block=o[16],this.start=r-64,this.hash(),this.hashed=!0):this.start=r}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha1.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha1.prototype.hash=function(){var t,e,n=this.h0,r=this.h1,s=this.h2,i=this.h3,o=this.h4,a=this.blocks;for(t=16;t<80;++t)e=a[t-3]^a[t-8]^a[t-14]^a[t-16],a[t]=e<<1|e>>>31;for(t=0;t<20;t+=5)n=(e=(r=(e=(s=(e=(i=(e=(o=(e=n<<5|n>>>27)+(r&s|~r&i)+o+1518500249+a[t]<<0)<<5|o>>>27)+(n&(r=r<<30|r>>>2)|~n&s)+i+1518500249+a[t+1]<<0)<<5|i>>>27)+(o&(n=n<<30|n>>>2)|~o&r)+s+1518500249+a[t+2]<<0)<<5|s>>>27)+(i&(o=o<<30|o>>>2)|~i&n)+r+1518500249+a[t+3]<<0)<<5|r>>>27)+(s&(i=i<<30|i>>>2)|~s&o)+n+1518500249+a[t+4]<<0,s=s<<30|s>>>2;for(;t<40;t+=5)n=(e=(r=(e=(s=(e=(i=(e=(o=(e=n<<5|n>>>27)+(r^s^i)+o+1859775393+a[t]<<0)<<5|o>>>27)+(n^(r=r<<30|r>>>2)^s)+i+1859775393+a[t+1]<<0)<<5|i>>>27)+(o^(n=n<<30|n>>>2)^r)+s+1859775393+a[t+2]<<0)<<5|s>>>27)+(i^(o=o<<30|o>>>2)^n)+r+1859775393+a[t+3]<<0)<<5|r>>>27)+(s^(i=i<<30|i>>>2)^o)+n+1859775393+a[t+4]<<0,s=s<<30|s>>>2;for(;t<60;t+=5)n=(e=(r=(e=(s=(e=(i=(e=(o=(e=n<<5|n>>>27)+(r&s|r&i|s&i)+o-1894007588+a[t]<<0)<<5|o>>>27)+(n&(r=r<<30|r>>>2)|n&s|r&s)+i-1894007588+a[t+1]<<0)<<5|i>>>27)+(o&(n=n<<30|n>>>2)|o&r|n&r)+s-1894007588+a[t+2]<<0)<<5|s>>>27)+(i&(o=o<<30|o>>>2)|i&n|o&n)+r-1894007588+a[t+3]<<0)<<5|r>>>27)+(s&(i=i<<30|i>>>2)|s&o|i&o)+n-1894007588+a[t+4]<<0,s=s<<30|s>>>2;for(;t<80;t+=5)n=(e=(r=(e=(s=(e=(i=(e=(o=(e=n<<5|n>>>27)+(r^s^i)+o-899497514+a[t]<<0)<<5|o>>>27)+(n^(r=r<<30|r>>>2)^s)+i-899497514+a[t+1]<<0)<<5|i>>>27)+(o^(n=n<<30|n>>>2)^r)+s-899497514+a[t+2]<<0)<<5|s>>>27)+(i^(o=o<<30|o>>>2)^n)+r-899497514+a[t+3]<<0)<<5|r>>>27)+(s^(i=i<<30|i>>>2)^o)+n-899497514+a[t+4]<<0,s=s<<30|s>>>2;this.h0=this.h0+n<<0,this.h1=this.h1+r<<0,this.h2=this.h2+s<<0,this.h3=this.h3+i<<0,this.h4=this.h4+o<<0},Sha1.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,s=this.h4;return HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,s=this.h4;return[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,s>>24&255,s>>16&255,s>>8&255,255&s]},Sha1.prototype.array=Sha1.prototype.digest,Sha1.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),t};var exports=createMethod();COMMON_JS?module.exports=exports:(root.sha1=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){function r(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}function s(t){return t?t.toArray?t.toArray():t:[]}var i=n(0),o=i.Token,a=n(2).INVERSES,c=n(3),p=["extend","static","local","export","global","prop"],h=e.ALL_KEYWORDS=["true","false","null","this","delete","typeof","in","instanceof","throw","break","continue","debugger","if","else","switch","for","while","do","try","catch","finally","class","extends","super","return","undefined","then","unless","until","loop","of","by","when","def","tag","do","elif","begin","var","let","const","self","await","import","and","or","is","isnt","not","yes","no","isa","case","nil","require","module"],u=(["true","false","null","this","delete","typeof","in","instanceof","throw","break","continue","debugger","if","else","switch","for","while","do","try","catch","finally","class","extends","super","return"].concat(["case","default","function","void","with","const","enum","native"]),/^((([\x23]?[\$A-Za-z_\x7f-\uffff][$\-\w\x7f-\uffff]*)([\=]?))|(<=>|\|(?![\|=])))/),l=/^((\$|@@|@|\#)[\wA-Za-z_\-\x7f-\uffff][$\w\x7f-\uffff]*(\-[$\w\x7f-\uffff]+)*|[$A-Za-z_][$\w\x7f-\uffff]*(\-[$\w\x7f-\uffff]+)*)([^\n\S]*:(?![\*\=:$\w\x7f-\uffff]))?/,f=/^import\s+(\{?[^\"\'\}]+\}?)(?=\s+from\s+)/,_=/^((\$|@@|@|)[$A-Za-z_\x7f-\uffff\-][$\w\x7f-\uffff\-]*)([^\n\S\s]*:(?![\*\=:$A-Za-z\_\x7f-\uffff]))/,y=/^(\<|%)(?=[A-Za-z\#\.\{\@\>])/,d=/^(\w[\w\d]*:)?(\w[\w\d]*)(-[\w\d]+)*/,v=/^#((\w[\w\d]*)(-[\w\d]+)*)/,g=/^[\:\.\#]?([A-Za-z\_][\w\-]*)(\:[A-Za-z\_][\w\-]*)?/,m=/^([\.\:]?[\w\_]+([\-\:\.][\w]+)*)(\s)*\=(?!\>)/,b=/^([%\$]{1,2})([\(\w\#\.\[])/,T=/^(\#|\.|:|::)?([\w]+(\-[\w]+)*)/,E=/^ (\+|\>|\~)*\s*(?=[\w\.\#\:\{\*\[])/,k=/^\[([\w\_\-]+)(\$=|\~=|\^=|\*=|\|=|=|\!=)/,w=/^\:((([\*\@$\w\x7f-\uffff]+)+([\-\\\:][\w\x7f-\uffff]+)*)|==|\<=\>)/,A=/^0x[\da-f]+|^0b[01]+|^\d*\.?\d+(?:e[+-]?\d+)?/i,S=/^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/,R=/^(?:[-=]=>|===|->|=>|!==|\*\*=?|[-+*\/%<>&|^!?=]=|=<|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\?\:|\.{2,3}|\*(?=[a-zA-Z\_]))/,x=/^[^\n\S]+/,O=/^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)/,N=/^(\s*)(#[ \t\!](.*)|#[ \t]?(?=\n|$))+/,I=/^[-=]=>/,C=/^(?:\n[^\n\S]*)+/,$=/^'[^\\']*(?:\\.[^\\']*)*'/,D=/^`[^\\`]*(?:\\.[^\\`]*)*`/,L=/^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/,P=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/,F=/\n/g,M=/\n+([^\n\S]*)/g,j=/^\s*(?:,|\??\.(?![.\d])|::)/,G=/^[A-Z]/,U=/^\$\w+\$/,H=/^\$\d$/,B=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|=","=<","**="],V=["!","~","NEW","TYPEOF","DELETE"],z=["&&","||","&","|","^","and","or"],X=["<<",">>",">>>"],q=["===","!==","==","!=","<",">","<=",">=","===","!=="],Y=["<=>","<<",".."],W=["*","/","%","∪","∩","√"],K=["IN","OF","INSTANCEOF","ISA"],J=["NUMBER","REGEX","BOOL","TRUE","FALSE","++","--","]"],Z=["NUMBER","REGEX","BOOL","TRUE","FALSE","++","--","]",")","}","THIS","SELF","IDENTIFIER","STRING"],Q=["\\",".","?.","?:","UNARY","MATH","EXP","+","-","SHIFT","RELATION","COMPARE","LOGIC","COMPOUND_ASSIGN","THROW","EXTENDS"],tt=["IDENTIFIER","STRING","REGEX",")","]","THIS","SUPER","TAG_END","IVAR","GVAR","SELF","CONST_ID","NEW","ARGVAR","SYMBOL","RETURN"],et=["IDENTIFIER","STRING","REGEX",")","]","THIS","SUPER","TAG_END","IVAR","GVAR","SELF","CONST_ID","NEW","ARGVAR","SYMBOL","RETURN","NUMBER","BOOL","TAG_SELECTOR","ARGUMENTS","}","TAG_TYPE","TAGID"],nt=[".","?","?.","UNARY","?:","+","-","*"],rt=["INDENT","OUTDENT","TERMINATOR"];function st(t,e,n){return this.message=t,this.file=e,this.line=n,this}!function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t}(st,SyntaxError),e.LexerError=st;var it=function(t,e){return void 0===e&&(e=0),t[t.length-e-1]},ot=i.typ,at=i.val,ct=i.setTyp,pt=i.setVal;function ht(){this.reset()}e.Lexer=ht,ht.prototype.reset=function(){return this._code=null,this._chunk=null,this._opts=null,this._state={},this._indent=0,this._indebt=0,this._outdebt=0,this._indents=[],this._ends=[],this._contexts=[],this._scopes=[],this._nextScope=null,this._context=null,this._indentStyle=null,this._inTag=!1,this._tokens=[],this._seenFor=!1,this._loc=0,this._locOffset=0,this._end=null,this._char=null,this._bridge=null,this._last=null,this._lastTyp="",this._lastVal=null,this},ht.prototype.jisonBridge=function(t){return this._bridge={lex:i.lex,setInput:function(t){return this.tokens=t,this.pos=0},upcomingInput:function(){return""}}},ht.prototype.tokenize=function(t,e){var n;if(void 0===e&&(e={}),0==t.length)return[];if(!e.inline){if(x.test(t)&&(t="\n"+t).match(/^\s*$/g))return[];t=t.replace(/\r/g,"").replace(/[\t ]+$/g,"")}return this._last=null,this._lastTyp=null,this._lastVal=null,this._code=t,this._opts=e,this._locOffset=e.loc||0,this._indentStyle=e.indentation||null,(n=t.match(/^([\ \t]*)[^\n\s\t]/))&&(this._state.gutter=n[1]),void 0!==e.gutter&&(this._state.gutter=e.gutter),e._tokens=this._tokens,this.parse(t),e.inline||this.closeIndentation(),!e.silent&&this._ends.length&&(console.log(this._ends),this.error("missing "+this._ends.pop())),this._tokens},ht.prototype.parse=function(t){var e=0;for(this._loc=this._locOffset+e;this._chunk=t.slice(e);)this._context&&this._context.pop&&this._context.pop.test(this._chunk)&&this.popEnd(),e+="TAG"==this._end&&this.tagDefContextToken()||this._inTag&&this.tagContextToken()||this.basicContext(),this._loc=this._locOffset+e},ht.prototype.basicContext=function(){return this.selectorToken()||this.symbolToken()||this.methodNameToken()||this.identifierToken()||this.whitespaceToken()||this.lineToken()||this.commentToken()||this.heredocToken()||this.tagToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken()||0},ht.prototype.moveCaret=function(t){return this._loc+=t},ht.prototype.context=function(){return this._ends[this._ends.length-1]},ht.prototype.inContext=function(t){var e=this._contexts[this._contexts.length-1];return e&&e[t]},ht.prototype.pushEnd=function(t,e){return this._ends.push(t),this._contexts.push(this._context=e||{}),this._end=t,this.refreshScope(),e&&e.id&&(e.start=new o(e.id+"_START",t,this._last.region()[1],0),this._tokens.push(e.start)),this},ht.prototype.popEnd=function(t){var e=this._ends.pop();this._end=this._ends[this._ends.length-1];var n=this._context;return n&&n.start&&(n.end=new o(n.id+"_END",e,this._last.region()[1],0),n.end._start=n.start,n.start._end=n.end,this._tokens.push(n.end)),this._contexts.pop(),this._context=this._contexts[this._contexts.length-1],this.refreshScope(),this},ht.prototype.refreshScope=function(){var t=this._ends[this._ends.length-1],e=this._ends[this._ends.length-2];return this._inTag="TAG_END"==t||"TAG_END"==e&&"OUTDENT"==t},ht.prototype.queueScope=function(t){return this._scopes[this._indents.length]=t,this},ht.prototype.popScope=function(t){return this._scopes.pop(),this},ht.prototype.getScope=function(){return this._scopes[this._indents.length-1]},ht.prototype.scope=function(t,e){return this._ends.push(this._end=t),this._contexts.push(e||null),t},ht.prototype.closeSelector=function(){if("%"==this._end)return this.token("SELECTOR_END","%",0),this.pair("%")},ht.prototype.openDef=function(){return this.pushEnd("DEF")},ht.prototype.closeDef=function(){if("DEF"==this.context()){var t=it(this._tokens);if("DEF_FRAGMENT"==ot(t));else if("TERMINATOR"==ot(t)){var e=this._tokens.pop();this.token("DEF_BODY","DEF_BODY",0),this._tokens.push(e)}else this.token("DEF_BODY","DEF_BODY",0);this.pair("DEF")}},ht.prototype.tagContextToken=function(){var t=this._chunk[0],e=g.exec(this._chunk);if(e){var n,r=e[1],s=e[0].length;return n=":"==t?"TAG_ON":"."==t?"TAG_FLAG":"#"==t?"TAG_ID":"self"==(r=e[0])?"SELF":"TAG_ATTR",this.token(n,r,s),s}if(" "==t||"\n"==t||"\t"==t){var i=/^[\n\s\t]+/.exec(this._chunk);return this.token("TAG_WS",i[0],i[0].length),i[0].length}return"="==t&&">"!=this._chunk[1]?(this.token("=","=",1),this.pushEnd("TAG_ATTR",{id:"VALUE",pop:/^[\s\n\>]/}),1):0},ht.prototype.tagDefContextToken=function(){var t;if(t=d.exec(this._chunk))return this.token("TAG_TYPE",t[0],t[0].length),t[0].length;if(t=v.exec(this._chunk)){var e=t[0];return this.token("TAG_ID",e,e.length),e.length}return"\n"==this._chunk[0]&&this.pair("TAG"),0},ht.prototype.importsToken=function(){var t;return(t=f.exec(this._chunk))?(this.token("IMPORTS",t[1],t[1].length,7),t[0].length):0},ht.prototype.tagToken=function(){var t;if(!(t=y.exec(this._chunk)))return 0;var e,n=(e=s(t))[0],r=e[1],i=e[2];if("<"==r){if(this.token("TAG_START","<",1),this.pushEnd(a.TAG_START),(t=d.exec(this._chunk.substr(1,40)))&&"self"!=t[0])return this.token("TAG_TYPE",t[0],t[0].length,1),n.length+t[0].length;if(i){if("{"==i.substr(0,1))return r.length;this.token("TAG_NAME",n.substr(1),0)}}return n.length},ht.prototype.selectorToken=function(){var t,e;if("%"==this._end){var n=this._chunk[0];if(this.inContext("open")&&(" "==n||"\n"==n||","==n||"+"==n||"~"==n||")"==n||"]"==n))return this.token("SELECTOR_END","%",0),this.pair("%"),0;if(t=E.exec(this._chunk))return this.token("SELECTOR_COMBINATOR",t[1]||" ",t[0].length),t[0].length;if(t=T.exec(this._chunk)){var i=t[1],o=t[2];switch(i){case".":a="SELECTOR_CLASS";break;case"#":a="SELECTOR_ID";break;case":":case"::":a="SELECTOR_PSEUDO_CLASS";break;default:var a="SELECTOR_TAG"}return this.token(a,t[2],t[0].length),t[0].length}if("["==n){if(this.token("[","[",1),this.pushEnd("]"),t=k.exec(this._chunk)){var c=t[0].indexOf(t[1]),p=t[0].indexOf(t[2]);return this.token("IDENTIFIER",t[1],t[1].length,c),this.token("SELECTOR_ATTR_OP",t[2],t[2].length,p),t[0].length}return 1}if("|"==n){var h=this._tokens[this._tokens.length-1];return ct(h,"SELECTOR_NS"),1}if(","==n)return this.token("SELECTOR_GROUP",",",1),1;if("*"==n)return this.token("UNIVERSAL_SELECTOR","*",1),1;if(")"==n)return this.pair("%"),this.token("SELECTOR_END",")",1),1;if(r(n,[")","}","]",""])>=0)return this.pair("%"),0}return(t=b.exec(this._chunk))?((e=s(t))[0],o=e[1],"("==e[2]?(this.token("SELECTOR_START",o,o.length+1),this.pushEnd("%"),o.length+1):"%"==o?"%"==this.context()?1:(this.token("SELECTOR_START",o,o.length),this.pushEnd("%",{open:!0}),o.length):0):0},ht.prototype.methodNameToken=function(){if(" "==this._chunk[0])return 0;var t;if(")"==this._end&&this._ends.length>1&&"%"==this._ends[this._ends.length-2]&&(t=m.exec(this._chunk)))return this.token("TAG_ATTR_SET",t[1]),t[0].length;if(!(t=u.exec(this._chunk)))return 0;var e=t[0].length,n=t[0],r=this._lastTyp,s="IDENTIFIER",i=n.charAt(0),o=!1,a=t[4];return"."==r||"DEF"==r||"GET"==r||"SET"==r||"!"==a||t[5]?"self"==n||"this"==n||"super"==n?0:("new"==n&&("."==r&&this.inTag()||(s="NEW")),"..."==n&&[",","(","CALL_START","BLOCK_PARAM_START","PARAM_START"].indexOf(r)>=0?0:"|"==n?"("==r||"CALL_START"==r?(this.token("DO","DO",0),this.pushEnd("|"),this.token("BLOCK_PARAM_START",n,1),e):"DO"==r||"{"==r?(this.pushEnd("|"),this.token("BLOCK_PARAM_START",n,1),e):"|"==this._ends[this._ends.length-1]?(this.token("BLOCK_PARAM_END","|",1),this.pair("|"),e):0:["&","^","<<","<<<",">>"].indexOf(n)>=0||"|"==n&&"|"!=this.context()?0:(Y.indexOf(n)>=0&&(o=!0),"@"==i?s="IVAR":"$"==i||("#"==i?s="TAGID":(G.test(i)||"global"==n||"exports"==n)&&(s="CONST_ID")),t[5]&&["IDENTIFIER","CONST_ID","GVAR","DECORATOR","CVAR","IVAR","SELF","THIS","]","}",")","NUMBER","STRING"].indexOf(r)>=0&&this.token(".",".",0),this.token(s,n,e),o&&(this._last.spaced=!0),e)):0},ht.prototype.inTag=function(){var t=this._ends.length;if(t>0){var e=this._ends[t-1],n=t>1?this._ends[t-2]:e;return"TAG_END"==e||"TAG_END"==n&&"OUTDENT"==e}return!1},ht.prototype.isKeyword=function(t){if("attr"==t||"prop"==t||"get"==t||"set"==t){var e=this.getScope();if("CLASS"==e||"TAG"==e||"MODULE"==e)return!0}return"ATTR"!=this._lastTyp&&"PROP"!=this._lastTyp&&h.indexOf(t)>=0},ht.prototype.identifierToken=function(){var t,e=this._ends.length>0?this._ends[this._ends.length-1]:null,n=this._ends.length>1?this._ends[this._ends.length-2]:null;if(("TAG_END"==e||"TAG_END"==n&&"OUTDENT"==e)&&(t=m.exec(this._chunk))){"TAG_NAME"!=this._lastTyp&&("TERMINATOR"==this._lastTyp||this.token(",",","));var i=t[0].length;return this.token("TAG_ATTR",t[1],i-1),this._loc+=i-1,this.token("=","=",1),i}if(t=_.exec(this._chunk)){var o=t[1];return h="KEY",this.token(h,o,o.length),this.moveCaret(o.length),this.token(":",":",t[3].length),this.moveCaret(-o.length),t[0].length}if(!(t=l.exec(this._chunk)))return 0;var a,c=(a=s(t))[0],h=(o=a[1],a[2]),u=(a[3],a[4],a[5]),f=o.length;if("own"===o&&"FOR"==this.lastTokenType())return this.token("OWN",o,o.length),o.length;var y,d=it(this._tokens),v=this._lastTyp;if("#"==v)return this.token("IDENTIFIER",o,f),f;if(y=u||"."==v||"?."==v,u&&"?"==v&&(y=!1),"tag"==o&&0==this._chunk.indexOf("tag(")&&(y=!0),"$"==h&&H.test(o))"$0"==o?h="ARGUMENTS":(h="ARGVAR",o=o.substr(1));else if("$"==h&&U.test(o))h="ENV_FLAG",o=o.toUpperCase().slice(1,-1);else if("@"==h)h="IVAR",r(v,["IDENTIFIER","IVAR","CONST_ID"])>=0&&!d.spaced&&this.token(".",".");else if("#"==h)h="TAGID";else if("@@"==h)h="DECORATOR";else if("$"!=h||u)if(G.test(o)||"global"==o||"exports"==o)h="CONST_ID";else{if("elif"==o)return this.token("ELSE","elif",o.length),this.token("IF","if"),o.length;h="IDENTIFIER"}else h="IDENTIFIER";if(!y&&this.isKeyword(o)&&("MODULE"==(h=o.toUpperCase())&&(/^module [a-zA-Z]/.test(this._chunk)&&"TAG_ATTR"!=e||(h="IDENTIFIER")),"YES"==h?h="TRUE":"NO"==h?h="FALSE":"NIL"==h?h="NULL":"VAR"==h||"CONST"==h||"LET"==h?"export"==this._lastVal&&ct(d,"EXPORT"):"IF"==h||"ELSE"==h||"TRUE"==h||"FALSE"==h||"NULL"==h||("TAG"==h?this.pushEnd("TAG"):"DEF"==h||"GET"==h||"SET"==h?(h="DEF",this.openDef()):"DO"==h?"DEF"==this.context()&&this.closeDef():"WHEN"===h&&rt.indexOf(this.lastTokenType())>=0?h="LEADING_WHEN":"FOR"===h?this._seenFor=!0:"UNLESS"===h?h="IF":V.indexOf(h)>=0?h="UNARY":K.indexOf(h)>=0&&("INSTANCEOF"!=h&&"ISA"!=h&&this._seenFor?(h="FOR"+h,this._seenFor=!1):(h="RELATION","UNARY"==d._type&&(d._type="NOT"))))),"super"==o&&(h="SUPER"),!y)switch("export"==this._lastVal&&"default"==o&&(ct(d,"EXPORT"),h="DEFAULT"),o){case"!":case"not":h="UNARY";break;case"==":case"!=":case"===":case"!==":case"is":case"isnt":h="COMPARE";break;case"&&":case"||":case"and":case"or":h="LOGIC";break;case"break":case"continue":case"debugger":case"arguments":h=o.toUpperCase()}var g=c.length;if("CLASS"==h||"DEF"==h||"TAG"==h||"MODULE"==h){this.queueScope(h);for(var b=this._tokens.length;b;){d=this._tokens[--b];var T=""+at(d);if(!(r(T,p)>=0))break;ct(d,T.toUpperCase())}}else if("IF"==h)this.queueScope(h);else{if("IMPORT"==h)return this.pushEnd("IMPORT"),this.token(h,o,f),this.importsToken()||g;"from"==o&&"IMPORT"==e?(h="FROM",this.pair("IMPORT")):"as"==o&&"IMPORT"==e&&(h="AS",this.pair("IMPORT"))}if("IDENTIFIER"==h&&"CATCH"==v&&(h="CATCH_VAR"),u){"IDENTIFIER"==h&&-1==nt.indexOf(this._lastTyp)&&(h="KEY"),this.token(h,o,f);var E=u.indexOf(":");this.moveCaret(f+E),this.token(":",":",1),this.moveCaret(-(f+E))}else this.token(h,o,f);return g},ht.prototype.numberToken=function(){var t,e,n,r;if(!(e=A.exec(this._chunk)))return 0;r=(n=e[0]).length,(t=/0b([01]+)/.exec(n))&&(n=""+parseInt(t[1],2));var s=it(this._tokens);return"."==e[0][0]&&s&&!s.spaced&&["IDENTIFIER",")","}","]","NUMBER"].indexOf(ot(s))>=0&&(this.token(".","."),n=n.substr(1)),this.token("NUMBER",n,r),r},ht.prototype.symbolToken=function(){var t,e,n;if(!(t=w.exec(this._chunk)))return 0;if(e=t[0],(n=it(this._tokens))&&!n.spaced&&-1==r(ot(n),["(","{","[",".","CALL_START","INDEX_START",",","=","INDENT","TERMINATOR","VALUE_START"])){var s=e.split(":")[1];return this.token(".:",":",1),this.token("IDENTIFIER",s,s.length,1),s.length+1}return this.token("SYMBOL",e,t[0].length),t[0].length},ht.prototype.escapeStr=function(t,e,n){if(t=t.replace(F,e?"\\n":""),n){var r=RegExp("\\\\["+n+"]","g");t=(t=t.replace(r,n)).replace(RegExp(""+n,"g"),"\\$&")}return t},ht.prototype.stringToken=function(){var t,e;switch(this._chunk.charAt(0)){case"'":if(!(t=$.exec(this._chunk)))return 0;e=t[0],this.token("STRING",this.escapeStr(e),e.length);break;case'"':if(!(e=this.balancedString(this._chunk,'"')))return 0;if(e.indexOf("{")>=0){var n=e.length;this.token("STRING_START",e.charAt(0),1),this.interpolateString(e.slice(1,-1)),this.token("STRING_END",e.charAt(n-1),1,e.length-1)}else n=e.length,this.token("STRING",this.escapeStr(e),n);break;default:return 0}return this.moveHead(e),e.length},ht.prototype.heredocToken=function(){var t,e,n,r;if(!(t=S.exec(this._chunk)))return 0;var s={quote:n=(e=t[0]).charAt(0),indent:null,offset:0};if(r=this.sanitizeHeredoc(t[2],s),'"'==n&&r.indexOf("{")>=0){var i=t[1];this.token("STRING_START",i,i.length),this.interpolateString(r,{heredoc:!0,offset:i.length+s.offset,quote:n,indent:s.realIndent}),this.token("STRING_END",i,i.length,e.length-i.length)}else this.token("STRING",this.makeString(r,n,!0),0);return this.moveHead(e),e.length},ht.prototype.parseMagicalOptions=function(t){var e=this;return t.indexOf("imba$")>=0&&t.replace(/imba\$(\w+)\=(.*)\b/g,(function(t,n,r){return/^\d+$/.test(r)&&(r=parseInt(r)),e._opts[n]=r})),e},ht.prototype.commentToken=function(){var t,e,n,r;if(t=N.exec(this._chunk)){e=t[0].length,t[1],n=t[2];var s=(r=it(this._tokens))&&ot(r),i="//"+n.substr(1);return this.parseMagicalOptions(i),this._last&&this._last.spaced&&(i=" "+i),s&&"INDENT"!=s&&"TERMINATOR"!=s||!s?this.token("TERMINATOR",i,e):"TERMINATOR"==s?pt(r,at(r)+i):"INDENT"==s?this.addLinebreaks(1,i):this.token("HERECOMMENT",n.substr(2),e),e}if(!(t=O.exec(this._chunk)))return 0;n=t[0];var o=t[1];return o?(this.token("HERECOMMENT",this.sanitizeHeredoc(o,{herecomment:!0,indent:Array(this._indent+1).join(" ")}),n.length),this.token("TERMINATOR","\n")):(this.token("HERECOMMENT",n,n.length),this.token("TERMINATOR","\n")),this.moveHead(n),n.length},ht.prototype.jsToken=function(){var t,e;return"`"===this._chunk.charAt(0)&&(t=D.exec(this._chunk))?(this.token("JS",(e=t[0]).slice(1,-1)),e.length):0},ht.prototype.regexToken=function(){var t,e,n;if("/"!=this._chunk.charAt(0))return 0;if(t=P.exec(this._chunk))return e=this.heregexToken(t),this.moveHead(t[0]),e;if((n=it(this._tokens))&&r(ot(n),n.spaced?J:Z)>=0)return 0;if(!(t=L.exec(this._chunk)))return 0;var i,o=(i=s(t))[0],a=i[1],c=i[2];return this.token("REGEX",""+a+c,o.length),o.length},ht.prototype.heregexToken=function(t){var e,n=(e=s(t))[0];return e[1],e[2],this.token("REGEX",n,n.length),n.length},ht.prototype.lineToken=function(){var t,e;if(!(e=C.exec(this._chunk)))return 0;var n=e[0],r=this.moveHead(n);this._seenFor=!1,it(this._tokens,1);var s=n.substr(n.lastIndexOf("\n")+1),i=this.unfinished();if(/^\n#\s/.test(this._chunk))return this.addLinebreaks(1),0;null==this._state.gutter&&(this._state.gutter=s),(t=this._state.gutter||this._opts.gutter)&&(0==s.indexOf(t)?s=s.slice(t.length):void 0===this._chunk[n.length]||this.warn("incorrect indentation"));var o=s.length;if(this._opts.dropIndentation)return o;if(o>0){this._indentStyle||(this._opts.indent=this._indentStyle=s);for(var a=0,c=0;;)if(s.indexOf(this._indentStyle,c)==c)a++,c+=this._indentStyle.length;else{if(c==s.length)break;if(this._opts.silent)break;if(this._loc+=n.length-s.length,this.token("INDENT",s,s.length),!this._opts.silent)return this.error("inconsistent "+this._indentStyle+" indentation")}o=a}if(o-this._indebt==this._indent)return i?this.suppressNewlines():this.newlineToken(r),n.length;if(o>this._indent){if(i)return this._indebt=o-this._indent,this.suppressNewlines(),n.length;if(this.inTag())return n.length;var p=o-this._indent+this._outdebt;this.closeDef();var h=this._scopes[this._indents.length],u=it(this._tokens);u&&"TERMINATOR"==ot(u)?(ct(u,"INDENT"),u._meta||(u._meta={pre:at(u),post:""}),u.scope=h):(this.token("INDENT",""+p,0),this._last.scope=h),this._indents.push(p),this.pushEnd("OUTDENT"),this._outdebt=this._indebt=0,this.addLinebreaks(r)}else this._indebt=0,this.outdentToken(this._indent-o,i,r),this.addLinebreaks(r-1);return this._indent=o,n.length},ht.prototype.outdentToken=function(t,e,n){for(var r=0;t>0;){var s=this._indents.length-1;void 0===this._indents[s]?t=0:this._indents[s]===this._outdebt?(t-=this._outdebt,this._outdebt=0):this._indents[s]<this._outdebt?(this._outdebt-=this._indents[s],t-=this._indents[s]):(t-=r=this._indents.pop()-this._outdebt,this._outdebt=0,e||this.addLinebreaks(1),this.pair("OUTDENT"),this.token("OUTDENT",""+r,0))}for(r&&(this._outdebt-=t);";"==this.lastTokenValue();)this._tokens.pop();"TERMINATOR"==this.lastTokenType()||e||this.token("TERMINATOR","\n",0),this._scopes.length=this._indents.length;var i=this.context();return"%"!=i&&"TAG"!=i||this.pair(i),this.closeDef(),this},ht.prototype.whitespaceToken=function(t){var e,n;return(e=x.exec(this._chunk))||"\n"===this._chunk.charAt(0)?(n=it(this._tokens))?e?(n.spaced=!0,e[0].length):(n.newLine=!0,0):void 0:0},ht.prototype.addNewline=function(){return this.token("TERMINATOR","\n")},ht.prototype.moveHead=function(t){return function(t,e){return t.split("\n").length-1}(t)},ht.prototype.addLinebreaks=function(t,e){var n;if(!e&&0==t)return this;var r=this._last;if(e||(n=1==t?"\n":2==t?"\n\n":3==t?"\n\n\n":function(t,e){for(var n="";e>0;)e%2==1&&(n+=t),t+=t,e>>=1;return n}("\n",t)),r){var s=r._type,i=at(r);if("INDENT"==s)return(r._meta||(r._meta={pre:"",post:""})).post+=e||n,this;if("TERMINATOR"==s)return pt(r,i+(e||n)),this}this.token("TERMINATOR",n,0)},ht.prototype.newlineToken=function(t){this.addLinebreaks(t);var e=this.context();return"TAG"!=e&&"IMPORT"!=e||this.pair(e),this.closeDef(),this},ht.prototype.suppressNewlines=function(){return"\\"===this.value()&&this._tokens.pop(),this},ht.prototype.literalToken=function(){var t,e;(t=R.exec(this._chunk))?(e=t[0],I.test(e)&&this.tagParameters()):e=this._chunk.charAt(0);var n=this._ends[this._ends.length-1],s=this._ends[this._ends.length-2],i="TAG_END"==n||"OUTDENT"==n&&"TAG_END"==s,o=e,c=it(this._tokens),p=c&&ot(c),h=c&&at(c);if(e.length,"="==e&&c&&("||"==h||"&&"==h))return ct(c,"COMPOUND_ASSIGN"),pt(c,h+"="),c._len=this._loc-c._loc+e.length,e.length;switch(";"===e?(this._seenFor=!1,o="TERMINATOR"):"("===e&&i&&"="!=p&&c.spaced?this.token(",",","):"->"===e&&i?(o="TAG_END",this.pair("TAG_END")):"=>"===e&&i?(o="TAG_END",this.pair("TAG_END")):"/>"===e&&i?(o="TAG_END",this.pair("TAG_END")):">"===e&&i?(o="TAG_END",this.pair("TAG_END")):">"===e&&"DEF"==this.context()?o="DEF_FRAGMENT":"TERMINATOR"===e&&"DEF"===n?this.closeDef():"&"===e&&"DEF"==this.context()?o="BLOCK_ARG":"*"==e&&this._chunk.charAt(1).match(/[A-Za-z\_\@\[]/)&&(c.spaced||[",","(","[","{","|","\n","\t"].indexOf(h)>=0)?o="SPLAT":"√"==e?o="SQRT":"ƒ"==e?o="DO":"**"==e?o="EXP":r(e,W)>=0?o="MATH":r(e,q)>=0?o="COMPARE":r(e,B)>=0?o="COMPOUND_ASSIGN":r(e,V)>=0?o="UNARY":r(e,X)>=0?o="SHIFT":r(e,z)>=0?o="LOGIC":c&&!c.spaced&&("("===e&&r(p,tt)>=0?o="CALL_START":"["===e&&r(p,et)>=0&&(o="INDEX_START","?"==p&&ct(c,"INDEX_SOAK"))),e){case"(":case"{":case"[":this.pushEnd(a[e]);break;case")":case"}":case"]":this.pair(e)}return this.token(o,e,e.length),e.length},ht.prototype.sanitizeHeredoc=function(t,e){var n,r=e.indent,s=e.herecomment;if(s){if(t.indexOf("\n")<=0)return t}else for(var i;n=M.exec(t);){var o=n[1];(null===r||0<(i=o.length)&&i<r.length)&&(r=o)}return r&&(t=t.replace(RegExp("\\n"+r,"g"),"\n")),s||("\n"==t[0]&&(e.offset=r.length+1),t=t.replace(/^\n/,"")),e.realIndent=r,t},ht.prototype.tagParameters=function(){var t;if(")"!=this.lastTokenType())return this;var e=[],n=this._tokens,r=n.length;for(ct(n[--r],"PARAM_END");t=n[--r];){var s=ot(t);switch(s){case")":e.push(t);break;case"(":case"CALL_START":if(!e.length)return"("===s?(ct(t,"PARAM_START"),this):this;e.pop()}}return this},ht.prototype.closeIndentation=function(){return"IMPORT"==this.context()&&this.pair(this.context()),this.closeDef(),this.closeSelector(),this.outdentToken(this._indent,!1,0)},ht.prototype.balancedString=function(t,e){for(var n,r,s=[e],i=0;i<t.length-1;){switch(i++,r=t.charAt(i)){case"\\":i++;continue;case e:if(s.pop(),!s.length)return t.slice(0,i+1);e=s[s.length-1];continue}"}"!==e||'"'!=r&&"'"!=r?"}"===e&&"/"===r&&(n=P.exec(t.slice(i))||L.exec(t.slice(i)))?i+=n[0].length-1:"}"===e&&"{"===r?s.push(e="}"):'"'===e&&"{"===r&&s.push(e="}"):s.push(e=r)}if(!this._opts.silent)return this.error("missing "+s.pop()+", starting")},ht.prototype.interpolateString=function(t,e){void 0===e&&(e={});var n,r,s=e.heredoc,i=e.quote,a=e.regex,c=(e.prefix,e.indent),p=(this._loc,[]),h=0,u=-1,l=e.offset||1;for(t.length;n=t[u+=1];)if("\\"!==n){if("\n"===n&&c&&(l+=c.length),"{"==t[u]&&(r=this.balancedString(t.slice(u),"}"))){if(h<u){var f=new o("NEOSTRING",this.escapeStr(t.slice(h,u),s,i),this._loc+h+l,u-h);p.push(f)}p.push(new o("{{","{",this._loc+u+l,1));var _=r.slice(1,-1);if((_=_.replace(/^[^\n\S]+/,"")).length){var y=this._loc+u+(r.length-_.length)-1,d=(new ht).tokenize(_,{inline:!0,rewrite:!1,loc:y+l});d[0]&&"TERMINATOR"==ot(d[0])&&d.shift(),d.length&&p.push.apply(p,d)}u+=r.length-1,p.push(new o("}}","}",this._loc+u+l,1)),h=u+1}}else u+=1;if(u>=h&&h<t.length&&p.push(new o("NEOSTRING",this.escapeStr(t.slice(h),s,i),this._loc+h+l,t.length-h)),a)return p;if(!p.length)return this.token("NEOSTRING",'""');for(var v=0,g=p.length;v<g;v++)this._tokens.push(p[v]);return p},ht.prototype.balancedSelector=function(t,e){for(var n,r=[e],s=t.length,i=1,o=s-i;o>0?i<s:i>s;o>0?i++:i--){switch(n=t.charAt(i)){case"\\":i++;continue;case e:if(r.pop(),!r.length)return t.slice(0,i+1);e=r[r.length-1];continue}"}"===e&&n===[")"]?r.push(e=n):"}"===e&&"{"===n?r.push(e="}"):")"===e&&"{"===n&&r.push(e="}")}return this.error("missing "+r.pop()+", starting")},ht.prototype.pair=function(t){var e=it(this._ends);if(t!=e){"OUTDENT"!==e&&this.error("unmatched "+t);var n=it(this._indents);return this._indent-=n,this.outdentToken(n,!0,0),this.pair(t)}return this.popEnd()},ht.prototype.token=function(t,e,n,r){this._lastTyp=t,this._lastVal=e;var s=this._last=new o(t,e,this._loc+(r||0),n||0);this._tokens.push(s)},ht.prototype.lastTokenType=function(){var t=this._tokens[this._tokens.length-1];return t?ot(t):"NONE"},ht.prototype.lastTokenValue=function(){var t=this._tokens[this._tokens.length-1];return t?t._value:""},ht.prototype.tokid=function(t,e){var n;return(n=it(this._tokens,t))?(e&&ct(n,e),ot(n)):null},ht.prototype.value=function(t,e){var n;return(n=it(this._tokens,t))?(e&&pt(n,e),at(n)):null},ht.prototype.unfinished=function(){return!!j.test(this._chunk)||Q.indexOf(this._lastTyp)>=0},ht.prototype.escapeLines=function(t,e){return t.replace(F,e?"\\n":"")},ht.prototype.makeString=function(t,e,n){return t?(t=(t=t.replace(/\\([\s\S])/g,(function(t,n){return"\n"==n||n==e?n:t}))).replace(RegExp(""+e,"g"),"\\$&"),e+this.escapeLines(t,n)+e):e+e},ht.prototype.error=function(t,e){("number"==typeof this._line||this._line instanceof Number)&&(t=t+" on line "+this._line),e&&(t+=" ["+this._loc+":"+(this._loc+e)+"]");var n=new SyntaxError(t);throw n.line=this._line,(n=new c.ImbaParseError(n,{tokens:this._tokens,pos:this._tokens.length})).region=[this._loc,this._loc+(e||0)],n},ht.prototype.warn=function(t){return(this._tokens.warnings||(this._tokens.warnings=[])).push(t),console.warn(t),this}},function(t,e,n){function r(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}var s=n(0),i=s.Token,o=n(2),a=(o.INVERSES,o.BALANCED_PAIRS,o.TOK,"INDENT"),c=function(t){for(var e,n={},r=0,s=(e=t)?e.toArray?e.toArray():e:[],i=s.length;r<i;r++)n[s[r]]=1;return n},p=c([")","]","}","OUTDENT","CALL_END","PARAM_END","INDEX_END","BLOCK_PARAM_END","STRING_END","}}","TAG_END","CATCH","WHEN","ELSE","FINALLY"]),h={"(":1,"[":1,"{":1,"{{":1,INDENT:1,CALL_START:1,PARAM_START:1,INDEX_START:1,BLOCK_PARAM_START:1,STRING_START:1,TAG_START:1},u={")":1,"]":1,"}":1,"}}":1,OUTDENT:1,CALL_END:1,PARAM_END:1,INDEX_END:1,BLOCK_PARAM_END:1,STRING_END:1,TAG_END:1},l={ELSE:1,TRY:1,FINALLY:1,THEN:1,BLOCK_PARAM_END:1,DO:1,BEGIN:1,CATCH_VAR:1},f={TERMINATOR:!0,CATCH:!0,FINALLY:!0,ELSE:!0,OUTDENT:!0,LEADING_WHEN:!0},_={IDENTIFIER:1,SUPER:1,"@":1,THIS:1,SELF:1,TAG_END:1,IVAR:1,GVAR:1,CVAR:1,DECORATOR:1,CONST_ID:1,ARGVAR:1,NEW:1,BREAK:1,CONTINUE:1,RETURN:1},y={SELECTOR:1,IDENTIFIER:1,NUMBER:1,STRING:1,SYMBOL:1,JS:1,REGEX:1,NEW:1,CLASS:1,IF:1,UNLESS:1,TRY:1,SWITCH:1,THIS:1,BOOL:1,TRUE:1,FALSE:1,NULL:1,UNDEFINED:1,UNARY:1,SUPER:1,IVAR:1,GVAR:1,CONST_ID:1,ARGVAR:1,SELF:1,"@":1,"[":1,"(":1,"{":1,"--":1,"++":1,TAGID:1,"#":1,TAG_START:1,PARAM_START:1,SELECTOR_START:1,STRING_START:1,IDREF:1,SPLAT:1,DO:1,BLOCK_ARG:1,FOR:1,CONTINUE:1,BREAK:1},d=["+","-"],v=c(["{","[",",","BLOCK_PARAM_END","DO"]),g=c(["CLASS","IF","UNLESS","TAG","WHILE","FOR","UNTIL","CATCH","FINALLY","MODULE","LEADING_WHEN"]),m={POST_IF:!0,POST_UNLESS:!0,POST_FOR:!0,WHILE:!0,UNTIL:!0,WHEN:!0,BY:!0,LOOP:!0,TERMINATOR:!0,DEF_BODY:!0,DEF_FRAGMENT:!0};function b(){this._tokens=[],this._options={},this._len=0,this._starter=null}e.Rewriter=b,b.prototype.reset=function(){return this._starter=null,this._len=0,this},b.prototype.tokens=function(){return this._tokens},b.prototype.rewrite=function(t,e){void 0===e&&(e={}),this.reset(),this._tokens=t,this._options=e;for(var n=0,r=t.length;n<r-1;){var s=t[n];if("DEF_BODY"==s._type){var i=t[n+1];i&&"TERMINATOR"==i._type&&(s._type="DEF_EMPTY")}n++}return this.step("all"),this._tokens},b.prototype.all=function(){return this.step("ensureFirstLine"),this.step("removeLeadingNewlines"),this.step("removeMidExpressionNewlines"),this.step("tagDefArguments"),this.step("closeOpenCalls"),this.step("closeOpenIndexes"),this.step("closeOpenTags"),this.step("addImplicitIndentation"),this.step("tagPostfixConditionals"),this.step("addImplicitBraces"),this.step("addImplicitParentheses")},b.prototype.step=function(t){this[t]()},b.prototype.scanTokens=function(t){for(var e=this._tokens,n=0;n<e.length;)n+=t.call(this,e[n],n,e);return!0},b.prototype.detectEnd=function(t,e,n,r){void 0===r&&(r={});for(var s,i,o=this._tokens,a=0;t<o.length;){if(s=o[t],0==a&&e.call(this,s,t,o,r))return n.call(this,s,t,o,r);if(!s||a<0)return n.call(this,s,t-1,o,r);i=s._type,h[i]?a+=1:u[i]&&(a-=1),t+=1}return t-1},b.prototype.ensureFirstLine=function(){"TERMINATOR"===this._tokens[0]._type&&this._tokens.unshift(s.token("BODYSTART","BODYSTART"))},b.prototype.removeLeadingNewlines=function(){for(var t=0,e=0,n=this._tokens,r=n.length;e<r;){if("TERMINATOR"!==n[e]._type){t=e;break}e++}t&&n.splice(0,t)},b.prototype.removeMidExpressionNewlines=function(){return this.scanTokens((function(t,e,n){var r=n.length>e+1?n[e+1]:null;return"TERMINATOR"===t._type&&r&&p[r._type]?r&&"OUTDENT"==r._type?1:(n.splice(e,1),0):1}))},b.prototype.tagDefArguments=function(){return!0},b.prototype.closeOpenCalls=function(){var t=function(t,e,n){var r=t._type;return")"==r||"CALL_END"==r||"OUTDENT"==r&&")"==this.tokenType(e-1)},e=function(t,e,n){"OUTDENT"===t._type&&(t=n[e-1]),t._type="CALL_END"};this.scanTokens((function(n,r,s){return"CALL_START"===n._type&&this.detectEnd(r+1,t,e),1}))},b.prototype.closeOpenIndexes=function(){var t=this,e=function(t,e){return"]"===t._type||"INDEX_END"===t._type},n=function(t,e){return t._type="INDEX_END"};return t.scanTokens((function(r,s,i){return"INDEX_START"===r._type&&t.detectEnd(s+1,e,n),1}))},b.prototype.closeOpenTags=function(){var t=this,e=function(t,e){return">"==t._type||"TAG_END"==t._type},n=function(t,e){return t._type="TAG_END"};return t.scanTokens((function(r,s,i){return"TAG_START"===r._type&&t.detectEnd(s+1,e,n),1}))},b.prototype.addImplicitBlockCalls=function(){for(var t=1,e=this._tokens;t<e.length;){var n=e[t],r=n._type,i=n._value;"DO"!=r||"INDEX