import"./client.shop-login-button_BtqW_SIO.en.esm.js";import{B as t,af as e,i as n,aj as i,ao as o,au as s,av as a,j as r,aw as c,ax as l,ar as u,ah as m}from"./chunk.common_0OUaOowp.esm.js";import"./chunk.modal_CGo_dVj3.esm.js";function d(m){return t(this,void 0,void 0,(function*(){var t,d;const p=e(),h={analyticsContext:"loginWithShopClassicCustomerAccounts",analyticsTraceId:p,apiKey:"",flow:"classic_customer_accounts",flowVersion:"sign_up",shopPermanentDomain:null!==(d=null===(t=n.Shopify)||void 0===t?void 0:t.shop)&&void 0!==d?d:"",source:"initCustomerAccountsSignUp"},g=new i("initCustomerAccountsSignUp"),f=new o({analyticsData:h,notify:g.notify});try{!function(){const t=new WeakMap;let e=null;const i=s({onVisible:g,onFallback:t=>{t.addEventListener("focus",o,{once:!0}),f.produceMonorailEvent({event:{payload:Object.assign(Object.assign({},h),{errorCode:"fallback_to_focus_event",errorMessage:"Fallback to focus event for classic customer accounts",sdkVersion:"1.0.34-beta"}),schemaId:"shopify_pay_login_with_shop_sdk_error_events/1.0"}})}});function o(t){g(t.target)}function d(t,e){var i,o;const s=null===(i=t.elements.namedItem("checkout_url"))||void 0===i?void 0:i.value,a=null===(o=t.elements.namedItem("return_url"))||void 0===o?void 0:o.value,r=new URLSearchParams(Object.assign(Object.assign({analytics_trace_id:e},s&&{checkout_url:s}),a&&{return_url:a}));return`${n.location.origin}/account/redirect?${r.toString()}`}function g(i){var o;const s=i.form;if(!s)return;t.has(i)&&(null===(o=t.get(i))||void 0===o||o.destroy(),t.delete(i));const a=r.createElement("input");if(a.type="hidden",a.name="login_with_shop[analytics_trace_id]",a.value=p,s.appendChild(a),!e){const t=d(s,p);e=function(t,e){const n=null===r.querySelector('form[data-login-with-shop-sign-in] input[type="email"],form[data-login-with-shop-sign-in] input[name="customer[email]"'),i="true"===l("signInWithShop:modalDismissed"),o=n&&!i,s=u("shop-login-button"),a=Object.assign(Object.assign(Object.assign(Object.assign({"analytics-context":"loginWithShopClassicCustomerAccounts"},o?{"auto-open":!0}:{}),{"client-id":"","disable-sign-up":!0,flow:"classic_customer_accounts","flow-version":"sign_up","hide-button":!0,experiments:JSON.stringify((null==t?void 0:t.experiments)||{}),proxy:!0,"response-type":"code"}),e&&{"return-uri":e}),{"ux-mode":"windoid"});return Object.entries(a).forEach((([t,e])=>{s.setAttribute(t,String(e))})),r.body.appendChild(s),s}(m,t),e.addEventListener("completed",(()=>{n.location.assign(t)}))}const h=s.querySelector('input[name="customer[first_name]"'),g=s.querySelector('input[name="customer[last_name]"');e.setAttribute("firstName",(null==h?void 0:h.value)||""),e.setAttribute("lastName",(null==g?void 0:g.value)||""),e.setAttribute("email",i.value),t.set(i,new c(i,(t=>{e&&(e.setAttribute("firstName",(null==h?void 0:h.value)||""),e.setAttribute("lastName",(null==g?void 0:g.value)||""),e.setAttribute("email",t))})))}a({selector:'form[data-login-with-shop-sign-up] input[type="email"],form[data-login-with-shop-sign-up] input[name="customer[email]"',onElementFound:t=>i.observe(t)})}()}catch(t){t instanceof Error&&g.notify(t)}}))}m("initCustomerAccountsSignUp",d); //# sourceMappingURL=client.init-customer-accounts-sign-up_D6__K_p8.en.esm.js.map