'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("@gem-sdk/core");exports.default=({setting:l,styles:r,builderAttrs:a,builderProps:i,className:n,style:g})=>{let{data:o}=t.useCartData(),{openCart:p}=t.useCartUI(),c=t.useFormatMoney(o?.totalPrice??0,!1),d=s.useMemo(()=>o?.lineItems.reduce((e,s)=>e+s.quantity,0)??0,[o?.lineItems]),u=t.getGlobalColorStateStyle("c",r?.iconColor),m=l?.enableHoverEffect?u:t.filterHoverVariables(u);return e.jsx("div",{...a,"data-id":i?.uid,"aria-hidden":!0,style:g,className:t.cls("gp-relative gp-inline-block",i?.uid,n),onClick:p,children:e.jsxs("div",{className:"gp-flex gp-cursor-pointer gp-items-center gp-gap-4",children:[e.jsxs("div",{className:t.cls("gp-relative",t.getGlobalColorStateClass("text",r?.iconColor)),style:m,children:[l?.svgIcon?e.jsx("span",{className:"gp-flex gp-h-8 gp-w-8 gp-items-center gp-justify-center [&_>_svg]:gp-h-8 [&_>_svg]:gp-w-8",dangerouslySetInnerHTML:{__html:l.svgIcon}}):e.jsx("span",{className:"gp-flex gp-h-8 gp-w-8 gp-items-center gp-justify-center [&_>_svg]:gp-h-8 [&_>_svg]:gp-w-8",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"})})}),e.jsx("span",{className:"gp-absolute -gp-right-2 -gp-top-1 gp-inline-flex gp-aspect-square gp-w-5 gp-animate-bounce gp-items-center gp-justify-center gp-rounded-full gp-bg-g-brand gp-text-xs gp-font-semibold gp-text-white",children:d})]}),!l?.iconOnly&&e.jsxs("div",{className:"gp-flex gp-flex-col",children:[e.jsx("span",{className:"gp-font-semibold",children:l?.label}),e.jsx("div",{children:e.jsxs("span",{"aria-label":"Total item","data-testid":"cart-total",children:[d," items - ",c]})})]})]})})};
