{"version":3,"file":"InstagramReel.uL9WNXfD.mjs","names":["useRef","useState","useMemo","_Fragment","p"],"sources":["https:/framerusercontent.com/modules/pBw4hwa69ZMr4JMxgzkX/hO9befNCasqZlATjLCav/InstagramReel.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useMemo,useRef,useEffect}from\"react\";/**\n * INSTAGRAM REEL – Framer Code Component\n * ------------------------------------------------------------------\n * Bettet ein öffentliches Instagram Reel (oder einen Post) per iframe ein.\n * URL einfügen – der Shortcode wird automatisch erkannt\n * (/reel/, /reels/, /p/, /tv/).\n *\n * AUTO-HÖHE: Instagram meldet die exakte Inhaltshöhe per postMessage\n * (\"MEASURE\"). Wird ausgelesen, damit nichts abgeschnitten wird.\n *\n * STIL:\n *  - \"Clean\": Instagram-Header (Username/Buttons) und Footer (Likes/\n *    Kommentare/\"Mehr auf Instagram\") werden weggeschnitten -> ruhige,\n *    rein videofokussierte Kachel. Passt zu cleanem, editorialem Design.\n *  - \"Karte\": vollständige Instagram-Karte mit allem Drumherum.\n *\n * Tipp: Höhe in Framer auf \"Fit Content\" stellen. Breite selbst vorgeben\n * (360–400 px wirkt am saubersten).\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function InstagramReel(props){const{url,variant,cropTop,cropBottom,showCaption,borderRadius,shadow,backgroundColor,loadingColor,style}=props;const iframeRef=useRef(null);const[loaded,setLoaded]=useState(false);const isClean=variant===\"clean\";// Caption nur in der \"Karte\"-Ansicht sinnvoll\nconst withCaption=!isClean&&showCaption;// Fallback-Höhe, bis Instagram die echte Höhe meldet\nconst[measuredHeight,setMeasuredHeight]=useState(withCaption?660:560);// Shortcode aus allen gängigen Instagram-URL-Formaten extrahieren\nconst embedUrl=useMemo(()=>{if(!url)return null;const match=url.match(/instagram\\.com\\/(?:reel|reels|p|tv)\\/([A-Za-z0-9_-]+)/);const id=match?match[1]:null;if(!id)return null;return`https://www.instagram.com/reel/${id}/embed/${withCaption?\"captioned/\":\"\"}`;},[url,withCaption]);// Beim Wechsel: Ladezustand zurücksetzen\nuseEffect(()=>{setLoaded(false);},[embedUrl]);// Auf die Höhen-Meldung von Instagram hören\nuseEffect(()=>{function handleMessage(event){if(!event.origin||!event.origin.includes(\"instagram.com\"))return;// Nur Nachrichten DIESER iframe verarbeiten (mehrere Embeds möglich)\nif(event.source!==iframeRef.current?.contentWindow)return;try{const data=typeof event.data===\"string\"?JSON.parse(event.data):event.data;if(data?.type===\"MEASURE\"&&data?.details?.height){setMeasuredHeight(Math.ceil(data.details.height));}}catch(e){// Nicht-JSON-Nachrichten ignorieren\n}}window.addEventListener(\"message\",handleMessage);return()=>window.removeEventListener(\"message\",handleMessage);},[]);// Sichtbare Höhe = gemessene Höhe minus weggeschnittenes Chrome\nconst visibleHeight=isClean?Math.max(measuredHeight-cropTop-cropBottom,160):measuredHeight;const containerStyle={...style,width:\"100%\",height:embedUrl?visibleHeight:isClean?480:560,position:\"relative\",overflow:\"hidden\",borderRadius,backgroundColor};// Platzhalter, solange keine (gültige) URL gesetzt ist\nif(!embedUrl){return /*#__PURE__*/_jsxs(\"div\",{style:{...containerStyle,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:12,color:\"rgba(255,255,255,0.85)\",fontFamily:\"Inter, -apple-system, system-ui, sans-serif\",fontSize:14,textAlign:\"center\",padding:24},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:44,height:44,borderRadius:12,background:\"linear-gradient(45deg,#feda75,#fa7e1e,#d62976,#962fbf,#4f5bd5)\"}}),/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:600},children:\"Instagram Reel\"}),/*#__PURE__*/_jsx(\"span\",{style:{opacity:.7,lineHeight:1.4},children:\"F\\xfcge rechts im Panel eine Reel-URL ein\"})]});}return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[!loaded&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`@keyframes ig-spin{to{transform:rotate(360deg)}}`}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:loadingColor,zIndex:1},children:/*#__PURE__*/_jsx(\"div\",{style:{width:28,height:28,borderRadius:\"50%\",border:\"3px solid rgba(255,255,255,0.2)\",borderTopColor:\"#000000\",animation:\"ig-spin 0.8s linear infinite\"}})})]}),/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,src:embedUrl,title:\"Instagram Reel\",onLoad:()=>setLoaded(true),scrolling:\"no\",frameBorder:0,allow:\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\",allowFullScreen:true,style:{position:\"absolute\",left:0,top:isClean?-cropTop:0,width:\"100%\",height:measuredHeight,border:\"none\",display:\"block\"}},embedUrl)]});}InstagramReel.defaultProps={url:\"\",variant:\"clean\",cropTop:58,cropBottom:118,showCaption:false,borderRadius:16,shadow:true,backgroundColor:\"#000000\",loadingColor:\"#1a1a1a\"};addPropertyControls(InstagramReel,{url:{type:ControlType.String,title:\"Reel URL\",placeholder:\"https://www.instagram.com/reel/...\"},variant:{type:ControlType.Enum,title:\"Stil\",options:[\"clean\",\"card\"],optionTitles:[\"Clean (nur Video)\",\"Karte (Instagram)\"],defaultValue:\"clean\",displaySegmentedControl:true},cropTop:{type:ControlType.Number,title:\"Oben beschneiden\",min:0,max:160,step:1,unit:\"px\",defaultValue:58,hidden:p=>p.variant!==\"clean\"},cropBottom:{type:ControlType.Number,title:\"Unten beschneiden\",min:0,max:200,step:1,unit:\"px\",defaultValue:118,hidden:p=>p.variant!==\"clean\"},showCaption:{type:ControlType.Boolean,title:\"Caption\",enabledTitle:\"An\",disabledTitle:\"Aus\",defaultValue:false,hidden:p=>p.variant!==\"card\"},borderRadius:{type:ControlType.Number,title:\"Ecken\",min:0,max:48,step:1,unit:\"px\",defaultValue:16},shadow:{type:ControlType.Boolean,title:\"Schatten\",enabledTitle:\"An\",disabledTitle:\"Aus\",defaultValue:true},backgroundColor:{type:ControlType.Color,title:\"Hintergrund\",defaultValue:\"#000000\"},loadingColor:{type:ControlType.Color,title:\"Ladefarbe\",defaultValue:\"#1a1a1a\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InstagramReel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InstagramReel.map"],"mappings":"2NAqBG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,MAAI,UAAQ,UAAQ,aAAW,cAAY,eAAa,SAAO,kBAAgB,eAAa,SAAO,EAAY,EAAUA,EAAO,KAAK,CAAM,CAAC,EAAO,GAAWC,EAAS,GAAM,CAAO,EAAQ,IAAU,QACtP,EAAY,CAAC,GAAS,EACvB,CAAC,EAAe,GAAmBA,EAAS,EAAY,IAAI,IAAI,CAC/D,EAASC,MAAY,CAAC,GAAG,CAAC,EAAI,OAAO,KAAK,IAAM,EAAM,EAAI,MAAM,wDAAwD,CAAO,EAAG,EAAM,EAAM,GAAG,KAAwB,OAAf,EAAqB,kCAAkC,EAAG,SAAS,EAAY,aAAa,KAAlF,MAAyF,CAAC,EAAI,EAAY,CAAC,CACrR,MAAc,CAAC,EAAU,GAAM,EAAG,CAAC,EAAS,CAAC,CAC7C,MAAc,CAAC,SAAS,EAAc,EAAM,CAAI,MAAC,EAAM,QAAQ,CAAC,EAAM,OAAO,SAAS,gBAAgB,GACnG,EAAM,SAAS,EAAU,SAAS,cAAqB,GAAG,CAAC,IAAM,EAAK,OAAO,EAAM,MAAO,SAAS,KAAK,MAAM,EAAM,KAAK,CAAC,EAAM,KAAQ,GAAM,OAAO,WAAW,GAAM,SAAS,QAAQ,EAAkB,KAAK,KAAK,EAAK,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