!function(a){const d=window.ac_acf_field_settings||{};a(document).on("click",".ac-acf-add-column",(function(){const c=a(this),e=c.closest(".ac-acf-card"),n=e.data("table-id"),t=c.closest(".acf-field-object"),s=t.find('.acf-field[data-name="name"] input').val()||t.data("field-name")||"";if(!s)return;const i={name:s,type:t.data("type")||"",label:t.find('.acf-field[data-name="label"] input').val()||"",prepend:t.find('.acf-field[data-name="prepend"] input').val()||"",append:t.find('.acf-field[data-name="append"] input').val()||""};c.prop("disabled",!0).text(d.adding||"Adding..."),a.post(ajaxurl,{action:"ac-acf-add-column",_ajax_nonce:d.nonce||"",table_id:n,meta_key:s,field_data:JSON.stringify(i)}).done((function(n){if(!n.success)return void c.prop("disabled",!1).text(d.add_as_column||"Add as column");const t=n.data&&n.data.editor_url?n.data.editor_url:"#",s=e.find(".ac-acf-card-name").text();e.addClass("ac-acf-card--added").attr("data-state","added").empty().append(a("<div>",{class:"ac-acf-card-main"}).append(a("<span>",{class:"ac-acf-card-name",text:s})).append(a("<span>",{class:"ac-acf-status"}).append(a("<span>",{class:"ac-acf-badge",html:"&#10003;"})).append(a("<span>",{class:"ac-acf-card-status",text:d.added||"Added"})))).append(a("<div>",{class:"ac-acf-card-actions"}).append(a("<a>",{href:t,target:"_blank",class:"ac-acf-link",text:d.edit_column||"Edit column →"})))})).fail((function(){c.prop("disabled",!1).text(d.add_as_column||"Add as column")}))}))}(jQuery);