{"version":3,"file":"TallyForms.ROxMHb8a.mjs","names":["useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/V4h4EjBj7cKNB6QjCAQ6/71FFFhUXcU7HwDJyWlUt/jFtCgpHNk.js","https:/framerusercontent.com/modules/wK8r9CRnmNFLJyrAjgYX/eAwoxCEH17J2KKURdLKv/TallyForms.js"],"sourcesContent":["// Generated by Framer (6ca5d98)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,cx,motion,withCSS}from\"framer\";import*as React from\"react\";import{forwardRef}from\"react\";const mask='url(\\'data:image/svg+xml,<svg display=\"block\" role=\"presentation\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 0 0 L 0 6 L 0.01 6 L 0 6.01 L 4 10 L 0 14 L 0.01 14.01 L 0 14.01 L 0 20 L 12 20 L 12 14.01 L 11.99 14.01 L 12 14 L 8 10 L 12 6.01 L 11.99 6 L 12 6 L 12 0 Z M 10 14.5 L 10 18 L 2 18 L 2 14.5 L 6 10.5 Z M 6 9.5 L 2 5.5 L 2 2 L 10 2 L 10 5.5 Z\" fill=\"var(--esondr, rgb(0,0,0))\" height=\"20px\" id=\"Ph4FeWxsH\" transform=\"translate(6 2)\" width=\"12px\"/></svg>\\') alpha no-repeat center / auto var(--framer-icon-mask-mode, add), var(--framer-icon-mask, none)';const SVG=/*#__PURE__*/forwardRef((props,ref)=>{const{animated,layoutId,children,...rest}=props;return animated?/*#__PURE__*/_jsx(motion.div,{...rest,layoutId:layoutId,ref:ref}):/*#__PURE__*/_jsx(\"div\",{...rest,ref:ref});});const getProps=({fill,height,id,width,...props})=>{return{...props,K5AAorpEW:fill??props.K5AAorpEW??\"rgb(0, 0, 0)\"};};const Component=/*#__PURE__*/React.forwardRef(function(props,ref){const{style,className,layoutId,variant,K5AAorpEW,...restProps}=getProps(props);return /*#__PURE__*/_jsx(SVG,{...restProps,className:cx(\"framer-aI4Bk\",className),layoutId:layoutId,ref:ref,style:{\"--esondr\":K5AAorpEW,...style}});});const css=[`.framer-aI4Bk { -webkit-mask: ${mask}; aspect-ratio: 1; background-color: var(--esondr); mask: ${mask}; width: 24px; }`];/**\n * This is a generated Framer component.\n * @framerIntrinsicWidth 24\n * @framerIntrinsicHeight 24\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerVariables {\"K5AAorpEW\":\"fill\"}\n * @framerImmutableVariables true\n * @framerVector {\"name\":\"Hourglass Empty\",\"color\":{\"type\":\"variable\",\"value\":\"esondr\"},\"set\":{\"localId\":\"vectorSet/DnLsXE00W\",\"id\":\"DnLsXE00W\",\"moduleId\":\"JIScivAkNLgXrcOUxHXD\"}}\n * @framerDisableUnlink true\n */const Icon=withCSS(Component,css,\"framer-aI4Bk\");Icon.displayName=\"Hourglass Empty\";export default Icon;addPropertyControls(Icon,{K5AAorpEW:{defaultValue:\"rgb(0, 0, 0)\",hidden:false,title:\"Fill\",type:ControlType.Color}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Icon\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerVector\":\"{\\\"name\\\":\\\"Hourglass Empty\\\",\\\"color\\\":{\\\"type\\\":\\\"variable\\\",\\\"value\\\":\\\"esondr\\\"},\\\"set\\\":{\\\"localId\\\":\\\"vectorSet/DnLsXE00W\\\",\\\"id\\\":\\\"DnLsXE00W\\\",\\\"moduleId\\\":\\\"JIScivAkNLgXrcOUxHXD\\\"}}\",\"framerDisableUnlink\":\"true\",\"framerImmutableVariables\":\"true\",\"framerIntrinsicWidth\":\"24\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerVariables\":\"{\\\"K5AAorpEW\\\":\\\"fill\\\"}\",\"framerIntrinsicHeight\":\"24\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{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 embedUrl=useMemo(()=>{const searchParams=new URLSearchParams({hideTitle:title?\"0\":\"1\",alignLeft:alignLeft?\"1\":\"0\",transparentBackground:background?\"0\":\"1\",dynamicHeight:\"1\",formEventsForwarding:\"1\"});let url=\"\";if(form.includes(\"tally.so/\")){// Tally link with form ID\nconst 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(\".\")){// Custom domain\nurl=form;searchParams.set(\"embed\",\"1\");}// If we still don't have URL, we assume the form is the form ID itself\nif(!url){url=`https://tally.so/embed/${form}`;}// Append query params\nreturn`${url}?${searchParams.toString()}`;},[form,title,alignLeft,background]);const loadEmbeds=useCallback(()=>{// Remove initialized attribute if any, so we can reload\nconst 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\"){/**\n             * Reset iframe to uninitialized state so Tally's widget can reinitialize it properly.\n             * This ensures dynamic height and all other Tally features work correctly.\n             */if(iframeEl.dataset.tallyEmbedWidgetInitialized){iframeEl.removeAttribute(\"data-tally-embed-widget-initialized\");iframeEl.removeAttribute(\"src\");iframeEl.style.height=\"\";// Force a reflow before calling loadEmbeds to ensure DOM updates are applied\nvoid iframeEl.offsetHeight;}// Use setTimeout to ensure the DOM has updated before Tally processes it\nsetTimeout(()=>{// @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(\"iframe\",{ref:iframeRef,title:\"Tally form\",\"data-tally-src\":embedUrl,width:\"100%\",height:\"100%\",frameBorder:0,marginHeight:0,marginWidth:0});}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\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"700\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TallyForms.map"],"mappings":"qRAC2C,IAAsE,IAA4B,CAAoC,EAAK,skBAA8kB,EAAiB,GAAY,EAAM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