!function(e,t,n){e.hooks.addAction("panel/open_editor/widget/ee-offcanvas",function(t,o,s){"ee-offcanvas.classic"===s.$el.data("widget_type")&&e.channels.editor.off("ee:editor:offcanvas:open").on("ee:editor:offcanvas:open",function(e){var t=s.$el,o=t.data("id");n.elementor.$previewContents.find("#ee-offcanvas-"+o);n.elementorFrontend.eeOffcanvas.controller.toggle("oc"+o)})});var o=e.modules.controls.BaseData.extend({getSnazzyDefaultOptions:function(){var n=this.model.get("snazzy_options");return{containerCssClass:"ee-select2-container",dropdownCssClass:"ee-select2-dropdown",allowClear:!0,placeholder:this.model.get("placeholder"),dir:e.config.is_rtl?"rtl":"ltr",ajax:{url:"https://snazzymaps.com/"+n.endpoint+".json",dataType:"json",cache:!0,data:function(e){return{key:n.key,page:e.page||1}},processResults:function(e,n){var o=t.map(e.styles,function(e){return e.id=JSON.stringify(e),e.text=e.name,e});return n.page=n.page||1,{results:o,pagination:{more:12*n.page
"},formatResultsSelection:function(e){return e.text},applySavedValue:function(){var e=this.getControlValue();e&&""!==e&&(e=JSON.parse(this.getControlValue()),this.setInputValue('[data-setting="'+this.model.get("name")+'"]',e.id))},getSnazzyOptions:function(){return jQuery.extend(this.getSnazzyDefaultOptions(),this.model.get("select2options"))},onReady:function(){this.ui.select.select2(this.getSnazzyOptions())},onBeforeDestroy:function(){this.ui.select.data("select2")&&this.ui.select.select2("destroy"),this.$el.remove()}}),s=e.modules.controls.Select2.extend({cache:null,isTitlesReceived:!1,getSelect2Placeholder:function(){return{id:"",text:this.model.get("placeholder")||"All"}},getSelect2DefaultOptions:function(){var t=this;return jQuery.extend(e.modules.controls.Select2.prototype.getSelect2DefaultOptions.apply(this,arguments),{ajax:{transport:function(e,n,o){var s={q:e.data.q,query_type:t.model.get("query_type"),query_options:t.model.get("query_options"),object_type:t.model.get("object_type")};return elementorCommon.ajax.addRequest("ee_query_control_filter_autocomplete",{data:s,success:n,error:o})},data:function(e){return{q:e.term,page:e.page}},cache:!0},escapeMarkup:function(e){return e},minimumInputLength:1})},getValueTitles:function(){var e=this,t=this.getControlValue(),n=this.model.get("query_type"),o=this.model.get("query_options"),s=this.model.get("object_type");t&&n&&(_.isArray(t)||(t=[t]),elementorCommon.ajax.loadObjects({action:"ee_query_control_value_titles",ids:t,data:{query_type:n,query_options:o,object_type:s,unique_id:""+e.cid+n},success:function(t){e.isTitlesReceived=!0,e.model.set("options",t),e.render()},before:function(){e.addSpinner()}}))},addSpinner:function(){this.ui.select.prop("disabled",!0),this.$el.find(".elementor-control-title").after('  ')},onReady:function(){setTimeout(e.modules.controls.Select2.prototype.onReady.bind(this)),this.isTitlesReceived||this.getValueTitles()},onBeforeDestroy:function(){this.ui.select.data("select2")&&this.ui.select.select2("destroy"),this.$el.remove()}});e.addControlView("ee-query",s),e.addControlView("ee-snazzy",o)}(elementor,jQuery,window);