import{r as o,T as Y,U as K,F as N,j as c,z as d}from"./vendor-CT-JknSv.chunk.js";import{f as O,a6 as U,L as q,ay as H,bx as J,bW as Q,bX as tt,V as et,bY as D,by as rt,bZ as ot,ac as nt,ab as st,j as G,a7 as it}from"./index-DDZqnj79.js";const $=e=>o.createElement("svg",{width:32,height:32,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e},o.createElement("path",{d:"m15 6-6 6 6 6"})),at=(()=>{const p=["15.1","15.2","15.3"].some(m=>navigator==null?void 0:navigator.userAgent.includes(`Version/${m}`));return(navigator==null?void 0:navigator.userAgent.includes("Safari"))&&p})(),lt=navigator==null?void 0:navigator.userAgent.includes("Firefox"),ct=()=>{var e;return Math.min(H,(e=window==null?void 0:window.innerWidth)!=null?e:1/0)},u={layoutWithArrows:"data-layout-with-arrows",showingAllItems:"data-showing-all-items",isArrowActive:"data-is-arrow-active"},w=J(u),E={conveyorGap:"--conveyor-gap",childWidth:"--child-width"},k={position:"absolute",top:0,background:"transparent",width:30,height:60,transition:"opacity ease-in-out 0.6s, transform ease-in-out 0.6s",color:G.silverDusty,[D]:{color:G.neutral0_70},display:"none",opacity:0,pointerEvents:"none",cursor:"auto",flexFlow:"row",alignItems:"center",marginTop:40,[w.layoutWithArrows]:{display:"flex",[w.isArrowActive]:{opacity:.5,pointerEvents:"all",cursor:"pointer"}}},F="--conveyor-horizontal-offset",S=`var(${F})`,v={wrapper:d({width:"100%",paddingTop:20,marginTop:-40,position:"relative",[F]:et,[D]:{filter:"drop-shadow(0 24px 48px rgba(0, 0, 0, 0.50))",willChange:"filter",transform:"translateZ(0)"}}),prevArrow:d([k,{transform:"translateX(0px)",left:0,[w.isArrowActive]:{transform:"translateX(-30px)"}}]),nextArrow:d([k,{right:0,transform:"translateX(0px)",[w.isArrowActive]:{transform:"translateX(30px)"}}]),conveyorContainer:d({width:`calc(100% + 2 * ${S})`,margin:`0 calc(-1 * ${S})`,[w.layoutWithArrows]:{width:"100%",margin:"0"},overflow:"hidden"}),conveyorMask:d({overflowX:"hidden",width:"100%",margin:"0 auto"}),conveyorScroll:d([{display:"flex",gridTemplateRows:"auto",overflow:"scroll",width:"100%",paddingTop:"20px",scrollSnapType:at?"none":"x mandatory",transition:"transform ease-in-out 0.6s","& > *":{scrollSnapAlign:"start",boxSizing:"content-box",marginRight:`var(${E.conveyorGap})`,width:`var(${E.childWidth})`,flexGrow:0,flexShrink:0,pointerEvents:"none","*":{pointerEvents:"auto"}},"& > *:last-of-type":{marginRight:0},paddingLeft:S,paddingRight:S,scrollPadding:S,[w.layoutWithArrows]:{paddingLeft:0,paddingRight:0,scrollPadding:0}},rt])};function vt({children:e,heightToWidthRatio:p=U,className:m,size:T="medium",arrowsLayoutBreakpoint:a=q+1}){const g=o.useRef(null),n=o.useRef(null),[t,l]=o.useState(null),{matches:s}=O(`not screen and ${ot}, (min-width: ${a}px)`),{matches:x}=O(`${nt},${st}`),i=x?Q:tt,[W,R]=o.useState(ct);ht(()=>{g.current&&R(g.current.getBoundingClientRect().width)},[]);const C=dt({size:T,isLayoutWithArrows:s,conveyorWidth:W,heightToWidthRatio:p}),X=(Math.floor(C)-1)*i,I=(W-X)/C,_=I*p,L=W,y=o.useCallback(()=>{if(!n.current)return;const{scrollLeft:r,offsetWidth:f,scrollWidth:h}=n.current,b=r===0,A=r+f>=h-5;l(b&&A?null:b?"start":A?"end":"middle")},[]);o.useEffect(()=>{y()},[y,o.Children.count(e),W]);const M=lt&&(t==="middle"||t==="end"),P=o.useCallback(r=>{R(f=>{var h;return M&&r!==f&&((h=n.current)==null||h.scroll()),r})},[M]);o.useEffect(()=>{const r=g.current;if(!r)return;const f=Y(P,50),h=new ResizeObserver(b=>{const A=K(b);if(A){const z=A.contentRect.width;f(z)}});return h.observe(r),()=>{f.cancel(),h.disconnect()}},[P]);const B=()=>{if(!n.current)return;const{scrollLeft:r}=n.current;n.current.scrollTo({left:r-L,behavior:"smooth"}),y()},j=()=>{if(!n.current)return;const{scrollLeft:r}=n.current;n.current.scrollTo({left:r+L,behavior:"smooth"}),y()},Z=()=>{s&&y()};return N("div",{css:v.wrapper,className:m,ref:g,style:{[E.conveyorGap]:`${i}px`,[E.childWidth]:`${I}px`},children:[c("div",{"aria-hidden":"true",onClick:B,css:v.prevArrow,style:{height:_},[u.layoutWithArrows]:s,[u.isArrowActive]:!!t&&t!=="start",children:c($,{})}),c("div",{"aria-hidden":"true",onClick:j,css:v.nextArrow,style:{height:_},[u.layoutWithArrows]:s,[u.isArrowActive]:!!t&&t!=="end",children:c($,{style:{transform:"rotate(180deg)"}})}),c("div",{css:v.conveyorContainer,[u.layoutWithArrows]:s,children:c("div",{css:v.conveyorMask,children:c("div",{ref:n,onScroll:Z,role:"list",css:v.conveyorScroll,[u.layoutWithArrows]:s,children:e})})})]})}function dt({size:e,heightToWidthRatio:p,conveyorWidth:m,isLayoutWithArrows:T,zoom:a=0}){let t;const l=p<1;e==="small"?t=l?5:6:e==="large"?t=l?3:4:t=l?4:5;const s=1024/m,x=(t+a+72)*s/((t+a)*s+72);let i;return T?i=Math.min(t+a,Math.floor((t+a)/x)):(i=Math.min(t+a,Math.floor((t+a)/x*3)/3),i>4&&(i=Math.floor(i))),Math.max(1,i)}const ht=typeof window<"u"?o.useLayoutEffect:()=>{};function wt({children:e}){return N("div",{css:V.shimmerDivWrapper,children:[c(it,{css:V.shimmer}),e]})}const V={shimmer:d({height:18,width:160,borderRadius:4,marginBottom:"14px"}),shimmerDivWrapper:d({margin:"0 auto 40px auto",maxWidth:`${H}px`})};export{vt as C,wt as L};