{"version":3,"file":"EmbedSocial.BQdVbOJs.mjs","names":["React.useRef","React.useState","React.useMemo","React.useCallback"],"sources":["https:/framerusercontent.com/modules/oObE7yL4qNIEvbij4hmu/wLGsUwdoMtgnT9gJxPJb/EmbedSocial.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function UGCEmbedSocial({dataRef,maxWidth=1280,sidePadding=16,minHeight=500,loadStrategy=\"visible\",rootMargin=\"200px 0px\",debug=false}){const wrapRef=React.useRef(null);const slotRef=React.useRef(null);const[loaded,setLoaded]=React.useState(false);const cleanRef=(dataRef||\"\").trim();// Debounced nudge to ask EmbedSocial to (re)scan\nconst rescan=React.useMemo(()=>{let t=null;return()=>{if(t)window.clearTimeout(t);t=window.setTimeout(()=>{// Some builds expose a global helper\n// @ts-ignore\nif(window.EmbedSocial?.reload)window.EmbedSocial.reload();t=null;},80);};},[]);const ensureScript=React.useCallback(()=>{const ID=\"EmbedSocialHashtagScript\";if(document.getElementById(ID))return;const s=document.createElement(\"script\");s.id=ID;s.src=\"https://embedsocial.com/cdn/ht.js\";s.async=true;document.head.appendChild(s);},[]);const init=React.useCallback(()=>{if(!slotRef.current||!cleanRef)return;ensureScript();// Ask it to scan shortly after the script is ensured\nrescan();// When EmbedSocial injects content, release minHeight\nconst mo=new MutationObserver(()=>{if(slotRef.current&&slotRef.current.children.length>0){setLoaded(true);}});mo.observe(slotRef.current,{childList:true,subtree:true});// Re-scan on container size changes (Framer layout shifting)\nconst ro=new ResizeObserver(()=>rescan());if(wrapRef.current)ro.observe(wrapRef.current);return()=>{mo.disconnect();ro.disconnect();};},[cleanRef,ensureScript,rescan]);React.useEffect(()=>{if(!wrapRef.current)return;if(loadStrategy===\"immediate\"){return init();}// Lazy: only load when visible and has real width\nconst io=new IntersectionObserver((entries,obs)=>{for(const e of entries){if(!e.isIntersecting)continue;if(wrapRef.current&&wrapRef.current.clientWidth>320){const cleanup=init();obs.disconnect();return()=>cleanup&&cleanup();}}},{rootMargin});io.observe(wrapRef.current);return()=>io.disconnect();},[init,loadStrategy,rootMargin]);return /*#__PURE__*/_jsx(\"div\",{ref:wrapRef,style:{width:\"100%\",maxWidth,margin:\"0 auto\",padding:`0 ${sidePadding}px`,boxSizing:\"border-box\",// Prevent CLS while content mounts\nminHeight:loaded?undefined:minHeight,contentVisibility:\"auto\",containIntrinsicSize:loaded?undefined:`${minHeight}px`,outline:debug?\"1px dashed #999\":\"none\"},children:/*#__PURE__*/_jsx(\"div\",{ref:slotRef,className:\"embedsocial-hashtag\",\"data-ref\":cleanRef,\"data-lazyload\":\"yes\",style:{width:\"100%\"}},cleanRef)});}addPropertyControls(UGCEmbedSocial,{dataRef:{type:ControlType.String,title:\"UGC data-ref\"},maxWidth:{type:ControlType.Number,title:\"Max Width\",defaultValue:1280,min:320,max:2200},sidePadding:{type:ControlType.Number,title:\"Side Padding\",defaultValue:16,min:0,max:64},minHeight:{type:ControlType.Number,title:\"Min Height (px)\",defaultValue:500,min:0,max:2e3},loadStrategy:{type:ControlType.Enum,title:\"Load\",options:[\"visible\",\"immediate\"],optionTitles:[\"On view\",\"Immediate\"]},rootMargin:{type:ControlType.String,title:\"Lazy RootMargin\",defaultValue:\"200px 0px\"},debug:{type:ControlType.Boolean,title:\"Debug Outline\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"UGCEmbedSocial\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmbedSocial.map"],"mappings":"gNAA2H,SAAwB,EAAe,CAAC,UAAQ,WAAS,KAAK,cAAY,GAAG,YAAU,IAAI,eAAa,UAAU,aAAW,YAAY,QAAM,IAAO,CAAC,IAAM,EAAQA,EAAa,KAAK,CAAO,EAAQA,EAAa,KAAK,CAAM,CAAC,EAAO,GAAWC,EAAe,GAAM,CAAO,GAAU,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