import{t as e}from"./chunk.document_DMcRsBXN.esm.js";import{t}from"./chunk.window_CAbVMZox.esm.js";import{l as n,s as o}from"./chunk.casing_U_9x-Om3.esm.js";import{A as r,E as i,O as l,S as a,T as s,_ as c,d,g as u,j as f,k as m,s as h,w as p,x as v}from"./chunk.register_Cnn1s0Rw.esm.js";import{t as g}from"./chunk.hooks_B8JiKvZ3.esm.js";import{a as y,o as w,t as b}from"./chunk.css_3LXkvzsj.esm.js";import{t as x}from"./chunk.PortalProvider_BcqAKZox.esm.js";import{t as R}from"./chunk.hooks_DeX7xKd-.esm.js";const E=o({dispatch:()=>{throw new Error("Invalid attempt to call dispatch outside of AuthorizeStateProvider")},isLoaded:()=>!1,loaded:!1,modalDismissible:!1,modalForceHidden:!1,modalVisible:!1,uiRendered:!1}),T=()=>r(E),L=Math.min,k=Math.max,_=Math.round,D=Math.floor,S=e=>({x:e,y:e}),P={left:"right",right:"left",bottom:"top",top:"bottom"},F={start:"end",end:"start"};function V(e,t,n){return k(e,L(t,n))}function C(e,t){return"function"==typeof e?e(t):e}function z(e){return e.split("-")[0]}function M(e){return e.split("-")[1]}function H(e){return"x"===e?"y":"x"}function A(e){return"y"===e?"height":"width"}function O(e){return["top","bottom"].includes(z(e))?"y":"x"}function N(e){return H(O(e))}function j(e){return e.replace(/start|end/g,(e=>F[e]))}function B(e){return e.replace(/left|right|bottom|top/g,(e=>P[e]))}function I(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 W(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 $(e,t,n){let{reference:o,floating:r}=e;const i=O(t),l=N(t),a=A(l),s=z(t),c="y"===i,d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,f=o[a]/2-r[a]/2;let m;switch(s){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:u};break;case"left":m={x:o.x-r.width,y:u};break;default:m={x:o.x,y:o.y}}switch(M(t)){case"start":m[l]-=f*(n&&c?-1:1);break;case"end":m[l]+=f*(n&&c?-1:1)}return m}async function q(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:m=0}=C(t,e),h=I(m),p=a[f?"floating"===u?"reference":"floating":u],v=W(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(p)))||n?p:p.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:s})),g="floating"===u?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.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=W(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:y,strategy:s}):g);return{top:(v.top-b.top+h.top)/w.y,bottom:(b.bottom-v.bottom+h.bottom)/w.y,left:(v.left-b.left+h.left)/w.x,right:(b.right-v.right+h.right)/w.x}}function X(){return"undefined"!=typeof window}function Y(e){return G(e)?(e.nodeName||"").toLowerCase():"#document"}function Z(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function U(e){var t;return null==(t=(G(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function G(e){return!!X()&&(e instanceof Node||e instanceof Z(e).Node)}function J(e){return!!X()&&(e instanceof Element||e instanceof Z(e).Element)}function K(e){return!!X()&&(e instanceof HTMLElement||e instanceof Z(e).HTMLElement)}function Q(e){return!(!X()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Z(e).ShadowRoot)}function ee(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=le(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function te(e){return["table","td","th"].includes(Y(e))}function ne(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function oe(e){const t=re(),n=J(e)?le(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 re(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function ie(e){return["html","body","#document"].includes(Y(e))}function le(e){return Z(e).getComputedStyle(e)}function ae(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function se(e){if("html"===Y(e))return e;const t=e.assignedSlot||e.parentNode||Q(e)&&e.host||U(e);return Q(t)?t.host:t}function ce(e){const t=se(e);return ie(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&ee(t)?t:ce(t)}function de(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=ce(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),l=Z(r);if(i){const e=ue(l);return t.concat(l,l.visualViewport||[],ee(r)?r:[],e&&n?de(e):[])}return t.concat(r,de(r,[],n))}function ue(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fe(e){const t=le(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=K(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,a=_(n)!==i||_(o)!==l;return a&&(n=i,o=l),{width:n,height:o,$:a}}function me(e){return J(e)?e:e.contextElement}function he(e){const t=me(e);if(!K(t))return S(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=fe(t);let l=(i?_(n.width):n.width)/o,a=(i?_(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const pe=S(0);function ve(e){const t=Z(e);return re()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:pe}function ge(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=me(e);let l=S(1);t&&(o?J(o)&&(l=he(o)):l=he(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Z(e))&&t}(i,n,o)?ve(i):S(0);let s=(r.left+a.x)/l.x,c=(r.top+a.y)/l.y,d=r.width/l.x,u=r.height/l.y;if(i){const e=Z(i),t=o&&J(o)?Z(o):o;let n=e,r=ue(n);for(;r&&o&&t!==n;){const e=he(r),t=r.getBoundingClientRect(),o=le(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,c*=e.y,d*=e.x,u*=e.y,s+=i,c+=l,n=Z(r),r=ue(n)}}return W({width:d,height:u,x:s,y:c})}function ye(e,t){const n=ae(e).scrollLeft;return t?t.left+n:ge(U(e)).left+n}function we(e,t,n){void 0===n&&(n=!1);const o=e.getBoundingClientRect();return{x:o.left+t.scrollLeft-(n?0:ye(e,o)),y:o.top+t.scrollTop}}function be(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Z(e),o=U(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,a=0,s=0;if(r){i=r.width,l=r.height;const e=re();(!e||e&&"fixed"===t)&&(a=r.offsetLeft,s=r.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n);else if("document"===t)o=function(e){const t=U(e),n=ae(e),o=e.ownerDocument.body,r=k(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=k(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+ye(e);const a=-n.scrollTop;return"rtl"===le(o).direction&&(l+=k(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:a}}(U(e));else if(J(t))o=function(e,t){const n=ge(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=K(e)?he(e):S(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=ve(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return W(o)}function xe(e,t){const n=se(e);return!(n===t||!J(n)||ie(n))&&("fixed"===le(n).position||xe(n,t))}function Re(e,t){const n=t.get(e);if(n)return n;let o=de(e,[],!1).filter((e=>J(e)&&"body"!==Y(e))),r=null;const i="fixed"===le(e).position;let l=i?se(e):e;for(;J(l)&&!ie(l);){const t=le(l),n=oe(l);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&["absolute","fixed"].includes(r.position)||ee(l)&&!n&&xe(e,l))?o=o.filter((e=>e!==l)):r=t,l=se(l)}return t.set(e,o),o}function Ee(e,t,n){const o=K(t),r=U(t),i="fixed"===n,l=ge(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const s=S(0);if(o||!o&&!i)if(("body"!==Y(t)||ee(r))&&(a=ae(t)),o){const e=ge(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else r&&(s.x=ye(r));const c=!r||o||i?S(0):we(r,a);return{x:l.left+a.scrollLeft-s.x-c.x,y:l.top+a.scrollTop-s.y-c.y,width:l.width,height:l.height}}function Te(e){return"static"===le(e).position}function Le(e,t){if(!K(e)||"fixed"===le(e).position)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function ke(e,t){const n=Z(e);if(ne(e))return n;if(!K(e)){let t=se(e);for(;t&&!ie(t);){if(J(t)&&!Te(t))return t;t=se(t)}return n}let o=Le(e,t);for(;o&&te(o)&&Te(o);)o=Le(o,t);return o&&ie(o)&&Te(o)&&!oe(o)?n:o||function(e){let t=se(e);for(;K(t)&&!ie(t);){if(oe(t))return t;if(ne(t))return null;t=se(t)}return null}(e)||n}const _e={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,l=U(o),a=!!t&&ne(t.floating);if(o===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},c=S(1);const d=S(0),u=K(o);if((u||!u&&!i)&&(("body"!==Y(o)||ee(l))&&(s=ae(o)),K(o))){const e=ge(o);c=he(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const f=!l||u||i?S(0):we(l,s,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-s.scrollTop*c.y+d.y+f.y}},getDocumentElement:U,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?ne(t)?[]:Re(t,this._c):[].concat(n),o],l=i[0],a=i.reduce(((e,n)=>{const o=be(t,n,r);return e.top=k(o.top,e.top),e.right=L(o.right,e.right),e.bottom=L(o.bottom,e.bottom),e.left=k(o.left,e.left),e}),be(t,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:ke,getElementRects:async function(e){const t=this.getOffsetParent||ke,n=this.getDimensions,o=await n(e.floating);return{reference:Ee(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}=fe(e);return{width:t,height:n}},getScale:he,isElement:J,isRTL:function(e){return"rtl"===le(e).direction}};function De(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Se(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,c=me(e),d=r||i?[...c?de(c):[],...de(t)]:[];d.forEach((e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&a?function(e,t){let n,o=null;const r=U(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),i();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:m}=c;if(a||t(),!f||!m)return;const h={rootMargin:-D(u)+"px "+-D(r.clientWidth-(d+f))+"px "+-D(r.clientHeight-(u+m))+"px "+-D(d)+"px",threshold:k(0,L(1,s))||1};let p=!0;function v(t){const o=t[0].intersectionRatio;if(o!==s){if(!p)return l();o?l(!1,o):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}1!==o||De(c,e.getBoundingClientRect())||l(),p=!1}try{o=new IntersectionObserver(v,{...h,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(v,h)}o.observe(e)}(!0),i}(c,n):null;let f,m=-1,h=null;l&&(h=new ResizeObserver((e=>{let[o]=e;o&&o.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!s&&h.observe(c),h.observe(t));let p=s?ge(e):null;return s&&function t(){const o=ge(e);p&&!De(p,o)&&n();p=o,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const Pe=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:a}=t,s=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=z(n),a=M(n),s="y"===O(n),c=["left","top"].includes(l)?-1:1,d=i&&s?-1:1,u=C(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&"number"==typeof h&&(m="end"===a?-1*h:h),s?{x:m*d,y:f*c}:{x:f*c,y:m*d}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:l}}}}},Fe=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:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=C(e,t),c={x:n,y:o},d=await q(t,s),u=O(z(r)),f=H(u);let m=c[f],h=c[u];if(i){const e="y"===f?"bottom":"right";m=V(m+d["y"===f?"top":"left"],m,m-d[e])}if(l){const e="y"===u?"bottom":"right";h=V(h+d["y"===u?"top":"left"],h,h-d[e])}const p=a.fn({...t,[f]:m,[u]:h});return{...p,data:{x:p.x-n,y:p.y-o}}}}},Ve=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:a,platform:s,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:p=!0,...v}=C(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=z(r),y=O(a),w=z(a)===a,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),x=f||(w||!p?[B(a)]:function(e){const t=B(e);return[j(e),t,j(t)]}(a)),R="none"!==h;!f&&R&&x.push(...function(e,t,n,o){const r=M(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[]}}(z(e),"start"===n,o);return r&&(i=i.map((e=>e+"-"+r)),t&&(i=i.concat(i.map(j)))),i}(a,p,h,b));const E=[a,...x],T=await q(t,v),L=[];let k=(null==(o=i.flip)?void 0:o.overflows)||[];if(d&&L.push(T[g]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=M(e),r=N(e),i=A(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=B(l)),[l,B(l)]}(r,l,b);L.push(T[e[0]],T[e[1]])}if(k=[...k,{placement:r,overflows:L}],!L.every((e=>e<=0))){var _,D;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=E[e];if(t)return{data:{index:e,overflows:k},reset:{placement:t}};let n=null==(D=k.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:D.placement;if(!n)switch(m){case"bestFit":{var S;const e=null==(S=k.filter((e=>{if(R){const t=O(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:S[0];e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}},Ce=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:l,elements:a,middlewareData:s}=t,{element:c,padding:d=0}=C(e,t)||{};if(null==c)return{};const u=I(d),f={x:n,y:o},m=N(r),h=A(m),p=await l.getDimensions(c),v="y"===m,g=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",b=i.reference[h]+i.reference[m]-f[m]-i.floating[h],x=f[m]-i.reference[m],R=await(null==l.getOffsetParent?void 0:l.getOffsetParent(c));let E=R?R[w]:0;E&&await(null==l.isElement?void 0:l.isElement(R))||(E=a.floating[w]||i.floating[h]);const T=b/2-x/2,k=E/2-p[h]/2-1,_=L(u[g],k),D=L(u[y],k),S=_,P=E-p[h]-D,F=E/2-p[h]/2+T,z=V(S,F,P),H=!s.arrow&&null!=M(r)&&F!==z&&i.reference[h]/2-(F{const o=new Map,r={platform:_e,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=$(c,o,s),f=o,m={},h=0;for(let n=0;n{t.current=e})),t}const Oe={mobile:["max-width: 448px"],tablet:["min-width: 449px","max-width: 1000px","max-height: 920px"]};function Ne({className:e}){return c("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:c("path",{fill:"currentColor","fill-rule":"evenodd",d:"M0 10C0 4.477 4.477 0 10 0s10 4.477 10 10-4.477 10-10 10S0 15.523 0 10Zm7.707-3.707a1 1 0 0 0-1.414 1.414L8.586 10l-2.293 2.293a1 1 0 1 0 1.414 1.414L10 11.414l2.293 2.293a1 1 0 0 0 1.414-1.414L11.414 10l2.293-2.293a1 1 0 0 0-1.414-1.414L10 8.586 7.707 6.293Z","clip-rule":"evenodd"})})}const je=({className:e,headerTitle:t,headerLogo:n,onDismiss:o})=>{const{translate:r}=g(),i=Boolean(t),l=i?"with-title":"default",a=b("flex w-full items-center p-4 pb-2",n?"justify-between":"justify-end",i&&"mb-5 gap-x-4 border-b border-solid border-grayscale-l2l px-5 pb-4",e);return c("div",{className:a,"data-testid":"authorize-modal-header","data-variant":l,children:[n,i&&c("h2",{className:"flex-1 font-sans text-body-large",children:t}),c("button",{"aria-label":r("button.close",{defaultValue:"Close"}),className:"group relative z-50 flex size-6 cursor-pointer rounded-max","data-testid":"authorize-modal-close-button",onClick:()=>o("close_button"),type:"button",children:[c(Ne,{className:"size-6 text-grayscale-l5 transition-colors group-hover_text-grayscale-l2l"}),c("div",{className:"absolute inset-05 -z-10 rounded-max bg-grayscale-primary-light"})]})]})},Be='\n a[href],\n area[href],\n input:not([type="hidden"]):not([disabled]):not([tabindex="-1"]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]):not([tabindex="-1"]),\n iframe,\n object,\n embed,\n [tabindex="0"],\n [contenteditable],\n audio[controls],\n video[controls]';const Ie=w((({as:e="div",children:t,disabled:o=!1,...r},i)=>{const l=a(null),d=a(null),u=a(null);s((()=>{var e;o||null===(e=l.current)||void 0===e||e.focus()}),[o]);const f=e=>{const t=l.current;var n;t&&!o&&((e?(n=t,n.querySelector(Be)):function(e){const t=e.querySelectorAll(Be);return t[t.length-1]}(t))||t).focus()},m=o?-1:0,h="absolute -m-px h-px w-px overflow-hidden whitespace-nowrap p-0";return c(n,{children:[c("div",{className:h,ref:d,onFocus:()=>f(!1),tabIndex:m}),c(e,{...r,ref:e=>{l.current=e,"function"==typeof i?i(e):i&&(i.current=e)},tabIndex:-1,children:t}),c("div",{className:h,ref:u,onFocus:()=>f(!0),tabIndex:m})]})})),We=["right","left","bottom","top"],$e=({anchorTo:n,children:o,dismissable:r=!0,headerLogo:l,headerTitle:s,hideHeader:u=!1,disableMinWidth:g=!1,key:w,modalTitle:R="Sign in with Shop",onDismiss:E,onModalInViewport:L,popupDisabled:k,type:_,variant:D,visible:S})=>{var P,F,V;const{dispatch:C,modalDismissible:z}=T(),M=a(null),[H,A]=i(null),[O,N]=i(0),j=a(null),B=a(null),I=a(null),[W,$]=i(!1),[q,X]=i(null),{instanceId:Y}=v(),{isDesktop:Z,isMobile:U}=function(){const e=Oe.mobile.every((e=>t.matchMedia(`(${e})`).matches)),n=!e&&Oe.tablet.every((e=>t.matchMedia(`(${e})`).matches));return{isMobile:e,isTablet:n,isDesktop:!e&&!n}}(),G=a(null),{floatingStyles:J,middlewareData:K,refs:Q,update:ee}=function(e={}){const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:l,floating:s}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[v,g]=i({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,w]=i(o);h(y,o)||w(o);const[b,x]=i(null),[R,E]=i(null),T=m((e=>{e!==D.current&&(D.current=e,x(e))}),[]),L=m((e=>{e!==S.current&&(S.current=e,E(e))}),[]),k=l||b,_=s||R,D=a(null),S=a(null),P=a(v),F=null!=d,V=Ae(d),C=Ae(r),z=m((()=>{if(!D.current||!S.current)return;const e={placement:t,strategy:n,middleware:y};C.current&&(e.platform=C.current),ze(D.current,S.current,e).then((e=>{const t={...e,isPositioned:!0};M.current&&!h(P.current,t)&&(P.current=t,g(t))})).catch((e=>{console.error("error caught during computePosition",e)}))}),[y,t,n,C]);f((()=>{!1===u&&P.current.isPositioned&&(P.current.isPositioned=!1,g((e=>({...e,isPositioned:!1}))))}),[u]);const M=a(!1);f((()=>(M.current=!0,()=>{M.current=!1})),[]),f((()=>{if(k&&(D.current=k),_&&(S.current=_),!1!==u&&k&&_){if(V.current)return V.current(k,_,z);z()}}),[u,k,_,z,V,F]);const H=p((()=>({reference:D,floating:S,setReference:T,setFloating:L})),[T,L]),A=p((()=>({reference:k,floating:_})),[k,_]),O=p((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=He(A.floating,v.x),o=He(A.floating,v.y);return c?{...e,transform:`translate(${t}px, ${o}px)`,...Me(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}}),[n,c,A.floating,v.x,v.y]);return p((()=>({...v,update:z,refs:H,elements:A,floatingStyles:O})),[v,z,H,A,O])}({middleware:[Ve({crossAxis:!1,fallbackPlacements:We.slice(1)}),Fe({padding:30}),Pe(30),(te={element:j,padding:28},{name:"arrow",options:te,fn(e){const{element:t,padding:n}=te;return t&&(o=t,{}.hasOwnProperty.call(o,"current"))?null!=t.current?Ce({element:t.current,padding:n}).fn(e):{}:t?Ce({element:t,padding:n}).fn(e):{};var o}})],placement:We[0],whileElementsMounted:Se,open:S});var te;f((()=>{var n,o;const r=()=>{var n,o;const r=(null===(n=t.visualViewport)||void 0===n?void 0:n.height)||t.innerHeight,i=null===(o=t.visualViewport)||void 0===o?void 0:o.offsetTop;N(i),e.documentElement.style.setProperty("--shop-js-visual-viewport-height",`${r}px`)};return r(),null===(n=t.visualViewport)||void 0===n||n.addEventListener("resize",r),null===(o=t.visualViewport)||void 0===o||o.addEventListener("scroll",r),t.addEventListener("orientationchange",r),()=>{var e,n;null===(e=t.visualViewport)||void 0===e||e.removeEventListener("resize",r),null===(n=t.visualViewport)||void 0===n||n.removeEventListener("scroll",r),t.removeEventListener("orientationchange",r)}}),[]),f((()=>{"checkoutModal"===D&&U&&O&&O>0&&S&&t.scrollTo({top:0})}),[U,O,D,S]),f((()=>{if(n){let t;t="string"==typeof n?e.querySelector(n):n.current,A(t),Q.setReference(t),S&&ee()}}),[n,Q,ee,S]),null===G.current&&(G.current=e.documentElement.style.overflow),!B.current&&d()&&(B.current=new IntersectionObserver((e=>{for(const n of e)n.boundingClientRect.top<0&&t.scrollTo({top:0,left:0}),n.isIntersecting&&(null==L||L())}))),!M.current&&d()&&(M.current=new IntersectionObserver((e=>{for(const o of e)if(o.boundingClientRect.top<0&&t.scrollTo({top:0,left:0}),!o.isIntersecting&&o.target.offsetTop){var n;const e=((null==H?void 0:H.offsetHeight)||0)+((null===(n=I.current)||void 0===n?void 0:n.offsetHeight)||0)/2+30;t.scrollTo({top:o.target.offsetTop-e})}}))),f((()=>()=>{B.current&&B.current.disconnect(),M.current&&M.current.disconnect()}),[]);const ne=p((()=>H&&!k&&Z?"dynamic":"center"),[H,Z,k]);f((()=>{const t=e.documentElement,n=null==t?void 0:t.style.overflow;return()=>{n&&t?t.style.overflow=n:t.style.removeProperty("overflow")}}),[]);const oe=m((t=>{z&&(E(t),e.documentElement.style.overflow=G.current||"")}),[z,E]),re=m((()=>{r?oe("overlay"):z&&X("horizontal")}),[r,oe,z]);f((()=>{if(!q)return;const e=setTimeout((()=>{X(null)}),300);return()=>{clearTimeout(e)}}),[q]),f((()=>{function e({key:e}){"Escape"!==e&&"Esc"!==e||oe("keyboard")}return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[oe]),f((()=>{S?(e.documentElement.style.overflow="hidden",B.current&&I.current&&B.current.observe(I.current),M.current&&H&&M.current.observe(H)):(B.current&&I.current&&B.current.unobserve(I.current),M.current&&H&&M.current.unobserve(H),e.documentElement.style.overflow=G.current||"")}),[H,oe,S]),f((()=>{var e;if(!S)return void $(!1);const t=()=>{$(!0)};return null===(e=I.current)||void 0===e||e.addEventListener("transitionend",t,{once:!0}),()=>{var e;null===(e=I.current)||void 0===e||e.removeEventListener("transitionend",t)}}),[S]),f((()=>{if(S){const e=setTimeout((()=>{C({type:"modalDismissible"})}),400);return()=>{clearTimeout(e)}}}),[C,S]);const ie=b("fixed inset-0 z-10 bg-overlay transition-opacity duration-400 ease-cubic-modal motion-reduce_duration-0",S?"opacity-100":"opacity-0"),le=b("fixed inset-0 z-max overflow-hidden","center"===ne&&"flex h-auto items-center justify-center sm_h-visual-viewport-height",S?"visible":"pointer-events-none invisible");let ae="";"checkoutModal"!==D&&"stepUpModal"!==D||(ae="wide"===_?"max-w-100 sm_max-w-none":"max-w-85 sm_max-w-none");const se=b("relative z-50 bg-white 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","dynamic"===ne?"transition-opacity":"transition",S?"opacity-100 sm_translate-y-0":"opacity-0 sm_translate-y-full","dynamic"===ne&&S?"scale-100":"","dynamic"!==ne||S?"":"scale-0 sm_scale-100","horizontal"===q&&"animate-modal-shake motion-reduce_animate-none",!g&&("wide"===_?"min-w-100":"min-w-85"),ae,!u&&"rounded-xxl",!Z&&"max-h-full"),ce=p((()=>{if(Z)return{};let t="calc(100vh - env(safe-area-inset-bottom, 0) - env(safe-area-inset-top, 0))";return"webkitTouchCallout"in e.documentElement.style&&(t="-webkit-fill-available"),{maxHeight:t}}),[Z]),de=b("relative flex flex-col sm_rounded-b-none"),ue=b("flex-1 overflow-y-auto",!U&&"rounded-xxl"),fe=p((()=>{var e,t,n,o,r,i,l;if("center"===ne)return null;const a={right:{top:null===(e=K.arrow)||void 0===e?void 0:e.y,left:(null===(t=K.arrow)||void 0===t?void 0:t.x)||"-10px"},left:{top:null===(n=K.arrow)||void 0===n?void 0:n.y,right:(null===(o=K.arrow)||void 0===o?void 0:o.x)||"-10px"},bottom:{top:"-10px",left:(null===(r=K.arrow)||void 0===r?void 0:r.x)||"-10px"},top:{bottom:"-10px",left:(null===(i=K.arrow)||void 0===i?void 0:i.x)||"-10px"}},s=We[(null===(l=K.flip)||void 0===l||null===(l=l.overflows)||void 0===l?void 0:l.length)||0],d=a[s],u=b("absolute z-30 block size-6 rotate-45 rounded-xs duration-400 ease-cubic-modal sm_hidden","top"===s?"bg-grayscale-l5":"bg-white");return c("div",{className:u,"data-testid":"authorize-modal-arrow",ref:j,style:d})}),[null===(P=K.arrow)||void 0===P?void 0:P.x,null===(F=K.arrow)||void 0===F?void 0:F.y,null===(V=K.flip)||void 0===V?void 0:V.overflows,ne]),me="dynamic"===ne?J:void 0,he=S?{}:{"aria-hidden":!0};return y(c(x,{instanceId:Y,type:"modal",variant:D,children:c("div",{className:le,"data-testid":"authorize-modal-container","data-variant":_,children:[c("div",{...he,className:ie,"data-testid":"authorize-modal-overlay",onClick:re}),c(Ie,{as:"section",disabled:!W,"aria-modal":"true",...he,"aria-label":R,className:se,"data-testid":"authorize-modal","data-visible":S,part:"modal",ref:e=>{I.current=e,H&&(Q.setFloating(e),S&&ee())},role:"dialog",style:me,children:[c("div",{"data-testid":"authorize-modal-content",className:de,style:ce,children:[!u&&c(je,{headerTitle:s,headerLogo:l,onDismiss:oe}),c("div",{"data-testid":"authorize-modal-children",className:ue,children:o})]}),fe]}),c("div",{className:"fixed inset-x-0 bottom-0 top-visual-viewport z-max hidden bg-white sm_block"})]})},w),e.body)},qe=(e,t)=>{switch(t.type){case"hideModal":return{...e,modalVisible:!1};case"loaded":{const n=t.payload.autoOpen&&t.payload.sessionDetected&&!e.modalVisible;return{...e,loaded:!0,...n&&!e.modalForceHidden&&{modalDismissible:!1,modalVisible:!0}}}case"modalDismissible":return{...e,modalDismissible:!0};case"reset":return{...Xe,modalForceHidden:e.modalForceHidden};case"uiRendered":return{...e,uiRendered:!0};case"showModal":return e.modalForceHidden&&"user_button_clicked"!==t.reason?e:{...e,modalDismissible:!1,modalForceHidden:!1,modalVisible:!0};case"windoidClosed":return{...e,modalForceHidden:!1};case"windoidOpened":return{...e,modalForceHidden:!0,modalVisible:!1};default:return e}},Xe={loaded:!1,uiRendered:!1,modalDismissible:!1,modalForceHidden:!1,modalVisible:!1};const Ye=({children:e})=>{const{leaveBreadcrumb:t,notify:n}=u(),{trackModalStateChange:o}=R(),r=m((({action:e,previousState:r,state:i})=>{const l=r.modalVisible!==i.modalVisible,a=i.modalVisible?"shown":"hidden";if("loaded"===e.type&&(o({currentState:"loaded",reason:"event_loaded"}),t("iframe loaded",{},"state")),l)switch(e.type){case"loaded":o({currentState:a,reason:"event_loaded_with_auto_open"});break;case"windoidOpened":o({currentState:a,dismissMethod:"windoid_continue",reason:"event_windoid_opened"});break;case"showModal":o({currentState:a,reason:e.reason});break;case"hideModal":o({currentState:a,dismissMethod:e.dismissMethod,reason:e.reason});break;case"reset":o({currentState:a,reason:"event_restarted"});break;default:n(new Error(`Could not determine state change reason for action: ${e}`))}}),[t,n,o]),i=m(((e,t)=>{const n=qe(e,t);return r({action:t,previousState:e,state:n}),n}),[r]),[s,d]=l(i,{loaded:!1,modalDismissible:!1,modalForceHidden:!1,modalVisible:!1,uiRendered:!1}),f=a(!1),h=m((e=>{f.current=function(e,t){return qe({...Xe,loaded:e},t).loaded}(f.current,e),d(e)}),[d]),v=m((()=>f.current),[]),g=p((()=>{const{loaded:e,modalDismissible:t,modalForceHidden:n,modalVisible:o,uiRendered:r}=s;return{dispatch:h,isLoaded:v,loaded:e,modalDismissible:t,modalForceHidden:n,modalVisible:o,uiRendered:r}}),[h,v,s]);return c(E.Provider,{value:g,children:e})};export{$e as n,T as r,Ye as t}; //# sourceMappingURL=chunk.AuthorizeStateProvider_B7VsfgRh.esm.js.map