{"version":3,"file":"DecemberStickyCta.R-F2ooDb.mjs","names":["useState","_Fragment","__esmMin","init_npm_react_18_3_1","window","init_ssg_sandbox_shims","Ha","ce","init_jsx_runtime","init_npm_react_dom_18_3_1","c","_e","addPropertyControls","useIsStaticRenderer","ControlType","init_framer_CKT6jEEQ","DecemberStickyCta","label","props","isCanvas","mounted","setMounted","isPhone","setIsPhone","targetVisible","setTargetVisible","leadDone","setLeadDone","mq","onMq","PHONE_QUERY","observer","tries","timer","attach","target","FORM_ID","FALLBACK_ID","entries","onSuccess","LEAD_SUCCESS_EVENT","placeholder","l","bar","form","firstName","top","SCROLL_OFFSET","barButton","BLACK","YELLOW","FONT","init_DecemberStickyCta"],"sources":["https:/framerusercontent.com/modules/efgYDFGzsFldbhbNxUcM/pB1bTq4lV9quO3QrzC7g/DecemberStickyCta.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";// December copy of StickyCta.tsx with an editable label (the audit pages say \"Get my free audit\").\n// Sticky phone bar for the Free Playbooks / Free Audit pages. Fixed to the bottom of the viewport and\n// rendered into document.body (a fixed element inside a transformed Framer layer\n// would scroll with it). Shown only when:\n//   - the viewport is under 810px wide, and\n//   - the form (#fp-form, rendered by PlaybooksForm.tsx; #get as a fallback) is\n//     out of view, including on first load, and\n//   - the form has not succeeded (PlaybooksForm.tsx dispatches \"fp:lead-success\").\n// Hidden on the canvas. Tapping it focuses First name and scrolls the form to the top.\nconst FORM_ID=\"fp-form\";const FALLBACK_ID=\"get\";const SCROLL_OFFSET=16;const PHONE_QUERY=\"(max-width: 809.98px)\";const LEAD_SUCCESS_EVENT=\"fp:lead-success\";const BLACK=\"var(--token-14703ad7-22ca-42ba-8873-65f10ee24fb5, #000000)\";const YELLOW=\"var(--token-c9303a75-c2ef-4aa9-a59b-08d37f8ca413, #FFC936)\";const FONT='\"Manrope\", \"Manrope Placeholder\", sans-serif';/**\n * Sticky CTA (phone)\n *\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function DecemberStickyCta(props){const label=props.label||\"Get my free playbooks\";const isCanvas=useIsStaticRenderer();const[mounted,setMounted]=useState(false);const[isPhone,setIsPhone]=useState(false);const[targetVisible,setTargetVisible]=useState(true);const[leadDone,setLeadDone]=useState(false);useEffect(()=>{if(isCanvas)return;setMounted(true);let mq=null;const onMq=()=>setIsPhone(!!mq?.matches);try{mq=window.matchMedia(PHONE_QUERY);onMq();mq.addEventListener(\"change\",onMq);}catch{// No matchMedia: leave the bar hidden.\n}// The form is a separate code component and may mount after this one, so\n// look for it for a few seconds before falling back to #get.\nlet observer=null;let tries=0;let timer;const attach=()=>{const target=document.getElementById(FORM_ID)??(tries>=20?document.getElementById(FALLBACK_ID):null);if(!target){tries++;if(tries<=20)timer=window.setTimeout(attach,150);return;}if(typeof IntersectionObserver!==\"function\")return;observer=new IntersectionObserver(entries=>setTargetVisible(entries.some(e=>e.isIntersecting)),{threshold:0});observer.observe(target);};attach();const onSuccess=()=>setLeadDone(true);window.addEventListener(LEAD_SUCCESS_EVENT,onSuccess);return()=>{mq?.removeEventListener(\"change\",onMq);if(timer!==undefined)window.clearTimeout(timer);observer?.disconnect();window.removeEventListener(LEAD_SUCCESS_EVENT,onSuccess);};},[isCanvas]);// In-flow footprint is nothing; the bar itself lives in document.body.\nconst placeholder=/*#__PURE__*/_jsx(\"div\",{style:{...props.style,width:0,height:0},\"aria-hidden\":\"true\"});if(isCanvas||!mounted)return placeholder;const show=isPhone&&!targetVisible&&!leadDone;// Focus first, inside the tap, so phones open the keyboard; then scroll the form\n// so its top sits about 16px below the top of the screen.\nconst scrollToForm=()=>{const form=document.getElementById(FORM_ID);const target=form??document.getElementById(FALLBACK_ID);if(!target)return;const firstName=form?.querySelector('input[name=\"firstName\"]');try{firstName?.focus({preventScroll:true});}catch{// Focus is a convenience; scrolling still happens.\n}const top=target.getBoundingClientRect().top+window.scrollY-SCROLL_OFFSET;window.scrollTo({top:Math.max(0,top),behavior:\"smooth\"});};return /*#__PURE__*/_jsxs(_Fragment,{children:[placeholder,show&&/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{style:bar,children:/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:scrollToForm,style:barButton,children:label})}),document.body)]});}const bar={position:\"fixed\",left:0,right:0,bottom:0,zIndex:10,background:YELLOW,boxShadow:\"0 -4px 16px rgba(0, 0, 0, 0.12)\",paddingBottom:\"env(safe-area-inset-bottom)\"};const barButton={display:\"flex\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\",height:56,padding:\"0 20px\",margin:0,border:\"none\",background:\"transparent\",color:BLACK,fontFamily:FONT,fontWeight:700,fontSize:16,lineHeight:\"1.2em\",cursor:\"pointer\"};addPropertyControls(DecemberStickyCta,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Get my free playbooks\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DecemberStickyCta\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"1\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicWidth\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DecemberStickyCta.map"],"mappings":"A,+NAiBG,SAAwBgB,EAAkB,EAAM,CAAC,IAAMC,EAAMC,EAAM,OAAO,wBAA8BC,EAASN,EAAoB,EAAO,CAACO,EAAQC,GAAYrB,EAAS,EAAK,EAAO,CAACsB,EAAQC,GAAYvB,EAAS,EAAK,EAAO,CAACwB,EAAcC,GAAkBzB,EAAS,EAAI,EAAO,CAAC0B,EAASC,GAAa3B,EAAS,EAAK,EAAEO,MAAc,CAAC,GAAGY,EAAS,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