/* CodeMirror - Minified & Bundled
   Generated on 14.3.2016 with http://codemirror.net/doc/compress.html
   Version: HEAD

   Modes:
   - htmlmixed.js
 */

!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],a):a(CodeMirror)}(function(a){"use strict";function c(a,b,c){var d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):d.match(/<\/?$/)&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function e(a){var b=d[a];return b?b:d[a]=new RegExp("\\s+"+a+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function f(a,b){var c=a.match(e(b));return c?c[2]:""}function g(a,b){return new RegExp((b?"^":"")+"</s*"+a+"s*>","i")}function h(a,b){for(var c in a)for(var d=b[c]||(b[c]=[]),e=a[c],f=e.length-1;f>=0;f--)d.unshift(e[f])}function i(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(!d[0]||d[1].test(f(b,d[0])))return d[2]}}var b={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},d={};a.defineMode("htmlmixed",function(d,e){function n(b,e){var l,h=f.token(b,e.htmlState),k=/\btag\b/.test(h);if(k&&!/[<>\s\/]/.test(b.current())&&(l=e.htmlState.tagName&&e.htmlState.tagName.toLowerCase())&&j.hasOwnProperty(l))e.inTag=l+" ";else if(e.inTag&&k&&/>$/.test(b.current())){var m=/^([\S]+) (.*)/.exec(e.inTag);e.inTag=null;var o=">"==b.current()&&i(j[m[1]],m[2]),p=a.getMode(d,o),q=g(m[1],!0),r=g(m[1],!1);e.token=function(a,b){return a.match(q,!1)?(b.token=n,b.localState=b.localMode=null,null):c(a,r,b.localMode.token(a,b.localState))},e.localMode=p,e.localState=a.startState(p,f.indent(e.htmlState,""))}else e.inTag&&(e.inTag+=b.current(),b.eol()&&(e.inTag+=" "));return h}var f=a.getMode(d,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag}),j={},k=e&&e.tags,l=e&&e.scriptTypes;if(h(b,j),k&&h(k,j),l)for(var m=l.length-1;m>=0;m--)j.script.unshift(["type",l[m].matches,l[m].mode]);return{startState:function(){var a=f.startState();return{token:n,inTag:null,localMode:null,localState:null,htmlState:a}},copyState:function(b){var c;return b.localState&&(c=a.copyState(b.localMode,b.localState)),{token:b.token,inTag:b.inTag,localMode:b.localMode,localState:c,htmlState:a.copyState(f,b.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(b,c){return!b.localMode||/^\s*<\//.test(c)?f.indent(b.htmlState,c):b.localMode.indent?b.localMode.indent(b.localState,c):a.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||f}}}},"xml","javascript","css"),a.defineMIME("text/html","htmlmixed")});