{"version":3,"file":"Inverted_CMS_Color.DoiY9qpv.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/DxEl4VwSth7Q5sU18etC/x6b4WEjFOGfalnRpp7P9/Inverted_CMS_Color.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";// ═══════════════════════════════════════════════════════════════\n// 1. FARBEN — HIER ÄNDERN\n// ═══════════════════════════════════════════════════════════════\n// Dunkle Hintergründe\nconst DARK_H1=\"#FFFFF\";const DARK_H2_H6=\"#FFFFFF\";const DARK_BODY=\"#9EB4B5\";const DARK_LINK=\"#7E9B9E\";// Helle Hintergründe\nconst LIGHT_H1=\"#172527\";const LIGHT_H2_H6=\"#293C3E\";const LIGHT_BODY=\"#4F6062\";const LIGHT_LINK=\"#52787B\";const THEMES={dark:{h1:DARK_H1,heading:DARK_H2_H6,body:DARK_BODY,link:DARK_LINK},light:{h1:LIGHT_H1,heading:LIGHT_H2_H6,body:LIGHT_BODY,link:LIGHT_LINK}};const SKIP='script, style, noscript, svg, code, pre, textarea, button, [contenteditable=\"true\"], [aria-hidden=\"true\"]';function applyColors(root,colors,saved){const elements=[root,...Array.from(root.querySelectorAll(\"*\"))];for(const element of elements){if(element.closest(SKIP))continue;if(!(element instanceof HTMLElement))continue;const link=element.closest(\"a\");const heading=element.closest(\"h1, h2, h3, h4, h5, h6\");let target=colors.body;// Heading colors\nif(heading?.tagName===\"H1\"&&root.contains(heading)){target=colors.h1;}else if(heading&&root.contains(heading)){target=colors.heading;}// Links have priority\nif(link&&root.contains(link)){target=colors.link;}// Avoid unnecessary style updates\nif(element.style.getPropertyValue(\"color\")===target&&element.style.getPropertyPriority(\"color\")===\"important\"){continue;}// Save original color\nif(!saved.has(element)){saved.set(element,{value:element.style.getPropertyValue(\"color\"),priority:element.style.getPropertyPriority(\"color\")});}// Force color over Framer styles\nelement.style.setProperty(\"color\",target,\"important\");}}function restoreColors(saved){saved.forEach((original,element)=>{if(original.value){element.style.setProperty(\"color\",original.value,original.priority);}else{element.style.removeProperty(\"color\");}});saved.clear();}// ═══════════════════════════════════════════════════════════════\n// 3. OVERRIDE FACTORY\n// ═══════════════════════════════════════════════════════════════\nfunction makeOverride(Component,theme){return /*#__PURE__*/forwardRef(function RichTextColors(props,ref){const elementRef=useRef(null);useEffect(()=>{const root=elementRef.current;if(!root||typeof MutationObserver===\"undefined\"){return;}const saved=new Map;const colors=THEMES[theme];let frame=0;const observer=new MutationObserver(()=>{if(frame)return;frame=requestAnimationFrame(()=>{frame=0;update();});});function update(){// Prevent observing own changes\nobserver.disconnect();try{applyColors(root,colors,saved);}finally{observer.observe(root,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:[\"style\",\"class\"]});}}// Apply immediately after mounting\nupdate();return()=>{observer.disconnect();if(frame){cancelAnimationFrame(frame);}restoreColors(saved);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{elementRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref){ref.current=node;}}});});}// ═══════════════════════════════════════════════════════════════\n// 4. FRAMER OVERRIDES\n// ═══════════════════════════════════════════════════════════════\n// For dark backgrounds\nexport function withRichTextDark(Component){return makeOverride(Component,\"dark\");}// For light backgrounds\nexport function withRichTextLight(Component){return makeOverride(Component,\"light\");}// Default: dark background\nexport function withRichTextColors(Component){return makeOverride(Component,\"dark\");}\nexport const __FramerMetadata__ = {\"exports\":{\"withRichTextColors\":{\"type\":\"reactHoc\",\"name\":\"withRichTextColors\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRichTextLight\":{\"type\":\"reactHoc\",\"name\":\"withRichTextLight\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRichTextDark\":{\"type\":\"reactHoc\",\"name\":\"withRichTextDark\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Inverted_CMS_Color.map"],"mappings":"gIAK4X,SAAS,EAAY,EAAK,EA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