| 1 |
(()=>{"use strict";const t={x:0,y:0,opacity:1,scale:1,rotate:0,transition:{type:"spring",stiffness:300,damping:35,mass:2,delay:0}},{GHOSTKIT:{events:e,instance:n},Motion:{animate:s,spring:a,inView:i}}=window,r=window.matchMedia("(prefers-reduced-motion: reduce)").matches;e.on(document,"init.blocks.gkt",(()=>{document.querySelectorAll("[data-gkt-effects]").forEach((function(o){if(r)return void o.removeAttribute("data-gkt-effects");const c=o.getAttribute("data-gkt-effects");let g;try{g=JSON.parse(c)}catch(t){g=!1}if(o.removeAttribute("data-gkt-effects"),!g)return;if(e.trigger(o,"prepare.effects.gkt",{data:g}),n.set(o,"effects",g),!g?.reveal)return;const l={...t,...g.reveal};e.trigger(o,"prepare.effects.reveal.gkt",{config:l});const f=i(o,(()=>{o.classList.remove("ghostkit-effects-reveal");const t={};"easing"===l?.transition?.type?(t.duration=l.transition.duration,t.delay=l.transition.delay,t.easing=l.transition.easing):"spring"===l?.transition?.type&&(t.delay=l.transition.delay,t.easing=a({stiffness:l.transition.stiffness,damping:l.transition.damping,mass:l.transition.mass}),1!==l.scale&&(t.scale={easing:a({stiffness:l.transition.stiffness,damping:l.transition.damping,mass:l.transition.mass,restSpeed:.01,restDistance:.001})}),0!==l.rotate&&(t.rotate={easing:a({stiffness:l.transition.stiffness,damping:l.transition.damping,mass:l.transition.mass,restSpeed:1,restDistance:.1})}));const n={};1!==l.opacity&&(n.opacity=[l.opacity,1]),0!==l.x&&(n.x=[l.x,0]),0!==l.y&&(n.y=[l.y,0]),1!==l.scale&&(n.scale=[l.scale,1]),0!==l.rotate&&(n.rotate=[l.rotate,0]);const i={config:l,keyframes:n,options:t,stopInView:f,leaveCallback:()=>{}};return e.trigger(o,"show.effects.reveal.gkt",i),i.stopInView(),s(o,n,t).finished.then((()=>{e.trigger(o,"showed.effects.reveal.gkt",i)})),i.leaveCallback}));e.trigger(o,"prepared.effects.reveal.gkt",{config:l})}))})),e.on(document,"init.blocks.gkt",(()=>{document.querySelectorAll(".ghostkit-count-up:not(.ghostkit-count-up-ready)").forEach((t=>{if(t.classList.add("ghostkit-count-up-ready"),r)return;const n=t.classList.contains("ghostkit-progress-bar"),a=parseFloat(t.getAttribute("data-count-from"))||0,o=parseFloat(n?t.getAttribute("aria-valuenow"):t.textContent)||0;let c,g,l=0,f="";n||(f=t.textContent.replace(o,"${val}")),/\${val}/.test(f)||(f="${val}"),n?(c=t.closest(".ghostkit-progress").querySelector(".ghostkit-progress-bar-count"),c&&(g=c.querySelector(":scope > div > span:nth-child(2)"),c.style.width="0%",g.textContent="0"),t.style.width="0%"):(t.textContent=f.replace("${val}",a),l=Math.max((`${a}`.split(".")?.[1]||"").length,(`${o}`.split(".")?.[1]||"").length));const d={from:a,to:o,duration:.8,easing:[.6,0,.3,1],cb(e){const s=(o-a)*e+a;n?g&&(g.textContent=Math.ceil(s)):t.textContent=f.replace("${val}",function(t,e=1){const n=10**e;return Math.round(t*n)/n}(s,l))}};e.trigger(t,"prepare.counter.gkt",{config:d});const p=i(t,(()=>{p(),e.trigger(t,"count.counter.gkt",{config:d}),n&&[t,c].forEach((t=>{t&&s(t,{width:`${o}%`},{duration:d.duration,easing:d.easing})})),s((t=>{d.cb(t)}),{duration:d.duration,easing:d.easing}).finished.then((()=>{e.trigger(t,"counted.counter.gkt",{config:d})}))}),{margin:"-50px"})}))}))})(); |