jQuery(document).ready(function(i){let n={},e;i(document).on("click",".dina-icon-picker-trigger",function(){e||(e=i('<div class="dina-icon-picker-modal-backdrop" style="display:none;"><div class="dina-icon-picker-modal"><button type="button" class="dina-icon-picker-close">\xd7</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(e),e.on("click",function(n){i(n.target).is(".dina-icon-picker-modal-backdrop")&&e.fadeOut()}),e.find(".dina-icon-picker-close").on("click",function(){e.fadeOut()}),e.find(".dina-icon-picker-search").on("input",function(){let n=i(this).val().toLowerCase();e.find(".dina-icon-picker-grid i").each(function(){let e=i(this).attr("title")?.toLowerCase()||"";i(this).toggle(-1!==e.indexOf(n))})}));let a=i(this).closest(".dina-icon-picker-field"),c=a.find('input[type="hidden"]'),t=a.find(".dina-icon-preview i");e.fadeIn().css("display","flex");let o=e.find(".dina-icon-picker-grid");o.html("<span>"+dinaIconPicker.i18n.loading+"</span>"),e.find(".dina-icon-picker-search").val(""),function e(a){if(n.data){a(n.data);return}i.post(dinaIconPicker.ajaxurl,{action:"load_fontawesome_icons"},function(i){i&&"object"==typeof i?(n.data=i,a(i)):console.error("Invalid icon data received:",i)})}(function(n){o.empty(),i.each(n,function(n,a){let d=i("<i>",{class:n,title:a,tabIndex:0,role:"button","aria-label":a});d.on("click keypress",function(i){("click"===i.type||"Enter"===i.key)&&(c.val(n).trigger("change"),t.attr("class",n),e.fadeOut())}),o.append(d)})})})});