'use strict';function splitLines(a){return a.split(/\r\n?|\n/)}var countColumn=exports.countColumn=function(a,b,d,c,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));c=c||0;for(e=e||0;;){var f=a.indexOf("\t",c);if(0>f||f>=b)return e+(b-c);e+=f-c;e+=d-e%d;c=f+1}};function StringStream(a,b,d){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.context=d}
StringStream.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;
return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return countColumn(this.string,
null,this.tabSize)-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,d){if("string"==typeof a){var c=function(a){return d?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(c(e)==c(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=
a;try{return b()}finally{this.lineStart-=a}},lookAhead:function(a){a=this.context.line+a;return a>=this.context.lines.length?null:this.context.lines[a]}};exports.StringStream=StringStream;exports.startState=function(a,b,d){return a.startState?a.startState(b,d):!0};var modes=exports.modes={},mimeModes=exports.mimeModes={};exports.defineMode=function(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));modes[a]=b};exports.defineMIME=function(a,b){mimeModes[a]=b};
exports.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});exports.defineMIME("text/plain","null");exports.resolveMode=function(a){"string"==typeof a&&mimeModes.hasOwnProperty(a)?a=mimeModes[a]:a&&"string"==typeof a.name&&mimeModes.hasOwnProperty(a.name)&&(a=mimeModes[a.name]);return"string"==typeof a?{name:a}:a||{name:"null"}};function copyObj(a,b,d){b||(b={});for(var c in a)!a.hasOwnProperty(c)||!1===d&&b.hasOwnProperty(c)||(b[c]=a[c]);return b}
var modeExtensions=exports.modeExtensions={};exports.extendMode=function(a,b){a=modeExtensions.hasOwnProperty(a)?modeExtensions[a]:modeExtensions[a]={};copyObj(b,a)};
exports.getMode=function(a,b){b=exports.resolveMode(b);var d=modes[b.name];if(!d)return exports.getMode(a,"text/plain");a=d(a,b);if(modeExtensions.hasOwnProperty(b.name)){d=modeExtensions[b.name];for(var c in d)d.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a["_"+c]=a[c]),a[c]=d[c])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(c in b.modeProps)a[c]=b.modeProps[c];return a};
exports.innerMode=function(a,b){for(var d;a.innerMode;){d=a.innerMode(b);if(!d||d.mode==a)break;b=d.state;a=d.mode}return d||{mode:a,state:b}};exports.registerHelper=exports.registerGlobalHelper=Math.min;
exports.runMode=function(a,b,d,c){b=exports.getMode({indentUnit:2},b);a=splitLines(a);c=c&&c.state||exports.startState(b);for(var e={lines:a,line:0},f=0,h=a.length;f<h;++f,++e.line){f&&d("\n");var g=new exports.StringStream(a[f],4,e);for(!g.string&&b.blankLine&&b.blankLine(c);!g.eol();){var k=b.token(g,c);d(g.current(),k,f,g.start,c);g.start=g.pos}}};require.cache[require.resolve("../../lib/codemirror")]=require.cache[require.resolve("./runmode.node")];
require.cache[require.resolve("../../addon/runmode/runmode")]=require.cache[require.resolve("./runmode.node")];
