{"version":3,"file":"JobDescription.BspnoK4d.mjs","names":["React.isValidElement","renderToStaticMarkup","_jsx","__esmMin","init_npm_react_18_3_1","K","c","init_jsx_runtime","init_framer_ChujFWHC","addPropertyControls","init_server_browser","Qn","CleanJobDescription","html","className","style","rawHtml","cleanedHtml","cleanJobHtml","richTextStyles","cleaned","match","pAttrs","pContent","pOpen","content","blockOpen","outerP","innerP","outerOpen","level","innerOpen","removeOrphanedClosingTags","init_JobDescription","depth","tag","nameMatch","name","ControlType"],"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":"A,8NASG,SAAwBY,EAAoB,CAACC,OAAKC,YAAUC,SAAO,CAEtE,IAAIC,EAAQ,GAAG,GAAG,OAAOH,GAAO,SAAUG,EAAQH,OAAW,GAAgBb,gBAAqBa,CAAI,EAAG,GAAG,CAACG,EAAQf,EAAqBY,CAAI,CAAE,MAAM,CAACG,EAAQ,EAAG,CAAE,IAAMC,EAAYC,EAAaF,CAAO,EAAQG,EAAe,CAAC,WAAW,wBAAwB,SAAS,OAAO,MAAM,UAAU,WAAW,MAAM,GAAGJ,CAAK,EACjJ,OAAzKE,EAA6Lf,gBAAK,MAAM,CAAC,UAAU,kBAAkBY,GAAW,KAAK,MAAMK,EAAe,wBAAwB,CAAC,OAAOF,CAAW,CAAC,CAAC,EAAtRf,gBAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,OAAO,WAAW,sBAAsB,SAAS,EAAE,EAAE,SAAS,kCAAkC,CAAC,CAAmJ,CAMrT,SAASgB,EAAaL,EAAK,CAAC,GAAG,CAACA,GAAM,OAAOA,GAAO,SAAS,MAAM,GAAG,IAAIO,EAAQP,EAAK,QAAQ,mBAAmB,EAAE,EAQjF,MARmFO,G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