!function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){n(1),e.exports=n(2)},function(e,t){var n;(n=jQuery)(window).on("load",(function(){n("a.switch_now").click((function(){return n.post(ajaxurl,{action:"switch_now"}).done((function(e){window.location.href=e.url})).fail((function(e){})),!1}))})),n(".stages-nav a").each((function(){n(this).click((function(){var e=n(this).attr("data-target");if("stage-02"!=e&&"stage-03"!=e&&"stage-04"!=e&&"stage-05"!=e||n('input[name="wpg_page_name"]').val()||n('input[name="wpg_page_id"]').val())return n(".stages-nav a").removeClass("active"),n(this).addClass("active"),n(".stages > div").hide(),n(".stages > div."+e).show(),!1;alert("Page Name is required")}))})),n(".nav_cont a").each((function(){n(this).click((function(){var e=n(this).attr("data-target");return n('.stages-nav a[data-target="'+e+'"]').click(),!1}))})),n(".wpg_create_page_name").click((function(){return n('input[name="wpg_page_name"]').val()?(n.post(ajaxurl,{action:"wpg_create_page_name",page_name:n('input[name="wpg_page_name"]').val()}).done((function(e){"Page Created"==e.message&&(n('input[name="wpg_page_name"], .wpg_create_page_name').attr("disabled",!0),n(".wpg_create_page_name").parents(".box").append("✔ Completed"),n('input[name="wpg_page_id"]').val(e.page.ID),n(".import_people").attr("disabled",!1).attr("href",e.page_link+"#/dashboard/migrate/"),n(".add_people").attr("disabled",!1).attr("href",e.page_link+"#/dashboard/people/add")),alert(e.message)})).fail((function(e){})),!1):(alert("Page name is required"),!1)})),n(".save_hub_content").click((function(){return n.post(ajaxurl,{action:"save_hub_content",wpg_page_heading:n('input[name="wpg_page_heading"]').val(),wpg_page_text:n('textarea[name="wpg_page_text"]').val(),wpg_button_text:n('input[name="wpg_button_text"]').val(),wpg_button_link:n('input[name="wpg_button_link"]').val(),wpg_image_link:n('input[name="wpg_image_link"]').val()}).done((function(e){alert(e.message)})).fail((function(e){})),!1})),n(".wpg_create_tree").click((function(){n.post(ajaxurl,{action:"wpg_create_tree",gedcom:n('input[name="tree_name"]').val()}).done((function(e){e.messages&&e.messages[0]&&e.messages[0].text&&(alert(e.messages[0].text),n('input[name="tree_name"], .wpg_create_tree').attr("disabled",!0),n(".wpg_create_tree").parents(".box").append("✔ Completed"))})).fail((function(e){}))})),n(".wpg_create_branch").click((function(){n.post(ajaxurl,{action:"wpg_create_branch",gedcom:n('input[name="tree_name"]').val(),branch:n('input[name="branch_name"]').val()}).done((function(e){e.messages&&e.messages[0]&&e.messages[0].text&&(alert(e.messages[0].text),n('input[name="branch_name"], .wpg_create_branch').attr("disabled",!0),n(".wpg_create_branch").parents(".box").append("✔ Completed"))})).fail((function(e){}))})),n(".save_hub_content_fnish").click((function(){if(!n('input[name="wpg_page_id"]').val())return alert("Stae 1 must be complited to fnish setup."),!1;n.post(ajaxurl,{action:"save_hub_content_fnish"}).done((function(e){window.location.href=wpGenealogy.site_url+"/wp-admin/admin.php?page=wpgenealogy"})).fail((function(e){}))})),n('input[name="wpg_button_link"]').focus((function(){0==n(this).parent().find(".wpg_button_links_box").length&&n(this).parent().append('<ul class="wpg_button_links_box">Loading...</ul>'),n.post(ajaxurl,{action:"get_wpg_button_link"}).done((function(e){n('input[name="wpg_button_link"]').parent().find(".wpg_button_links_box").html(e),n('input[name="wpg_button_link"]').parent().find(".wpg_button_links_box li").each((function(){n(this).click((function(){n('input[name="wpg_button_link"]').val(n(this).text())}))}))})).fail((function(e){})),n(document).mouseup((function(e){var t=n('input[name="wpg_button_link"]').parent().find(".wpg_button_links_box"),a=n('input[name="wpg_button_link"]');t.is(e.target)||0!==t.has(e.target).length||a.is(e.target)||0!==a.has(e.target).length||t.remove()}))}))},function(e,t,n){}]);