!function(e,t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,t){"use strict";e.fn.mediabayResize||(e.fn.mediabayResize=function(t){var n={handleSelector:null,resizeWidth:!0,resizeHeight:!0,resizeWidthFrom:"right",resizeHeightFrom:"bottom",onDragStart:null,onDragEnd:null,onDrag:null,touchActionNone:!0,instanceId:null};return"object"==typeof t&&(n=e.extend(n,t)),this.each(function(){var o,i=e.extend({},n);i.instanceId||(i.instanceId="rsz_"+(new Date).getTime());var a,r=e(this);if("destroy"===t){if(!(i=r.data("resizable")))return;return(a=l(i.handleSelector,r)).off("mousedown."+i.instanceId+" touchstart."+i.instanceId),i.touchActionNone&&a.css("touch-action",""),void r.removeClass("resizable")}function c(e){e.stopPropagation(),e.preventDefault()}function s(e){var t,n,a=u(e);t="left"===i.resizeWidthFrom?o.width-a.x+o.x:o.width+a.x-o.x,n="top"===i.resizeHeightFrom?o.height-a.y+o.y:o.height+a.y-o.y,i.onDrag&&!1===i.onDrag(e,r,t,n,i)||(i.resizeHeight&&r.height(n),i.resizeWidth&&r.width(t))}function d(t){return t.stopPropagation(),t.preventDefault(),e(document).off("mousemove."+i.instanceId),e(document).off("mouseup."+i.instanceId),(window.Touch||navigator.maxTouchPoints)&&(e(document).off("touchmove."+i.instanceId),e(document).off("touchend."+i.instanceId)),e(document).off("selectstart."+i.instanceId,c),e("iframe").css("pointer-events","auto"),i.onDragEnd&&i.onDragEnd(t,r,i),function(){e(".mediabay_be_loader").addClass("active");var t={action:"mediabayAjaxUpdateSidebarWidth",width:e(".cc_mediabay_sidebar").width()};e.ajax({type:"POST",url:self.ajaxurl,cache:!0,data:t,success:function(){e(".mediabay_be_loader").removeClass("active")},error:function(t,n,o){console.log(o),console.log(n),console.log(t),e(".mediabay_be_loader").removeClass("active")}})}(),!1}function u(e){var t={x:0,y:0,width:0,height:0};if("number"==typeof e.clientX)t.x=e.clientX,t.y=e.clientY;else{if(!e.originalEvent.touches)return null;t.x=e.originalEvent.touches[0].clientX,t.y=e.originalEvent.touches[0].clientY}return t}function l(e,t){return e&&">"===e.trim()[0]?(e=e.trim().replace(/^>\s*/,""),t.find(e)):e?t.parent().find(e):t}r.data("resizable",i),a=l(i.handleSelector,r),i.touchActionNone&&a.css("touch-action","none"),r.addClass("resizable"),a.on("mousedown."+i.instanceId+" touchstart."+i.instanceId,function(t){t.preventDefault&&t.preventDefault();if((o=u(t)).width=parseInt(r.width(),10),o.height=parseInt(r.height(),10),r.css("transition"),i.onDragStart&&!1===i.onDragStart(t,r,i))return;e(document).on("mousemove."+i.instanceId,s),e(document).on("mouseup."+i.instanceId,d),(window.Touch||navigator.maxTouchPoints)&&(e(document).on("touchmove."+i.instanceId,s),e(document).on("touchend."+i.instanceId,d));e(document).on("selectstart."+i.instanceId,c),e("iframe").css("pointer-events","none")})})})});