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