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