{"version":3,"file":"DynamicQueryParams.ZavHPLkm.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/L8FsiBpkqfj068FRpd0Q/90btNJFM5T0uXoJIsugl/DynamicQueryParams.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";/**\n * Ad-specific hero copy without the default-copy flicker.\n *\n * URL: /platform/mattress-builder?variant=layers&utm_source=meta...\n *\n * The copy lives in the <head> script (ad-variant-head-script.html), which\n * swaps the text as soon as the HTML arrives — before Framer's JS loads.\n * These overrides mark the layers for that script and keep React in sync.\n */const PARAM=\"variant\";const HIDE_VARS={headline:\"--ad-variant-headline\",subheadline:\"--ad-variant-subheadline\"};function getVariantText(field){if(typeof window===\"undefined\")return undefined;const key=new URLSearchParams(window.location.search).get(PARAM)?.trim().toLowerCase();const variants=window.__AD_VARIANTS__;return key?variants?.[key]?.[field]:undefined;}function withVariantField(Component,field){return props=>{// Resolved in the initial render: the server renders the default copy,\n// the browser starts with the variant copy the head script already put in the DOM\nconst[text]=useState(()=>getVariantText(field));return /*#__PURE__*/_jsx(Component,{...props,...text?{text}:{},// Hidden only while the head script sets this variable\nstyle:{...props.style,visibility:`var(${HIDE_VARS[field]}, visible)`}});};}export function withDynamicHeadline(Component){return withVariantField(Component,\"headline\");}export function withDynamicSubheadline(Component){return withVariantField(Component,\"subheadline\");}\nexport const __FramerMetadata__ = {\"exports\":{\"withDynamicSubheadline\":{\"type\":\"reactHoc\",\"name\":\"withDynamicSubheadline\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDynamicHeadline\":{\"type\":\"reactHoc\",\"name\":\"withDynamicHeadline\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DynamicQueryParams.map"],"mappings":"gIAQmH,SAAS,EAAe,EAAM,CAAC,GAAU,IAAS,OAAY,OAAiB,IAAM,EAAI,IAAI,gBAAgB,EAAO,SAAS,MAAM,CAAC,CAAC,IAAI,CAAK,CAAC,EAAE,KAAK,CAAC,CAAC,YAAY,EAAQ,EAAS,EAAO,gBAAgB,OAAO,EAAI,IAAW,EAAI,GAAG,GAAO,IAAA,EAAU,CAAC,SAAS,EAAiB,EAAU,EAAM,CAAC,MAAO,IAAO,CAEva,GAAK,CAAC,GAAMA,MAAa,EAAe,CAAK,CAAC,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,GAAG,EAAK,CAAC,MAAI,EAAE,CAAC,EAC7G,MAAM,CAAC,GAAG,EAAM,MAAM,WAAW,OAAO,EAAU,GAAO,WAAW,CAAC,CAAC,CAAE,CAAE,CAAC,SAAgB,EAAoB,EAAU,CAAC,OAAO,EAAiB,EAAU,UAAU,CAAE,yBAX9H,IAA4B,EAQ7D,EAAM,UAAgB,EAAU,CAAC,SAAS,wBAAwB,YAAY,0BAA0B"}