Liferay.Loader.define("liferay!object-js-components-web$codemirror@5.65.12/addon/mode/simple",["module","exports","require","../../lib/codemirror"],(function(e,t,n){var o,a=void 0;window;o=function(e){"use strict";function ensureState(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function toRegex(e,t){if(!e)return/(?:)/;var n="";return e instanceof RegExp?(e.ignoreCase&&(n="i"),e.unicode&&(n+="u"),e=e.source):e=String(e),new RegExp((!1===t?"":"^")+"(?:"+e+")",n)}function Rule(e,t){(e.next||e.push)&&ensureState(t,e.next||e.push),this.regex=toRegex(e.regex),this.token=function asToken(e){if(!e)return null;if(e.apply)return e;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g," "));return t}(e.token),this.data=e}function tokenFunction(e,t){return function(n,o){if(o.pending){var a=o.pending.shift();return 0==o.pending.length&&(o.pending=null),n.pos+=a.text.length,a.token}if(o.local){if(o.local.end&&n.match(o.local.end)){var r=o.local.endToken||null;return o.local=o.localState=null,r}var i;return r=o.local.mode.token(n,o.localState),o.local.endScan&&(i=o.local.endScan.exec(n.current()))&&(n.pos=n.start+i.index),r}for(var l=e[o.state],d=0;d<l.length;d++){var s=l[d],c=(!s.data.sol||n.sol())&&n.match(s.regex);if(c){s.data.next?o.state=s.data.next:s.data.push?((o.stack||(o.stack=[])).push(o.state),o.state=s.data.push):s.data.pop&&o.stack&&o.stack.length&&(o.state=o.stack.pop()),s.data.mode&&enterLocalMode(t,o,s.data.mode,s.token),s.data.indent&&o.indent.push(n.indentation()+t.indentUnit),s.data.dedent&&o.indent.pop();var u=s.token;if(u&&u.apply&&(u=u(c)),c.length>2&&s.token&&"string"!=typeof s.token){for(var p=2;p<c.length;p++)c[p]&&(o.pending||(o.pending=[])).push({text:c[p],token:s.token[p-1]});return n.backUp(c[0].length-(c[1]?c[1].length:0)),u[0]}return u&&u.join?u[0]:u}}return n.next(),null}}function cmp(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var o in e)if(e.hasOwnProperty(o)){if(!t.hasOwnProperty(o)||!cmp(e[o],t[o]))return!1;n++}for(var o in t)t.hasOwnProperty(o)&&n--;return 0==n}function enterLocalMode(t,n,o,a){var r;if(o.persistent)for(var i=n.persistentStates;i&&!r;i=i.next)(o.spec?cmp(o.spec,i.spec):o.mode==i.mode)&&(r=i);var l=r?r.mode:o.mode||e.getMode(t,o.spec),d=r?r.state:e.startState(l);o.persistent&&!r&&(n.persistentStates={mode:l,spec:o.spec,state:d,next:n.persistentStates}),n.localState=d,n.local={mode:l,end:o.end&&toRegex(o.end),endScan:o.end&&!1!==o.forceEnd&&toRegex(o.end,!1),endToken:a&&a.join?a[a.length-1]:a}}function indentFunction(t,n){return function(o,a,r){if(o.local&&o.local.mode.indent)return o.local.mode.indent(o.localState,a,r);if(null==o.indent||o.local||n.dontIndentStates&&function indexOf(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}(o.state,n.dontIndentStates)>-1)return e.Pass;var i=o.indent.length-1,l=t[o.state];e:for(;;){for(var d=0;d<l.length;d++){var s=l[d];if(s.data.dedent&&!1!==s.data.dedentIfLineStart){var c=s.regex.exec(a);if(c&&c[0]){i--,(s.next||s.push)&&(l=t[s.next||s.push]),a=a.slice(c[0].length);continue e}}}break}return i<0?0:o.indent[i]}}e.defineSimpleMode=function(t,n){e.defineMode(t,(function(t){return e.simpleMode(t,n)}))},e.simpleMode=function(t,n){ensureState(n,"start");var o={},a=n.meta||{},r=!1;for(var i in n)if(i!=a&&n.hasOwnProperty(i))for(var l=o[i]=[],d=n[i],s=0;s<d.length;s++){var c=d[s];l.push(new Rule(c,n)),(c.indent||c.dedent)&&(r=!0)}var u={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:r?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var o=t.persistentStates;o;o=o.next)n.persistentStates={mode:o.mode,spec:o.spec,state:o.state==t.localState?n.localState:e.copyState(o.mode,o.state),next:n.persistentStates};return n},token:tokenFunction(o,t),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:indentFunction(o,a)};if(a)for(var p in a)a.hasOwnProperty(p)&&(u[p]=a[p]);return u}},"object"==typeof t&&"object"==typeof e?o(n("../../lib/codemirror")):"function"==typeof a&&a.amd?a(["../../lib/codemirror"],o):o(CodeMirror)}));
//# sourceMappingURL=simple.js.map