!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<arguments.length;e++)n[e]=arguments[e]},noarg:function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t()}},compose:function(t,r){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t(r.apply(null,arguments))}},constant:d,identity:function(n){return n},tripleEquals:function(n,e){return n===e},curry:function(u){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];for(var i=new Array(arguments.length-1),t=1;t<arguments.length;t++)i[t-1]=arguments[t];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var o=i.concat(t);return u.apply(null,o)}},not:function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return!t.apply(null,arguments)}},die:function(n){return function(){throw new Error(n)}},apply:function(n){return n()},call:function(n){n()},never:d(!1),always:d(!0)},p=m.never,v=m.always,h=function(){return g},g=(r={fold:function(n,e){return n()},is:p,isSome:p,isNone:v,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},or:t,orThunk:e,map:h,ap:h,each:function(){},bind:h,flatten:h,exists:p,forall:v,filter:h,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:m.constant("none()")},Object.freeze&&Object.freeze(r),r),y=function(t){var n=function(){return t},e=function(){return o},r=function(n){return n(t)},o={fold:function(n,e){return e(t)},is:function(n){return t===n},isSome:v,isNone:p,getOr:n,getOrThunk:n,getOrDie:n,or:e,orThunk:e,map:function(n){return y(n(t))},ap:function(n){return n.fold(h,function(n){return y(n(t))})},each:function(n){n(t)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(t)?o:g},equals:function(n){return n.is(t)},equals_:function(n,e){return n.fold(p,function(n){return e(t,n)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},b={some:y,none:h,from:function(n){return null===n||n===undefined?g:y(n)}},T=function(e){return function(n){return function(n){if(null===n)return"null";var e=typeof n;return"object"===e&&Array.prototype.isPrototypeOf(n)?"array":"object"===e&&String.prototype.isPrototypeOf(n)?"string":e}(n)===e}},w={isString:T("string"),isObject:T("object"),isArray:T("array"),isNull:T("null"),isBoolean:T("boolean"),isUndefined:T("undefined"),isFunction:T("function"),isNumber:T("number")},x=(Array.prototype.indexOf,undefined,function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var u=n[o];r[o]=e(u,o,n)}return r}),E=function(n,e){for(var t=0,r=n.length;t<r;t++)e(n[t],t,n)},N=(Array.prototype.push,Array.prototype.slice,w.isFunction(Array.from)&&Array.from,x),k=E,A=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:m.constant(n)}},O={fromHtml:function(n,e){var t=(e||document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw console.error("HTML does not have a single root node",n),"HTML must have a single root node";return A(t.childNodes[0])},fromTag:function(n,e){var t=(e||document).createElement(n);return A(t)},fromText:function(n,e){var t=(e||document).createTextNode(n);return A(t)},fromDom:A,fromPoint:function(n,e,t){return b.from(n.dom().elementFromPoint(e,t)).map(A)}},C=8,M=9,S=3,D=function(n){return n.dom().nodeName.toLowerCase()},P=function(n){return n.dom().nodeType},B=function(e){return function(n){return P(n)===e}},j=B(1),V=B(S),q=B(M),H={name:D,type:P,value:function(n){return n.dom().nodeValue},isElement:j,isText:V,isDocument:q,isComment:function(n){return P(n)===C||"#comment"===D(n)}},L=function(n){return'<span data-mce-bogus="1" class="mce-'+s.charMap[n]+'">'+n+"</span>"},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)})}()