!function(){"use strict";var n,e,t,r,o=function(n){var e=n,t=function(){return e};return{get:t,set:function(n){e=n},clone:function(){return o(t())}}},u=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n){return{isEnabled:function(){return n.get()}}},c=function(n,e){return n.fire("VisualChars",{state:e})},a={"\xa0":"nbsp","\xad":"shy"},f=function(n,e){var t,r="";for(t in n)r+=t;return new RegExp("["+r+"]",e?"g":"")},l=function(n){var e,t="";for(e in n)t&&(t+=","),t+="span.mce-"+n[e];return t},s={charMap:a,regExp:f(a),regExpGlobal:f(a,!0),selector:l(a),charMapToRegExp:f,charMapToSelector:l},d=function(n){return function(){return n}},m={noop:function(){for(var n=[],e=0;e'+n+""},R=function(n,e){var t=[],r=n.dom(),o=N(r.childNodes,O.fromDom);return k(o,function(n){e(n)&&(t=t.concat([n])),t=t.concat(R(n,e))}),t},_={isMatch:function(n){return H.isText(n)&&H.value(n)!==undefined&&s.regExp.test(H.value(n))},filterDescendants:R,findParentElm:function(n,e){for(;n.parentNode;){if(n.parentNode===e)return n;n=n.parentNode}},replaceWithSpans:function(n){return n.replace(s.regExpGlobal,L)}},F=function(t,n){var r,o,e=_.filterDescendants(O.fromDom(n),_.isMatch);k(e,function(n){var e=_.replaceWithSpans(H.value(n));for(o=t.dom.create("div",null,e);r=o.lastChild;)t.dom.insertAfter(r,n.dom());t.dom.remove(n.dom())})},z=function(e,n){var t=e.dom.select(s.selector,n);k(t,function(n){e.dom.remove(n,1)})},G=F,W=z,I=function(n){var e=n.getBody(),t=n.selection.getBookmark(),r=_.findParentElm(n.selection.getNode(),e);r=r!==undefined?r:e,z(n,r),F(n,r),n.selection.moveToBookmark(t)},U=function(n,e){var t,r=n.getBody(),o=n.selection;e.set(!e.get()),c(n,e.get()),t=o.getBookmark(),!0===e.get()?G(n,r):W(n,r),o.moveToBookmark(t)},J=function(n,e){n.addCommand("mceVisualChars",function(){U(n,e)})},K=tinymce.util.Tools.resolve("tinymce.util.Delay"),Q=function(e,t){var r=K.debounce(function(){I(e)},300);!1!==e.settings.forced_root_block&&e.on("keydown",function(n){!0===t.get()&&(13===n.keyCode?I(e):r())})},X=function(t){return function(n){var e=n.control;t.on("VisualChars",function(n){e.active(n.state)})}};u.add("visualchars",function(n){var e,t=o(!1);return J(n,t),(e=n).addButton("visualchars",{active:!1,title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:X(e)}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:X(e),selectable:!0,context:"view",prependToContext:!0}),Q(n,t),i(t)})}();