{"version":3,"file":"TradingContactOveride.q6JaxpDB.mjs","names":["__esmMin","init_ssg_sandbox_shims","window","init_jsx_runtime","c","extractSerialFromDOM","el","withTradingContactLink","link","serialNumber","params","target","Component","props","init_TradingContactOveride"],"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":"A,kHAeG,SAASK,GAAsB,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAAG,IAAMC,EAAG,SAAS,eAAe,eAAe,EAEX,OAFiBA,GAExHA,EAAG,aAAa,GAAA,CAAI,KAAwB,CAAC,CAAC,QAAQ,6CAA6C,EAAkB,CAAC,CAAC,KAAK,EAFK,EAEH,CAAC,SAAgBC,EAAuB,EAAU,CAAC,MAAO,IAAwf,gBAAK,MAAM,CAAC,eAA1e,GAAG,CAAC,IAAMC,EAAK,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,CAACA,GAAM,KAAK,OAAO,IAAMC,EAAaJ,EAAqB,EAAQK,EAAO,IAAI,gBAAgBA,EAAO,IAAI,OAAO,cAAc,EAAEA,EAAO,IAAI,QAAQ,kBAAkB,EAAKD,GAAaC,EAAO,IAAI,eAAeD,CAAY,EAAE,IAAME,EAAO,IAAI,IAAIH,EAAK,KAAKN,EAAO,SAAS,IAAI,EAAE,EAAO,OAAOQ,EAAO,SAAS,EAAE,EAAO,KAAK,kBAAkB,EAAE,eAAe,EAAE,EAAE,gBAAgB,EAAE,EAAO,SAAS,KAAKC,EAAO,SAAS,CAAE,EAA6D,MAAM,CAAC,QAAQ,UAAU,EAAE,SAAsB,gBAAKC,EAAU,CAAC,GAAGC,CAAK,CAAC,CAAC,CAAC,CAAI,C"}