{"version":3,"file":"ParagraphAdjustments.B60IDL-Z.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/DtD6eL1AT7OLibo9V3id/NPlgcsfwSbiOIwwoeJuM/ParagraphAdjustments.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import styled from\"styled-components\";/**\n * Configuration options for the heading links functionality.\n */const CONFIG={scrollOffset:100,linkSymbol:\"#\",copySuccessSymbol:\"✓\"};/**\n * Styled component that applies bold link styling to all anchor tags within it.\n * Uses Framer's CSS variables for consistent theming.\n */const BoldLinkWrapper=styled.div`\n    a {\n        font-family: \"Degular Text Semibold\", -apple-system, system-ui, sans-serif !important;\n        white-space: nowrap;\n        border-bottom: 2px var(--framer-text-color) solid;\n        text-decoration: none !important;\n        color: var(--framer-text-color) !important;\n\n        &:hover,\n        &:active,\n        &:focus {\n            color: var(--framer-link-current-text-color) !important;\n            border-color: var(--framer-link-current-text-color);\n        }\n    }\n`;/**\n * AnchorBubble styled component.\n * It is positioned to the left of the heading text.\n * By default, it shows the link symbol (#). On hover, it applies bubble styling.\n */const AnchorBubble=styled.a`\n    position: absolute;\n    left: -30px;\n    top: 50%;\n    transform: translateY(-50%);\n    padding: 0 0.5rem;\n    font-family: \"Source Sans Pro\", sans-serif;\n    font-size: 10pt;\n    text-decoration: none;\n    line-height: 1.4em;\n    color: var(--framer-text-color);\n    background-color: transparent;\n    cursor: pointer;\n    opacity: 0; /* initially hidden */\n    border: 3px transparent solid !important;\n    border-radius: 9999px;\n\n    &:hover {\n        background-color: rgba(128, 128, 128, 0.5);\n        color: var(--background-color, #fff) !important;\n        opacity: 1;\n    }\n`;/**\n * HeadingWrapper styled component that positions the AnchorBubble relative to the heading.\n * It ensures that the AnchorBubble is displayed when either the heading or the bubble is hovered.\n */const HeadingWrapper=styled.div`\n    position: relative;\n    display: block;\n\n    &:hover ${AnchorBubble},\n    ${AnchorBubble}:hover {\n        display: inline-block;\n        opacity: 1;\n    }\n`;/**\n * Checks if the given child element is a heading (h1, h2, or h3).\n * @param child - The child element to check.\n * @returns True if the element is a heading.\n */const isHeading=child=>{const type=child?.type;return type===\"h1\"||type===\"h2\"||type===\"h3\";};/**\n * Generates a URL-friendly slug from a text string.\n * @param text - The text to convert into a slug.\n * @returns A URL-friendly slug.\n */const generateSlug=text=>{return text.toLowerCase().replace(/[^a-z0-9]+/g,\"-\")// Replace non-alphanumeric chars with hyphens\n.replace(/^-|-$/g,\"\")// Remove leading/trailing hyphens\n;};/**\n * Scrolls to the specified element with an offset.\n * @param elementId - The ID of the element to scroll to.\n * @param offset - The offset in pixels from the top.\n */const scrollToElement=(elementId,offset=0)=>{const element=document.getElementById(elementId);if(element){const elementPosition=element.getBoundingClientRect().top+window.pageYOffset;const offsetPosition=elementPosition-offset;window.scrollTo({top:offsetPosition,behavior:\"smooth\"});}};/**\n * Higher-order component that adds bold styling to all links within a component.\n * @param Component - The component to wrap.\n * @returns A wrapped component with bold link styling.\n */export const WithBoldLinks=Component=>{const WithBoldLinksComponent=props=>/*#__PURE__*/_jsx(BoldLinkWrapper,{children:/*#__PURE__*/_jsx(Component,{...props})});return WithBoldLinksComponent;};/**\n * Higher-order component that adds anchor links to headings with URL updating, scrolling, and clipboard copy functionality.\n *\n * When the \"#\" bubble is clicked, the page scrolls to the heading (with configurable offset),\n * the URL hash is updated, and the URL is copied to the clipboard.\n * The bubble content changes to a check mark (\"✓\") for 1 second before reverting.\n *\n * Additionally, to avoid a flash of unstyled content, the anchor links are hidden until the\n * component is mounted.\n *\n * @param Component - The component to wrap.\n * @returns A wrapped component with heading link functionality.\n */export function withHeadingLinks(Component){return props=>{// State to track whether the component has mounted.\nconst[mounted,setMounted]=React.useState(false);// copiedSlug stores the slug for which the copy was successful.\nconst[copiedSlug,setCopiedSlug]=React.useState(null);// Set mounted to true after the first render.\nReact.useEffect(()=>{setMounted(true);},[]);/**\n         * Handles click events on the heading anchor bubble.\n         * Scrolls to the heading, updates the URL hash, and copies it to the clipboard.\n         *\n         * @param headingText - The text content of the heading.\n         * @param e - The mouse event.\n         */const handleClick=(headingText,e)=>{e.preventDefault();const slug=generateSlug(headingText);// Scroll to the heading with offset\nscrollToElement(slug,CONFIG.scrollOffset);// Update the URL hash.\nconst newUrl=new URL(window.location.href);newUrl.hash=slug;window.history.pushState({},\"\",newUrl.toString());// Copy the URL to the clipboard.\nnavigator.clipboard.writeText(newUrl.toString()).then(()=>{// Change the bubble content to a check mark.\nsetCopiedSlug(slug);// Revert after 1 second.\nsetTimeout(()=>setCopiedSlug(null),1e3);}).catch(err=>console.error(\"Failed to copy URL:\",err));};/**\n         * Recursively processes children to add anchor links to headings.\n         *\n         * @param children - Child elements to process.\n         * @returns Modified children with anchor links.\n         */const modifyChildren=children=>{if(!children)return children;const childrenArray=Array.isArray(children)?children:[children];return childrenArray.map(child=>{if(!child||typeof child!==\"object\")return child;if(isHeading(child)){const headingText=child.props.children;const slug=generateSlug(headingText);return /*#__PURE__*/React.cloneElement(child,{...child.props,id:slug,children:/*#__PURE__*/_jsxs(HeadingWrapper,{children:[mounted&&/*#__PURE__*/_jsx(AnchorBubble,{href:`#${slug}`,onClick:e=>handleClick(headingText,e),\"aria-hidden\":\"true\",tabIndex:-1,children:copiedSlug===slug?CONFIG.copySuccessSymbol:CONFIG.linkSymbol},\"link\"),/*#__PURE__*/_jsx(\"span\",{children:headingText})]})});}if(child.props?.children){return /*#__PURE__*/React.cloneElement(child,{...child.props,children:modifyChildren(child.props.children)});}return child;});};// If there are no children to process, return the component as is.\nif(!props.children?.props?.children){return /*#__PURE__*/_jsx(Component,{...props});}// Process children and apply modifications.\nconst newChildren=/*#__PURE__*/React.cloneElement(props.children,{...props.children.props,children:modifyChildren(props.children.props.children)});return /*#__PURE__*/_jsx(Component,{...props,children:newChildren});};}/**\n * Combined higher-order component that applies both bold links and heading links.\n *\n * @param Component - The component to wrap.\n * @returns A wrapped component with both link enhancements.\n */export const withBoldAndHeadingLinks=Component=>{return withHeadingLinks(WithBoldLinks(Component));};\nexport const __FramerMetadata__ = {\"exports\":{\"WithBoldLinks\":{\"type\":\"reactHoc\",\"name\":\"WithBoldLinks\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHeadingLinks\":{\"type\":\"reactHoc\",\"name\":\"withHeadingLinks\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBoldAndHeadingLinks\":{\"type\":\"reactHoc\",\"name\":\"withBoldAndHeadingLinks\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParagraphAdjustments.map"],"mappings":"8TAwFG,SAAgB,EAAiB,EAAU,CAAC,MAAO,IAAO,CAC7D,GAAK,CAAC,EAAQ,GAAYA,EAAe,GAAM,CAC1C,CAAC,EAAW,GAAeA,EAAe,KAAK,CACpD,MAAoB,CAAC,EAAW,GAAK,EAAG,EAAE,CAAC,CAMhC,IAAM,GAAa,EAAY,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAM,EAAK,EAAa,EAAY,CACtG,EAAgB,EAAK,EAAO,aAAa,CACzC,IAAM,EAAO,IAAI,IAAI,EAAO,SAAS,KAAK,CAAC,EAAO,KAAK,EAAK,EAAO,QAAQ,UAAU,EAAE,CAAC,GAAG,EAAO,UAAU,CAAC,CAC7G,EAAU,UAAU,UAAU,EAAO,UAAU,CAAC,CAAC,SAAS,CAC1D,EAAc,EAAK,CACnB,eAAe,EAAc,KAAK,CAAC,IAAI,EAAG,CAAC,MAAM,GAAK,QAAQ,MAAM,sBAAsB,EAAI,CAAC,EAK9E,EAAe,GAAe,IAA6C,MAAM,QAAQ,EAAS,CAAC,EAAS,CAAC,EAAS,EAAsB,IAAI,GAAO,CAAC,GAAG,CAAC,GAAO,OAAO,GAAQ,SAAS,OAAO,EAAM,GAAG,EAAU,EAAM,CAAC,CAAC,IAAM,EAAY,EAAM,MAAM,SAAe,EAAK,EAAa,EAAY,CAAC,OAAoB,EAAmB,EAAM,CAAC,GAA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