jQuery((function(o){function t(){o.ajax({type:"POST",url:ajaxurl,data:{action:"mmp_get_shortcode_list",nonce:o("#mmp-shortcode-nonce").val(),search:o("#mmp-shortcode-search").val()},beforeSend:function(){o("#mmp-shortcode-insert").prop("disabled",!0)}}).done((function(t){o("#mmp-shortcode-list-container .mmp-shortcode-error").remove(),o("#mmp-shortcode-list").empty(),t.success?(o.each(t.data,(function(t,e){o("#mmp-shortcode-list").append('<li data-id="'+e.id+'">'+e.name+"</li>")})),o("#mmp-shortcode-list li").first().trigger("click")):o("#mmp-shortcode-list-container").append('<p class="mmp-shortcode-error">'+t.data+"</p>")}))}function e(){var t=o("#mmp-shortcode-list li.mmp-shortcode-row-active").first().data("id");if(t){var e="["+o("#mmp-shortcode-string").val()+' map="'+t+'"]';wp.media.editor.insert(e),o("#mmp-shortcode-modal").hide()}}o("#mmp-shortcode-button").on("click",(function(){o("#mmp-shortcode-modal").show(),o("#mmp-shortcode-search").val("").trigger("focus"),t()})),o("#mmp-shortcode-search").keyup((function(o){"Enter"!==o.key?t():e()})),o("#mmp-shortcode-insert").on("click",(function(){e()})),o(".mmp-shortcode-modal, .mmp-shortcode-modal-close").on("click",(function(t){t.target===this&&o("#mmp-shortcode-modal").hide()})),o("#mmp-shortcode-list").on("click","li",(function(){o("#mmp-shortcode-list li.mmp-shortcode-row-active").removeClass("mmp-shortcode-row-active"),o(this).addClass("mmp-shortcode-row-active"),o("#mmp-shortcode-insert").prop("disabled",!1)})),o("#mmp-shortcode-add-map").on("click",(function(){o("#mmp-shortcode-modal").hide()}))}));