jQuery(window).on("elementor:init",(function(){"use strict";var e=elementor.modules.controls.BaseData.extend({onReady:function(){var e=this,t=e.ui.select,n=t.attr("data-ajax-url"),a=window.wpApiSettings.nonce;t.select2({ajax:{url:n,dataType:"json",headers:{"X-WP-Nonce":a},data:function(e){return{s:e.term}}},cache:!0});var r=void 0!==e.getControlValue()?e.getControlValue():"";r.isArray&&(r=e.getControlValue().join()),jQuery.ajax({url:n,dataType:"json",headers:{"X-WP-Nonce":a},data:{ids:String(r)}}).then((function(e){r.length&&null!==e&&e.results.length>0&&(jQuery.each(e.results,(function(e,n){var a=new Option(n.text,n.id,!0,!0);t.append(a).trigger("change")})),t.trigger({type:"select2:select",params:{data:e}}))}))},onBeforeDestroy:function(){this.ui.select.data("select2")&&this.ui.select.select2("destroy"),this.el.remove()}});elementor.addControlView("shopengine_ajaxselect2",e)}));