"use strict";(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[218],{90:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),i=n(6942),r=n.n(i),o=n(8468),s=n(8969),d=n(9269);const l=({title:e,subtitle:t})=>{const n=(0,o.useContext)(d.D),i=n?.theme||!1;return(0,a.createElement)("div",{className:"nfd-onboarding-step__heading"},(0,a.createElement)("h2",{className:"nfd-onboarding-step__heading__title"},e),t&&(0,a.createElement)("div",{className:"nfd-onboarding-step__heading__subtitle"},t,(0,a.createElement)("div",{className:r()("nfd-onboarding-step__heading__icon",i===s.Vw?"nfd-onboarding-step__heading__icon--light":null)})))}},1218:(e,t,n)=>{n.r(t),n.d(t,{default:()=>E});var a=n(1609),i=n(8468),r=n(7143),o=n(7723);var s=n(7708),d=n(3988),l=n(90),c=n(1032),g=n(9034),_=n(3731),m=n(67),p=n(2940),u=n(7675),b=n(8969),f=n(1056),w=n(8744),h=n(2202);const E=()=>{const{setIsHeaderEnabled:e,setSidebarActiveView:t,setHeaderActiveView:n,setDrawerActiveView:E,setIsHeaderNavigationEnabled:S,setFooterActiveView:N,setHideFooterNav:v,updateSiteGenErrorStatus:y,updateAllSteps:A}=(0,r.useDispatch)(u.M),{siteGenErrorStatus:M,allSteps:x,canMigrateSite:V,currentBrandName:O}=(0,r.useSelect)((e=>({siteGenErrorStatus:e(u.M).getSiteGenErrorStatus(),allSteps:e(u.M).getAllSteps(),canMigrateSite:e(u.M).canMigrateSite(),currentBrandName:e(u.M).getNewfoldBrandName()})));(0,i.useEffect)((()=>{const a=x.filter((e=>e===_.O));if(0===a?.length){let e;e=window.nfdOnboarding.currentFlow===w.d0?(0,p.gK)(x,g.O):(0,p.gK)(x,m.H),A(e.allSteps)}v(!0),e(!1),t(!1),S(!1),n(b.Ix),E(!1),N(b.Sr)}),[]),(0,i.useEffect)((()=>{!1===M&&(async()=>{try{if(V){const e=await(0,s.OD)(),t=e?.body?.data?.redirect_url;t?((0,f.SV)(new f.iC(h.o_,t)),setTimeout((()=>{window.open(t,"_self")}),3e3)):y(!0)}else y(!0)}catch(e){console.error("Failed to fetch migration URL:",e),y(!0)}})()}),[M]);const C=(e=>({heading:(0,o.sprintf)(/* translators: %s: to replace Brand name */ /* translators: %s: to replace Brand name */
(0,o.__)("Let's migrate your existing site to %s","wp-module-onboarding"),e),description:(0,o.__)("Please wait a few seconds while we get your new account ready to import your existing WordPress site. ","wp-module-onboarding"),importText:(0,o.__)("Preparing your account","wp-module-onboarding")}))(O);return(0,a.createElement)(c.tR,null,(0,a.createElement)(d.A,{isVerticallyCentered:!0,className:"nfd-onboarding-step--site-gen__migration"},(0,a.createElement)(l.A,{title:C.heading}),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__migration--container"},(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__migration--container__loader"}),(0,a.createElement)("p",{className:"nfd-onboarding-step--site-gen__migration--container__importtext"},C?.importText)),(0,a.createElement)("p",{className:"nfd-onboarding-step--site-gen__migration__description"},C?.description)))}}}]);