!function(e){"use strict";var t=function(e,t){var n=this;if(!e.length||e.length<3)return t();wp.ajax.send(n.ajax,{data:{query:e,nonce:n.nonce,ajax_param:n.ajax_param}}).done((function(e){t(e)}))};function n(e){return"<i class='ivc fa "+e.id.toLowerCase()+"'/></i>"+e.text}e(".vc-select-wrapper").each((function(){var n,a,i=e(this).data("ajax"),s=e(this).data("multiple"),o=e(this).data("nonce"),c=e(this).data("ajax-param");if(s>1){var r=e(this).find(".data-option").text(),p=JSON.parse(r);n=e(this).find("input"),a={plugins:["drag_drop","remove_button"],multiple:s,hideSelected:!0,persist:!0,options:p,render:{option:function(e){return"<div><span>"+e.text+"</span></div>"}}}}else n=e(this).find("select"),a={allowEmptyOption:!0};""!==i&&(a.load=t.bind({ajax:i,nonce:o,ajax_param:c}),a.create=!0,a.onItemAdd=function(){if("jeg_find_review"===i){var e=this.items;if(e.length>1)for(var t=0;t<e.length;t++)this.removeItem(e[t]),this.refreshOptions()}}),e(n).selectize(a)})),e(".number-input-wrapper input[type=text]").each((function(){var t=e(this).attr("min"),n=e(this).attr("max"),a=e(this).attr("step");e(this).spinner({min:t,max:n,step:a})})),e(".wp-tab-panel.vc_checkblock").each((function(){var t=this,n=e(t).find(".wpb-input");e(this).find(".checkblock").on("click",(function(){var a=[];e(t).find(".checkblock").each((function(){e(this).is(":checked")&&a.push(e(this).val())})),e(n).val(a)}))})),window.vc.atts.radioimage={init:function(t,n){e(".radio-image-wrapper label input",n).change((function(){e(this).closest(".radio-image-wrapper").find(".wpb_vc_param_value").val(e(this).val()).trigger("change")}))}},e(".slider-input-wrapper").each((function(){var t=e(this),n=t.find("input[type=range]");n.on("mousedown",(function(){e(this).on("mousemove",(function(){t.find(".jnews_range_value .value").text(e(this).val())}))})),n.on("click",(function(){t.find(".jnews_range_value .value").text(e(this).val())})),t.find(".jnews-slider-reset").on("click",(function(){var n=e(this).parent().find("input"),a=n.data("reset_value");n.val(a),n.change(),t.find(".jnews_range_value .value").text(a)}))})),e(".input-uploadfile").each((function(){var t=e(this).find('input[type="text"]');e(this).find(".selectfileimage").on("click",(function(e){e.preventDefault(),custom_uploader=wp.media.frames.file_frame=wp.media({multiple:!1}),custom_uploader.on("select",(function(){attachment=custom_uploader.state().get("selection").first().toJSON();var e=attachment.url;t.val(e)})),custom_uploader.open()}))})),e(".sectionid-input > input").blur((function(){var t=e(this).val(),n=t.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"");e(this).val(n)})),e(".sectionid-input > select").each((function(){e(this).select2({placeholder:"Select",allowClear:!0,formatResult:n,formatSelection:n,escapeMarkup:function(e){return e}})})),e(".jnews_token_access.facebook").on("click",(function(t){t.preventDefault();var n,a=e(this),i=a.parents("#vc_edit-form-tab-0"),s={client_id:i.find("input.fb_id").val(),client_secret:i.find("input.fb_secret").val(),grant_type:"client_credentials"};e.ajax({url:"https://graph.facebook.com/oauth/access_token",data:s,dataType:"json",type:"POST",beforeSend:function(e){a.parent().find(".jnews-spinner").addClass("active")}}).done((function(e,t,a){n=e.access_token,i.find("input.fb_key").val(n)})).fail((function(e,t,n){window.alert("Info Message: "+n)})).always((function(e,t,n){a.parent().find(".jnews-spinner").removeClass("active")}))})),e(".jnews_instagram_access_token").on("click",(function(e){if(e.preventDefault(),"undefined"!=typeof jnewsinstagramoption){var t="https://api.instagram.com/oauth/authorize?app_id=423965861585747&redirect_uri=https://api.smashballoon.com/instagram-basic-display-redirect.php&response_type=code&scope=user_profile,user_media&state="+jnewsinstagramoption.instagram_callback;window.open(t,"_blank").focus()}}))}(window.jQuery);