function page_generator_pro_keywords_generate_locations_update_output_types(){jQuery('body.page-generator-pro select[name="output_type[]"]').selectize().each(function(){const 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:e=>wpzinc_modal_show_error_message(e.status+" "+e.statusText),success(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")}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.georocket").on("submit",function(a){a.preventDefault(),e(".js-notices").html("");const t=e(this).serializeArray(),r={},o=t.length;for(let e=0;e<o;e++)if("_wp_http_referer"!==t[e].name)switch(t[e].name){case"output_type[]":case"region_id[]":case"county_id[]":case"city_id[]":const a=t[e].name.split("[]");void 0===r[a[0]]?r[a[0]]=[t[e].value]:r[a[0]].push(t[e].value);break;default:r[t[e].name]=t[e].value}r.action="page_generator_pro_keywords_generate_locations",page_generator_pro_keywords_generate_locations_request(r,1)})});