function page_generator_pro_keywords_generate_locations_update_output_types(){jQuery('body.page-generator-pro select[name="output_type[]"]').selectize().each((function(){var e=jQuery('select[name="method"]').val(),a=jQuery('select[name="country_code"]').val();"area"==e&&"GB"==a?(this.selectize.addOption({value:"street_name",text:page_generator_pro_keywords_generate_locations.options.output_types.street_name}),this.selectize.addOption({value:"zipcode_district",text:page_generator_pro_keywords_generate_locations.options.output_types.zipcode_district})):(this.selectize.removeOption("street_name"),this.selectize.removeOption("zipcode_district"))}))}function page_generator_pro_keywords_generate_locations_request(e,a){wpzinc_modal_open(page_generator_pro_keywords_generate_locations.titles.keywords_generate_location_request,page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_request+" #"+a),jQuery.ajax({url:ajaxurl,type:"POST",async:!0,data:e,error:function(e,a,t){return wpzinc_modal_show_error_message_and_exit(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_error)},success:function(t){if(!t.success)return wpzinc_modal_show_error_message_and_exit(t.data);if(wpzinc_modal_update_message(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_response),e.keyword_id=t.data.keyword_id,void 0!==t.data.meta.has_more&&!0===t.data.meta.has_more)wpzinc_modal_update_message(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_request_next),e.start_id=t.data.meta.next_id,page_generator_pro_keywords_generate_locations_request(e,a+=1);else{if(!(void 0!==t.data.meta.last_page&&t.data.meta.current_page<t.data.meta.last_page))return wpzinc_modal_show_success_message_and_exit(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_success+' <a href="'+t.data.keyword_url+'" rel="noopener" target="_blank">View Keyword</a>');wpzinc_modal_update_message(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_request_next),e.page=t.data.meta.current_page+1,page_generator_pro_keywords_generate_locations_request(e,a+=1)}}})}jQuery(document).ready((function(e){e('body.page-generator-pro select[name="method"]').on("change.page-generator-pro",(function(){switch(e(this).val()){case"radius":e("div.radius").show(),e("div.area").hide(),e('select[name="orderby"] option[value="distance"]').removeAttr("disabled");break;case"area":e("div.radius").hide(),e("div.area").show(),e('select[name="orderby"] option[value="distance"]').attr("disabled","disabled");break}page_generator_pro_keywords_generate_locations_update_output_types()})),e('body.page-generator-pro select[name="method"]').trigger("change.page-generator-pro"),e('body.page-generator-pro select[name="country_code"]').on("change.page-generator-pro",(function(){page_generator_pro_destroy_selectize(),page_generator_pro_reinit_selectize(),page_generator_pro_keywords_generate_locations_update_output_types()})),e('body.page-generator-pro select[name="country_code"]').trigger("change.page-generator-pro"),e("form#keywords-generate-locations").on("submit",(function(a){a.preventDefault(),e(".js-notices").html("");for(var t=e(this).serializeArray(),r={},o=0;o<t.length;o++)if("_wp_http_referer"!=t[o].name&&"page-generator-pro_nonce"!=t[o].name)switch(t[o].name){case"output_type[]":case"region_id[]":case"county_id[]":case"city_id[]":var _=t[o].name.split("[]");void 0===r[_[0]]?r[_[0]]=[t[o].value]:r[_[0]].push(t[o].value);break;default:r[t[o].name]=t[o].value;break}r.action="page_generator_pro_keywords_generate_locations",page_generator_pro_keywords_generate_locations_request(r,1)}))}));