wp/wp-includes/js/tinymce/plugins/paste/plugin.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     1 (function () {
     1 (function () {
     2 var paste = (function () {
     2 var paste = (function (domGlobals) {
     3   'use strict';
     3     'use strict';
     4 
     4 
     5   var Cell = function (initial) {
     5     var Cell = function (initial) {
     6     var value = initial;
     6       var value = initial;
     7     var get = function () {
     7       var get = function () {
     8       return value;
     8         return value;
     9     };
     9       };
    10     var set = function (v) {
    10       var set = function (v) {
    11       value = v;
    11         value = v;
    12     };
    12       };
    13     var clone = function () {
    13       var clone = function () {
    14       return Cell(get());
    14         return Cell(get());
    15     };
    15       };
    16     return {
    16       return {
    17       get: get,
    17         get: get,
    18       set: set,
    18         set: set,
    19       clone: clone
    19         clone: clone
    20     };
    20       };
    21   };
    21     };
    22 
    22 
    23   var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
    23     var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
    24 
    24 
    25   var hasProPlugin = function (editor) {
    25     var hasProPlugin = function (editor) {
    26     if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) {
    26       if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) {
    27       if (typeof window.console !== 'undefined' && window.console.log) {
    27         if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) {
    28         window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
    28           domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
    29       }
    29         }
    30       return true;
    30         return true;
    31     } else {
    31       } else {
    32       return false;
    32         return false;
       
    33       }
       
    34     };
       
    35     var DetectProPlugin = { hasProPlugin: hasProPlugin };
       
    36 
       
    37     var get = function (clipboard, quirks) {
       
    38       return {
       
    39         clipboard: clipboard,
       
    40         quirks: quirks
       
    41       };
       
    42     };
       
    43     var Api = { get: get };
       
    44 
       
    45     var firePastePreProcess = function (editor, html, internal, isWordHtml) {
       
    46       return editor.fire('PastePreProcess', {
       
    47         content: html,
       
    48         internal: internal,
       
    49         wordContent: isWordHtml
       
    50       });
       
    51     };
       
    52     var firePastePostProcess = function (editor, node, internal, isWordHtml) {
       
    53       return editor.fire('PastePostProcess', {
       
    54         node: node,
       
    55         internal: internal,
       
    56         wordContent: isWordHtml
       
    57       });
       
    58     };
       
    59     var firePastePlainTextToggle = function (editor, state) {
       
    60       return editor.fire('PastePlainTextToggle', { state: state });
       
    61     };
       
    62     var firePaste = function (editor, ieFake) {
       
    63       return editor.fire('paste', { ieFake: ieFake });
       
    64     };
       
    65     var Events = {
       
    66       firePastePreProcess: firePastePreProcess,
       
    67       firePastePostProcess: firePastePostProcess,
       
    68       firePastePlainTextToggle: firePastePlainTextToggle,
       
    69       firePaste: firePaste
       
    70     };
       
    71 
       
    72     var shouldPlainTextInform = function (editor) {
       
    73       return editor.getParam('paste_plaintext_inform', true);
       
    74     };
       
    75     var shouldBlockDrop = function (editor) {
       
    76       return editor.getParam('paste_block_drop', false);
       
    77     };
       
    78     var shouldPasteDataImages = function (editor) {
       
    79       return editor.getParam('paste_data_images', false);
       
    80     };
       
    81     var shouldFilterDrop = function (editor) {
       
    82       return editor.getParam('paste_filter_drop', true);
       
    83     };
       
    84     var getPreProcess = function (editor) {
       
    85       return editor.getParam('paste_preprocess');
       
    86     };
       
    87     var getPostProcess = function (editor) {
       
    88       return editor.getParam('paste_postprocess');
       
    89     };
       
    90     var getWebkitStyles = function (editor) {
       
    91       return editor.getParam('paste_webkit_styles');
       
    92     };
       
    93     var shouldRemoveWebKitStyles = function (editor) {
       
    94       return editor.getParam('paste_remove_styles_if_webkit', true);
       
    95     };
       
    96     var shouldMergeFormats = function (editor) {
       
    97       return editor.getParam('paste_merge_formats', true);
       
    98     };
       
    99     var isSmartPasteEnabled = function (editor) {
       
   100       return editor.getParam('smart_paste', true);
       
   101     };
       
   102     var isPasteAsTextEnabled = function (editor) {
       
   103       return editor.getParam('paste_as_text', false);
       
   104     };
       
   105     var getRetainStyleProps = function (editor) {
       
   106       return editor.getParam('paste_retain_style_properties');
       
   107     };
       
   108     var getWordValidElements = function (editor) {
       
   109       var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';
       
   110       return editor.getParam('paste_word_valid_elements', defaultValidElements);
       
   111     };
       
   112     var shouldConvertWordFakeLists = function (editor) {
       
   113       return editor.getParam('paste_convert_word_fake_lists', true);
       
   114     };
       
   115     var shouldUseDefaultFilters = function (editor) {
       
   116       return editor.getParam('paste_enable_default_filters', true);
       
   117     };
       
   118     var Settings = {
       
   119       shouldPlainTextInform: shouldPlainTextInform,
       
   120       shouldBlockDrop: shouldBlockDrop,
       
   121       shouldPasteDataImages: shouldPasteDataImages,
       
   122       shouldFilterDrop: shouldFilterDrop,
       
   123       getPreProcess: getPreProcess,
       
   124       getPostProcess: getPostProcess,
       
   125       getWebkitStyles: getWebkitStyles,
       
   126       shouldRemoveWebKitStyles: shouldRemoveWebKitStyles,
       
   127       shouldMergeFormats: shouldMergeFormats,
       
   128       isSmartPasteEnabled: isSmartPasteEnabled,
       
   129       isPasteAsTextEnabled: isPasteAsTextEnabled,
       
   130       getRetainStyleProps: getRetainStyleProps,
       
   131       getWordValidElements: getWordValidElements,
       
   132       shouldConvertWordFakeLists: shouldConvertWordFakeLists,
       
   133       shouldUseDefaultFilters: shouldUseDefaultFilters
       
   134     };
       
   135 
       
   136     var shouldInformUserAboutPlainText = function (editor, userIsInformedState) {
       
   137       return userIsInformedState.get() === false && Settings.shouldPlainTextInform(editor);
       
   138     };
       
   139     var displayNotification = function (editor, message) {
       
   140       editor.notificationManager.open({
       
   141         text: editor.translate(message),
       
   142         type: 'info'
       
   143       });
       
   144     };
       
   145     var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) {
       
   146       if (clipboard.pasteFormat.get() === 'text') {
       
   147         clipboard.pasteFormat.set('html');
       
   148         Events.firePastePlainTextToggle(editor, false);
       
   149       } else {
       
   150         clipboard.pasteFormat.set('text');
       
   151         Events.firePastePlainTextToggle(editor, true);
       
   152         if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
       
   153           displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
       
   154           userIsInformedState.set(true);
       
   155         }
       
   156       }
       
   157       editor.focus();
       
   158     };
       
   159     var Actions = { togglePlainTextPaste: togglePlainTextPaste };
       
   160 
       
   161     var register = function (editor, clipboard, userIsInformedState) {
       
   162       editor.addCommand('mceTogglePlainTextPaste', function () {
       
   163         Actions.togglePlainTextPaste(editor, clipboard, userIsInformedState);
       
   164       });
       
   165       editor.addCommand('mceInsertClipboardContent', function (ui, value) {
       
   166         if (value.content) {
       
   167           clipboard.pasteHtml(value.content, value.internal);
       
   168         }
       
   169         if (value.text) {
       
   170           clipboard.pasteText(value.text);
       
   171         }
       
   172       });
       
   173     };
       
   174     var Commands = { register: register };
       
   175 
       
   176     var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
       
   177 
       
   178     var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
       
   179 
       
   180     var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
       
   181 
       
   182     var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
       
   183 
       
   184     var internalMimeType = 'x-tinymce/html';
       
   185     var internalMark = '<!-- ' + internalMimeType + ' -->';
       
   186     var mark = function (html) {
       
   187       return internalMark + html;
       
   188     };
       
   189     var unmark = function (html) {
       
   190       return html.replace(internalMark, '');
       
   191     };
       
   192     var isMarked = function (html) {
       
   193       return html.indexOf(internalMark) !== -1;
       
   194     };
       
   195     var InternalHtml = {
       
   196       mark: mark,
       
   197       unmark: unmark,
       
   198       isMarked: isMarked,
       
   199       internalHtmlMime: function () {
       
   200         return internalMimeType;
       
   201       }
       
   202     };
       
   203 
       
   204     var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities');
       
   205 
       
   206     var isPlainText = function (text) {
       
   207       return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
       
   208     };
       
   209     var toBRs = function (text) {
       
   210       return text.replace(/\r?\n/g, '<br>');
       
   211     };
       
   212     var openContainer = function (rootTag, rootAttrs) {
       
   213       var key;
       
   214       var attrs = [];
       
   215       var tag = '<' + rootTag;
       
   216       if (typeof rootAttrs === 'object') {
       
   217         for (key in rootAttrs) {
       
   218           if (rootAttrs.hasOwnProperty(key)) {
       
   219             attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"');
       
   220           }
       
   221         }
       
   222         if (attrs.length) {
       
   223           tag += ' ' + attrs.join(' ');
       
   224         }
       
   225       }
       
   226       return tag + '>';
       
   227     };
       
   228     var toBlockElements = function (text, rootTag, rootAttrs) {
       
   229       var blocks = text.split(/\n\n/);
       
   230       var tagOpen = openContainer(rootTag, rootAttrs);
       
   231       var tagClose = '</' + rootTag + '>';
       
   232       var paragraphs = global$3.map(blocks, function (p) {
       
   233         return p.split(/\n/).join('<br />');
       
   234       });
       
   235       var stitch = function (p) {
       
   236         return tagOpen + p + tagClose;
       
   237       };
       
   238       return paragraphs.length === 1 ? paragraphs[0] : global$3.map(paragraphs, stitch).join('');
       
   239     };
       
   240     var convert = function (text, rootTag, rootAttrs) {
       
   241       return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
       
   242     };
       
   243     var Newlines = {
       
   244       isPlainText: isPlainText,
       
   245       convert: convert,
       
   246       toBRs: toBRs,
       
   247       toBlockElements: toBlockElements
       
   248     };
       
   249 
       
   250     var global$6 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
       
   251 
       
   252     var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node');
       
   253 
       
   254     var global$8 = tinymce.util.Tools.resolve('tinymce.html.Schema');
       
   255 
       
   256     var global$9 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
       
   257 
       
   258     function filter(content, items) {
       
   259       global$3.each(items, function (v) {
       
   260         if (v.constructor === RegExp) {
       
   261           content = content.replace(v, '');
       
   262         } else {
       
   263           content = content.replace(v[0], v[1]);
       
   264         }
       
   265       });
       
   266       return content;
    33     }
   267     }
    34   };
   268     function innerText(html) {
    35   var $_15bf6siejjgwect1 = { hasProPlugin: hasProPlugin };
   269       var schema = global$8();
    36 
   270       var domParser = global$6({}, schema);
    37   var get = function (clipboard, quirks) {
   271       var text = '';
    38     return {
   272       var shortEndedElements = schema.getShortEndedElements();
    39       clipboard: clipboard,
   273       var ignoreElements = global$3.makeMap('script noscript style textarea video audio iframe object', ' ');
    40       quirks: quirks
   274       var blockElements = schema.getBlockElements();
    41     };
   275       function walk(node) {
    42   };
   276         var name = node.name, currentNode = node;
    43   var $_6gtliyigjjgwecte = { get: get };
   277         if (name === 'br') {
    44 
   278           text += '\n';
    45   var firePastePreProcess = function (editor, html, internal, isWordHtml) {
   279           return;
    46     return editor.fire('PastePreProcess', {
   280         }
    47       content: html,
   281         if (name === 'wbr') {
    48       internal: internal,
   282           return;
    49       wordContent: isWordHtml
   283         }
    50     });
   284         if (shortEndedElements[name]) {
    51   };
   285           text += ' ';
    52   var firePastePostProcess = function (editor, node, internal, isWordHtml) {
   286         }
    53     return editor.fire('PastePostProcess', {
   287         if (ignoreElements[name]) {
    54       node: node,
   288           text += ' ';
    55       internal: internal,
   289           return;
    56       wordContent: isWordHtml
   290         }
    57     });
   291         if (node.type === 3) {
    58   };
   292           text += node.value;
    59   var firePastePlainTextToggle = function (editor, state) {
   293         }
    60     return editor.fire('PastePlainTextToggle', { state: state });
   294         if (!node.shortEnded) {
    61   };
   295           if (node = node.firstChild) {
    62   var firePaste = function (editor, ieFake) {
   296             do {
    63     return editor.fire('paste', { ieFake: ieFake });
   297               walk(node);
    64   };
   298             } while (node = node.next);
    65   var $_8tki3zijjjgwectj = {
   299           }
    66     firePastePreProcess: firePastePreProcess,
   300         }
    67     firePastePostProcess: firePastePostProcess,
   301         if (blockElements[name] && currentNode.next) {
    68     firePastePlainTextToggle: firePastePlainTextToggle,
   302           text += '\n';
    69     firePaste: firePaste
   303           if (name === 'p') {
    70   };
   304             text += '\n';
    71 
   305           }
    72   var shouldPlainTextInform = function (editor) {
   306         }
    73     return editor.getParam('paste_plaintext_inform', true);
   307       }
    74   };
   308       html = filter(html, [/<!\[[^\]]+\]>/g]);
    75   var shouldBlockDrop = function (editor) {
   309       walk(domParser.parse(html));
    76     return editor.getParam('paste_block_drop', false);
   310       return text;
    77   };
       
    78   var shouldPasteDataImages = function (editor) {
       
    79     return editor.getParam('paste_data_images', false);
       
    80   };
       
    81   var shouldFilterDrop = function (editor) {
       
    82     return editor.getParam('paste_filter_drop', true);
       
    83   };
       
    84   var getPreProcess = function (editor) {
       
    85     return editor.getParam('paste_preprocess');
       
    86   };
       
    87   var getPostProcess = function (editor) {
       
    88     return editor.getParam('paste_postprocess');
       
    89   };
       
    90   var getWebkitStyles = function (editor) {
       
    91     return editor.getParam('paste_webkit_styles');
       
    92   };
       
    93   var shouldRemoveWebKitStyles = function (editor) {
       
    94     return editor.getParam('paste_remove_styles_if_webkit', true);
       
    95   };
       
    96   var shouldMergeFormats = function (editor) {
       
    97     return editor.getParam('paste_merge_formats', true);
       
    98   };
       
    99   var isSmartPasteEnabled = function (editor) {
       
   100     return editor.getParam('smart_paste', true);
       
   101   };
       
   102   var isPasteAsTextEnabled = function (editor) {
       
   103     return editor.getParam('paste_as_text', false);
       
   104   };
       
   105   var getRetainStyleProps = function (editor) {
       
   106     return editor.getParam('paste_retain_style_properties');
       
   107   };
       
   108   var getWordValidElements = function (editor) {
       
   109     var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';
       
   110     return editor.getParam('paste_word_valid_elements', defaultValidElements);
       
   111   };
       
   112   var shouldConvertWordFakeLists = function (editor) {
       
   113     return editor.getParam('paste_convert_word_fake_lists', true);
       
   114   };
       
   115   var shouldUseDefaultFilters = function (editor) {
       
   116     return editor.getParam('paste_enable_default_filters', true);
       
   117   };
       
   118   var $_xr8b0ikjjgwectl = {
       
   119     shouldPlainTextInform: shouldPlainTextInform,
       
   120     shouldBlockDrop: shouldBlockDrop,
       
   121     shouldPasteDataImages: shouldPasteDataImages,
       
   122     shouldFilterDrop: shouldFilterDrop,
       
   123     getPreProcess: getPreProcess,
       
   124     getPostProcess: getPostProcess,
       
   125     getWebkitStyles: getWebkitStyles,
       
   126     shouldRemoveWebKitStyles: shouldRemoveWebKitStyles,
       
   127     shouldMergeFormats: shouldMergeFormats,
       
   128     isSmartPasteEnabled: isSmartPasteEnabled,
       
   129     isPasteAsTextEnabled: isPasteAsTextEnabled,
       
   130     getRetainStyleProps: getRetainStyleProps,
       
   131     getWordValidElements: getWordValidElements,
       
   132     shouldConvertWordFakeLists: shouldConvertWordFakeLists,
       
   133     shouldUseDefaultFilters: shouldUseDefaultFilters
       
   134   };
       
   135 
       
   136   var shouldInformUserAboutPlainText = function (editor, userIsInformedState) {
       
   137     return userIsInformedState.get() === false && $_xr8b0ikjjgwectl.shouldPlainTextInform(editor);
       
   138   };
       
   139   var displayNotification = function (editor, message) {
       
   140     editor.notificationManager.open({
       
   141       text: editor.translate(message),
       
   142       type: 'info'
       
   143     });
       
   144   };
       
   145   var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) {
       
   146     if (clipboard.pasteFormat.get() === 'text') {
       
   147       clipboard.pasteFormat.set('html');
       
   148       $_8tki3zijjjgwectj.firePastePlainTextToggle(editor, false);
       
   149     } else {
       
   150       clipboard.pasteFormat.set('text');
       
   151       $_8tki3zijjjgwectj.firePastePlainTextToggle(editor, true);
       
   152       if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
       
   153         displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
       
   154         userIsInformedState.set(true);
       
   155       }
       
   156     }
   311     }
   157     editor.focus();
   312     function trimHtml(html) {
   158   };
   313       function trimSpaces(all, s1, s2) {
   159   var $_2j7vw7iijjgwecti = { togglePlainTextPaste: togglePlainTextPaste };
   314         if (!s1 && !s2) {
   160 
   315           return ' ';
   161   var register = function (editor, clipboard, userIsInformedState) {
   316         }
   162     editor.addCommand('mceTogglePlainTextPaste', function () {
   317         return '\xA0';
   163       $_2j7vw7iijjgwecti.togglePlainTextPaste(editor, clipboard, userIsInformedState);
   318       }
   164     });
   319       html = filter(html, [
   165     editor.addCommand('mceInsertClipboardContent', function (ui, value) {
   320         /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
   166       if (value.content) {
   321         /<!--StartFragment-->|<!--EndFragment-->/g,
   167         clipboard.pasteHtml(value.content, value.internal);
   322         [
   168       }
   323           /( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
   169       if (value.text) {
   324           trimSpaces
   170         clipboard.pasteText(value.text);
   325         ],
   171       }
   326         /<br class="Apple-interchange-newline">/g,
   172     });
   327         /<br>$/i
   173   };
   328       ]);
   174   var $_fldd1mihjjgwecth = { register: register };
   329       return html;
   175 
       
   176   var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
       
   177 
       
   178   var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
       
   179 
       
   180   var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
       
   181 
       
   182   var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
       
   183 
       
   184   var internalMimeType = 'x-tinymce/html';
       
   185   var internalMark = '<!-- ' + internalMimeType + ' -->';
       
   186   var mark = function (html) {
       
   187     return internalMark + html;
       
   188   };
       
   189   var unmark = function (html) {
       
   190     return html.replace(internalMark, '');
       
   191   };
       
   192   var isMarked = function (html) {
       
   193     return html.indexOf(internalMark) !== -1;
       
   194   };
       
   195   var $_4x13hjirjjgwecu1 = {
       
   196     mark: mark,
       
   197     unmark: unmark,
       
   198     isMarked: isMarked,
       
   199     internalHtmlMime: function () {
       
   200       return internalMimeType;
       
   201     }
   330     }
   202   };
   331     function createIdGenerator(prefix) {
   203 
   332       var count = 0;
   204   var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities');
   333       return function () {
   205 
   334         return prefix + count++;
   206   var isPlainText = function (text) {
   335       };
   207     return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
       
   208   };
       
   209   var toBRs = function (text) {
       
   210     return text.replace(/\r?\n/g, '<br>');
       
   211   };
       
   212   var openContainer = function (rootTag, rootAttrs) {
       
   213     var key;
       
   214     var attrs = [];
       
   215     var tag = '<' + rootTag;
       
   216     if (typeof rootAttrs === 'object') {
       
   217       for (key in rootAttrs) {
       
   218         if (rootAttrs.hasOwnProperty(key)) {
       
   219           attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"');
       
   220         }
       
   221       }
       
   222       if (attrs.length) {
       
   223         tag += ' ' + attrs.join(' ');
       
   224       }
       
   225     }
   336     }
   226     return tag + '>';
   337     var isMsEdge = function () {
   227   };
   338       return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1;
   228   var toBlockElements = function (text, rootTag, rootAttrs) {
   339     };
   229     var blocks = text.split(/\n\n/);
   340     var Utils = {
   230     var tagOpen = openContainer(rootTag, rootAttrs);
   341       filter: filter,
   231     var tagClose = '</' + rootTag + '>';
   342       innerText: innerText,
   232     var paragraphs = global$3.map(blocks, function (p) {
   343       trimHtml: trimHtml,
   233       return p.split(/\n/).join('<br />');
   344       createIdGenerator: createIdGenerator,
   234     });
   345       isMsEdge: isMsEdge
   235     var stitch = function (p) {
   346     };
   236       return tagOpen + p + tagClose;
   347 
   237     };
   348     function isWordContent(content) {
   238     return paragraphs.length === 1 ? paragraphs[0] : global$3.map(paragraphs, stitch).join('');
   349       return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
   239   };
   350     }
   240   var convert = function (text, rootTag, rootAttrs) {
   351     function isNumericList(text) {
   241     return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
   352       var found, patterns;
   242   };
   353       patterns = [
   243   var $_4h3hnrisjjgwecu2 = {
   354         /^[IVXLMCD]{1,2}\.[ \u00a0]/,
   244     isPlainText: isPlainText,
   355         /^[ivxlmcd]{1,2}\.[ \u00a0]/,
   245     convert: convert,
   356         /^[a-z]{1,2}[\.\)][ \u00a0]/,
   246     toBRs: toBRs,
   357         /^[A-Z]{1,2}[\.\)][ \u00a0]/,
   247     toBlockElements: toBlockElements
   358         /^[0-9]+\.[ \u00a0]/,
   248   };
   359         /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,
   249 
   360         /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
   250   var global$6 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
   361       ];
   251 
   362       text = text.replace(/^[\u00a0 ]+/, '');
   252   var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node');
   363       global$3.each(patterns, function (pattern) {
   253 
   364         if (pattern.test(text)) {
   254   var global$8 = tinymce.util.Tools.resolve('tinymce.html.Schema');
   365           found = true;
   255 
   366           return false;
   256   var global$9 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
   367         }
   257 
   368       });
   258   function filter(content, items) {
   369       return found;
   259     global$3.each(items, function (v) {
   370     }
   260       if (v.constructor === RegExp) {
   371     function isBulletList(text) {
   261         content = content.replace(v, '');
   372       return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
   262       } else {
   373     }
   263         content = content.replace(v[0], v[1]);
   374     function convertFakeListsToProperLists(node) {
   264       }
   375       var currentListNode, prevListNode, lastLevel = 1;
   265     });
   376       function getText(node) {
   266     return content;
   377         var txt = '';
   267   }
   378         if (node.type === 3) {
   268   function innerText(html) {
   379           return node.value;
   269     var schema = global$8();
   380         }
   270     var domParser = global$6({}, schema);
       
   271     var text = '';
       
   272     var shortEndedElements = schema.getShortEndedElements();
       
   273     var ignoreElements = global$3.makeMap('script noscript style textarea video audio iframe object', ' ');
       
   274     var blockElements = schema.getBlockElements();
       
   275     function walk(node) {
       
   276       var name$$1 = node.name, currentNode = node;
       
   277       if (name$$1 === 'br') {
       
   278         text += '\n';
       
   279         return;
       
   280       }
       
   281       if (shortEndedElements[name$$1]) {
       
   282         text += ' ';
       
   283       }
       
   284       if (ignoreElements[name$$1]) {
       
   285         text += ' ';
       
   286         return;
       
   287       }
       
   288       if (node.type === 3) {
       
   289         text += node.value;
       
   290       }
       
   291       if (!node.shortEnded) {
       
   292         if (node = node.firstChild) {
   381         if (node = node.firstChild) {
   293           do {
   382           do {
   294             walk(node);
   383             txt += getText(node);
   295           } while (node = node.next);
   384           } while (node = node.next);
   296         }
   385         }
   297       }
   386         return txt;
   298       if (blockElements[name$$1] && currentNode.next) {
   387       }
   299         text += '\n';
   388       function trimListStart(node, regExp) {
   300         if (name$$1 === 'p') {
   389         if (node.type === 3) {
   301           text += '\n';
   390           if (regExp.test(node.value)) {
   302         }
   391             node.value = node.value.replace(regExp, '');
   303       }
       
   304     }
       
   305     html = filter(html, [/<!\[[^\]]+\]>/g]);
       
   306     walk(domParser.parse(html));
       
   307     return text;
       
   308   }
       
   309   function trimHtml(html) {
       
   310     function trimSpaces(all, s1, s2) {
       
   311       if (!s1 && !s2) {
       
   312         return ' ';
       
   313       }
       
   314       return '\xA0';
       
   315     }
       
   316     html = filter(html, [
       
   317       /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
       
   318       /<!--StartFragment-->|<!--EndFragment-->/g,
       
   319       [
       
   320         /( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
       
   321         trimSpaces
       
   322       ],
       
   323       /<br class="Apple-interchange-newline">/g,
       
   324       /<br>$/i
       
   325     ]);
       
   326     return html;
       
   327   }
       
   328   function createIdGenerator(prefix) {
       
   329     var count = 0;
       
   330     return function () {
       
   331       return prefix + count++;
       
   332     };
       
   333   }
       
   334   var isMsEdge = function () {
       
   335     return navigator.userAgent.indexOf(' Edge/') !== -1;
       
   336   };
       
   337   var $_4bi2o9j0jjgwecui = {
       
   338     filter: filter,
       
   339     innerText: innerText,
       
   340     trimHtml: trimHtml,
       
   341     createIdGenerator: createIdGenerator,
       
   342     isMsEdge: isMsEdge
       
   343   };
       
   344 
       
   345   function isWordContent(content) {
       
   346     return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
       
   347   }
       
   348   function isNumericList(text) {
       
   349     var found, patterns;
       
   350     patterns = [
       
   351       /^[IVXLMCD]{1,2}\.[ \u00a0]/,
       
   352       /^[ivxlmcd]{1,2}\.[ \u00a0]/,
       
   353       /^[a-z]{1,2}[\.\)][ \u00a0]/,
       
   354       /^[A-Z]{1,2}[\.\)][ \u00a0]/,
       
   355       /^[0-9]+\.[ \u00a0]/,
       
   356       /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,
       
   357       /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
       
   358     ];
       
   359     text = text.replace(/^[\u00a0 ]+/, '');
       
   360     global$3.each(patterns, function (pattern) {
       
   361       if (pattern.test(text)) {
       
   362         found = true;
       
   363         return false;
       
   364       }
       
   365     });
       
   366     return found;
       
   367   }
       
   368   function isBulletList(text) {
       
   369     return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
       
   370   }
       
   371   function convertFakeListsToProperLists(node) {
       
   372     var currentListNode, prevListNode, lastLevel = 1;
       
   373     function getText(node) {
       
   374       var txt = '';
       
   375       if (node.type === 3) {
       
   376         return node.value;
       
   377       }
       
   378       if (node = node.firstChild) {
       
   379         do {
       
   380           txt += getText(node);
       
   381         } while (node = node.next);
       
   382       }
       
   383       return txt;
       
   384     }
       
   385     function trimListStart(node, regExp) {
       
   386       if (node.type === 3) {
       
   387         if (regExp.test(node.value)) {
       
   388           node.value = node.value.replace(regExp, '');
       
   389           return false;
       
   390         }
       
   391       }
       
   392       if (node = node.firstChild) {
       
   393         do {
       
   394           if (!trimListStart(node, regExp)) {
       
   395             return false;
   392             return false;
   396           }
   393           }
   397         } while (node = node.next);
   394         }
   398       }
   395         if (node = node.firstChild) {
   399       return true;
   396           do {
   400     }
   397             if (!trimListStart(node, regExp)) {
   401     function removeIgnoredNodes(node) {
   398               return false;
   402       if (node._listIgnore) {
   399             }
   403         node.remove();
   400           } while (node = node.next);
   404         return;
   401         }
   405       }
   402         return true;
   406       if (node = node.firstChild) {
   403       }
   407         do {
   404       function removeIgnoredNodes(node) {
   408           removeIgnoredNodes(node);
   405         if (node._listIgnore) {
   409         } while (node = node.next);
   406           node.remove();
   410       }
   407           return;
   411     }
   408         }
   412     function convertParagraphToLi(paragraphNode, listName, start) {
   409         if (node = node.firstChild) {
   413       var level = paragraphNode._listLevel || lastLevel;
   410           do {
   414       if (level !== lastLevel) {
   411             removeIgnoredNodes(node);
   415         if (level < lastLevel) {
   412           } while (node = node.next);
   416           if (currentListNode) {
   413         }
   417             currentListNode = currentListNode.parent.parent;
   414       }
   418           }
   415       function convertParagraphToLi(paragraphNode, listName, start) {
       
   416         var level = paragraphNode._listLevel || lastLevel;
       
   417         if (level !== lastLevel) {
       
   418           if (level < lastLevel) {
       
   419             if (currentListNode) {
       
   420               currentListNode = currentListNode.parent.parent;
       
   421             }
       
   422           } else {
       
   423             prevListNode = currentListNode;
       
   424             currentListNode = null;
       
   425           }
       
   426         }
       
   427         if (!currentListNode || currentListNode.name !== listName) {
       
   428           prevListNode = prevListNode || currentListNode;
       
   429           currentListNode = new global$7(listName, 1);
       
   430           if (start > 1) {
       
   431             currentListNode.attr('start', '' + start);
       
   432           }
       
   433           paragraphNode.wrap(currentListNode);
       
   434         } else {
       
   435           currentListNode.append(paragraphNode);
       
   436         }
       
   437         paragraphNode.name = 'li';
       
   438         if (level > lastLevel && prevListNode) {
       
   439           prevListNode.lastChild.append(currentListNode);
       
   440         }
       
   441         lastLevel = level;
       
   442         removeIgnoredNodes(paragraphNode);
       
   443         trimListStart(paragraphNode, /^\u00a0+/);
       
   444         trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
       
   445         trimListStart(paragraphNode, /^\u00a0+/);
       
   446       }
       
   447       var elements = [];
       
   448       var child = node.firstChild;
       
   449       while (typeof child !== 'undefined' && child !== null) {
       
   450         elements.push(child);
       
   451         child = child.walk();
       
   452         if (child !== null) {
       
   453           while (typeof child !== 'undefined' && child.parent !== node) {
       
   454             child = child.walk();
       
   455           }
       
   456         }
       
   457       }
       
   458       for (var i = 0; i < elements.length; i++) {
       
   459         node = elements[i];
       
   460         if (node.name === 'p' && node.firstChild) {
       
   461           var nodeText = getText(node);
       
   462           if (isBulletList(nodeText)) {
       
   463             convertParagraphToLi(node, 'ul');
       
   464             continue;
       
   465           }
       
   466           if (isNumericList(nodeText)) {
       
   467             var matches = /([0-9]+)\./.exec(nodeText);
       
   468             var start = 1;
       
   469             if (matches) {
       
   470               start = parseInt(matches[1], 10);
       
   471             }
       
   472             convertParagraphToLi(node, 'ol', start);
       
   473             continue;
       
   474           }
       
   475           if (node._listLevel) {
       
   476             convertParagraphToLi(node, 'ul', 1);
       
   477             continue;
       
   478           }
       
   479           currentListNode = null;
   419         } else {
   480         } else {
   420           prevListNode = currentListNode;
   481           prevListNode = currentListNode;
   421           currentListNode = null;
   482           currentListNode = null;
   422         }
   483         }
   423       }
   484       }
   424       if (!currentListNode || currentListNode.name !== listName) {
       
   425         prevListNode = prevListNode || currentListNode;
       
   426         currentListNode = new global$7(listName, 1);
       
   427         if (start > 1) {
       
   428           currentListNode.attr('start', '' + start);
       
   429         }
       
   430         paragraphNode.wrap(currentListNode);
       
   431       } else {
       
   432         currentListNode.append(paragraphNode);
       
   433       }
       
   434       paragraphNode.name = 'li';
       
   435       if (level > lastLevel && prevListNode) {
       
   436         prevListNode.lastChild.append(currentListNode);
       
   437       }
       
   438       lastLevel = level;
       
   439       removeIgnoredNodes(paragraphNode);
       
   440       trimListStart(paragraphNode, /^\u00a0+/);
       
   441       trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
       
   442       trimListStart(paragraphNode, /^\u00a0+/);
       
   443     }
   485     }
   444     var elements = [];
   486     function filterStyles(editor, validStyles, node, styleValue) {
   445     var child = node.firstChild;
   487       var outputStyles = {}, matches;
   446     while (typeof child !== 'undefined' && child !== null) {
   488       var styles = editor.dom.parseStyle(styleValue);
   447       elements.push(child);
   489       global$3.each(styles, function (value, name) {
   448       child = child.walk();
   490         switch (name) {
   449       if (child !== null) {
   491         case 'mso-list':
   450         while (typeof child !== 'undefined' && child.parent !== node) {
   492           matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
   451           child = child.walk();
       
   452         }
       
   453       }
       
   454     }
       
   455     for (var i = 0; i < elements.length; i++) {
       
   456       node = elements[i];
       
   457       if (node.name === 'p' && node.firstChild) {
       
   458         var nodeText = getText(node);
       
   459         if (isBulletList(nodeText)) {
       
   460           convertParagraphToLi(node, 'ul');
       
   461           continue;
       
   462         }
       
   463         if (isNumericList(nodeText)) {
       
   464           var matches = /([0-9]+)\./.exec(nodeText);
       
   465           var start = 1;
       
   466           if (matches) {
   493           if (matches) {
   467             start = parseInt(matches[1], 10);
   494             node._listLevel = parseInt(matches[1], 10);
   468           }
   495           }
   469           convertParagraphToLi(node, 'ol', start);
   496           if (/Ignore/i.test(value) && node.firstChild) {
   470           continue;
   497             node._listIgnore = true;
   471         }
   498             node.firstChild._listIgnore = true;
   472         if (node._listLevel) {
   499           }
   473           convertParagraphToLi(node, 'ul', 1);
   500           break;
   474           continue;
   501         case 'horiz-align':
   475         }
   502           name = 'text-align';
   476         currentListNode = null;
   503           break;
   477       } else {
   504         case 'vert-align':
   478         prevListNode = currentListNode;
   505           name = 'vertical-align';
   479         currentListNode = null;
   506           break;
   480       }
   507         case 'font-color':
   481     }
   508         case 'mso-foreground':
   482   }
   509           name = 'color';
   483   function filterStyles(editor, validStyles, node, styleValue) {
   510           break;
   484     var outputStyles = {}, matches;
   511         case 'mso-background':
   485     var styles = editor.dom.parseStyle(styleValue);
   512         case 'mso-highlight':
   486     global$3.each(styles, function (value, name) {
   513           name = 'background';
   487       switch (name) {
   514           break;
   488       case 'mso-list':
   515         case 'font-weight':
   489         matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
   516         case 'font-style':
   490         if (matches) {
   517           if (value !== 'normal') {
   491           node._listLevel = parseInt(matches[1], 10);
   518             outputStyles[name] = value;
   492         }
   519           }
   493         if (/Ignore/i.test(value) && node.firstChild) {
   520           return;
   494           node._listIgnore = true;
   521         case 'mso-element':
   495           node.firstChild._listIgnore = true;
   522           if (/^(comment|comment-list)$/i.test(value)) {
   496         }
   523             node.remove();
   497         break;
   524             return;
   498       case 'horiz-align':
   525           }
   499         name = 'text-align';
   526           break;
   500         break;
   527         }
   501       case 'vert-align':
   528         if (name.indexOf('mso-comment') === 0) {
   502         name = 'vertical-align';
       
   503         break;
       
   504       case 'font-color':
       
   505       case 'mso-foreground':
       
   506         name = 'color';
       
   507         break;
       
   508       case 'mso-background':
       
   509       case 'mso-highlight':
       
   510         name = 'background';
       
   511         break;
       
   512       case 'font-weight':
       
   513       case 'font-style':
       
   514         if (value !== 'normal') {
       
   515           outputStyles[name] = value;
       
   516         }
       
   517         return;
       
   518       case 'mso-element':
       
   519         if (/^(comment|comment-list)$/i.test(value)) {
       
   520           node.remove();
   529           node.remove();
   521           return;
   530           return;
   522         }
   531         }
   523         break;
   532         if (name.indexOf('mso-') === 0) {
   524       }
   533           return;
   525       if (name.indexOf('mso-comment') === 0) {
   534         }
   526         node.remove();
   535         if (Settings.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {
   527         return;
   536           outputStyles[name] = value;
   528       }
   537         }
   529       if (name.indexOf('mso-') === 0) {
   538       });
   530         return;
   539       if (/(bold)/i.test(outputStyles['font-weight'])) {
   531       }
   540         delete outputStyles['font-weight'];
   532       if ($_xr8b0ikjjgwectl.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {
   541         node.wrap(new global$7('b', 1));
   533         outputStyles[name] = value;
   542       }
   534       }
   543       if (/(italic)/i.test(outputStyles['font-style'])) {
   535     });
   544         delete outputStyles['font-style'];
   536     if (/(bold)/i.test(outputStyles['font-weight'])) {
   545         node.wrap(new global$7('i', 1));
   537       delete outputStyles['font-weight'];
   546       }
   538       node.wrap(new global$7('b', 1));
   547       outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
       
   548       if (outputStyles) {
       
   549         return outputStyles;
       
   550       }
       
   551       return null;
   539     }
   552     }
   540     if (/(italic)/i.test(outputStyles['font-style'])) {
   553     var filterWordContent = function (editor, content) {
   541       delete outputStyles['font-style'];
   554       var retainStyleProperties, validStyles;
   542       node.wrap(new global$7('i', 1));
   555       retainStyleProperties = Settings.getRetainStyleProps(editor);
       
   556       if (retainStyleProperties) {
       
   557         validStyles = global$3.makeMap(retainStyleProperties.split(/[, ]/));
       
   558       }
       
   559       content = Utils.filter(content, [
       
   560         /<br class="?Apple-interchange-newline"?>/gi,
       
   561         /<b[^>]+id="?docs-internal-[^>]*>/gi,
       
   562         /<!--[\s\S]+?-->/gi,
       
   563         /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
       
   564         [
       
   565           /<(\/?)s>/gi,
       
   566           '<$1strike>'
       
   567         ],
       
   568         [
       
   569           /&nbsp;/gi,
       
   570           '\xA0'
       
   571         ],
       
   572         [
       
   573           /<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
       
   574           function (str, spaces) {
       
   575             return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : '';
       
   576           }
       
   577         ]
       
   578       ]);
       
   579       var validElements = Settings.getWordValidElements(editor);
       
   580       var schema = global$8({
       
   581         valid_elements: validElements,
       
   582         valid_children: '-li[p]'
       
   583       });
       
   584       global$3.each(schema.elements, function (rule) {
       
   585         if (!rule.attributes.class) {
       
   586           rule.attributes.class = {};
       
   587           rule.attributesOrder.push('class');
       
   588         }
       
   589         if (!rule.attributes.style) {
       
   590           rule.attributes.style = {};
       
   591           rule.attributesOrder.push('style');
       
   592         }
       
   593       });
       
   594       var domParser = global$6({}, schema);
       
   595       domParser.addAttributeFilter('style', function (nodes) {
       
   596         var i = nodes.length, node;
       
   597         while (i--) {
       
   598           node = nodes[i];
       
   599           node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
       
   600           if (node.name === 'span' && node.parent && !node.attributes.length) {
       
   601             node.unwrap();
       
   602           }
       
   603         }
       
   604       });
       
   605       domParser.addAttributeFilter('class', function (nodes) {
       
   606         var i = nodes.length, node, className;
       
   607         while (i--) {
       
   608           node = nodes[i];
       
   609           className = node.attr('class');
       
   610           if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
       
   611             node.remove();
       
   612           }
       
   613           node.attr('class', null);
       
   614         }
       
   615       });
       
   616       domParser.addNodeFilter('del', function (nodes) {
       
   617         var i = nodes.length;
       
   618         while (i--) {
       
   619           nodes[i].remove();
       
   620         }
       
   621       });
       
   622       domParser.addNodeFilter('a', function (nodes) {
       
   623         var i = nodes.length, node, href, name;
       
   624         while (i--) {
       
   625           node = nodes[i];
       
   626           href = node.attr('href');
       
   627           name = node.attr('name');
       
   628           if (href && href.indexOf('#_msocom_') !== -1) {
       
   629             node.remove();
       
   630             continue;
       
   631           }
       
   632           if (href && href.indexOf('file://') === 0) {
       
   633             href = href.split('#')[1];
       
   634             if (href) {
       
   635               href = '#' + href;
       
   636             }
       
   637           }
       
   638           if (!href && !name) {
       
   639             node.unwrap();
       
   640           } else {
       
   641             if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
       
   642               node.unwrap();
       
   643               continue;
       
   644             }
       
   645             node.attr({
       
   646               href: href,
       
   647               name: name
       
   648             });
       
   649           }
       
   650         }
       
   651       });
       
   652       var rootNode = domParser.parse(content);
       
   653       if (Settings.shouldConvertWordFakeLists(editor)) {
       
   654         convertFakeListsToProperLists(rootNode);
       
   655       }
       
   656       content = global$9({ validate: editor.settings.validate }, schema).serialize(rootNode);
       
   657       return content;
       
   658     };
       
   659     var preProcess = function (editor, content) {
       
   660       return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;
       
   661     };
       
   662     var WordFilter = {
       
   663       preProcess: preProcess,
       
   664       isWordContent: isWordContent
       
   665     };
       
   666 
       
   667     var processResult = function (content, cancelled) {
       
   668       return {
       
   669         content: content,
       
   670         cancelled: cancelled
       
   671       };
       
   672     };
       
   673     var postProcessFilter = function (editor, html, internal, isWordHtml) {
       
   674       var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
       
   675       var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml);
       
   676       return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
       
   677     };
       
   678     var filterContent = function (editor, content, internal, isWordHtml) {
       
   679       var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml);
       
   680       if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
       
   681         return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml);
       
   682       } else {
       
   683         return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented());
       
   684       }
       
   685     };
       
   686     var process = function (editor, html, internal) {
       
   687       var isWordHtml = WordFilter.isWordContent(html);
       
   688       var content = isWordHtml ? WordFilter.preProcess(editor, html) : html;
       
   689       return filterContent(editor, content, internal, isWordHtml);
       
   690     };
       
   691     var ProcessFilters = { process: process };
       
   692 
       
   693     var removeMeta = function (editor, html) {
       
   694       var body = editor.dom.create('body', {}, html);
       
   695       global$3.each(body.querySelectorAll('meta'), function (elm) {
       
   696         return elm.parentNode.removeChild(elm);
       
   697       });
       
   698       return body.innerHTML;
       
   699     };
       
   700     var pasteHtml = function (editor, html) {
       
   701       editor.insertContent(removeMeta(editor, html), {
       
   702         merge: Settings.shouldMergeFormats(editor),
       
   703         paste: true
       
   704       });
       
   705       return true;
       
   706     };
       
   707     var isAbsoluteUrl = function (url) {
       
   708       return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
       
   709     };
       
   710     var isImageUrl = function (url) {
       
   711       return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
       
   712     };
       
   713     var createImage = function (editor, url, pasteHtmlFn) {
       
   714       editor.undoManager.extra(function () {
       
   715         pasteHtmlFn(editor, url);
       
   716       }, function () {
       
   717         editor.insertContent('<img src="' + url + '">');
       
   718       });
       
   719       return true;
       
   720     };
       
   721     var createLink = function (editor, url, pasteHtmlFn) {
       
   722       editor.undoManager.extra(function () {
       
   723         pasteHtmlFn(editor, url);
       
   724       }, function () {
       
   725         editor.execCommand('mceInsertLink', false, url);
       
   726       });
       
   727       return true;
       
   728     };
       
   729     var linkSelection = function (editor, html, pasteHtmlFn) {
       
   730       return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;
       
   731     };
       
   732     var insertImage = function (editor, html, pasteHtmlFn) {
       
   733       return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false;
       
   734     };
       
   735     var smartInsertContent = function (editor, html) {
       
   736       global$3.each([
       
   737         linkSelection,
       
   738         insertImage,
       
   739         pasteHtml
       
   740       ], function (action) {
       
   741         return action(editor, html, pasteHtml) !== true;
       
   742       });
       
   743     };
       
   744     var insertContent = function (editor, html) {
       
   745       if (Settings.isSmartPasteEnabled(editor) === false) {
       
   746         pasteHtml(editor, html);
       
   747       } else {
       
   748         smartInsertContent(editor, html);
       
   749       }
       
   750     };
       
   751     var SmartPaste = {
       
   752       isImageUrl: isImageUrl,
       
   753       isAbsoluteUrl: isAbsoluteUrl,
       
   754       insertContent: insertContent
       
   755     };
       
   756 
       
   757     var constant = function (value) {
       
   758       return function () {
       
   759         return value;
       
   760       };
       
   761     };
       
   762     function curry(fn) {
       
   763       var initialArgs = [];
       
   764       for (var _i = 1; _i < arguments.length; _i++) {
       
   765         initialArgs[_i - 1] = arguments[_i];
       
   766       }
       
   767       return function () {
       
   768         var restArgs = [];
       
   769         for (var _i = 0; _i < arguments.length; _i++) {
       
   770           restArgs[_i] = arguments[_i];
       
   771         }
       
   772         var all = initialArgs.concat(restArgs);
       
   773         return fn.apply(null, all);
       
   774       };
   543     }
   775     }
   544     outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
   776     var never = constant(false);
   545     if (outputStyles) {
   777     var always = constant(true);
   546       return outputStyles;
   778 
   547     }
   779     var never$1 = never;
   548     return null;
   780     var always$1 = always;
   549   }
   781     var none = function () {
   550   var filterWordContent = function (editor, content) {
   782       return NONE;
   551     var retainStyleProperties, validStyles;
   783     };
   552     retainStyleProperties = $_xr8b0ikjjgwectl.getRetainStyleProps(editor);
   784     var NONE = function () {
   553     if (retainStyleProperties) {
   785       var eq = function (o) {
   554       validStyles = global$3.makeMap(retainStyleProperties.split(/[, ]/));
   786         return o.isNone();
   555     }
   787       };
   556     content = $_4bi2o9j0jjgwecui.filter(content, [
   788       var call = function (thunk) {
   557       /<br class="?Apple-interchange-newline"?>/gi,
   789         return thunk();
   558       /<b[^>]+id="?docs-internal-[^>]*>/gi,
   790       };
   559       /<!--[\s\S]+?-->/gi,
   791       var id = function (n) {
   560       /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
   792         return n;
   561       [
   793       };
   562         /<(\/?)s>/gi,
   794       var noop = function () {
   563         '<$1strike>'
   795       };
   564       ],
   796       var nul = function () {
   565       [
   797         return null;
   566         /&nbsp;/gi,
   798       };
   567         '\xA0'
   799       var undef = function () {
   568       ],
   800         return undefined;
   569       [
   801       };
   570         /<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
   802       var me = {
   571         function (str, spaces) {
   803         fold: function (n, s) {
   572           return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : '';
   804           return n();
   573         }
   805         },
   574       ]
   806         is: never$1,
   575     ]);
   807         isSome: never$1,
   576     var validElements = $_xr8b0ikjjgwectl.getWordValidElements(editor);
   808         isNone: always$1,
   577     var schema = global$8({
   809         getOr: id,
   578       valid_elements: validElements,
   810         getOrThunk: call,
   579       valid_children: '-li[p]'
   811         getOrDie: function (msg) {
   580     });
   812           throw new Error(msg || 'error: getOrDie called on none.');
   581     global$3.each(schema.elements, function (rule) {
   813         },
   582       if (!rule.attributes.class) {
   814         getOrNull: nul,
   583         rule.attributes.class = {};
   815         getOrUndefined: undef,
   584         rule.attributesOrder.push('class');
   816         or: id,
   585       }
   817         orThunk: call,
   586       if (!rule.attributes.style) {
   818         map: none,
   587         rule.attributes.style = {};
   819         ap: none,
   588         rule.attributesOrder.push('style');
   820         each: noop,
   589       }
   821         bind: none,
   590     });
   822         flatten: none,
   591     var domParser = global$6({}, schema);
   823         exists: never$1,
   592     domParser.addAttributeFilter('style', function (nodes) {
   824         forall: always$1,
   593       var i = nodes.length, node;
   825         filter: none,
   594       while (i--) {
   826         equals: eq,
   595         node = nodes[i];
   827         equals_: eq,
   596         node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
   828         toArray: function () {
   597         if (node.name === 'span' && node.parent && !node.attributes.length) {
   829           return [];
   598           node.unwrap();
   830         },
   599         }
   831         toString: constant('none()')
   600       }
   832       };
   601     });
   833       if (Object.freeze)
   602     domParser.addAttributeFilter('class', function (nodes) {
   834         Object.freeze(me);
   603       var i = nodes.length, node, className;
   835       return me;
   604       while (i--) {
   836     }();
   605         node = nodes[i];
   837     var some = function (a) {
   606         className = node.attr('class');
   838       var constant_a = function () {
   607         if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
   839         return a;
   608           node.remove();
   840       };
   609         }
   841       var self = function () {
   610         node.attr('class', null);
   842         return me;
   611       }
   843       };
   612     });
   844       var map = function (f) {
   613     domParser.addNodeFilter('del', function (nodes) {
   845         return some(f(a));
   614       var i = nodes.length;
   846       };
   615       while (i--) {
   847       var bind = function (f) {
   616         nodes[i].remove();
   848         return f(a);
   617       }
   849       };
   618     });
   850       var me = {
   619     domParser.addNodeFilter('a', function (nodes) {
   851         fold: function (n, s) {
   620       var i = nodes.length, node, href, name;
   852           return s(a);
   621       while (i--) {
   853         },
   622         node = nodes[i];
   854         is: function (v) {
   623         href = node.attr('href');
   855           return a === v;
   624         name = node.attr('name');
   856         },
   625         if (href && href.indexOf('#_msocom_') !== -1) {
   857         isSome: always$1,
   626           node.remove();
   858         isNone: never$1,
   627           continue;
   859         getOr: constant_a,
   628         }
   860         getOrThunk: constant_a,
   629         if (href && href.indexOf('file://') === 0) {
   861         getOrDie: constant_a,
   630           href = href.split('#')[1];
   862         getOrNull: constant_a,
   631           if (href) {
   863         getOrUndefined: constant_a,
   632             href = '#' + href;
   864         or: self,
   633           }
   865         orThunk: self,
   634         }
   866         map: map,
   635         if (!href && !name) {
   867         ap: function (optfab) {
   636           node.unwrap();
   868           return optfab.fold(none, function (fab) {
       
   869             return some(fab(a));
       
   870           });
       
   871         },
       
   872         each: function (f) {
       
   873           f(a);
       
   874         },
       
   875         bind: bind,
       
   876         flatten: constant_a,
       
   877         exists: bind,
       
   878         forall: bind,
       
   879         filter: function (f) {
       
   880           return f(a) ? me : NONE;
       
   881         },
       
   882         equals: function (o) {
       
   883           return o.is(a);
       
   884         },
       
   885         equals_: function (o, elementEq) {
       
   886           return o.fold(never$1, function (b) {
       
   887             return elementEq(a, b);
       
   888           });
       
   889         },
       
   890         toArray: function () {
       
   891           return [a];
       
   892         },
       
   893         toString: function () {
       
   894           return 'some(' + a + ')';
       
   895         }
       
   896       };
       
   897       return me;
       
   898     };
       
   899     var from = function (value) {
       
   900       return value === null || value === undefined ? NONE : some(value);
       
   901     };
       
   902     var Option = {
       
   903       some: some,
       
   904       none: none,
       
   905       from: from
       
   906     };
       
   907 
       
   908     var typeOf = function (x) {
       
   909       if (x === null)
       
   910         return 'null';
       
   911       var t = typeof x;
       
   912       if (t === 'object' && Array.prototype.isPrototypeOf(x))
       
   913         return 'array';
       
   914       if (t === 'object' && String.prototype.isPrototypeOf(x))
       
   915         return 'string';
       
   916       return t;
       
   917     };
       
   918     var isType = function (type) {
       
   919       return function (value) {
       
   920         return typeOf(value) === type;
       
   921       };
       
   922     };
       
   923     var isFunction = isType('function');
       
   924 
       
   925     var map = function (xs, f) {
       
   926       var len = xs.length;
       
   927       var r = new Array(len);
       
   928       for (var i = 0; i < len; i++) {
       
   929         var x = xs[i];
       
   930         r[i] = f(x, i, xs);
       
   931       }
       
   932       return r;
       
   933     };
       
   934     var each = function (xs, f) {
       
   935       for (var i = 0, len = xs.length; i < len; i++) {
       
   936         var x = xs[i];
       
   937         f(x, i, xs);
       
   938       }
       
   939     };
       
   940     var filter$1 = function (xs, pred) {
       
   941       var r = [];
       
   942       for (var i = 0, len = xs.length; i < len; i++) {
       
   943         var x = xs[i];
       
   944         if (pred(x, i, xs)) {
       
   945           r.push(x);
       
   946         }
       
   947       }
       
   948       return r;
       
   949     };
       
   950     var slice = Array.prototype.slice;
       
   951     var from$1 = isFunction(Array.from) ? Array.from : function (x) {
       
   952       return slice.call(x);
       
   953     };
       
   954 
       
   955     var nu = function (baseFn) {
       
   956       var data = Option.none();
       
   957       var callbacks = [];
       
   958       var map = function (f) {
       
   959         return nu(function (nCallback) {
       
   960           get(function (data) {
       
   961             nCallback(f(data));
       
   962           });
       
   963         });
       
   964       };
       
   965       var get = function (nCallback) {
       
   966         if (isReady())
       
   967           call(nCallback);
       
   968         else
       
   969           callbacks.push(nCallback);
       
   970       };
       
   971       var set = function (x) {
       
   972         data = Option.some(x);
       
   973         run(callbacks);
       
   974         callbacks = [];
       
   975       };
       
   976       var isReady = function () {
       
   977         return data.isSome();
       
   978       };
       
   979       var run = function (cbs) {
       
   980         each(cbs, call);
       
   981       };
       
   982       var call = function (cb) {
       
   983         data.each(function (x) {
       
   984           domGlobals.setTimeout(function () {
       
   985             cb(x);
       
   986           }, 0);
       
   987         });
       
   988       };
       
   989       baseFn(set);
       
   990       return {
       
   991         get: get,
       
   992         map: map,
       
   993         isReady: isReady
       
   994       };
       
   995     };
       
   996     var pure = function (a) {
       
   997       return nu(function (callback) {
       
   998         callback(a);
       
   999       });
       
  1000     };
       
  1001     var LazyValue = {
       
  1002       nu: nu,
       
  1003       pure: pure
       
  1004     };
       
  1005 
       
  1006     var bounce = function (f) {
       
  1007       return function () {
       
  1008         var args = [];
       
  1009         for (var _i = 0; _i < arguments.length; _i++) {
       
  1010           args[_i] = arguments[_i];
       
  1011         }
       
  1012         var me = this;
       
  1013         domGlobals.setTimeout(function () {
       
  1014           f.apply(me, args);
       
  1015         }, 0);
       
  1016       };
       
  1017     };
       
  1018 
       
  1019     var nu$1 = function (baseFn) {
       
  1020       var get = function (callback) {
       
  1021         baseFn(bounce(callback));
       
  1022       };
       
  1023       var map = function (fab) {
       
  1024         return nu$1(function (callback) {
       
  1025           get(function (a) {
       
  1026             var value = fab(a);
       
  1027             callback(value);
       
  1028           });
       
  1029         });
       
  1030       };
       
  1031       var bind = function (aFutureB) {
       
  1032         return nu$1(function (callback) {
       
  1033           get(function (a) {
       
  1034             aFutureB(a).get(callback);
       
  1035           });
       
  1036         });
       
  1037       };
       
  1038       var anonBind = function (futureB) {
       
  1039         return nu$1(function (callback) {
       
  1040           get(function (a) {
       
  1041             futureB.get(callback);
       
  1042           });
       
  1043         });
       
  1044       };
       
  1045       var toLazy = function () {
       
  1046         return LazyValue.nu(get);
       
  1047       };
       
  1048       var toCached = function () {
       
  1049         var cache = null;
       
  1050         return nu$1(function (callback) {
       
  1051           if (cache === null) {
       
  1052             cache = toLazy();
       
  1053           }
       
  1054           cache.get(callback);
       
  1055         });
       
  1056       };
       
  1057       return {
       
  1058         map: map,
       
  1059         bind: bind,
       
  1060         anonBind: anonBind,
       
  1061         toLazy: toLazy,
       
  1062         toCached: toCached,
       
  1063         get: get
       
  1064       };
       
  1065     };
       
  1066     var pure$1 = function (a) {
       
  1067       return nu$1(function (callback) {
       
  1068         callback(a);
       
  1069       });
       
  1070     };
       
  1071     var Future = {
       
  1072       nu: nu$1,
       
  1073       pure: pure$1
       
  1074     };
       
  1075 
       
  1076     var par = function (asyncValues, nu) {
       
  1077       return nu(function (callback) {
       
  1078         var r = [];
       
  1079         var count = 0;
       
  1080         var cb = function (i) {
       
  1081           return function (value) {
       
  1082             r[i] = value;
       
  1083             count++;
       
  1084             if (count >= asyncValues.length) {
       
  1085               callback(r);
       
  1086             }
       
  1087           };
       
  1088         };
       
  1089         if (asyncValues.length === 0) {
       
  1090           callback([]);
   637         } else {
  1091         } else {
   638           if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
  1092           each(asyncValues, function (asyncValue, i) {
   639             node.unwrap();
  1093             asyncValue.get(cb(i));
   640             continue;
       
   641           }
       
   642           node.attr({
       
   643             href: href,
       
   644             name: name
       
   645           });
  1094           });
   646         }
  1095         }
   647       }
  1096       });
   648     });
  1097     };
   649     var rootNode = domParser.parse(content);
  1098 
   650     if ($_xr8b0ikjjgwectl.shouldConvertWordFakeLists(editor)) {
  1099     var par$1 = function (futures) {
   651       convertFakeListsToProperLists(rootNode);
  1100       return par(futures, Future.nu);
   652     }
  1101     };
   653     content = global$9({ validate: editor.settings.validate }, schema).serialize(rootNode);
  1102     var mapM = function (array, fn) {
   654     return content;
  1103       var futures = map(array, fn);
   655   };
  1104       return par$1(futures);
   656   var preProcess = function (editor, content) {
  1105     };
   657     return $_xr8b0ikjjgwectl.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;
  1106 
   658   };
  1107     var pasteHtml$1 = function (editor, html, internalFlag) {
   659   var $_dfatuiivjjgwecu8 = {
  1108       var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html);
   660     preProcess: preProcess,
  1109       var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal);
   661     isWordContent: isWordContent
  1110       if (args.cancelled === false) {
   662   };
  1111         SmartPaste.insertContent(editor, args.content);
   663 
  1112       }
   664   var processResult = function (content, cancelled) {
  1113     };
   665     return {
  1114     var pasteText = function (editor, text) {
   666       content: content,
  1115       text = editor.dom.encode(text).replace(/\r\n/g, '\n');
   667       cancelled: cancelled
  1116       text = Newlines.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
   668     };
  1117       pasteHtml$1(editor, text, false);
   669   };
  1118     };
   670   var postProcessFilter = function (editor, html, internal, isWordHtml) {
  1119     var getDataTransferItems = function (dataTransfer) {
   671     var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
  1120       var items = {};
   672     var postProcessArgs = $_8tki3zijjjgwectj.firePastePostProcess(editor, tempBody, internal, isWordHtml);
  1121       var mceInternalUrlPrefix = 'data:text/mce-internal,';
   673     return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
  1122       if (dataTransfer) {
   674   };
  1123         if (dataTransfer.getData) {
   675   var filterContent = function (editor, content, internal, isWordHtml) {
  1124           var legacyText = dataTransfer.getData('Text');
   676     var preProcessArgs = $_8tki3zijjjgwectj.firePastePreProcess(editor, content, internal, isWordHtml);
  1125           if (legacyText && legacyText.length > 0) {
   677     if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
  1126             if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
   678       return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml);
  1127               items['text/plain'] = legacyText;
   679     } else {
  1128             }
   680       return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented());
  1129           }
   681     }
  1130         }
   682   };
  1131         if (dataTransfer.types) {
   683   var process = function (editor, html, internal) {
  1132           for (var i = 0; i < dataTransfer.types.length; i++) {
   684     var isWordHtml = $_dfatuiivjjgwecu8.isWordContent(html);
  1133             var contentType = dataTransfer.types[i];
   685     var content = isWordHtml ? $_dfatuiivjjgwecu8.preProcess(editor, html) : html;
  1134             try {
   686     return filterContent(editor, content, internal, isWordHtml);
  1135               items[contentType] = dataTransfer.getData(contentType);
   687   };
  1136             } catch (ex) {
   688   var $_3scw66iujjgwecu4 = { process: process };
  1137               items[contentType] = '';
   689 
  1138             }
   690   var pasteHtml = function (editor, html) {
  1139           }
   691     editor.insertContent(html, {
  1140         }
   692       merge: $_xr8b0ikjjgwectl.shouldMergeFormats(editor),
  1141       }
   693       paste: true
  1142       return items;
   694     });
  1143     };
   695     return true;
  1144     var getClipboardContent = function (editor, clipboardEvent) {
   696   };
  1145       var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
   697   var isAbsoluteUrl = function (url) {
  1146       return Utils.isMsEdge() ? global$3.extend(content, { 'text/html': '' }) : content;
   698     return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
  1147     };
   699   };
  1148     var hasContentType = function (clipboardContent, mimeType) {
   700   var isImageUrl = function (url) {
  1149       return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
   701     return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
  1150     };
   702   };
  1151     var hasHtmlOrText = function (content) {
   703   var createImage = function (editor, url, pasteHtmlFn) {
  1152       return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
   704     editor.undoManager.extra(function () {
  1153     };
   705       pasteHtmlFn(editor, url);
  1154     var getBase64FromUri = function (uri) {
   706     }, function () {
  1155       var idx;
   707       editor.insertContent('<img src="' + url + '">');
  1156       idx = uri.indexOf(',');
   708     });
  1157       if (idx !== -1) {
   709     return true;
  1158         return uri.substr(idx + 1);
   710   };
  1159       }
   711   var createLink = function (editor, url, pasteHtmlFn) {
  1160       return null;
   712     editor.undoManager.extra(function () {
  1161     };
   713       pasteHtmlFn(editor, url);
  1162     var isValidDataUriImage = function (settings, imgElm) {
   714     }, function () {
  1163       return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
   715       editor.execCommand('mceInsertLink', false, url);
  1164     };
   716     });
  1165     var extractFilename = function (editor, str) {
   717     return true;
  1166       var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
   718   };
  1167       return m ? editor.dom.encode(m[1]) : null;
   719   var linkSelection = function (editor, html, pasteHtmlFn) {
  1168     };
   720     return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;
  1169     var uniqueId = Utils.createIdGenerator('mceclip');
   721   };
  1170     var pasteImage = function (editor, imageItem) {
   722   var insertImage = function (editor, html, pasteHtmlFn) {
  1171       var base64 = getBase64FromUri(imageItem.uri);
   723     return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false;
  1172       var id = uniqueId();
   724   };
  1173       var name = editor.settings.images_reuse_filename && imageItem.blob.name ? extractFilename(editor, imageItem.blob.name) : id;
   725   var smartInsertContent = function (editor, html) {
  1174       var img = new domGlobals.Image();
   726     global$3.each([
  1175       img.src = imageItem.uri;
   727       linkSelection,
  1176       if (isValidDataUriImage(editor.settings, img)) {
   728       insertImage,
  1177         var blobCache = editor.editorUpload.blobCache;
   729       pasteHtml
  1178         var blobInfo = void 0, existingBlobInfo = void 0;
   730     ], function (action) {
  1179         existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
   731       return action(editor, html, pasteHtml) !== true;
  1180           return cachedBlobInfo.base64() === base64;
   732     });
  1181         });
   733   };
  1182         if (!existingBlobInfo) {
   734   var insertContent = function (editor, html) {
  1183           blobInfo = blobCache.create(id, imageItem.blob, base64, name);
   735     if ($_xr8b0ikjjgwectl.isSmartPasteEnabled(editor) === false) {
  1184           blobCache.add(blobInfo);
   736       pasteHtml(editor, html);
  1185         } else {
   737     } else {
  1186           blobInfo = existingBlobInfo;
   738       smartInsertContent(editor, html);
  1187         }
   739     }
  1188         pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);
   740   };
  1189       } else {
   741   var $_d8pzpej1jjgwecum = {
  1190         pasteHtml$1(editor, '<img src="' + imageItem.uri + '">', false);
   742     isImageUrl: isImageUrl,
  1191       }
   743     isAbsoluteUrl: isAbsoluteUrl,
  1192     };
   744     insertContent: insertContent
  1193     var isClipboardEvent = function (event) {
   745   };
  1194       return event.type === 'paste';
   746 
  1195     };
   747   var pasteHtml$1 = function (editor, html, internalFlag) {
  1196     var readBlobsAsDataUris = function (items) {
   748     var internal = internalFlag ? internalFlag : $_4x13hjirjjgwecu1.isMarked(html);
  1197       return mapM(items, function (item) {
   749     var args = $_3scw66iujjgwecu4.process(editor, $_4x13hjirjjgwecu1.unmark(html), internal);
  1198         return Future.nu(function (resolve) {
   750     if (args.cancelled === false) {
  1199           var blob = item.getAsFile ? item.getAsFile() : item;
   751       $_d8pzpej1jjgwecum.insertContent(editor, args.content);
  1200           var reader = new window.FileReader();
   752     }
  1201           reader.onload = function () {
   753   };
  1202             resolve({
   754   var pasteText = function (editor, text) {
  1203               blob: blob,
   755     text = editor.dom.encode(text).replace(/\r\n/g, '\n');
  1204               uri: reader.result
   756     text = $_4h3hnrisjjgwecu2.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
  1205             });
   757     pasteHtml$1(editor, text, false);
  1206           };
   758   };
  1207           reader.readAsDataURL(blob);
   759   var getDataTransferItems = function (dataTransfer) {
  1208         });
   760     var items = {};
  1209       });
   761     var mceInternalUrlPrefix = 'data:text/mce-internal,';
  1210     };
   762     if (dataTransfer) {
  1211     var getImagesFromDataTransfer = function (dataTransfer) {
   763       if (dataTransfer.getData) {
  1212       var items = dataTransfer.items ? map(from$1(dataTransfer.items), function (item) {
   764         var legacyText = dataTransfer.getData('Text');
  1213         return item.getAsFile();
   765         if (legacyText && legacyText.length > 0) {
  1214       }) : [];
   766           if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
  1215       var files = dataTransfer.files ? from$1(dataTransfer.files) : [];
   767             items['text/plain'] = legacyText;
  1216       var images = filter$1(items.length > 0 ? items : files, function (file) {
   768           }
  1217         return /^image\/(jpeg|png|gif|bmp)$/.test(file.type);
   769         }
  1218       });
   770       }
  1219       return images;
   771       if (dataTransfer.types) {
  1220     };
   772         for (var i = 0; i < dataTransfer.types.length; i++) {
  1221     var pasteImageData = function (editor, e, rng) {
   773           var contentType = dataTransfer.types[i];
  1222       var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
   774           try {
  1223       if (editor.settings.paste_data_images && dataTransfer) {
   775             items[contentType] = dataTransfer.getData(contentType);
  1224         var images = getImagesFromDataTransfer(dataTransfer);
   776           } catch (ex) {
  1225         if (images.length > 0) {
   777             items[contentType] = '';
  1226           e.preventDefault();
   778           }
  1227           readBlobsAsDataUris(images).get(function (blobResults) {
   779         }
  1228             if (rng) {
   780       }
  1229               editor.selection.setRng(rng);
   781     }
  1230             }
   782     return items;
  1231             each(blobResults, function (result) {
   783   };
  1232               pasteImage(editor, result);
   784   var getClipboardContent = function (editor, clipboardEvent) {
  1233             });
   785     var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
  1234           });
   786     return $_4bi2o9j0jjgwecui.isMsEdge() ? global$3.extend(content, { 'text/html': '' }) : content;
  1235           return true;
   787   };
  1236         }
   788   var hasContentType = function (clipboardContent, mimeType) {
  1237       }
   789     return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
  1238       return false;
   790   };
  1239     };
   791   var hasHtmlOrText = function (content) {
  1240     var isBrokenAndroidClipboardEvent = function (e) {
   792     return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
  1241       var clipboardData = e.clipboardData;
   793   };
  1242       return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
   794   var getBase64FromUri = function (uri) {
  1243     };
   795     var idx;
  1244     var isKeyboardPasteEvent = function (e) {
   796     idx = uri.indexOf(',');
  1245       return global$4.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
   797     if (idx !== -1) {
  1246     };
   798       return uri.substr(idx + 1);
  1247     var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
   799     }
  1248       var keyboardPasteTimeStamp = 0;
   800     return null;
  1249       var keyboardPastePlainTextState;
   801   };
  1250       editor.on('keydown', function (e) {
   802   var isValidDataUriImage = function (settings, imgElm) {
  1251         function removePasteBinOnKeyUp(e) {
   803     return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
  1252           if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
   804   };
  1253             pasteBin.remove();
   805   var extractFilename = function (editor, str) {
  1254           }
   806     var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
  1255         }
   807     return m ? editor.dom.encode(m[1]) : null;
  1256         if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
   808   };
  1257           keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
   809   var uniqueId = $_4bi2o9j0jjgwecui.createIdGenerator('mceclip');
  1258           if (keyboardPastePlainTextState && global$1.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) {
   810   var pasteImage = function (editor, rng, reader, blob) {
  1259             return;
   811     if (rng) {
  1260           }
       
  1261           e.stopImmediatePropagation();
       
  1262           keyboardPasteTimeStamp = new Date().getTime();
       
  1263           if (global$1.ie && keyboardPastePlainTextState) {
       
  1264             e.preventDefault();
       
  1265             Events.firePaste(editor, true);
       
  1266             return;
       
  1267           }
       
  1268           pasteBin.remove();
       
  1269           pasteBin.create();
       
  1270           editor.once('keyup', removePasteBinOnKeyUp);
       
  1271           editor.once('paste', function () {
       
  1272             editor.off('keyup', removePasteBinOnKeyUp);
       
  1273           });
       
  1274         }
       
  1275       });
       
  1276       function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
       
  1277         var content, isPlainTextHtml;
       
  1278         if (hasContentType(clipboardContent, 'text/html')) {
       
  1279           content = clipboardContent['text/html'];
       
  1280         } else {
       
  1281           content = pasteBin.getHtml();
       
  1282           internal = internal ? internal : InternalHtml.isMarked(content);
       
  1283           if (pasteBin.isDefaultContent(content)) {
       
  1284             plainTextMode = true;
       
  1285           }
       
  1286         }
       
  1287         content = Utils.trimHtml(content);
       
  1288         pasteBin.remove();
       
  1289         isPlainTextHtml = internal === false && Newlines.isPlainText(content);
       
  1290         if (!content.length || isPlainTextHtml) {
       
  1291           plainTextMode = true;
       
  1292         }
       
  1293         if (plainTextMode) {
       
  1294           if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
       
  1295             content = clipboardContent['text/plain'];
       
  1296           } else {
       
  1297             content = Utils.innerText(content);
       
  1298           }
       
  1299         }
       
  1300         if (pasteBin.isDefaultContent(content)) {
       
  1301           if (!isKeyBoardPaste) {
       
  1302             editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
       
  1303           }
       
  1304           return;
       
  1305         }
       
  1306         if (plainTextMode) {
       
  1307           pasteText(editor, content);
       
  1308         } else {
       
  1309           pasteHtml$1(editor, content, internal);
       
  1310         }
       
  1311       }
       
  1312       var getLastRng = function () {
       
  1313         return pasteBin.getLastRng() || editor.selection.getRng();
       
  1314       };
       
  1315       editor.on('paste', function (e) {
       
  1316         var clipboardTimer = new Date().getTime();
       
  1317         var clipboardContent = getClipboardContent(editor, e);
       
  1318         var clipboardDelay = new Date().getTime() - clipboardTimer;
       
  1319         var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay < 1000;
       
  1320         var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
       
  1321         var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime());
       
  1322         keyboardPastePlainTextState = false;
       
  1323         if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
       
  1324           pasteBin.remove();
       
  1325           return;
       
  1326         }
       
  1327         if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
       
  1328           pasteBin.remove();
       
  1329           return;
       
  1330         }
       
  1331         if (!isKeyBoardPaste) {
       
  1332           e.preventDefault();
       
  1333         }
       
  1334         if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
       
  1335           pasteBin.create();
       
  1336           editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
       
  1337             e.stopPropagation();
       
  1338           });
       
  1339           editor.getDoc().execCommand('Paste', false, null);
       
  1340           clipboardContent['text/html'] = pasteBin.getHtml();
       
  1341         }
       
  1342         if (hasContentType(clipboardContent, 'text/html')) {
       
  1343           e.preventDefault();
       
  1344           if (!internal) {
       
  1345             internal = InternalHtml.isMarked(clipboardContent['text/html']);
       
  1346           }
       
  1347           insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
       
  1348         } else {
       
  1349           global$2.setEditorTimeout(editor, function () {
       
  1350             insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
       
  1351           }, 0);
       
  1352         }
       
  1353       });
       
  1354     };
       
  1355     var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
       
  1356       registerEventHandlers(editor, pasteBin, pasteFormat);
       
  1357       var src;
       
  1358       editor.parser.addNodeFilter('img', function (nodes, name, args) {
       
  1359         var isPasteInsert = function (args) {
       
  1360           return args.data && args.data.paste === true;
       
  1361         };
       
  1362         var remove = function (node) {
       
  1363           if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) {
       
  1364             node.remove();
       
  1365           }
       
  1366         };
       
  1367         var isWebKitFakeUrl = function (src) {
       
  1368           return src.indexOf('webkit-fake-url') === 0;
       
  1369         };
       
  1370         var isDataUri = function (src) {
       
  1371           return src.indexOf('data:') === 0;
       
  1372         };
       
  1373         if (!editor.settings.paste_data_images && isPasteInsert(args)) {
       
  1374           var i = nodes.length;
       
  1375           while (i--) {
       
  1376             src = nodes[i].attributes.map.src;
       
  1377             if (!src) {
       
  1378               continue;
       
  1379             }
       
  1380             if (isWebKitFakeUrl(src)) {
       
  1381               remove(nodes[i]);
       
  1382             } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
       
  1383               remove(nodes[i]);
       
  1384             }
       
  1385           }
       
  1386         }
       
  1387       });
       
  1388     };
       
  1389 
       
  1390     var getPasteBinParent = function (editor) {
       
  1391       return global$1.ie && editor.inline ? domGlobals.document.body : editor.getBody();
       
  1392     };
       
  1393     var isExternalPasteBin = function (editor) {
       
  1394       return getPasteBinParent(editor) !== editor.getBody();
       
  1395     };
       
  1396     var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {
       
  1397       if (isExternalPasteBin(editor)) {
       
  1398         editor.dom.bind(pasteBinElm, 'paste keyup', function (e) {
       
  1399           if (!isDefault(editor, pasteBinDefaultContent)) {
       
  1400             editor.fire('paste');
       
  1401           }
       
  1402         });
       
  1403       }
       
  1404     };
       
  1405     var create = function (editor, lastRngCell, pasteBinDefaultContent) {
       
  1406       var dom = editor.dom, body = editor.getBody();
       
  1407       var pasteBinElm;
       
  1408       lastRngCell.set(editor.selection.getRng());
       
  1409       pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
       
  1410         'id': 'mcepastebin',
       
  1411         'class': 'mce-pastebin',
       
  1412         'contentEditable': true,
       
  1413         'data-mce-bogus': 'all',
       
  1414         'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
       
  1415       }, pasteBinDefaultContent);
       
  1416       if (global$1.ie || global$1.gecko) {
       
  1417         dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
       
  1418       }
       
  1419       dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
       
  1420         e.stopPropagation();
       
  1421       });
       
  1422       delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);
       
  1423       pasteBinElm.focus();
       
  1424       editor.selection.select(pasteBinElm, true);
       
  1425     };
       
  1426     var remove = function (editor, lastRngCell) {
       
  1427       if (getEl(editor)) {
       
  1428         var pasteBinClone = void 0;
       
  1429         var lastRng = lastRngCell.get();
       
  1430         while (pasteBinClone = editor.dom.get('mcepastebin')) {
       
  1431           editor.dom.remove(pasteBinClone);
       
  1432           editor.dom.unbind(pasteBinClone);
       
  1433         }
       
  1434         if (lastRng) {
       
  1435           editor.selection.setRng(lastRng);
       
  1436         }
       
  1437       }
       
  1438       lastRngCell.set(null);
       
  1439     };
       
  1440     var getEl = function (editor) {
       
  1441       return editor.dom.get('mcepastebin');
       
  1442     };
       
  1443     var getHtml = function (editor) {
       
  1444       var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
       
  1445       var copyAndRemove = function (toElm, fromElm) {
       
  1446         toElm.appendChild(fromElm);
       
  1447         editor.dom.remove(fromElm, true);
       
  1448       };
       
  1449       pasteBinClones = global$3.grep(getPasteBinParent(editor).childNodes, function (elm) {
       
  1450         return elm.id === 'mcepastebin';
       
  1451       });
       
  1452       pasteBinElm = pasteBinClones.shift();
       
  1453       global$3.each(pasteBinClones, function (pasteBinClone) {
       
  1454         copyAndRemove(pasteBinElm, pasteBinClone);
       
  1455       });
       
  1456       dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
       
  1457       for (i = dirtyWrappers.length - 1; i >= 0; i--) {
       
  1458         cleanWrapper = editor.dom.create('div');
       
  1459         pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
       
  1460         copyAndRemove(cleanWrapper, dirtyWrappers[i]);
       
  1461       }
       
  1462       return pasteBinElm ? pasteBinElm.innerHTML : '';
       
  1463     };
       
  1464     var getLastRng = function (lastRng) {
       
  1465       return lastRng.get();
       
  1466     };
       
  1467     var isDefaultContent = function (pasteBinDefaultContent, content) {
       
  1468       return content === pasteBinDefaultContent;
       
  1469     };
       
  1470     var isPasteBin = function (elm) {
       
  1471       return elm && elm.id === 'mcepastebin';
       
  1472     };
       
  1473     var isDefault = function (editor, pasteBinDefaultContent) {
       
  1474       var pasteBinElm = getEl(editor);
       
  1475       return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
       
  1476     };
       
  1477     var PasteBin = function (editor) {
       
  1478       var lastRng = Cell(null);
       
  1479       var pasteBinDefaultContent = '%MCEPASTEBIN%';
       
  1480       return {
       
  1481         create: function () {
       
  1482           return create(editor, lastRng, pasteBinDefaultContent);
       
  1483         },
       
  1484         remove: function () {
       
  1485           return remove(editor, lastRng);
       
  1486         },
       
  1487         getEl: function () {
       
  1488           return getEl(editor);
       
  1489         },
       
  1490         getHtml: function () {
       
  1491           return getHtml(editor);
       
  1492         },
       
  1493         getLastRng: function () {
       
  1494           return getLastRng(lastRng);
       
  1495         },
       
  1496         isDefault: function () {
       
  1497           return isDefault(editor, pasteBinDefaultContent);
       
  1498         },
       
  1499         isDefaultContent: function (content) {
       
  1500           return isDefaultContent(pasteBinDefaultContent, content);
       
  1501         }
       
  1502       };
       
  1503     };
       
  1504 
       
  1505     var Clipboard = function (editor, pasteFormat) {
       
  1506       var pasteBin = PasteBin(editor);
       
  1507       editor.on('preInit', function () {
       
  1508         return registerEventsAndFilters(editor, pasteBin, pasteFormat);
       
  1509       });
       
  1510       return {
       
  1511         pasteFormat: pasteFormat,
       
  1512         pasteHtml: function (html, internalFlag) {
       
  1513           return pasteHtml$1(editor, html, internalFlag);
       
  1514         },
       
  1515         pasteText: function (text) {
       
  1516           return pasteText(editor, text);
       
  1517         },
       
  1518         pasteImageData: function (e, rng) {
       
  1519           return pasteImageData(editor, e, rng);
       
  1520         },
       
  1521         getDataTransferItems: getDataTransferItems,
       
  1522         hasHtmlOrText: hasHtmlOrText,
       
  1523         hasContentType: hasContentType
       
  1524       };
       
  1525     };
       
  1526 
       
  1527     var noop = function () {
       
  1528     };
       
  1529     var hasWorkingClipboardApi = function (clipboardData) {
       
  1530       return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true;
       
  1531     };
       
  1532     var setHtml5Clipboard = function (clipboardData, html, text) {
       
  1533       if (hasWorkingClipboardApi(clipboardData)) {
       
  1534         try {
       
  1535           clipboardData.clearData();
       
  1536           clipboardData.setData('text/html', html);
       
  1537           clipboardData.setData('text/plain', text);
       
  1538           clipboardData.setData(InternalHtml.internalHtmlMime(), html);
       
  1539           return true;
       
  1540         } catch (e) {
       
  1541           return false;
       
  1542         }
       
  1543       } else {
       
  1544         return false;
       
  1545       }
       
  1546     };
       
  1547     var setClipboardData = function (evt, data, fallback, done) {
       
  1548       if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
       
  1549         evt.preventDefault();
       
  1550         done();
       
  1551       } else {
       
  1552         fallback(data.html, done);
       
  1553       }
       
  1554     };
       
  1555     var fallback = function (editor) {
       
  1556       return function (html, done) {
       
  1557         var markedHtml = InternalHtml.mark(html);
       
  1558         var outer = editor.dom.create('div', {
       
  1559           'contenteditable': 'false',
       
  1560           'data-mce-bogus': 'all'
       
  1561         });
       
  1562         var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
       
  1563         editor.dom.setStyles(outer, {
       
  1564           position: 'fixed',
       
  1565           top: '0',
       
  1566           left: '-3000px',
       
  1567           width: '1000px',
       
  1568           overflow: 'hidden'
       
  1569         });
       
  1570         outer.appendChild(inner);
       
  1571         editor.dom.add(editor.getBody(), outer);
       
  1572         var range = editor.selection.getRng();
       
  1573         inner.focus();
       
  1574         var offscreenRange = editor.dom.createRng();
       
  1575         offscreenRange.selectNodeContents(inner);
       
  1576         editor.selection.setRng(offscreenRange);
       
  1577         setTimeout(function () {
       
  1578           editor.selection.setRng(range);
       
  1579           outer.parentNode.removeChild(outer);
       
  1580           done();
       
  1581         }, 0);
       
  1582       };
       
  1583     };
       
  1584     var getData = function (editor) {
       
  1585       return {
       
  1586         html: editor.selection.getContent({ contextual: true }),
       
  1587         text: editor.selection.getContent({ format: 'text' })
       
  1588       };
       
  1589     };
       
  1590     var isTableSelection = function (editor) {
       
  1591       return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody());
       
  1592     };
       
  1593     var hasSelectedContent = function (editor) {
       
  1594       return !editor.selection.isCollapsed() || isTableSelection(editor);
       
  1595     };
       
  1596     var cut = function (editor) {
       
  1597       return function (evt) {
       
  1598         if (hasSelectedContent(editor)) {
       
  1599           setClipboardData(evt, getData(editor), fallback(editor), function () {
       
  1600             setTimeout(function () {
       
  1601               editor.execCommand('Delete');
       
  1602             }, 0);
       
  1603           });
       
  1604         }
       
  1605       };
       
  1606     };
       
  1607     var copy = function (editor) {
       
  1608       return function (evt) {
       
  1609         if (hasSelectedContent(editor)) {
       
  1610           setClipboardData(evt, getData(editor), fallback(editor), noop);
       
  1611         }
       
  1612       };
       
  1613     };
       
  1614     var register$1 = function (editor) {
       
  1615       editor.on('cut', cut(editor));
       
  1616       editor.on('copy', copy(editor));
       
  1617     };
       
  1618     var CutCopy = { register: register$1 };
       
  1619 
       
  1620     var global$a = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
       
  1621 
       
  1622     var getCaretRangeFromEvent = function (editor, e) {
       
  1623       return global$a.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
       
  1624     };
       
  1625     var isPlainTextFileUrl = function (content) {
       
  1626       var plainTextContent = content['text/plain'];
       
  1627       return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
       
  1628     };
       
  1629     var setFocusedRange = function (editor, rng) {
       
  1630       editor.focus();
   812       editor.selection.setRng(rng);
  1631       editor.selection.setRng(rng);
   813       rng = null;
  1632     };
   814     }
  1633     var setup = function (editor, clipboard, draggingInternallyState) {
   815     var dataUri = reader.result;
  1634       if (Settings.shouldBlockDrop(editor)) {
   816     var base64 = getBase64FromUri(dataUri);
  1635         editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
   817     var id = uniqueId();
       
   818     var name$$1 = editor.settings.images_reuse_filename && blob.name ? extractFilename(editor, blob.name) : id;
       
   819     var img = new Image();
       
   820     img.src = dataUri;
       
   821     if (isValidDataUriImage(editor.settings, img)) {
       
   822       var blobCache = editor.editorUpload.blobCache;
       
   823       var blobInfo = void 0, existingBlobInfo = void 0;
       
   824       existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
       
   825         return cachedBlobInfo.base64() === base64;
       
   826       });
       
   827       if (!existingBlobInfo) {
       
   828         blobInfo = blobCache.create(id, blob, base64, name$$1);
       
   829         blobCache.add(blobInfo);
       
   830       } else {
       
   831         blobInfo = existingBlobInfo;
       
   832       }
       
   833       pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);
       
   834     } else {
       
   835       pasteHtml$1(editor, '<img src="' + dataUri + '">', false);
       
   836     }
       
   837   };
       
   838   var isClipboardEvent = function (event$$1) {
       
   839     return event$$1.type === 'paste';
       
   840   };
       
   841   var pasteImageData = function (editor, e, rng) {
       
   842     var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
       
   843     function processItems(items) {
       
   844       var i, item, reader, hadImage = false;
       
   845       if (items) {
       
   846         for (i = 0; i < items.length; i++) {
       
   847           item = items[i];
       
   848           if (/^image\/(jpeg|png|gif|bmp)$/.test(item.type)) {
       
   849             var blob = item.getAsFile ? item.getAsFile() : item;
       
   850             reader = new window.FileReader();
       
   851             reader.onload = pasteImage.bind(null, editor, rng, reader, blob);
       
   852             reader.readAsDataURL(blob);
       
   853             e.preventDefault();
       
   854             hadImage = true;
       
   855           }
       
   856         }
       
   857       }
       
   858       return hadImage;
       
   859     }
       
   860     if (editor.settings.paste_data_images && dataTransfer) {
       
   861       return processItems(dataTransfer.items) || processItems(dataTransfer.files);
       
   862     }
       
   863   };
       
   864   var isBrokenAndroidClipboardEvent = function (e) {
       
   865     var clipboardData = e.clipboardData;
       
   866     return navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
       
   867   };
       
   868   var isKeyboardPasteEvent = function (e) {
       
   869     return global$4.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
       
   870   };
       
   871   var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
       
   872     var keyboardPasteTimeStamp = 0;
       
   873     var keyboardPastePlainTextState;
       
   874     editor.on('keydown', function (e) {
       
   875       function removePasteBinOnKeyUp(e) {
       
   876         if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
       
   877           pasteBin.remove();
       
   878         }
       
   879       }
       
   880       if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
       
   881         keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
       
   882         if (keyboardPastePlainTextState && global$1.webkit && navigator.userAgent.indexOf('Version/') !== -1) {
       
   883           return;
       
   884         }
       
   885         e.stopImmediatePropagation();
       
   886         keyboardPasteTimeStamp = new Date().getTime();
       
   887         if (global$1.ie && keyboardPastePlainTextState) {
       
   888           e.preventDefault();
  1636           e.preventDefault();
   889           $_8tki3zijjjgwectj.firePaste(editor, true);
       
   890           return;
       
   891         }
       
   892         pasteBin.remove();
       
   893         pasteBin.create();
       
   894         editor.once('keyup', removePasteBinOnKeyUp);
       
   895         editor.once('paste', function () {
       
   896           editor.off('keyup', removePasteBinOnKeyUp);
       
   897         });
       
   898       }
       
   899     });
       
   900     function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
       
   901       var content, isPlainTextHtml;
       
   902       if (hasContentType(clipboardContent, 'text/html')) {
       
   903         content = clipboardContent['text/html'];
       
   904       } else {
       
   905         content = pasteBin.getHtml();
       
   906         internal = internal ? internal : $_4x13hjirjjgwecu1.isMarked(content);
       
   907         if (pasteBin.isDefaultContent(content)) {
       
   908           plainTextMode = true;
       
   909         }
       
   910       }
       
   911       content = $_4bi2o9j0jjgwecui.trimHtml(content);
       
   912       pasteBin.remove();
       
   913       isPlainTextHtml = internal === false && $_4h3hnrisjjgwecu2.isPlainText(content);
       
   914       if (!content.length || isPlainTextHtml) {
       
   915         plainTextMode = true;
       
   916       }
       
   917       if (plainTextMode) {
       
   918         if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
       
   919           content = clipboardContent['text/plain'];
       
   920         } else {
       
   921           content = $_4bi2o9j0jjgwecui.innerText(content);
       
   922         }
       
   923       }
       
   924       if (pasteBin.isDefaultContent(content)) {
       
   925         if (!isKeyBoardPaste) {
       
   926           editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
       
   927         }
       
   928         return;
       
   929       }
       
   930       if (plainTextMode) {
       
   931         pasteText(editor, content);
       
   932       } else {
       
   933         pasteHtml$1(editor, content, internal);
       
   934       }
       
   935     }
       
   936     var getLastRng = function () {
       
   937       return pasteBin.getLastRng() || editor.selection.getRng();
       
   938     };
       
   939     editor.on('paste', function (e) {
       
   940       var clipboardTimer = new Date().getTime();
       
   941       var clipboardContent = getClipboardContent(editor, e);
       
   942       var clipboardDelay = new Date().getTime() - clipboardTimer;
       
   943       var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay < 1000;
       
   944       var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
       
   945       var internal = hasContentType(clipboardContent, $_4x13hjirjjgwecu1.internalHtmlMime());
       
   946       keyboardPastePlainTextState = false;
       
   947       if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
       
   948         pasteBin.remove();
       
   949         return;
       
   950       }
       
   951       if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
       
   952         pasteBin.remove();
       
   953         return;
       
   954       }
       
   955       if (!isKeyBoardPaste) {
       
   956         e.preventDefault();
       
   957       }
       
   958       if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
       
   959         pasteBin.create();
       
   960         editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
       
   961           e.stopPropagation();
  1637           e.stopPropagation();
   962         });
  1638         });
   963         editor.getDoc().execCommand('Paste', false, null);
  1639       }
   964         clipboardContent['text/html'] = pasteBin.getHtml();
  1640       if (!Settings.shouldPasteDataImages(editor)) {
   965       }
  1641         editor.on('drop', function (e) {
   966       if (hasContentType(clipboardContent, 'text/html')) {
  1642           var dataTransfer = e.dataTransfer;
   967         e.preventDefault();
  1643           if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
   968         if (!internal) {
  1644             e.preventDefault();
   969           internal = $_4x13hjirjjgwecu1.isMarked(clipboardContent['text/html']);
  1645           }
   970         }
  1646         });
   971         insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
  1647       }
   972       } else {
  1648       editor.on('drop', function (e) {
   973         global$2.setEditorTimeout(editor, function () {
  1649         var dropContent, rng;
   974           insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
  1650         rng = getCaretRangeFromEvent(editor, e);
   975         }, 0);
  1651         if (e.isDefaultPrevented() || draggingInternallyState.get()) {
   976       }
  1652           return;
   977     });
  1653         }
   978   };
  1654         dropContent = clipboard.getDataTransferItems(e.dataTransfer);
   979   var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
  1655         var internal = clipboard.hasContentType(dropContent, InternalHtml.internalHtmlMime());
   980     registerEventHandlers(editor, pasteBin, pasteFormat);
  1656         if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {
   981     var src;
  1657           return;
   982     editor.parser.addNodeFilter('img', function (nodes, name$$1, args) {
  1658         }
   983       var isPasteInsert = function (args) {
  1659         if (rng && Settings.shouldFilterDrop(editor)) {
   984         return args.data && args.data.paste === true;
  1660           var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
   985       };
  1661           if (content_1) {
   986       var remove = function (node) {
  1662             e.preventDefault();
   987         if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) {
  1663             global$2.setEditorTimeout(editor, function () {
   988           node.remove();
  1664               editor.undoManager.transact(function () {
   989         }
  1665                 if (dropContent['mce-internal']) {
   990       };
  1666                   editor.execCommand('Delete');
   991       var isWebKitFakeUrl = function (src) {
  1667                 }
   992         return src.indexOf('webkit-fake-url') === 0;
  1668                 setFocusedRange(editor, rng);
   993       };
  1669                 content_1 = Utils.trimHtml(content_1);
   994       var isDataUri = function (src) {
  1670                 if (!dropContent['text/html']) {
   995         return src.indexOf('data:') === 0;
  1671                   clipboard.pasteText(content_1);
   996       };
  1672                 } else {
   997       if (!editor.settings.paste_data_images && isPasteInsert(args)) {
  1673                   clipboard.pasteHtml(content_1, internal);
   998         var i = nodes.length;
  1674                 }
   999         while (i--) {
  1675               });
  1000           src = nodes[i].attributes.map.src;
  1676             });
  1001           if (!src) {
  1677           }
  1002             continue;
  1678         }
  1003           }
  1679       });
  1004           if (isWebKitFakeUrl(src)) {
  1680       editor.on('dragstart', function (e) {
  1005             remove(nodes[i]);
  1681         draggingInternallyState.set(true);
  1006           } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
  1682       });
  1007             remove(nodes[i]);
  1683       editor.on('dragover dragend', function (e) {
  1008           }
  1684         if (Settings.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {
  1009         }
  1685           e.preventDefault();
  1010       }
  1686           setFocusedRange(editor, getCaretRangeFromEvent(editor, e));
  1011     });
  1687         }
  1012   };
  1688         if (e.type === 'dragend') {
  1013 
  1689           draggingInternallyState.set(false);
  1014   var getPasteBinParent = function (editor) {
  1690         }
  1015     return global$1.ie && editor.inline ? document.body : editor.getBody();
  1691       });
  1016   };
  1692     };
  1017   var isExternalPasteBin = function (editor) {
  1693     var DragDrop = { setup: setup };
  1018     return getPasteBinParent(editor) !== editor.getBody();
  1694 
  1019   };
  1695     var setup$1 = function (editor) {
  1020   var delegatePasteEvents = function (editor, pasteBinElm) {
  1696       var plugin = editor.plugins.paste;
  1021     if (isExternalPasteBin(editor)) {
  1697       var preProcess = Settings.getPreProcess(editor);
  1022       editor.dom.bind(pasteBinElm, 'paste keyup', function (e) {
  1698       if (preProcess) {
  1023         setTimeout(function () {
  1699         editor.on('PastePreProcess', function (e) {
  1024           editor.fire('paste');
  1700           preProcess.call(plugin, plugin, e);
  1025         }, 0);
  1701         });
       
  1702       }
       
  1703       var postProcess = Settings.getPostProcess(editor);
       
  1704       if (postProcess) {
       
  1705         editor.on('PastePostProcess', function (e) {
       
  1706           postProcess.call(plugin, plugin, e);
       
  1707         });
       
  1708       }
       
  1709     };
       
  1710     var PrePostProcess = { setup: setup$1 };
       
  1711 
       
  1712     function addPreProcessFilter(editor, filterFunc) {
       
  1713       editor.on('PastePreProcess', function (e) {
       
  1714         e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
  1026       });
  1715       });
  1027     }
  1716     }
  1028   };
  1717     function addPostProcessFilter(editor, filterFunc) {
  1029   var create = function (editor, lastRngCell, pasteBinDefaultContent) {
  1718       editor.on('PastePostProcess', function (e) {
  1030     var dom = editor.dom, body = editor.getBody();
  1719         filterFunc(editor, e.node);
  1031     var pasteBinElm;
  1720       });
  1032     lastRngCell.set(editor.selection.getRng());
       
  1033     pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
       
  1034       'id': 'mcepastebin',
       
  1035       'class': 'mce-pastebin',
       
  1036       'contentEditable': true,
       
  1037       'data-mce-bogus': 'all',
       
  1038       'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
       
  1039     }, pasteBinDefaultContent);
       
  1040     if (global$1.ie || global$1.gecko) {
       
  1041       dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
       
  1042     }
  1721     }
  1043     dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
  1722     function removeExplorerBrElementsAfterBlocks(editor, html) {
  1044       e.stopPropagation();
  1723       if (!WordFilter.isWordContent(html)) {
  1045     });
  1724         return html;
  1046     delegatePasteEvents(editor, pasteBinElm);
  1725       }
  1047     pasteBinElm.focus();
  1726       var blockElements = [];
  1048     editor.selection.select(pasteBinElm, true);
  1727       global$3.each(editor.schema.getBlockElements(), function (block, blockName) {
  1049   };
  1728         blockElements.push(blockName);
  1050   var remove = function (editor, lastRngCell) {
  1729       });
  1051     if (getEl(editor)) {
  1730       var explorerBlocksRegExp = new RegExp('(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*', 'g');
  1052       var pasteBinClone = void 0;
  1731       html = Utils.filter(html, [[
  1053       var lastRng = lastRngCell.get();
  1732           explorerBlocksRegExp,
  1054       while (pasteBinClone = editor.dom.get('mcepastebin')) {
  1733           '$1'
  1055         editor.dom.remove(pasteBinClone);
  1734         ]]);
  1056         editor.dom.unbind(pasteBinClone);
  1735       html = Utils.filter(html, [
  1057       }
  1736         [
  1058       if (lastRng) {
  1737           /<br><br>/g,
  1059         editor.selection.setRng(lastRng);
  1738           '<BR><BR>'
  1060       }
  1739         ],
  1061     }
  1740         [
  1062     lastRngCell.set(null);
  1741           /<br>/g,
  1063   };
  1742           ' '
  1064   var getEl = function (editor) {
  1743         ],
  1065     return editor.dom.get('mcepastebin');
  1744         [
  1066   };
  1745           /<BR><BR>/g,
  1067   var getHtml = function (editor) {
  1746           '<br>'
  1068     var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
  1747         ]
  1069     var copyAndRemove = function (toElm, fromElm) {
  1748       ]);
  1070       toElm.appendChild(fromElm);
       
  1071       editor.dom.remove(fromElm, true);
       
  1072     };
       
  1073     pasteBinClones = global$3.grep(getPasteBinParent(editor).childNodes, function (elm) {
       
  1074       return elm.id === 'mcepastebin';
       
  1075     });
       
  1076     pasteBinElm = pasteBinClones.shift();
       
  1077     global$3.each(pasteBinClones, function (pasteBinClone) {
       
  1078       copyAndRemove(pasteBinElm, pasteBinClone);
       
  1079     });
       
  1080     dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
       
  1081     for (i = dirtyWrappers.length - 1; i >= 0; i--) {
       
  1082       cleanWrapper = editor.dom.create('div');
       
  1083       pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
       
  1084       copyAndRemove(cleanWrapper, dirtyWrappers[i]);
       
  1085     }
       
  1086     return pasteBinElm ? pasteBinElm.innerHTML : '';
       
  1087   };
       
  1088   var getLastRng = function (lastRng) {
       
  1089     return lastRng.get();
       
  1090   };
       
  1091   var isDefaultContent = function (pasteBinDefaultContent, content) {
       
  1092     return content === pasteBinDefaultContent;
       
  1093   };
       
  1094   var isPasteBin = function (elm) {
       
  1095     return elm && elm.id === 'mcepastebin';
       
  1096   };
       
  1097   var isDefault = function (editor, pasteBinDefaultContent) {
       
  1098     var pasteBinElm = getEl(editor);
       
  1099     return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
       
  1100   };
       
  1101   var PasteBin = function (editor) {
       
  1102     var lastRng = Cell(null);
       
  1103     var pasteBinDefaultContent = '%MCEPASTEBIN%';
       
  1104     return {
       
  1105       create: function () {
       
  1106         return create(editor, lastRng, pasteBinDefaultContent);
       
  1107       },
       
  1108       remove: function () {
       
  1109         return remove(editor, lastRng);
       
  1110       },
       
  1111       getEl: function () {
       
  1112         return getEl(editor);
       
  1113       },
       
  1114       getHtml: function () {
       
  1115         return getHtml(editor);
       
  1116       },
       
  1117       getLastRng: function () {
       
  1118         return getLastRng(lastRng);
       
  1119       },
       
  1120       isDefault: function () {
       
  1121         return isDefault(editor, pasteBinDefaultContent);
       
  1122       },
       
  1123       isDefaultContent: function (content) {
       
  1124         return isDefaultContent(pasteBinDefaultContent, content);
       
  1125       }
       
  1126     };
       
  1127   };
       
  1128 
       
  1129   var Clipboard = function (editor, pasteFormat) {
       
  1130     var pasteBin = PasteBin(editor);
       
  1131     editor.on('preInit', function () {
       
  1132       return registerEventsAndFilters(editor, pasteBin, pasteFormat);
       
  1133     });
       
  1134     return {
       
  1135       pasteFormat: pasteFormat,
       
  1136       pasteHtml: function (html, internalFlag) {
       
  1137         return pasteHtml$1(editor, html, internalFlag);
       
  1138       },
       
  1139       pasteText: function (text) {
       
  1140         return pasteText(editor, text);
       
  1141       },
       
  1142       pasteImageData: function (e, rng) {
       
  1143         return pasteImageData(editor, e, rng);
       
  1144       },
       
  1145       getDataTransferItems: getDataTransferItems,
       
  1146       hasHtmlOrText: hasHtmlOrText,
       
  1147       hasContentType: hasContentType
       
  1148     };
       
  1149   };
       
  1150 
       
  1151   var noop = function () {
       
  1152   };
       
  1153   var hasWorkingClipboardApi = function (clipboardData) {
       
  1154     return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && $_4bi2o9j0jjgwecui.isMsEdge() !== true;
       
  1155   };
       
  1156   var setHtml5Clipboard = function (clipboardData, html, text) {
       
  1157     if (hasWorkingClipboardApi(clipboardData)) {
       
  1158       try {
       
  1159         clipboardData.clearData();
       
  1160         clipboardData.setData('text/html', html);
       
  1161         clipboardData.setData('text/plain', text);
       
  1162         clipboardData.setData($_4x13hjirjjgwecu1.internalHtmlMime(), html);
       
  1163         return true;
       
  1164       } catch (e) {
       
  1165         return false;
       
  1166       }
       
  1167     } else {
       
  1168       return false;
       
  1169     }
       
  1170   };
       
  1171   var setClipboardData = function (evt, data, fallback, done) {
       
  1172     if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
       
  1173       evt.preventDefault();
       
  1174       done();
       
  1175     } else {
       
  1176       fallback(data.html, done);
       
  1177     }
       
  1178   };
       
  1179   var fallback = function (editor) {
       
  1180     return function (html, done) {
       
  1181       var markedHtml = $_4x13hjirjjgwecu1.mark(html);
       
  1182       var outer = editor.dom.create('div', {
       
  1183         'contenteditable': 'false',
       
  1184         'data-mce-bogus': 'all'
       
  1185       });
       
  1186       var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
       
  1187       editor.dom.setStyles(outer, {
       
  1188         position: 'fixed',
       
  1189         top: '0',
       
  1190         left: '-3000px',
       
  1191         width: '1000px',
       
  1192         overflow: 'hidden'
       
  1193       });
       
  1194       outer.appendChild(inner);
       
  1195       editor.dom.add(editor.getBody(), outer);
       
  1196       var range = editor.selection.getRng();
       
  1197       inner.focus();
       
  1198       var offscreenRange = editor.dom.createRng();
       
  1199       offscreenRange.selectNodeContents(inner);
       
  1200       editor.selection.setRng(offscreenRange);
       
  1201       setTimeout(function () {
       
  1202         editor.selection.setRng(range);
       
  1203         outer.parentNode.removeChild(outer);
       
  1204         done();
       
  1205       }, 0);
       
  1206     };
       
  1207   };
       
  1208   var getData = function (editor) {
       
  1209     return {
       
  1210       html: editor.selection.getContent({ contextual: true }),
       
  1211       text: editor.selection.getContent({ format: 'text' })
       
  1212     };
       
  1213   };
       
  1214   var cut = function (editor) {
       
  1215     return function (evt) {
       
  1216       if (editor.selection.isCollapsed() === false) {
       
  1217         setClipboardData(evt, getData(editor), fallback(editor), function () {
       
  1218           setTimeout(function () {
       
  1219             editor.execCommand('Delete');
       
  1220           }, 0);
       
  1221         });
       
  1222       }
       
  1223     };
       
  1224   };
       
  1225   var copy = function (editor) {
       
  1226     return function (evt) {
       
  1227       if (editor.selection.isCollapsed() === false) {
       
  1228         setClipboardData(evt, getData(editor), fallback(editor), noop);
       
  1229       }
       
  1230     };
       
  1231   };
       
  1232   var register$1 = function (editor) {
       
  1233     editor.on('cut', cut(editor));
       
  1234     editor.on('copy', copy(editor));
       
  1235   };
       
  1236   var $_32blojj3jjgwecv4 = { register: register$1 };
       
  1237 
       
  1238   var global$10 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
       
  1239 
       
  1240   var getCaretRangeFromEvent = function (editor, e) {
       
  1241     return global$10.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
       
  1242   };
       
  1243   var isPlainTextFileUrl = function (content) {
       
  1244     var plainTextContent = content['text/plain'];
       
  1245     return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
       
  1246   };
       
  1247   var setFocusedRange = function (editor, rng) {
       
  1248     editor.focus();
       
  1249     editor.selection.setRng(rng);
       
  1250   };
       
  1251   var setup = function (editor, clipboard, draggingInternallyState) {
       
  1252     if ($_xr8b0ikjjgwectl.shouldBlockDrop(editor)) {
       
  1253       editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
       
  1254         e.preventDefault();
       
  1255         e.stopPropagation();
       
  1256       });
       
  1257     }
       
  1258     if (!$_xr8b0ikjjgwectl.shouldPasteDataImages(editor)) {
       
  1259       editor.on('drop', function (e) {
       
  1260         var dataTransfer = e.dataTransfer;
       
  1261         if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
       
  1262           e.preventDefault();
       
  1263         }
       
  1264       });
       
  1265     }
       
  1266     editor.on('drop', function (e) {
       
  1267       var dropContent, rng;
       
  1268       rng = getCaretRangeFromEvent(editor, e);
       
  1269       if (e.isDefaultPrevented() || draggingInternallyState.get()) {
       
  1270         return;
       
  1271       }
       
  1272       dropContent = clipboard.getDataTransferItems(e.dataTransfer);
       
  1273       var internal = clipboard.hasContentType(dropContent, $_4x13hjirjjgwecu1.internalHtmlMime());
       
  1274       if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {
       
  1275         return;
       
  1276       }
       
  1277       if (rng && $_xr8b0ikjjgwectl.shouldFilterDrop(editor)) {
       
  1278         var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
       
  1279         if (content_1) {
       
  1280           e.preventDefault();
       
  1281           global$2.setEditorTimeout(editor, function () {
       
  1282             editor.undoManager.transact(function () {
       
  1283               if (dropContent['mce-internal']) {
       
  1284                 editor.execCommand('Delete');
       
  1285               }
       
  1286               setFocusedRange(editor, rng);
       
  1287               content_1 = $_4bi2o9j0jjgwecui.trimHtml(content_1);
       
  1288               if (!dropContent['text/html']) {
       
  1289                 clipboard.pasteText(content_1);
       
  1290               } else {
       
  1291                 clipboard.pasteHtml(content_1, internal);
       
  1292               }
       
  1293             });
       
  1294           });
       
  1295         }
       
  1296       }
       
  1297     });
       
  1298     editor.on('dragstart', function (e) {
       
  1299       draggingInternallyState.set(true);
       
  1300     });
       
  1301     editor.on('dragover dragend', function (e) {
       
  1302       if ($_xr8b0ikjjgwectl.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {
       
  1303         e.preventDefault();
       
  1304         setFocusedRange(editor, getCaretRangeFromEvent(editor, e));
       
  1305       }
       
  1306       if (e.type === 'dragend') {
       
  1307         draggingInternallyState.set(false);
       
  1308       }
       
  1309     });
       
  1310   };
       
  1311   var $_b4etj0j4jjgwecv7 = { setup: setup };
       
  1312 
       
  1313   var setup$1 = function (editor) {
       
  1314     var plugin = editor.plugins.paste;
       
  1315     var preProcess = $_xr8b0ikjjgwectl.getPreProcess(editor);
       
  1316     if (preProcess) {
       
  1317       editor.on('PastePreProcess', function (e) {
       
  1318         preProcess.call(plugin, plugin, e);
       
  1319       });
       
  1320     }
       
  1321     var postProcess = $_xr8b0ikjjgwectl.getPostProcess(editor);
       
  1322     if (postProcess) {
       
  1323       editor.on('PastePostProcess', function (e) {
       
  1324         postProcess.call(plugin, plugin, e);
       
  1325       });
       
  1326     }
       
  1327   };
       
  1328   var $_c5bihmj6jjgwecva = { setup: setup$1 };
       
  1329 
       
  1330   function addPreProcessFilter(editor, filterFunc) {
       
  1331     editor.on('PastePreProcess', function (e) {
       
  1332       e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
       
  1333     });
       
  1334   }
       
  1335   function addPostProcessFilter(editor, filterFunc) {
       
  1336     editor.on('PastePostProcess', function (e) {
       
  1337       filterFunc(editor, e.node);
       
  1338     });
       
  1339   }
       
  1340   function removeExplorerBrElementsAfterBlocks(editor, html) {
       
  1341     if (!$_dfatuiivjjgwecu8.isWordContent(html)) {
       
  1342       return html;
  1749       return html;
  1343     }
  1750     }
  1344     var blockElements = [];
  1751     function removeWebKitStyles(editor, content, internal, isWordHtml) {
  1345     global$3.each(editor.schema.getBlockElements(), function (block, blockName) {
  1752       if (isWordHtml || internal) {
  1346       blockElements.push(blockName);
  1753         return content;
  1347     });
  1754       }
  1348     var explorerBlocksRegExp = new RegExp('(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*', 'g');
  1755       var webKitStylesSetting = Settings.getWebkitStyles(editor);
  1349     html = $_4bi2o9j0jjgwecui.filter(html, [[
  1756       var webKitStyles;
  1350         explorerBlocksRegExp,
  1757       if (Settings.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {
  1351         '$1'
  1758         return content;
  1352       ]]);
  1759       }
  1353     html = $_4bi2o9j0jjgwecui.filter(html, [
  1760       if (webKitStylesSetting) {
  1354       [
  1761         webKitStyles = webKitStylesSetting.split(/[, ]/);
  1355         /<br><br>/g,
  1762       }
  1356         '<BR><BR>'
  1763       if (webKitStyles) {
  1357       ],
  1764         var dom_1 = editor.dom, node_1 = editor.selection.getNode();
  1358       [
  1765         content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
  1359         /<br>/g,
  1766           var inputStyles = dom_1.parseStyle(dom_1.decode(value));
  1360         ' '
  1767           var outputStyles = {};
  1361       ],
  1768           if (webKitStyles === 'none') {
  1362       [
  1769             return before + after;
  1363         /<BR><BR>/g,
  1770           }
  1364         '<br>'
  1771           for (var i = 0; i < webKitStyles.length; i++) {
  1365       ]
  1772             var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);
  1366     ]);
  1773             if (/color/.test(webKitStyles[i])) {
  1367     return html;
  1774               inputValue = dom_1.toHex(inputValue);
  1368   }
  1775               currentValue = dom_1.toHex(currentValue);
  1369   function removeWebKitStyles(editor, content, internal, isWordHtml) {
  1776             }
  1370     if (isWordHtml || internal) {
  1777             if (currentValue !== inputValue) {
       
  1778               outputStyles[webKitStyles[i]] = inputValue;
       
  1779             }
       
  1780           }
       
  1781           outputStyles = dom_1.serializeStyle(outputStyles, 'span');
       
  1782           if (outputStyles) {
       
  1783             return before + ' style="' + outputStyles + '"' + after;
       
  1784           }
       
  1785           return before + after;
       
  1786         });
       
  1787       } else {
       
  1788         content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
       
  1789       }
       
  1790       content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
       
  1791         return before + ' style="' + value + '"' + after;
       
  1792       });
  1371       return content;
  1793       return content;
  1372     }
  1794     }
  1373     var webKitStylesSetting = $_xr8b0ikjjgwectl.getWebkitStyles(editor);
  1795     function removeUnderlineAndFontInAnchor(editor, root) {
  1374     var webKitStyles;
  1796       editor.$('a', root).find('font,u').each(function (i, node) {
  1375     if ($_xr8b0ikjjgwectl.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {
  1797         editor.dom.remove(node, true);
  1376       return content;
  1798       });
  1377     }
  1799     }
  1378     if (webKitStylesSetting) {
  1800     var setup$2 = function (editor) {
  1379       webKitStyles = webKitStylesSetting.split(/[, ]/);
  1801       if (global$1.webkit) {
       
  1802         addPreProcessFilter(editor, removeWebKitStyles);
       
  1803       }
       
  1804       if (global$1.ie) {
       
  1805         addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
       
  1806         addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
       
  1807       }
       
  1808     };
       
  1809     var Quirks = { setup: setup$2 };
       
  1810 
       
  1811     var stateChange = function (editor, clipboard, e) {
       
  1812       var ctrl = e.control;
       
  1813       ctrl.active(clipboard.pasteFormat.get() === 'text');
       
  1814       editor.on('PastePlainTextToggle', function (e) {
       
  1815         ctrl.active(e.state);
       
  1816       });
       
  1817     };
       
  1818     var register$2 = function (editor, clipboard) {
       
  1819       var postRender = curry(stateChange, editor, clipboard);
       
  1820       editor.addButton('pastetext', {
       
  1821         active: false,
       
  1822         icon: 'pastetext',
       
  1823         tooltip: 'Paste as text',
       
  1824         cmd: 'mceTogglePlainTextPaste',
       
  1825         onPostRender: postRender
       
  1826       });
       
  1827       editor.addMenuItem('pastetext', {
       
  1828         text: 'Paste as text',
       
  1829         selectable: true,
       
  1830         active: clipboard.pasteFormat,
       
  1831         cmd: 'mceTogglePlainTextPaste',
       
  1832         onPostRender: postRender
       
  1833       });
       
  1834     };
       
  1835     var Buttons = { register: register$2 };
       
  1836 
       
  1837     global.add('paste', function (editor) {
       
  1838       if (DetectProPlugin.hasProPlugin(editor) === false) {
       
  1839         var userIsInformedState = Cell(false);
       
  1840         var draggingInternallyState = Cell(false);
       
  1841         var pasteFormat = Cell(Settings.isPasteAsTextEnabled(editor) ? 'text' : 'html');
       
  1842         var clipboard = Clipboard(editor, pasteFormat);
       
  1843         var quirks = Quirks.setup(editor);
       
  1844         Buttons.register(editor, clipboard);
       
  1845         Commands.register(editor, clipboard, userIsInformedState);
       
  1846         PrePostProcess.setup(editor);
       
  1847         CutCopy.register(editor);
       
  1848         DragDrop.setup(editor, clipboard, draggingInternallyState);
       
  1849         return Api.get(clipboard, quirks);
       
  1850       }
       
  1851     });
       
  1852     function Plugin () {
  1380     }
  1853     }
  1381     if (webKitStyles) {
  1854 
  1382       var dom_1 = editor.dom, node_1 = editor.selection.getNode();
  1855     return Plugin;
  1383       content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
  1856 
  1384         var inputStyles = dom_1.parseStyle(dom_1.decode(value));
  1857 }(window));
  1385         var outputStyles = {};
       
  1386         if (webKitStyles === 'none') {
       
  1387           return before + after;
       
  1388         }
       
  1389         for (var i = 0; i < webKitStyles.length; i++) {
       
  1390           var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);
       
  1391           if (/color/.test(webKitStyles[i])) {
       
  1392             inputValue = dom_1.toHex(inputValue);
       
  1393             currentValue = dom_1.toHex(currentValue);
       
  1394           }
       
  1395           if (currentValue !== inputValue) {
       
  1396             outputStyles[webKitStyles[i]] = inputValue;
       
  1397           }
       
  1398         }
       
  1399         outputStyles = dom_1.serializeStyle(outputStyles, 'span');
       
  1400         if (outputStyles) {
       
  1401           return before + ' style="' + outputStyles + '"' + after;
       
  1402         }
       
  1403         return before + after;
       
  1404       });
       
  1405     } else {
       
  1406       content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
       
  1407     }
       
  1408     content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
       
  1409       return before + ' style="' + value + '"' + after;
       
  1410     });
       
  1411     return content;
       
  1412   }
       
  1413   function removeUnderlineAndFontInAnchor(editor, root) {
       
  1414     editor.$('a', root).find('font,u').each(function (i, node) {
       
  1415       editor.dom.remove(node, true);
       
  1416     });
       
  1417   }
       
  1418   var setup$2 = function (editor) {
       
  1419     if (global$1.webkit) {
       
  1420       addPreProcessFilter(editor, removeWebKitStyles);
       
  1421     }
       
  1422     if (global$1.ie) {
       
  1423       addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
       
  1424       addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
       
  1425     }
       
  1426   };
       
  1427   var $_36tmgyj7jjgwecvc = { setup: setup$2 };
       
  1428 
       
  1429   var curry = function (f) {
       
  1430     var x = [];
       
  1431     for (var _i = 1; _i < arguments.length; _i++) {
       
  1432       x[_i - 1] = arguments[_i];
       
  1433     }
       
  1434     var args = new Array(arguments.length - 1);
       
  1435     for (var i = 1; i < arguments.length; i++)
       
  1436       args[i - 1] = arguments[i];
       
  1437     return function () {
       
  1438       var x = [];
       
  1439       for (var _i = 0; _i < arguments.length; _i++) {
       
  1440         x[_i] = arguments[_i];
       
  1441       }
       
  1442       var newArgs = new Array(arguments.length);
       
  1443       for (var j = 0; j < newArgs.length; j++)
       
  1444         newArgs[j] = arguments[j];
       
  1445       var all = args.concat(newArgs);
       
  1446       return f.apply(null, all);
       
  1447     };
       
  1448   };
       
  1449 
       
  1450   var stateChange = function (editor, clipboard, e) {
       
  1451     var ctrl = e.control;
       
  1452     ctrl.active(clipboard.pasteFormat.get() === 'text');
       
  1453     editor.on('PastePlainTextToggle', function (e) {
       
  1454       ctrl.active(e.state);
       
  1455     });
       
  1456   };
       
  1457   var register$2 = function (editor, clipboard) {
       
  1458     var postRender = curry(stateChange, editor, clipboard);
       
  1459     editor.addButton('pastetext', {
       
  1460       active: false,
       
  1461       icon: 'pastetext',
       
  1462       tooltip: 'Paste as text',
       
  1463       cmd: 'mceTogglePlainTextPaste',
       
  1464       onPostRender: postRender
       
  1465     });
       
  1466     editor.addMenuItem('pastetext', {
       
  1467       text: 'Paste as text',
       
  1468       selectable: true,
       
  1469       active: clipboard.pasteFormat,
       
  1470       cmd: 'mceTogglePlainTextPaste',
       
  1471       onPostRender: postRender
       
  1472     });
       
  1473   };
       
  1474   var $_g9yhwdj8jjgwecvf = { register: register$2 };
       
  1475 
       
  1476   global.add('paste', function (editor) {
       
  1477     if ($_15bf6siejjgwect1.hasProPlugin(editor) === false) {
       
  1478       var userIsInformedState = Cell(false);
       
  1479       var draggingInternallyState = Cell(false);
       
  1480       var pasteFormat = Cell($_xr8b0ikjjgwectl.isPasteAsTextEnabled(editor) ? 'text' : 'html');
       
  1481       var clipboard = Clipboard(editor, pasteFormat);
       
  1482       var quirks = $_36tmgyj7jjgwecvc.setup(editor);
       
  1483       $_g9yhwdj8jjgwecvf.register(editor, clipboard);
       
  1484       $_fldd1mihjjgwecth.register(editor, clipboard, userIsInformedState);
       
  1485       $_c5bihmj6jjgwecva.setup(editor);
       
  1486       $_32blojj3jjgwecv4.register(editor);
       
  1487       $_b4etj0j4jjgwecv7.setup(editor, clipboard, draggingInternallyState);
       
  1488       return $_6gtliyigjjgwecte.get(clipboard, quirks);
       
  1489     }
       
  1490   });
       
  1491   function Plugin () {
       
  1492   }
       
  1493 
       
  1494   return Plugin;
       
  1495 
       
  1496 }());
       
  1497 })();
  1858 })();