wysiwyg-rails 2.6.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -3
  3. data/app/assets/javascripts/froala_editor.min.js +3 -8
  4. data/app/assets/javascripts/froala_editor.pkgd.min.js +3 -17
  5. data/app/assets/javascripts/languages/ar.js +92 -4
  6. data/app/assets/javascripts/languages/bs.js +92 -4
  7. data/app/assets/javascripts/languages/cs.js +92 -4
  8. data/app/assets/javascripts/languages/da.js +196 -111
  9. data/app/assets/javascripts/languages/de.js +167 -79
  10. data/app/assets/javascripts/languages/el.js +327 -0
  11. data/app/assets/javascripts/languages/en_ca.js +94 -6
  12. data/app/assets/javascripts/languages/en_gb.js +92 -4
  13. data/app/assets/javascripts/languages/es.js +93 -5
  14. data/app/assets/javascripts/languages/et.js +92 -4
  15. data/app/assets/javascripts/languages/fa.js +96 -8
  16. data/app/assets/javascripts/languages/fi.js +92 -4
  17. data/app/assets/javascripts/languages/fr.js +129 -41
  18. data/app/assets/javascripts/languages/he.js +92 -4
  19. data/app/assets/javascripts/languages/hr.js +92 -4
  20. data/app/assets/javascripts/languages/hu.js +105 -17
  21. data/app/assets/javascripts/languages/id.js +92 -4
  22. data/app/assets/javascripts/languages/it.js +198 -110
  23. data/app/assets/javascripts/languages/ja.js +191 -103
  24. data/app/assets/javascripts/languages/ko.js +116 -28
  25. data/app/assets/javascripts/languages/ku.js +314 -0
  26. data/app/assets/javascripts/languages/me.js +92 -4
  27. data/app/assets/javascripts/languages/nb.js +92 -4
  28. data/app/assets/javascripts/languages/nl.js +101 -13
  29. data/app/assets/javascripts/languages/pl.js +92 -4
  30. data/app/assets/javascripts/languages/pt_br.js +165 -77
  31. data/app/assets/javascripts/languages/pt_pt.js +94 -6
  32. data/app/assets/javascripts/languages/ro.js +92 -5
  33. data/app/assets/javascripts/languages/ru.js +95 -7
  34. data/app/assets/javascripts/languages/sk.js +92 -5
  35. data/app/assets/javascripts/languages/sr.js +92 -4
  36. data/app/assets/javascripts/languages/sv.js +121 -33
  37. data/app/assets/javascripts/languages/th.js +93 -5
  38. data/app/assets/javascripts/languages/tr.js +92 -4
  39. data/app/assets/javascripts/languages/{ua.js → uk.js} +93 -5
  40. data/app/assets/javascripts/languages/vi.js +92 -4
  41. data/app/assets/javascripts/languages/zh_cn.js +259 -171
  42. data/app/assets/javascripts/languages/zh_tw.js +92 -4
  43. data/app/assets/javascripts/plugins/align.min.js +3 -3
  44. data/app/assets/javascripts/plugins/char_counter.min.js +3 -3
  45. data/app/assets/javascripts/plugins/code_beautifier.min.js +3 -4
  46. data/app/assets/javascripts/plugins/code_view.min.js +3 -3
  47. data/app/assets/javascripts/plugins/colors.min.js +3 -3
  48. data/app/assets/javascripts/plugins/draggable.min.js +3 -3
  49. data/app/assets/javascripts/plugins/emoticons.min.js +3 -3
  50. data/app/assets/javascripts/plugins/entities.min.js +3 -3
  51. data/app/assets/javascripts/plugins/file.min.js +3 -3
  52. data/app/assets/javascripts/plugins/font_family.min.js +3 -3
  53. data/app/assets/javascripts/plugins/font_size.min.js +3 -3
  54. data/app/assets/javascripts/plugins/forms.min.js +3 -3
  55. data/app/assets/javascripts/plugins/fullscreen.min.js +3 -3
  56. data/app/assets/javascripts/plugins/help.min.js +3 -3
  57. data/app/assets/javascripts/plugins/image.min.js +3 -4
  58. data/app/assets/javascripts/plugins/image_manager.min.js +3 -3
  59. data/app/assets/javascripts/plugins/inline_class.min.js +7 -0
  60. data/app/assets/javascripts/plugins/inline_style.min.js +3 -3
  61. data/app/assets/javascripts/plugins/line_breaker.min.js +3 -3
  62. data/app/assets/javascripts/plugins/line_height.min.js +7 -0
  63. data/app/assets/javascripts/plugins/link.min.js +3 -3
  64. data/app/assets/javascripts/plugins/lists.min.js +3 -3
  65. data/app/assets/javascripts/plugins/paragraph_format.min.js +3 -3
  66. data/app/assets/javascripts/plugins/paragraph_style.min.js +3 -3
  67. data/app/assets/javascripts/plugins/print.min.js +3 -3
  68. data/app/assets/javascripts/plugins/quick_insert.min.js +3 -3
  69. data/app/assets/javascripts/plugins/quote.min.js +3 -3
  70. data/app/assets/javascripts/plugins/save.min.js +3 -3
  71. data/app/assets/javascripts/plugins/special_characters.min.js +3 -3
  72. data/app/assets/javascripts/plugins/table.min.js +3 -4
  73. data/app/assets/javascripts/plugins/url.min.js +3 -3
  74. data/app/assets/javascripts/plugins/video.min.js +3 -4
  75. data/app/assets/javascripts/plugins/word_paste.min.js +3 -3
  76. data/app/assets/javascripts/third_party/embedly.min.js +7 -0
  77. data/app/assets/javascripts/third_party/font_awesome.min.js +7 -0
  78. data/app/assets/javascripts/third_party/image_aviary.min.js +7 -0
  79. data/app/assets/javascripts/third_party/image_tui.min.js +7 -0
  80. data/app/assets/javascripts/third_party/spell_checker.min.js +7 -0
  81. data/app/assets/stylesheets/froala_editor.css +159 -31
  82. data/app/assets/stylesheets/froala_editor.min.css +3 -3
  83. data/app/assets/stylesheets/froala_editor.pkgd.css +274 -82
  84. data/app/assets/stylesheets/froala_editor.pkgd.min.css +3 -3
  85. data/app/assets/stylesheets/froala_style.css +174 -26
  86. data/app/assets/stylesheets/froala_style.min.css +3 -3
  87. data/app/assets/stylesheets/plugins/char_counter.css +2 -2
  88. data/app/assets/stylesheets/plugins/char_counter.min.css +2 -2
  89. data/app/assets/stylesheets/plugins/code_view.css +2 -2
  90. data/app/assets/stylesheets/plugins/code_view.min.css +2 -2
  91. data/app/assets/stylesheets/plugins/colors.css +34 -3
  92. data/app/assets/stylesheets/plugins/colors.min.css +3 -3
  93. data/app/assets/stylesheets/plugins/draggable.css +3 -3
  94. data/app/assets/stylesheets/plugins/draggable.min.css +3 -3
  95. data/app/assets/stylesheets/plugins/emoticons.css +2 -2
  96. data/app/assets/stylesheets/plugins/emoticons.min.css +2 -2
  97. data/app/assets/stylesheets/plugins/file.css +16 -16
  98. data/app/assets/stylesheets/plugins/file.min.css +3 -3
  99. data/app/assets/stylesheets/plugins/fullscreen.css +3 -3
  100. data/app/assets/stylesheets/plugins/fullscreen.min.css +3 -3
  101. data/app/assets/stylesheets/plugins/help.css +2 -2
  102. data/app/assets/stylesheets/plugins/help.min.css +2 -2
  103. data/app/assets/stylesheets/plugins/image.css +17 -16
  104. data/app/assets/stylesheets/plugins/image.min.css +3 -3
  105. data/app/assets/stylesheets/plugins/image_manager.css +4 -2
  106. data/app/assets/stylesheets/plugins/image_manager.min.css +3 -3
  107. data/app/assets/stylesheets/plugins/line_breaker.css +2 -2
  108. data/app/assets/stylesheets/plugins/line_breaker.min.css +2 -2
  109. data/app/assets/stylesheets/plugins/quick_insert.css +4 -4
  110. data/app/assets/stylesheets/plugins/quick_insert.min.css +3 -3
  111. data/app/assets/stylesheets/plugins/special_characters.css +2 -2
  112. data/app/assets/stylesheets/plugins/special_characters.min.css +2 -2
  113. data/app/assets/stylesheets/plugins/table.css +34 -4
  114. data/app/assets/stylesheets/plugins/table.min.css +3 -3
  115. data/app/assets/stylesheets/plugins/video.css +18 -18
  116. data/app/assets/stylesheets/plugins/video.min.css +3 -3
  117. data/app/assets/stylesheets/themes/dark.css +199 -45
  118. data/app/assets/stylesheets/themes/dark.min.css +3 -3
  119. data/app/assets/stylesheets/themes/gray.css +197 -43
  120. data/app/assets/stylesheets/themes/gray.min.css +3 -3
  121. data/app/assets/stylesheets/themes/red.css +198 -44
  122. data/app/assets/stylesheets/themes/red.min.css +3 -3
  123. data/app/assets/stylesheets/themes/royal.css +210 -56
  124. data/app/assets/stylesheets/themes/royal.min.css +3 -3
  125. data/app/assets/stylesheets/third_party/embedly.css +64 -0
  126. data/app/assets/stylesheets/third_party/embedly.min.css +7 -0
  127. data/app/assets/stylesheets/third_party/font_awesome.css +50 -0
  128. data/app/assets/stylesheets/third_party/font_awesome.min.css +7 -0
  129. data/app/assets/stylesheets/third_party/image_tui.css +42 -0
  130. data/app/assets/stylesheets/third_party/image_tui.min.css +7 -0
  131. data/app/assets/stylesheets/third_party/spell_checker.css +72 -0
  132. data/app/assets/stylesheets/{plugins → third_party}/spell_checker.min.css +2 -2
  133. data/lib/wysiwyg-rails/engine.rb +0 -2
  134. data/lib/wysiwyg-rails/version.rb +1 -1
  135. metadata +20 -26
  136. data/app/assets/javascripts/plugins/image_aviary.min.js +0 -7
  137. data/app/assets/javascripts/plugins/spell_checker.min.js +0 -7
@@ -1,8 +1,7 @@
1
1
  /*!
2
- * froala_editor v2.6.0 (https://www.froala.com/wysiwyg-editor)
2
+ * froala_editor v2.9.0 (https://www.froala.com/wysiwyg-editor)
3
3
  * License https://froala.com/wysiwyg-editor/terms/
4
- * Copyright 2014-2017 Froala Labs
4
+ * Copyright 2014-2018 Froala Labs
5
5
  */
6
6
 
