{"version":3,"file":"AFCarouselControls.BfJaIWEF.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/jJcmCTCfZQLNqLcuof1R/1mWPISmwrX8DYv3VF9kR/AFCarouselControls.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function AFCarouselControls({target=\"af-ouvertures\",label=\"Ouvertures\",style}){const root=React.useRef(null);const track=React.useRef(null);const[edges,setEdges]=React.useState({start:true,end:false,total:0,index:1});React.useEffect(()=>{if(typeof document===\"undefined\")return;let scope=root.current?.parentElement;let rail=null;while(scope&&!rail){rail=scope.querySelector(`[id=\"${target}\"], [data-framer-name=\"Carrousel CMS\"]`);scope=scope.parentElement;}if(!rail)return;const el=rail;track.current=el;const update=()=>{const cards=Array.from(el.children).filter(x=>x instanceof HTMLElement&&x.offsetWidth>0);const first=cards[0];const step=first?first.offsetWidth+16:el.clientWidth;setEdges({start:el.scrollLeft<3,end:el.scrollLeft+el.clientWidth>=el.scrollWidth-3,total:cards.length,index:Math.min(cards.length,Math.round(el.scrollLeft/step)+1)});};const oldSnap=el.style.scrollSnapType,oldTab=el.getAttribute(\"tabindex\"),oldRole=el.getAttribute(\"role\"),oldLabel=el.getAttribute(\"aria-label\");el.style.scrollSnapType=\"x mandatory\";el.setAttribute(\"tabindex\",\"0\");el.setAttribute(\"role\",\"region\");el.setAttribute(\"aria-label\",`Prestations : ${label}`);const saved=new Map;const sync=()=>{Array.from(el.children).forEach(c=>{if(c instanceof HTMLElement&&!saved.has(c)){saved.set(c,c.style.scrollSnapAlign);c.style.scrollSnapAlign=\"start\";}});update();};let down=false,startX=0,startScroll=0,moved=false;const pointerDown=e=>{if(e.pointerType!==\"mouse\"||e.button!==0)return;down=true;moved=false;startX=e.clientX;startScroll=el.scrollLeft;};const pointerMove=e=>{if(!down)return;const delta=e.clientX-startX;if(Math.abs(delta)>5){moved=true;el.style.scrollSnapType=\"none\";e.preventDefault();el.scrollLeft=startScroll-delta;}};const pointerUp=()=>{if(!down)return;down=false;el.style.scrollSnapType=\"x mandatory\";update();};const click=e=>{if(moved){e.preventDefault();e.stopPropagation();moved=false;}};const drag=e=>e.preventDefault();const key=e=>{if(e.target!==el||![\"ArrowLeft\",\"ArrowRight\",\"Home\",\"End\"].includes(e.key))return;e.preventDefault();const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;el.scrollTo({left:e.key===\"Home\"?0:e.key===\"End\"?el.scrollWidth:el.scrollLeft+(e.key===\"ArrowRight\"?1:-1)*el.clientWidth*.9,behavior:reduced?\"auto\":\"smooth\"});};const resize=new ResizeObserver(sync);resize.observe(el);const mutation=new MutationObserver(sync);mutation.observe(el,{childList:true,subtree:true,attributes:true,attributeFilter:[\"hidden\"]});el.addEventListener(\"scroll\",update,{passive:true});el.addEventListener(\"pointerdown\",pointerDown);window.addEventListener(\"pointermove\",pointerMove);window.addEventListener(\"pointerup\",pointerUp);window.addEventListener(\"pointercancel\",pointerUp);el.addEventListener(\"click\",click,true);el.addEventListener(\"dragstart\",drag);el.addEventListener(\"keydown\",key);sync();return()=>{resize.disconnect();mutation.disconnect();el.removeEventListener(\"scroll\",update);el.removeEventListener(\"pointerdown\",pointerDown);window.removeEventListener(\"pointermove\",pointerMove);window.removeEventListener(\"pointerup\",pointerUp);window.removeEventListener(\"pointercancel\",pointerUp);el.removeEventListener(\"click\",click,true);el.removeEventListener(\"dragstart\",drag);el.removeEventListener(\"keydown\",key);el.style.scrollSnapType=oldSnap;for(const[node,value]of saved)node.style.scrollSnapAlign=value;for(const[key,value]of[[\"tabindex\",oldTab],[\"role\",oldRole],[\"aria-label\",oldLabel]])value===null?el.removeAttribute(key):el.setAttribute(key,value);track.current=null;};},[target,label]);const move=direction=>{const el=track.current;if(!el)return;const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;el.scrollBy({left:direction*(Array.from(el.children).find(c=>c instanceof HTMLElement&&c.offsetWidth>0)?.offsetWidth+16||el.clientWidth*.9),behavior:reduced?\"auto\":\"smooth\"});};return /*#__PURE__*/_jsxs(\"div\",{ref:root,className:\"af-carousel-controls\",style:{...style,position:\"relative\",width:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:16,fontFamily:\"Inter, sans-serif\",color:\"#696969\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n@media(min-width:1200px){\n    [id=\"af-exigence-carousel\"]{overflow-x:auto!important;overflow-y:hidden!important;overscroll-behavior:auto!important;touch-action:auto!important}}[data-framer-name=\"Carrousel CMS\"]{container-type:inline-size;scroll-snap-type:x mandatory}[data-framer-name=\"Carrousel CMS\"]>*{width:88%!important;flex-shrink:0!important;scroll-snap-align:start}@container (min-width:600px){[data-framer-name=\"Carrousel CMS\"]>*{width:calc((100% - 16px)/2)!important}}@container (min-width:1000px){[data-framer-name=\"Carrousel CMS\"]>*{width:calc((100% - 32px)/3)!important}}.af-carousel-controls button{width:44px;height:44px;display:grid;place-items:center;background:transparent;border:1px solid #d9d8d3;border-radius:2px;color:#262626;cursor:pointer;transition:background .28s cubic-bezier(.22,1,.36,1),border-color .28s,color .28s}.af-carousel-controls button:hover:not(:disabled){background:#f7f6f2;border-color:#f77100}.af-carousel-controls button:active:not(:disabled){background:#262626;color:#f7f6f2;border-color:#262626}.af-carousel-controls button:disabled{opacity:.3;cursor:default}.af-carousel-controls button:focus-visible{outline:2px solid #f77100;outline-offset:3px}@media(prefers-reduced-motion:reduce){.af-carousel-controls button{transition:none}}`}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize:12,lineHeight:1.5,fontVariantNumeric:\"tabular-nums\",letterSpacing:\".04em\"},children:edges.total>0?`${edges.index} / ${edges.total}`:\"\"}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:8},children:[-1,1].map(direction=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":`${label} : ${direction<0?\"pr\\xe9c\\xe9dent\":\"suivant\"}`,disabled:direction<0?edges.start:edges.end,onClick:()=>move(direction),children:/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"1.5\",\"aria-hidden\":\"true\",style:{transform:direction<0?\"rotate(180deg)\":undefined},children:/*#__PURE__*/_jsx(\"path\",{d:\"M4 12h15m-6-6 6 6-6 6\"})})},direction))})]});}addPropertyControls(AFCarouselControls,{target:{type:ControlType.String,title:\"Identifiant du carrousel\",defaultValue:\"af-ouvertures\"},label:{type:ControlType.String,title:\"Nom\",defaultValue:\"Ouvertures\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AFCarouselControls\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AFCarouselControls.map"],"mappings":"mMAGG,SAAwB,EAAmB,CAAC,SAAO,gBAAgB,QAAM,aAAa,SAAO,CAAC,IAAM,EAAKA,EAAa,IAAI,EAAQ,EAAMA,EAAa,IAAI,EAAO,CAAC,EAAM,GAAUC,EAAe,CAAC,MAAM,GAAK,IAAI,GAAM,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAoB,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,IAAI,EAAM,EAAK,SAAS,cAAkB,EAAK,KAAK,KAAM,GAAO,CAAC,GAAM,EAAK,EAAM,cAAc,QAAQ,EAAO,uCAAuC,EAAE,EAAM,EAAM,cAAe,GAAG,CAAC,EAAK,OAAO,IAAM,EAAG,EAAK,EAAM,QAAQ,EAAG,IAAM,MAAW,CAAC,IAAM,EAAM,MAAM,KAAK,EAAG,QAAQ,CAAC,CAAC,OAAO,GAAG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