{"version":3,"file":"Modal_Trigger.CMPozJOj.mjs","names":["t","e","useState","useRef","useCallback","Cookies","e"],"sources":["https:/ga.jspm.io/npm:js-cookie@3.0.1/dist/js.cookie.mjs","https:/framerusercontent.com/modules/IdqlkUdwJ7lkvSmkXknw/oolckiwv1cOhQN13xT6e/Modal_Trigger.js"],"sourcesContent":["function assign(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var e={read:function(e){'\"'===e[0]&&(e=e.slice(1,-1));return e.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function init(e,t){function set(n,r,i){if(\"undefined\"!==typeof document){i=assign({},t,i);\"number\"===typeof i.expires&&(i.expires=new Date(Date.now()+864e5*i.expires));i.expires&&(i.expires=i.expires.toUTCString());n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var c in i)if(i[c]){o+=\"; \"+c;true!==i[c]&&(o+=\"=\"+i[c].split(\";\")[0])}return document.cookie=n+\"=\"+e.write(r,n)+o}}function get(t){if(\"undefined\"!==typeof document&&(!arguments.length||t)){var n=document.cookie?document.cookie.split(\"; \"):[];var r={};for(var i=0;i<n.length;i++){var o=n[i].split(\"=\");var c=o.slice(1).join(\"=\");try{var a=decodeURIComponent(o[0]);r[a]=e.read(c,a);if(t===a)break}catch(e){}}return t?r[t]:r}}return Object.create({set:set,get:get,remove:function(e,t){set(e,\"\",assign({},t,{expires:-1}))},withAttributes:function(e){return init(this.converter,assign({},this.attributes,e))},withConverter:function(e){return init(assign({},this.converter,e),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var t=init(e,{path:\"/\"});export{t as default};\n\n//# sourceMappingURL=js.cookie.mjs.map","/**\n * Version: 1.1\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import Cookies from\"js-cookie\";/**\n * @framerIntrinsicHeight 0\n * @framerIntrinsicWidth 0\n */export default function ModalTrigger({showOnMouseLeave,showOnScroll,delayConfig,scrollConfig}){const[hasBeenTriggered,setHasBeenTriggered]=useState(false);const triggerRef=useRef(null);const stateRef=useRef(hasBeenTriggered);const _setHasBeenTriggered=useCallback(newState=>{stateRef.current=newState;setHasBeenTriggered(newState);},[]);const hasBeenShownRecently=useCallback(()=>{return!!Cookies.get(\"modalShown\");},[]);const showModal=useCallback(node=>{if(stateRef.current||hasBeenShownRecently())return;simulateClick(node);_setHasBeenTriggered(true);Cookies.set(\"modalShown\",\"true\",{expires:1});},[hasBeenShownRecently,_setHasBeenTriggered]);const triggerOnMouseOut=useCallback(node=>e=>{// You can remove conditions if you'd prefer that the pop-up isn't\n    // triggered by the mouse leaving certain edges of the viewport.\n    if(// Top\n    e.clientY<=0||// Left\n    e.clientX<=0||// Right\n    e.clientX>=window.innerWidth||// Bottom\n    e.clientY>=window.innerHeight){showModal(node);}},[showModal]);// Listen for mouse leaving the viewport if showOnMouseLeave is true\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){if(showOnMouseLeave){window.addEventListener(\"mouseout\",triggerOnMouseOut(triggerNode));return()=>window.removeEventListener(\"mouseout\",triggerOnMouseOut(triggerNode));}}return;},[triggerOnMouseOut,showOnMouseLeave,showModal]);// Initialize a timer if showOnDelay is true\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){if(delayConfig.showOnDelay){const delay=setTimeout(()=>showModal(triggerNode),delayConfig.delaySeconds*1e3);return()=>clearTimeout(delay);}}return;},[delayConfig.showOnDelay,delayConfig.delaySeconds,showModal]);// Listen for clicks on the button and disable our triggers\n// if the button has been clicked\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){var _triggerNode_parentElement;const preventTriggers=()=>_setHasBeenTriggered(true);const button=(_triggerNode_parentElement=triggerNode.parentElement)===null||_triggerNode_parentElement===void 0?void 0:_triggerNode_parentElement.parentElement;if(button){button.addEventListener(\"keyup\",preventTriggers);button.addEventListener(\"mouseup\",preventTriggers);return()=>{window.removeEventListener(\"keyup\",preventTriggers);window.removeEventListener(\"mouseup\",preventTriggers);};}}return;},[]);// Modify the scroll effect\nuseEffect(()=>{if(showOnScroll&&scrollConfig.showOnScrollToPercentage&&!stateRef.current&&!hasBeenShownRecently()){const initialYCoordBottomOfViewport=window.scrollY+window.innerHeight;const triggerNode=triggerRef.current;const body=document.querySelector(\"body\");if(triggerNode&&body){const scrollListener=()=>{if(stateRef.current||hasBeenShownRecently()){window.removeEventListener(\"scroll\",scrollListener);return;}const scrollPositionOfBottomOfViewport=window.scrollY+window.innerHeight;const triggerPoint=body.scrollHeight*scrollConfig.scrollPercentage/100;if(scrollPositionOfBottomOfViewport>=triggerPoint&&initialYCoordBottomOfViewport<triggerPoint){showModal(triggerNode);}};window.addEventListener(\"scroll\",scrollListener);return()=>window.removeEventListener(\"scroll\",scrollListener);}}return;},[showOnScroll,scrollConfig.showOnScrollToPercentage,scrollConfig.scrollPercentage,showModal,hasBeenShownRecently]);// It would be nice to aria-hide the container that Framer\n// wraps this in, but that would only be possible on the canvas\n// and it's not!\nreturn /*#__PURE__*/_jsx(\"div\",{ref:triggerRef,\"aria-hidden\":\"true\"});}// If this component breaks, it could be because Framer has decided to not wrap\n// code components in containers anymore. If that's the case, access\n// node.parentElement instead of node.parentElement.parentElement\nconst simulateClick=node=>{var _node_parentElement;if((_node_parentElement=node.parentElement)===null||_node_parentElement===void 0?void 0:_node_parentElement.parentElement){const button=node.parentElement.parentElement;button.dispatchEvent(new FocusEvent(\"focus\"));button.dispatchEvent(new KeyboardEvent(\"keydown\",{key:\"Enter\"}));button.dispatchEvent(new KeyboardEvent(\"keyup\",{key:\"Enter\"}));}};addPropertyControls(ModalTrigger,{showOnMouseLeave:{type:ControlType.Boolean,title:\"MouseLeave\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},showOnScroll:{type:ControlType.Boolean,title:\"Scroll\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delayConfig:{type:ControlType.Object,title:\"Delay\",buttonTitle:\"Configure\",controls:{showOnDelay:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delaySeconds:{type:ControlType.Number,title:\"Seconds\",defaultValue:10,min:0,max:300,step:5,displayStepper:true,unit:\" s\"}}},scrollConfig:{type:ControlType.Object,title:\"Scroll\",buttonTitle:\"Configure\",controls:{showOnScrollToPercentage:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},scrollPercentage:{type:ControlType.Number,title:\"Scroll %\",defaultValue:50,min:0,max:100,step:1,displayStepper:true,unit:\" %\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ModalTrigger\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"0\",\"framerIntrinsicWidth\":\"0\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Modal_Trigger.map"],"mappings":"wMAAA,SAAS,EAAO,EAAE,CAAC,IAAI,IAAIA,EAAE,EAAEA,EAAE,UAAU,OAAO,IAAI,CAAC,IAAI,EAAE,UAAUA,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,OAAOC,EAAyO,SAAS,EAAK,EAAE,EAAE,CAAC,SAAS,EAAI,EAAE,EAAE,EAAE,CAAC,GAAiB,OAAO,SAArB,IAA8B,CAAC,EAAE,EAAO,EAAE,CAACD,EAAE,EAAE,CAAY,OAAO,EAAE,SAApB,WAA8B,EAAE,QAAQ,IAAI,KAAK,KAAK,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,AAAY,EAAE,UAAQ,EAAE,QAAQ,aAAa,CAAE,EAA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