{"version":3,"file":"Cart.CSVmnSAQ.mjs","names":[],"sources":["https:/framerusercontent.com/modules/mVLf9HZqCEnninPqF5z3/5B6w38Adgmc7z6nhpt3Q/Cart.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect}from\"react\";export default function Cart(){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\",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":"uIAAsF,SAAwB,GAAM,CAO5G,OAP6G,MAAc,CAAC,IAA4B,GAAgB,CAAC,MAAI,KAAG,WAAS,QAAgB,IAAI,SAAS,EAAQ,IAAS,CAA4C,GAA5B,SAAS,eAAe,EAAG,CAAa,CAAC,GAAS,CAAC,OAAQ,IAAM,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,GAAG,EAAM,GAAK,EAAO,IAAI,EAAI,EAAO,WAAW,GAAS,CAAC,EAAO,YAAY,EAAW,MAAM,0BAA0B,IAAM,CAAC,GAAU,GAAU,EAAO,YAAY,EAAS,CAAE,GAAS,EAAE,SAAS,KAAK,YAAY,EAAO,EAAG,CAI1iB,OAJ4jB,SAAS,CACzmB,AAA4B,EAAO,mBAAiB,SAAS,CAAC,QAAQ,IAAI,YAAY,CAAC,EAAO,WAAW,GAAM,EAAO,iBAAiB,EAA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