!function(t){"use strict";window.addEventListener("load",(function(){var t,e=wp.media.model.settings.post.id;jQuery(".trn-media-upload-button").each((function(){jQuery(this).on("click",(function(i){i.preventDefault();var a=jQuery(this).attr("data-post-id"),d=jQuery(this).attr("data-preview-id"),o=jQuery(this).attr("data-input-id"),r=jQuery(this).attr("data-title"),n=jQuery(this).attr("data-button-text");t?a&&t.uploader.uploader.param("post_id",a):(a&&(wp.media.model.settings.post.id=a),t=wp.media.frames.file_frame=wp.media({title:r,button:{text:n},multiple:!1})),t.off("select"),t.on("select",(function(){var i=t.state().get("selection").first().toJSON();jQuery("#".concat(d)).attr("src",i.url).removeClass("hidden"),jQuery("#".concat(o)).val(i.id),wp.media.model.settings.post.id=e})),t.open()})),jQuery("a.add_media").on("click",(function(){wp.media.model.settings.post.id=e}))}))}),!1)}(jQuery);