{"version":3,"file":"FunnelAutoStart.CE4eQxF8.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/DKzCCNEhSjbSEFYGp14C/PJbjApVJbvLjUQpR92dh/FunnelAutoStart.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Funnel Auto-Start\n *\n * Unsichtbarer Ausloeser: feuert nach einer Verzoegerung ein Event,\n * aber hoechstens einmal innerhalb des eingestellten Zeitraums.\n *\n * @framerIntrinsicWidth 2\n * @framerIntrinsicHeight 2\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FunnelAutoStart(props){const{delaySeconds=1,oncePerDays=30,storageKey=\"nc-schein-interview-seen\",onTrigger}=props;const fired=useRef(false);useEffect(()=>{if(typeof window===\"undefined\")return;if(RenderTarget.current()!==RenderTarget.preview)return;if(fired.current)return;let allowed=false;try{const raw=window.localStorage.getItem(storageKey);const last=raw?parseInt(raw,10):0;const now=Date.now();if(!last||now-last>oncePerDays*24*60*60*1e3)allowed=true;}catch(e){allowed=false;}if(!allowed)return;const timer=window.setTimeout(()=>{if(fired.current)return;fired.current=true;try{window.localStorage.setItem(storageKey,String(Date.now()));}catch(e){}if(onTrigger)onTrigger();},Math.max(0,delaySeconds)*1e3);return()=>window.clearTimeout(timer);},[delaySeconds,oncePerDays,storageKey,onTrigger]);return /*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{...props.style,position:\"relative\",display:\"block\",width:2,height:2,pointerEvents:\"none\"}});}addPropertyControls(FunnelAutoStart,{delaySeconds:{type:ControlType.Number,title:\"Verzoegerung\",defaultValue:1,min:0,max:60,unit:\"s\"},oncePerDays:{type:ControlType.Number,title:\"Nur alle\",defaultValue:30,min:1,max:365,unit:\"Tage\"},storageKey:{type:ControlType.String,title:\"Speicher-Key\",defaultValue:\"nc-schein-interview-seen\"},onTrigger:{type:ControlType.EventHandler,title:\"Ausloesen\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FunnelAutoStart\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"2\",\"framerIntrinsicHeight\":\"2\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FunnelAutoStart.map"],"mappings":"sMAWG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,eAAa,EAAE,cAAY,GAAG,aAAW,2BAA2B,aAAW,EAAY,EAAMA,EAAO,EAAK,EAAopB,OAAlpB,MAAc,CAA+F,GAApF,IAAS,QAAsB,EAAa,QAAQ,IAAI,EAAa,SAAkB,EAAM,QAAQ,OAAO,IAAI,EAAQ,GAAM,GAAG,CAAC,IAAM,EAAI,EAAO,aAAa,QAAQ,CAAU,EAAQ,EAAK,EAAI,SAAS,EAAI,EAAE,EAAE,GAA0B,CAAC,GAAf,KAAK,IAAkB,EAAE,EAAK,EAAY,GAAG,GAAG,GAAG,OAAI,EAAQ,GAAK,MAAS,CAAC,EAAQ,EAAM,CAAC,GAAG,CAAC,EAAQ,OAAO,IAAM,EAAM,EAAO,eAAe,CAAI,MAAM,QAAe,GAAM,QAAQ,GAAK,GAAG,CAAC,EAAO,aAAa,QAAQ,EAAW,OAAO,KAAK,IAAI,CAAC,CAAC,CAAE,MAAS,CAAC,CAAI,GAAU,EAAU,CAAtG,CAAwG,EAAE,KAAK,IAAI,EAAE,CAAY,EAAE,GAAG,EAAE,UAAU,EAAO,aAAa,CAAK,CAAE,EAAE,CAAC,EAAa,EAAY,EAAW,CAAS,CAAC,EAAsB,EAAK,OAAO,CAAC,cAAc,OAAO,MAAM,CAAC,GAAG,EAAM,MAAM,SAAS,WAAW,QAAQ,QAAQ,MAAM,EAAE,OAAO,EAAE,cAAc,MAAM,CAAC,CAAC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