{"version":3,"file":"Instagram_Reels_Embed.Cl8gIumJ.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/f0tzpyiJcwbkWtgDEg5b/2XmWugutJ9fmDpy7zGSB/Instagram_Reels_Embed.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const SCRIPT_SRC=\"https://www.instagram.com/embed.js\";// Load embed.js once per page, return a promise that resolves when ready.\nlet scriptPromise=null;function loadInstagramScript(){if(typeof window===\"undefined\")return Promise.resolve();if(window.instgrm)return Promise.resolve();if(scriptPromise)return scriptPromise;scriptPromise=new Promise(resolve=>{const existing=document.querySelector(`script[src=\"${SCRIPT_SRC}\"]`);if(existing){existing.addEventListener(\"load\",()=>resolve());// If it already loaded before we attached the listener:\nif(window.instgrm)resolve();return;}const s=document.createElement(\"script\");s.src=SCRIPT_SRC;s.async=true;s.onload=()=>resolve();document.body.appendChild(s);});return scriptPromise;}export default function InstagramEmbed(props){const{url,maxWidth,align,captioned}=props;const hostRef=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{const host=hostRef.current;if(!host)return;// Clean a trailing slash / query so we always end with the permalink + \"/\"\nconst clean=(url||\"\").trim().split(\"?\")[0].replace(/\\/?$/,\"/\");if(!clean||!clean.includes(\"instagram.com\")){host.innerHTML=\"\";return;}// Instagram reads these styles when sizing the embed, so use its\n// canonical min/max width. Forcing min-width:0 makes it render squished.\nconst minW=Math.min(326,maxWidth);host.innerHTML=`\n            <blockquote\n                class=\"instagram-media\"\n                data-instgrm-permalink=\"${clean}\"\n                data-instgrm-version=\"14\"\n                ${captioned?\"data-instgrm-captioned\":\"\"}\n                style=\"background:#FFF; border:0; margin:0 auto; padding:0; width:100%; max-width:${maxWidth}px; min-width:${minW}px;\">\n            </blockquote>\n        `;let cancelled=false;const run=()=>{if(cancelled)return;const ig=window.instgrm;// Documented signature takes no argument and processes the page.\nif(ig?.Embeds?.process)ig.Embeds.process();};loadInstagramScript().then(()=>{run();// Safety retry: the first pass can race Framer's layout, leaving\n// the embed unconverted (squished + non-playable) until reprocessed.\nsetTimeout(run,400);});return()=>{cancelled=true;};},[url,maxWidth,captioned]);const justify=align===\"left\"?\"flex-start\":align===\"right\"?\"flex-end\":\"center\";// On the Framer canvas, embeds often won't render (no external scripts /\n// sandboxed). Show a clear placeholder so the layout is still legible.\nif(isCanvas){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",minHeight:360,background:\"#F2F0EA\",border:\"1px dashed #3A4C7E\",borderRadius:12,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:6,color:\"#3A4C7E\",fontFamily:\"Acumin Pro, sans-serif\",fontSize:13,textAlign:\"center\",padding:16,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontWeight:600},children:\"Instagram Embed\"}),/*#__PURE__*/_jsx(\"div\",{style:{opacity:.8,wordBreak:\"break-all\"},children:url?url:\"Bind a reel URL →\"}),/*#__PURE__*/_jsx(\"div\",{style:{opacity:.6},children:\"Renders on the published site\"})]});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",display:\"flex\",justifyContent:justify},children:/*#__PURE__*/_jsx(\"div\",{ref:hostRef,style:{width:\"100%\",maxWidth}})});}InstagramEmbed.defaultProps={url:\"\",maxWidth:540,align:\"center\",captioned:false};addPropertyControls(InstagramEmbed,{url:{type:ControlType.String,title:\"Reel URL\",placeholder:\"https://www.instagram.com/reel/…\",description:\"Bind this to your CMS Instagram URL field.\"},maxWidth:{type:ControlType.Number,title:\"Max Width\",min:280,max:800,step:10,unit:\"px\",displayStepper:true},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true},captioned:{type:ControlType.Boolean,title:\"Caption\",enabledTitle:\"Show\",disabledTitle:\"Hide\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InstagramEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Instagram_Reels_Embed.map"],"mappings":"6MACuB,SAAS,GAAqB,CAC6G,OADlG,IAAS,QAAwC,EAAO,QAAe,QAAQ,QAAQ,EAAK,IAAmC,EAAc,IAAI,QAAQ,GAAS,CAAC,IAAM,EAAS,SAAS,cAAc,eAAe,EAAW,GAAG,EAAE,GAAG,EAAS,CAAC,EAAS,iBAAiB,WAAW,EAAQ,CAAC,EAChW,EAAO,SAAQ,EAAQ,EAAE,MAAO,CAAC,IAAM,EAAE,SAAS,cAAc,QAAQ,EAAE,EAAE,IAAI,EAAW,EAAE,MAAM,GAAK,EAAE,WAAW,EAAQ,EAAE,SAAS,KAAK,YAAY,CAAC,CAAE,CAAC,EAAS,EAAc,CAAC,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,MAAI,WAAS,QAAM,aAAW,EAAY,EAAQA,EAAO,IAAI,EAAQ,EAAS,EAAa,QAAQ,IAAI,EAAa,OAgB0R,OAhBnR,MAAc,CAAC,IAAM,EAAK,EAAQ,QAAQ,GAAG,CAAC,EAAK,OAC1Z,IAAM,GAAO,GAAK,GAAA,CAAI,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,OAAO,GAAG,EAAE,GAAG,CAAC,GAAO,CAAC,EAAM,SAAS,eAAe,EAAE,CAAC,EAAK,UAAU,GAAG,MAAO,CAEnG,EAAK,UAAU;;;0CAGP,EAAM;;kBAE9B,EAAU,yBAAyB,GAAG;oGAC4C,EAAS,gBANlG,KAAK,IAAI,IAAI,CAMwG,EAAE;;UAExH,IAAI,EAAU,GAAY,MAAQ,CAAC,GAAG,EAAU,OAAO,IAAM,EAAG,EAAO,QAC9E,GAAI,QAAQ,SAAQ,EAAG,OAAO,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