import{t as e}from"./rolldown-runtime.Dh6celcD.mjs";import{A as t,C as n,E as r,F as i,L as ee,N as te,P as a,T as o,j as s,l as c,s as l,u}from"./react.DOKkFWbx.mjs";import{L as ne,P as re,S as ie,W as ae,h as oe,r as d,t as f,z as se}from"./motion.uQdjgbkC.mjs";import{A as p,C as m,X as h,o as g}from"./framer.BjElOtzr.mjs";import{n as ce,t as _}from"./index.es.CjHn7mRk.mjs";function v(e){let{slots:o=[],gap:l,padding:f,paddingPerSide:p,paddingTop:h,paddingRight:g,paddingBottom:_,paddingLeft:v,speed:T,hoverFactor:E,direction:D,alignment:fe,sizingOptions:pe,fadeOptions:me,style:he}=e,{fadeContent:O,overflow:ge,fadeWidth:k,fadeInset:A,fadeAlpha:j}=me,{widthType:M,heightType:N}=pe,_e=p?`${h}px ${g}px ${_}px ${v}px`:`${f}px`,P=m.current(),F=P===m.canvas||P===m.export,I=o.filter(Boolean),L=r.count(I),R=L>0;D===!0&&(D=`left`);let z=D===`left`||D===`right`,ve=ne(0),B=le[D];ae(ve,B);let V=t(null),H=te(()=>[{current:null},{current:null}],[]),[U,ye]=ee({parent:null,children:null}),W=null,G=[],K=0,q=0;F&&(K=L?Math.floor(10/L):0,q=1),!F&&R&&U.parent&&(K=Math.round(U.parent/U.children*2)+1,K=Math.min(K,y),q=1);let J=a(()=>{if(R&&V.current){let e=z?V.current.offsetWidth:V.current.offsetHeight,t=H[0].current?z?H[0].current.offsetLeft:H[0].current.offsetTop:0,n=(H[1].current?z?H[1].current.offsetLeft+H[1].current.offsetWidth:H[1].current.offsetTop+H[1].current.offsetHeight:0)-t+l;ye({parent:e,children:n})}},[]),Y=F?{contentVisibility:`auto`}:{};if(R){if(!F){let e=t(!0);n(()=>(oe.read(J,!1,!0),ce(V.current,({contentSize:t})=>{!e.current&&(t.width||t.height)&&oe.read(J,!1,!0),e.current=!1})),[])}W=r.map(I,(e,t)=>{let n;t===0&&(n=H[0]),t===I.length-1&&(n=H[1]);let r={width:M?e.props?.width:`100%`,height:N?e.props?.height:`100%`};return c(d,{inherit:`id`,children:c(`li`,{ref:n,style:r,children:s(e,{style:{...e.props?.style,...r,flexShrink:0,...Y},layoutId:e.props.layoutId?e.props.layoutId+`-original-`+t:void 0},e.props?.children)})})})}let X=F?!0:re(V);if(!F)for(let e=0;e<K;e++)G=G.concat(r.map(I,(t,n)=>c(d,{inherit:`id`,children:c(`li`,{style:{width:M?t.props?.width:`100%`,height:N?t.props?.height:`100%`,willChange:X?`transform`:void 0},"aria-hidden":!0,children:s(t,{key:e+` `+n,style:{...t.props?.style,width:M?t.props?.width:`100%`,height:N?t.props?.height:`100%`,flexShrink:0,...Y},layoutId:t.props.layoutId?t.props.layoutId+`-dupe-`+e:void 0},t.props?.children)},e+`li`+n)},e+`lg`+n)));let Z=U.children+U.children*Math.round(U.parent/U.children);t(null),t(null),t(0);let be=t(!1),xe=se(),Se=t(null),Q=t(null);if(!F){i(()=>{if(!(xe||!Z||!T))return Q.current=Se.current.animate({transform:[B(0),B(Z)]},{duration:Math.abs(Z)/T*1e3,iterations:1/0,easing:`linear`}),()=>Q.current.cancel()},[E,Z,T]);let e=a(()=>{if(!Q.current)return;let e=document.hidden;X&&!e&&Q.current.playState===`paused`?Q.current.play():(!X||e)&&Q.current.playState===`running`&&Q.current.pause()},[X]);i(()=>{e()},[X,E,Z,T]),i(()=>(document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}),[e])}let Ce=z?`to right`:`to bottom`,$=k/2,we=100-k/2,Te=`linear-gradient(${Ce}, rgba(0, 0, 0, ${j}) ${C(A,0,$)}%, rgba(0, 0, 0, 1) ${$}%, rgba(0, 0, 0, 1) ${we}%, rgba(0, 0, 0, ${j}) ${100-A}%)`;return R?c(`section`,{style:{...b,opacity:q,WebkitMaskImage:O?Te:void 0,maskImage:O?Te:void 0,overflow:ge?`visible`:`hidden`,padding:_e},ref:V,children:u(ie.ul,{ref:Se,style:{...b,gap:l,top:D===`bottom`&&w(Z)?-Z:void 0,left:D===`right`&&w(Z)?-Z:void 0,placeItems:fe,position:`relative`,flexDirection:z?`row`:`column`,...he,willChange:F||!X?`auto`:`transform`,transform:B(0)},onMouseEnter:()=>{be.current=!0,Q.current&&(Q.current.playbackRate=E)},onMouseLeave:()=>{be.current=!1,Q.current&&(Q.current.playbackRate=1)},children:[W,G]})}):u(`section`,{style:ue,children:[c(`div`,{style:de,children:`✨`}),c(`p`,{style:x,children:`Connect to Content`}),c(`p`,{style:S,children:`Add layers or components to infinitely loop on your page.`})]})}var y,le,b,ue,de,x,S,C,w,T=e((()=>{l(),o(),h(),f(),_(),y=100,le={left:e=>`translateX(-${e}px)`,right:e=>`translateX(${e}px)`,top:e=>`translateY(-${e}px)`,bottom:e=>`translateY(${e}px)`},v.defaultProps={gap:10,padding:10,sizingOptions:{widthType:!0,heightType:!0},fadeOptions:{fadeContent:!0,overflow:!1,fadeWidth:25,fadeAlpha:0,fadeInset:0},direction:!0},p(v,{slots:{type:g.Array,title:`Children`,control:{type:g.ComponentInstance}},speed:{type:g.Number,title:`Speed`,min:0,max:1e3,defaultValue:100,unit:`%`,displayStepper:!0,step:5},direction:{type:g.Enum,title:`Direction`,options:[`left`,`right`,`top`,`bottom`],optionIcons:[`direction-left`,`direction-right`,`direction-up`,`direction-down`],optionTitles:[`Left`,`Right`,`Top`,`Bottom`],defaultValue:`left`,displaySegmentedControl:!0},alignment:{type:g.Enum,title:`Align`,options:[`flex-start`,`center`,`flex-end`],optionIcons:{direction:{right:[`align-top`,`align-middle`,`align-bottom`],left:[`align-top`,`align-middle`,`align-bottom`],top:[`align-left`,`align-center`,`align-right`],bottom:[`align-left`,`align-center`,`align-right`]}},defaultValue:`center`,displaySegmentedControl:!0},gap:{type:g.Number,title:`Gap`},padding:{title:`Padding`,type:g.FusedNumber,toggleKey:`paddingPerSide`,toggleTitles:[`Padding`,`Padding per side`],valueKeys:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],valueLabels:[`T`,`R`,`B`,`L`],min:0},sizingOptions:{type:g.Object,title:`Sizing`,controls:{widthType:{type:g.Boolean,title:`Width`,enabledTitle:`Auto`,disabledTitle:`Stretch`,defaultValue:!0},heightType:{type:g.Boolean,title:`Height`,enabledTitle:`Auto`,disabledTitle:`Stretch`,defaultValue:!0}}},fadeOptions:{type:g.Object,title:`Clipping`,controls:{fadeContent:{type:g.Boolean,title:`Fade`,defaultValue:!0},overflow:{type:g.Boolean,title:`Overflow`,enabledTitle:`Show`,disabledTitle:`Hide`,defaultValue:!1,hidden(e){return e.fadeContent===!0}},fadeWidth:{type:g.Number,title:`Width`,defaultValue:25,min:0,max:100,unit:`%`,hidden(e){return e.fadeContent===!1}},fadeInset:{type:g.Number,title:`Inset`,defaultValue:0,min:0,max:100,unit:`%`,hidden(e){return e.fadeContent===!1}},fadeAlpha:{type:g.Number,title:`Opacity`,defaultValue:0,min:0,max:1,step:.05,hidden(e){return e.fadeContent===!1}}}},hoverFactor:{type:g.Number,title:`Hover`,min:0,max:1,unit:`x`,defaultValue:1,step:.1,displayStepper:!0,description:`Slows down the speed while you are hovering.`}}),b={display:`flex`,width:`100%`,height:`100%`,maxWidth:`100%`,maxHeight:`100%`,placeItems:`center`,margin:0,padding:0,listStyleType:`none`,textIndent:`none`},ue={display:`flex`,width:`100%`,height:`100%`,placeContent:`center`,placeItems:`center`,flexDirection:`column`,color:`#96F`,background:`rgba(136, 85, 255, 0.1)`,fontSize:11,overflow:`hidden`,padding:`20px 20px 30px 20px`},de={fontSize:32,marginBottom:10},x={margin:0,marginBottom:10,fontWeight:600,textAlign:`center`},S={margin:0,opacity:.7,maxWidth:150,lineHeight:1.5,textAlign:`center`},C=(e,t,n)=>Math.min(Math.max(e,t),n),w=e=>typeof e==`number`&&!isNaN(e)}));export{T as n,v as t};
//# sourceMappingURL=Ticker.Dg3FVBr3.mjs.map
