import{b3 as M,b4 as b,b5 as h,b6 as L,b7 as R,b8 as v,b9 as U,ba as I,bb as z,bc as S,bd as O,be as Y,bf as F,bg as H,bh as X,bi as j,u as d,k as g}from"./dist-vendor.a3kfnPsb.js";import{ee as P,T as x,X as C,K as D}from"./shop-pay-ButtonWithRegisterWebPixel.CUNg0UCj.js";import{a as E}from"./shop-pay-FullScreenBackground.Bxb6RI8a.js";function ee(e,a){const n=new Map;function o(c){for(const t of c){const[s,r]=t;switch(s){case b:{const i=t[2],m=t[3];p(r,i,m);break}case h:{const i=t[2];N(r,i);break}}}e.mutate(c)}function p(c,t,s){if(n.has(c)||n.set(c,[]),n.get(c).splice(s,0,{id:t.id,slot:"attributes"in t?t.attributes?.slot:void 0}),"children"in t&&t.children)for(const[i,m]of t.children.entries())p(t.id,m,i)}function N(c,t){const s=n.get(c);if(!s?.[t])return;const r=s[t].id;s.splice(t,1),T(r)}function T(c){const t=n.get(c);if(t){for(const s of t)T(s.id);n.delete(c)}}return function(t,...s){switch(t){case z:{const[r]=s,i=r.map((m,l)=>[b,I,y(m,a),l]);o(i);break}case U:{const[r=I,i,m]=s,l=[],_=n.get(r);if(_){const u=_.findIndex(({id:f})=>f===m.id);u>=0&&l.push([h,r,u])}l.push([b,r,y(m,a),i]),o(l);break}case v:{const[r,i]=s;o([[h,r??I,i]]);break}case R:{const[r,i]=s;o([[X,r,i]]);break}case M:{const[r,i]=s,m=n.get(r),l=[];for(const[_,u]of Object.entries(i)){const f=m?.findIndex(({slot:A})=>A===_)??-1;k(u)?(f>=0&&l.push([h,r,f]),l.push([b,r,w(_,u,a),n.get(r)?.length??0])):f>=0?l.push([h,r,f]):l.push([L,r,_,u])}o(l);break}default:throw new Error(`Unsupported action type: ${t}`)}}}function y(e,a){switch(e.kind){case H:return K(e);case F:return V(e,a);default:return{id:e.id,type:Y,data:"added by remote-ui legacy adaptor to replace a fragment rendered as a child"}}}function K({id:e,text:a}){return{id:e,type:j,data:a}}function V({id:e,type:a,props:n,children:o},p){const N=p?.elements?.[a]??a,[T,c]=G(n);return{id:e,type:O,element:N,properties:c,children:[...o.map(t=>y(t,p)),...$(T,p)]}}function G(e){const a={},n={};for(const[o,p]of Object.entries(e))k(p)?a[o]=p:n[o]=p;return[a,n]}function k(e){return e!=null&&typeof e=="object"&&"kind"in e&&e.kind===S}function $(e,a){return Object.entries(e).map(([n,o])=>w(n,o,a))}function w(e,a,n){return{id:a.id,element:n?.slotProps?.wrapper??"remote-fragment",attributes:{slot:e},type:O,children:a.children.map(o=>y(o,n))}}function q(){const{i18n:e}=E();return d(x,{size:"small",color:"subdued",children:d(P,{children:e.translate("shop_pay_remember_me.terms_and_privacy_html",{privacy_href:d(J,{}),terms_href:d(B,{})})})})}function B(){const{i18n:e}=E();return d(g,{children:d(C,{target:"_blank",href:"https://shop.app/terms-of-service",tone:"monochrome",accessibilityLabel:e.translate("shop_pay_remember_me.new_window_disclaimer"),children:[e.translate("shop_pay_remember_me.terms_of_service"),d(D,{type:"external",size:"small",display:"inline"})]})})}function J(){const{i18n:e}=E();return d(g,{children:d(C,{target:"_blank",href:"https://www.shopify.com/legal/privacy/app-users",tone:"monochrome",accessibilityLabel:e.translate("shop_pay_remember_me.new_window_disclaimer"),children:[e.translate("shop_pay_remember_me.privacy_policy"),d(D,{type:"external",size:"small",display:"inline"})]})})}function te({field:e="phone",link:a}){const{i18n:n}=E();return d(g,{children:[d(x,{color:"subdued",children:d(P,{children:[e==="phone"?n.translate("shop_pay_remember_me.description_html"):n.translate("shop_pay_remember_me.email_description_html")," ",a]})}),d(q,{})]})}export{te as R,ee as a};
