!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.media=redux.field_objects.media||{},a(document).ready(function(){}),redux.field_objects.media.init=function(b){b||(b=a(document).find(".redux-container-media")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".remove-image, .remove-file").unbind("click").on("click",function(){redux.field_objects.media.removeFile(a(this).parents("fieldset.redux-field:first"))}),b.find(".media_upload_button").unbind().on("click",function(b){redux.field_objects.media.addFile(b,a(this).parents("fieldset.redux-field:first"))}))})},redux.field_objects.media.addFile=function(b,c){b.preventDefault();var d,e=a(this);return d?void d.open():(d=wp.media({multiple:!1,library:{},title:e.data("choose"),button:{text:e.data("update")}}),d.on("select",function(){var b=d.state().get("selection").first();d.close();var e=a(c).find(".data").data();if(("undefined"==typeof redux.field_objects.media||void 0===typeof redux.field_objects.media)&&(redux.field_objects.media={}),(void 0===e||"undefined"===e.mode)&&(e={},e.mode="image"),0===e.mode);else if(e.mode!==!1&&b.attributes.type!==e.mode)return;c.find(".upload").val(b.attributes.url),c.find(".upload-id").val(b.attributes.id),c.find(".upload-height").val(b.attributes.height),c.find(".upload-width").val(b.attributes.width),redux_change(a(c).find(".upload-id"));var f=b.attributes.url;if("undefined"!=typeof b.attributes.sizes&&"undefined"!=typeof b.attributes.sizes.thumbnail)f=b.attributes.sizes.thumbnail.url;else if("undefined"!=typeof b.attributes.sizes){var g=b.attributes.height;for(var h in b.attributes.sizes){var i=b.attributes.sizes[h];i.height').slideDown("fast"),c.find(".remove-image").removeClass("hide"),c.find(".redux-background-properties").slideDown()}),void d.open())},redux.field_objects.media.removeFile=function(b){if(b.find(".remove-image").addClass("hide")){b.find(".remove-image").addClass("hide"),b.find(".upload").val(""),b.find(".upload-id").val(""),b.find(".upload-height").val(""),b.find(".upload-width").val(""),b.find(".upload-thumbnail").val(""),redux_change(a(b).find(".upload-id")),b.find(".redux-background-properties").hide();var c=b.find(".screenshot");c.slideUp(),b.find(".remove-file").unbind(),b.find(".section-upload .upload-notice").length>0&&b.find(".media_upload_button").remove()}}}(jQuery);