{"version":3,"file":"TradingContactOveride.iiujahEo.mjs","names":[],"sources":["https:/framerusercontent.com/modules/egaHdd3maPJ6NowMCsaD/xQlPZrB9oxYnUgWjGteO/TradingContactOveride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";/**\n * Trading Deal Template Page → Contact form preshot.\n *\n * Applied on the \"Contact\" CTA inside a trading deal CMS template page.\n * At click time, reads the Serial Number from the element with id=\"serial-number\"\n * (that element is a plain CMS text on the template page).\n *\n * Preserves the Framer-localized link href (e.g. /de/kontakt, /es/contacto)\n * and appends:\n *   - dept = other-topics\n *   - topic = Aircraft Trading\n *   - serialNumber = [scanned from DOM]\n *\n * The contact page's JetflyContactForm matches this serial against its\n * dealsCollection prop to retrieve manufacturer, model, and cover photo.\n */function extractSerialFromDOM(){if(typeof document===\"undefined\")return\"\";const el=document.getElementById(\"serial-number\");if(!el)return\"\";// The element may contain a label like \"Serial Number: 1234-ABC\"\n// OR just the raw value \"1234-ABC\". Strip the label if present.\nconst raw=(el.textContent||\"\").trim();const stripped=raw.replace(/^\\s*(serial\\s*number|s\\/n|sn)\\s*[:\\-]?\\s*/i,\"\");return stripped.trim();}export function withTradingContactLink(Component){return props=>{const handleClick=e=>{const link=e.target.closest(\"a\");if(!link?.href)return;const serialNumber=extractSerialFromDOM();const params=new URLSearchParams;params.set(\"dept\",\"other-topics\");params.set(\"topic\",\"Aircraft Trading\");if(serialNumber)params.set(\"serialNumber\",serialNumber);const target=new URL(link.href,window.location.href);target.search=params.toString();target.hash=\"connect-with-us\";e.preventDefault();e.stopPropagation();window.location.href=target.toString();};return /*#__PURE__*/_jsx(\"div\",{onClickCapture:handleClick,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTradingContactLink\":{\"type\":\"reactHoc\",\"name\":\"withTradingContactLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TradingContactOveride.map"],"mappings":"kHAeG,SAAS,GAAsB,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAAG,IAAM,EAAG,SAAS,eAAe,eAAe,EAEX,OAFiB,GAExH,EAAG,aAAa,GAAA,CAAI,KAAwB,CAAC,CAAC,QAAQ,6CAA6C,EAAkB,CAAC,CAAC,KAAK,EAFK,EAEH,CAAC,SAAgB,EAAuB,EAAU,CAAC,MAAO,IAAwf,EAAK,MAAM,CAAC,eAA1e,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,CAAC,GAAM,KAAK,OAAO,IAAM,EAAa,EAAqB,EAAQ,EAAO,IAAI,gBAAgB,EAAO,IAAI,OAAO,cAAc,EAAE,EAAO,IAAI,QAAQ,kBAAkB,EAAK,GAAa,EAAO,IAAI,eAAe,CAAY,EAAE,IAAM,EAAO,IAAI,IAAI,EAAK,KAAK,EAAO,SAAS,IAAI,EAAE,EAAO,OAAO,EAAO,SAAS,EAAE,EAAO,KAAK,kBAAkB,EAAE,eAAe,EAAE,EAAE,gBAAgB,EAAE,EAAO,SAAS,KAAK,EAAO,SAAS,CAAE,EAA6D,MAAM,CAAC,QAAQ,UAAU,EAAE,SAAsB,EAAK,EAAU,CAAC,GAAG,CAAK,CAAC,CAAC,CAAC,CAAI,qBAjBxwB"}