jQuery(document).ready(function(i){function n(n){a?n(a):i.post(dinaIconPicker.ajaxurl,{action:"load_fontawesome_icons"},function(i){i&&"object"==typeof i&&(a=i,n(i))})}const c=i('<div class="dina-icon-picker-modal-backdrop"><div class="dina-icon-picker-modal"><button class="dina-icon-picker-close">×</button><input type="text" class="dina-icon-picker-search" placeholder="'+dinaIconPicker.i18n.search+'" /><div class="dina-icon-picker-grid"><span>'+dinaIconPicker.i18n.loading+"</span></div></div></div>");i("body").append(c);let a=null;i(".dina-menu-icon-picker-trigger").on("click",function(){const a=i(this).data("target"),o=i(a),e=o.siblings(".dina-icon-preview");c.fadeIn().css("display","flex");const t=c.find(".dina-icon-picker-grid");t.html("<span>"+dinaIconPicker.i18n.loading+"</span>"),n(function(n){t.empty();let a=[""];Object.entries(n).forEach(([n,d])=>{"abacus"===n&&(a=["fal fa-"]),"500px"===n&&(a=["fab fa-"]),"threads"===n&&(a=["dico"]);const s=a.join(" ")+n,r=i("<i>",{class:s,title:d});r.on("click",function(){o.val(""),e.removeAttr("class"),o.val(s).trigger("change"),e.attr("class","dina-icon-preview "+s),c.fadeOut()}),t.append(r)})}),c.find(".dina-icon-picker-search").val("")}),c.find(".dina-icon-picker-close").on("click",function(){c.fadeOut()}),c.on("click",function(n){i(n.target).is(".dina-icon-picker-modal-backdrop")&&c.fadeOut()}),c.find(".dina-icon-picker-search").on("input",function(){const n=i(this).val().toLowerCase();c.find(".dina-icon-picker-grid i").each(function(){const c=i(this).attr("title").toLowerCase();i(this).toggle(-1!==c.indexOf(n))})})});