!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(f,i){var p="error";function e(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var a=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,s=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,u=/^[_A-Za-z$][_A-Za-z$0-9]*/,l=/^@[_A-Za-z$][_A-Za-z$0-9]*/,d=e(["and","or","not","is","isnt","in","instanceof","typeof"]),c=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],m=e(c.concat(["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"]));c=e(c);var h=/^('{3}|\"{3}|['\"])/,v=/^(\/{3}|\/)/,k=e(["Infinity","NaN","undefined","null","true","false","on","off","yes","no"]);function y(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var n=t.scope.offset;if(e.eatSpace()){var r=e.indentation();return n<r&&"coffee"==t.scope.type?"indent":r<n?"dedent":null}0<n&&x(e,t)}if(e.eatSpace())return null;var o=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=b,t.tokenize(e,t);if("#"===o)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var i=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^-?\d+\.\d*/)&&(i=!0),e.match(/^-?\.\d+/)&&(i=!0),i)return"."==e.peek()&&e.backUp(1),"number";var c=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(c=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(c=!0),e.match(/^-?0(?![\dx])/i)&&(c=!0),c)return"number"}if(e.match(h))return t.tokenize=g(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(v)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=g(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(a)||e.match(d)?"operator":e.match(s)?"punctuation":e.match(k)?"atom":e.match(l)||t.prop&&e.match(u)?"property":e.match(m)?"keyword":e.match(u)?"variable":(e.next(),p)}function g(n,r,o){return function(e,t){for(;!e.eol();)if(e.eatWhile(/[^'"\/\\]/),e.eat("\\")){if(e.next(),r&&e.eol())return o}else{if(e.match(n))return t.tokenize=y,o;e.eat(/['"\/]/)}return r&&(i.singleLineStringErrors?o=p:t.tokenize=y),o}}function b(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=y;break}e.eatWhile("#")}return"comment"}function z(e,t,n){n=n||"coffee";for(var r=0,o=!1,i=null,c=t.scope;c;c=c.prev)if("coffee"===c.type||"}"==c.type){r=c.offset+f.indentUnit;break}"coffee"!==n?(o=null,i=e.column()+e.current().length):t.scope.align&&(t.scope.align=!1),t.scope={offset:r,type:n,prev:t.scope,align:o,alignOffset:i}}function x(e,t){if(t.scope.prev){if("coffee"!==t.scope.type)return t.scope=t.scope.prev,!1;for(var n=e.indentation(),r=!1,o=t.scope;o;o=o.prev)if(n===o.offset){r=!0;break}if(!r)return!0;for(;t.scope.prev&&t.scope.offset!==n;)t.scope=t.scope.prev;return!1}}return{startState:function(e){return{tokenize:y,scope:{offset:e||0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,t){var n=null===t.scope.align&&t.scope;n&&e.sol()&&(n.align=!1);var r=function(e,t){var n=t.tokenize(e,t),r=e.current();"return"===r&&(t.dedent=!0),("->"!==r&&"=>"!==r||!e.eol())&&"indent"!==n||z(e,t);var o="[({".indexOf(r);if(-1!==o&&z(e,t,"])}".slice(o,o+1)),c.exec(r)&&z(e,t),"then"==r&&x(e,t),"dedent"===n&&x(e,t))return p;if(-1!==(o="])}".indexOf(r))){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==r&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),n}(e,t);return r&&"comment"!=r&&(n&&(n.align=!0),t.prop="punctuation"==r&&"."==e.current()),r},indent:function(e,t){if(e.tokenize!=y)return 0;var n=e.scope,r=t&&-1<"])}".indexOf(t.charAt(0));if(r)for(;"coffee"==n.type&&n.prev;)n=n.prev;var o=r&&n.type===t.charAt(0);return n.align?n.alignOffset-(o?1:0):(o?n.prev:n).offset},lineComment:"#",fold:"indent"}}),e.defineMIME("application/vnd.coffeescript","coffeescript"),e.defineMIME("text/x-coffeescript","coffeescript"),e.defineMIME("text/coffeescript","coffeescript")});