(function(e){if(typeof exports=="object"&&typeof module=="object")e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e);else e(CodeMirror)})(function(e){"use strict";e.defineMode("htmlmixed",function(t,n){function f(e,t){var n=t.htmlState.tagName;if(n)n=n.toLowerCase();var o=r.token(e,t.htmlState);if(n=="script"&&/\btag\b/.test(o)&&e.current()==">"){var u=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);u=u?u[1]:"";if(u&&/[\"\']/.test(u.charAt(0)))u=u.slice(1,u.length-1);for(var a=0;a<s.length;++a){var f=s[a];if(typeof f.matches=="string"?u==f.matches:f.matches.test(u)){if(f.mode){t.token=c;t.localMode=f.mode;t.localState=f.mode.startState&&f.mode.startState(r.indent(t.htmlState,""))}break}}}else if(n=="style"&&/\btag\b/.test(o)&&e.current()==">"){t.token=h;t.localMode=i;t.localState=i.startState(r.indent(t.htmlState,""))}return o}function l(e,t,n){var r=e.current();var i=r.search(t),s;if(i>-1)e.backUp(r.length-i);else if(s=r.match(/<\/?$/)){e.backUp(r.length);if(!e.match(t,false))e.match(r)}return n}function c(e,t){if(e.match(/^<\/\s*script\s*>/i,false)){t.token=f;t.localState=t.localMode=null;return null}return l(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function h(e,t){if(e.match(/^<\/\s*style\s*>/i,false)){t.token=f;t.localState=t.localMode=null;return null}return l(e,/<\/\s*style\s*>/,i.token(e,t.localState))}var r=e.getMode(t,{name:"xml",htmlMode:true,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag});var i=e.getMode(t,"css");var s=[],o=n&&n.scriptTypes;s.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")});if(o)for(var u=0;u<o.length;++u){var a=o[u];s.push({matches:a.matches,mode:a.mode&&e.getMode(t,a.mode)})}s.push({matches:/./,mode:e.getMode(t,"text/plain")});return{startState:function(){var e=r.startState();return{token:f,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var n=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:n,htmlState:e.copyState(r,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,n){if(!t.localMode||/^\s*<\//.test(n))return r.indent(t.htmlState,n);else if(t.localMode.indent)return t.localMode.indent(t.localState,n);else return e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||r}}}},"xml","javascript","css");e.defineMIME("text/html","htmlmixed")})