Liferay.Loader.define("portal-search-web$codemirror@5.62.0/addon/fold/xml-fold",["module","exports","require","../../lib/codemirror"],(function(e,n,t){window,function(e){"use strict";var n=e.Pos;function t(e,n){return e.line-n.line||e.ch-n.ch}var r="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=new RegExp("<(/?)(["+r+"]["+r+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function f(e,n,t,r){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=r?Math.max(r.from,e.firstLine()):e.firstLine(),this.max=r?Math.min(r.to-1,e.lastLine()):e.lastLine()}function o(e,t){var r=e.cm.getTokenTypeAt(n(e.line,t));return r&&/\btag\b/.test(r)}function l(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function u(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function c(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(l(e))continue;return}if(o(e,n+1)){var t=e.text.lastIndexOf("/",n),r=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,r?"selfClose":"regular"}e.ch=n+1}}function a(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==n){if(u(e))continue;return}if(o(e,n+1)){i.lastIndex=n,e.ch=n;var t=i.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function s(e){for(;;){i.lastIndex=e.ch;var n=i.exec(e.text);if(!n){if(l(e))continue;return}if(o(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}function h(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==n){if(u(e))continue;return}if(o(e,n+1)){var t=e.text.lastIndexOf("/",n),r=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,r?"selfClose":"regular"}e.ch=n}}function x(e,t){for(var r=[];;){var i,f=s(e),o=e.line,l=e.ch-(f?f[0].length:0);if(!f||!(i=c(e)))return;if("selfClose"!=i)if(f[1]){for(var u=r.length-1;u>=0;--u)if(r[u]==f[2]){r.length=u;break}if(u<0&&(!t||t==f[2]))return{tag:f[2],from:n(o,l),to:n(e.line,e.ch)}}else r.push(f[2])}}function d(e,t){for(var r=[];;){var i=h(e);if(!i)return;if("selfClose"!=i){var f=e.line,o=e.ch,l=a(e);if(!l)return;if(l[1])r.push(l[2]);else{for(var u=r.length-1;u>=0;--u)if(r[u]==l[2]){r.length=u;break}if(u<0&&(!t||t==l[2]))return{tag:l[2],from:n(e.line,e.ch),to:n(f,o)}}}else a(e)}}e.registerHelper("fold","xml",(function(e,r){for(var i=new f(e,r.line,0);;){var o=s(i);if(!o||i.line!=r.line)return;var l=c(i);if(!l)return;if(!o[1]&&"selfClose"!=l){var u=n(i.line,i.ch),a=x(i,o[2]);return a&&t(a.from,u)>0?{from:u,to:a.from}:null}}})),e.findMatchingTag=function(e,r,i){var o=new f(e,r.line,r.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var l=c(o),u=l&&n(o.line,o.ch),s=l&&a(o);if(l&&s&&!(t(o,r)>0)){var h={from:n(o.line,o.ch),to:u,tag:s[2]};return"selfClose"==l?{open:h,close:null,at:"open"}:s[1]?{open:d(o,s[2]),close:h,at:"close"}:{open:h,close:x(o=new f(e,u.line,u.ch,i),s[2]),at:"open"}}}},e.findEnclosingTag=function(e,n,t,r){for(var i=new f(e,n.line,n.ch,t);;){var o=d(i,r);if(!o)break;var l=x(new f(e,n.line,n.ch,t),o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,n,t,r){return x(new f(e,n.line,n.ch,r?{from:0,to:r}:null),t)}}("object"==typeof n&&"object"==typeof e?t("../../lib/codemirror"):CodeMirror)}));
//# sourceMappingURL=xml-fold.js.map