{"version":3,"file":"Custom_functions.B58Cal98.mjs","names":[],"sources":["https:/framerusercontent.com/modules/BUwVBqs9rpBr5P6eyVMR/p1leECJCME0iEgRDzkWH/Custom_functions.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import React,{forwardRef}from\"react\";export function withNoOrphan(Component){// console.log(\"withNoOrphan HOC called\")\n// Helper function to extract text from nested React elements\nconst extractText=element=>{if(typeof element===\"string\"){return element;}if(typeof element===\"number\"){return String(element);}if(/*#__PURE__*/React.isValidElement(element)){if(element.props&&element.props.children){return extractText(element.props.children);}}if(Array.isArray(element)){return element.map(extractText).join(\"\");}return\"\";};// Helper function to apply orphan prevention to text\nconst processText=text=>{if(typeof text!==\"string\"||text.length===0){return text;}// Trim trailing spaces to find the actual last word\nconst trimmedText=text.trimEnd();if(trimmedText.length===0){return text;}const lastSpaceIndex=trimmedText.lastIndexOf(\" \");if(lastSpaceIndex!==-1){const beforeSpace=trimmedText.substring(0,lastSpaceIndex);const afterSpace=trimmedText.substring(lastSpaceIndex+1);const trailingSpaces=text.substring(trimmedText.length)// Preserve trailing spaces\n;return beforeSpace+\"\\xa0\"+afterSpace+trailingSpaces;}return text;};// Helper function to recursively process React elements\nconst processChildren=children=>{if(typeof children===\"string\"){return processText(children);}if(/*#__PURE__*/React.isValidElement(children)){return /*#__PURE__*/React.cloneElement(children,{...children.props,children:processChildren(children.props.children)});}if(Array.isArray(children)){return children.map(child=>processChildren(child));}return children;};return /*#__PURE__*/forwardRef((props,ref)=>{// console.log(\"Rendering with props:\", props)\n// console.log(\"Children type:\", typeof props.children)\n// console.log(\"Children:\", props.children)\nconst{children,...rest}=props;// Extract text for logging\nconst extractedText=extractText(children);console.log(\"Extracted text:\",extractedText);// Process children to prevent orphans\nconst processedChildren=processChildren(children);console.log(\"Processed children:\",processedChildren);return /*#__PURE__*/_jsx(Component,{ref:ref,...rest,children:processedChildren});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withNoOrphan\":{\"type\":\"reactH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