!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../ruby/ruby")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../ruby/ruby"],t):t(CodeMirror)}((function(t){"use strict";t.defineMode("slim",(function(e){var n=t.getMode(e,{name:"htmlmixed"}),i=t.getMode(e,"ruby"),r={html:n,ruby:i},o={ruby:"ruby",javascript:"javascript",css:"text/css",sass:"text/x-sass",scss:"text/x-scss",less:"text/x-less",styl:"text/x-styl",coffee:"coffeescript",asciidoc:"text/x-asciidoc",markdown:"text/x-markdown",textile:"text/x-textile",creole:"text/x-creole",wiki:"text/x-wiki",mediawiki:"text/x-mediawiki",rdoc:"text/x-rdoc",builder:"text/x-builder",nokogiri:"text/x-nokogiri",erb:"application/x-erb"},u=function(t){var e=[];for(var n in t)e.push(n);return new RegExp("^("+e.join("|")+"):")}(o),a={commentLine:"comment",slimSwitch:"operator special",slimTag:"tag",slimId:"attribute def",slimClass:"attribute qualifier",slimAttribute:"attribute",slimSubmode:"keyword special",closeAttributeTag:null,slimDoctype:null,lineContinuation:null},c={"{":"}","[":"]","(":")"},l="_a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",s=l+"\\-0-9·̀-ͯ‿-⁀",k=new RegExp("^[:"+l+"](?::["+s+"]|["+s+"]*)"),d=new RegExp("^[:"+l+"][:\\."+s+"]*(?=\\s*=)"),m=new RegExp("^[:"+l+"][:\\."+s+"]*"),f=/^\.-?[_a-zA-Z]+[\w\-]*/,b=/^#[_a-zA-Z]+[\w\-]*/;function z(t,e){t.stack={parent:t.stack,style:"continuation",indented:e,tokenize:t.line},t.line=t.tokenize}function p(t){t.line==t.tokenize&&(t.line=t.stack.tokenize,t.stack=t.stack.parent)}function x(t,e){return function(n,i){return n.peek()==t&&1==i.rubyState.tokenize.length?(n.next(),i.tokenize=e,"closeAttributeTag"):y(n,i)}}function h(e){var n,r=function(t,i){if(1==i.rubyState.tokenize.length&&!i.rubyState.context.prev){if(t.backUp(1),t.eatSpace())return i.rubyState=n,i.tokenize=e,e(t,i);t.next()}return y(t,i)};return function(e,o){return n=o.rubyState,o.rubyState=t.startState(i),o.tokenize=r,y(e,o)}}function y(t,e){return i.token(t,e.rubyState)}function S(t,e){return t.match(/^#\{/)?(e.tokenize=x("}",e.tokenize),null):function(t,e,n,i,r){var o=t.current(),u=o.search(n);return u>-1&&(e.tokenize=function(t,e,n){var i=function(i,r){return r.tokenize=e,i.pos]?)/))return n.tokenize=function(t,e){return function(n,i){if(p(i),n.match(/^\\$/))return z(i,t),"lineContinuation";var r=e(n,i);return n.eol()&&n.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)&&n.backUp(1),r}}(e.column(),(i=e.column(),r=y,function(t,e){p(e);var n=r(t,e);return t.eol()&&t.current().match(/,$/)&&z(e,i),n})),"slimSwitch";if(e.match(/^doctype\b/))return n.tokenize=T,"keyword";var o=e.match(u);return o?function(e,n){var i=$(e),r=t.startState(i);return n.subMode=i,n.subState=r,n.stack={parent:n.stack,style:"sub",indented:n.indented+1,tokenize:n.line},n.line=n.tokenize=L,"slimSubmode"}(o[1],n):O(e,n)}function j(t,e){return e.startOfLine?U(t,e):O(t,e)}function O(t,e){return t.eat("*")?(e.tokenize=h(R),null):t.match(k)?(e.tokenize=R,"slimTag"):q(t,e)}function R(t,e){return t.match(/^(<>?|>e.indented&&"slimSubmode"!=e.last;)e.line=e.tokenize=e.stack.tokenize,e.stack=e.stack.parent,e.subMode=null,e.subState=null;if(t.eatSpace())return null;var n=e.tokenize(t,e);return e.startOfLine=!1,n&&(e.last=n),a.hasOwnProperty(n)?a[n]:n},blankLine:function(t){if(t.subMode&&t.subMode.blankLine)return t.subMode.blankLine(t.subState)},innerMode:function(t){return t.subMode?{state:t.subState,mode:t.subMode}:{state:t,mode:V}}};return V}),"htmlmixed","ruby"),t.defineMIME("text/x-slim","slim"),t.defineMIME("application/x-slim","slim")}));