!function(){"use strict";window.addEventListener("elementor/init",()=>{const e=elementor.modules.controls.Select2.extend({isLoaded:!1,addControlSpinner(){this.ui.select.prop("disabled",!0),this.$el.find(".elementor-control-title").after('<span class="elementor-control-spinner">&nbsp;<i class="eicon-spinner eicon-animation-spin"></i>&nbsp;</span>')},getControlValueByName(e){const t=(this.model.get("group_prefix")??"")+e;return this.container.settings.get(t)??""},getInitialValues(){let e=this.getControlValue();elementorCommon.ajax.loadObjects({action:"glsr_elementor_ajax_query_selected",before:()=>this.addControlSpinner(),data:this.getQueryData(),ids:_.isArray(e)?e:[e],success:e=>{this.isLoaded=!0,this.model.set("options",e),setTimeout(()=>this.render(),1)}})},getQueryData(){const e={include:this.getControlValueByName(this.model.get("include")),option:this.model.get("name"),shortcode:this.container.settings.get("widgetType"),unique_id:this.cid+this.model.get("name")},t=this.model.get("depends_on");return t&&(e[t]=this.getControlValueByName(t)),e},getSelect2DefaultOptions(){return jQuery.extend(elementor.modules.controls.Select2.prototype.getSelect2DefaultOptions.apply(this,arguments),{ajax:{transport:(e,t,s)=>elementorCommon.ajax.addRequest("glsr_elementor_ajax_query",{data:{search:e.data.q,...this.getQueryData()},error:s,success:t}),cache:!0},minimumInputLength:1})},onReady(){this.isLoaded||this.getInitialValues()}});elementor.addControlView("select2_ajax",e),document.addEventListener("change",function(e){if(!e.target.matches(".elementor-control-type-multi_switcher .elementor-switch-input"))return;const t=jQuery(e.target),s=t.closest(".elementor-control-type-multi_switcher").find("input[data-setting]"),n=t.val(),o=s.val()?s.val().split(","):[],i=t.is(":checked")?[...new Set([...o,n])]:o.filter(e=>e!==n);s.val(i.join(",")).trigger("input")},{passive:!0})},{passive:!0}),window.addEventListener("elementor/panel/init",()=>{elementor.hooks.addFilter("editor/style/styleText",(e,t)=>{const s=t?.$el,n=t?.container?.settings?.attributes||{},o=n?.widgetType||"";if(!s||n?.theme||!o.startsWith("site_review"))return e;const i=n?.style_bar_color||n?.__globals__?.style_bar_color;s.find(".glsr").parent()[i?"addClass":"removeClass"]("has-bar-color");const r=n?.style_rating_color||n?.__globals__?.style_rating_color;return s.find(".glsr").parent()[r?"addClass":"removeClass"]("has-rating-color"),e})},{passive:!0})}();
