").addClass("jp-spinner__outer").appendTo(t);n("
").addClass("jp-spinner__inner").appendTo(a),e.after(t)},handleConnectionSuccess:function(e){c.fetchPlanType(),window.addEventListener("message",c.receiveData),a.attr("src",e.authorizeUrl+"&from="+i),a.on("load",function(){a.show(),n(".jp-connect-full__button-container").hide()}),a.hide(),n(".jp-connect-full__button-container").after(a);var t=document.createElement("link");t.rel="preload",t.as="script",t.href=jpConnect.preFetchScript,document.head.appendChild(t)},fetchPlanType:function(){n.ajax({url:jpConnect.apiBaseUrl+"/site",type:"GET",data:{_wpnonce:jpConnect.apiSiteDataNonce},success:function(n){var e=JSON.parse(n.data);c.isPaidPlan=e.options.is_pending_plan||!e.plan.is_free}})},receiveData:function(n){n.origin===jpConnect.jetpackApiDomain&&n.source===a.get(0).contentWindow&&"close"===n.data&&(window.removeEventListener("message",this.receiveData),c.handleAuthorizationComplete())},handleAuthorizationComplete:function(){c.isRegistering=!1,c.isPaidPlan?window.location.assign(jpConnect.dashboardUrl):window.location.assign(jpConnect.plansPromptUrl),window.location.hash&&window.location.reload(!0)},handleConnectionError:function(n){c.isRegistering=!1,c.handleOriginalFlow()}};"setup"===location.hash.replace(/#\//,"")&&(o.length&&o.hide(),c.selectAndStartConnectionFlow())});