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