!function(t){"function"==typeof define&&define.amd?define("elementor",t):t()}(function(){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}elementor.addControlView("mylisting-posts-dropdown",elementor.modules.controls.BaseData.extend({onReady:function(){var o=this,t=this.prepareValue(this.getControlValue()),n=this.$el.find("select"),i="slug"===this.model.get("post_key")?"post_name":"ID",s=this.model.get("post_type"),a="_mylisting_post_details";window[a]=window[a]||{},window[a][i]=window[a][i]||{};var e=[];t.forEach(function(t){window[a][i][t]||e.push(t)});function r(){var e=[];t.forEach(function(t){window[a][i][t]&&e.push({value:t,label:window[a][i][t]})}),n.html(e.map(function(t){return'<option value="'.concat(t.value,'" selected>').concat(t.label,"</option>")}).join("")),n.attr("data-mylisting-ajax-params",JSON.stringify({post_type:s,item_key:i})),new MyListing.CustomSelect(n),n.on("select:change",function(t){var e=o.prepareValue(t.detail.value);e.forEach(function(t){window[a][i][t]=n.find('option[value="'.concat(t,'"]')).text().trim()}),o.setValue(e)}),n.parent().removeClass("hide"),o.$el.find(".loading-selection").remove()}e.length?jQuery.get(CASE27.mylisting_ajax_url,{item_key:i,post_type:s,posts:e,action:"post_details",security:CASE27.ajax_nonce},function(e){e&&"object"===l(e.results)&&Object.keys(e.results).forEach(function(t){window[a][i][t]=e.results[t]}),r()}):r()},prepareValue:function(t){return t?"string"==typeof t?[t]:Array.isArray(t)?t.filter(Boolean):[]:[]},onBeforeDestroy:function(){this.$el.find("select").data("select2").destroy()}}))});
