PageSourceSearch

https://www.todamateria.com.br/layout/assets/dist/js/testimonials-carousel.447ifHi6.js

js todamateria.com.br collected 2026-09-24 17:42:33 UTC 3,881 bytes, 2 lines download raw bytes

1import{g as K}from"./analytics.Yss8y0c9.js";const q=A=>{K({event:"testimonials_carousel_rebrand_interaction",event_value:A})},V=()=>{const A=".testimonials-carousel",O=".testimonials-carousel .carousel",x=".testimonial-card-rebrand",$=".testimonials-carousel .control-button",j=".testimonials-carousel .bullet-control",k="bullet-control-",z="bullet-control--active",D="dragging",w=document.querySelectorAll(A);if(!w.length)return;w.forEach(n=>{const m=n.querySelector(O);m&&H(m,n)});function H(n,m){const N=m.querySelectorAll($),G=m.querySelectorAll(j),S=Array.from(n.querySelectorAll(x)),d=S.length,E=d;let C=!1,f,M,u,l=0,i=0,a=0,W=0,g=!1,b=!1,y=!1;function X(){const t=n.querySelector(x);return t?t.offsetWidth:0}function P(){const t=n.querySelectorAll(x);if(t.length<2)return 0;const e=t[0].getBoundingClientRect(),r=t[1].getBoundingClientRect();return Math.abs(r.left-e.right)}function T(){return X()+P()}function F(t){let e=(t-E)%d;return e<0&&(e+=d),e}const h=(t,e=!0)=>{const r=T(),c=(window.innerWidth-X())/2,v=c-t*r,p=a!==t;if(e?n.style.transition="transform 0.3s ease-in-out":n.style.transition="none",n.style.transform="translateX(".concat(v,"px)"),W=i=v,a=t,p){const s=E,I=E+d-1;(t<s||t>I)&&setTimeout(()=>{n.style.transition="none";let L;t<s?L=t+d:L=t-d;const _=c-L*r;n.style.transform="translateX(".concat(_,"px)"),W=i=_,a=L,n.offsetHeight,setTimeout(()=>{n.style.transition="transform 0.3s ease-in-out"},20)},310),n.dispatchEvent(new CustomEvent("carouselindexchange"))}},Y=t=>{if(b=!1,y=!1,t instanceof MouseEvent){C=!0,n.classList.add(D),f=t.pageX,M=t.pageY,u=f;return}"touches"in t&&(g=!0,f=t.touches[0].pageX,M=t.touches[0].pageY,u=f)},B=t=>{let e=0,r=0;if("touches"in t&&(e=t.touches[0].pageX,r=t.touches[0].pageY),t instanceof MouseEvent&&(e=t.pageX,r=t.pageY),g&&!b){const v=Math.abs(e-f),p=Math.abs(r-M);if(v>10||p>10)if(b=!0,y=v>p*.75,y)C=!0,n.classList.add(D);else return;else return}if(!C)return;t.preventDefault();const o=Math.abs(e-u);if(o===0){l=0;return}const c=e-u<0;l=c?-1:1,i=c?i-o:i+o,n.style.transition="none",n.style.transform="translateX(".concat(i,"px)"),u=e},R=t=>{if(t instanceof MouseEvent&&g&&(g=!1),("touches"in t||g)&&(g=!1,b=!1,y=!1),!C)return;if(C=!1,n.classList.remove(D),l===0){W!==i&&h(a);return}const e=l<0,r=l>0,o=Math.abs(f-u),c=T(),p=(window.innerWidth-X())/2;let s=Math.round((p-i)/c);const I=n.querySelectorAll(x).length;s=Math.max(0,Math.min(s,I-1)),a===s&&l!==0&&o>50&&(r&&(s=Math.max(0,s-1)),e&&(s=Math.min(I-1,s+1)),s!==a&&q("scroll")),h(s),l=0};S.forEach((t,e)=>{t.setAttribute("data-original-index",e.toString())});for(let t=S.length-1;t>=0;t--){const e=S[t].cloneNode(!0);e.setAttribute("data-clone","true"),e.setAttribute("data-original-index",t.toString()),n.insertBefore(e,n.firstChild)}S.forEach((t,e)=>{const r=t.cloneNode(!0);r.setAttribute("data-clone","true"),r.setAttribute("data-original-index",e.toString()),n.appendChild(r)}),n.querySelectorAll("img").forEach(t=>{if(t.removeAttribute("loading"),t.setAttribute("loading","eager"),t.dataset.src&&(t.src=t.dataset.src),!t.complete){const e=t.src;t.src="",t.src=e}});const J=E+1;h(J,!1),N.forEach(t=>{t.addEventListener("click",e=>{e.preventDefault();const r=t.id==="left"?-1:1,o=a+r;h(o),q("arrow")}),t.classList.remove("hidden")}),G.forEach(t=>{const e=parseInt(t.id.replace(k,""),10);t.addEventListener("click",r=>{r.preventDefault();const o=E+e;h(o),q("bullet")}),n.addEventListener("carouselindexchange",()=>{const r=F(a);t.classList.toggle(z,r===e)})}),n.addEventListener("mousedown",Y),n.addEventListener("touchstart",Y),n.addEventListener("mousemove",B),n.addEventListener("touchmove",B),document.addEventListener("mouseup",R),document.addEventListener("touchend",R),window.addEventListener("resize",()=>h(a,!1)),n.dispatchEvent(new CustomEvent("carouselindexchange"))}};export{V as default};
2//# sourceMappingURL=testimonials-carousel.447ifHi6.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.