!function(){function t(t,e){for(var n=t.length,r=0,a=0;a<n;a+=1){var E=t[a];if(e>=r&&r+E.getText().length>=e)return{element:E,offset:e-r};r+=E.getText().length}return null}NEW_CKEDITOR.plugins.add("textmatch",{}),NEW_CKEDITOR.plugins.textMatch={},NEW_CKEDITOR.plugins.textMatch.match=function(t,e){var n=NEW_CKEDITOR.plugins.textMatch.getTextAndOffset(t),r=NEW_CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE,a=0;if(n)return 0==n.text.indexOf(r)&&(a=r.length,n.text=n.text.replace(r,""),n.offset-=a),(r=e(n.text,n.offset))?{range:NEW_CKEDITOR.plugins.textMatch.getRangeInText(t,r.start,r.end+a),text:n.text.slice(r.start,r.end)}:null},NEW_CKEDITOR.plugins.textMatch.getTextAndOffset=function(t){if(!t.collapsed)return null;var e,n="",r=0,a=NEW_CKEDITOR.plugins.textMatch.getAdjacentTextNodes(t),E=!1,s=t.startContainer.type!=NEW_CKEDITOR.NODE_ELEMENT;e=s?function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}(a,(function(e){return t.startContainer.equals(e)})):t.startOffset-(a[0]?a[0].getIndex():0);for(var g=a.length,f=0;f<g;f+=1){var l=a[f];n=n+l.getText();E||(s?f==e?(E=!0,r+=t.startOffset):r+=l.getText().length:(f==e&&(E=!0),0<f&&(r+=a[f-1].getText().length),g==e&&f+1==g&&(r+=l.getText().length)))}return{text:n,offset:r}},NEW_CKEDITOR.plugins.textMatch.getRangeInText=function(e,n,r){var a=new NEW_CKEDITOR.dom.range(e.root);return n=t(e=NEW_CKEDITOR.plugins.textMatch.getAdjacentTextNodes(e),n),r=t(e,r),a.setStart(n.element,n.offset),a.setEnd(r.element,r.offset),a},NEW_CKEDITOR.plugins.textMatch.getAdjacentTextNodes=function(t){if(!t.collapsed)return[];var e,n,r,a=[];for(t.startContainer.type!=NEW_CKEDITOR.NODE_ELEMENT?(e=t.startContainer.getParent().getChildren(),t=t.startContainer.getIndex()):(e=t.startContainer.getChildren(),t=t.startOffset),r=t;(n=e.getItem(--r))&&n.type==NEW_CKEDITOR.NODE_TEXT;)a.unshift(n);for(r=t;(n=e.getItem(r++))&&n.type==NEW_CKEDITOR.NODE_TEXT;)a.push(n);return a}}();