{"version":3,"file":"BookSlideIn.CFOz83Q2.mjs","names":["React.useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","init_npm_react_dom_18_3_1","_e","Ha","p","init_jsx_runtime","ce","RenderTarget","addPropertyControls","init_framer_DKtAEkcX","ControlType","BookSlideIn","props","isCanvas","mounted","setMounted","show","setShow","visible","setVisible","SEEN","d","DISMISSED","quietDays","DAY","done","open","cleanup","onScroll","h","max","scrollPercent","timer","delaySeconds","close","remember","headline","image","label","text","link","button","init_BookSlideIn"],"sources":["https:/framerusercontent.com/modules/d9B3RwgWXvEphVYrU4NT/82RorU6dUi9tJj9by0rR/BookSlideIn.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const SEEN=\"brl_book_seen\";const DISMISSED=\"brl_book_dismissed\";const DAY=864e5;/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BookSlideIn(props){const{link,image,label,headline,text,button,delaySeconds,scrollPercent,quietDays}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[mounted,setMounted]=React.useState(false);const[show,setShow]=React.useState(false);const[visible,setVisible]=React.useState(false);React.useEffect(()=>{setMounted(true);if(isCanvas)return;try{if(sessionStorage.getItem(SEEN))return;const d=Number(localStorage.getItem(DISMISSED)||0);if(d&&Date.now()-d<quietDays*DAY)return;}catch(e){}let done=false;const open=()=>{if(done)return;done=true;cleanup();try{sessionStorage.setItem(SEEN,\"1\");}catch(e){}setShow(true);requestAnimationFrame(()=>requestAnimationFrame(()=>setVisible(true)));};const onScroll=()=>{const h=document.documentElement;const max=Math.max(1,h.scrollHeight-h.clientHeight);if(h.scrollTop/max*100>=scrollPercent)open();};const timer=window.setTimeout(open,delaySeconds*1e3);window.addEventListener(\"scroll\",onScroll,{passive:true});function cleanup(){window.clearTimeout(timer);window.removeEventListener(\"scroll\",onScroll);}return cleanup;},[]);const close=remember=>{setVisible(false);if(remember){try{localStorage.setItem(DISMISSED,String(Date.now()));}catch(e){}}window.setTimeout(()=>setShow(false),400);};if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{font:\"500 11px/1.3 system-ui\",color:\"#7A6A3F\",padding:6,border:\"1px dashed #C9A96E\",borderRadius:6,background:\"#F7F3EC\"},children:\"Book slide-in (free book, shows on scroll)\"});}if(!mounted||!show)return null;const css=`\n.bsi{position:fixed;right:24px;bottom:24px;z-index:9999;width:380px;max-width:calc(100vw - 24px);box-sizing:border-box;display:flex;gap:16px;align-items:center;background:#1E2C23;color:#EFE9DF;border:1px solid rgba(217,197,154,.35);border-radius:22px;padding:18px 20px 18px 16px;box-shadow:0 30px 60px -20px rgba(0,0,0,.55),0 8px 18px -8px rgba(0,0,0,.35);font-family:'Hanken Grotesk',system-ui,sans-serif;opacity:0;transform:translateY(24px);transition:opacity .45s ease,transform .55s cubic-bezier(.2,.8,.2,1)}\n.bsi.on{opacity:1;transform:none}\n.bsi img{width:78px;flex:0 0 78px;height:auto;display:block;filter:drop-shadow(0 12px 14px rgba(0,0,0,.45))}\n.bsi-lb{font-size:10.5px;letter-spacing:.2em;text-transform:uppercase;color:#C9A96E;font-weight:500;margin:0 0 6px}\n.bsi-h{font-size:18px;line-height:1.2;font-weight:400;margin:0 0 6px;color:#EFE9DF}\n.bsi-t{font-size:13.5px;line-height:1.5;color:rgba(239,233,223,.75);font-weight:300;margin:0 0 12px}\n.bsi-b{display:inline-block;background:#D9C59A;color:#131811;text-decoration:none;font-size:11.5px;letter-spacing:.12em;text-transform:uppercase;font-weight:600;padding:11px 16px;border-radius:999px;white-space:nowrap}\n.bsi-b:hover{background:#C9A96E}\n.bsi-x{position:absolute;top:8px;right:10px;width:28px;height:28px;border:0;background:transparent;color:rgba(239,233,223,.6);font-size:20px;line-height:28px;cursor:pointer;padding:0}\n.bsi-x:hover{color:#EFE9DF}\n@media (max-width:640px){.bsi{left:12px;right:12px;bottom:92px;width:auto;padding:14px 16px 14px 12px;gap:12px}.bsi img{width:60px;flex-basis:60px}.bsi-h{font-size:16px}.bsi-t{display:none}}\n`;return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(\"div\",{className:\"bsi\"+(visible?\" on\":\"\"),role:\"dialog\",\"aria-label\":headline,children:[/*#__PURE__*/_jsx(\"style\",{children:css}),/*#__PURE__*/_jsx(\"button\",{className:\"bsi-x\",type:\"button\",\"aria-label\":\"Close\",onClick:()=>close(true),children:\"\\xd7\"}),image?.src&&/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Book cover\"}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"p\",{className:\"bsi-lb\",children:label}),/*#__PURE__*/_jsx(\"p\",{className:\"bsi-h\",children:headline}),/*#__PURE__*/_jsx(\"p\",{className:\"bsi-t\",children:text}),/*#__PURE__*/_jsx(\"a\",{className:\"bsi-b\",href:link,target:\"_blank\",rel:\"noopener\",onClick:()=>{try{localStorage.setItem(DISMISSED,String(Date.now()+23*DAY));}catch(e){}close(false);},children:button})]})]}),document.body);}BookSlideIn.defaultProps={link:\"https://portal.breatholution.com/Icantbehypnotized\",label:\"Free book\",headline:\"I Can’t Be Hypnotized\",text:\"Why people stay stuck, and how breath and hypnosis together get them moving.\",button:\"Get the free book\",delaySeconds:25,scrollPercent:45,quietDays:7};addPropertyControls(BookSlideIn,{link:{type:ControlType.Link,title:\"Link\"},image:{type:ControlType.ResponsiveImage,title:\"Book image\"},label:{type:ControlType.String,title:\"Label\"},headline:{type:ControlType.String,title:\"Headline\"},text:{type:ControlType.String,title:\"Text\",displayTextArea:true},button:{type:ControlType.String,title:\"Button\"},delaySeconds:{type:ControlType.Number,title:\"Show after (s)\",min:3,max:120,step:1},scrollPercent:{type:ControlType.Number,title:\"Or after scroll %\",min:10,max:100,step:5},quietDays:{type:ControlType.Number,title:\"Hide after close (days)\",min:1,max:60,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BookSlideIn\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BookSlideIn.map"],"mappings":"A,4NAGG,SAAwBe,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,QAAM,QAAM,WAAS,OAAK,SAAO,eAAa,gBAAc,aAAWC,EAAYC,EAASN,EAAa,QAAQ,IAAIA,EAAa,OAAY,CAACO,EAAQC,GAAYnB,EAAe,EAAK,EAAO,CAACoB,EAAKC,GAASrB,EAAe,EAAK,EAAO,CAACsB,EAAQC,GAAYvB,EAAe,EAAK,EAAEU,MAAoB,CAAkB,GAAjBS,EAAW,EAAI,EAAKF,EAAS,OAAO,GAAG,CAAC,GAAG,eAAe,QAAQO,CAAI,EAAE,OAAO,IAAMC,EAAE,OAAO,aAAa,QAAQC,CAAS,GAAG,CAAC,EAAE,GAAGD,GAAG,KAAK,IAAI,EAAEA,EAAEE,EAAUC,EAAI,MAAO,MAAS,CAAC,CAAC,IAAIC,EAAK,GAAYC,MAAS,CAAC,GAAG,GAAY,GAAK,GAAKC,EAAQ,EAAE,GAAG,CAAC,eAAe,QAAQP,EAAK,GAAG,CAAE,MAAS,CAAC,CAACH,EAAQ,EAAI,EAAE,0BAA0B,0BAA0BE,EAAW,EAAI,CAAC,CAAC,CAAlJ,CAAoJ,EAAQS,MAAa,CAAC,IAAMC,EAAE,SAAS,gBAAsBC,EAAI,KAAK,IAAI,EAAED,EAAE,aAAaA,EAAE,YAAY,EAAKA,EAAE,UAAUC,EAAI,KAAKC,GAAcL,EAAK,CAAE,EAAQM,EAAMhC,EAAO,WAAW0B,EAAKO,EAAa,GAAG,EAAEjC,EAAO,iBAAiB,SAAS4B,EAAS,CAAC,QAAQ,EAAI,CAAC,EAAE,SAASD,GAAS,CAAC3B,EA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