{"version":3,"file":"RailSnap.BPI4apnf.mjs","names":[],"sources":["https:/framerusercontent.com/modules/dWmnoy4nle9kLq4FPS0I/fy5tf0z0xgJIuSIM2n6P/RailSnap.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Rail Snap — makes the horizontal card rows on the hub snap as you swipe.\n * Finds every frame named `railName` that actually scrolls sideways and gives it\n * CSS scroll snapping, so each card settles in place instead of drifting.\n * Renders nothing on the published site; the box below is a canvas aid.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RailSnap(props){const{railName=\"Sessions\",alsoName=\"Stimuli\",align=\"start\",inset=20,maxWidth=900,enabled=true,hideEmptyBlocks=true,blockName=\"Source Block\",cardName=\"Session Card\"}=props;useEffect(()=>{if(typeof window===\"undefined\"||!enabled)return;const names=[railName,alsoName].filter(Boolean);const rails=()=>names.flatMap(n=>Array.from(document.querySelectorAll(`[data-framer-name=\"${n}\"]`)));const apply=()=>{const on=window.innerWidth<=maxWidth;rails().forEach(el=>{const cs=getComputedStyle(el);const scrolls=(cs.overflowX===\"auto\"||cs.overflowX===\"scroll\")&&el.scrollWidth>el.clientWidth+2;if(on&&scrolls){el.style.scrollSnapType=\"x mandatory\";el.style.scrollPaddingLeft=`${inset}px`;el.style.scrollPaddingRight=`${inset}px`;el.style.overscrollBehaviorX=\"contain\";Array.from(el.children).forEach(c=>{c.style.scrollSnapAlign=align;c.style.scrollSnapStop=\"always\";});}else{el.style.scrollSnapType=\"\";el.style.scrollPaddingLeft=\"\";el.style.scrollPaddingRight=\"\";Array.from(el.children).forEach(c=>{c.style.scrollSnapAlign=\"\";c.style.scrollSnapStop=\"\";});}});};// Hide any source block whose workouts are all drafted, so a coach or team\n// never shows as a heading with nothing under it. Runs at every width.\nconst hideEmpty=()=>{if(!hideEmptyBlocks)return;const blocks=Array.from(document.querySelectorAll(`[data-framer-name=\"${blockName}\"]`));blocks.forEach(b=>{const n=b.querySelectorAll(`[data-framer-name=\"${cardName}\"]`).length;if(n===0){if(b.dataset.emptyHidden!==\"1\"){b.dataset.emptyHidden=\"1\";b.style.display=\"none\";}}else if(b.dataset.emptyHidden===\"1\"){delete b.dataset.emptyHidden;b.style.removeProperty(\"display\");}});};hideEmpty();const hideTimers=[setTimeout(hideEmpty,400),setTimeout(hideEmpty,1400)];const hideObserver=new MutationObserver(()=>hideEmpty());hideObserver.observe(document.body,{childList:true,subtree:true});apply();const t1=window.setTimeout(apply,400);const t2=window.setTimeout(apply,1500);window.addEventListener(\"resize\",apply);const mo=new MutationObserver(()=>apply());mo.observe(document.body,{childList:true,subtree:true});return()=>{hideTimers.forEach(clearTimeout);hideObserver.disconnect();window.clearTimeout(t1);window.clearTimeout(t2);window.removeEventListener(\"resize\",apply);mo.disconnect();};},[railName,alsoName,align,inset,maxWidth,enabled,hideEmptyBlocks,blockName,cardName]);if(RenderTarget.current()!==RenderTarget.canvas)return null;return /*#__PURE__*/_jsxs(\"div\",{style:{padding:12,border:\"1px dashed #999\",borderRadius:8,fontSize:12,lineHeight:1.4,color:\"#666\",background:\"#f8f9fa\",fontFamily:\"system-ui, sans-serif\"},children:[\"Rail Snap \\xb7 snaps “\",railName,\"” and “\",alsoName,\"” rows to \",align,\" below\",\" \",maxWidth,\"px \\xb7 canvas only\"]});}addPropertyControls(RailSnap,{railName:{type:ControlType.String,title:\"Rail name\",defaultValue:\"Sessions\"},alsoName:{type:ControlType.String,title:\"Also snap\",defaultValue:\"Stimuli\"},align:{type:ControlType.Enum,title:\"Snap to\",options:[\"start\",\"center\"],defaultValue:\"start\"},inset:{type:ControlType.Number,title:\"Edge inset\",defaultValue:20,min:0,max:60},maxWidth:{type:ControlType.Number,title:\"Apply below\",defaultValue:900,min:320,max:1600},enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true},hideEmptyBlocks:{type:ControlType.Boolean,title:\"Hide empty sources\",defaultValue:true},blockName:{type:ControlType.String,title:\"Block layer\",defaultValue:\"Source Block\"},cardName:{type:ControlType.String,title:\"Card layer\",defaultValue:\"Session Card\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RailSnap\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RailSnap.map"],"mappings":"gMAQG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,WAAS,WAAW,WAAS,UAAU,QAAM,QAAQ,QAAM,GAAG,WAAS,IAAI,UAAQ,GAAK,kBAAgB,GAAK,YAAU,eAAe,WAAS,gBAAgB,EAE68B,OAFv8B,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAQ,OAAO,IAAM,EAAM,CAAC,EAAS,CAAQ,CAAC,CAAC,OAAO,OAAO,EAAQ,MAAU,EAAM,QAAQ,GAAG,MAAM,KAAK,SAAS,iBAAiB,sBAAsB,EAAE,GAAG,CAAC,CAAC,EAAQ,MAAU,CAAC,IAAM,EAAG,EAAO,YAAY,EAAS,EAAM,CAAC,CAAC,QAAQ,GAAI,CAAC,IAAM,EAAG,iBAAiB,CAAE,EAAQ,GAAS,EAAG,YAAY,QAAQ,EAAG,YAAY,WAAW,EAAG,YAAY,EAAG,YAAY,EAAK,GAAI,GAAS,EAAG,MAAM,eAAe,cAAc,EAAG,MAAM,kBAAkB,GAAG,EAAM,IAAI,EAAG,MAAM,mBAAmB,GAAG,EAAM,IAAI,EAAG,MAAM,oBAAoB,UAAU,MAAM,KAAK,EAAG,QAAQ,CAAC,CAAC,QAAQ,GAAG,CAAC,EAAE,MAAM,gBAAgB,EAAM,EAAE,MAAM,eAAe,QAAS,CAAC,IAAQ,EAAG,MAAM,eAAe,GAAG,EAAG,MAAM,kBAAkB,GAAG,EAAG,MAAM,mBAAmB,GAAG,MAAM,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