{"version":3,"file":"JobDescription.DAnEm4vb.mjs","names":["renderToStaticMarkup","_Fragment"],"sources":["https:/framerusercontent.com/modules/MfD0HZ6r2I5dvHG9wCpp/Db4C6ti2PwF40QHzPzAu/JobDescription.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import*as React from\"react\";// 👈 NEW\nimport{renderToStaticMarkup}from\"react-dom/server\";// 👈 NEW\n/**\n * Custom RichText component that cleans HTML before rendering\n * Use this instead of Framer's built-in RichText component\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__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .clean-richtext br{\n                    display:none;\n                }\n                .clean-richtext h1 {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 32px;\n                    font-weight: 600;\n                    color: #1C1022;\n                    margin: 24px 0 16px 0;\n                    line-height: 1.3;\n                }\n                \n                .clean-richtext h2 {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 28px;\n                    font-weight: 600;\n                    color: #1C1022;\n                    margin: 24px 0 16px 0;\n                    line-height: 1.3;\n                }\n                \n                .clean-richtext h3 {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 24px;\n                    font-weight: 600;\n                    color: #1C1022;\n                    margin: 24px 0 16px 0;\n                    line-height: 1.3;\n                }\n                \n                .clean-richtext h4 {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 20px;\n                    font-weight: 600;\n                    color: #1C1022;\n                    margin: 24px 0 16px 0;\n                    line-height: 1.3;\n                }\n                \n                .clean-richtext h5 {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 18px;\n                    font-weight: 600;\n                    color: #1C1022;\n                    margin: 14px 0 8px 0;\n                    line-height: 1.3;\n                }\n                \n                .clean-richtext h6 {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 16px;\n                    font-weight: 600;\n                    color: #1C1022;\n                    margin: 12px 0 8px 0;\n                    line-height: 1.3;\n                }\n                \n                .clean-richtext p {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 16px;\n                    font-weight: 400;\n                    color: #1C1022;\n                    margin: 0 0 16px 0;\n                    line-height: 1.6;\n                }\n                \n                .clean-richtext strong {\n                    font-weight: 600;\n                }\n                \n                .clean-richtext em {\n                    font-style: italic;\n                }\n                \n                .clean-richtext ul, .clean-richtext ol {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 16px;\n                    color: #1C1022;\n                    margin: 0 0 16px 0;\n                    padding-left: 24px;\n                    line-height: 1.6;\n                }\n                \n                .clean-richtext li {\n                    margin-bottom: 4px;\n                }\n                .clean-richtext li p{\n                    margin-bottom: 0px;\n                }\n                .clean-richtext a {\n                    color: #1C1022;\n                    text-decoration: underline;\n                }\n                \n                .clean-richtext a:hover {\n                    opacity: 0.8;\n                }\n                \n                .clean-richtext blockquote {\n                    font-family: 'Poppins', sans-serif;\n                    font-size: 16px;\n                    color: #1C1022;\n                    border-left: 4px solid #1C1022;\n                    margin: 16px 0;\n                    padding-left: 16px;\n                    font-style: italic;\n                }\n            `}),/*#__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}`;}//console.log(\"Base link:\", baseLink)\n//console.log(\"Job Opening ID:\", jobId)\n//console.log(\"Final link:\", finalLink)\nreturn /*#__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":"kPAKG,SAAwB,EAAoB,CAAC,OAAK,YAAU,SAAO,CAEtE,IAAI,EAAQ,GAAG,GAAG,OAAO,GAAO,SAAU,EAAQ,UAA2B,EAAqB,EAAK,CAAE,GAAG,CAAC,EAAQA,EAAqB,EAAK,MAAO,CAAC,EAAQ,GAAK,IAAM,EAAY,EAAa,EAAQ,CAAO,EAAe,CAAC,WAAW,wBAAwB,SAAS,OAAO,MAAM,UAAU,WAAW,MAAM,GAAG,EAAM,CAClJ,OAAzK,EAA6L,EAAMC,EAAU,CAAC,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4GlP,CAAC,CAAc,EAAK,MAAM,CAAC,UAAU,kBAAkB,GAAW,KAAK,MAAM,EAAe,wBAAwB,CAAC,OAAO,EAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CA5GtH,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,OAAO,WAAW,sB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