(()=>{function e(e,a){for(var l=0;l<a.length;l++){var t=a[l];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}var a=function(){function a(){!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,a)}var l,t;return l=a,(t=[{key:"init",value:function(){$(document).on("click","#change_slug",(function(e){$(".default-slug").unwrap();var a=$("#editable-post-name");a.html('<input type="text" id="new-post-slug" class="form-control" value="'+a.text()+'" autocomplete="off">'),$("#edit-slug-box .cancel").show(),$("#edit-slug-box .save").show(),$(e.currentTarget).hide()})),$(document).on("click","#edit-slug-box .cancel",(function(){var e=$("#current-slug").val(),a=$("#sample-permalink");a.html('<a class="permalink" href="'+$("#slug_id").data("view")+e.replace("/","")+'">'+a.html()+"</a>"),$("#editable-post-name").text(e),$("#edit-slug-box .cancel").hide(),$("#edit-slug-box .save").hide(),$("#change_slug").show()}));var e=function(e,a,l){$.ajax({url:$("#slug_id").data("url"),type:"POST",data:{name:e,slug_id:a,model:$("input[name=model]").val()},success:function(e){var a=$("#sample-permalink"),t=$("#slug_id");l?a.find(".permalink").prop("href",t.data("view")+e.replace("/","")):a.html('<a class="permalink" target="_blank" href="'+t.data("view")+e.replace("/","")+'">'+a.html()+"</a>"),$(".page-url-seo p").text(t.data("view")+e.replace("/","")),$("#editable-post-name").text(e),$("#current-slug").val(e),$("#edit-slug-box .cancel").hide(),$("#edit-slug-box .save").hide(),$("#change_slug").show(),$("#edit-slug-box").removeClass("hidden")},error:function(e){Botble.handleError(e)}})};$(document).on("click","#edit-slug-box .save",(function(){var a=$("#new-post-slug"),l=a.val(),t=$("#slug_id").data("id");null==t&&(t=0),null!=l&&""!==l?e(l,t,!1):a.closest(".form-group").addClass("has-error")})),$(document).on("blur","#name",(function(a){if($("#edit-slug-box").hasClass("hidden")){var l=$(a.currentTarget).val();null!==l&&""!==l&&e(l,0,!0)}}))}}])&&e(l.prototype,t),a}();$((function(){(new a).init()}))})();
