jQuery(document).ready(function(e){e("body").on("click","#wpzinc-tinymce-modal div.mce-cancel button, .wpzinc-quicktags-modal .media-frame-toolbar .media-toolbar button.cancel",function(e){if(typeof tinyMCE!=="undefined"&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()){tinymce.activeEditor.windowManager.close();return}wpZincQuickTagsModal.close()});e("body").on("click","#wpzinc-tinymce-modal div.mce-insert button, .wpzinc-quicktags-modal .media-frame-toolbar .media-toolbar button.insert",function(t){t.preventDefault();var i=e("form.wpzinc-tinymce-popup");var n="["+e('input[name="shortcode"]',e(i)).val(),a=e('input[name="close_shortcode"]',e(i)).val()=="1"?true:false;e("input, select",e(i)).each(function(t){if(typeof e(this).data("shortcode")==="undefined"){return true}if(!e(this).val()){return true}if(e(this).val().length==0){return true}var i=e(this).data("shortcode"),a=e(this).data("trim")=="0"?false:true,o=e(this).val();if(!i.length){return true}if(i.search("}")>-1&&i.search("{")>-1){i=i.replace(/{|}/gi,function(e){return""});i=e(i,e(this).parent().parent()).val()}if(typeof e(this).data("shortcode-prepend")!=="undefined"){i=e(this).data("shortcode-prepend")+i}if(Array.isArray(o)){o=o.join(",")}if(a){o=o.trim()}n+=" "+i.trim()+'="'+o+'"'});n+="]";if(a){n+="[/"+e('input[name="shortcode"]',e(i)).val()+"]"}switch(e('input[name="editor_type"]',e(i)).val()){case"tinymce":if(typeof tinyMCE!=="undefined"&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()){tinyMCE.activeEditor.execCommand("mceReplaceContent",false,n);tinyMCE.activeEditor.windowManager.close()}break;case"quicktags":QTags.insertContent(n);wpZincQuickTagsModal.close();break}})});if(typeof wp!=="undefined"&&typeof wp.media!=="undefined"){var wpZincQuickTagsModal=new wp.media.view.Modal({controller:{trigger:function(){}},className:"wpzinc-quicktags-modal"});var wpZincQuickTagsModalContent=wp.Backbone.View.extend({template:wp.template("wpzinc-quicktags-modal")});wpZincQuickTagsModal.content(new wpZincQuickTagsModalContent)}