{"version":3,"file":"JobDescription.CS_06NYW.mjs","names":["renderToStaticMarkup"],"sources":["https:/framerusercontent.com/modules/MfD0HZ6r2I5dvHG9wCpp/Mc8VulHH4o2aqOARHMdE/JobDescription.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import*as React from\"react\";import{renderToStaticMarkup}from\"react-dom/server\";/**\n * Custom RichText component that cleans HTML before rendering\n * Use this instead of Framer's built-in RichText component\n *\n * NOTE: Global CSS for .clean-richtext lives in Site Settings → Code →\n * \"End of <head>\" (scoped to All pages). Do NOT re-add an inline <style>\n * block here — this component renders once per job card in the hidden\n * Collection List (~1,700+ times on /jobs), so a per-instance <style>\n * tag gets duplicated that many times and caused a hydration mismatch.\n */export default function CleanJobDescription({html,className,style}){// Framer passes RichText CMS fields as React elements, not plain strings\n// Convert to HTML string first so cleanJobHtml can process it\nlet rawHtml=\"\";if(typeof html===\"string\"){rawHtml=html;}else if(/*#__PURE__*/React.isValidElement(html)){try{rawHtml=renderToStaticMarkup(html);}catch{rawHtml=\"\";}}const cleanedHtml=cleanJobHtml(rawHtml);const richTextStyles={fontFamily:\"'Poppins', sans-serif\",fontSize:\"16px\",color:\"#1C1022\",lineHeight:\"1.6\",...style};// Show placeholder on canvas when no content is connected\nif(!cleanedHtml){return /*#__PURE__*/_jsx(\"div\",{style:{padding:16,color:\"#999\",fontFamily:\"Poppins, sans-serif\",fontSize:14},children:\"Job description will appear here\"});}return /*#__PURE__*/_jsx(\"div\",{className:`clean-richtext ${className||\"\"}`,style:richTextStyles,dangerouslySetInnerHTML:{__html:cleanedHtml}});}// Remove orphaned closing tags by tracking open/close balance per tag type\n// Handles </p>, </h1> through </h6> left over after nesting fixes\nconst removeOrphanedClosingTags=html=>{const depth={};return html.replace(/<\\/?(?:p|h[1-6])[^>]*>/gi,tag=>{// Extract the tag name (e.g. \"p\", \"h3\")\nconst nameMatch=tag.match(/<\\/?([a-z0-9]+)/i);if(!nameMatch)return tag;const name=nameMatch[1].toLowerCase();if(!tag.startsWith(\"</\")){// Opening tag - increment depth for this tag type\ndepth[name]=(depth[name]||0)+1;return tag;}else{// Closing tag - only keep it if there's an open tag to close\nif(depth[name]&&depth[name]>0){depth[name]--;return tag;}else{return\"\"// Remove orphaned closing tag\n;}}});};function cleanJobHtml(html){if(!html||typeof html!==\"string\")return\"\";let cleaned=html.replace(/ style=\"[^\"]*\"/gi,\"\");cleaned=cleaned.replace(/ on\\w+=\"[^\"]*\"/gi,\"\");cleaned=cleaned.replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi,\"\");cleaned=cleaned.replace(/<p([^>]*)>([\\s\\S]*?)<\\/p>/gi,(match,pAttrs,pContent)=>{const updatedContent=pContent.replace(/<b>/gi,\"<strong>\").replace(/<\\/b>/gi,\"</strong>\");return`<p${pAttrs}>${updatedContent}</p>`;});cleaned=cleaned.replace(/<(p|div)(\\s[^>]*)?>\\s*<\\/(p|div)>/gi,\"\");cleaned=cleaned.replace(/(<br\\s*\\/?>\\s*){2,}/gi,\"<br>\");cleaned=cleaned.replace(/^(<br\\s*\\/?>\\s*)+/i,\"\");cleaned=cleaned.replace(/(<br\\s*\\/?>\\s*)+$/i,\"\");cleaned=cleaned.replace(/>\\s+</g,\"><\");cleaned=cleaned.replace(/[\\s\\u00A0\\u2000-\\u200B\\u2028\\u2029]+/g,\" \");cleaned=cleaned.replace(/>(\\ s+)/g,\">\");cleaned=cleaned.replace(/(\\s+)</g,\"<\");cleaned=cleaned.replace(/\\s{2,}/g,\" \");cleaned=cleaned.trim();// Fix: close <p> before block-level elements that cannot be nested inside it\n// Handles <p>...<h3>, <p>...<ul>, <p>...<ol>, etc.\ncleaned=cleaned.replace(/(<p[^>]*>)([\\s\\S]*?)(<(?:h[1-6]|ul|ol|blockquote|div|table|pre)[^>]*>)/gi,(match,pOpen,content,blockOpen)=>`${pOpen}${content}</p>${blockOpen}`);// Fix: close <p> before a nested <p>\n// Handles <p>...<p>\ncleaned=cleaned.replace(/(<p[^>]*>)([\\s\\S]*?)(<p[^>]*>)/gi,(match,outerP,content,innerP)=>`${outerP}${content}</p>${innerP}`);// Fix: headings cannot nest inside other headings - close the outer one first\n// Handles <h2>...<h2>, <h3>...<h3>, <h2>...<h3>, <h3>...<h4>, etc.\ncleaned=cleaned.replace(/(<h([1-6])[^>]*>)([\\s\\S]*?)(<h[1-6][^>]*>)/gi,(match,outerOpen,level,content,innerOpen)=>`${outerOpen}${content}</h${level}>${innerOpen}`);// Remove the first H3 tag and its content\ncleaned=cleaned.replace(/<h3[^>]*>[\\s\\S]*?<\\/h3>/i,\"\");// Remove any orphaned </p> tags left over from nesting fixes\ncleaned=removeOrphanedClosingTags(cleaned);return cleaned;}addPropertyControls(CleanJobDescription,{html:{type:ControlType.RichText,title:\"HTML Content\"}});/**\n * Append Job Opening ID to Link\n * Creates a custom \"Job Opening ID\" field in Framer that you can connect to your CMS\n *\n * Usage:\n * 1. Apply this override to your Link component\n * 2. Set the base link in Framer (e.g., https://application.newcrosshealthcare.com/?jobOpeningId=)\n * 3. In the right panel, connect the \"Job Opening ID\" field to your CMS field\n */export function AppendJobId(Component){return props=>{// Get the base link from Framer\nconst baseLink=props.href||props.link||props.url||\"\";// Get the Job Opening ID from the custom property\nconst jobId=props.jobOpeningId||\"\";// Helper function to slugify the job ID (uppercase, replace spaces with dashes)\nconst slugifyJobId=text=>{return text.toString().toUpperCase().trim().replace(/\\s+/g,\"-\").replace(/&/g,\"-and-\").replace(/[^\\w\\-]+/g,\"\").replace(/\\-\\-+/g,\"-\");};// Build the final link\nlet finalLink=baseLink;if(jobId){const sluggedJobId=slugifyJobId(jobId);finalLink=`${baseLink}${sluggedJobId}`;}return /*#__PURE__*/_jsx(Component,{...props,href:finalLink,link:finalLink,url:finalLink});};}// Add property controls to the override so you can connect CMS fields in Framer\nAppendJobId.propertyControls={jobOpeningId:{type:ControlType.String,title:\"Job Opening ID\",description:\"Connect this to your CMS Job_Opening_ID field\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"AppendJobId\":{\"type\":\"reactHoc\",\"name\":\"AppendJobId\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"CleanJobDescription\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./JobDescription.map"],"mappings":"+NASG,SAAwB,EAAoB,CAAC,OAAK,YAAU,SAAO,CAEtE,IAAI,EAAQ,GAAG,GAAG,OAAO,GAAO,SAAU,EAAQ,OAAW,GAAgB,EAAqB,CAAI,EAAG,GAAG,CAAC,EAAQA,EAAqB,CAAI,CAAE,MAAM,CAAC,EAAQ,EAAG,CAAE,IAAM,EAAY,EAAa,CAAO,EAAQ,EAAe,CAAC,WAAW,wBAAwB,SAAS,OAAO,MAAM,UAAU,WAAW,MAAM,GAAG,CAAK,EACjJ,OAAzK,EAA6L,EAAK,MAAM,CAAC,UAAU,kBAAkB,GAAW,KAAK,MAAM,EAAe,wBAAwB,CAAC,OAAO,CAAW,CAAC,CAAC,EAAtR,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,OAAO,WAAW,sBAAsB,SAAS,EAAE,EAAE,SAAS,kCAAkC,CAAC,CAAmJ,CAMrT,SAAS,EAAa,EAAK,CAAC,GAAG,CAAC,GAAM,OAAO,GAAO,SAAS,MAAM,GAAG,IAAI,EAAQ,EAAK,QAAQ,mBAAmB,EAAE,EAQjF,MARmF,GAAQ,EAAQ,QAAQ,mBAAmB,EAAE,EAAE,EAAQ,EAAQ,QAAQ,oCAAoC,EAAE,EAAE,EAAQ,EAAQ,QAAQ,+BAA+B,EAAM,EAAO,IAA2G,KAAK,EAAO,GAAtF,EAAS,QAAQ,QAAQ,UAAU,CAAC,CAAC,QAAQ,UAAU,WAA+C,EAAE,KAAO,EAAE,EAAQ,EAAQ,QAAQ,sCAAsC,EAAE,EAAE,EAAQ,EAAQ,QAAQ,wBA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