import{i as e,A as t,y as n,d as o,a as r,q as i,T as l,D as s,_ as a,b as c,u,k as d,f,c as m,e as p,g as h,h as g,j as v,l as y,m as w,n as b,C as x,$ as E,P as R,o as T,p as L,r as O,s as _,t as k,v as C,w as M,F as P,S as D,x as A,z,B as S,E as F,G as I,H as N}from"./chunk.common_CKtMJpz4.esm.js";const j=Math.min,H=Math.max,V=Math.round,B=Math.floor,W=e=>({x:e,y:e}),U={left:"right",right:"left",bottom:"top",top:"bottom"},q={start:"end",end:"start"};function $(e,t,n){return H(e,j(t,n))}function X(e,t){return"function"==typeof e?e(t):e}function Y(e){return e.split("-")[0]}function Z(e){return e.split("-")[1]}function G(e){return"x"===e?"y":"x"}function J(e){return"y"===e?"height":"width"}function K(e){return["top","bottom"].includes(Y(e))?"y":"x"}function Q(e){return G(K(e))}function ee(e){return e.replace(/start|end/g,(e=>q[e]))}function te(e){return e.replace(/left|right|bottom|top/g,(e=>U[e]))}function ne(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function oe(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function re(e,t,n){let{reference:o,floating:r}=e;const i=K(t),l=Q(t),s=J(l),a=Y(t),c="y"===i,u=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,f=o[s]/2-r[s]/2;let m;switch(a){case"top":m={x:u,y:o.y-r.height};break;case"bottom":m={x:u,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:d};break;case"left":m={x:o.x-r.width,y:d};break;default:m={x:o.x,y:o.y}}switch(Z(t)){case"start":m[l]-=f*(n&&c?-1:1);break;case"end":m[l]+=f*(n&&c?-1:1)}return m}async function ie(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:s,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=X(t,e),p=ne(m),h=s[f?"floating"===d?"reference":"floating":d],g=oe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:a})),v="floating"===d?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=oe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:a}):v);return{top:(g.top-b.top+p.top)/w.y,bottom:(b.bottom-g.bottom+p.bottom)/w.y,left:(g.left-b.left+p.left)/w.x,right:(b.right-g.right+p.right)/w.x}}function le(){return"undefined"!=typeof window}function se(e){return ue(e)?(e.nodeName||"").toLowerCase():"#document"}function ae(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function ce(e){var t;return null==(t=(ue(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ue(e){return!!le()&&(e instanceof Node||e instanceof ae(e).Node)}function de(e){return!!le()&&(e instanceof Element||e instanceof ae(e).Element)}function fe(e){return!!le()&&(e instanceof HTMLElement||e instanceof ae(e).HTMLElement)}function me(e){return!(!le()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ae(e).ShadowRoot)}function pe(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=be(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function he(e){return["table","td","th"].includes(se(e))}function ge(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function ve(e){const t=ye(),n=de(e)?be(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function ye(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function we(e){return["html","body","#document"].includes(se(e))}function be(e){return ae(e).getComputedStyle(e)}function xe(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ee(e){if("html"===se(e))return e;const t=e.assignedSlot||e.parentNode||me(e)&&e.host||ce(e);return me(t)?t.host:t}function Re(e){const t=Ee(e);return we(t)?e.ownerDocument?e.ownerDocument.body:e.body:fe(t)&&pe(t)?t:Re(t)}function Te(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=Re(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),l=ae(r);if(i){const e=Le(l);return t.concat(l,l.visualViewport||[],pe(r)?r:[],e&&n?Te(e):[])}return t.concat(r,Te(r,[],n))}function Le(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Oe(e){const t=be(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=fe(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,s=V(n)!==i||V(o)!==l;return s&&(n=i,o=l),{width:n,height:o,$:s}}function _e(e){return de(e)?e:e.contextElement}function ke(e){const t=_e(e);if(!fe(t))return W(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Oe(t);let l=(i?V(n.width):n.width)/o,s=(i?V(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),s&&Number.isFinite(s)||(s=1),{x:l,y:s}}const Ce=W(0);function Me(e){const t=ae(e);return ye()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Ce}function Pe(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=_e(e);let l=W(1);t&&(o?de(o)&&(l=ke(o)):l=ke(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ae(e))&&t}(i,n,o)?Me(i):W(0);let a=(r.left+s.x)/l.x,c=(r.top+s.y)/l.y,u=r.width/l.x,d=r.height/l.y;if(i){const e=ae(i),t=o&&de(o)?ae(o):o;let n=e,r=Le(n);for(;r&&o&&t!==n;){const e=ke(r),t=r.getBoundingClientRect(),o=be(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;a*=e.x,c*=e.y,u*=e.x,d*=e.y,a+=i,c+=l,n=ae(r),r=Le(n)}}return oe({width:u,height:d,x:a,y:c})}function De(e,t){const n=xe(e).scrollLeft;return t?t.left+n:Pe(ce(e)).left+n}function Ae(e,t,n){void 0===n&&(n=!1);const o=e.getBoundingClientRect();return{x:o.left+t.scrollLeft-(n?0:De(e,o)),y:o.top+t.scrollTop}}function ze(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=ae(e),o=ce(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,a=0;if(r){i=r.width,l=r.height;const e=ye();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,a=r.offsetTop)}return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)o=function(e){const t=ce(e),n=xe(e),o=e.ownerDocument.body,r=H(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=H(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+De(e);const s=-n.scrollTop;return"rtl"===be(o).direction&&(l+=H(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:s}}(ce(e));else if(de(t))o=function(e,t){const n=Pe(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=fe(e)?ke(e):W(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=Me(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return oe(o)}function Se(e,t){const n=Ee(e);return!(n===t||!de(n)||we(n))&&("fixed"===be(n).position||Se(n,t))}function Fe(e,t,n){const o=fe(t),r=ce(t),i="fixed"===n,l=Pe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=W(0);if(o||!o&&!i)if(("body"!==se(t)||pe(r))&&(s=xe(t)),o){const e=Pe(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else r&&(a.x=De(r));const c=!r||o||i?W(0):Ae(r,s);return{x:l.left+s.scrollLeft-a.x-c.x,y:l.top+s.scrollTop-a.y-c.y,width:l.width,height:l.height}}function Ie(e){return"static"===be(e).position}function Ne(e,t){if(!fe(e)||"fixed"===be(e).position)return null;if(t)return t(e);let n=e.offsetParent;return ce(e)===n&&(n=n.ownerDocument.body),n}function je(e,t){const n=ae(e);if(ge(e))return n;if(!fe(e)){let t=Ee(e);for(;t&&!we(t);){if(de(t)&&!Ie(t))return t;t=Ee(t)}return n}let o=Ne(e,t);for(;o&&he(o)&&Ie(o);)o=Ne(o,t);return o&&we(o)&&Ie(o)&&!ve(o)?n:o||function(e){let t=Ee(e);for(;fe(t)&&!we(t);){if(ve(t))return t;if(ge(t))return null;t=Ee(t)}return null}(e)||n}const He={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,l=ce(o),s=!!t&&ge(t.floating);if(o===l||s&&i)return n;let a={scrollLeft:0,scrollTop:0},c=W(1);const u=W(0),d=fe(o);if((d||!d&&!i)&&(("body"!==se(o)||pe(l))&&(a=xe(o)),fe(o))){const e=Pe(o);c=ke(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}const f=!l||d||i?W(0):Ae(l,a,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}},getDocumentElement:ce,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?ge(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Te(e,[],!1).filter((e=>de(e)&&"body"!==se(e))),r=null;const i="fixed"===be(e).position;let l=i?Ee(e):e;for(;de(l)&&!we(l);){const t=be(l),n=ve(l);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&["absolute","fixed"].includes(r.position)||pe(l)&&!n&&Se(e,l))?o=o.filter((e=>e!==l)):r=t,l=Ee(l)}return t.set(e,o),o}(t,this._c):[].concat(n),o],l=i[0],s=i.reduce(((e,n)=>{const o=ze(t,n,r);return e.top=H(o.top,e.top),e.right=j(o.right,e.right),e.bottom=j(o.bottom,e.bottom),e.left=H(o.left,e.left),e}),ze(t,l,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:je,getElementRects:async function(e){const t=this.getOffsetParent||je,n=this.getDimensions,o=await n(e.floating);return{reference:Fe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Oe(e);return{width:t,height:n}},getScale:ke,isElement:de,isRTL:function(e){return"rtl"===be(e).direction}};function Ve(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Be(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:a=!1}=o,c=_e(e),u=r||i?[...c?Te(c):[],...Te(t)]:[];u.forEach((e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,o=null;const r=ce(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(s,a){void 0===s&&(s=!1),void 0===a&&(a=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:m}=c;if(s||t(),!f||!m)return;const p={rootMargin:-B(d)+"px "+-B(r.clientWidth-(u+f))+"px "+-B(r.clientHeight-(d+m))+"px "+-B(u)+"px",threshold:H(0,j(1,a))||1};let h=!0;function g(t){const o=t[0].intersectionRatio;if(o!==a){if(!h)return l();o?l(!1,o):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}1!==o||Ve(c,e.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...p,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,p)}o.observe(e)}(!0),i}(c,n):null;let f,m=-1,p=null;l&&(p=new ResizeObserver((e=>{let[o]=e;o&&o.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=p)||e.observe(t)}))),n()})),c&&!a&&p.observe(c),p.observe(t));let h=a?Pe(e):null;return a&&function t(){const o=Pe(e);h&&!Ve(h,o)&&n();h=o,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=p)||e.disconnect(),p=null,a&&cancelAnimationFrame(f)}}const We=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:s}=t,a=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=Y(n),s=Z(n),a="y"===K(n),c=["left","top"].includes(l)?-1:1,u=i&&a?-1:1,d=X(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),a?{x:m*u,y:f*c}:{x:f*c,y:m*u}}(t,e);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:l}}}}},Ue=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...a}=X(e,t),c={x:n,y:o},u=await ie(t,a),d=K(Y(r)),f=G(d);let m=c[f],p=c[d];if(i){const e="y"===f?"bottom":"right";m=$(m+u["y"===f?"top":"left"],m,m-u[e])}if(l){const e="y"===d?"bottom":"right";p=$(p+u["y"===d?"top":"left"],p,p-u[e])}const h=s.fn({...t,[f]:m,[d]:p});return{...h,data:{x:h.x-n,y:h.y-o}}}}},qe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:s,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...g}=X(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Y(r),y=K(s),w=Y(s)===s,b=await(null==a.isRTL?void 0:a.isRTL(c.floating)),x=f||(w||!h?[te(s)]:function(e){const t=te(e);return[ee(e),t,ee(t)]}(s)),E="none"!==p;!f&&E&&x.push(...function(e,t,n,o){const r=Z(e);let i=function(e,t,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:o:t?o:r;case"left":case"right":return t?i:l;default:return[]}}(Y(e),"start"===n,o);return r&&(i=i.map((e=>e+"-"+r)),t&&(i=i.concat(i.map(ee)))),i}(s,h,p,b));const R=[s,...x],T=await ie(t,g),L=[];let O=(null==(o=i.flip)?void 0:o.overflows)||[];if(u&&L.push(T[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const o=Z(e),r=Q(e),i=J(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=te(l)),[l,te(l)]}(r,l,b);L.push(T[e[0]],T[e[1]])}if(O=[...O,{placement:r,overflows:L}],!L.every((e=>e<=0))){var _,k;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(k=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:k.placement;if(!n)switch(m){case"bestFit":{var C;const e=null==(C=O.filter((e=>{if(E){const t=K(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:C[0];e&&(n=e);break}case"initialPlacement":n=s}if(r!==n)return{reset:{placement:n}}}return{}}}},$e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:l,elements:s,middlewareData:a}=t,{element:c,padding:u=0}=X(e,t)||{};if(null==c)return{};const d=ne(u),f={x:n,y:o},m=Q(r),p=J(m),h=await l.getDimensions(c),g="y"===m,v=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=i.reference[p]+i.reference[m]-f[m]-i.floating[p],x=f[m]-i.reference[m],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(c));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=s.floating[w]||i.floating[p]);const T=b/2-x/2,L=R/2-h[p]/2-1,O=j(d[v],L),_=j(d[y],L),k=O,C=R-h[p]-_,M=R/2-h[p]/2+T,P=$(k,M,C),D=!a.arrow&&null!=Z(r)&&M!==P&&i.reference[p]/2-(M{const o=new Map,r={platform:He,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=re(c,o,a),f=o,m={},p=0;for(let n=0;n{o.current=e})),o}const Je=s(((e,n)=>{var{as:o="div",children:r,disabled:i=!1}=e,l=a(e,["as","children","disabled"]);const s=t(null),p=t(null),h=t(null);c((()=>{var e;i||null===(e=s.current)||void 0===e||e.focus()}),[i]);const g=e=>{const t=s.current;if(!t||i)return;((e?f(t):m(t))||t).focus()},v=i?-1:0,y="absolute -m-px h-px w-px overflow-hidden whitespace-nowrap p-0";return u(d,{children:[u("div",{className:y,ref:p,onFocus:()=>g(!1),tabIndex:v}),u(o,Object.assign({},l,{ref:e=>{s.current=e,"function"==typeof n?n(e):n&&(n.current=e)},tabIndex:-1,children:r})),u("div",{className:y,ref:h,onFocus:()=>g(!0),tabIndex:v})]})})),Ke=["right","left","bottom","top"],Qe=({anchorTo:s,children:a,headerLogo:c,headerTitle:d,hideHeader:f=!1,disableMinWidth:m=!1,key:T,modalTitle:L="Sign in with Shop",onDismiss:O,onModalInViewport:_,popupDisabled:k,type:C,variant:M,visible:P})=>{var D,A,z;const{dispatch:S,modalDismissible:F}=p(),{translate:I}=h(),N=t(null),[j,H]=o(null),V=t(null),B=t(null),W=t(null),[U,q]=o(!1),{instanceId:$}=g(),X=t(null),{floatingStyles:Y,middlewareData:Z,refs:G,update:J}=function(e={}){const{placement:s="bottom",strategy:a="absolute",middleware:c=[],platform:u,elements:{reference:d,floating:f}={},transform:m=!0,whileElementsMounted:p,open:h}=e,[g,v]=o({x:0,y:0,strategy:a,placement:s,middlewareData:{},isPositioned:!1}),[y,w]=o(c);r(y,c)||w(c);const[b,x]=o(null),[E,R]=o(null),T=i((e=>{e!==k.current&&(k.current=e,x(e))}),[]),L=i((e=>{e!==C.current&&(C.current=e,R(e))}),[]),O=d||b,_=f||E,k=t(null),C=t(null),M=t(g),P=null!=p,D=Ge(p),A=Ge(u),z=i((()=>{if(!k.current||!C.current)return;const e={placement:s,strategy:a,middleware:y};A.current&&(e.platform=A.current),Xe(k.current,C.current,e).then((e=>{const t=Object.assign(Object.assign({},e),{isPositioned:!0});S.current&&!r(M.current,t)&&(M.current=t,v(t))})).catch((e=>{console.error("error caught during computePosition",e)}))}),[y,s,a,A]);n((()=>{!1===h&&M.current.isPositioned&&(M.current.isPositioned=!1,v((e=>Object.assign(Object.assign({},e),{isPositioned:!1}))))}),[h]);const S=t(!1);n((()=>(S.current=!0,()=>{S.current=!1})),[]),n((()=>{if(O&&(k.current=O),_&&(C.current=_),O&&_){if(D.current)return D.current(O,_,z);z()}}),[O,_,z,D,P]);const F=l((()=>({reference:k,floating:C,setReference:T,setFloating:L})),[T,L]),I=l((()=>({reference:O,floating:_})),[O,_]),N=l((()=>{const e={position:a,left:0,top:0};if(!I.floating)return e;const t=Ze(I.floating,g.x),n=Ze(I.floating,g.y);return m?Object.assign(Object.assign(Object.assign({},e),{transform:`translate(${t}px, ${n}px)`}),Ye(I.floating)>=1.5&&{willChange:"transform"}):{position:a,left:t,top:n}}),[a,m,I.floating,g.x,g.y]);return l((()=>Object.assign(Object.assign({},g),{update:z,refs:F,elements:I,floatingStyles:N})),[g,z,F,I,N])}({middleware:[qe({crossAxis:!1,fallbackPlacements:Ke.slice(1)}),Ue({padding:30}),We(30),(K={element:V,padding:28},{name:"arrow",options:K,fn(e){const{element:t,padding:n}=K;return t&&(o=t,{}.hasOwnProperty.call(o,"current"))?null!=t.current?$e({element:t.current,padding:n}).fn(e):{}:t?$e({element:t,padding:n}).fn(e):{};var o}})],placement:Ke[0],whileElementsMounted:Be});var K;n((()=>{if(s){let e;e="string"==typeof s?v.querySelector(s):s.current,H(e),G.setReference(e),J()}}),[s,G,J]),null===X.current&&(X.current=v.documentElement.style.overflow),!B.current&&y()&&(B.current=new IntersectionObserver((t=>{for(const n of t){n.boundingClientRect.top<0&&e.scrollTo({top:0,left:0}),n.isIntersecting&&(null==_||_())}}))),!N.current&&y()&&(N.current=new IntersectionObserver((t=>{var n;for(const o of t){if(o.boundingClientRect.top<0&&e.scrollTo({top:0,left:0}),!o.isIntersecting&&o.target.offsetTop){const t=((null==j?void 0:j.offsetHeight)||0)+((null===(n=W.current)||void 0===n?void 0:n.offsetHeight)||0)/2+30;e.scrollTo({top:o.target.offsetTop-t})}}}))),n((()=>()=>{B.current&&B.current.disconnect(),N.current&&N.current.disconnect()}),[]);const{isDesktop:Q}=w(),ee=l((()=>j&&!k&&Q?"dynamic":"center"),[j,Q,k]);n((()=>{const e=v.documentElement,t=null==e?void 0:e.style.overflow;return()=>{t&&e?e.style.overflow=t:e.style.removeProperty("overflow")}}),[]);const te=i((e=>{F&&(O(e),v.documentElement.style.overflow=X.current||"")}),[F,O]);n((()=>{function t({key:e}){"Escape"!==e&&"Esc"!==e||te("keyboard")}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[te]),n((()=>{P?(v.documentElement.style.overflow="hidden",B.current&&W.current&&B.current.observe(W.current),N.current&&j&&N.current.observe(j)):(B.current&&W.current&&B.current.unobserve(W.current),N.current&&j&&N.current.unobserve(j),v.documentElement.style.overflow=X.current||"")}),[j,te,P]),n((()=>{var e;if(!P)return void q(!1);const t=()=>{q(!0)};return null===(e=W.current)||void 0===e||e.addEventListener("transitionend",t,{once:!0}),()=>{var e;null===(e=W.current)||void 0===e||e.removeEventListener("transitionend",t)}}),[P]),n((()=>{if(P){const e=setTimeout((()=>{S({type:"modalDismissible"})}),400);return()=>{clearTimeout(e)}}}),[S,P]);const ne=b("fixed inset-0 z-10 bg-overlay transition-opacity duration-400 ease-cubic-modal motion-reduce_duration-0",P?"opacity-100":"opacity-0"),oe=b("fixed inset-0 z-max overflow-hidden","center"===ee&&"flex items-center justify-center",P?"visible":"pointer-events-none invisible");let re="";"checkoutModal"===M&&(re="wide"===C?"max-w-100 sm_max-w-none":"max-w-85 sm_max-w-none");const ie=b("relative z-50 bg-white transition duration-400 ease-cubic-modal will-change-transform focus_outline-none focus_outline-0 motion-reduce_duration-0 sm_absolute sm_inset-x-0 sm_bottom-0 sm_top-auto sm_rounded-b-none",P?"opacity-100 sm_translate-y-0":"opacity-0 sm_translate-y-full","dynamic"===ee&&P?"scale-100":"","dynamic"!==ee||P?"":"scale-0 sm_scale-100",!m&&("wide"===C?"min-w-100":"min-w-85"),re,!f&&"rounded-xxl"),le=b("relative overflow-hidden sm_rounded-b-none",!f&&"rounded-xxl"),se=l((()=>{var e,t,n,o,r,i,l,s;if("center"===ee)return null;const a={right:{top:null===(e=Z.arrow)||void 0===e?void 0:e.y,left:(null===(t=Z.arrow)||void 0===t?void 0:t.x)||"-10px"},left:{top:null===(n=Z.arrow)||void 0===n?void 0:n.y,right:(null===(o=Z.arrow)||void 0===o?void 0:o.x)||"-10px"},bottom:{top:"-10px",left:(null===(r=Z.arrow)||void 0===r?void 0:r.x)||"-10px"},top:{bottom:"-10px",left:(null===(i=Z.arrow)||void 0===i?void 0:i.x)||"-10px"}},c=Ke[(null===(s=null===(l=Z.flip)||void 0===l?void 0:l.overflows)||void 0===s?void 0:s.length)||0],d=a[c],f=b("absolute z-30 block size-6 rotate-45 rounded-xs duration-400 ease-cubic-modal sm_hidden","top"===c?"bg-grayscale-l4":"bg-white");return u("div",{className:f,"data-testid":"authorize-modal-arrow",ref:V,style:d})}),[null===(D=Z.arrow)||void 0===D?void 0:D.x,null===(A=Z.arrow)||void 0===A?void 0:A.y,null===(z=Z.flip)||void 0===z?void 0:z.overflows,ee]),ae=Boolean(d),ce=b("flex w-full items-center p-4 pb-2",c?"justify-between":"justify-end",ae&&"mb-5 gap-x-4 border-b border-solid border-grayscale-l2l px-5 pb-4"),ue="dynamic"===ee?Y:void 0,de=f?null:u("div",{className:ce,"data-testid":"authorize-modal-header","data-variant":ae?"with-title":"default",children:[c,ae&&u("div",{className:"flex-1 font-sans text-body-large",children:d}),u("button",{"aria-label":I("button.close",{defaultValue:"Close"}),className:"group relative z-50 flex size-6 cursor-pointer rounded-max","data-testid":"authorize-modal-close-button",onClick:()=>te("close_button"),type:"button",children:[u(x,{className:"size-6 text-grayscale-l4 transition-colors group-hover_text-grayscale-l2l"}),u("div",{className:"absolute inset-05 -z-10 rounded-max bg-grayscale-primary-light"})]})]}),fe=P?{}:{"aria-hidden":!0};return E(u(R,{instanceId:$,type:"modal",variant:M,children:u("div",{className:oe,"data-testid":"authorize-modal-container","data-variant":C,children:[u("div",Object.assign({},fe,{className:ne,"data-testid":"authorize-modal-overlay",onClick:()=>te("overlay")})),u(Je,Object.assign({as:"section",disabled:!U,"aria-modal":"true"},fe,{"aria-label":L,className:ie,"data-testid":"authorize-modal","data-visible":P,part:"modal",ref:e=>{W.current=e,j&&(G.setFloating(e),J())},role:"dialog",style:ue,children:[u("div",{className:le,children:[de,a]}),se]}))]})},T),v.body)},et=()=>u(d,{children:[u("div",{class:"animate-pulse px-4 py-1 pb-6","data-testid":"loading-skeleton",children:[u("div",{class:"flex items-center pb-3",children:[u("div",{class:"mr-3 size-6 rounded-max bg-grayscale-l2"}),u("div",{class:"mr-20 h-3 flex-1 rounded-md bg-grayscale-l2"})]}),u("div",{class:"h-10 rounded-md bg-grayscale-l2"})]}),u("div",{class:"h-10 animate-pulse bg-grayscale-l3"})]}),tt=({children:e})=>{const{uiRendered:t}=p();return u(d,{children:[!t&&u(et,{}),u("div",{children:e})]})},nt=["api_unavailable","captcha_challenge","retriable_server_error"],ot=[/existing customer \d+ on shop \d+ has a conflicting provider subject associated: existing '([^']+)' != incoming '([^']+)'/,/no_prequalification_amount_available/];function rt(e,t){return!(nt.includes(e)||ot.some((e=>e.test(t))))}const it=s((({activator:e,allowAttribute:o,anchorTo:r,autoOpen:l,disableDefaultIframeResizing:s=!1,insideModal:a=!0,keepModalOpen:c=!1,modalHeaderTitle:d,modalHeaderVisible:f=!0,onComplete:m,onCustomFlowSideEffect:h,onError:g,onLoaded:y,onModalVisibleChange:w,onResizeIframe:b,onStripeLinkUserFound:x,onPromptChange:E,onPromptContinue:R,proxy:j,scrolling:H,src:V,storefrontOrigin:B,modalType:W,variant:U},q)=>{const{dispatch:$,loaded:X,modalVisible:Y}=p(),{leaveBreadcrumb:Z,notify:G}=T(),J=L(),{clearLoadTimeout:K,initLoadTimeout:Q}=O(),{trackPageImpression:ee,trackPostMessageTransmission:te}=_(),{recordCounter:ne}=k(),oe=t(null),re=C(Y),ie=i((e=>{$({type:"showModal",reason:e})}),[$]),le=i((({dismissMethod:t,reason:n})=>{Y&&($({type:"hideModal",reason:n,dismissMethod:t}),(null==e?void 0:e.current)&<(e)&&e.current.focus())}),[e,$,Y]);n((()=>{const t=N((function(){ie("user_button_clicked")}),150,!0),n=e;if((null==n?void 0:n.current)&<(n))return n.current.addEventListener("click",t),()=>{var e;null===(e=n.current)||void 0===e||e.removeEventListener("click",t)}}),[e,ie]);const se=i((()=>{z({iframe:oe.current,src:V})}),[V]),{destroy:ae,waitForMessage:ce}=M({includeCore:j,onClose:()=>le({dismissMethod:"auto",reason:"event_close_requested"}),onComplete:e=>S(void 0,void 0,void 0,(function*(){!c&&a&&le({dismissMethod:"auto",reason:"event_completed"}),yield null==m?void 0:m(e)})),onCustomFlowSideEffect:h,onError:e=>{const{message:t,code:n}=e;rt(n,t)?(Z("authorize error",{code:n,message:t},"state"),G(new F(t,"AuthorizeError"))):(ne("shop_js_handle_silent_error",{attributes:{errorCode:n}}),Z("silent error",{code:n},"state")),K(),null==g||g(e)},onLoaded:e=>{$({type:"loaded",payload:{autoOpen:Boolean(l),sessionDetected:e.userFound}}),null==y||y(e),K()},onUnloaded:()=>{$({type:"reset"})},onResizeIframe:e=>{s||oe.current&&(oe.current.style.height=`${e.height}px`),e.height>0&&$({type:"uiRendered"}),null==b||b(e)},onShopUserMatched:()=>{J("shopusermatched"),Z("shop user matched",{},"state")},onShopUserNotMatched:({apiError:e})=>{J("shopusernotmatched",e&&{apiError:e}),Z("shop user not matched",{},"state")},onStripeLinkUserFound:e=>{Z("stripe link user found - raw event",{event:e},"state");const t={email:null==e?void 0:e.email,phone:null==e?void 0:e.phone};t.email||Z("stripe link user found - missing email",{event:e,detail:t},"error"),J("stripelinkuserfound",t),Z("stripe link user found",{email:null==e?void 0:e.email,phone:null==e?void 0:e.phone},"state"),null==x||x(e)},onPromptChange:()=>{null==E||E()},onPromptContinue:()=>{null==R||R()},source:oe,storefrontOrigin:B});n((()=>()=>{oe.current&&ae()}),[ae]);const ue=i(((e,...t)=>S(void 0,[e,...t],void 0,(function*(e,{afterLoaded:t=!1}={}){var n;t&&!X&&(yield ce("loaded")),I({contentWindow:null===(n=oe.current)||void 0===n?void 0:n.contentWindow,event:e,onMessageSent:e=>te({direction:"outgoing",event:e})})}))),[X,te,ce]);n((()=>{var e;if(Y!==re)if(Y){try{ue({type:"sheetmodalopened"},{afterLoaded:!0}),J("modalopened")}catch(e){G(new Error(`Error before calling onModalVisibleChange(true): ${e}`))}null==w||w(!0)}else ue({type:"sheetmodalclosed"},{afterLoaded:!0}),J("modalclosed"),null==w||w(!1),null===(e=v.querySelector("com-1password-notification"))||void 0===e||e.remove()}),[J,Y,G,w,ue,re]),P(q,(()=>({close:le,iframeRef:oe,open:ie,postMessage:ue,reload:se,waitForMessage:ce})),[le,ie,ue,se,ce]),n((()=>{Q(),Z("Iframe url updated",{src:V},"state")}),[Q,Z,V]),n((()=>{Y&&ee({page:"AUTHORIZE_MODAL"})}),[Y,ee]),n((()=>{z({iframe:oe.current,src:V})}),[V]);const de=u("iframe",{allow:o||"publickey-credentials-get *",className:"relative z-40 m-auto w-full border-none",ref:e=>{e&&(oe.current=e,e.getAttribute("src")||e.setAttribute("src",V))},tabIndex:0,scrolling:H,"data-testid":"authorize-iframe"}),fe=d?u(D,{className:"size-8 text-purple-primary"}):u(A,{className:"h-4-5 text-purple-primary"});return a?u(Qe,{anchorTo:r,headerLogo:fe,headerTitle:d,hideHeader:!f,onDismiss:e=>le({dismissMethod:e,reason:"user_dismissed"}),onModalInViewport:()=>{ee({page:"AUTHORIZE_MODAL_IN_VIEWPORT",allowDuplicates:!0}),Z("modal in viewport",{},"state")},type:W,variant:U,visible:Y,children:u(tt,{children:de})}):de}));function lt(e){return Object.prototype.hasOwnProperty.call(e,"current")}it.displayName="AuthorizeIframe";export{it as A,Qe as M,rt as i}; //# sourceMappingURL=chunk.modal_DmDXaa6V.esm.js.map