{"version":3,"file":"TrainingCenterOverride.DyylwMx_.mjs","names":[],"sources":["https:/framerusercontent.com/modules/oDFwNpHmQwcEdLmMlOPM/9ihSwWjlHcGzMSZzXejv/TrainingCenterOverride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";/**\n * Training Centre / Course Template Page → Contact form preshot.\n *\n * Mirrors `withTradingContactLink`. Applied on the \"Contact\" CTA. At click\n * time, reads the course Title ONLY from an element explicitly tagged with\n * id=\"course-title\" (or \"course-name\") on the CMS template page. There's\n * no <h1> fallback on purpose: the Training Centre landing page has its\n * own <h1> (\"Training Centre\") that is NOT a course name, so falling back\n * to it would poison the URL with a bogus courseName.\n *\n * Redirects to /contact with:\n *   - dept = other-topics\n *   - topic = Training Centre\n *   - courseName = [scanned from DOM, omitted when the id is absent]\n *\n * The contact page's JetflyContactForm matches courseName against its\n * trainingCollection prop to preselect the \"Select the course\" dropdown.\n *\n * SETUP\n *   - Course CMS template page: pick the Text element bound to the CMS\n *     Title field and, in its right-panel attributes, set ID = \"course-title\".\n *     Apply this override on the Contact CTA button.\n *   - Training Centre landing page: same override on the CTA, no id needed.\n *     URL will arrive without courseName and the dropdown stays empty.\n */function extractCourseTitleFromDOM(){if(typeof document===\"undefined\")return\"\";// Strict: only explicit IDs. No generic fallbacks like #title or <h1>\n// because those exist on non-course pages too and would inject the\n// wrong value (e.g. the landing page's \"Training Centre\" heading).\nconst ids=[\"course-title\",\"course-name\"];for(const id of ids){const el=document.getElementById(id);if(el){const raw=(el.textContent||\"\").trim();return raw.replace(/^\\s*(course\\s*title|course\\s*name)\\s*[:\\-]?\\s*/i,\"\").trim();}}return\"\";}export function withTrainingCentreContactLink(Component){return props=>{const handleClick=e=>{const link=e.target.closest(\"a\");if(!link||!link.href||!link.href.includes(\"/contact\"))return;const courseName=extractCourseTitleFromDOM();const params=new URLSearchParams;params.set(\"dept\",\"other-topics\");params.set(\"topic\",\"Training Centre\");if(courseName)params.set(\"courseName\",courseName);const href=`/contact?${params.toString()}#connect-with-us`;e.preventDefault();e.stopPropagation();window.location.href=href;};return /*#__PURE__*/_jsx(\"div\",{onClickCapture:handleClick,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTrainingCentreContactLink\":{\"type\":\"reactHoc\",\"name\":\"withTrainingCentreContactLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrainingCenterOverride.map"],"mappings":"kHAwBG,SAAS,GAA2B,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAGtC,IAAI,IAAM,IAAzC,CAAC,eAAe,cAAc,CAAqB,CAAC,IAAM,EAAG,SAAS,eAAe,EAAG,CAAC,GAAG,EAA0C,OAA3B,EAAG,aAAa,IAAI,MAAM,CAAY,QAAQ,kDAAkD,GAAG,CAAC,MAAM,CAAG,MAAM,GAAI,SAAgB,EAA8B,EAAU,CAAC,MAAO,IAAsd,EAAK,MAAM,CAAC,eAAxc,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAM,CAAC,EAAK,MAAM,CAAC,EAAK,KAAK,SAAS,WAAW,CAAC,OAAO,IAAM,EAAW,GAA2B,CAAO,EAAO,IAAI,gBAAgB,EAAO,IAAI,OAAO,eAAe,CAAC,EAAO,IAAI,QAAQ,kBAAkB,CAAI,GAAW,EAAO,IAAI,aAAa,EAAW,CAAC,IAAM,EAAK,YAAY,EAAO,UAAU,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,EAAO,SAAS,KAAK,GAAkE,MAAM,CAAC,QAAQ,WAAW,CAAC,SAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAC,CAAC,sBA3B30B"}