{"version":3,"file":"Cart.BiAIChgh.mjs","names":["_Fragment"],"sources":["https:/framerusercontent.com/modules/mVLf9HZqCEnninPqF5z3/zhLzZFJ5sCqxH45oefAY/Cart.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect}from\"react\";export default function Cart(){return /*#__PURE__*/_jsx(_Fragment,{});useEffect(()=>{let isUnmounted=false;const loadScriptOnce=({src,id,children=null})=>{return new Promise((resolve,reject)=>{const existing=document.getElementById(id);if(existing){resolve();return;}const script=document.createElement(\"script\");script.id=id;if(src){script.src=src;script.onload=()=>resolve();script.onerror=()=>reject(new Error(`Failed to load script: ${src}`));}else{if(children){script.appendChild(children);}resolve();}document.body.appendChild(script);});};const initCart=async()=>{// Reuse the same init if Framer mounts this component multiple times.\nif(!window.cartInitPromise){window.cartInitPromise=(async()=>{console.log(\"init cart\");window.isCartInit=false;window.cartLoadCounter=(window.cartLoadCounter||0)+1;if(window.addToCartEventListener){document.removeEventListener(\"click\",window.addToCartEventListener);}const scripts=[{src:\"https://cart.portals.care/prod/scripts.js?123\",id:\"portals-cart-script\"},{id:\"portals-cart-org\",children:document.createTextNode(\"window.organization = 'enhanced_com';\")}];await Promise.all(scripts.map(loadScriptOnce));window.cartAppLoaded=true;// Only create one observer globally.\nif(!window.cartObserver){window.cartObserver=new MutationObserver(()=>{const cartTitle=document.querySelector(\".cart-drawer-title\");if(cartTitle&&cartTitle.textContent?.trim()!==\"Your Cart\"){cartTitle.textContent=\"Your Cart\";}const ctaButton=document.querySelector(\".cart-checkout-button .mantine-Button-label\");if(ctaButton&&ctaButton.textContent?.trim()!==\"Continue →\"){ctaButton.textContent=\"Continue →\";}});window.cartObserver.observe(document.body,{childList:true,subtree:true,characterData:true});}})().catch(err=>{// Reset on failure so a later mount can retry.\nwindow.cartInitPromise=undefined;window.cartAppLoaded=false;console.error(\"Error loading Vue cart scripts or styles\",err);throw err;});}try{await window.cartInitPromise;}catch{// Error already logged above.\n}if(isUnmounted)return;};initCart();return()=>{isUnmounted=true;// Do not tear down global scripts/observer here unless you truly want\n// the cart system destroyed when this component unmounts.\n// Leaving them in place prevents duplicate re-inits in Framer.\n};},[]);return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                /*\n                Example overrides if needed:\n\n                #portals-cart-app button,\n                #portals-cart-app .cart-icon,\n                #portals-cart-app > * {\n                    background: #fff !important;\n                    background-color: #fff !important;\n                    border: none !important;\n                    box-shadow: none !important;\n                    border-radius: 0 !important;\n                }\n\n                #portals-cart-app path {\n                    stroke: #000 !important;\n                }\n                */\n            `}),/*#__PURE__*/_jsx(\"div\",{id:\"portals-cart-app\",style:{transform:\"scale(0.7)\",transformOrigin:\"center center\"}})]});}const containerStyle={height:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\",zIndex:10};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Cart\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Cart.map"],"mappings":"yHAA4G,SAAwB,GAAM,CAAC,OAAoB,EAAKA,EAAU,EAAE,CAAC,sBAAlG,IAA6B"}