/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.6.2 (2020-12-08) */!function(){"use strict";varn,t,e,o,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(n,t){vare,o=n.dom,r=n.selection.getSelectedBlocks();r.length&&(e=o.getAttrib(r[0],"dir"),u.each(r,function(n){o.getParent(n.parentNode,'*[dir="'+t+'"]',o.getRoot())||o.setAttrib(n,"dir",e!==t?t:null)}),n.nodeChanged())},c=function(n){returnfunction(){returnn}},f=c(!1),d=c(!0),l=function(){returnm},m=(n=function(n){returnn.isNone()},{fold:function(n,t){returnn()},is:f,isSome:f,isNone:d,getOr:e=function(n){returnn},getOrThunk:t=function(n){returnn()},getOrDie:function(n){thrownewError(n||"error: getOrDie called on none.")},getOrNull:c(null),getOrUndefined:c(undefined),or:e,orThunk:t,map:l,each:function(){},bind:l,exists:f,forall:d,filter:l,equals:n,equals_:n,toArray:function(){return[]},toString:c("none()")}),a=function(e){varn=c(e),t=function(){returnr},o=function(n){returnn(e)},r={fold:function(n,t){returnt(e)},is:function(n){returne===n},isSome:d,isNone:f,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){returna(n(e))},each:function(n){n(e)},bind:o,exists:o,forall:o,filter:function(n){returnn(e)?r:m},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(n){returnn.is(e)},equals_:function(n,t){returnn.fold(f,function(n){returnt(e,n)})}};returnr},s={some:a,none:l,from:function(n){returnnull===n||n===undefined?m:a(n)}},g=(o="function",function(n){returntypeofn===o}),h=function(n){if(null===n||n===undefined)thrownewError("Node cannot be null or undefined");return{dom:n}},y={fromHtml:function(n,t){vare=(t||document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||1<e.childNodes.length)throwconsole.error("HTML does not have a single root node",n),newError("HTML must have a single root node");returnh(e.childNodes[0])},fromTag:function(n,t){vare=(t||document).createElement(n);returnh(e)},fromText:function(n,t){vare=(t||document).createTextNode(n);returnh(e)},fromDom:h,fromPoint:function(n,t,e){returns.from(n.dom.elementFromPoint(t,e)).map(h)}},v=("undefined"!=typeofwindow||Function("return this;")(),function(t){returnfunction(n){returnn.dom.nodeType===t}}),p=v(3),T=v(9),N=v(11),D=g(Element.prototype.attachShadow)&&g(Node.prototype.getRootNode)?function(n){returny.fromDom(n.dom.getRootNode())}:function(n){returnT(n)?n:(t=n,y.fromDom(t.dom.ownerDocument));vart},w=function(n){vart=D(n);returnN(t)?s.some(t):s.none()},O=function(n){returny.fromDom(n.dom.host)},C=function(n){vart=p(n)?n.dom.parentNode:n.dom;if(t===undefined||null===t||null===t.ownerDocument)return!1;vare,o,r=t.ownerDocument;returnw(y.fromDom(t)).fold(function(){returnr.body.contains(t)},(e=C,o=O,function(n){returne(o(n))}))},S=function(n,t){return(e=n).style!==undefined&&g(e.style.getPropertyValue)?n.style.getPropertyValue(t):"";vare},L=function(n){return"rtl"===(e="direction",o=(t=n).dom,""!==(r=window.getComputedStyle(o).getPropertyValue(e))||C(t)?r:S(o,e))?"rtl":"ltr";vart,e,o,r},R=function(t,o){returnfunction(e){varn=function(n){vart=y.fromDom(n.element);e.setActive(L(t)===o)};returnt.on("NodeChange",n),function(){returnt.off("NodeChange",n)}}};r.add("directionality",function(n){vart,e;(t=n).addCommand("mceDirectionLTR",function(){i(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){i(t,"rtl")}),(e=n).ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:function(){returne.execCommand("mceDirectionLTR")},onSetup:R(e,"ltr")}),e.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:function(){returne.execCommand("mceDirectionRTL")},onSetup:R(e,"rtl")})})}();