7
- !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c)}:a(window.jQuery)}(function(a){a.extend(a.FE.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_]"}),a.extend(a.FE.DEFAULTS,{tableInsertMaxSize:10,tableEditButtons:["tableHeader","tableRemove","|","tableRows","tableColumns","tableStyle","-","tableCells","tableCellBackground","tableCellVerticalAlign","tableCellHorizontalAlign","tableCellStyle"],tableInsertButtons:["tableBack","|"],tableResizer:!0,tableResizerOffset:5,tableResizingLimit:30,tableColorsButtons:["tableBack","|"],tableColors:["#61BD6D","#1ABC9C","#54ACD2","#2C82C9","#9365B8","#475577","#CCCCCC","#41A85F","#00A885","#3D8EB9","#2969B0","#553982","#28324E","#000000","#F7DA64","#FBA026","#EB6B56","#E25041","#A38F84","#EFEFEF","#FFFFFF","#FAC51C","#F37934","#D14841","#B8312F","#7C706B","#D1D5D8","REMOVE"],tableColorsStep:7,tableCellStyles:{"fr-highlighted":"Highlighted","fr-thick":"Thick"},tableStyles:{"fr-dashed-borders":"Dashed Borders","fr-alternate-rows":"Alternate Rows"},tableCellMultipleStyles:!0,tableMultipleStyles:!0,tableInsertHelper:!0,tableInsertHelperOffset:15}),a.FE.PLUGINS.table=function(b){function c(){var a=b.$tb.find('.fr-command[data-cmd="insertTable"]'),c=b.popups.get("table.insert");if(c||(c=g()),!c.hasClass("fr-active")){b.popups.refresh("table.insert"),b.popups.setContainer("table.insert",b.$tb);var d=a.offset().left+a.outerWidth()/2,e=a.offset().top+(b.opts.toolbarBottom?10:a.outerHeight()-10);b.popups.show("table.insert",d,e,a.outerHeight())}}function d(){var a=I();if(a){var c=b.popups.get("table.edit");c||(c=k()),b.popups.setContainer("table.edit",b.$sc);var d=Q(a),e=(d.left+d.right)/2,f=d.bottom;b.popups.show("table.edit",e,f,d.bottom-d.top),b.edit.isDisabled()&&(b.toolbar.disable(),b.$el.removeClass("fr-no-selection"),b.edit.on(),b.button.bulkRefresh(),b.selection.setAtEnd(b.$el.find(".fr-selected-cell:last").get(0)),b.selection.restore())}}function e(){var a=I();if(a){var c=b.popups.get("table.colors");c||(c=l()),b.popups.setContainer("table.colors",b.$sc);var d=Q(a),e=(d.left+d.right)/2,f=d.bottom;o(),b.popups.show("table.colors",e,f,d.bottom-d.top)}}function f(){0===sa().length&&b.toolbar.enable()}function g(c){if(c)return b.popups.onHide("table.insert",function(){b.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseenter")}),!0;var d="";b.opts.tableInsertButtons.length>0&&(d='<div class="fr-buttons">'+b.button.buildList(b.opts.tableInsertButtons)+"</div>");var e={buttons:d,rows_columns:i()},f=b.popups.create("table.insert",e);return b.events.$on(f,"mouseenter",".fr-table-size .fr-select-table-size .fr-table-cell",function(b){h(a(b.currentTarget))},!0),j(f),f}function h(a){var c=a.data("row"),d=a.data("col"),e=a.parent();e.siblings(".fr-table-size-info").html(c+" &times; "+d),e.find("> span").removeClass("hover fr-active-item");for(var f=1;f<=b.opts.tableInsertMaxSize;f++)for(var g=0;g<=b.opts.tableInsertMaxSize;g++){var h=e.find('> span[data-row="'+f+'"][data-col="'+g+'"]');f<=c&&g<=d?h.addClass("hover"):f<=c+1||f<=2&&!b.helpers.isMobile()?h.css("display","inline-block"):f>2&&!b.helpers.isMobile()&&h.css("display","none")}a.addClass("fr-active-item")}function i(){for(var a='<div class="fr-table-size"><div class="fr-table-size-info">1 &times; 1</div><div class="fr-select-table-size">',c=1;c<=b.opts.tableInsertMaxSize;c++){for(var d=1;d<=b.opts.tableInsertMaxSize;d++){var e="inline-block";c>2&&!b.helpers.isMobile()&&(e="none");var f="fr-table-cell ";1==c&&1==d&&(f+=" hover"),a+='<span class="fr-command '+f+'" tabIndex="-1" data-cmd="tableInsert" data-row="'+c+'" data-col="'+d+'" data-param1="'+c+'" data-param2="'+d+'" style="display: '+e+';" role="button"><span></span><span class="fr-sr-only">'+c+" &times; "+d+"&nbsp;&nbsp;&nbsp;</span></span>"}a+='<div class="new-line"></div>'}return a+="</div></div>"}function j(c){b.events.$on(c,"focus","[tabIndex]",function(b){var c=a(b.currentTarget);h(c)}),b.events.on("popup.tab",function(c){var d=a(c.currentTarget);if(!b.popups.isVisible("table.insert")||!d.is("span, a"))return!0;var e,f=c.which;if(a.FE.KEYCODE.ARROW_UP==f||a.FE.KEYCODE.ARROW_DOWN==f||a.FE.KEYCODE.ARROW_LEFT==f||a.FE.KEYCODE.ARROW_RIGHT==f){if(d.is("span.fr-table-cell")){var g=d.parent().find("span.fr-table-cell"),i=g.index(d),j=b.opts.tableInsertMaxSize,k=i%j,l=Math.floor(i/j);a.FE.KEYCODE.ARROW_UP==f?l=Math.max(0,l-1):a.FE.KEYCODE.ARROW_DOWN==f?l=Math.min(b.opts.tableInsertMaxSize-1,l+1):a.FE.KEYCODE.ARROW_LEFT==f?k=Math.max(0,k-1):a.FE.KEYCODE.ARROW_RIGHT==f&&(k=Math.min(b.opts.tableInsertMaxSize-1,k+1));var m=l*j+k,n=a(g.get(m));h(n),b.events.disableBlur(),n.focus(),e=!1}}else a.FE.KEYCODE.ENTER==f&&(b.button.exec(d),e=!1);return e===!1&&(c.preventDefault(),c.stopPropagation()),e},!0)}function k(a){if(a)return b.popups.onHide("table.edit",f),!0;var c="";b.opts.tableEditButtons.length>0&&(c='<div class="fr-buttons">'+b.button.buildList(b.opts.tableEditButtons)+"</div>");var e={buttons:c},g=b.popups.create("table.edit",e);return b.events.$on(b.$wp,"scroll.table-edit",function(){b.popups.isVisible("table.edit")&&d()}),g}function l(){var a="";b.opts.tableColorsButtons.length>0&&(a='<div class="fr-buttons fr-table-colors-buttons">'+b.button.buildList(b.opts.tableColorsButtons)+"</div>");var c={buttons:a,colors:m()},d=b.popups.create("table.colors",c);return b.events.$on(b.$wp,"scroll.table-colors",function(){b.popups.isVisible("table.colors")&&e()}),n(d),d}function m(){for(var a='<div class="fr-table-colors">',c=0;c<b.opts.tableColors.length;c++)0!==c&&c%b.opts.tableColorsStep===0&&(a+="<br>"),a+="REMOVE"!=b.opts.tableColors[c]?'<span class="fr-command" style="background: '+b.opts.tableColors[c]+';" tabIndex="-1" role="button" data-cmd="tableCellBackgroundColor" data-param1="'+b.opts.tableColors[c]+'"><span class="fr-sr-only">'+b.language.translate("Color")+" "+b.opts.tableColors[c]+"&nbsp;&nbsp;&nbsp;</span></span>":'<span class="fr-command" data-cmd="tableCellBackgroundColor" tabIndex="-1" role="button" data-param1="REMOVE" title="'+b.language.translate("Clear Formatting")+'"><i class="fa fa-eraser"></i><span class="fr-sr-only">'+b.language.translate("Clear Formatting")+"</span></span>";return a+="</div>"}function n(c){b.events.on("popup.tab",function(d){var e=a(d.currentTarget);if(!b.popups.isVisible("table.colors")||!e.is("span"))return!0;var f=d.which,g=!0;if(a.FE.KEYCODE.TAB==f){var h=c.find(".fr-buttons");g=!b.accessibility.focusToolbar(h,!!d.shiftKey)}else if(a.FE.KEYCODE.ARROW_UP==f||a.FE.KEYCODE.ARROW_DOWN==f||a.FE.KEYCODE.ARROW_LEFT==f||a.FE.KEYCODE.ARROW_RIGHT==f){var i=e.parent().find("span.fr-command"),j=i.index(e),k=b.opts.colorsStep,l=Math.floor(i.length/k),m=j%k,n=Math.floor(j/k),o=n*k+m,p=l*k;a.FE.KEYCODE.ARROW_UP==f?o=((o-k)%p+p)%p:a.FE.KEYCODE.ARROW_DOWN==f?o=(o+k)%p:a.FE.KEYCODE.ARROW_LEFT==f?o=((o-1)%p+p)%p:a.FE.KEYCODE.ARROW_RIGHT==f&&(o=(o+1)%p);var q=a(i.get(o));b.events.disableBlur(),q.focus(),g=!1}else a.FE.KEYCODE.ENTER==f&&(b.button.exec(e),g=!1);return g===!1&&(d.preventDefault(),d.stopPropagation()),g},!0)}function o(){var a=b.popups.get("table.colors"),c=b.$el.find(".fr-selected-cell:first");a.find(".fr-selected-color").removeClass("fr-selected-color fr-active-item"),a.find('span[data-param1="'+b.helpers.RGBToHex(c.css("background-color"))+'"]').addClass("fr-selected-color fr-active-item")}function p(c,d){var e,f,g='<table style="width: 100%;"><tbody>',h=100/d;for(e=0;e<c;e++){for(g+="<tr>",f=0;f<d;f++)g+='<td style="width: '+h.toFixed(4)+'%;">',0===e&&0===f&&(g+=a.FE.MARKERS),g+="<br></td>";g+="</tr>"}g+="</tbody></table>",b.html.insert(g),b.selection.restore()}function q(){if(sa().length>0){var a=ta();b.selection.setBefore(a.get(0))||b.selection.setAfter(a.get(0)),b.selection.restore(),b.popups.hide("table.edit"),a.remove(),b.toolbar.enable()}}function r(){var b=ta();if(b.length>0&&0===b.find("th").length){var c,e="<thead><tr>",f=0;for(b.find("tr:first > td").each(function(){var b=a(this);f+=parseInt(b.attr("colspan"),10)||1}),c=0;c<f;c++)e+="<th><br></th>";e+="</tr></thead>",b.prepend(e),d()}}function s(){var a=ta(),c=a.find("thead");if(c.length>0)if(0===a.find("tbody tr").length)q();else if(c.remove(),sa().length>0)d();else{b.popups.hide("table.edit");var e=a.find("tbody tr:first td:first").get(0);e&&(b.selection.setAtEnd(e),b.selection.restore())}}function t(c){var e=ta();if(e.length>0){if(b.$el.find("th.fr-selected-cell").length>0&&"above"==c)return;var f,g,h=I(),i=O(h);g="above"==c?i.min_i:i.max_i;var j="<tr>";for(f=0;f<h[g].length;f++)if("below"==c&&g<h.length-1&&h[g][f]==h[g+1][f]||"above"==c&&g>0&&h[g][f]==h[g-1][f]){if(0===f||f>0&&h[g][f]!=h[g][f-1]){var k=a(h[g][f]);k.attr("rowspan",parseInt(k.attr("rowspan"),10)+1)}}else j+="<td><br></td>";j+="</tr>";var l=a(e.find("tr").not(e.find("table tr")).get(g));"below"==c?l.after(j):"above"==c&&(l.before(j),b.popups.isVisible("table.edit")&&d())}}function u(){var c=ta();if(c.length>0){var d,e,f,g=I(),h=O(g);if(0===h.min_i&&h.max_i==g.length-1)q();else{for(d=h.max_i;d>=h.min_i;d--){for(f=a(c.find("tr").not(c.find("table tr")).get(d)),e=0;e<g[d].length;e++)if(0===e||g[d][e]!=g[d][e-1]){var i=a(g[d][e]);if(parseInt(i.attr("rowspan"),10)>1){var j=parseInt(i.attr("rowspan"),10)-1;1==j?i.removeAttr("rowspan"):i.attr("rowspan",j)}if(d<g.length-1&&g[d][e]==g[d+1][e]&&(0===d||g[d][e]!=g[d-1][e])){for(var k=g[d][e],l=e;l>0&&g[d][l]==g[d][l-1];)l--;0===l?a(c.find("tr").not(c.find("table tr")).get(d+1)).prepend(k):a(g[d+1][l-1]).after(k)}}var m=f.parent();f.remove(),0===m.find("tr").length&&m.remove(),g=I(c)}A(0,g.length-1,0,g[0].length-1,c),h.min_i>0?b.selection.setAtEnd(g[h.min_i-1][0]):b.selection.setAtEnd(g[0][0]),b.selection.restore(),b.popups.hide("table.edit")}}}function v(c){var e=ta();if(e.length>0){var f,g=I(),h=O(g);f="before"==c?h.min_j:h.max_j;var i,j=100/g[0].length,k=100/(g[0].length+1);e.find("th, td").each(function(){i=a(this),i.data("old-width",i.outerWidth()/e.outerWidth()*100)}),e.find("tr").not(e.find("table tr")).each(function(b){for(var d,e=a(this),h=0,i=0;h-1<f;){if(d=e.find("> th, > td").get(i),!d){d=null;break}d==g[b][h]?(h+=parseInt(a(d).attr("colspan"),10)||1,i++):(h+=parseInt(a(g[b][h]).attr("colspan"),10)||1,"after"==c&&(d=0===i?-1:e.find("> th, > td").get(i-1)))}var l=a(d);if("after"==c&&h-1>f||"before"==c&&f>0&&g[b][f]==g[b][f-1]){if(0===b||b>0&&g[b][f]!=g[b-1][f]){var m=parseInt(l.attr("colspan"),10)+1;l.attr("colspan",m),l.css("width",(l.data("old-width")*k/j+k).toFixed(4)+"%"),l.removeData("old-width")}}else{var n;n=e.find("th").length>0?'<th style="width: '+k.toFixed(4)+'%;"><br></th>':'<td style="width: '+k.toFixed(4)+'%;"><br></td>',d==-1?e.prepend(n):null==d?e.append(n):"before"==c?l.before(n):"after"==c&&l.after(n)}}),e.find("th, td").each(function(){i=a(this),i.data("old-width")&&(i.css("width",(i.data("old-width")*k/j).toFixed(4)+"%"),i.removeData("old-width"))}),b.popups.isVisible("table.edit")&&d()}}function w(){var c=ta();if(c.length>0){var d,e,f,g=I(),h=O(g);if(0===h.min_j&&h.max_j==g[0].length-1)q();else{var i=100/g[0].length,j=100/(g[0].length-h.max_j+h.min_j-1);for(c.find("th, td").each(function(){f=a(this),f.hasClass("fr-selected-cell")||f.data("old-width",f.outerWidth()/c.outerWidth()*100)}),e=h.max_j;e>=h.min_j;e--)for(d=0;d<g.length;d++)if(0===d||g[d][e]!=g[d-1][e])if(f=a(g[d][e]),(parseInt(f.attr("colspan"),10)||1)>1){var k=parseInt(f.attr("colspan"),10)-1;1==k?f.removeAttr("colspan"):f.attr("colspan",k),f.css("width",((f.data("old-width")-ka(e,g))*j/i).toFixed(4)+"%"),f.removeData("old-width")}else{var l=a(f.parent().get(0));f.remove(),0===l.find("> th, > td").length&&(0===l.prev().length||0===l.next().length||l.prev().find("> th[rowspan], > td[rowspan]").length<l.prev().find("> th, > td").length)&&l.remove()}A(0,g.length-1,0,g[0].length-1,c),h.min_j>0?b.selection.setAtEnd(g[h.min_i][h.min_j-1]):b.selection.setAtEnd(g[h.min_i][0]),b.selection.restore(),b.popups.hide("table.edit"),c.find("th, td").each(function(){f=a(this),f.data("old-width")&&(f.css("width",(f.data("old-width")*j/i).toFixed(4)+"%"),f.removeData("old-width"))})}}}function x(a,b,c){var d,e,f,g,h,i=0,j=I(c);for(b=Math.min(b,j[0].length-1),e=a;e<=b;e++)if(!(e>a&&j[0][e]==j[0][e-1])&&(g=parseInt(j[0][e].getAttribute("colspan"),10)||1,g>1&&j[0][e]==j[0][e+1]))for(i=g-1,d=1;d<j.length;d++)if(j[d][e]!=j[d-1][e]){for(f=e;f<e+g;f++)if(h=parseInt(j[d][f].getAttribute("colspan"),10)||1,h>1&&j[d][f]==j[d][f+1])i=Math.min(i,h-1),f+=i;else if(i=Math.max(0,i-1),!i)break;if(!i)break}i&&z(j,i,"colspan",0,j.length-1,a,b)}function y(a,b,c){var d,e,f,g,h,i=0,j=I(c);for(b=Math.min(b,j.length-1),d=a;d<=b;d++)if(!(d>a&&j[d][0]==j[d-1][0])&&(g=parseInt(j[d][0].getAttribute("rowspan"),10)||1,g>1&&j[d][0]==j[d+1][0]))for(i=g-1,e=1;e<j[0].length;e++)if(j[d][e]!=j[d][e-1]){for(f=d;f<d+g;f++)if(h=parseInt(j[f][e].getAttribute("rowspan"),10)||1,h>1&&j[f][e]==j[f+1][e])i=Math.min(i,h-1),f+=i;else if(i=Math.max(0,i-1),!i)break;if(!i)break}i&&z(j,i,"rowspan",a,b,0,j[0].length-1)}function z(a,b,c,d,e,f,g){var h,i,j;for(h=d;h<=e;h++)for(i=f;i<=g;i++)h>d&&a[h][i]==a[h-1][i]||i>f&&a[h][i]==a[h][i-1]||(j=parseInt(a[h][i].getAttribute(c),10)||1,j>1&&(j-b>1?a[h][i].setAttribute(c,j-b):a[h][i].removeAttribute(c)))}function A(a,b,c,d,e){y(a,b,e),x(c,d,e)}function B(){if(sa().length>1&&(0===b.$el.find("th.fr-selected-cell").length||0===b.$el.find("td.fr-selected-cell").length)){L();var c,e,f=I(),g=O(f),h=b.$el.find(".fr-selected-cell"),i=a(h[0]),j=i.parent(),k=j.find(".fr-selected-cell"),l=i.closest("table"),m=i.html(),n=0;for(c=0;c<k.length;c++)n+=a(k[c]).outerWidth();for(i.css("width",(n/l.outerWidth()*100).toFixed(4)+"%"),g.min_j<g.max_j&&i.attr("colspan",g.max_j-g.min_j+1),g.min_i<g.max_i&&i.attr("rowspan",g.max_i-g.min_i+1),c=1;c<h.length;c++)e=a(h[c]),"<br>"!=e.html()&&""!==e.html()&&(m+="<br>"+e.html()),e.remove();i.html(m),b.selection.setAtEnd(i.get(0)),b.selection.restore(),b.toolbar.enable(),y(g.min_i,g.max_i,l);var o=l.find("tr:empty");for(c=o.length-1;c>=0;c--)a(o[c]).remove();x(g.min_j,g.max_j,l),d()}}function C(){if(1==sa().length){var c=b.$el.find(".fr-selected-cell"),d=c.parent(),e=c.closest("table"),f=parseInt(c.attr("rowspan"),10),g=I(),h=J(c.get(0),g),i=c.clone().html("<br>");if(f>1){var j=Math.ceil(f/2);j>1?c.attr("rowspan",j):c.removeAttr("rowspan"),f-j>1?i.attr("rowspan",f-j):i.removeAttr("rowspan");for(var k=h.row+j,l=0===h.col?h.col:h.col-1;l>=0&&(g[k][l]==g[k][l-1]||k>0&&g[k][l]==g[k-1][l]);)l--;l==-1?a(e.find("tr").not(e.find("table tr")).get(k)).prepend(i):a(g[k][l]).after(i)}else{var m,n=a("<tr>").append(i);for(m=0;m<g[0].length;m++)if(0===m||g[h.row][m]!=g[h.row][m-1]){var o=a(g[h.row][m]);o.is(c)||o.attr("rowspan",(parseInt(o.attr("rowspan"),10)||1)+1)}d.after(n)}M(),b.popups.hide("table.edit")}}function D(){if(1==sa().length){var c=b.$el.find(".fr-selected-cell"),d=parseInt(c.attr("colspan"),10)||1,e=c.parent().outerWidth(),f=c.outerWidth(),g=c.clone().html("<br>"),h=I(),i=J(c.get(0),h);if(d>1){var j=Math.ceil(d/2);f=la(i.col,i.col+j-1,h)/e*100;var k=la(i.col+j,i.col+d-1,h)/e*100;j>1?c.attr("colspan",j):c.removeAttr("colspan"),d-j>1?g.attr("colspan",d-j):g.removeAttr("colspan"),c.css("width",f.toFixed(4)+"%"),g.css("width",k.toFixed(4)+"%")}else{var l;for(l=0;l<h.length;l++)if(0===l||h[l][i.col]!=h[l-1][i.col]){var m=a(h[l][i.col]);if(!m.is(c)){var n=(parseInt(m.attr("colspan"),10)||1)+1;m.attr("colspan",n)}}f=f/e*100/2,c.css("width",f.toFixed(4)+"%"),g.css("width",f.toFixed(4)+"%")}c.after(g),M(),b.popups.hide("table.edit")}}function E(a){"REMOVE"!=a?b.$el.find(".fr-selected-cell").css("background-color",b.helpers.HEXtoRGB(a)):b.$el.find(".fr-selected-cell").css("background-color","")}function F(a){b.$el.find(".fr-selected-cell").css("vertical-align",a)}function G(a){b.$el.find(".fr-selected-cell").css("text-align",a)}function H(a,b,c,d){if(b.length>0){if(!c){var e=Object.keys(d);e.splice(e.indexOf(a),1),b.removeClass(e.join(" "))}b.toggleClass(a)}}function I(b){b=b||null;var c=[];if(null==b&&sa().length>0&&(b=ta()),b)return b.find("tr").not(b.find("table tr")).each(function(b,d){var e=a(d),f=0;e.find("> th, > td").each(function(d,e){for(var g=a(e),h=parseInt(g.attr("colspan"),10)||1,i=parseInt(g.attr("rowspan"),10)||1,j=b;j<b+i;j++)for(var k=f;k<f+h;k++)c[j]||(c[j]=[]),c[j][k]?f++:c[j][k]=e;f+=h})}),c}function J(a,b){for(var c=0;c<b.length;c++)for(var d=0;d<b[c].length;d++)if(b[c][d]==a)return{row:c,col:d}}function K(a,b,c){for(var d=a+1,e=b+1;d<c.length;){if(c[d][b]!=c[a][b]){d--;break}d++}for(d==c.length&&d--;e<c[a].length;){if(c[a][e]!=c[a][b]){e--;break}e++}return e==c[a].length&&e--,{row:d,col:e}}function L(){b.el.querySelector(".fr-cell-fixed")&&b.el.querySelector(".fr-cell-fixed").classList.remove("fr-cell-fixed"),b.el.querySelector(".fr-cell-handler")&&b.el.querySelector(".fr-cell-handler").classList.remove("fr-cell-handler")}function M(){var c=b.$el.find(".fr-selected-cell");c.length>0&&c.each(function(){var b=a(this);b.removeClass("fr-selected-cell"),""===b.attr("class")&&b.removeAttr("class")}),L()}function N(){setTimeout(function(){b.selection.clear(),b.$el.addClass("fr-no-selection"),b.$el.blur()},0)}function O(a){var c=b.$el.find(".fr-selected-cell");if(c.length>0){var d,e=a.length,f=0,g=a[0].length,h=0;for(d=0;d<c.length;d++){var i=J(c[d],a),j=K(i.row,i.col,a);e=Math.min(i.row,e),f=Math.max(j.row,f),g=Math.min(i.col,g),h=Math.max(j.col,h)}return{min_i:e,max_i:f,min_j:g,max_j:h}}return null}function P(b,c,d,e,f){var g,h,i,j,k=b,l=c,m=d,n=e;for(g=k;g<=l;g++)((parseInt(a(f[g][m]).attr("rowspan"),10)||1)>1||(parseInt(a(f[g][m]).attr("colspan"),10)||1)>1)&&(i=J(f[g][m],f),j=K(i.row,i.col,f),k=Math.min(i.row,k),l=Math.max(j.row,l),m=Math.min(i.col,m),n=Math.max(j.col,n)),((parseInt(a(f[g][n]).attr("rowspan"),10)||1)>1||(parseInt(a(f[g][n]).attr("colspan"),10)||1)>1)&&(i=J(f[g][n],f),j=K(i.row,i.col,f),k=Math.min(i.row,k),l=Math.max(j.row,l),m=Math.min(i.col,m),n=Math.max(j.col,n));for(h=m;h<=n;h++)((parseInt(a(f[k][h]).attr("rowspan"),10)||1)>1||(parseInt(a(f[k][h]).attr("colspan"),10)||1)>1)&&(i=J(f[k][h],f),j=K(i.row,i.col,f),k=Math.min(i.row,k),l=Math.max(j.row,l),m=Math.min(i.col,m),n=Math.max(j.col,n)),((parseInt(a(f[l][h]).attr("rowspan"),10)||1)>1||(parseInt(a(f[l][h]).attr("colspan"),10)||1)>1)&&(i=J(f[l][h],f),j=K(i.row,i.col,f),k=Math.min(i.row,k),l=Math.max(j.row,l),m=Math.min(i.col,m),n=Math.max(j.col,n));return k==b&&l==c&&m==d&&n==e?{min_i:b,max_i:c,min_j:d,max_j:e}:P(k,l,m,n,f)}function Q(b){var c=O(b),d=a(b[c.min_i][c.min_j]),e=a(b[c.min_i][c.max_j]),f=a(b[c.max_i][c.min_j]),g=d.offset().left,h=e.offset().left+e.outerWidth(),i=d.offset().top,j=f.offset().top+f.outerHeight();return{left:g,right:h,top:i,bottom:j}}function R(c,d){if(a(c).is(d))M(),b.edit.on(),a(c).addClass("fr-selected-cell");else{N(),b.edit.off();var e=I(),f=J(c,e),g=J(d,e),h=P(Math.min(f.row,g.row),Math.max(f.row,g.row),Math.min(f.col,g.col),Math.max(f.col,g.col),e);M(),c.classList.add("fr-cell-fixed"),d.classList.add("fr-cell-handler");for(var i=h.min_i;i<=h.max_i;i++)for(var j=h.min_j;j<=h.max_j;j++)a(e[i][j]).addClass("fr-selected-cell")}}function S(c){var d=null,e=a(c.target);return"TD"==c.target.tagName||"TH"==c.target.tagName?d=c.target:e.closest("td").length>0?d=e.closest("td").get(0):e.closest("th").length>0&&(d=e.closest("th").get(0)),0===b.$el.find(d).length?null:d}function T(){M(),b.popups.hide("table.edit")}function U(c){var d=S(c);if(sa().length>0&&!d&&T(),!b.edit.isDisabled()||b.popups.isVisible("table.edit"))if(1!=c.which||1==c.which&&b.helpers.isMac()&&c.ctrlKey)(3==c.which||1==c.which&&b.helpers.isMac()&&c.ctrlKey)&&d&&T();else if(Aa=!0,d){sa().length>0&&!c.shiftKey&&T(),c.stopPropagation(),b.events.trigger("image.hideResizer"),b.events.trigger("video.hideResizer"),za=!0;var e=d.tagName.toLowerCase();c.shiftKey&&b.$el.find(e+".fr-selected-cell").length>0?a(b.$el.find(e+".fr-selected-cell").closest("table")).is(a(d).closest("table"))?R(Ba,d):N():((b.keys.ctrlKey(c)||c.shiftKey)&&(sa().length>1||0===a(d).find(b.selection.element()).length&&!a(d).is(b.selection.element()))&&N(),Ba=d,R(Ba,Ba))}}function V(c){if(za||b.$tb.is(c.target)||b.$tb.is(a(c.target).closest(b.$tb.get(0)))||(sa().length>0&&b.toolbar.enable(),M()),!(1!=c.which||1==c.which&&b.helpers.isMac()&&c.ctrlKey)){if(Aa=!1,za){za=!1;var e=S(c);e||1!=sa().length?sa().length>0&&(b.selection.isCollapsed()?d():M()):M()}if(Da){Da=!1,xa.removeClass("fr-moving"),b.$el.removeClass("fr-no-selection"),b.edit.on();var f=parseFloat(xa.css("left"))+b.opts.tableResizerOffset;b.opts.iframe&&(f-=b.$iframe.offset().left),xa.data("release-position",f),xa.removeData("max-left"),xa.removeData("max-right"),ja(c),ba()}}}function W(c){if(za===!0){var d=a(c.currentTarget);if(d.closest("table").is(ta())){if("TD"==c.currentTarget.tagName&&0===b.$el.find("th.fr-selected-cell").length)return void R(Ba,c.currentTarget);if("TH"==c.currentTarget.tagName&&0===b.$el.find("td.fr-selected-cell").length)return void R(Ba,c.currentTarget)}N()}}function X(c,d){for(var e=c;e&&"TABLE"!=e.tagName&&e.parentNode!=b.el;)e=e.parentNode;if(e&&"TABLE"==e.tagName){var f=I(a(e));"up"==d?Z(J(c,f),e,f):"down"==d&&$(J(c,f),e,f)}}function Y(a,c,d,e){for(var f,g=c;g!=b.el&&"TD"!=g.tagName&&"TH"!=g.tagName&&("up"==e?f=g.previousElementSibling:"down"==e&&(f=g.nextElementSibling),!f);)g=g.parentNode;"TD"==g.tagName||"TH"==g.tagName?X(g,e):f&&("up"==e&&b.selection.setAtEnd(f),"down"==e&&b.selection.setAtStart(f))}function Z(a,c,d){a.row>0?b.selection.setAtEnd(d[a.row-1][a.col]):Y(a,c,d,"up")}function $(a,c,d){var e=parseInt(d[a.row][a.col].getAttribute("rowspan"),10)||1;a.row<d.length-e?b.selection.setAtStart(d[a.row+e][a.col]):Y(a,c,d,"down")}function _(c){var d=c.which,e=b.selection.blocks();if(e.length&&(e=e[0],"TD"==e.tagName||"TH"==e.tagName)){for(var f=e;f&&"TABLE"!=f.tagName&&f.parentNode!=b.el;)f=f.parentNode;if(f&&"TABLE"==f.tagName&&(a.FE.KEYCODE.ARROW_LEFT==d||a.FE.KEYCODE.ARROW_UP==d||a.FE.KEYCODE.ARROW_RIGHT==d||a.FE.KEYCODE.ARROW_DOWN==d)&&(sa().length>0&&T(),b.browser.webkit&&(a.FE.KEYCODE.ARROW_UP==d||a.FE.KEYCODE.ARROW_DOWN==d))){var g=b.selection.ranges(0).startContainer;if(g.nodeType==Node.TEXT_NODE&&(a.FE.KEYCODE.ARROW_UP==d&&g.previousSibling||a.FE.KEYCODE.ARROW_DOWN==d&&g.nextSibling))return;c.preventDefault(),c.stopPropagation();var h=I(a(f)),i=J(e,h);return a.FE.KEYCODE.ARROW_UP==d?Z(i,f,h):a.FE.KEYCODE.ARROW_DOWN==d&&$(i,f,h),b.selection.restore(),!1}}}function aa(){b.shared.$table_resizer||(b.shared.$table_resizer=a('<div class="fr-table-resizer"><div></div></div>')),xa=b.shared.$table_resizer,b.events.$on(xa,"mousedown",function(a){return!b.core.sameInstance(xa)||(sa().length>0&&T(),1==a.which?(b.selection.save(),Da=!0,xa.addClass("fr-moving"),N(),b.edit.off(),xa.find("div").css("opacity",1),!1):void 0)}),b.events.$on(xa,"mousemove",function(a){return!b.core.sameInstance(xa)||void(Da&&(b.opts.iframe&&(a.pageX-=b.$iframe.offset().left),ma(a)))}),b.events.on("shared.destroy",function(){xa.html("").removeData().remove(),xa=null},!0),b.events.on("destroy",function(){b.$el.find(".fr-selected-cell").removeClass("fr-selected-cell"),xa.hide().appendTo(a("body:first"))},!0)}function ba(){xa&&(xa.find("div").css("opacity",0),xa.css("top",0),xa.css("left",0),xa.css("height",0),xa.find("div").css("height",0),xa.hide())}function ca(){ya&&ya.removeClass("fr-visible").css("left","-9999px")}function da(c,d){var e=a(d),f=e.closest("table"),g=f.parent();if(d&&"TD"!=d.tagName&&"TH"!=d.tagName&&(e.closest("td").length>0?d=e.closest("td"):e.closest("th").length>0&&(d=e.closest("th"))),!d||"TD"!=d.tagName&&"TH"!=d.tagName)xa&&e.get(0)!=xa.get(0)&&e.parent().get(0)!=xa.get(0)&&b.core.sameInstance(xa)&&ba();else{if(e=a(d),0===b.$el.find(e).length)return!1;var h=e.offset().left-1,i=h+e.outerWidth();if(Math.abs(c.pageX-h)<=b.opts.tableResizerOffset||Math.abs(i-c.pageX)<=b.opts.tableResizerOffset){var j,k,l,m,n,o=I(f),p=J(d,o),q=K(p.row,p.col,o),r=f.offset().top,s=f.outerHeight()-1;"rtl"!=b.opts.direction?c.pageX-h<=b.opts.tableResizerOffset?(l=h,p.col>0?(m=h-ka(p.col-1,o)+b.opts.tableResizingLimit,n=h+ka(p.col,o)-b.opts.tableResizingLimit,j=p.col-1,k=p.col):(j=null,k=0,m=f.offset().left-1-parseInt(f.css("margin-left"),10),n=f.offset().left-1+f.width()-o[0].length*b.opts.tableResizingLimit)):i-c.pageX<=b.opts.tableResizerOffset&&(l=i,q.col<o[q.row].length&&o[q.row][q.col+1]?(m=i-ka(q.col,o)+b.opts.tableResizingLimit,n=i+ka(q.col+1,o)-b.opts.tableResizingLimit,j=q.col,k=q.col+1):(j=q.col,k=null,m=f.offset().left-1+o[0].length*b.opts.tableResizingLimit,n=g.offset().left-1+g.width()+parseFloat(g.css("padding-left")))):i-c.pageX<=b.opts.tableResizerOffset?(l=i,p.col>0?(m=i-ka(p.col,o)+b.opts.tableResizingLimit,n=i+ka(p.col-1,o)-b.opts.tableResizingLimit,j=p.col,k=p.col-1):(j=null,k=0,m=f.offset().left+o[0].length*b.opts.tableResizingLimit,n=g.offset().left-1+g.width()+parseFloat(g.css("padding-left")))):c.pageX-h<=b.opts.tableResizerOffset&&(l=h,q.col<o[q.row].length&&o[q.row][q.col+1]?(m=h-ka(q.col+1,o)+b.opts.tableResizingLimit,n=h+ka(q.col,o)-b.opts.tableResizingLimit,j=q.col+1,k=q.col):(j=q.col,k=null,m=g.offset().left+parseFloat(g.css("padding-left")),n=f.offset().left-1+f.width()-o[0].length*b.opts.tableResizingLimit)),xa||aa(),xa.data("table",f),xa.data("first",j),xa.data("second",k),xa.data("instance",b),b.$wp.append(xa);var t=l-b.win.pageXOffset-b.opts.tableResizerOffset,u=r-b.win.pageYOffset;b.opts.iframe&&(t+=b.$iframe.offset().left-b.helpers.scrollLeft(),u+=b.$iframe.offset().top-b.helpers.scrollTop(),m+=b.$iframe.offset().left,n+=b.$iframe.offset().left),xa.data("max-left",m),xa.data("max-right",n),xa.data("origin",l-b.win.pageXOffset),xa.css("top",u),xa.css("left",t),xa.css("height",s),xa.find("div").css("height",s),xa.css("padding-left",b.opts.tableResizerOffset),xa.css("padding-right",b.opts.tableResizerOffset),xa.show()}else b.core.sameInstance(xa)&&ba()}}function ea(c,d){if(b.$box.find(".fr-line-breaker").is(":visible"))return!1;ya||pa(),b.$box.append(ya),ya.data("instance",b);var e=a(d),f=e.find("tr:first"),g=c.pageX,h=0,i=0;b.opts.iframe&&(h+=b.$iframe.offset().left-b.helpers.scrollLeft(),i+=b.$iframe.offset().top-b.helpers.scrollTop());var j;f.find("th, td").each(function(){var c=a(this);return c.offset().left<=g&&g<c.offset().left+c.outerWidth()/2?(j=parseInt(ya.find("a").css("width"),10),ya.css("top",i+c.offset().top-b.win.pageYOffset-j-5),ya.css("left",h+c.offset().left-b.win.pageXOffset-j/2),ya.data("selected-cell",c),ya.data("position","before"),ya.addClass("fr-visible"),!1):c.offset().left+c.outerWidth()/2<=g&&g<c.offset().left+c.outerWidth()?(j=parseInt(ya.find("a").css("width"),10),ya.css("top",i+c.offset().top-b.win.pageYOffset-j-5),ya.css("left",h+c.offset().left+c.outerWidth()-b.win.pageXOffset-j/2),ya.data("selected-cell",c),ya.data("position","after"),ya.addClass("fr-visible"),!1):void 0})}function fa(c,d){if(b.$box.find(".fr-line-breaker").is(":visible"))return!1;ya||pa(),b.$box.append(ya),ya.data("instance",b);var e=a(d),f=c.pageY,g=0,h=0;b.opts.iframe&&(g+=b.$iframe.offset().left-b.helpers.scrollLeft(),h+=b.$iframe.offset().top-b.helpers.scrollTop());var i;e.find("tr").each(function(){var c=a(this);return c.offset().top<=f&&f<c.offset().top+c.outerHeight()/2?(i=parseInt(ya.find("a").css("width"),10),ya.css("top",h+c.offset().top-b.win.pageYOffset-i/2),ya.css("left",g+c.offset().left-b.win.pageXOffset-i-5),ya.data("selected-cell",c.find("td:first")),ya.data("position","above"),ya.addClass("fr-visible"),!1):c.offset().top+c.outerHeight()/2<=f&&f<c.offset().top+c.outerHeight()?(i=parseInt(ya.find("a").css("width"),10),ya.css("top",h+c.offset().top+c.outerHeight()-b.win.pageYOffset-i/2),ya.css("left",g+c.offset().left-b.win.pageXOffset-i-5),ya.data("selected-cell",c.find("td:first")),ya.data("position","below"),ya.addClass("fr-visible"),!1):void 0})}function ga(c,d){if(0===sa().length){var e,f,g;if(d&&("HTML"==d.tagName||"BODY"==d.tagName||b.node.isElement(d)))for(e=1;e<=b.opts.tableInsertHelperOffset;e++){if(f=b.doc.elementFromPoint(c.pageX-b.win.pageXOffset,c.pageY-b.win.pageYOffset+e),a(f).hasClass("fr-tooltip"))return!0;if(f&&("TH"==f.tagName||"TD"==f.tagName||"TABLE"==f.tagName)&&(a(f).parents(".fr-wrapper").length||b.opts.iframe))return ea(c,a(f).closest("table")),!0;if(g=b.doc.elementFromPoint(c.pageX-b.win.pageXOffset+e,c.pageY-b.win.pageYOffset),a(g).hasClass("fr-tooltip"))return!0;if(g&&("TH"==g.tagName||"TD"==g.tagName||"TABLE"==g.tagName)&&(a(g).parents(".fr-wrapper").length||b.opts.iframe))return fa(c,a(g).closest("table")),!0}b.core.sameInstance(ya)&&ca()}}function ha(a){Ca=null;var c=b.doc.elementFromPoint(a.pageX-b.win.pageXOffset,a.pageY-b.win.pageYOffset);b.opts.tableResizer&&(!b.popups.areVisible()||b.popups.areVisible()&&b.popups.isVisible("table.edit"))&&da(a,c),!b.opts.tableInsertHelper||b.popups.areVisible()||b.$tb.hasClass("fr-inline")&&b.$tb.is(":visible")||ga(a,c)}function ia(){if(Da){var a=xa.data("table"),c=a.offset().top-b.win.pageYOffset;b.opts.iframe&&(c+=b.$iframe.offset().top-b.helpers.scrollTop()),xa.css("top",c)}}function ja(){var c=xa.data("origin"),d=xa.data("release-position");if(c!==d){var e=xa.data("first"),f=xa.data("second"),g=xa.data("table"),h=g.outerWidth();if(b.undo.canDo()||b.undo.saveStep(),null!==e&&null!==f){var i,j,k,l=I(g),m=[],n=[],o=[],p=[];for(i=0;i<l.length;i++)j=a(l[i][e]),k=a(l[i][f]),m[i]=j.outerWidth(),o[i]=k.outerWidth(),n[i]=m[i]/h*100,p[i]=o[i]/h*100;for(i=0;i<l.length;i++){j=a(l[i][e]),k=a(l[i][f]);var q=(n[i]*(m[i]+d-c)/m[i]).toFixed(4);j.css("width",q+"%"),k.css("width",(n[i]+p[i]-q).toFixed(4)+"%")}}else{var r,s=g.parent(),t=h/s.width()*100,u=(parseInt(g.css("margin-left"),10)||0)/s.width()*100,v=(parseInt(g.css("margin-right"),10)||0)/s.width()*100;"rtl"==b.opts.direction&&0===f||"rtl"!=b.opts.direction&&0!==f?(r=(h+d-c)/h*t,g.css("margin-right","calc(100% - "+Math.round(r).toFixed(4)+"% - "+Math.round(u).toFixed(4)+"%)")):("rtl"==b.opts.direction&&0!==f||"rtl"!=b.opts.direction&&0===f)&&(r=(h-d+c)/h*t,g.css("margin-left","calc(100% - "+Math.round(r).toFixed(4)+"% - "+Math.round(v).toFixed(4)+"%)")),g.css("width",Math.round(r).toFixed(4)+"%")}b.selection.restore(),b.undo.saveStep()}xa.removeData("origin"),xa.removeData("release-position"),xa.removeData("first"),xa.removeData("second"),xa.removeData("table")}function ka(b,c){var d,e=a(c[0][b]).outerWidth();for(d=1;d<c.length;d++)e=Math.min(e,a(c[d][b]).outerWidth());return e}function la(a,b,c){var d,e=0;for(d=a;d<=b;d++)e+=ka(d,c);return e}function ma(a){if(sa().length>1&&Aa&&N(),Aa===!1&&za===!1&&Da===!1)Ca&&clearTimeout(Ca),b.edit.isDisabled()&&!b.popups.isVisible("table.edit")||(Ca=setTimeout(ha,30,a));else if(Da){var c=a.pageX-b.win.pageXOffset;b.opts.iframe&&(c+=b.$iframe.offset().left);var d=xa.data("max-left"),e=xa.data("max-right");c>=d&&c<=e?xa.css("left",c-b.opts.tableResizerOffset):c<d&&parseFloat(xa.css("left"),10)>d-b.opts.tableResizerOffset?xa.css("left",d-b.opts.tableResizerOffset):c>e&&parseFloat(xa.css("left"),10)<e-b.opts.tableResizerOffset&&xa.css("left",e-b.opts.tableResizerOffset)}else Aa&&ca()}function na(c){b.node.isEmpty(c.get(0))?c.prepend(a.FE.MARKERS):c.prepend(a.FE.START_MARKER).append(a.FE.END_MARKER)}function oa(c){var d=c.which;if(d==a.FE.KEYCODE.TAB){var e;if(sa().length>0)e=b.$el.find(".fr-selected-cell:last");else{var f=b.selection.element();"TD"==f.tagName||"TH"==f.tagName?e=a(f):a(f).parentsUntil(b.$el,"td").length>0?e=a(f).parents("td:first"):a(f).parentsUntil(b.$el,"th").length>0&&(e=a(f).parents("th:first"))}if(e)return c.preventDefault(),T(),c.shiftKey?e.prev().length>0?na(e.prev()):e.closest("tr").length>0&&e.closest("tr").prev().length>0?na(e.closest("tr").prev().find("td:last")):e.closest("tbody").length>0&&e.closest("table").find("thead tr").length>0&&na(e.closest("table").find("thead tr th:last")):e.next().length>0?na(e.next()):e.closest("tr").length>0&&e.closest("tr").next().length>0?na(e.closest("tr").next().find("td:first")):e.closest("thead").length>0&&e.closest("table").find("tbody tr").length>0?na(e.closest("table").find("tbody tr td:first")):(e.addClass("fr-selected-cell"),
8
- t("below"),M(),na(e.closest("tr").next().find("td:first"))),b.selection.restore(),!1}}function pa(){b.shared.$ti_helper||(b.shared.$ti_helper=a('<div class="fr-insert-helper"><a class="fr-floating-btn" role="button" tabIndex="-1" title="'+b.language.translate("Insert")+'"><svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22,16.75 L16.75,16.75 L16.75,22 L15.25,22.000 L15.25,16.75 L10,16.75 L10,15.25 L15.25,15.25 L15.25,10 L16.75,10 L16.75,15.25 L22,15.25 L22,16.75 Z"/></svg></a></div>'),b.events.bindClick(b.shared.$ti_helper,"a",function(){var a=ya.data("selected-cell"),c=ya.data("position"),d=ya.data("instance")||b;"before"==c?(a.addClass("fr-selected-cell"),d.table.insertColumn(c),a.removeClass("fr-selected-cell")):"after"==c?(a.addClass("fr-selected-cell"),d.table.insertColumn(c),a.removeClass("fr-selected-cell")):"above"==c?(a.addClass("fr-selected-cell"),d.table.insertRow(c),a.removeClass("fr-selected-cell")):"below"==c&&(a.addClass("fr-selected-cell"),d.table.insertRow(c),a.removeClass("fr-selected-cell")),ca()}),b.events.on("shared.destroy",function(){b.shared.$ti_helper.html("").removeData().remove(),b.shared.$ti_helper=null},!0),b.events.$on(b.shared.$ti_helper,"mousemove",function(a){a.stopPropagation()},!0),b.events.$on(a(b.o_win),"scroll",function(){ca()},!0),b.events.$on(b.$wp,"scroll",function(){ca()},!0)),ya=b.shared.$ti_helper,b.events.on("destroy",function(){ya=null}),b.tooltip.bind(b.$box,".fr-insert-helper > a.fr-floating-btn")}function qa(){Ba=null,clearTimeout(Ca)}function ra(){sa().length>0?d():(b.popups.hide("table.insert"),b.toolbar.showInline())}function sa(){return b.el.querySelectorAll(".fr-selected-cell")}function ta(){var c=sa();if(c.length){for(var d=c[0];d&&"TABLE"!=d.tagName&&d.parentNode!=b.el;)d=d.parentNode;return a(d&&"TABLE"==d.tagName?d:[])}return a([])}function ua(c){if(c.altKey&&c.which==a.FE.KEYCODE.SPACE){var e,f=b.selection.element();if("TD"==f.tagName||"TH"==f.tagName?e=f:a(f).closest("td").length>0?e=a(f).closest("td").get(0):a(f).closest("th").length>0&&(e=a(f).closest("th").get(0)),e)return c.preventDefault(),R(e,e),d(),!1}}function va(c){var d=sa();if(d.length>0){var e,f,g=I(),h=c.which;1==d.length?(e=d[0],f=e):(e=b.el.querySelector(".fr-cell-fixed"),f=b.el.querySelector(".fr-cell-handler"));var i=J(f,g);if(a.FE.KEYCODE.ARROW_RIGHT==h){if(i.col<g[0].length-1)return R(e,g[i.row][i.col+1]),!1}else if(a.FE.KEYCODE.ARROW_DOWN==h){if(i.row<g.length-1)return R(e,g[i.row+1][i.col]),!1}else if(a.FE.KEYCODE.ARROW_LEFT==h){if(i.col>0)return R(e,g[i.row][i.col-1]),!1}else if(a.FE.KEYCODE.ARROW_UP==h&&i.row>0)return R(e,g[i.row-1][i.col]),!1}}function wa(){if(!b.$wp)return!1;if(!b.helpers.isMobile()){Aa=!1,za=!1,Da=!1,b.events.$on(b.$el,"mousedown",U),b.popups.onShow("image.edit",function(){M(),Aa=!1,za=!1}),b.popups.onShow("link.edit",function(){M(),Aa=!1,za=!1}),b.events.on("commands.mousedown",function(a){a.parents(".fr-toolbar").length>0&&M()}),b.events.$on(b.$el,"mouseenter","th, td",W),b.events.$on(b.$win,"mouseup",V),b.opts.iframe&&b.events.$on(a(b.o_win),"mouseup",V),b.events.$on(b.$win,"mousemove",ma),b.events.$on(a(b.o_win),"scroll",ia),b.events.on("contentChanged",function(){sa().length>0&&(d(),b.$el.find("img").on("load.selected-cells",function(){a(this).off("load.selected-cells"),sa().length>0&&d()}))}),b.events.$on(a(b.o_win),"resize",function(){M()}),b.events.on("toolbar.esc",function(){if(sa().length>0)return b.events.disableBlur(),b.events.focus(),!1},!0),b.events.$on(b.$el,"keydown",function(a){a.shiftKey?va(a)===!1&&setTimeout(function(){d()},0):_(a)}),b.events.on("keydown",function(c){if(oa(c)===!1)return!1;var d=sa();if(d.length>0){if(d.length>0&&b.keys.ctrlKey(c)&&c.which==a.FE.KEYCODE.A)return M(),b.popups.isVisible("table.edit")&&b.popups.hide("table.edit"),d=[],!0;if(c.which==a.FE.KEYCODE.ESC&&b.popups.isVisible("table.edit"))return M(),b.popups.hide("table.edit"),c.preventDefault(),c.stopPropagation(),c.stopImmediatePropagation(),d=[],!1;if(d.length>1&&c.which==a.FE.KEYCODE.BACKSPACE){b.undo.saveStep();for(var e=0;e<d.length;e++)a(d[e]).html("<br>"),e==d.length-1&&a(d[e]).prepend(a.FE.MARKERS);return b.selection.restore(),b.undo.saveStep(),d=[],!1}if(d.length>1&&c.which!=a.FE.KEYCODE.F10&&!b.keys.isBrowserAction(c))return c.preventDefault(),d=[],!1}else if(d=[],ua(c)===!1)return!1},!0);var c=[];b.events.on("html.beforeGet",function(){c=sa();for(var a=0;a<c.length;a++)c[a].className=(c[a].className||"").replace(/fr-selected-cell/g,"")}),b.events.on("html.afterGet",function(){for(var a=0;a<c.length;a++)c[a].className=(c[a].className?c[a].className.trim()+" ":"")+"fr-selected-cell";c=[]}),g(!0),k(!0)}b.events.on("destroy",qa)}var xa,ya,za,Aa,Ba,Ca,Da;return{_init:wa,insert:p,remove:q,insertRow:t,deleteRow:u,insertColumn:v,deleteColumn:w,mergeCells:B,splitCellVertically:D,splitCellHorizontally:C,addHeader:r,removeHeader:s,setBackground:E,showInsertPopup:c,showEditPopup:d,showColorsPopup:e,back:ra,verticalAlign:F,horizontalAlign:G,applyStyle:H,selectedTable:ta,selectedCells:sa}},a.FE.DefineIcon("insertTable",{NAME:"table"}),a.FE.RegisterCommand("insertTable",{title:"Insert Table",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("table.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("table.insert")):this.table.showInsertPopup()},plugin:"table"}),a.FE.RegisterCommand("tableInsert",{callback:function(a,b,c){this.table.insert(b,c),this.popups.hide("table.insert")}}),a.FE.DefineIcon("tableHeader",{NAME:"header"}),a.FE.RegisterCommand("tableHeader",{title:"Table Header",focus:!1,toggle:!0,callback:function(){var a=this.popups.get("table.edit").find('.fr-command[data-cmd="tableHeader"]');a.hasClass("fr-active")?this.table.removeHeader():this.table.addHeader()},refresh:function(a){var b=this.table.selectedTable();b.length>0&&(0===b.find("th").length?a.removeClass("fr-active").attr("aria-pressed",!1):a.addClass("fr-active").attr("aria-pressed",!0))}}),a.FE.DefineIcon("tableRows",{NAME:"bars"}),a.FE.RegisterCommand("tableRows",{type:"dropdown",focus:!1,title:"Row",options:{above:"Insert row above",below:"Insert row below",delete:"Delete row"},html:function(){var b='<ul class="fr-dropdown-list" role="presentation">',c=a.FE.COMMANDS.tableRows.options;for(var d in c)c.hasOwnProperty(d)&&(b+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableRows" data-param1="'+d+'" title="'+this.language.translate(c[d])+'">'+this.language.translate(c[d])+"</a></li>");return b+="</ul>"},callback:function(a,b){"above"==b||"below"==b?this.table.insertRow(b):this.table.deleteRow()}}),a.FE.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90"}),a.FE.RegisterCommand("tableColumns",{type:"dropdown",focus:!1,title:"Column",options:{before:"Insert column before",after:"Insert column after",delete:"Delete column"},html:function(){var b='<ul class="fr-dropdown-list" role="presentation">',c=a.FE.COMMANDS.tableColumns.options;for(var d in c)c.hasOwnProperty(d)&&(b+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableColumns" data-param1="'+d+'" title="'+this.language.translate(c[d])+'">'+this.language.translate(c[d])+"</a></li>");return b+="</ul>"},callback:function(a,b){"before"==b||"after"==b?this.table.insertColumn(b):this.table.deleteColumn()}}),a.FE.DefineIcon("tableCells",{NAME:"square-o"}),a.FE.RegisterCommand("tableCells",{type:"dropdown",focus:!1,title:"Cell",options:{merge:"Merge cells","vertical-split":"Vertical split","horizontal-split":"Horizontal split"},html:function(){var b='<ul class="fr-dropdown-list" role="presentation">',c=a.FE.COMMANDS.tableCells.options;for(var d in c)c.hasOwnProperty(d)&&(b+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCells" data-param1="'+d+'" title="'+this.language.translate(c[d])+'">'+this.language.translate(c[d])+"</a></li>");return b+="</ul>"},callback:function(a,b){"merge"==b?this.table.mergeCells():"vertical-split"==b?this.table.splitCellVertically():this.table.splitCellHorizontally()},refreshOnShow:function(a,b){this.$el.find(".fr-selected-cell").length>1?(b.find('a[data-param1="vertical-split"]').addClass("fr-disabled").attr("aria-disabled",!0),b.find('a[data-param1="horizontal-split"]').addClass("fr-disabled").attr("aria-disabled",!0),b.find('a[data-param1="merge"]').removeClass("fr-disabled").attr("aria-disabled",!1)):(b.find('a[data-param1="merge"]').addClass("fr-disabled").attr("aria-disabled",!0),b.find('a[data-param1="vertical-split"]').removeClass("fr-disabled").attr("aria-disabled",!1),b.find('a[data-param1="horizontal-split"]').removeClass("fr-disabled").attr("aria-disabled",!1))}}),a.FE.DefineIcon("tableRemove",{NAME:"trash"}),a.FE.RegisterCommand("tableRemove",{title:"Remove Table",focus:!1,callback:function(){this.table.remove()}}),a.FE.DefineIcon("tableStyle",{NAME:"paint-brush"}),a.FE.RegisterCommand("tableStyle",{title:"Table Style",type:"dropdown",focus:!1,html:function(){var a='<ul class="fr-dropdown-list" role="presentation">',b=this.opts.tableStyles;for(var c in b)b.hasOwnProperty(c)&&(a+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableStyle" data-param1="'+c+'" title="'+this.language.translate(b[c])+'">'+this.language.translate(b[c])+"</a></li>");return a+="</ul>"},callback:function(a,b){this.table.applyStyle(b,this.$el.find(".fr-selected-cell").closest("table"),this.opts.tableMultipleStyles,this.opts.tableStyles)},refreshOnShow:function(b,c){var d=this.$el.find(".fr-selected-cell").closest("table");d&&c.find(".fr-command").each(function(){var b=a(this).data("param1"),c=d.hasClass(b);a(this).toggleClass("fr-active",c).attr("aria-selected",c)})}}),a.FE.DefineIcon("tableCellBackground",{NAME:"tint"}),a.FE.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),a.FE.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(a,b){this.table.setBackground(b)}}),a.FE.DefineIcon("tableBack",{NAME:"arrow-left"}),a.FE.RegisterCommand("tableBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.table.back()},refresh:function(a){0!==this.table.selectedCells().length||this.opts.toolbarInline?(a.removeClass("fr-hidden"),a.next(".fr-separator").removeClass("fr-hidden")):(a.addClass("fr-hidden"),a.next(".fr-separator").addClass("fr-hidden"))}}),a.FE.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v"}),a.FE.RegisterCommand("tableCellVerticalAlign",{type:"dropdown",focus:!1,title:"Vertical Align",options:{Top:"Align Top",Middle:"Align Middle",Bottom:"Align Bottom"},html:function(){var b='<ul class="fr-dropdown-list" role="presentation">',c=a.FE.COMMANDS.tableCellVerticalAlign.options;for(var d in c)c.hasOwnProperty(d)&&(b+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellVerticalAlign" data-param1="'+d.toLowerCase()+'" title="'+this.language.translate(c[d])+'">'+this.language.translate(d)+"</a></li>");return b+="</ul>"},callback:function(a,b){this.table.verticalAlign(b)},refreshOnShow:function(a,b){b.find('.fr-command[data-param1="'+this.$el.find(".fr-selected-cell").css("vertical-align")+'"]').addClass("fr-active").attr("aria-selected",!0)}}),a.FE.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left"}),a.FE.DefineIcon("align-left",{NAME:"align-left"}),a.FE.DefineIcon("align-right",{NAME:"align-right"}),a.FE.DefineIcon("align-center",{NAME:"align-center"}),a.FE.DefineIcon("align-justify",{NAME:"align-justify"}),a.FE.RegisterCommand("tableCellHorizontalAlign",{type:"dropdown",focus:!1,title:"Horizontal Align",options:{left:"Align Left",center:"Align Center",right:"Align Right",justify:"Align Justify"},html:function(){var b='<ul class="fr-dropdown-list" role="presentation">',c=a.FE.COMMANDS.tableCellHorizontalAlign.options;for(var d in c)c.hasOwnProperty(d)&&(b+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="tableCellHorizontalAlign" data-param1="'+d+'" title="'+this.language.translate(c[d])+'">'+this.icon.create("align-"+d)+'<span class="fr-sr-only">'+this.language.translate(c[d])+"</span></a></li>");return b+="</ul>"},callback:function(a,b){this.table.horizontalAlign(b)},refresh:function(b){var c=this.table.selectedCells();c.length&&b.find("> *:first").replaceWith(this.icon.create("align-"+this.helpers.getAlignment(a(c[0]))))},refreshOnShow:function(a,b){b.find('.fr-command[data-param1="'+this.helpers.getAlignment(this.$el.find(".fr-selected-cell:first"))+'"]').addClass("fr-active").attr("aria-selected",!0)}}),a.FE.DefineIcon("tableCellStyle",{NAME:"magic"}),a.FE.RegisterCommand("tableCellStyle",{title:"Cell Style",type:"dropdown",focus:!1,html:function(){var a='<ul class="fr-dropdown-list" role="presentation">',b=this.opts.tableCellStyles;for(var c in b)b.hasOwnProperty(c)&&(a+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellStyle" data-param1="'+c+'" title="'+this.language.translate(b[c])+'">'+this.language.translate(b[c])+"</a></li>");return a+="</ul>"},callback:function(a,b){this.table.applyStyle(b,this.$el.find(".fr-selected-cell"),this.opts.tableCellMultipleStyles,this.opts.tableCellStyles)},refreshOnShow:function(b,c){var d=this.$el.find(".fr-selected-cell:first");d&&c.find(".fr-command").each(function(){var b=a(this).data("param1"),c=d.hasClass(b);a(this).toggleClass("fr-active",c).attr("aria-selected",c)})}})});
7
+ !function(l){"function"==typeof define&&define.amd?define(["jquery"],l):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),l(t)}:l(window.jQuery)}(function(Z){Z.extend(Z.FE.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_][_CUSTOM_COLOR_]"}),Z.extend(Z.FE.DEFAULTS,{tableInsertMaxSize:10,tableEditButtons:["tableHeader","tableRemove","|","tableRows","tableColumns","tableStyle","-","tableCells","tableCellBackground","tableCellVerticalAlign","tableCellHorizontalAlign","tableCellStyle"],tableInsertButtons:["tableBack","|"],tableResizer:!0,tableDefaultWidth:"100%",tableResizerOffset:5,tableResizingLimit:30,tableColorsButtons:["tableBack","|"],tableColors:["#61BD6D","#1ABC9C","#54ACD2","#2C82C9","#9365B8","#475577","#CCCCCC","#41A85F","#00A885","#3D8EB9","#2969B0","#553982","#28324E","#000000","#F7DA64","#FBA026","#EB6B56","#E25041","#A38F84","#EFEFEF","#FFFFFF","#FAC51C","#F37934","#D14841","#B8312F","#7C706B","#D1D5D8","REMOVE"],tableColorsStep:7,tableCellStyles:{"fr-highlighted":"Highlighted","fr-thick":"Thick"},tableStyles:{"fr-dashed-borders":"Dashed Borders","fr-alternate-rows":"Alternate Rows"},tableCellMultipleStyles:!0,tableMultipleStyles:!0,tableInsertHelper:!0,tableInsertHelperOffset:15}),Z.FE.PLUGINS.table=function(w){var C,o,s,r,a,n,E;function h(){var e=O();if(e){var t=w.popups.get("table.edit");if(t||(t=p()),t){w.popups.setContainer("table.edit",w.$sc);var l=M(e),a=(l.left+l.right)/2,s=l.bottom;w.popups.show("table.edit",a,s,l.bottom-l.top),w.edit.isDisabled()&&(1<J().length&&w.toolbar.disable(),w.$el.removeClass("fr-no-selection"),w.edit.on(),w.button.bulkRefresh(),w.selection.setAtEnd(w.$el.find(".fr-selected-cell:last").get(0)),w.selection.restore())}}}function f(){var e,t,l,a,s=O();if(s){var r=w.popups.get("table.colors");r||(r=function(){var e="";0<w.opts.tableColorsButtons.length&&(e='<div class="fr-buttons fr-table-colors-buttons">'+w.button.buildList(w.opts.tableColorsButtons)+"</div>");var t="";w.opts.colorsHEXInput&&(t='<div class="fr-table-colors-hex-layer fr-active fr-layer" id="fr-table-colors-hex-layer-'+w.id+'"><div class="fr-input-line"><input maxlength="7" id="fr-table-colors-hex-layer-text-'+w.id+'" type="text" placeholder="'+w.language.translate("HEX Color")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="tableCellBackgroundCustomColor" tabIndex="2" role="button">'+w.language.translate("OK")+"</button></div></div>");var l={buttons:e,colors:function(){for(var e='<div class="fr-table-colors">',t=0;t<w.opts.tableColors.length;t++)0!==t&&t%w.opts.tableColorsStep==0&&(e+="<br>"),"REMOVE"!=w.opts.tableColors[t]?e+='<span class="fr-command" style="background: '+w.opts.tableColors[t]+';" tabIndex="-1" role="button" data-cmd="tableCellBackgroundColor" data-param1="'+w.opts.tableColors[t]+'"><span class="fr-sr-only">'+w.language.translate("Color")+" "+w.opts.tableColors[t]+"&nbsp;&nbsp;&nbsp;</span></span>":e+='<span class="fr-command" data-cmd="tableCellBackgroundColor" tabIndex="-1" role="button" data-param1="REMOVE" title="'+w.language.translate("Clear Formatting")+'">'+w.icon.create("tableColorRemove")+'<span class="fr-sr-only">'+w.language.translate("Clear Formatting")+"</span></span>";return e+="</div>"}(),custom_color:t},a=w.popups.create("table.colors",l);return w.events.$on(w.$wp,"scroll.table-colors",function(){w.popups.isVisible("table.colors")&&f()}),u=a,w.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!w.popups.isVisible("table.colors")||!t.is("span"))return!0;var l=e.which,a=!0;if(Z.FE.KEYCODE.TAB==l){var s=u.find(".fr-buttons");a=!w.accessibility.focusToolbar(s,!!e.shiftKey)}else if(Z.FE.KEYCODE.ARROW_UP==l||Z.FE.KEYCODE.ARROW_DOWN==l||Z.FE.KEYCODE.ARROW_LEFT==l||Z.FE.KEYCODE.ARROW_RIGHT==l){var r=t.parent().find("span.fr-command"),n=r.index(t),o=w.opts.colorsStep,i=Math.floor(r.length/o),f=n%o,c=Math.floor(n/o),d=c*o+f,p=i*o;Z.FE.KEYCODE.ARROW_UP==l?d=((d-o)%p+p)%p:Z.FE.KEYCODE.ARROW_DOWN==l?d=(d+o)%p:Z.FE.KEYCODE.ARROW_LEFT==l?d=((d-1)%p+p)%p:Z.FE.KEYCODE.ARROW_RIGHT==l&&(d=(d+1)%p);var h=Z(r.get(d));w.events.disableBlur(),h.focus(),a=!1}else Z.FE.KEYCODE.ENTER==l&&(w.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0),a;var u}()),w.popups.setContainer("table.colors",w.$sc);var n=M(s),o=(n.left+n.right)/2,i=n.bottom;e=w.popups.get("table.colors"),t=w.$el.find(".fr-selected-cell:first"),l=w.helpers.RGBToHex(t.css("background-color")),a=e.find(".fr-table-colors-hex-layer input"),e.find(".fr-selected-color").removeClass("fr-selected-color fr-active-item"),e.find('span[data-param1="'+l+'"]').addClass("fr-selected-color fr-active-item"),a.val(l).trigger("change"),w.popups.show("table.colors",o,i,n.bottom-n.top)}}function i(){0===J().length&&w.toolbar.enable()}function c(e){if(e)return w.popups.onHide("table.insert",function(){w.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseenter")}),!0;var t="";0<w.opts.tableInsertButtons.length&&(t='<div class="fr-buttons">'+w.button.buildList(w.opts.tableInsertButtons)+"</div>");var l,a={buttons:t,rows_columns:function(){for(var e='<div class="fr-table-size"><div class="fr-table-size-info">1 &times; 1</div><div class="fr-select-table-size">',t=1;t<=w.opts.tableInsertMaxSize;t++){for(var l=1;l<=w.opts.tableInsertMaxSize;l++){var a="inline-block";2<t&&!w.helpers.isMobile()&&(a="none");var s="fr-table-cell ";1==t&&1==l&&(s+=" hover"),e+='<span class="fr-command '+s+'" tabIndex="-1" data-cmd="tableInsert" data-row="'+t+'" data-col="'+l+'" data-param1="'+t+'" data-param2="'+l+'" style="display: '+a+';" role="button"><span></span><span class="fr-sr-only">'+t+" &times; "+l+"&nbsp;&nbsp;&nbsp;</span></span>"}e+='<div class="new-line"></div>'}return e+="</div></div>"}()},s=w.popups.create("table.insert",a);return w.events.$on(s,"mouseenter",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){d(Z(e.currentTarget))},!0),l=s,w.events.$on(l,"focus","[tabIndex]",function(e){var t=Z(e.currentTarget);d(t)}),w.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!w.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var l,a=e.which;if(Z.FE.KEYCODE.ARROW_UP==a||Z.FE.KEYCODE.ARROW_DOWN==a||Z.FE.KEYCODE.ARROW_LEFT==a||Z.FE.KEYCODE.ARROW_RIGHT==a){if(t.is("span.fr-table-cell")){var s=t.parent().find("span.fr-table-cell"),r=s.index(t),n=w.opts.tableInsertMaxSize,o=r%n,i=Math.floor(r/n);Z.FE.KEYCODE.ARROW_UP==a?i=Math.max(0,i-1):Z.FE.KEYCODE.ARROW_DOWN==a?i=Math.min(w.opts.tableInsertMaxSize-1,i+1):Z.FE.KEYCODE.ARROW_LEFT==a?o=Math.max(0,o-1):Z.FE.KEYCODE.ARROW_RIGHT==a&&(o=Math.min(w.opts.tableInsertMaxSize-1,o+1));var f=i*n+o,c=Z(s.get(f));d(c),w.events.disableBlur(),c.focus(),l=!1}}else Z.FE.KEYCODE.ENTER==a&&(w.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0),s}function d(e){var t=e.data("row"),l=e.data("col"),a=e.parent();a.siblings(".fr-table-size-info").html(t+" &times; "+l),a.find("> span").removeClass("hover fr-active-item");for(var s=1;s<=w.opts.tableInsertMaxSize;s++)for(var r=0;r<=w.opts.tableInsertMaxSize;r++){var n=a.find('> span[data-row="'+s+'"][data-col="'+r+'"]');s<=t&&r<=l?n.addClass("hover"):s<=t+1||s<=2&&!w.helpers.isMobile()?n.css("display","inline-block"):2<s&&!w.helpers.isMobile()&&n.css("display","none")}e.addClass("fr-active-item")}function p(e){if(e)return w.popups.onHide("table.edit",i),!0;if(0<w.opts.tableEditButtons.length){var t={buttons:'<div class="fr-buttons">'+w.button.buildList(w.opts.tableEditButtons)+"</div>"},l=w.popups.create("table.edit",t);return w.events.$on(w.$wp,"scroll.table-edit",function(){w.popups.isVisible("table.edit")&&h()}),l}return!1}function u(){if(0<J().length){var e=Q();w.selection.setBefore(e.get(0))||w.selection.setAfter(e.get(0)),w.selection.restore(),w.popups.hide("table.edit"),e.remove(),w.toolbar.enable()}}function b(e){var t=Q();if(0<t.length){if(0<w.$el.find("th.fr-selected-cell").length&&"above"==e)return;var l,a,s,r=O(),n=$(r);a="above"==e?n.min_i:n.max_i;var o="<tr>";for(l=0;l<r[a].length;l++)if("below"==e&&a<r.length-1&&r[a][l]==r[a+1][l]||"above"==e&&0<a&&r[a][l]==r[a-1][l]){if(0===l||0<l&&r[a][l]!=r[a][l-1]){var i=Z(r[a][l]);i.attr("rowspan",parseInt(i.attr("rowspan"),10)+1)}}else o+="<td><br></td>";o+="</tr>",s=0<w.$el.find("th.fr-selected-cell").length&&"below"==e?Z(t.find("tbody").not(t.find("table tbody"))):Z(t.find("tr").not(t.find("table tr")).get(a)),"below"==e?"TBODY"==s.prop("tagName")?s.prepend(o):s.after(o):"above"==e&&(s.before(o),w.popups.isVisible("table.edit")&&h())}}function g(e,t,l){var a,s,r,n,o,i=0,f=O(l);if(e<(t=Math.min(t,f[0].length-1)))for(s=e;s<=t;s++)if(!(e<s&&f[0][s]==f[0][s-1])&&1<(n=Math.min(parseInt(f[0][s].getAttribute("colspan"),10)||1,t-e+1))&&f[0][s]==f[0][s+1])for(i=n-1,a=1;a<f.length;a++)if(f[a][s]!=f[a-1][s]){for(r=s;r<s+n;r++)if(1<(o=parseInt(f[a][r].getAttribute("colspan"),10)||1)&&f[a][r]==f[a][r+1])r+=i=Math.min(i,o-1);else if(!(i=Math.max(0,i-1)))break;if(!i)break}i&&v(f,i,"colspan",0,f.length-1,e,t)}function m(e,t,l){var a,s,r,n,o,i=0,f=O(l);if(e<(t=Math.min(t,f.length-1)))for(a=e;a<=t;a++)if(!(e<a&&f[a][0]==f[a-1][0])&&1<(n=Math.min(parseInt(f[a][0].getAttribute("rowspan"),10)||1,t-e+1))&&f[a][0]==f[a+1][0])for(i=n-1,s=1;s<f[0].length;s++)if(f[a][s]!=f[a][s-1]){for(r=a;r<a+n;r++)if(1<(o=parseInt(f[r][s].getAttribute("rowspan"),10)||1)&&f[r][s]==f[r+1][s])r+=i=Math.min(i,o-1);else if(!(i=Math.max(0,i-1)))break;if(!i)break}i&&v(f,i,"rowspan",e,t,0,f[0].length-1)}function v(e,t,l,a,s,r,n){var o,i,f;for(o=a;o<=s;o++)for(i=r;i<=n;i++)a<o&&e[o][i]==e[o-1][i]||r<i&&e[o][i]==e[o][i-1]||1<(f=parseInt(e[o][i].getAttribute(l),10)||1)&&(1<f-t?e[o][i].setAttribute(l,f-t):e[o][i].removeAttribute(l))}function R(e,t,l,a,s){m(e,t,s),g(l,a,s)}function t(e){var t=w.$el.find(".fr-selected-cell");"REMOVE"!=e?t.css("background-color",w.helpers.HEXtoRGB(e)):t.css("background-color",""),h()}function O(e){var f=[];return null==(e=e||null)&&0<J().length&&(e=Q()),e&&e.find("tr:visible").not(e.find("table tr")).each(function(o,e){var t=Z(e),i=0;t.find("> th, > td").each(function(e,t){for(var l=Z(t),a=parseInt(l.attr("colspan"),10)||1,s=parseInt(l.attr("rowspan"),10)||1,r=o;r<o+s;r++)for(var n=i;n<i+a;n++)f[r]||(f[r]=[]),f[r][n]?i++:f[r][n]=t;i+=a})}),f}function A(e,t){for(var l=0;l<t.length;l++)for(var a=0;a<t[l].length;a++)if(t[l][a]==e)return{row:l,col:a}}function F(e,t,l){for(var a=e+1,s=t+1;a<l.length;){if(l[a][t]!=l[e][t]){a--;break}a++}for(a==l.length&&a--;s<l[e].length;){if(l[e][s]!=l[e][t]){s--;break}s++}return s==l[e].length&&s--,{row:a,col:s}}function x(){w.el.querySelector(".fr-cell-fixed")&&w.el.querySelector(".fr-cell-fixed").classList.remove("fr-cell-fixed"),w.el.querySelector(".fr-cell-handler")&&w.el.querySelector(".fr-cell-handler").classList.remove("fr-cell-handler")}function D(){var e=w.$el.find(".fr-selected-cell");0<e.length&&e.each(function(){var e=Z(this);e.removeClass("fr-selected-cell"),""===e.attr("class")&&e.removeAttr("class")}),x()}function y(){w.events.disableBlur(),w.selection.clear(),w.$el.addClass("fr-no-selection"),w.$el.blur(),w.events.enableBlur()}function $(e){var t=w.$el.find(".fr-selected-cell");if(0<t.length){var l,a=e.length,s=0,r=e[0].length,n=0;for(l=0;l<t.length;l++){var o=A(t[l],e),i=F(o.row,o.col,e);a=Math.min(o.row,a),s=Math.max(i.row,s),r=Math.min(o.col,r),n=Math.max(i.col,n)}return{min_i:a,max_i:s,min_j:r,max_j:n}}return null}function M(e){var t=$(e),l=Z(e[t.min_i][t.min_j]),a=Z(e[t.min_i][t.max_j]),s=Z(e[t.max_i][t.min_j]);return{left:l.offset().left,right:a.offset().left+a.outerWidth(),top:l.offset().top,bottom:s.offset().top+s.outerHeight()}}function _(t,l){if(Z(t).is(l))D(),Z(t).addClass("fr-selected-cell");else{y(),w.edit.off();var a=O(),s=A(t,a),r=A(l,a),n=function e(t,l,a,s,r){var n,o,i,f,c=t,d=l,p=a,h=s;for(n=c;n<=d;n++)(1<(parseInt(Z(r[n][p]).attr("rowspan"),10)||1)||1<(parseInt(Z(r[n][p]).attr("colspan"),10)||1))&&(f=F((i=A(r[n][p],r)).row,i.col,r),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(Z(r[n][h]).attr("rowspan"),10)||1)||1<(parseInt(Z(r[n][h]).attr("colspan"),10)||1))&&(f=F((i=A(r[n][h],r)).row,i.col,r),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h));for(o=p;o<=h;o++)(1<(parseInt(Z(r[c][o]).attr("rowspan"),10)||1)||1<(parseInt(Z(r[c][o]).attr("colspan"),10)||1))&&(f=F((i=A(r[c][o],r)).row,i.col,r),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h)),(1<(parseInt(Z(r[d][o]).attr("rowspan"),10)||1)||1<(parseInt(Z(r[d][o]).attr("colspan"),10)||1))&&(f=F((i=A(r[d][o],r)).row,i.col,r),c=Math.min(i.row,c),d=Math.max(f.row,d),p=Math.min(i.col,p),h=Math.max(f.col,h));return c==t&&d==l&&p==a&&h==s?{min_i:t,max_i:l,min_j:a,max_j:s}:e(c,d,p,h,r)}(Math.min(s.row,r.row),Math.max(s.row,r.row),Math.min(s.col,r.col),Math.max(s.col,r.col),a);D(),t.classList.add("fr-cell-fixed"),l.classList.add("fr-cell-handler");for(var o=n.min_i;o<=n.max_i;o++)for(var i=n.min_j;i<=n.max_j;i++)Z(a[o][i]).addClass("fr-selected-cell")}}function I(e){var t=null,l=Z(e.target);return"TD"==e.target.tagName||"TH"==e.target.tagName?t=e.target:0<l.closest("td").length?t=l.closest("td").get(0):0<l.closest("th").length&&(t=l.closest("th").get(0)),0===w.$el.find(t).length?null:t}function T(){D(),w.popups.hide("table.edit")}function e(e){var t=I(e);if("false"==Z(t).parents("[contenteditable]:not(.fr-element):not(.fr-img-caption):not(body):first").attr("contenteditable"))return!0;if(0<J().length&&!t&&T(),!w.edit.isDisabled()||w.popups.isVisible("table.edit"))if(1!=e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)(3==e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)&&t&&T();else if(r=!0,t){0<J().length&&!e.shiftKey&&T(),e.stopPropagation(),w.events.trigger("image.hideResizer"),w.events.trigger("video.hideResizer"),s=!0;var l=t.tagName.toLowerCase();e.shiftKey&&0<w.$el.find(l+".fr-selected-cell").length?Z(w.$el.find(l+".fr-selected-cell").closest("table")).is(Z(t).closest("table"))?_(a,t):y():((w.keys.ctrlKey(e)||e.shiftKey)&&(1<J().length||0===Z(t).find(w.selection.element()).length&&!Z(t).is(w.selection.element()))&&y(),a=t,0<w.opts.tableEditButtons.length&&_(a,a))}}function l(e){if(s||w.$tb.is(e.target)||w.$tb.is(Z(e.target).closest(w.$tb.get(0)))||(0<J().length&&w.toolbar.enable(),D()),!(1!=e.which||1==e.which&&w.helpers.isMac()&&e.ctrlKey)){if(r=!1,s)s=!1,I(e)||1!=J().length?0<J().length&&(w.selection.isCollapsed()?h():D()):D();if(E){E=!1,C.removeClass("fr-moving"),w.$el.removeClass("fr-no-selection"),w.edit.on();var t=parseFloat(C.css("left"))+w.opts.tableResizerOffset+w.$wp.offset().left;w.opts.iframe&&(t-=w.$iframe.offset().left),C.data("release-position",t),C.removeData("max-left"),C.removeData("max-right"),function(){var e=C.data("origin"),t=C.data("release-position");if(e!==t){var l=C.data("first"),a=C.data("second"),s=C.data("table"),r=s.outerWidth();if(w.undo.canDo()||w.undo.saveStep(),null!==l&&null!==a){var n,o,i,f=O(s),c=[],d=[],p=[],h=[];for(n=0;n<f.length;n++)o=Z(f[n][l]),i=Z(f[n][a]),c[n]=o.outerWidth(),p[n]=i.outerWidth(),d[n]=c[n]/r*100,h[n]=p[n]/r*100;for(n=0;n<f.length;n++)if(o=Z(f[n][l]),i=Z(f[n][a]),f[n][l]!=f[n][a]){var u=(d[n]*(c[n]+t-e)/c[n]).toFixed(4);o.css("width",u+"%"),i.css("width",(d[n]+h[n]-u).toFixed(4)+"%")}}else{var b,g=s.parent(),m=r/g.width()*100,v=(parseInt(s.css("margin-left"),10)||0)/g.width()*100,E=(parseInt(s.css("margin-right"),10)||0)/g.width()*100;"rtl"==w.opts.direction&&0===a||"rtl"!=w.opts.direction&&0!==a?(b=(r+t-e)/r*m,s.css("margin-right","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(v).toFixed(4)+"%)")):("rtl"==w.opts.direction&&0!==a||"rtl"!=w.opts.direction&&0===a)&&(b=(r-t+e)/r*m,s.css("margin-left","calc(100% - "+Math.round(b).toFixed(4)+"% - "+Math.round(E).toFixed(4)+"%)")),s.css("width",Math.round(b).toFixed(4)+"%")}w.selection.restore(),w.undo.saveStep(),w.events.trigger("table.resized",[s.get(0)])}C.removeData("origin"),C.removeData("release-position"),C.removeData("first"),C.removeData("second"),C.removeData("table")}(),W()}}}function N(e){if(!0===s&&0<w.opts.tableEditButtons.length){if(Z(e.currentTarget).closest("table").is(Q())){if("TD"==e.currentTarget.tagName&&0===w.$el.find("th.fr-selected-cell").length)return void _(a,e.currentTarget);if("TH"==e.currentTarget.tagName&&0===w.$el.find("td.fr-selected-cell").length)return void _(a,e.currentTarget)}y()}}function S(e,t,l,a){for(var s,r=t;r!=w.el&&"TD"!=r.tagName&&"TH"!=r.tagName&&("up"==a?s=r.previousElementSibling:"down"==a&&(s=r.nextElementSibling),!s);)r=r.parentNode;"TD"==r.tagName||"TH"==r.tagName?function(e,t){for(var l=e;l&&"TABLE"!=l.tagName&&l.parentNode!=w.el;)l=l.parentNode;if(l&&"TABLE"==l.tagName){var a=O(Z(l));"up"==t?z(A(e,a),l,a):"down"==t&&B(A(e,a),l,a)}}(r,a):s&&("up"==a&&w.selection.setAtEnd(s),"down"==a&&w.selection.setAtStart(s))}function z(e,t,l){0<e.row?w.selection.setAtEnd(l[e.row-1][e.col]):S(0,t,0,"up")}function B(e,t,l){var a=parseInt(l[e.row][e.col].getAttribute("rowspan"),10)||1;e.row<l.length-a?w.selection.setAtStart(l[e.row+a][e.col]):S(0,t,0,"down")}function W(){C&&(C.find("div").css("opacity",0),C.css("top",0),C.css("left",0),C.css("height",0),C.find("div").css("height",0),C.hide())}function k(){o&&o.removeClass("fr-visible").css("left","-9999px")}function K(e,t){var l=Z(t),a=l.closest("table"),s=a.parent();if(t&&"TD"!=t.tagName&&"TH"!=t.tagName&&(0<l.closest("td").length?t=l.closest("td"):0<l.closest("th").length&&(t=l.closest("th"))),!t||"TD"!=t.tagName&&"TH"!=t.tagName)C&&l.get(0)!=C.get(0)&&l.parent().get(0)!=C.get(0)&&w.core.sameInstance(C)&&W();else{if(l=Z(t),0===w.$el.find(l).length)return!1;var r=l.offset().left-1,n=r+l.outerWidth();if(Math.abs(e.pageX-r)<=w.opts.tableResizerOffset||Math.abs(n-e.pageX)<=w.opts.tableResizerOffset){var o,i,f,c,d,p=O(a),h=A(t,p),u=F(h.row,h.col,p),b=a.offset().top,g=a.outerHeight()-1;"rtl"!=w.opts.direction?e.pageX-r<=w.opts.tableResizerOffset?(f=r,0<h.col?(c=r-j(h.col-1,p)+w.opts.tableResizingLimit,d=r+j(h.col,p)-w.opts.tableResizingLimit,o=h.col-1,i=h.col):(o=null,i=0,c=a.offset().left-1-parseInt(a.css("margin-left"),10),d=a.offset().left-1+a.width()-p[0].length*w.opts.tableResizingLimit)):n-e.pageX<=w.opts.tableResizerOffset&&(f=n,u.col<p[u.row].length&&p[u.row][u.col+1]?(c=n-j(u.col,p)+w.opts.tableResizingLimit,d=n+j(u.col+1,p)-w.opts.tableResizingLimit,o=u.col,i=u.col+1):(o=u.col,i=null,c=a.offset().left-1+p[0].length*w.opts.tableResizingLimit,d=s.offset().left-1+s.width()+parseFloat(s.css("padding-left")))):n-e.pageX<=w.opts.tableResizerOffset?(f=n,0<h.col?(c=n-j(h.col,p)+w.opts.tableResizingLimit,d=n+j(h.col-1,p)-w.opts.tableResizingLimit,o=h.col,i=h.col-1):(o=null,i=0,c=a.offset().left+p[0].length*w.opts.tableResizingLimit,d=s.offset().left-1+s.width()+parseFloat(s.css("padding-left")))):e.pageX-r<=w.opts.tableResizerOffset&&(f=r,u.col<p[u.row].length&&p[u.row][u.col+1]?(c=r-j(u.col+1,p)+w.opts.tableResizingLimit,d=r+j(u.col,p)-w.opts.tableResizingLimit,o=u.col+1,i=u.col):(o=u.col,i=null,c=s.offset().left+parseFloat(s.css("padding-left")),d=a.offset().left-1+a.width()-p[0].length*w.opts.tableResizingLimit)),C||(w.shared.$table_resizer||(w.shared.$table_resizer=Z('<div class="fr-table-resizer"><div></div></div>')),C=w.shared.$table_resizer,w.events.$on(C,"mousedown",function(e){return!w.core.sameInstance(C)||(0<J().length&&T(),1==e.which?(w.selection.save(),E=!0,C.addClass("fr-moving"),y(),w.edit.off(),C.find("div").css("opacity",1),!1):void 0)}),w.events.$on(C,"mousemove",function(e){if(!w.core.sameInstance(C))return!0;E&&(w.opts.iframe&&(e.pageX-=w.$iframe.offset().left),X(e))}),w.events.on("shared.destroy",function(){C.html("").removeData().remove(),C=null},!0),w.events.on("destroy",function(){w.$el.find(".fr-selected-cell").removeClass("fr-selected-cell"),C.hide().appendTo(Z("body:first"))},!0)),C.data("table",a),C.data("first",o),C.data("second",i),C.data("instance",w),w.$wp.append(C);var m=f-w.win.pageXOffset-w.opts.tableResizerOffset-w.$wp.offset().left,v=b-w.$wp.offset().top+w.$wp.scrollTop();w.opts.iframe&&(m+=w.$iframe.offset().left,v+=w.$iframe.offset().top,c+=w.$iframe.offset().left,d+=w.$iframe.offset().left),C.data("max-left",c),C.data("max-right",d),C.data("origin",f-w.win.pageXOffset),C.css("top",v),C.css("left",m),C.css("height",g),C.find("div").css("height",g),C.css("padding-left",w.opts.tableResizerOffset),C.css("padding-right",w.opts.tableResizerOffset),C.show()}else w.core.sameInstance(C)&&W()}}function L(e,t){if(w.$box.find(".fr-line-breaker").is(":visible"))return!1;o||q(),w.$box.append(o),o.data("instance",w);var l,a=Z(t).find("tr:first"),s=e.pageX,r=0,n=0;w.opts.iframe&&(r+=w.$iframe.offset().left-w.helpers.scrollLeft(),n+=w.$iframe.offset().top-w.helpers.scrollTop()),a.find("th, td").each(function(){var e=Z(this);return e.offset().left<=s&&s<e.offset().left+e.outerWidth()/2?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top-l-5),o.css("left",r+e.offset().left-w.$box.offset().left-l/2),o.data("selected-cell",e),o.data("position","before"),o.addClass("fr-visible"),!1):e.offset().left+e.outerWidth()/2<=s&&s<e.offset().left+e.outerWidth()?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top-l-5),o.css("left",r+e.offset().left-w.$box.offset().left+e.outerWidth()-l/2),o.data("selected-cell",e),o.data("position","after"),o.addClass("fr-visible"),!1):void 0})}function H(e,t){if(w.$box.find(".fr-line-breaker").is(":visible"))return!1;o||q(),w.$box.append(o),o.data("instance",w);var l,a=Z(t),s=e.pageY,r=0,n=0;w.opts.iframe&&(r+=w.$iframe.offset().left-w.helpers.scrollLeft(),n+=w.$iframe.offset().top-w.helpers.scrollTop()),a.find("tr").each(function(){var e=Z(this);return e.offset().top<=s&&s<e.offset().top+e.outerHeight()/2?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top-l/2),o.css("left",r+e.offset().left-w.$box.offset().left-l-5),o.data("selected-cell",e.find("td:first")),o.data("position","above"),o.addClass("fr-visible"),!1):e.offset().top+e.outerHeight()/2<=s&&s<e.offset().top+e.outerHeight()?(l=parseInt(o.find("a").css("width"),10),o.css("top",n+e.offset().top-w.$box.offset().top+e.outerHeight()-l/2),o.css("left",r+e.offset().left-w.$box.offset().left-l-5),o.data("selected-cell",e.find("td:first")),o.data("position","below"),o.addClass("fr-visible"),!1):void 0})}function Y(e){n=null;var t=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset,e.pageY-w.win.pageYOffset);w.opts.tableResizer&&(!w.popups.areVisible()||w.popups.areVisible()&&w.popups.isVisible("table.edit"))&&K(e,t),!w.opts.tableInsertHelper||w.popups.areVisible()||w.$tb.hasClass("fr-inline")&&w.$tb.is(":visible")||function(e,t){if(0===J().length){var l,a,s;if(t&&("HTML"==t.tagName||"BODY"==t.tagName||w.node.isElement(t)))for(l=1;l<=w.opts.tableInsertHelperOffset;l++){if(a=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset,e.pageY-w.win.pageYOffset+l),Z(a).hasClass("fr-tooltip"))return;if(a&&("TH"==a.tagName||"TD"==a.tagName||"TABLE"==a.tagName)&&(Z(a).parents(".fr-wrapper").length||w.opts.iframe))return L(e,Z(a).closest("table"));if(s=w.doc.elementFromPoint(e.pageX-w.win.pageXOffset+l,e.pageY-w.win.pageYOffset),Z(s).hasClass("fr-tooltip"))return;if(s&&("TH"==s.tagName||"TD"==s.tagName||"TABLE"==s.tagName)&&(Z(s).parents(".fr-wrapper").length||w.opts.iframe))return H(e,Z(s).closest("table"))}w.core.sameInstance(o)&&k()}}(e,t)}function P(){if(E){var e=C.data("table").offset().top-w.win.pageYOffset;w.opts.iframe&&(e+=w.$iframe.offset().top-w.helpers.scrollTop()),C.css("top",e)}}function j(e,t){var l,a=Z(t[0][e]).outerWidth();for(l=1;l<t.length;l++)a=Math.min(a,Z(t[l][e]).outerWidth());return a}function V(e,t,l){var a,s=0;for(a=e;a<=t;a++)s+=j(a,l);return s}function X(e){if(1<J().length&&r&&y(),!1===r&&!1===s&&!1===E)n&&clearTimeout(n),w.edit.isDisabled()&&!w.popups.isVisible("table.edit")||(n=setTimeout(Y,30,e));else if(E){var t=e.pageX-w.win.pageXOffset;w.opts.iframe&&(t+=w.$iframe.offset().left);var l=C.data("max-left"),a=C.data("max-right");l<=t&&t<=a?C.css("left",t-w.opts.tableResizerOffset-w.$wp.offset().left):t<l&&parseFloat(C.css("left"),10)>l-w.opts.tableResizerOffset?C.css("left",l-w.opts.tableResizerOffset-w.$wp.offset().left):a<t&&parseFloat(C.css("left"),10)<a-w.opts.tableResizerOffset&&C.css("left",a-w.opts.tableResizerOffset-w.$wp.offset().left)}else r&&k()}function U(e){w.node.isEmpty(e.get(0))?e.prepend(Z.FE.MARKERS):e.prepend(Z.FE.START_MARKER).append(Z.FE.END_MARKER)}function q(){w.shared.$ti_helper||(w.shared.$ti_helper=Z('<div class="fr-insert-helper"><a class="fr-floating-btn" role="button" tabIndex="-1" title="'+w.language.translate("Insert")+'"><svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22,16.75 L16.75,16.75 L16.75,22 L15.25,22.000 L15.25,16.75 L10,16.75 L10,15.25 L15.25,15.25 L15.25,10 L16.75,10 L16.75,15.25 L22,15.25 L22,16.75 Z"/></svg></a></div>'),w.events.bindClick(w.shared.$ti_helper,"a",function(){var e=o.data("selected-cell"),t=o.data("position"),l=o.data("instance")||w;"before"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertColumn(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"after"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertColumn(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"above"==t?(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertRow(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()):"below"==t&&(w.undo.saveStep(),e.addClass("fr-selected-cell"),l.table.insertRow(t),e.removeClass("fr-selected-cell"),w.undo.saveStep()),k()}),w.events.on("shared.destroy",function(){w.shared.$ti_helper.html("").removeData().remove(),w.shared.$ti_helper=null},!0),w.events.$on(w.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),w.events.$on(Z(w.o_win),"scroll",function(){k()},!0),w.events.$on(w.$wp,"scroll",function(){k()},!0)),o=w.shared.$ti_helper,w.events.on("destroy",function(){o=null}),w.tooltip.bind(w.$box,".fr-insert-helper > a.fr-floating-btn")}function G(){a=null,clearTimeout(n)}function J(){return w.el.querySelectorAll(".fr-selected-cell")}function Q(){var e=J();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=w.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?Z(t):Z([])}return Z([])}return{_init:function(){if(!w.$wp)return!1;if(!w.helpers.isMobile()){E=s=r=!1,w.events.$on(w.$el,"mousedown",e),w.popups.onShow("image.edit",function(){D(),s=r=!1}),w.popups.onShow("link.edit",function(){D(),s=r=!1}),w.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&D()}),w.events.$on(w.$el,"mouseenter","th, td",N),w.events.$on(w.$win,"mouseup",l),w.opts.iframe&&w.events.$on(Z(w.o_win),"mouseup",l),w.events.$on(w.$win,"mousemove",X),w.events.$on(Z(w.o_win),"scroll",P),w.events.on("contentChanged",function(){0<J().length&&(h(),w.$el.find("img").on("load.selected-cells",function(){Z(this).off("load.selected-cells"),0<J().length&&h()}))}),w.events.$on(Z(w.o_win),"resize",function(){D()}),w.events.on("toolbar.esc",function(){if(0<J().length)return w.events.disableBlur(),w.events.focus(),!1},!0),w.events.$on(Z(w.o_win),"keydown",function(){r&&s&&(s=r=!1,w.$el.removeClass("fr-no-selection"),w.edit.on(),w.selection.setAtEnd(w.$el.find(".fr-selected-cell:last").get(0)),w.selection.restore(),D())}),w.events.$on(w.$el,"keydown",function(e){e.shiftKey?!1===function(e){var t=J();if(0<t.length){var l,a,s=O(),r=e.which;1==t.length?a=l=t[0]:(l=w.el.querySelector(".fr-cell-fixed"),a=w.el.querySelector(".fr-cell-handler"));var n=A(a,s);if(Z.FE.KEYCODE.ARROW_RIGHT==r){if(n.col<s[0].length-1)return _(l,s[n.row][n.col+1]),!1}else if(Z.FE.KEYCODE.ARROW_DOWN==r){if(n.row<s.length-1)return _(l,s[n.row+1][n.col]),!1}else if(Z.FE.KEYCODE.ARROW_LEFT==r){if(0<n.col)return _(l,s[n.row][n.col-1]),!1}else if(Z.FE.KEYCODE.ARROW_UP==r&&0<n.row)return _(l,s[n.row-1][n.col]),!1}}(e)&&setTimeout(function(){h()},0):function(e){var t=e.which,l=w.selection.blocks();if(l.length&&("TD"==(l=l[0]).tagName||"TH"==l.tagName)){for(var a=l;a&&"TABLE"!=a.tagName&&a.parentNode!=w.el;)a=a.parentNode;if(a&&"TABLE"==a.tagName&&(Z.FE.KEYCODE.ARROW_LEFT==t||Z.FE.KEYCODE.ARROW_UP==t||Z.FE.KEYCODE.ARROW_RIGHT==t||Z.FE.KEYCODE.ARROW_DOWN==t)&&(0<J().length&&T(),w.browser.webkit&&(Z.FE.KEYCODE.ARROW_UP==t||Z.FE.KEYCODE.ARROW_DOWN==t))){var s=w.selection.ranges(0).startContainer;if(s.nodeType==Node.TEXT_NODE&&(Z.FE.KEYCODE.ARROW_UP==t&&s.previousSibling||Z.FE.KEYCODE.ARROW_DOWN==t&&s.nextSibling))return;e.preventDefault(),e.stopPropagation();var r=O(Z(a)),n=A(l,r);Z.FE.KEYCODE.ARROW_UP==t?z(n,a,r):Z.FE.KEYCODE.ARROW_DOWN==t&&B(n,a,r),w.selection.restore()}}}(e)}),w.events.on("keydown",function(e){if(!1===function(e){if(e.which==Z.FE.KEYCODE.TAB){var t;if(0<J().length)t=w.$el.find(".fr-selected-cell:last");else{var l=w.selection.element();"TD"==l.tagName||"TH"==l.tagName?t=Z(l):l!=w.el&&(0<Z(l).parentsUntil(w.$el,"td").length?t=Z(l).parents("td:first"):0<Z(l).parentsUntil(w.$el,"th").length&&(t=Z(l).parents("th:first")))}if(t)return e.preventDefault(),!!(0<Z(w.selection.element()).parentsUntil(w.$el,"ol, ul").length&&(0<Z(w.selection.element()).parents("li").prev().length||Z(w.selection.element()).is("li")&&0<Z(w.selection.element()).prev().length))||(T(),e.shiftKey?0<t.prev().length?U(t.prev()):0<t.closest("tr").length&&0<t.closest("tr").prev().length?U(t.closest("tr").prev().find("td:last")):0<t.closest("tbody").length&&0<t.closest("table").find("thead tr").length&&U(t.closest("table").find("thead tr th:last")):0<t.next().length?U(t.next()):0<t.closest("tr").length&&0<t.closest("tr").next().length?U(t.closest("tr").next().find("td:first")):0<t.closest("thead").length&&0<t.closest("table").find("tbody tr").length?U(t.closest("table").find("tbody tr td:first")):(t.addClass("fr-selected-cell"),b("below"),D(),U(t.closest("tr").next().find("td:first"))),w.selection.restore(),!1)}}(e))return!1;var t=J();if(0<t.length){if(0<t.length&&w.keys.ctrlKey(e)&&e.which==Z.FE.KEYCODE.A)return D(),w.popups.isVisible("table.edit")&&w.popups.hide("table.edit"),t=[],!0;if(e.which==Z.FE.KEYCODE.ESC&&w.popups.isVisible("table.edit"))return D(),w.popups.hide("table.edit"),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!(t=[]);if(1<t.length&&(e.which==Z.FE.KEYCODE.BACKSPACE||e.which==Z.FE.KEYCODE.DELETE)){w.undo.saveStep();for(var l=0;l<t.length;l++)Z(t[l]).html("<br>"),l==t.length-1&&Z(t[l]).prepend(Z.FE.MARKERS);return w.selection.restore(),w.undo.saveStep(),!(t=[])}if(1<t.length&&e.which!=Z.FE.KEYCODE.F10&&!w.keys.isBrowserAction(e))return e.preventDefault(),!(t=[])}else if(!(t=[])===function(e){if(e.altKey&&e.which==Z.FE.KEYCODE.SPACE){var t,l=w.selection.element();if("TD"==l.tagName||"TH"==l.tagName?t=l:0<Z(l).closest("td").length?t=Z(l).closest("td").get(0):0<Z(l).closest("th").length&&(t=Z(l).closest("th").get(0)),t)return e.preventDefault(),_(t,t),h(),!1}}(e))return!1},!0);var t=[];w.events.on("html.beforeGet",function(){t=J();for(var e=0;e<t.length;e++)t[e].className=(t[e].className||"").replace(/fr-selected-cell/g,"")}),w.events.on("html.afterGet",function(){for(var e=0;e<t.length;e++)t[e].className=(t[e].className?t[e].className.trim()+" ":"")+"fr-selected-cell";t=[]}),c(!0),p(!0)}w.events.on("destroy",G)},insert:function(e,t){var l,a,s="<table "+(w.opts.tableDefaultWidth?'style="width: '+w.opts.tableDefaultWidth+';" ':"")+'class="fr-inserted-table"><tbody>',r=100/t;for(l=0;l<e;l++){for(s+="<tr>",a=0;a<t;a++)s+="<td"+(w.opts.tableDefaultWidth?' style="width: '+r.toFixed(4)+'%;"':"")+">",0===l&&0===a&&(s+=Z.FE.MARKERS),s+="<br></td>";s+="</tr>"}s+="</tbody></table>",w.html.insert(s),w.selection.restore();var n=w.$el.find(".fr-inserted-table");n.removeClass("fr-inserted-table"),w.events.trigger("table.inserted",[n.get(0)])},remove:u,insertRow:b,deleteRow:function(){var e=Q();if(0<e.length){var t,l,a,s=O(),r=$(s);if(0===r.min_i&&r.max_i==s.length-1)u();else{for(t=r.max_i;t>=r.min_i;t--){for(a=Z(e.find("tr").not(e.find("table tr")).get(t)),l=0;l<s[t].length;l++)if(0===l||s[t][l]!=s[t][l-1]){var n=Z(s[t][l]);if(1<parseInt(n.attr("rowspan"),10)){var o=parseInt(n.attr("rowspan"),10)-1;1==o?n.removeAttr("rowspan"):n.attr("rowspan",o)}if(t<s.length-1&&s[t][l]==s[t+1][l]&&(0===t||s[t][l]!=s[t-1][l])){for(var i=s[t][l],f=l;0<f&&s[t][f]==s[t][f-1];)f--;0===f?Z(e.find("tr").not(e.find("table tr")).get(t+1)).prepend(i):Z(s[t+1][f-1]).after(i)}}var c=a.parent();a.remove(),0===c.find("tr").length&&c.remove(),s=O(e)}R(0,s.length-1,0,s[0].length-1,e),0<r.min_i?w.selection.setAtEnd(s[r.min_i-1][0]):w.selection.setAtEnd(s[0][0]),w.selection.restore(),w.popups.hide("table.edit")}}},insertColumn:function(i){var e=Q();if(0<e.length){var f,c=O(),t=$(c);f="before"==i?t.min_j:t.max_j;var l,d=100/c[0].length,p=100/(c[0].length+1);e.find("th, td").each(function(){(l=Z(this)).data("old-width",l.outerWidth()/e.outerWidth()*100)}),e.find("tr").not(e.find("table tr")).each(function(e){for(var t,l=Z(this),a=0,s=0;a-1<f;){if(!(t=l.find("> th, > td").get(s))){t=null;break}t==c[e][a]?(a+=parseInt(Z(t).attr("colspan"),10)||1,s++):(a+=parseInt(Z(c[e][a]).attr("colspan"),10)||1,"after"==i&&(t=0===s?-1:l.find("> th, > td").get(s-1)))}var r,n=Z(t);if("after"==i&&f<a-1||"before"==i&&0<f&&c[e][f]==c[e][f-1]){if(0===e||0<e&&c[e][f]!=c[e-1][f]){var o=parseInt(n.attr("colspan"),10)+1;n.attr("colspan",o),n.css("width",(n.data("old-width")*p/d+p).toFixed(4)+"%"),n.removeData("old-width")}}else r=0<l.find("th").length?'<th style="width: '+p.toFixed(4)+'%;"><br></th>':'<td style="width: '+p.toFixed(4)+'%;"><br></td>',-1==t?l.prepend(r):null==t?l.append(r):"before"==i?n.before(r):"after"==i&&n.after(r)}),e.find("th, td").each(function(){(l=Z(this)).data("old-width")&&(l.css("width",(l.data("old-width")*p/d).toFixed(4)+"%"),l.removeData("old-width"))}),w.popups.isVisible("table.edit")&&h()}},deleteColumn:function(){var e=Q();if(0<e.length){var t,l,a,s=O(),r=$(s);if(0===r.min_j&&r.max_j==s[0].length-1)u();else{var n=0;for(t=0;t<s.length;t++)for(l=0;l<s[0].length;l++)(a=Z(s[t][l])).hasClass("fr-selected-cell")||(a.data("old-width",a.outerWidth()/e.outerWidth()*100),(l<r.min_j||l>r.max_j)&&(n+=a.outerWidth()/e.outerWidth()*100));for(n/=s.length,l=r.max_j;l>=r.min_j;l--)for(t=0;t<s.length;t++)if(0===t||s[t][l]!=s[t-1][l])if(a=Z(s[t][l]),1<(parseInt(a.attr("colspan"),10)||1)){var o=parseInt(a.attr("colspan"),10)-1;1==o?a.removeAttr("colspan"):a.attr("colspan",o),a.css("width",(100*(a.data("old-width")-j(l,s))/n).toFixed(4)+"%"),a.removeData("old-width")}else{var i=Z(a.parent().get(0));a.remove(),0===i.find("> th, > td").length&&(0===i.prev().length||0===i.next().length||i.prev().find("> th[rowspan], > td[rowspan]").length<i.prev().find("> th, > td").length)&&i.remove()}R(0,s.length-1,0,s[0].length-1,e),0<r.min_j?w.selection.setAtEnd(s[r.min_i][r.min_j-1]):w.selection.setAtEnd(s[r.min_i][0]),w.selection.restore(),w.popups.hide("table.edit"),e.find("th, td").each(function(){(a=Z(this)).data("old-width")&&(a.css("width",(100*a.data("old-width")/n).toFixed(4)+"%"),a.removeData("old-width"))})}}},mergeCells:function(){if(1<J().length&&(0===w.$el.find("th.fr-selected-cell").length||0===w.$el.find("td.fr-selected-cell").length)){x();var e,t,l=$(O()),a=w.$el.find(".fr-selected-cell"),s=Z(a[0]),r=s.parent().find(".fr-selected-cell"),n=s.closest("table"),o=s.html(),i=0;for(e=0;e<r.length;e++)i+=Z(r[e]).outerWidth();for(s.css("width",Math.min(100,i/n.outerWidth()*100).toFixed(4)+"%"),l.min_j<l.max_j&&s.attr("colspan",l.max_j-l.min_j+1),l.min_i<l.max_i&&s.attr("rowspan",l.max_i-l.min_i+1),e=1;e<a.length;e++)"<br>"!=(t=Z(a[e])).html()&&""!==t.html()&&(o+="<br>"+t.html()),t.remove();s.html(o),w.selection.setAtEnd(s.get(0)),w.selection.restore(),w.toolbar.enable(),m(l.min_i,l.max_i,n);var f=n.find("tr:empty");for(e=f.length-1;0<=e;e--)Z(f[e]).remove();g(l.min_j,l.max_j,n),h()}},splitCellVertically:function(){if(1==J().length){var e=w.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,l=e.parent().outerWidth(),a=e.outerWidth(),s=e.clone().html("<br>"),r=O(),n=A(e.get(0),r);if(1<t){var o=Math.ceil(t/2);a=V(n.col,n.col+o-1,r)/l*100;var i=V(n.col+o,n.col+t-1,r)/l*100;1<o?e.attr("colspan",o):e.removeAttr("colspan"),1<t-o?s.attr("colspan",t-o):s.removeAttr("colspan"),e.css("width",a.toFixed(4)+"%"),s.css("width",i.toFixed(4)+"%")}else{var f;for(f=0;f<r.length;f++)if(0===f||r[f][n.col]!=r[f-1][n.col]){var c=Z(r[f][n.col]);if(!c.is(e)){var d=(parseInt(c.attr("colspan"),10)||1)+1;c.attr("colspan",d)}}a=a/l*100/2,e.css("width",a.toFixed(4)+"%"),s.css("width",a.toFixed(4)+"%")}e.after(s),D(),w.popups.hide("table.edit")}},splitCellHorizontally:function(){if(1==J().length){var e=w.$el.find(".fr-selected-cell"),t=e.parent(),l=e.closest("table"),a=parseInt(e.attr("rowspan"),10),s=O(),r=A(e.get(0),s),n=e.clone().html("<br>");if(1<a){var o=Math.ceil(a/2);1<o?e.attr("rowspan",o):e.removeAttr("rowspan"),1<a-o?n.attr("rowspan",a-o):n.removeAttr("rowspan");for(var i=r.row+o,f=0===r.col?r.col:r.col-1;0<=f&&(s[i][f]==s[i][f-1]||0<i&&s[i][f]==s[i-1][f]);)f--;-1==f?Z(l.find("tr").not(l.find("table tr")).get(i)).prepend(n):Z(s[i][f]).after(n)}else{var c,d=Z("<tr>").append(n);for(c=0;c<s[0].length;c++)if(0===c||s[r.row][c]!=s[r.row][c-1]){var p=Z(s[r.row][c]);p.is(e)||p.attr("rowspan",(parseInt(p.attr("rowspan"),10)||1)+1)}t.after(d)}D(),w.popups.hide("table.edit")}},addHeader:function(){var e=Q();if(0<e.length&&0===e.find("th").length){var t,l="<thead><tr>",a=0;for(e.find("tr:first > td").each(function(){var e=Z(this);a+=parseInt(e.attr("colspan"),10)||1}),t=0;t<a;t++)l+="<th><br></th>";l+="</tr></thead>",e.prepend(l),h()}},removeHeader:function(){var e=Q(),t=e.find("thead");if(0<t.length)if(0===e.find("tbody tr").length)u();else if(t.remove(),0<J().length)h();else{w.popups.hide("table.edit");var l=e.find("tbody tr:first td:first").get(0);l&&(w.selection.setAtEnd(l),w.selection.restore())}},setBackground:t,showInsertPopup:function(){var e=w.$tb.find('.fr-command[data-cmd="insertTable"]'),t=w.popups.get("table.insert");if(t||(t=c()),!t.hasClass("fr-active")){w.popups.refresh("table.insert"),w.popups.setContainer("table.insert",w.$tb);var l=e.offset().left+e.outerWidth()/2,a=e.offset().top+(w.opts.toolbarBottom?10:e.outerHeight()-10);w.popups.show("table.insert",l,a,e.outerHeight())}},showEditPopup:h,showColorsPopup:f,back:function(){0<J().length?h():(w.popups.hide("table.insert"),w.toolbar.showInline())},verticalAlign:function(e){w.$el.find(".fr-selected-cell").css("vertical-align",e)},horizontalAlign:function(e){w.$el.find(".fr-selected-cell").css("text-align",e)},applyStyle:function(e,t,l,a){if(0<t.length){if(!l){var s=Object.keys(a);s.splice(s.indexOf(e),1),t.removeClass(s.join(" "))}t.toggleClass(e)}},selectedTable:Q,selectedCells:J,customColor:function(){var e=w.popups.get("table.colors").find(".fr-table-colors-hex-layer input");e.length&&t(e.val())},selectCells:_}},Z.FE.DefineIcon("insertTable",{NAME:"table"}),Z.FE.RegisterCommand("insertTable",{title:"Insert Table",undo:!1,focus:!0,refreshOnCallback:!1,popup:!0,callback:function(){this.popups.isVisible("table.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("table.insert")):this.table.showInsertPopup()},plugin:"table"}),Z.FE.RegisterCommand("tableInsert",{callback:function(e,t,l){this.table.insert(t,l),this.popups.hide("table.insert")}}),Z.FE.DefineIcon("tableHeader",{NAME:"header",FA5NAME:"heading"}),Z.FE.RegisterCommand("tableHeader",{title:"Table Header",focus:!1,toggle:!0,callback:function(){this.popups.get("table.edit").find('.fr-command[data-cmd="tableHeader"]').hasClass("fr-active")?this.table.removeHeader():this.table.addHeader()},refresh:function(e){var t=this.table.selectedTable();0<t.length&&(0===t.find("th").length?e.removeClass("fr-active").attr("aria-pressed",!1):e.addClass("fr-active").attr("aria-pressed",!0))}}),Z.FE.DefineIcon("tableRows",{NAME:"bars"}),Z.FE.RegisterCommand("tableRows",{type:"dropdown",focus:!1,title:"Row",options:{above:"Insert row above",below:"Insert row below","delete":"Delete row"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Z.FE.COMMANDS.tableRows.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableRows" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),Z.FE.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90"}),Z.FE.RegisterCommand("tableColumns",{type:"dropdown",focus:!1,title:"Column",options:{before:"Insert column before",after:"Insert column after","delete":"Delete column"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Z.FE.COMMANDS.tableColumns.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableColumns" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"before"==t||"after"==t?this.table.insertColumn(t):this.table.deleteColumn()}}),Z.FE.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square"}),Z.FE.RegisterCommand("tableCells",{type:"dropdown",focus:!1,title:"Cell",options:{merge:"Merge cells","vertical-split":"Vertical split","horizontal-split":"Horizontal split"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Z.FE.COMMANDS.tableCells.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCells" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){"merge"==t?this.table.mergeCells():"vertical-split"==t?this.table.splitCellVertically():this.table.splitCellHorizontally()},refreshOnShow:function(e,t){1<this.$el.find(".fr-selected-cell").length?(t.find('a[data-param1="vertical-split"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="horizontal-split"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="merge"]').removeClass("fr-disabled").attr("aria-disabled",!1)):(t.find('a[data-param1="merge"]').addClass("fr-disabled").attr("aria-disabled",!0),t.find('a[data-param1="vertical-split"]').removeClass("fr-disabled").attr("aria-disabled",!1),t.find('a[data-param1="horizontal-split"]').removeClass("fr-disabled").attr("aria-disabled",!1))}}),Z.FE.DefineIcon("tableRemove",{NAME:"trash"}),Z.FE.RegisterCommand("tableRemove",{title:"Remove Table",focus:!1,callback:function(){this.table.remove()}}),Z.FE.DefineIcon("tableStyle",{NAME:"paint-brush"}),Z.FE.RegisterCommand("tableStyle",{title:"Table Style",type:"dropdown",focus:!1,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.tableStyles;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableStyle" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell").closest("table"),this.opts.tableMultipleStyles,this.opts.tableStyles)},refreshOnShow:function(e,t){var l=this.$el.find(".fr-selected-cell").closest("table");l&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=l.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.DefineIcon("tableCellBackground",{NAME:"tint"}),Z.FE.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),Z.FE.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),Z.FE.DefineIcon("tableBack",{NAME:"arrow-left"}),Z.FE.RegisterCommand("tableBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.table.back()},refresh:function(e){0!==this.table.selectedCells().length||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Z.FE.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v"}),Z.FE.RegisterCommand("tableCellVerticalAlign",{type:"dropdown",focus:!1,title:"Vertical Align",options:{Top:"Align Top",Middle:"Align Middle",Bottom:"Align Bottom"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Z.FE.COMMANDS.tableCellVerticalAlign.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellVerticalAlign" data-param1="'+l.toLowerCase()+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(l)+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.verticalAlign(t)},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.$el.find(".fr-selected-cell").css("vertical-align")+'"]').addClass("fr-active").attr("aria-selected",!0)}}),Z.FE.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left"}),Z.FE.DefineIcon("align-left",{NAME:"align-left"}),Z.FE.DefineIcon("align-right",{NAME:"align-right"}),Z.FE.DefineIcon("align-center",{NAME:"align-center"}),Z.FE.DefineIcon("align-justify",{NAME:"align-justify"}),Z.FE.RegisterCommand("tableCellHorizontalAlign",{type:"dropdown",focus:!1,title:"Horizontal Align",options:{left:"Align Left",center:"Align Center",right:"Align Right",justify:"Align Justify"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Z.FE.COMMANDS.tableCellHorizontalAlign.options;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="tableCellHorizontalAlign" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.icon.create("align-"+l)+'<span class="fr-sr-only">'+this.language.translate(t[l])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.table.horizontalAlign(t)},refresh:function(e){var t=this.table.selectedCells();t.length&&e.find("> *:first").replaceWith(this.icon.create("align-"+this.helpers.getAlignment(Z(t[0]))))},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.helpers.getAlignment(this.$el.find(".fr-selected-cell:first"))+'"]').addClass("fr-active").attr("aria-selected",!0)}}),Z.FE.DefineIcon("tableCellStyle",{NAME:"magic"}),Z.FE.RegisterCommand("tableCellStyle",{title:"Cell Style",type:"dropdown",focus:!1,html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=this.opts.tableCellStyles;for(var l in t)t.hasOwnProperty(l)&&(e+='<li role="presentation"><a class="fr-command" tabIndex="-1" role="option" data-cmd="tableCellStyle" data-param1="'+l+'" title="'+this.language.translate(t[l])+'">'+this.language.translate(t[l])+"</a></li>");return e+="</ul>"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell"),this.opts.tableCellMultipleStyles,this.opts.tableCellStyles)},refreshOnShow:function(e,t){var l=this.$el.find(".fr-selected-cell:first");l&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=l.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),Z.FE.DefineIcon("tableColorRemove",{NAME:"eraser"})});
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * froala_editor v2.6.0 (https://www.froala.com/wysiwyg-editor)
2
+ * froala_editor v2.9.0 (https://www.froala.com/wysiwyg-editor)
3
3
  * License https://froala.com/wysiwyg-editor/terms/
4
- * Copyright 2014-2017 Froala Labs
4
+ * Copyright 2014-2018 Froala Labs
5
5
  */
6
6
 
7
- !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c)}:a(window.jQuery)}(function(a){a.extend(a.FE.DEFAULTS,{}),a.FE.URLRegEx="(^| |\\u00A0)((https?:\\/\\/(www\\.)?)?(([-a-zA-Z0-9@:%_\\+~#=]{2,256}\\.[a-z]{2,6}\\b((\\.?[-a-zA-Z0-9@:%_\\+~#?&/=]{1,})*))|([\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}([-a-zA-Z0-9@:%_\\+~#?&/=]*))))$",a.FE.PLUGINS.url=function(b){function c(a,c,d){var e=d;return/^((http|https|ftp|ftps)\:\/\/)/i.test(e)||(e="//"+e),(c?c:"")+"<a"+(b.opts.linkAlwaysBlank?' target="_blank"':"")+(h?' rel="'+h+'"':"")+' href="'+e+'">'+d+"</a>"}function d(){return new RegExp(a.FE.URLRegEx,"gi")}function e(a){return b.opts.linkAlwaysNoFollow&&(h="nofollow"),b.opts.linkAlwaysBlank&&(h?h+=" noopener noreferrer":h="noopener noreferrer"),a.replace(d(),c)}function f(){var c=b.selection.ranges(0),f=c.startContainer;if(!f||f.nodeType!==Node.TEXT_NODE)return!1;if(d().test(f.textContent))a(f).before(e(f.textContent)),f.parentNode.removeChild(f);else if(f.previousSibling&&"A"===f.previousSibling.tagName){var g=f.previousSibling.innerText+f.textContent;d().test(g)&&(a(f.previousSibling).replaceWith(e(g)),f.parentNode.removeChild(f))}}function g(){b.events.on("paste.afterCleanup",function(b){if(new RegExp(a.FE.URLRegEx,"gi").test(b))return e(b)}),b.events.on("keydown",function(b){var c=b.which;c!=a.FE.KEYCODE.ENTER&&c!=a.FE.KEYCODE.SPACE&&c!=a.FE.KEYCODE.PERIOD||f()},!0),b.events.on("keydown",function(c){var d=c.which;if(d==a.FE.KEYCODE.ENTER){var e=b.selection.element();if(("A"==e.tagName||a(e).parents("a").length)&&b.selection.info(e).atEnd)return c.stopImmediatePropagation(),"A"!==e.tagName&&(e=a(e).parents("a")[0]),a(e).after("&nbsp;"+a.FE.MARKERS),b.selection.restore(),!1}})}var h=null;return{_init:g}}});
7
+ !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=function(e,n){return n===undefined&&(n="undefined"!=typeof window?require("jquery"):require("jquery")(e)),t(n)}:t(window.jQuery)}(function(f){f.FE.URLRegEx="(^| |\\u00A0)("+f.FE.LinkRegEx+"|([a-z0-9+-_.]{1,}@[a-z0-9+-_.]{1,}\\.[a-z0-9+-_]{1,}))$",f.FE.PLUGINS.url=function(i){var l=null;function n(e,n,t){for(var r="";t.length&&"."==t[t.length-1];)r+=".",t=t.substring(0,t.length-1);var o=t;if(i.opts.linkConvertEmailAddress)i.helpers.isEmail(o)&&!/^mailto:.*/i.test(o)&&(o="mailto:"+o);else if(i.helpers.isEmail(o))return n+t;return/^((http|https|ftp|ftps|mailto|tel|sms|notes|data)\:)/i.test(o)||(o="//"+o),(n||"")+"<a"+(i.opts.linkAlwaysBlank?' target="_blank"':"")+(l?' rel="'+l+'"':"")+' data-fr-linked="true" href="'+o+'">'+t.replace(/&amp;/g,"&").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")+"</a>"+r}function a(){return new RegExp(f.FE.URLRegEx,"gi")}function s(e){return i.opts.linkAlwaysNoFollow&&(l="nofollow"),i.opts.linkAlwaysBlank&&(i.opts.linkNoOpener&&(l?l+=" noopener":l="noopener"),i.opts.linkNoReferrer&&(l?l+=" noreferrer":l="noreferrer")),e.replace(a(),n)}function p(e){var n=e.split(" ");return n[n.length-1]}function t(){var n=i.selection.ranges(0),t=n.startContainer;if(!t||t.nodeType!==Node.TEXT_NODE||n.startOffset!==(t.textContent||"").length)return!1;if(function e(n){return!!n&&("A"===n.tagName||!(!n.parentNode||n.parentNode==i.el)&&e(n.parentNode))}(t))return!1;if(a().test(p(t.textContent))){f(t).before(s(t.textContent));var r=f(t.parentNode).find("a[data-fr-linked]");r.removeAttr("data-fr-linked"),t.parentNode.removeChild(t),i.events.trigger("url.linked",[r.get(0)])}else if(t.textContent.split(" ").length<=2&&t.previousSibling&&"A"===t.previousSibling.tagName){var o=t.previousSibling.innerText+t.textContent;a().test(p(o))&&(f(t.previousSibling).replaceWith(s(o)),t.parentNode.removeChild(t))}}return{_init:function(){i.events.on("keypress",function(e){!i.selection.isCollapsed()||"."!=e.key&&")"!=e.key&&"("!=e.key||t()},!0),i.events.on("keydown",function(e){var n=e.which;!i.selection.isCollapsed()||n!=f.FE.KEYCODE.ENTER&&n!=f.FE.KEYCODE.SPACE||t()},!0),i.events.on("paste.beforeCleanup",function(e){if(i.helpers.isURL(e)){var n=null;return i.opts.linkAlwaysBlank&&(i.opts.linkNoOpener&&(n?n+=" noopener":n="noopener"),i.opts.linkNoReferrer&&(n?n+=" noreferrer":n="noreferrer")),"<a"+(i.opts.linkAlwaysBlank?' target="_blank"':"")+(n?' rel="'+n+'"':"")+' href="'+e+'" >'+e+"</a>"}})}}}});
@@ -1,8 +1,7 @@
1
1
  /*!
2
- * froala_editor v2.6.0 (https://www.froala.com/wysiwyg-editor)
2
+ * froala_editor v2.9.0 (https://www.froala.com/wysiwyg-editor)
3
3
  * License https://froala.com/wysiwyg-editor/terms/
4
- * Copyright 2014-2017 Froala Labs
4
+ * Copyright 2014-2018 Froala Labs
5
5
  */
6
6
 
7
- !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c)}:a(window.jQuery)}(function(a){a.extend(a.FE.POPUP_TEMPLATES,{"video.insert":"[_BUTTONS_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_LAYER_][_PROGRESS_BAR_]","video.edit":"[_BUTTONS_]","video.size":"[_BUTTONS_][_SIZE_LAYER_]"}),a.extend(a.FE.DEFAULTS,{videoAllowedTypes:["mp4","webm","ogg"],videoAllowedProviders:[".*"],videoDefaultAlign:"center",videoDefaultDisplay:"block",videoDefaultWidth:600,videoEditButtons:["videoReplace","videoRemove","|","videoDisplay","videoAlign","videoSize"],videoInsertButtons:["videoBack","|","videoByURL","videoEmbed","videoUpload"],videoMaxSize:52428800,videoMove:!0,videoResize:!0,videoSizeButtons:["videoBack","|"],videoSplitHTML:!1,videoTextNear:!0,videoUploadMethod:"POST",videoUploadParam:"file",videoUploadParams:{},videoUploadToS3:!1,videoUploadURL:"https://i.froala.com/upload"}),a.FE.VIDEO_PROVIDERS=[{test_regex:/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/)?([0-9a-zA-Z_\-]+)(.+)?/g,url_text:"//www.youtube.com/embed/$1",html:'<iframe width="640" height="360" src="{url}?wmode=opaque" frameborder="0" allowfullscreen></iframe>',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i,url_text:"//player.vimeo.com/video/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"//www.dailymotion.com/embed/video/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'<iframe width="640" height="360" src="{url}?format=embed" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"//rutube.ru/play/embed/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&\/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&\/]+)\/?(?:[^_.&]+)?/g,url_text:"//play.vidyard.com/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vidyard"}],a.FE.VIDEO_EMBED_REGEX=/^\W*((<iframe.*><\/iframe>)|(<embed.*>))\W*$/i,a.FE.PLUGINS.video=function(b){function c(){var a=b.popups.get("video.insert"),c=a.find(".fr-video-by-url-layer input");c.val("").trigger("change");var d=a.find(".fr-video-embed-layer textarea");d.val("").trigger("change"),d=a.find(".fr-video-upload-layer input"),d.val("").trigger("change")}function d(){var a=b.$tb.find('.fr-command[data-cmd="insertVideo"]'),c=b.popups.get("video.insert");if(c||(c=f()),o(),!c.hasClass("fr-active")){b.popups.refresh("video.insert"),b.popups.setContainer("video.insert",b.$tb);var d=a.offset().left+a.outerWidth()/2,e=a.offset().top+(b.opts.toolbarBottom?10:a.outerHeight()-10);b.popups.show("video.insert",d,e,a.outerHeight())}}function e(){var a=b.popups.get("video.edit");if(a||(a=T()),a){b.popups.setContainer("video.edit",b.$sc),b.popups.refresh("video.edit");var c=ra.find("iframe, embed, video"),d=c.offset().left+c.outerWidth()/2,e=c.offset().top+c.outerHeight();b.popups.show("video.edit",d,e,c.outerHeight())}}function f(a){if(a)return b.popups.onRefresh("video.insert",c),b.popups.onHide("image.insert",ea),!0;var d="";b.opts.videoInsertButtons.length>1&&(d='<div class="fr-buttons">'+b.button.buildList(b.opts.videoInsertButtons)+"</div>");var e,f="",g=b.opts.videoInsertButtons.indexOf("videoUpload"),h=b.opts.videoInsertButtons.indexOf("videoByURL"),i=b.opts.videoInsertButtons.indexOf("videoEmbed");h>=0&&(e=" fr-active",(h>g&&g>=0||h>i&&i>=0)&&(e=""),f='<div class="fr-video-by-url-layer fr-layer'+e+'" id="fr-video-by-url-layer-'+b.id+'"><div class="fr-input-line"><input id="fr-video-by-url-layer-text-'+b.id+'" type="text" placeholder="http://" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertByURL" tabIndex="2" role="button">'+b.language.translate("Insert")+"</button></div></div>");var j="";i>=0&&(e=" fr-active",(i>g&&g>=0||i>h&&h>=0)&&(e=""),j='<div class="fr-video-embed-layer fr-layer'+e+'" id="fr-video-embed-layer-'+b.id+'"><div class="fr-input-line"><textarea id="fr-video-embed-layer-text'+b.id+'" type="text" placeholder="'+b.language.translate("Embedded Code")+'" tabIndex="1" aria-required="true" rows="5"></textarea></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertEmbed" tabIndex="2" role="button">'+b.language.translate("Insert")+"</button></div></div>");var k="";g>=0&&(e=" fr-active",(g>i&&i>=0||g>h&&h>=0)&&(e=""),k='<div class="fr-video-upload-layer fr-layer'+e+'" id="fr-video-upload-layer-'+b.id+'"><strong>'+b.language.translate("Drop video")+"</strong><br>("+b.language.translate("or click")+')<div class="fr-form"><input type="file" accept="video/'+b.opts.videoAllowedTypes.join(", video/").toLowerCase()+'" tabIndex="-1" aria-labelledby="fr-video-upload-layer-'+b.id+'" role="button"></div></div>');var l='<div class="fr-video-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="videoDismissError" tabIndex="2" role="button">OK</button></div></div>',m={buttons:d,by_url_layer:f,embed_layer:j,upload_layer:k,progress_bar:l},n=b.popups.create("video.insert",m);return Q(n),n}function g(a){var c,d,e=b.popups.get("video.insert");if(!ra&&!b.opts.toolbarInline){var f=b.$tb.find('.fr-command[data-cmd="insertVideo"]');c=f.offset().left+f.outerWidth()/2,d=f.offset().top+(b.opts.toolbarBottom?10:f.outerHeight()-10)}b.opts.toolbarInline&&(d=e.offset().top-b.helpers.getPX(e.css("margin-top")),e.hasClass("fr-above")&&(d+=e.outerHeight())),e.find(".fr-layer").removeClass("fr-active"),e.find(".fr-"+a+"-layer").addClass("fr-active"),b.popups.show("video.insert",c,d,0),b.accessibility.focusPopup(e)}function h(a){var c=b.popups.get("video.insert");c.find(".fr-video-by-url-layer").hasClass("fr-active")&&a.addClass("fr-active").attr("aria-pressed",!0)}function i(a){var c=b.popups.get("video.insert");c.find(".fr-video-embed-layer").hasClass("fr-active")&&a.addClass("fr-active").attr("aria-pressed",!0)}function j(a){var c=b.popups.get("video.insert");c.find(".fr-video-upload-layer").hasClass("fr-active")&&a.addClass("fr-active").attr("aria-pressed",!0)}function k(a){b.events.focus(!0),b.selection.restore();var c=!1;ra&&(da(),c=!0),b.html.insert('<span contenteditable="false" draggable="true" class="fr-jiv fr-video">'+a+"</span>",!1,b.opts.videoSplitHTML),b.popups.hide("video.insert");var d=b.$el.find(".fr-jiv");d.removeClass("fr-jiv"),fa(d,b.opts.videoDefaultDisplay,b.opts.videoDefaultAlign),d.toggleClass("fr-draggable",b.opts.videoMove),b.events.trigger(c?"video.replaced":"video.inserted",[d])}function l(){var c=a(this);b.popups.hide("video.insert"),c.removeClass("fr-uploading"),c.parent().next().is("br")&&c.parent().next().remove(),t(c.parent()),b.events.trigger("video.loaded",[c.parent()])}function m(a,c,d,e,f){b.edit.off(),p("Loading video"),c&&(a=b.helpers.sanitizeURL(a));var g=document.createElement("video");g.oncanplay=function(){var c,g;if(e){b.undo.canDo()||e.find("video").hasClass("fr-uploading")||b.undo.saveStep();var h=e.find("video").data("fr-old-src"),i=e.data("fr-replaced");e.data("fr-replaced",!1),b.$wp?(c=e.clone(),c.find("video").removeData("fr-old-src").removeClass("fr-uploading"),c.find("video").off("canplay"),h&&e.find("video").attr("src",h),e.replaceWith(c)):c=e;for(var j=c.find("video").get(0).attributes,k=0;k<j.length;k++){var m=j[k];0===m.nodeName.indexOf("data-")&&c.find("video").removeAttr(m.nodeName)}if("undefined"!=typeof d)for(g in d)d.hasOwnProperty(g)&&"link"!=g&&c.find("video").attr("data-"+g,d[g]);c.find("video").on("canplay",l),c.find("video").attr("src",a),b.edit.on(),H(),b.undo.saveStep(),b.$el.blur(),b.events.trigger(i?"video.replaced":"video.inserted",[c,f])}else c=A(a,d,l),H(),b.undo.saveStep(),b.events.trigger("video.inserted",[c,f])},g.onerror=function(){S(sa)},n("Loading video"),g.src=a}function n(a){var c=b.popups.get("video.insert");if(c||(c=f()),c.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),c.find(".fr-video-progress-bar-layer").addClass("fr-active"),c.find(".fr-buttons").hide(),ra){var d=ra.find("video");b.popups.setContainer("video.insert",b.$sc);var e=d.offset().left+d.width()/2,g=d.offset().top+d.height();b.popups.show("video.insert",e,g,d.outerHeight())}"undefined"==typeof a&&p("Uploading",0)}function o(a){var c=b.popups.get("video.insert");if(c&&(c.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),c.find(".fr-video-progress-bar-layer").removeClass("fr-active"),c.find(".fr-buttons").show(),a||b.$el.find("video.fr-error").length)){if(b.events.focus(),b.$el.find("video.fr-error").length&&(b.$el.find("video.fr-error").parent().remove(),b.undo.saveStep(),b.undo.run(),b.undo.dropRedo()),!b.$wp&&ra){var d=ra;K(!0),b.selection.setAfter(d.find("video").get(0)),b.selection.restore()}b.popups.hide("video.insert")}}function p(a,c){var d=b.popups.get("video.insert");if(d){var e=d.find(".fr-video-progress-bar-layer");e.find("h3").text(a+(c?" "+c+"%":"")),e.removeClass("fr-error"),c?(e.find("div").removeClass("fr-indeterminate"),e.find("div > span").css("width",c+"%")):e.find("div").addClass("fr-indeterminate")}}function q(a){n();var c=b.popups.get("video.insert"),d=c.find(".fr-video-progress-bar-layer");d.addClass("fr-error");var e=d.find("h3");e.text(a),b.events.disableBlur(),e.focus()}function r(c){if("undefined"==typeof c){var d=b.popups.get("video.insert");c=d.find('.fr-video-by-url-layer input[type="text"]').val()||""}var e=null;if(b.helpers.isURL(c))for(var f=0;f<a.FE.VIDEO_PROVIDERS.length;f++){var g=a.FE.VIDEO_PROVIDERS[f];if(g.test_regex.test(c)&&new RegExp(b.opts.videoAllowedProviders.join("|")).test(g.provider)){e=c.replace(g.url_regex,g.url_text),e=g.html.replace(/\{url\}/,e);break}}e?k(e):b.events.trigger("video.linkError",[c])}function s(c){if("undefined"==typeof c){var d=b.popups.get("video.insert");c=d.find(".fr-video-embed-layer textarea").val()||""}0!==c.length&&a.FE.VIDEO_EMBED_REGEX.test(c)?k(c):b.events.trigger("video.codeError",[c])}function t(a){J.call(a.get(0))}function u(c){try{if(b.events.trigger("video.uploaded",[c],!0)===!1)return b.edit.on(),!1;var d=a.parseJSON(c);return d.link?d:(S(ta,c),!1)}catch(e){return S(va,c),!1}}function v(c){try{var d=a(c).find("Location").text(),e=a(c).find("Key").text();return b.events.trigger("video.uploadedToS3",[d,e,c],!0)===!1?(b.edit.on(),!1):d}catch(f){return S(va,c),!1}}function w(a){p("Loading video");var c=this.status,d=this.response,e=this.responseXML,f=this.responseText;try{if(b.opts.videoUploadToS3)if(201==c){var g=v(e);g&&m(g,!1,[],a,d||e)}else S(va,d||e);else if(c>=200&&c<300){var h=u(f);h&&m(h.link,!1,h,a,d||f)}else S(ua,d||f)}catch(i){S(va,d||f)}}function x(){S(va,this.response||this.responseText||this.responseXML)}function y(a){if(a.lengthComputable){var b=a.loaded/a.total*100|0;p("Uploading",b)}}function z(){b.edit.on(),o(!0)}function A(c,d,e){var f,g="";if(d&&"undefined"!=typeof d)for(f in d)d.hasOwnProperty(f)&&"link"!=f&&(g+=" data-"+f+'="'+d[f]+'"');var h=b.opts.videoDefaultWidth;h&&"auto"!=h&&(h+="px");var i=a('<span contenteditable="false" draggable="true" class="fr-video fr-dv'+b.opts.videoDefaultDisplay[0]+("center"!=b.opts.videoDefaultAlign?" fr-fv"+b.opts.videoDefaultAlign[0]:"")+'"><video src="'+c+'" '+g+(h?' style="width: '+h+';"':"")+'" controls>'+b.language.translate("Your browser does not support HTML5 video.")+"</video></span>");i.toggleClass("fr-draggable",b.opts.videoMove),i.find("video").on("canplay",e),b.edit.on(),b.events.focus(!0),b.selection.restore(),b.undo.saveStep(),b.opts.videoSplitHTML?b.markers.split():b.markers.insert();var j=b.$el.find(".fr-marker");return b.node.isLastSibling(j)&&j.parent().hasClass("fr-deletable")&&j.insertAfter(j.parent()),j.replaceWith(i),b.html.wrap(),b.selection.clear(),i}function B(c){if(!b.core.sameInstance(qa))return!0;c.preventDefault(),c.stopPropagation();var d=c.pageX||(c.originalEvent.touches?c.originalEvent.touches[0].pageX:null),e=c.pageY||(c.originalEvent.touches?c.originalEvent.touches[0].pageY:null);if(!d||!e)return!1;if("mousedown"==c.type){var f=b.$oel.get(0),g=f.ownerDocument,h=g.defaultView||g.parentWindow,i=h.location!=h.parent.location;i&&h.frameElement&&(d+=b.helpers.getPX(a(h.frameElement).offset().left)+h.frameElement.clientLeft,e=c.clientY+b.helpers.getPX(a(h.frameElement).offset().top)+h.frameElement.clientTop)}b.undo.canDo()||b.undo.saveStep(),pa=a(this),pa.data("start-x",d),pa.data("start-y",e),oa.show(),b.popups.hideAll(),M()}function C(a){if(!b.core.sameInstance(qa))return!0;if(pa){a.preventDefault();var c=a.pageX||(a.originalEvent.touches?a.originalEvent.touches[0].pageX:null),d=a.pageY||(a.originalEvent.touches?a.originalEvent.touches[0].pageY:null);if(!c||!d)return!1;var e=pa.data("start-x"),f=pa.data("start-y");pa.data("start-x",c),pa.data("start-y",d);var g=c-e,h=d-f,i=ra.find("iframe, embed, video"),j=i.width(),k=i.height();(pa.hasClass("fr-hnw")||pa.hasClass("fr-hsw"))&&(g=0-g),(pa.hasClass("fr-hnw")||pa.hasClass("fr-hne"))&&(h=0-h),i.css("width",j+g),i.css("height",k+h),i.removeAttr("width"),i.removeAttr("height"),I()}}function D(a){return!b.core.sameInstance(qa)||void(pa&&ra&&(a&&a.stopPropagation(),pa=null,oa.hide(),I(),e(),b.undo.saveStep()))}function E(a){return'<div class="fr-handler fr-h'+a+'"></div>'}function F(a,b,c,d){return a.pageX=b,a.pageY=b,B.call(this,a),a.pageX=a.pageX+c*Math.floor(Math.pow(1.1,d)),a.pageY=a.pageY+c*Math.floor(Math.pow(1.1,d)),C.call(this,a),D.call(this,a),++d}function G(){var c;if(b.shared.$video_resizer?(qa=b.shared.$video_resizer,oa=b.shared.$vid_overlay,b.events.on("destroy",function(){qa.removeClass("fr-active").appendTo(a("body:first"))},!0)):(b.shared.$video_resizer=a('<div class="fr-video-resizer"></div>'),qa=b.shared.$video_resizer,b.events.$on(qa,"mousedown",function(a){a.stopPropagation()},!0),b.opts.videoResize&&(qa.append(E("nw")+E("ne")+E("sw")+E("se")),b.shared.$vid_overlay=a('<div class="fr-video-overlay"></div>'),oa=b.shared.$vid_overlay,c=qa.get(0).ownerDocument,a(c).find("body:first").append(oa))),b.events.on("shared.destroy",function(){qa.html("").removeData().remove(),qa=null,b.opts.videoResize&&(oa.remove(),oa=null)},!0),b.helpers.isMobile()||b.events.$on(a(b.o_win),"resize.video",function(){K(!0)}),b.opts.videoResize){c=qa.get(0).ownerDocument,b.events.$on(qa,b._mousedown,".fr-handler",B),b.events.$on(a(c),b._mousemove,C),b.events.$on(a(c.defaultView||c.parentWindow),b._mouseup,D),b.events.$on(oa,"mouseleave",D);var d=1,e=null,f=0;b.events.on("keydown",function(c){if(ra){var g=navigator.userAgent.indexOf("Mac OS X")!=-1?c.metaKey:c.ctrlKey,h=c.which;(h!==e||c.timeStamp-f>200)&&(d=1),(h==a.FE.KEYCODE.EQUALS||b.browser.mozilla&&h==a.FE.KEYCODE.FF_EQUALS)&&g&&!c.altKey?d=F.call(this,c,1,1,d):(h==a.FE.KEYCODE.HYPHEN||b.browser.mozilla&&h==a.FE.KEYCODE.FF_HYPHEN)&&g&&!c.altKey&&(d=F.call(this,c,2,-1,d)),e=h,f=c.timeStamp}}),b.events.on("keyup",function(){d=1})}}function H(){var c,d=Array.prototype.slice.call(b.el.querySelectorAll("video")),e=[];for(c=0;c<d.length;c++)e.push(d[c].getAttribute("src")),a(d[c]).toggleClass("fr-draggable",b.opts.videoMove),""===d[c].getAttribute("class")&&d[c].removeAttribute("class"),""===d[c].getAttribute("style")&&d[c].removeAttribute("style");if(Aa)for(c=0;c<Aa.length;c++)e.indexOf(Aa[c].getAttribute("src"))<0&&b.events.trigger("video.removed",[a(Aa[c])]);Aa=d}function I(){qa||G(),(b.$wp||b.$sc).append(qa),qa.data("instance",b);var a=ra.find("iframe, embed, video");qa.css("top",(b.opts.iframe?a.offset().top-1:a.offset().top-b.$wp.offset().top-1)+b.$wp.scrollTop()).css("left",(b.opts.iframe?a.offset().left-1:a.offset().left-b.$wp.offset().left-1)+b.$wp.scrollLeft()).css("width",a.outerWidth()).css("height",a.height()).addClass("fr-active")}function J(c){if(c&&"touchend"==c.type&&Ba)return!0;if(c&&b.edit.isDisabled())return c.stopPropagation(),c.preventDefault(),!1;if(b.edit.isDisabled())return!1;for(var d=0;d<a.FE.INSTANCES.length;d++)a.FE.INSTANCES[d]!=b&&a.FE.INSTANCES[d].events.trigger("video.hideResizer");b.toolbar.disable(),b.helpers.isMobile()&&(b.events.disableBlur(),b.$el.blur(),b.events.enableBlur()),ra=a(this),a(this).addClass("fr-active"),b.opts.iframe&&b.size.syncIframe(),ka(),I(),e(),b.selection.clear(),b.button.bulkRefresh(),b.events.trigger("image.hideResizer")}function K(a){ra&&(N()||a===!0)&&(qa.removeClass("fr-active"),b.toolbar.enable(),ra.removeClass("fr-active"),ra=null,M())}function L(){b.shared.vid_exit_flag=!0}function M(){b.shared.vid_exit_flag=!1}function N(){return b.shared.vid_exit_flag}function O(c){var d=c.originalEvent.dataTransfer;if(d&&d.files&&d.files.length){var e=d.files[0];if(e&&e.type&&e.type.indexOf("video")!==-1){b.markers.remove(),b.markers.insertAtPoint(c.originalEvent),b.$el.find(".fr-marker").replaceWith(a.FE.MARKERS),b.popups.hideAll();var g=b.popups.get("video.insert");return g||(g=f()),b.popups.setContainer("video.insert",b.$sc),b.popups.show("video.insert",c.originalEvent.pageX,c.originalEvent.pageY),n(),b.opts.videoAllowedTypes.indexOf(e.type.replace(/video\//g,""))>=0?P(d.files):S(xa),c.preventDefault(),c.stopPropagation(),!1}}}function P(a){if("undefined"!=typeof a&&a.length>0){if(b.events.trigger("video.beforeUpload",[a])===!1)return!1;var c=a[0];if(c.size>b.opts.videoMaxSize)return S(wa),!1;if(b.opts.videoAllowedTypes.indexOf(c.type.replace(/video\//g,""))<0)return S(xa),!1;var d;if(b.drag_support.formdata&&(d=b.drag_support.formdata?new FormData:null),d){var e;if(b.opts.videoUploadToS3!==!1){d.append("key",b.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(c.name||"untitled")),d.append("success_action_status","201"),d.append("X-Requested-With","xhr"),d.append("Content-Type",c.type);for(e in b.opts.videoUploadToS3.params)b.opts.videoUploadToS3.params.hasOwnProperty(e)&&d.append(e,b.opts.videoUploadToS3.params[e])}for(e in b.opts.videoUploadParams)b.opts.videoUploadParams.hasOwnProperty(e)&&d.append(e,b.opts.videoUploadParams[e]);d.append(b.opts.videoUploadParam,c);var f=b.opts.videoUploadURL;b.opts.videoUploadToS3&&(f=b.opts.videoUploadToS3.uploadURL?b.opts.videoUploadToS3.uploadURL:"https://"+b.opts.videoUploadToS3.region+".amazonaws.com/"+b.opts.videoUploadToS3.bucket);var g=b.core.getXHR(f,b.opts.videoUploadMethod);g.onload=function(){w.call(g,ra)},g.onerror=x,g.upload.onprogress=y,g.onabort=z,n(),b.edit.off();var h=b.popups.get("video.insert");h&&h.off("abortUpload").on("abortUpload",function(){4!=g.readyState&&g.abort()}),g.send(d)}}}function Q(c){b.events.$on(c,"dragover dragenter",".fr-video-upload-layer",function(){return a(this).addClass("fr-drop"),!1}),b.events.$on(c,"dragleave dragend",".fr-video-upload-layer",function(){return a(this).removeClass("fr-drop"),!1}),b.events.$on(c,"drop",".fr-video-upload-layer",function(d){d.preventDefault(),d.stopPropagation(),a(this).removeClass("fr-drop");var e=d.originalEvent.dataTransfer;if(e&&e.files){var f=c.data("instance")||b;f.events.disableBlur(),f.video.upload(e.files),f.events.enableBlur()}}),b.events.$on(c,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var d=c.data("instance")||b;d.events.disableBlur(),c.find("input:focus").blur(),d.events.enableBlur(),d.video.upload(this.files)}a(this).val("")})}function R(){b.events.on("drop",O,!0),b.events.on("mousedown window.mousedown",L),b.events.on("window.touchmove",M),b.events.on("mouseup window.mouseup",K),b.events.on("commands.mousedown",function(a){a.parents(".fr-toolbar").length>0&&K()}),b.events.on("blur video.hideResizer commands.undo commands.redo element.dropped",function(){K(!0)})}function S(a,c){b.edit.on(),ra&&ra.find("video").addClass("fr-error"),q(b.language.translate("Something went wrong. Please try again.")),b.events.trigger("video.error",[{code:a,message:za[a]},c])}function T(){var a="";if(b.opts.videoEditButtons.length>0){a+='<div class="fr-buttons">',a+=b.button.buildList(b.opts.videoEditButtons),a+="</div>";var c={buttons:a},d=b.popups.create("video.edit",c);return b.events.$on(b.$wp,"scroll.video-edit",function(){ra&&b.popups.isVisible("video.edit")&&(b.events.disableBlur(),t(ra))}),d}return!1}function U(){if(ra){var a=b.popups.get("video.size"),c=ra.find("iframe, embed, video");a.find('input[name="width"]').val(c.get(0).style.width||c.attr("width")).trigger("change"),a.find('input[name="height"]').val(c.get(0).style.height||c.attr("height")).trigger("change")}}function V(){var a=b.popups.get("video.size");a||(a=W()),o(),b.popups.refresh("video.size"),b.popups.setContainer("video.size",b.$sc);var c=ra.find("iframe, embed, video"),d=c.offset().left+c.width()/2,e=c.offset().top+c.height();b.popups.show("video.size",d,e,c.height())}function W(a){if(a)return b.popups.onRefresh("video.size",U),!0;var c="";c='<div class="fr-buttons">'+b.button.buildList(b.opts.videoSizeButtons)+"</div>";var d="";d='<div class="fr-video-size-layer fr-layer fr-active" id="fr-video-size-layer-'+b.id+'"><div class="fr-video-group"><div class="fr-input-line"><input id="fr-video-size-layer-width-'+b.id+'" type="text" name="width" placeholder="'+b.language.translate("Width")+'" tabIndex="1"></div><div class="fr-input-line"><input id="fr-video-size-layer-height-'+b.id+'" type="text" name="height" placeholder="'+b.language.translate("Height")+'" tabIndex="1"></div></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoSetSize" tabIndex="2" role="button">'+b.language.translate("Update")+"</button></div></div>";var e={buttons:c,size_layer:d},f=b.popups.create("video.size",e);return b.events.$on(b.$wp,"scroll",function(){ra&&b.popups.isVisible("video.size")&&(b.events.disableBlur(),t(ra))}),f}function X(a){if("undefined"==typeof a&&(a=ra),a){if(a.hasClass("fr-fvl"))return"left";if(a.hasClass("fr-fvr"))return"right";if(a.hasClass("fr-dvb")||a.hasClass("fr-dvi"))return"center";if("block"==a.css("display")){if("left"==a.css("text-algin"))return"left";if("right"==a.css("text-align"))return"right"}else{if("left"==a.css("float"))return"left";if("right"==a.css("float"))return"right"}}return"center"}function Y(a){ra.removeClass("fr-fvr fr-fvl"),!b.opts.htmlUntouched&&b.opts.useClasses?"left"==a?ra.addClass("fr-fvl"):"right"==a&&ra.addClass("fr-fvr"):fa(ra,_(),a),ka(),I(),e(),b.selection.clear()}function Z(a){return!!ra&&void a.find("> *:first").replaceWith(b.icon.create("video-align-"+X()))}function $(a,b){ra&&b.find('.fr-command[data-param1="'+X()+'"]').addClass("fr-active").attr("aria-selected",!0)}function _(a){"undefined"==typeof a&&(a=ra);var b=a.css("float");return a.css("float","none"),"block"==a.css("display")?(a.css("float",""),a.css("float")!=b&&a.css("float",b),"block"):(a.css("float",""),a.css("float")!=b&&a.css("float",b),"inline")}function aa(a){ra.removeClass("fr-dvi fr-dvb"),!b.opts.htmlUntouched&&b.opts.useClasses?"inline"==a?ra.addClass("fr-dvi"):"block"==a&&ra.addClass("fr-dvb"):fa(ra,a,X()),ka(),I(),e(),b.selection.clear()}function ba(a,b){ra&&b.find('.fr-command[data-param1="'+_()+'"]').addClass("fr-active").attr("aria-selected",!0)}function ca(){var a=b.popups.get("video.insert");a||(a=f()),b.popups.isVisible("video.insert")||(o(),b.popups.refresh("video.insert"),b.popups.setContainer("video.insert",b.$sc));var c=ra.offset().left+ra.width()/2,d=ra.offset().top+ra.height();b.popups.show("video.insert",c,d,ra.outerHeight())}function da(){if(ra&&b.events.trigger("video.beforeRemove",[ra])!==!1){var a=ra;b.popups.hideAll(),K(!0),b.selection.setBefore(a.get(0))||b.selection.setAfter(a.get(0)),a.remove(),b.selection.restore(),b.html.fillEmptyBlocks(),b.events.trigger("video.removed",[a])}}function ea(){o()}function fa(a,c,d){!b.opts.htmlUntouched&&b.opts.useClasses?(a.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),a.addClass("fr-fv"+d[0]+" fr-dv"+c[0])):"inline"==c?(a.css({display:"inline-block"}),"center"==d?a.css({float:"none"}):"left"==d?a.css({float:"left"}):a.css({float:"right"})):(a.css({display:"block",clear:"both"}),"left"==d?a.css({textAlign:"left"}):"right"==d?a.css({textAlign:"right"}):a.css({textAlign:"center"}))}function ga(a){a.hasClass("fr-dvi")||a.hasClass("fr-dvb")||(a.addClass("fr-fv"+X(a)[0]),a.addClass("fr-dv"+_(a)[0]))}function ha(a){var b=a.hasClass("fr-dvb")?"block":a.hasClass("fr-dvi")?"inline":null,c=a.hasClass("fr-fvl")?"left":a.hasClass("fr-fvr")?"right":X(a);fa(a,b,c),a.removeClass("fr-dvb fr-dvi fr-fvr fr-fvl")}function ia(){b.$el.find("video").filter(function(){return 0===a(this).parents("span.fr-video").length}).wrap('<span class="fr-video" contenteditable="false"></span>'),b.$el.find("embed, iframe").filter(function(){if(b.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),a(this).parents("span.fr-video").length>0)return!1;for(var c=a(this).attr("src"),d=0;d<a.FE.VIDEO_PROVIDERS.length;d++){var e=a.FE.VIDEO_PROVIDERS[d];if(e.test_regex.test(c)&&new RegExp(b.opts.videoAllowedProviders.join("|")).test(e.provider))return!0}return!1}).map(function(){return 0===a(this).parents("object").length?this:a(this).parents("object").get(0)}).wrap('<span class="fr-video" contenteditable="false"></span>');for(var c=b.$el.find("span.fr-video, video"),d=0;d<c.length;d++){var e=a(c[d]);!b.opts.htmlUntouched&&b.opts.useClasses?(ga(e),b.opts.videoTextNear||e.removeClass("fr-dvi").addClass("fr-dvb")):b.opts.htmlUntouched||b.opts.useClasses||ha(e)}c.toggleClass("fr-draggable",b.opts.videoMove)}function ja(){R(),b.helpers.isMobile()&&(b.events.$on(b.$el,"touchstart","span.fr-video",function(){Ba=!1}),b.events.$on(b.$el,"touchmove",function(){Ba=!0})),b.events.on("html.set",ia),ia(),b.events.$on(b.$el,"mousedown","span.fr-video",function(a){a.stopPropagation()}),b.events.$on(b.$el,"click touchend","span.fr-video",J),b.events.on("keydown",function(c){var d=c.which;return!ra||d!=a.FE.KEYCODE.BACKSPACE&&d!=a.FE.KEYCODE.DELETE?ra&&d==a.FE.KEYCODE.ESC?(K(!0),c.preventDefault(),!1):ra&&d!=a.FE.KEYCODE.F10&&!b.keys.isBrowserAction(c)?(c.preventDefault(),!1):void 0:(c.preventDefault(),da(),!1)},!0),b.events.on("toolbar.esc",function(){if(ra)return b.events.disableBlur(),b.events.focus(),!1},!0),b.events.on("toolbar.focusEditor",function(){if(ra)return!1},!0),b.events.on("keydown",function(){b.$el.find("span.fr-video:empty").remove()}),f(!0),W(!0)}function ka(){if(ra){b.selection.clear();var a=b.doc.createRange();a.selectNode(ra.get(0));var c=b.selection.get();c.addRange(a)}}function la(){ra?(b.events.disableBlur(),ra.trigger("click")):(b.events.disableBlur(),b.selection.restore(),b.events.enableBlur(),b.popups.hide("video.insert"),b.toolbar.showInline())}function ma(a,c){if(ra){var d=b.popups.get("video.size"),e=ra.find("iframe, embed, video");e.css("width",a||d.find('input[name="width"]').val()),e.css("height",c||d.find('input[name="height"]').val()),e.get(0).style.width&&e.removeAttr("width"),e.get(0).style.height&&e.removeAttr("height"),d.find("input:focus").blur(),setTimeout(function(){ra.trigger("click")},b.helpers.isAndroid()?50:0)}}function na(){return ra}var oa,pa,qa,ra,sa=1,ta=2,ua=3,va=4,wa=5,xa=6,ya=7,za={};za[sa]="Video cannot be loaded from the passed link.",za[ta]="No link in upload response.",za[ua]="Error during file upload.",za[va]="Parsing response failed.",za[wa]="File is too large.",za[xa]="Video file type is invalid.",za[ya]="Files can be uploaded only to same domain in IE 8 and IE 9.";var Aa,Ba;return b.shared.vid_exit_flag=!1,{_init:ja,showInsertPopup:d,showLayer:g,refreshByURLButton:h,refreshEmbedButton:i,refreshUploadButton:j,upload:P,insertByURL:r,insertEmbed:s,insert:k,align:Y,refreshAlign:Z,refreshAlignOnShow:$,display:aa,refreshDisplayOnShow:ba,remove:da,hideProgressBar:o,showSizePopup:V,replace:ca,back:la,setSize:ma,get:na}},a.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),a.FE.DefineIcon("insertVideo",{NAME:"video-camera"}),a.FE.DefineIcon("videoByURL",{NAME:"link"}),a.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(a){this.video.refreshByURLButton(a)}}),a.FE.DefineIcon("videoEmbed",{NAME:"code"}),a.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(a){this.video.refreshEmbedButton(a)}}),a.FE.DefineIcon("videoUpload",{NAME:"upload"}),a.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(a){this.video.refreshUploadButton(a)}}),a.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),a.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),a.FE.DefineIcon("videoDisplay",{NAME:"star"}),a.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(a,b){this.video.display(b)},refresh:function(a){this.opts.videoTextNear||a.addClass("fr-hidden")},refreshOnShow:function(a,b){this.video.refreshDisplayOnShow(a,b)}}),a.FE.DefineIcon("video-align",{NAME:"align-left"}),a.FE.DefineIcon("video-align-left",{NAME:"align-left"}),a.FE.DefineIcon("video-align-right",{NAME:"align-right"}),a.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),a.FE.DefineIcon("videoAlign",{NAME:"align-center"}),a.FE.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var b='<ul class="fr-dropdown-list" role="presentation">',c=a.FE.COMMANDS.videoAlign.options;for(var d in c)c.hasOwnProperty(d)&&(b+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="videoAlign" data-param1="'+d+'" title="'+this.language.translate(c[d])+'">'+this.icon.create("video-align-"+d)+'<span class="fr-sr-only">'+this.language.translate(c[d])+"</span></a></li>");return b+="</ul>"},callback:function(a,b){this.video.align(b)},refresh:function(a){this.video.refreshAlign(a)},refreshOnShow:function(a,b){this.video.refreshAlignOnShow(a,b)}}),a.FE.DefineIcon("videoReplace",{NAME:"exchange"}),a.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),a.FE.DefineIcon("videoRemove",{NAME:"trash"}),a.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){
8
- this.video.remove()}}),a.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),a.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),a.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),a.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(a){var b=this.video.get();b||this.opts.toolbarInline?(a.removeClass("fr-hidden"),a.next(".fr-separator").removeClass("fr-hidden")):(a.addClass("fr-hidden"),a.next(".fr-separator").addClass("fr-hidden"))}}),a.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),a.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}})});
7
+ !function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t)}:i(window.jQuery)}(function(Z){Z.extend(Z.FE.POPUP_TEMPLATES,{"video.insert":"[_BUTTONS_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_LAYER_][_PROGRESS_BAR_]","video.edit":"[_BUTTONS_]","video.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Z.extend(Z.FE.DEFAULTS,{videoAllowedTypes:["mp4","webm","ogg"],videoAllowedProviders:[".*"],videoDefaultAlign:"center",videoDefaultDisplay:"block",videoDefaultWidth:600,videoEditButtons:["videoReplace","videoRemove","|","videoDisplay","videoAlign","videoSize"],videoInsertButtons:["videoBack","|","videoByURL","videoEmbed","videoUpload"],videoMaxSize:52428800,videoMove:!0,videoResize:!0,videoResponsive:!1,videoSizeButtons:["videoBack","|"],videoSplitHTML:!1,videoTextNear:!0,videoUpload:!0,videoUploadMethod:"POST",videoUploadParam:"file",videoUploadParams:{},videoUploadToS3:!1,videoUploadURL:null}),Z.FE.VIDEO_PROVIDERS=[{test_regex:/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/)?([0-9a-zA-Z_\-]+)(.+)?/g,url_text:"https://www.youtube.com/embed/$1",html:'<iframe width="640" height="360" src="{url}?wmode=opaque" frameborder="0" allowfullscreen></iframe>',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:https?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?(\/[a-zA-Z0-9_\-]+)?/i,url_text:"https://player.vimeo.com/video/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"https://www.dailymotion.com/embed/video/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'<iframe width="640" height="360" src="{url}?format=embed" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vidyard"}],Z.FE.VIDEO_EMBED_REGEX=/^\W*((<iframe.*><\/iframe>)|(<embed.*>))\W*$/i,Z.FE.PLUGINS.video=function(v){var a,f,p,u,o,i,l="https://i.froala.com/upload",d=2,c=3,h=4,g=5,m=6,r={};function b(){var e=v.popups.get("video.insert");e.find(".fr-video-by-url-layer input").val("").trigger("change");var t=e.find(".fr-video-embed-layer textarea");t.val("").trigger("change"),(t=e.find(".fr-video-upload-layer input")).val("").trigger("change")}function s(){var e=v.popups.get("video.edit");if(e||(e=function(){var e="";if(0<v.opts.videoEditButtons.length){v.opts.videoResponsive&&(v.opts.videoEditButtons.splice(v.opts.videoEditButtons.indexOf("videoSize"),1),v.opts.videoEditButtons.splice(v.opts.videoEditButtons.indexOf("videoDisplay"),1),v.opts.videoEditButtons.splice(v.opts.videoEditButtons.indexOf("videoAlign"),1)),e+='<div class="fr-buttons">',e+=v.button.buildList(v.opts.videoEditButtons);var t={buttons:e+="</div>"},i=v.popups.create("video.edit",t);return v.events.$on(v.$wp,"scroll.video-edit",function(){u&&v.popups.isVisible("video.edit")&&(v.events.disableBlur(),x(u))}),i}return!1}()),e){v.popups.setContainer("video.edit",v.$sc),v.popups.refresh("video.edit");var t=u.find("iframe, embed, video"),i=t.offset().left+t.outerWidth()/2,o=t.offset().top+t.outerHeight();v.popups.show("video.edit",i,o,t.outerHeight())}}function n(e){if(e)return v.popups.onRefresh("video.insert",b),v.popups.onHide("image.insert",j),!0;var t="";v.opts.videoUpload||v.opts.videoInsertButtons.splice(v.opts.videoInsertButtons.indexOf("videoUpload"),1),1<v.opts.videoInsertButtons.length&&(t='<div class="fr-buttons">'+v.button.buildList(v.opts.videoInsertButtons)+"</div>");var i,o="",r=v.opts.videoInsertButtons.indexOf("videoUpload"),s=v.opts.videoInsertButtons.indexOf("videoByURL"),n=v.opts.videoInsertButtons.indexOf("videoEmbed");0<=s&&(i=" fr-active",(r<s&&0<=r||n<s&&0<=n)&&(i=""),o='<div class="fr-video-by-url-layer fr-layer'+i+'" id="fr-video-by-url-layer-'+v.id+'"><div class="fr-input-line"><input id="fr-video-by-url-layer-text-'+v.id+'" type="text" placeholder="'+v.language.translate("Paste in a video URL")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertByURL" tabIndex="2" role="button">'+v.language.translate("Insert")+"</button></div></div>");var a="";0<=n&&(i=" fr-active",(r<n&&0<=r||s<n&&0<=s)&&(i=""),a='<div class="fr-video-embed-layer fr-layer'+i+'" id="fr-video-embed-layer-'+v.id+'"><div class="fr-input-line"><textarea id="fr-video-embed-layer-text'+v.id+'" type="text" placeholder="'+v.language.translate("Embedded Code")+'" tabIndex="1" aria-required="true" rows="5"></textarea></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoInsertEmbed" tabIndex="2" role="button">'+v.language.translate("Insert")+"</button></div></div>");var d="";0<=r&&(i=" fr-active",(n<r&&0<=n||s<r&&0<=s)&&(i=""),d='<div class="fr-video-upload-layer fr-layer'+i+'" id="fr-video-upload-layer-'+v.id+'"><strong>'+v.language.translate("Drop video")+"</strong><br>("+v.language.translate("or click")+')<div class="fr-form"><input type="file" accept="video/'+v.opts.videoAllowedTypes.join(", video/").toLowerCase()+'" tabIndex="-1" aria-labelledby="fr-video-upload-layer-'+v.id+'" role="button"></div></div>');var l={buttons:t,by_url_layer:o,embed_layer:a,upload_layer:d,progress_bar:'<div class="fr-video-progress-bar-layer fr-layer"><h3 tabIndex="-1" class="fr-message">Uploading</h3><div class="fr-loader"><span class="fr-progress"></span></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-dismiss" data-cmd="videoDismissError" tabIndex="2" role="button">OK</button></div></div>'},f=v.popups.create("video.insert",l);return function(o){v.events.$on(o,"dragover dragenter",".fr-video-upload-layer",function(){return Z(this).addClass("fr-drop"),!1},!0),v.events.$on(o,"dragleave dragend",".fr-video-upload-layer",function(){return Z(this).removeClass("fr-drop"),!1},!0),v.events.$on(o,"drop",".fr-video-upload-layer",function(e){e.preventDefault(),e.stopPropagation(),Z(this).removeClass("fr-drop");var t=e.originalEvent.dataTransfer;if(t&&t.files){var i=o.data("instance")||v;i.events.disableBlur(),i.video.upload(t.files),i.events.enableBlur()}},!0),v.helpers.isIOS()&&v.events.$on(o,"touchstart",'.fr-video-upload-layer input[type="file"]',function(){Z(this).trigger("click")},!0);v.events.$on(o,"change",'.fr-video-upload-layer input[type="file"]',function(){if(this.files){var e=o.data("instance")||v;e.events.disableBlur(),o.find("input:focus").blur(),e.events.enableBlur(),e.video.upload(this.files)}Z(this).val("")},!0)}(f),f}function y(e){v.events.focus(!0),v.selection.restore();var t=!1;u&&(K(),t=!0),v.html.insert('<span contenteditable="false" draggable="true" class="fr-jiv fr-video">'+e+"</span>",!1,v.opts.videoSplitHTML),v.popups.hide("video.insert");var i=v.$el.find(".fr-jiv");i.removeClass("fr-jiv"),i.toggleClass("fr-rv",v.opts.videoResponsive),W(i,v.opts.videoDefaultDisplay,v.opts.videoDefaultAlign),i.toggleClass("fr-draggable",v.opts.videoMove),v.events.trigger(t?"video.replaced":"video.inserted",[i])}function E(){var e=Z(this);v.popups.hide("video.insert"),e.removeClass("fr-uploading"),e.parent().next().is("br")&&e.parent().next().remove(),x(e.parent()),v.events.trigger("video.loaded",[e.parent()])}function w(a,e,d,l,f){v.edit.off(),_("Loading video"),e&&(a=v.helpers.sanitizeURL(a));C("Loading video"),function(){var e,t;if(l){v.undo.canDo()||l.find("video").hasClass("fr-uploading")||v.undo.saveStep();var i=l.find("video").data("fr-old-src"),o=l.data("fr-replaced");l.data("fr-replaced",!1),v.$wp?((e=l.clone()).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),i&&l.find("video").attr("src",i),l.replaceWith(e)):e=l;for(var r=e.find("video").get(0).attributes,s=0;s<r.length;s++){var n=r[s];0===n.nodeName.indexOf("data-")&&e.find("video").removeAttr(n.nodeName)}if(void 0!==d)for(t in d)d.hasOwnProperty(t)&&"link"!=t&&e.find("video").attr("data-"+t,d[t]);e.find("video").on("canplay",E),e.find("video").attr("src",a),v.edit.on(),F(),v.undo.saveStep(),v.$el.blur(),v.events.trigger(o?"video.replaced":"video.inserted",[e,f])}else e=function(e,t,i){var o,r="";if(t&&void 0!==t)for(o in t)t.hasOwnProperty(o)&&"link"!=o&&(r+=" data-"+o+'="'+t[o]+'"');var s=v.opts.videoDefaultWidth;s&&"auto"!=s&&(s+="px");var n=Z('<span contenteditable="false" draggable="true" class="fr-video fr-dv'+v.opts.videoDefaultDisplay[0]+("center"!=v.opts.videoDefaultAlign?" fr-fv"+v.opts.videoDefaultAlign[0]:"")+'"><video src="'+e+'" '+r+(s?' style="width: '+s+';" ':"")+" controls>"+v.language.translate("Your browser does not support HTML5 video.")+"</video></span>");n.toggleClass("fr-draggable",v.opts.videoMove),v.edit.on(),v.events.focus(!0),v.selection.restore(),v.undo.saveStep(),v.opts.videoSplitHTML?v.markers.split():v.markers.insert(),v.html.wrap();var a=v.$el.find(".fr-marker");return v.node.isLastSibling(a)&&a.parent().hasClass("fr-deletable")&&a.insertAfter(a.parent()),a.replaceWith(n),v.selection.clear(),n.find("video").get(0).readyState>n.find("video").get(0).HAVE_FUTURE_DATA||v.helpers.isIOS()?i.call(n.find("video").get(0)):n.find("video").on("canplaythrough load",i),n}(a,d,E),F(),v.undo.saveStep(),v.events.trigger("video.inserted",[e,f])}()}function C(e){var t=v.popups.get("video.insert");if(t||(t=n()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),u){var i=u.find("video");v.popups.setContainer("video.insert",v.$sc);var o=i.offset().left+i.width()/2,r=i.offset().top+i.height();v.popups.show("video.insert",o,r,i.outerHeight())}void 0===e&&_(v.language.translate("Uploading"),0)}function A(e){var t=v.popups.get("video.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-video-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||v.$el.find("video.fr-error").length)){if(v.events.focus(),v.$el.find("video.fr-error").length&&(v.$el.find("video.fr-error").parent().remove(),v.undo.saveStep(),v.undo.run(),v.undo.dropRedo()),!v.$wp&&u){var i=u;z(!0),v.selection.setAfter(i.find("video").get(0)),v.selection.restore()}v.popups.hide("video.insert")}}function _(e,t){var i=v.popups.get("video.insert");if(i){var o=i.find(".fr-video-progress-bar-layer");o.find("h3").text(e+(t?" "+t+"%":"")),o.removeClass("fr-error"),t?(o.find("div").removeClass("fr-indeterminate"),o.find("div > span").css("width",t+"%")):o.find("div").addClass("fr-indeterminate")}}function x(e){L.call(e.get(0))}function R(e){_("Loading video");var t=this.status,i=this.response,o=this.responseXML,r=this.responseText;try{if(v.opts.videoUploadToS3)if(201==t){var s=function(e){try{var t=Z(e).find("Location").text(),i=Z(e).find("Key").text();return!1===v.events.trigger("video.uploadedToS3",[t,i,e],!0)?(v.edit.on(),!1):t}catch(o){return N(h,e),!1}}(o);s&&w(s,!1,[],e,i||o)}else N(h,i||o);else if(200<=t&&t<300){var n=function(e){try{if(!1===v.events.trigger("video.uploaded",[e],!0))return v.edit.on(),!1;var t=JSON.parse(e);return t.link?t:(N(d,e),!1)}catch(i){return N(h,e),!1}}(r);n&&w(n.link,!1,n,e,i||r)}else N(c,i||r)}catch(a){N(h,i||r)}}function S(){N(h,this.response||this.responseText||this.responseXML)}function D(e){if(e.lengthComputable){var t=e.loaded/e.total*100|0;_(v.language.translate("Uploading"),t)}}function U(){v.edit.on(),A(!0)}function B(e){if(!v.core.sameInstance(p))return!0;e.preventDefault(),e.stopPropagation();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),i=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!i)return!1;if("mousedown"==e.type){var o=v.$oel.get(0).ownerDocument,r=o.defaultView||o.parentWindow,s=!1;try{s=r.location!=r.parent.location&&!(r.$&&r.$.FE)}catch(n){}s&&r.frameElement&&(t+=v.helpers.getPX(Z(r.frameElement).offset().left)+r.frameElement.clientLeft,i=e.clientY+v.helpers.getPX(Z(r.frameElement).offset().top)+r.frameElement.clientTop)}v.undo.canDo()||v.undo.saveStep(),(f=Z(this)).data("start-x",t),f.data("start-y",i),a.show(),v.popups.hideAll(),P()}function I(e){if(!v.core.sameInstance(p))return!0;if(f){e.preventDefault();var t=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null),i=e.pageY||(e.originalEvent.touches?e.originalEvent.touches[0].pageY:null);if(!t||!i)return!1;var o=f.data("start-x"),r=f.data("start-y");f.data("start-x",t),f.data("start-y",i);var s=t-o,n=i-r,a=u.find("iframe, embed, video"),d=a.width(),l=a.height();(f.hasClass("fr-hnw")||f.hasClass("fr-hsw"))&&(s=0-s),(f.hasClass("fr-hnw")||f.hasClass("fr-hne"))&&(n=0-n),a.css("width",d+s),a.css("height",l+n),a.removeAttr("width"),a.removeAttr("height"),O()}}function $(e){if(!v.core.sameInstance(p))return!0;f&&u&&(e&&e.stopPropagation(),f=null,a.hide(),O(),s(),v.undo.saveStep())}function t(e){return'<div class="fr-handler fr-h'+e+'"></div>'}function k(e,t,i,o){return e.pageX=t,e.pageY=t,B.call(this,e),e.pageX=e.pageX+i*Math.floor(Math.pow(1.1,o)),e.pageY=e.pageY+i*Math.floor(Math.pow(1.1,o)),I.call(this,e),$.call(this,e),++o}function F(){var e,t=Array.prototype.slice.call(v.el.querySelectorAll("video, .fr-video > *")),i=[];for(e=0;e<t.length;e++)i.push(t[e].getAttribute("src")),Z(t[e]).toggleClass("fr-draggable",v.opts.videoMove),""===t[e].getAttribute("class")&&t[e].removeAttribute("class"),""===t[e].getAttribute("style")&&t[e].removeAttribute("style");if(o)for(e=0;e<o.length;e++)i.indexOf(o[e].getAttribute("src"))<0&&v.events.trigger("video.removed",[Z(o[e])]);o=t}function O(){p||function(){var e;if(v.shared.$video_resizer?(p=v.shared.$video_resizer,a=v.shared.$vid_overlay,v.events.on("destroy",function(){p.removeClass("fr-active").appendTo(Z("body:first"))},!0)):(v.shared.$video_resizer=Z('<div class="fr-video-resizer"></div>'),p=v.shared.$video_resizer,v.events.$on(p,"mousedown",function(e){e.stopPropagation()},!0),v.opts.videoResize&&(p.append(t("nw")+t("ne")+t("sw")+t("se")),v.shared.$vid_overlay=Z('<div class="fr-video-overlay"></div>'),a=v.shared.$vid_overlay,e=p.get(0).ownerDocument,Z(e).find("body:first").append(a))),v.events.on("shared.destroy",function(){p.html("").removeData().remove(),p=null,v.opts.videoResize&&(a.remove(),a=null)},!0),v.helpers.isMobile()||v.events.$on(Z(v.o_win),"resize.video",function(){z(!0)}),v.opts.videoResize){e=p.get(0).ownerDocument,v.events.$on(p,v._mousedown,".fr-handler",B),v.events.$on(Z(e),v._mousemove,I),v.events.$on(Z(e.defaultView||e.parentWindow),v._mouseup,$),v.events.$on(a,"mouseleave",$);var o=1,r=null,s=0;v.events.on("keydown",function(e){if(u){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,i=e.which;(i!==r||200<e.timeStamp-s)&&(o=1),(i==Z.FE.KEYCODE.EQUALS||v.browser.mozilla&&i==Z.FE.KEYCODE.FF_EQUALS)&&t&&!e.altKey?o=k.call(this,e,1,1,o):(i==Z.FE.KEYCODE.HYPHEN||v.browser.mozilla&&i==Z.FE.KEYCODE.FF_HYPHEN)&&t&&!e.altKey&&(o=k.call(this,e,2,-1,o)),r=i,s=e.timeStamp}}),v.events.on("keyup",function(){o=1})}}(),(v.$wp||v.$sc).append(p),p.data("instance",v);var e=u.find("iframe, embed, video");p.css("top",(v.opts.iframe?e.offset().top-1:e.offset().top-v.$wp.offset().top-1)+v.$wp.scrollTop()).css("left",(v.opts.iframe?e.offset().left-1:e.offset().left-v.$wp.offset().left-1)+v.$wp.scrollLeft()).css("width",e.get(0).getBoundingClientRect().width).css("height",e.get(0).getBoundingClientRect().height).addClass("fr-active")}function L(e){if(e&&"touchend"==e.type&&i)return!0;if(e&&v.edit.isDisabled())return e.stopPropagation(),e.preventDefault(),!1;if(v.edit.isDisabled())return!1;for(var t=0;t<Z.FE.INSTANCES.length;t++)Z.FE.INSTANCES[t]!=v&&Z.FE.INSTANCES[t].events.trigger("video.hideResizer");v.toolbar.disable(),v.helpers.isMobile()&&(v.events.disableBlur(),v.$el.blur(),v.events.enableBlur()),v.$el.find(".fr-video.fr-active").removeClass("fr-active"),(u=Z(this)).addClass("fr-active"),v.opts.iframe&&v.size.syncIframe(),G(),O(),s(),v.selection.clear(),v.button.bulkRefresh(),v.events.trigger("image.hideResizer")}function z(e){u&&(v.shared.vid_exit_flag||!0===e)&&(p.removeClass("fr-active"),v.toolbar.enable(),u.removeClass("fr-active"),u=null,P())}function e(){v.shared.vid_exit_flag=!0}function P(){v.shared.vid_exit_flag=!1}function T(e){var t=e.originalEvent.dataTransfer;if(t&&t.files&&t.files.length){var i=t.files[0];if(i&&i.type&&-1!==i.type.indexOf("video")){if(!v.opts.videoUpload)return e.preventDefault(),e.stopPropagation(),!1;v.markers.remove(),v.markers.insertAtPoint(e.originalEvent),v.$el.find(".fr-marker").replaceWith(Z.FE.MARKERS),v.popups.hideAll();var o=v.popups.get("video.insert");return o||(o=n()),v.popups.setContainer("video.insert",v.$sc),v.popups.show("video.insert",e.originalEvent.pageX,e.originalEvent.pageY),C(),0<=v.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))?M(t.files):N(m),e.preventDefault(),e.stopPropagation(),!1}}}function M(e){if(void 0!==e&&0<e.length){if(!1===v.events.trigger("video.beforeUpload",[e]))return!1;var t,i=e[0];if((null===v.opts.videoUploadURL||v.opts.videoUploadURL==l)&&!v.opts.videoUploadToS3)return a=i,(d=new FileReader).addEventListener("load",function(){d.result;for(var e=atob(d.result.split(",")[1]),t=[],i=0;i<e.length;i++)t.push(e.charCodeAt(i));w(window.URL.createObjectURL(new Blob([new Uint8Array(t)],{type:a.type})),!1,null,u)},!1),C(),d.readAsDataURL(a),!1;if(i.size>v.opts.videoMaxSize)return N(g),!1;if(v.opts.videoAllowedTypes.indexOf(i.type.replace(/video\//g,""))<0)return N(m),!1;if(v.drag_support.formdata&&(t=v.drag_support.formdata?new FormData:null),t){var o;if(!1!==v.opts.videoUploadToS3)for(o in t.append("key",v.opts.videoUploadToS3.keyStart+(new Date).getTime()+"-"+(i.name||"untitled")),t.append("success_action_status","201"),t.append("X-Requested-With","xhr"),t.append("Content-Type",i.type),v.opts.videoUploadToS3.params)v.opts.videoUploadToS3.params.hasOwnProperty(o)&&t.append(o,v.opts.videoUploadToS3.params[o]);for(o in v.opts.videoUploadParams)v.opts.videoUploadParams.hasOwnProperty(o)&&t.append(o,v.opts.videoUploadParams[o]);t.append(v.opts.videoUploadParam,i);var r=v.opts.videoUploadURL;v.opts.videoUploadToS3&&(r=v.opts.videoUploadToS3.uploadURL?v.opts.videoUploadToS3.uploadURL:"https://"+v.opts.videoUploadToS3.region+".amazonaws.com/"+v.opts.videoUploadToS3.bucket);var s=v.core.getXHR(r,v.opts.videoUploadMethod);s.onload=function(){R.call(s,u)},s.onerror=S,s.upload.onprogress=D,s.onabort=U,C(),v.events.disableBlur(),v.edit.off(),v.events.enableBlur();var n=v.popups.get("video.insert");n&&n.off("abortUpload").on("abortUpload",function(){4!=s.readyState&&s.abort()}),s.send(t)}}var a,d}function N(e,t){v.edit.on(),u&&u.find("video").addClass("fr-error"),function(e){C();var t=v.popups.get("video.insert").find(".fr-video-progress-bar-layer");t.addClass("fr-error");var i=t.find("h3");i.text(e),v.events.disableBlur(),i.focus()}(v.language.translate("Something went wrong. Please try again.")),v.events.trigger("video.error",[{code:e,message:r[e]},t])}function V(){if(u){var e=v.popups.get("video.size"),t=u.find("iframe, embed, video");e.find('input[name="width"]').val(t.get(0).style.width||t.attr("width")).trigger("change"),e.find('input[name="height"]').val(t.get(0).style.height||t.attr("height")).trigger("change")}}function Y(e){if(e)return v.popups.onRefresh("video.size",V),!0;var t={buttons:'<div class="fr-buttons">'+v.button.buildList(v.opts.videoSizeButtons)+"</div>",size_layer:'<div class="fr-video-size-layer fr-layer fr-active" id="fr-video-size-layer-'+v.id+'"><div class="fr-video-group"><div class="fr-input-line"><input id="fr-video-size-layer-width-'+v.id+'" type="text" name="width" placeholder="'+v.language.translate("Width")+'" tabIndex="1"></div><div class="fr-input-line"><input id="fr-video-size-layer-height-'+v.id+'" type="text" name="height" placeholder="'+v.language.translate("Height")+'" tabIndex="1"></div></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="videoSetSize" tabIndex="2" role="button">'+v.language.translate("Update")+"</button></div></div>"},i=v.popups.create("video.size",t);return v.events.$on(v.$wp,"scroll",function(){u&&v.popups.isVisible("video.size")&&(v.events.disableBlur(),x(u))}),i}function H(e){if(void 0===e&&(e=u),e){if(e.hasClass("fr-fvl"))return"left";if(e.hasClass("fr-fvr"))return"right";if(e.hasClass("fr-dvb")||e.hasClass("fr-dvi"))return"center";if("block"==e.css("display")){if("left"==e.css("text-algin"))return"left";if("right"==e.css("text-align"))return"right"}else{if("left"==e.css("float"))return"left";if("right"==e.css("float"))return"right"}}return"center"}function X(e){void 0===e&&(e=u);var t=e.css("float");return e.css("float","none"),"block"==e.css("display")?(e.css("float",""),e.css("float")!=t&&e.css("float",t),"block"):(e.css("float",""),e.css("float")!=t&&e.css("float",t),"inline")}function K(){if(u&&!1!==v.events.trigger("video.beforeRemove",[u])){var e=u;v.popups.hideAll(),z(!0),v.selection.setBefore(e.get(0))||v.selection.setAfter(e.get(0)),e.remove(),v.selection.restore(),v.html.fillEmptyBlocks(),v.events.trigger("video.removed",[e])}}function j(){A()}function W(e,t,i){!v.opts.htmlUntouched&&v.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv"+i[0]+" fr-dv"+t[0])):"inline"==t?(e.css({display:"inline-block"}),"center"==i?e.css({"float":"none"}):"left"==i?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==i?e.css({textAlign:"left"}):"right"==i?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}function q(){v.$el.find("video").filter(function(){return 0===Z(this).parents("span.fr-video").length}).wrap('<span class="fr-video" contenteditable="false"></span>'),v.$el.find("embed, iframe").filter(function(){if(v.browser.safari&&this.getAttribute("src")&&this.setAttribute("src",this.src),0<Z(this).parents("span.fr-video").length)return!1;for(var e=Z(this).attr("src"),t=0;t<Z.FE.VIDEO_PROVIDERS.length;t++){var i=Z.FE.VIDEO_PROVIDERS[t];if(i.test_regex.test(e)&&new RegExp(v.opts.videoAllowedProviders.join("|")).test(i.provider))return!0}return!1}).map(function(){return 0===Z(this).parents("object").length?this:Z(this).parents("object").get(0)}).wrap('<span class="fr-video" contenteditable="false"></span>');for(var e,t,i=v.$el.find("span.fr-video, video"),o=0;o<i.length;o++){var r=Z(i[o]);!v.opts.htmlUntouched&&v.opts.useClasses?((t=r).hasClass("fr-dvi")||t.hasClass("fr-dvb")||(t.addClass("fr-fv"+H(t)[0]),t.addClass("fr-dv"+X(t)[0])),v.opts.videoTextNear||r.removeClass("fr-dvi").addClass("fr-dvb")):v.opts.htmlUntouched||v.opts.useClasses||(W(e=r,e.hasClass("fr-dvb")?"block":e.hasClass("fr-dvi")?"inline":null,e.hasClass("fr-fvl")?"left":e.hasClass("fr-fvr")?"right":H(e)),e.removeClass("fr-dvb fr-dvi fr-fvr fr-fvl"))}i.toggleClass("fr-draggable",v.opts.videoMove)}function G(){if(u){v.selection.clear();var e=v.doc.createRange();e.selectNode(u.get(0)),v.selection.get().addRange(e)}}return r[1]="Video cannot be loaded from the passed link.",r[d]="No link in upload response.",r[c]="Error during file upload.",r[h]="Parsing response failed.",r[g]="File is too large.",r[m]="Video file type is invalid.",r[7]="Files can be uploaded only to same domain in IE 8 and IE 9.",v.shared.vid_exit_flag=!1,{_init:function(){v.opts.videoResponsive&&(v.opts.videoResize=!1),v.events.on("drop",T,!0),v.events.on("mousedown window.mousedown",e),v.events.on("window.touchmove",P),v.events.on("mouseup window.mouseup",z),v.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&z()}),v.events.on("video.hideResizer commands.undo commands.redo element.dropped",function(){z(!0)}),v.helpers.isMobile()&&(v.events.$on(v.$el,"touchstart","span.fr-video",function(){i=!1}),v.events.$on(v.$el,"touchmove",function(){i=!0})),v.events.on("html.set",q),q(),v.events.$on(v.$el,"mousedown","span.fr-video",function(e){e.stopPropagation(),(v.browser.msie||v.browser.edge)&&(e.target.dragDrop(),L.call(this,e))}),v.events.$on(v.$el,"click touchend","span.fr-video",function(e){if("false"==Z(this).parents("[contenteditable]:not(.fr-element):not(.fr-img-caption):not(body):first").attr("contenteditable"))return!0;L.call(this,e)}),v.events.on("keydown",function(e){var t=e.which;return!u||t!=Z.FE.KEYCODE.BACKSPACE&&t!=Z.FE.KEYCODE.DELETE?u&&t==Z.FE.KEYCODE.ESC?(z(!0),e.preventDefault(),!1):u&&t!=Z.FE.KEYCODE.F10&&!v.keys.isBrowserAction(e)?(e.preventDefault(),!1):void 0:(e.preventDefault(),K(),v.undo.saveStep(),!1)},!0),v.events.on("toolbar.esc",function(){if(u)return v.events.disableBlur(),v.events.focus(),!1},!0),v.events.on("toolbar.focusEditor",function(){if(u)return!1},!0),v.events.on("keydown",function(){v.$el.find("span.fr-video:empty").remove()}),v.$wp&&(F(),v.events.on("contentChanged",F)),n(!0),Y(!0)},showInsertPopup:function(){var e=v.$tb.find('.fr-command[data-cmd="insertVideo"]'),t=v.popups.get("video.insert");if(t||(t=n()),A(),!t.hasClass("fr-active"))if(v.popups.refresh("video.insert"),v.popups.setContainer("video.insert",v.$tb),e.is(":visible")){var i=e.offset().left+e.outerWidth()/2,o=e.offset().top+(v.opts.toolbarBottom?10:e.outerHeight()-10);v.popups.show("video.insert",i,o,e.outerHeight())}else v.position.forSelection(t),v.popups.show("video.insert")},showLayer:function(e){var t,i,o=v.popups.get("video.insert");if(!u&&!v.opts.toolbarInline){var r=v.$tb.find('.fr-command[data-cmd="insertVideo"]');t=r.offset().left+r.outerWidth()/2,i=r.offset().top+(v.opts.toolbarBottom?10:r.outerHeight()-10)}v.opts.toolbarInline&&(i=o.offset().top-v.helpers.getPX(o.css("margin-top")),o.hasClass("fr-above")&&(i+=o.outerHeight())),o.find(".fr-layer").removeClass("fr-active"),o.find(".fr-"+e+"-layer").addClass("fr-active"),v.popups.show("video.insert",t,i,0),v.accessibility.focusPopup(o)},refreshByURLButton:function(e){v.popups.get("video.insert").find(".fr-video-by-url-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshEmbedButton:function(e){v.popups.get("video.insert").find(".fr-video-embed-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},refreshUploadButton:function(e){v.popups.get("video.insert").find(".fr-video-upload-layer").hasClass("fr-active")&&e.addClass("fr-active").attr("aria-pressed",!0)},upload:M,insertByURL:function(e){void 0===e&&(e=(v.popups.get("video.insert").find('.fr-video-by-url-layer input[type="text"]').val()||"").trim());var t=null;if(/^http/.test(e)||(e="https://"+e),v.helpers.isURL(e))for(var i=0;i<Z.FE.VIDEO_PROVIDERS.length;i++){var o=Z.FE.VIDEO_PROVIDERS[i];if(o.test_regex.test(e)&&new RegExp(v.opts.videoAllowedProviders.join("|")).test(o.provider)){t=e.replace(o.url_regex,o.url_text),t=o.html.replace(/\{url\}/,t);break}}t?y(t):v.events.trigger("video.linkError",[e])},insertEmbed:function(e){void 0===e&&(e=v.popups.get("video.insert").find(".fr-video-embed-layer textarea").val()||""),0!==e.length&&Z.FE.VIDEO_EMBED_REGEX.test(e)?y(e):v.events.trigger("video.codeError",[e])},insert:y,align:function(e){u.removeClass("fr-fvr fr-fvl"),!v.opts.htmlUntouched&&v.opts.useClasses?"left"==e?u.addClass("fr-fvl"):"right"==e&&u.addClass("fr-fvr"):W(u,X(),e),G(),O(),s(),v.selection.clear()},refreshAlign:function(e){if(!u)return!1;e.find("> *:first").replaceWith(v.icon.create("video-align-"+H()))},refreshAlignOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+H()+'"]').addClass("fr-active").attr("aria-selected",!0)},display:function(e){u.removeClass("fr-dvi fr-dvb"),!v.opts.htmlUntouched&&v.opts.useClasses?"inline"==e?u.addClass("fr-dvi"):"block"==e&&u.addClass("fr-dvb"):W(u,e,H()),G(),O(),s(),v.selection.clear()},refreshDisplayOnShow:function(e,t){u&&t.find('.fr-command[data-param1="'+X()+'"]').addClass("fr-active").attr("aria-selected",!0)},remove:K,hideProgressBar:A,showSizePopup:function(){var e=v.popups.get("video.size");e||(e=Y()),A(),v.popups.refresh("video.size"),v.popups.setContainer("video.size",v.$sc);var t=u.find("iframe, embed, video"),i=t.offset().left+t.width()/2,o=t.offset().top+t.height();v.popups.show("video.size",i,o,t.height())},replace:function(){var e=v.popups.get("video.insert");e||(e=n()),v.popups.isVisible("video.insert")||(A(),v.popups.refresh("video.insert"),v.popups.setContainer("video.insert",v.$sc));var t=u.offset().left+u.width()/2,i=u.offset().top+u.height();v.popups.show("video.insert",t,i,u.outerHeight())},back:function(){u?(v.events.disableBlur(),u.trigger("click")):(v.events.disableBlur(),v.selection.restore(),v.events.enableBlur(),v.popups.hide("video.insert"),v.toolbar.showInline())},setSize:function(e,t){if(u){var i=v.popups.get("video.size"),o=u.find("iframe, embed, video");o.css("width",e||i.find('input[name="width"]').val()),o.css("height",t||i.find('input[name="height"]').val()),o.get(0).style.width&&o.removeAttr("width"),o.get(0).style.height&&o.removeAttr("height"),i.find("input:focus").blur(),setTimeout(function(){u.trigger("click")},v.helpers.isAndroid()?50:0)}},get:function(){return u}}},Z.FE.RegisterCommand("insertVideo",{title:"Insert Video",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("video.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("video.insert")):this.video.showInsertPopup()},plugin:"video"}),Z.FE.DefineIcon("insertVideo",{NAME:"video-camera",FA5NAME:"camera"}),Z.FE.DefineIcon("videoByURL",{NAME:"link"}),Z.FE.RegisterCommand("videoByURL",{title:"By URL",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-by-url")},refresh:function(e){this.video.refreshByURLButton(e)}}),Z.FE.DefineIcon("videoEmbed",{NAME:"code"}),Z.FE.RegisterCommand("videoEmbed",{title:"Embedded Code",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-embed")},refresh:function(e){this.video.refreshEmbedButton(e)}}),Z.FE.DefineIcon("videoUpload",{NAME:"upload"}),Z.FE.RegisterCommand("videoUpload",{title:"Upload Video",undo:!1,focus:!1,toggle:!0,callback:function(){this.video.showLayer("video-upload")},refresh:function(e){this.video.refreshUploadButton(e)}}),Z.FE.RegisterCommand("videoInsertByURL",{undo:!0,focus:!0,callback:function(){this.video.insertByURL()}}),Z.FE.RegisterCommand("videoInsertEmbed",{undo:!0,focus:!0,callback:function(){this.video.insertEmbed()}}),Z.FE.DefineIcon("videoDisplay",{NAME:"star"}),Z.FE.RegisterCommand("videoDisplay",{title:"Display",type:"dropdown",options:{inline:"Inline",block:"Break Text"},callback:function(e,t){this.video.display(t)},refresh:function(e){this.opts.videoTextNear||e.addClass("fr-hidden")},refreshOnShow:function(e,t){this.video.refreshDisplayOnShow(e,t)}}),Z.FE.DefineIcon("video-align",{NAME:"align-left"}),Z.FE.DefineIcon("video-align-left",{NAME:"align-left"}),Z.FE.DefineIcon("video-align-right",{NAME:"align-right"}),Z.FE.DefineIcon("video-align-center",{NAME:"align-justify"}),Z.FE.DefineIcon("videoAlign",{NAME:"align-center"}),Z.FE.RegisterCommand("videoAlign",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"None",right:"Align Right"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Z.FE.COMMANDS.videoAlign.options;for(var i in t)t.hasOwnProperty(i)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="videoAlign" data-param1="'+i+'" title="'+this.language.translate(t[i])+'">'+this.icon.create("video-align-"+i)+'<span class="fr-sr-only">'+this.language.translate(t[i])+"</span></a></li>");return e+="</ul>"},callback:function(e,t){this.video.align(t)},refresh:function(e){this.video.refreshAlign(e)},refreshOnShow:function(e,t){this.video.refreshAlignOnShow(e,t)}}),Z.FE.DefineIcon("videoReplace",{NAME:"exchange",FA5NAME:"exchange-alt"}),Z.FE.RegisterCommand("videoReplace",{title:"Replace",undo:!1,focus:!1,popup:!0,refreshAfterCallback:!1,callback:function(){this.video.replace()}}),Z.FE.DefineIcon("videoRemove",{NAME:"trash"}),Z.FE.RegisterCommand("videoRemove",{title:"Remove",callback:function(){this.video.remove()}}),Z.FE.DefineIcon("videoSize",{NAME:"arrows-alt"}),Z.FE.RegisterCommand("videoSize",{undo:!1,focus:!1,popup:!0,title:"Change Size",callback:function(){this.video.showSizePopup()}}),Z.FE.DefineIcon("videoBack",{NAME:"arrow-left"}),Z.FE.RegisterCommand("videoBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.video.back()},refresh:function(e){this.video.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Z.FE.RegisterCommand("videoDismissError",{title:"OK",undo:!1,callback:function(){this.video.hideProgressBar(!0)}}),Z.FE.RegisterCommand("videoSetSize",{undo:!0,focus:!1,title:"Update",refreshAfterCallback:!1,callback:function(){this.video.setSize()}})});