{"version":3,"file":"Tally_Pop_Up.V-RXmDr8.mjs","names":["useRef","useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/1nFcHYCmG0fc3vDfocoy/wsdPK4IvYBlwZVxXONyn/TallyForms.js","https:/framerusercontent.com/modules/2o7iVwO1fk6LjMH23dEZ/XXtTkjP9UNwSXKED8xqO/Tally_Pop_Up.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useCallback,useEffect,useMemo,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const WIDGET_URL=\"https://tally.so/widgets/embed.js\";/**\n * @framerIntrinsicWidth 700\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any\n */export default function TallyForms(props){const{form,title,alignLeft,background}=props;const iframeRef=useRef(null);const[isMobile,setIsMobile]=useState(false);useEffect(()=>{const check=()=>setIsMobile(window.innerWidth<768);check();window.addEventListener(\"resize\",check);return()=>window.removeEventListener(\"resize\",check);},[]);const embedUrl=useMemo(()=>{const searchParams=new URLSearchParams({hideTitle:title?\"0\":\"1\",alignLeft:alignLeft?\"1\":\"0\",transparentBackground:background?\"0\":\"1\",dynamicHeight:\"0\",formEventsForwarding:\"0\"});let url=\"\";if(form.includes(\"tally.so/\")){const matches=form.match(/\\/(?:r|embed|popup|forms)\\/([a-zA-Z0-9]+)/);if(matches!==null){const formId=matches[1];url=`https://tally.so/embed/${formId}`;}}else if(form.startsWith(\"http\")&&form.includes(\".\")){url=form;searchParams.set(\"embed\",\"1\");}if(!url){url=`https://tally.so/embed/${form}`;}return`${url}?${searchParams.toString()}`;},[form,title,alignLeft,background]);const loadEmbeds=useCallback(()=>{const iframeEl=iframeRef.current;if(iframeEl?.dataset?.tallyEmbedWidgetInitialized){iframeEl.removeAttribute(\"data-tally-embed-widget-initialized\");}// @ts-expect-error Tally is not defined in the global scope\nif(typeof Tally!==\"undefined\"){// @ts-expect-error Tally is not defined in the global scope\nTally.loadEmbeds();}else{document.querySelectorAll(\"iframe[data-tally-src]:not([src])\").forEach(e=>{e.src=e.dataset.tallySrc;});}},[]);const loadWidgetScript=useCallback(()=>{const scriptEl=document.createElement(\"script\");scriptEl.src=WIDGET_URL;scriptEl.onload=loadEmbeds;scriptEl.onerror=loadEmbeds;document.body.appendChild(scriptEl);},[loadEmbeds]);useEffect(()=>{const iframeEl=iframeRef.current;if(!iframeEl)return;// @ts-expect-error Tally is not defined in the global scope\nif(typeof Tally!==\"undefined\"){if(iframeEl.dataset.tallyEmbedWidgetInitialized){iframeEl.removeAttribute(\"data-tally-embed-widget-initialized\");iframeEl.removeAttribute(\"src\");iframeEl.style.height=\"\";void iframeEl.offsetHeight;}setTimeout(()=>{// @ts-expect-error Tally is not defined in the global scope\nif(typeof Tally!==\"undefined\"){// @ts-expect-error Tally is not defined in the global scope\nTally.loadEmbeds();}},0);}else if(document.querySelector(`script[src=\"${WIDGET_URL}\"]`)==null){loadWidgetScript();}},[embedUrl,loadWidgetScript]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:\"inherit\",position:\"relative\",isolation:\"isolate\",transform:\"translateZ(0)\",willChange:\"transform\"},onMouseEnter:e=>e.stopPropagation(),onMouseLeave:e=>e.stopPropagation(),onMouseMove:e=>e.stopPropagation(),children:/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,title:\"Tally form\",\"data-tally-src\":embedUrl,height:\"100%\",frameBorder:0,marginHeight:0,marginWidth:0,allowTransparency:true,style:{display:\"block\",width:isMobile?\"100%\":\"calc(100% + 15px)\",transform:\"translateZ(0)\",willChange:\"transform\"}})});}addPropertyControls(TallyForms,{form:{type:ControlType.String,title:\"Form\",defaultValue:\"tally.so/r/3EKXW4\",description:\"Create a form in [Tally](https://tally.so?ref=framer) and copy the form link\"},title:{type:ControlType.Boolean,title:\"Title\",enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:false},alignLeft:{type:ControlType.Boolean,title:\"Align\",enabledTitle:\"Left\",disabledTitle:\"Center\",defaultValue:true},background:{type:ControlType.Boolean,title:\"Background\",enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TallyForms\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"700\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TallyForms.map","import{jsx as _jsx}from\"react/jsx-runtime\";export function TallyPopup(Component){return({...props})=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-tally-open\":\"EkvbLq\",\"data-tally-layout\":\"modal\",\"data-tally-emoji-text\":\"👋\",\"data-tally-emoji-animation\":\"wave\"});};}\nexport const __FramerMetadata__ = {\"exports\":{\"TallyPopup\":{\"type\":\"reactHoc\",\"name\":\"TallyPopup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Tally_Pop_Up.map"],"mappings":"oNAIG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,QAAM,YAAU,cAAY,EAAY,EAAUA,EAAO,IAAI,EAAO,CAAC,EAAS,GAAaC,EAAS,EAAK,EAAE,MAAc,CAAC,IAAM,MAAU,EAAY,EAAO,WAAW,GAAG,EAAkD,OAAhD,EAAM,EAAE,EAAO,iBAAiB,SAAS,CAAK,MAAY,EAAO,oBAAoB,SAAS,CAAK,CAAE,EAAE,CAAC,CAAC,EAAE,IAAM,EAASC,MAAY,CAAC,IAAM,EAAa,IAAI,gBAAgB,CAAC,UAAU,EAAM,IAAI,IAAI,UAAU,EAAU,IAAI,IAAI,sBAAsB,EAAW,IAAI,IAAI,cAAc,IAAI,qBAAqB,GAAG,CAAC,EAAM,EAAI,GAAG,GAAG,EAAK,SAAS,WAAW,EAAE,CAAC,IAAM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