!function(e,t){"use strict";function n(e,t){for(var n,o=[],i=0;i=d[1]?(i=c,a=d[1]-s):o&&l.push(c),!o&&c.length+s>d[0]&&(o=c,r=d[0]-s),s+=c.length),o&&i){if(c=n({startNode:o,startNodeIndex:r,endNode:i,endNodeIndex:a,innerNodes:l,match:d[2],matchIndex:u}),s-=i.length-a,o=null,i=null,l=[],d=t.shift(),u++,!d)break}else{if((!h[c.nodeName]||g[c.nodeName])&&c.firstChild){c=c.firstChild;continue}if(c.nextSibling){c=c.nextSibling;continue}}for(;;){if(c.nextSibling){c=c.nextSibling;break}if(c.parentNode===e)break e;c=c.parentNode}}}function a(e){var t;if("function"!=typeof e){var n=e.nodeType?e:p.createElement(e);t=function(e,t){var o=n.cloneNode(!1);return o.setAttribute("data-mce-index",t),e&&o.appendChild(p.createTextNode(e)),o}}else t=e;return function o(e){var n,o,i,r=e.startNode,a=e.endNode,l=e.matchIndex;if(r===a){var s=r;i=s.parentNode,e.startNodeIndex>0&&(n=p.createTextNode(s.data.substring(0,e.startNodeIndex)),i.insertBefore(n,s));var c=t(e.match[0],l);return i.insertBefore(c,s),e.endNodeIndexf;++f){var g=e.innerNodes[f],h=t(g.data,l);g.parentNode.replaceChild(h,g),u.push(h)}var v=t(a.data.substring(0,e.endNodeIndex),l);return i=r.parentNode,i.insertBefore(n,r),i.insertBefore(d,r),i.removeChild(r),i=a.parentNode,i.insertBefore(v,a),i.insertBefore(o,a),i.removeChild(a),v}}function l(e){var t=[];return s(function(n,o){e(n,o)&&t.push(n)}),u=t,this}function s(e){for(var t=0,n=u.length;n>t&&e(u[t],t)!==!1;t++);return this}function c(e){return u.length&&(m=u.length,r(t,u,a(e))),this}var d,u=[],f,m=0,p,g,h,v;if(p=t.ownerDocument,g=n.getBlockElements(),h=n.getWhiteSpaceElements(),v=n.getShortEndedElements(),f=i(t),f&&e.global)for(;d=e.exec(f);)u.push(o(d));return{text:f,count:m,matches:u,each:s,filter:l,mark:c}}}),o(c,[s,d,u,f,m,p,g],function(e,t,n,o,i,r,a){t.add("spellchecker",function(t,l){function s(e){for(var t in e)return!1;return!0}function c(e,r){var a=[],l=h[r];n.each(l,function(e){a.push({text:e,onclick:function(){t.insertContent(e),u()}})}),a.push.apply(a,[{text:"-"},{text:"Ignore",onclick:function(){m(e,r)}},{text:"Ignore all",onclick:function(){m(e,r,!0)}},{text:"Finish",onclick:p}]),b=new o({items:a,context:"contextmenu",onautohide:function(e){-1!=e.target.className.indexOf("spellchecker")&&e.preventDefault()},onhide:function(){b.remove(),b=null}}),b.renderTo(document.body);var s=i.DOM.getPos(t.getContentAreaContainer()),c=t.dom.getPos(e);s.x+=c.x,s.y+=c.y,b.moveTo(s.x,s.y+e.offsetHeight)}function d(){function n(e){return t.setProgressState(!1),s(e)?(t.windowManager.alert("No misspellings found"),void(v=!1)):(h=e,i.filter(function(t){return!!e[t[2][0]]}).mark(t.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1})),i=null,void t.fire("SpellcheckStart"))}function o(e,n,o){r.sendRPC({url:new a(l).toAbsolute(y.spellchecker_rpc_url),method:e,params:{lang:y.spellchecker_language||"en",words:n},success:function(e){o(e)},error:function(e,n){e="JSON Parse error."==e?"Non JSON response:"+n.responseText:"Error: "+e,t.windowManager.alert(e),t.setProgressState(!1),i=null,v=!1}})}var i,c=[],d={};if(v)return void p();v=!0;var u=t.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e]+',"g");i=new e(u,t.getBody(),t.schema).each(function(e){var t=e[2][0];if(!d[t]){if(/^\d+$/.test(t)||1==t.length)return;c.push(t),d[t]=!0}}),t.setProgressState(!0);var f=y.spellchecker_callback||o;f("spellcheck",c,n)}function u(){t.dom.select("span.mce-spellchecker-word").length||p()}function f(e){var t=e.parentNode;t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)}function m(e,o,i){i?n.each(t.dom.select("span.mce-spellchecker-word"),function(e){var t=e.innerText||e.textContent;t==o&&f(e)}):f(e),u()}function p(){var e,n,o;for(v=!1,o=t.getBody(),n=o.getElementsByTagName("span"),e=n.length;e--;)o=n[e],o.getAttribute("data-mce-index")&&f(o);t.fire("SpellcheckEnd")}function g(e){var n,o,i,r=-1,a,l;for(e=""+e,n=t.getBody().getElementsByTagName("span"),o=0;o