'use client';
import{jsx as e}from"react/jsx-runtime";import{useCartData as t}from"@gem-sdk/core";import{useRef as n}from"react";import o from"../../button/components/Button.js";let CheckoutNow=({setting:i,builderAttrs:c,builderProps:r,style:d,styles:l,className:w})=>{let{data:s}=t(),u=n(null),m=(e,t)=>{if(i?.openMode==="popup"){let n=void 0!==window.screenLeft?window.screenLeft:window.screenX,o=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,c=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,r=i/window.screen.availWidth,d=(i-e)/2/r+n,l=(c-t)/2/r+o;u.current=window.open(s?.checkoutUrl,"checkout",`scrollbars=yes, width=${e/r}, height=${t/r}, top=${l}, left=${d}`),u.current?.focus()}else s?.checkoutUrl&&window.open(s?.checkoutUrl)};return e(o,{builderAttrs:c,builderProps:r,onClick:()=>m(600,600),style:d,className:w,setting:{label:i?.label},styles:l})};export{CheckoutNow as default};
