/*!
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2019 Froala Labs
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(w){"use strict";w=w&&w.hasOwnProperty("default")?w["default"]:w,Object.assign(w.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),w.PLUGINS.wordPaste=function(C){var l,i,f=C.$,a="word_paste",g={};function t(e){var t=C.opts.wordAllowedStyleProps;e||(C.opts.wordAllowedStyleProps=[]),0===i.indexOf("
")&&(i=""),i=function(e,t){0<=e.indexOf("]*(]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"));!function(e){for(var t=e.split("v:shape"),r=1;r').remove()}}(e,t),!0});for(var l=n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),s=l.length-1;0<=s;s--)l[s].previousElementSibling&&"LI"===l[s].previousElementSibling.tagName&&l[s].previousElementSibling.appendChild(l[s]);u(n,function(t){if(t.nodeType===Node.TEXT_NODE)return t.data=t.data.replace(/
(\n|\r)/gi,"
"),!1;if(t.nodeType===Node.ELEMENT_NODE){if(y(t)){var r=t.parentNode,i=t.previousSibling,n=function e(t,r){var i=/[0-9a-zA-Z]./gi;var n=!1;var l=!1;var a=!1;var s;t.firstElementChild&&t.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstChild&&!(n=n||i.test(t.firstElementChild.firstElementChild.firstChild.data||""))&&t.firstElementChild.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstElementChild.firstChild&&(n=n||i.test(t.firstElementChild.firstElementChild.firstElementChild.firstChild.data||""));var o=n?"ol":"ul";var d=v(t);var f="<"+o+">"+b(t,r);var g=t.nextElementSibling;null!==g&&(s=g.previousElementSibling);var u=t.parentNode;A(t);t=null;for(;g&&y(g);){var p=v(g);if(d"+b(g,r):f+=e(g,r).outerHTML}if(d=p,g.previousElementSibling||g.nextElementSibling||g.parentNode){var h=g;g=g.nextElementSibling,A(h),h=null}else g=s?s.nextElementSibling:u.firstElementChild}f+=""+o+">";var m=document.createElement("div");m.innerHTML=f;var c=m.firstElementChild;return c}(t,a),l=null;return(l=i?i.nextSibling:r.firstChild)?r.insertBefore(n,l):r.appendChild(n),!1}return m(t,a)}return t.nodeType!==Node.COMMENT_NODE||(A(t),!1)}),u(n,function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e.tagName;if(!e.innerHTML&&-1===["BR","IMG"].indexOf(t)){for(var r=e.parentNode;r&&(A(e),!(e=r).innerHTML);)r=e.parentNode;return!1}!function(e){var t=e.getAttribute("style");if(!t)return;(t=x(t))&&";"!==t.slice(-1)&&(t+=";");var r=t.match(/(^|\S+?):.+?;{1,1}/gi);if(!r)return;for(var i={},n=0;n([\r\n\u00a0 ]*)<\/span>/g,function(e,t){for(var r="",i=0;i++/gi,"")}function E(e,t){for(var r=document.createElement(t),i=0;i");for(var a=r.firstElementChild,s=1===r.children.length;a;)"P"!==a.tagName||y(a)||s&&N(a),a=a.nextElementSibling;if(t){var o=r.getAttribute("class");if(o){var d=(o=x(o)).match(/xl[0-9]+/gi);if(d){var f="."+d[0];t[f]&&S(r,t[f])}}t.td&&S(r,t.td)}var g=r.getAttribute("style");g&&(g=x(g))&&";"!==g.slice(-1)&&(g+=";");var u=r.getAttribute("valign");if(!u&&g){var p=g.match(/vertical-align:.+?[; "]{1,1}/gi);p&&(u=p[p.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1"))}var h=null;if(g){var m=g.match(/text-align:.+?[; "]{1,1}/gi);m&&(h=m[m.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1")),"general"===h&&(h=null)}var c=null;if(g){var v=g.match(/background:.+?[; "]{1,1}/gi);v&&(c=v[v.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1"))}var b=r.getAttribute("colspan"),E=r.getAttribute("rowspan");b&&r.setAttribute("colspan",b),E&&r.setAttribute("rowspan",E),u&&(r.style["vertical-align"]=u),h&&(r.style["text-align"]=h),c&&(r.style["background-color"]=c),l&&r.setAttribute("width",l),r=r.nextElementSibling}for(r=e.firstElementChild;r;)l=r.getAttribute("width"),n?r.removeAttribute("width"):r.setAttribute("width",100*parseInt(l,10)/i+"%"),r=r.nextElementSibling}(e,t),"A"!==r||e.attributes.getNamedItem("href")||e.attributes.getNamedItem("name")||!e.innerHTML||(e.outerHTML=e.innerHTML),"TD"!==r&&"TH"!==r||e.innerHTML||(e.innerHTML="
"),"TABLE"===r&&(e.style.width="100%"),e.getAttribute("lang")&&e.removeAttribute("lang"),e.getAttribute("style")&&-1!==e.getAttribute("style").toLowerCase().indexOf("mso")){var c=x(e.getAttribute("style"));(c=c.replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,""))?e.setAttribute("style",c):e.removeAttribute("style")}return!0}return{_init:function(){C.events.on("paste.wordPaste",function(e){return i=e,C.opts.wordPasteModal?function(){if(!l){var e=' '+C.language.translate("Word Paste Detected")+"
",t=(n='',n+='
'+C.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"
",n+='
",n+="
"),r=C.modals.create(a,e,t),i=r.$body;l=r.$modal,r.$modal.addClass("fr-middle"),C.events.bindClick(i,"button.fr-remove-word",function(){var e=l.data("instance")||C;e.wordPaste.clean()}),C.events.bindClick(i,"button.fr-keep-word",function(){var e=l.data("instance")||C;e.wordPaste.clean(!0)}),C.events.$on(f(C.o_win),"resize",function(){C.modals.resize(a)})}var n;C.modals.show(a),C.modals.resize(a)}():t(C.opts.wordPasteKeepFormatting),!1})},clean:t}}});