(function(){var a=/^[\t\r\n ]*(?:&nbsp;|\xa0)$/,b='{cke_protected}';function c(H){var I=H.children.length,J=H.children[I-1];while(J&&J.type==CKEDITOR.NODE_TEXT&&!CKEDITOR.tools.trim(J.value))J=H.children[--I];return J;};function d(H,I){var J=H.children,K=c(H);if(K){if((I||!CKEDITOR.env.ie)&&K.type==CKEDITOR.NODE_ELEMENT&&K.name=='br')J.pop();if(K.type==CKEDITOR.NODE_TEXT&&a.test(K.value))J.pop();}};function e(H,I,J){if(!I&&(!J||typeof J=='function'&&J(H)===false))return false;if(I&&CKEDITOR.env.ie&&(document.documentMode>7||H.name in CKEDITOR.dtd.tr||H.name in CKEDITOR.dtd.$listItem))return false;var K=c(H);return!K||K&&(K.type==CKEDITOR.NODE_ELEMENT&&K.name=='br'||H.name=='form'&&K.name=='input');};function f(H,I){return function(J){d(J,!H);if(e(J,!H,I))if(H||CKEDITOR.env.ie)J.add(new CKEDITOR.htmlParser.text('\xa0'));else J.add(new CKEDITOR.htmlParser.element('br',{}));};};var g=CKEDITOR.dtd,h=['caption','colgroup','col','thead','tfoot','tbody'],i=CKEDITOR.tools.extend({},g.$block,g.$listItem,g.$tableContent);for(var j in i){if(!('br' in g[j]))delete i[j];}delete i.pre;var k={elements:{},attributeNames:[[/^on/,'data-cke-pa-on']]},l={elements:{}};for(j in i)l.elements[j]=f();var m={elementNames:[[/^cke:/,''],[/^\?xml:namespace$/,'']],attributeNames:[[/^data-cke-(saved|pa)-/,''],[/^data-cke-.*/,''],['hidefocus','']],elements:{$:function(H){var I=H.attributes;if(I){if(I['data-cke-temp'])return false;var J=['name','href','src'],K;for(var L=0;L<J.length;L++){K='data-cke-saved-'+J[L];K in I&&delete I[J[L]];}}return H;},table:function(H){var I=H.children;I.sort(function(J,K){return J.type==CKEDITOR.NODE_ELEMENT&&K.type==J.type?CKEDITOR.tools.indexOf(h,J.name)>CKEDITOR.tools.indexOf(h,K.name)?1:-1:0;});},embed:function(H){var I=H.parent;if(I&&I.name=='object'){var J=I.attributes.width,K=I.attributes.height;J&&(H.attributes.width=J);K&&(H.attributes.height=K);}},param:function(H){H.children=[];H.isEmpty=true;return H;},a:function(H){if(!(H.children.length||H.attributes.name||H.attributes['data-cke-saved-name']))return false;},span:function(H){if(H.attributes['class']=='Apple-style-span')delete H.name;},pre:function(H){CKEDITOR.env.ie&&d(H);},html:function(H){delete H.attributes.contenteditable;delete H.attributes['class'];},body:function(H){delete H.attributes.spellcheck;delete H.attributes.contenteditable;},style:function(H){var I=H.children[0];I&&I.value&&(I.value=CKEDITOR.tools.trim(I.value));if(!H.attributes.type)H.attributes.type='text/css';},title:function(H){var I=H.children[0];
I&&(I.value=H.attributes['data-cke-title']||'');}},attributes:{'class':function(H,I){return CKEDITOR.tools.ltrim(H.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}}};if(CKEDITOR.env.ie)m.attributes.style=function(H,I){return H.replace(/(^|;)([^\:]+)/g,function(J){return J.toLowerCase();});};function n(H){var I=H.attributes;if(I.contenteditable!='false')I['data-cke-editable']=I.contenteditable?'true':1;I.contenteditable='false';};function o(H){var I=H.attributes;switch(I['data-cke-editable']){case 'true':I.contenteditable='true';break;case '1':delete I.contenteditable;break;}};for(j in {input:1,textarea:1}){k.elements[j]=n;m.elements[j]=o;}var p=/<(a|area|img|input)\b([^>]*)>/gi,q=/\b(href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,r=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,s=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,t=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,u=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,v=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function w(H){return H.replace(p,function(I,J,K){return '<'+J+K.replace(q,function(L,M){if(K.indexOf('data-cke-saved-'+M)==-1)return ' data-cke-saved-'+L+' '+L;return L;})+'>';});};function x(H){return H.replace(r,function(I){return '<cke:encoded>'+encodeURIComponent(I)+'</cke:encoded>';});};function y(H){return H.replace(s,function(I,J){return decodeURIComponent(J);});};function z(H){return H.replace(t,'$1cke:$2');};function A(H){return H.replace(u,'$1$2');};function B(H){return H.replace(v,'<cke:$1$2></cke:$1>');};function C(H){return H.replace(/(<pre\b[^>]*>)(\r\n|\n)/g,'$1$2$2');};function D(H){return H.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(I){return '<!--'+b+'{C}'+encodeURIComponent(I).replace(/--/g,'%2D%2D')+'-->';});};function E(H){return H.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(I,J){return decodeURIComponent(J);});};function F(H,I){var J=I._.dataStore;return H.replace(/<!--\{cke_protected\}([\s\S]+?)-->/g,function(K,L){return decodeURIComponent(L);}).replace(/\{cke_protected_(\d+)\}/g,function(K,L){return J&&J[L]||'';});};function G(H,I){var J=[],K=I.config.protectedSource,L=I._.dataStore||(I._.dataStore={id:1}),M=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,N=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(K);H=H.replace(/<!--[\s\S]*?-->/g,function(P){return '<!--{cke_tempcomment}'+(J.push(P)-1)+'-->';});for(var O=0;O<N.length;O++)H=H.replace(N[O],function(P){P=P.replace(M,function(Q,R,S){return J[S];
});return/cke_temp(comment)?/.test(P)?P:'<!--{cke_temp}'+(J.push(P)-1)+'-->';});H=H.replace(M,function(P,Q,R){return '<!--'+b+(Q?'{C}':'')+encodeURIComponent(J[R]).replace(/--/g,'%2D%2D')+'-->';});return H.replace(/(['"]).*?\1/g,function(P){return P.replace(/<!--\{cke_protected\}([\s\S]+?)-->/g,function(Q,R){L[L.id]=decodeURIComponent(R);return '{cke_protected_'+L.id++ +'}';});});};CKEDITOR.plugins.add('htmldataprocessor',{requires:['htmlwriter'],init:function(H){var I=H.dataProcessor=new CKEDITOR.htmlDataProcessor(H);I.writer.forceSimpleAmpersand=H.config.forceSimpleAmpersand;I.dataFilter.addRules(k);I.dataFilter.addRules(l);I.htmlFilter.addRules(m);var J={elements:{}};for(j in i)J.elements[j]=f(true,H.config.fillEmptyBlocks);I.htmlFilter.addRules(J);},onLoad:function(){!('fillEmptyBlocks' in CKEDITOR.config)&&(CKEDITOR.config.fillEmptyBlocks=1);}});CKEDITOR.htmlDataProcessor=function(H){var I=this;I.editor=H;I.writer=new CKEDITOR.htmlWriter();I.dataFilter=new CKEDITOR.htmlParser.filter();I.htmlFilter=new CKEDITOR.htmlParser.filter();};CKEDITOR.htmlDataProcessor.prototype={toHtml:function(H,I){H=G(H,this.editor);H=w(H);H=x(H);H=z(H);H=B(H);H=C(H);var J=new CKEDITOR.dom.element('div');J.setHtml('a'+H);H=J.getHtml().substr(1);H=A(H);H=y(H);H=E(H);var K=CKEDITOR.htmlParser.fragment.fromHtml(H,I),L=new CKEDITOR.htmlParser.basicWriter();K.writeHtml(L,this.dataFilter);H=L.getHtml(true);H=D(H);return H;},toDataFormat:function(H,I){var J=this.writer,K=CKEDITOR.htmlParser.fragment.fromHtml(H,I);J.reset();K.writeHtml(J,this.htmlFilter);var L=J.getHtml(true);L=E(L);L=F(L,this.editor);return L;}};})();
