/*!
* froala_editor v2.2.4 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2016 Froala Labs
*/
!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),c}:a(jQuery)}(function(a){"use strict";a.extend(a.FE.DEFAULTS,{dragInline:!0}),a.FE.PLUGINS.draggable=function(b){function c(c){return a(c.target).hasClass("fr-draggable")?(a(c.target).addClass("fr-dragging"),b.opts.dragInline?b.$el.attr("contenteditable",!0):b.$el.attr("contenteditable",!1),b.opts.toolbarInline&&b.toolbar.hide(),b.undo.canDo()||b.undo.saveStep(),b.browser.msie||b.browser.edge||b.selection.clear(),void c.originalEvent.dataTransfer.setData("text","Froala")):(c.preventDefault(),!1)}function d(a){return!(a&&("HTML"==a.tagName||"BODY"==a.tagName||b.node.isElement(a)))}function e(a,c,d){b.opts.iframe&&(a+=b.$iframe.offset().top,c+=b.$iframe.offset().left),m.offset().top!=a&&m.css("top",a),m.offset().left!=c&&m.css("left",c),m.width()!=d&&m.css("width",d)}function f(c){var f=b.doc.elementFromPoint(c.originalEvent.pageX-b.win.pageXOffset,c.originalEvent.pageY-b.win.pageYOffset);if(!d(f)){for(var g=0,h=f;!d(h)&&h==f&&c.originalEvent.pageY-b.win.pageYOffset-g>0;)g++,h=b.doc.elementFromPoint(c.originalEvent.pageX-b.win.pageXOffset,c.originalEvent.pageY-b.win.pageYOffset-g);(!d(h)||m&&0===b.$el.find(h).length&&h!=m.get(0))&&(h=null);for(var i=0,j=f;!d(j)&&j==f&&c.originalEvent.pageY-b.win.pageYOffset+ig?h:j:null}if(a(f).hasClass("fr-drag-helper"))return!1;if(f&&!b.node.isBlock(f)&&(f=b.node.blockParent(f)),f&&["TD","TH","TR","THEAD","TBODY"].indexOf(f.tagName)>=0&&(f=a(f).parents("table").get(0)),f&&["LI"].indexOf(f.tagName)>=0&&(f=a(f).parents("UL, OL").get(0)),f&&!a(f).hasClass("fr-drag-helper")){m||(a.FE.$draggable_helper||(a.FE.$draggable_helper=a('')),m=a.FE.$draggable_helper,b.events.on("shared.destroy",function(){m.html("").removeData().remove()},!0));var k,l=c.originalEvent.pageY;k=l0&&(o=parseFloat(n.prev().css("margin-bottom"))||0),o=Math.max(o,parseFloat(n.css("margin-top"))||0),e(n.offset().top-o/2-b.$box.offset().top,n.offset().left-b.win.pageXOffset-b.$box.offset().left,n.width()),m.data("fr-position","before"))):"after"==m.data("fr-position")&&n.is(m.data("fr-tag"))||(o=parseFloat(n.css("margin-bottom"))||0,e(n.offset().top+a(f).height()+o/2-b.$box.offset().top,n.offset().left-b.win.pageXOffset-b.$box.offset().left,n.width()),m.data("fr-position","after")),m.data("fr-tag",n),m.addClass("fr-visible"),m.appendTo(b.$box)}else m&&b.$box.find(m).length>0&&m.removeClass("fr-visible")}function g(a){a.originalEvent.dataTransfer.dropEffect="move",b.opts.dragInline?j()||!b.browser.msie&&!b.browser.edge||a.preventDefault():(a.preventDefault(),f(a))}function h(a){a.originalEvent.dataTransfer.dropEffect="move",b.opts.dragInline||a.preventDefault()}function i(a){b.$el.attr("contenteditable",!0);var c=b.$el.find(".fr-dragging");m&&m.hasClass("fr-visible")&&b.$box.find(m).length?k(a):c.length&&(a.preventDefault(),a.stopPropagation(),m&&!m.hasClass("fr-visible")&&c.removeClass("fr-dragging")),m&&b.$box.find(m).length&&m.removeClass("fr-visible")}function j(){for(var b=null,c=0;c'),m.removeClass("fr-visible");else{var g=b.markers.insertAtPoint(c.originalEvent);if(g===!1)return!1}if(b.popups.hideAll(),e==b||b.undo.canDo()||b.undo.saveStep(),b.core.isEmpty())b.$el.html(d);else{var h=b.$el.find(".fr-marker");h.replaceWith(d),d.after(a.FE.MARKERS),b.selection.restore()}return d.removeClass("fr-dragging"),b.$el.find(b.html.emptyBlockTagsQuery()).remove(),b.html.wrap(),b.undo.saveStep(),e!=b&&(e.popups.hideAll(),e.$el.find(b.html.emptyBlockTagsQuery()).remove(),e.html.wrap(),e.undo.saveStep(),e.events.trigger("element.dropped")),b.opts.iframe&&b.size.syncIframe(),b.events.trigger("element.dropped",[d]),!1}}function l(){b.opts.enter==a.FE.ENTER_BR&&(b.opts.dragInline=!0),b.events.on("dragstart",c,!0),b.events.on("dragover",g,!0),b.events.on("dragenter",h,!0),b.events.on("document.dragend",i,!0),b.events.on("document.drop",i,!0),b.events.on("drop",k,!0),b.events.on("html.get",function(a){return a=a.replace(/<(div)((?:[\w\W]*?))class="([\w\W]*?)fr-drag-helper([\w\W]*?)"((?:[\w\W]*?))>((?:[\w\W]*?))<\/(div)>/g,"")})}var m;return{_init:l}}});