diff --git a/assets/index-88e23c2d.js b/assets/index-8992abf3.js similarity index 79% rename from assets/index-88e23c2d.js rename to assets/index-8992abf3.js index 276791e..3d624e4 100644 --- a/assets/index-88e23c2d.js +++ b/assets/index-8992abf3.js @@ -1,7 +1,7 @@ -import{A as R,a as oe,i as A}from"./sprite-578f308f.js";document.addEventListener("DOMContentLoaded",function(){const o=document.getElementById("homeButton"),l=document.getElementById("favoritesButton");o.addEventListener("click",()=>{console.log("Home button clicked"),o.classList.add("active"),l.classList.remove("active")}),l.addEventListener("click",()=>{console.log("Favorites button clicked"),l.classList.add("active"),o.classList.remove("active")})});const ae=document.querySelector(".js-open-menu"),re=document.querySelector(".js-close-menu"),U=document.querySelector("#mobile-menu"),F=document.querySelector("[data-menu-backdrop]"),le=document.querySelectorAll(".menu__nav-link");function ce(){U.classList.add("is-open"),F.classList.remove("is-hidden"),document.body.classList.add("no-scroll")}function G(){U.classList.remove("is-open"),F.classList.add("is-hidden"),document.body.classList.remove("no-scroll")}ae.addEventListener("click",()=>{ce()});re.addEventListener("click",()=>{G()});F.addEventListener("click",()=>{G()});le.forEach(o=>{o.addEventListener("click",()=>{const l=o.getAttribute("href").substring(1),u=document.getElementById(l);u&&(u.scrollIntoView({behavior:"smooth"}),G())})});document.addEventListener("DOMContentLoaded",()=>{const o=window.location.pathname;if(o.includes("index.html")){const l=document.getElementById("homeButton");l.classList.add("active"),l.addEventListener("click",X)}else if(o.includes("favorites.html")){const l=document.getElementById("favoritesButton");l.classList.add("active"),l.addEventListener("click",X)}});const X=o=>{o.currentTarget.classList.contains("active")?o.preventDefault():alert("Button clicked!")},de=document.querySelector(".js-quote"),ue=new R;fe();async function fe(){try{const o=await ue.getQuote();me(o)}catch(o){console.log(o)}}function me({author:o,quote:l}){de.innerHTML=` +import{A as q,i as M,a as ae}from"./sprite-578f308f.js";document.addEventListener("DOMContentLoaded",function(){const o=document.getElementById("homeButton"),l=document.getElementById("favoritesButton");o.addEventListener("click",()=>{console.log("Home button clicked"),o.classList.add("active"),l.classList.remove("active")}),l.addEventListener("click",()=>{console.log("Favorites button clicked"),l.classList.add("active"),o.classList.remove("active")})});const re=document.querySelector(".js-open-menu"),le=document.querySelector(".js-close-menu"),Q=document.querySelector("#mobile-menu"),F=document.querySelector("[data-menu-backdrop]"),ce=document.querySelectorAll(".menu__nav-link");function de(){Q.classList.add("is-open"),F.classList.remove("is-hidden"),document.body.classList.add("no-scroll")}function G(){Q.classList.remove("is-open"),F.classList.add("is-hidden"),document.body.classList.remove("no-scroll")}re.addEventListener("click",()=>{de()});le.addEventListener("click",()=>{G()});F.addEventListener("click",()=>{G()});ce.forEach(o=>{o.addEventListener("click",()=>{const l=o.getAttribute("href").substring(1),u=document.getElementById(l);u&&(u.scrollIntoView({behavior:"smooth"}),G())})});document.addEventListener("DOMContentLoaded",()=>{const o=window.location.pathname;if(o.includes("index.html")){const l=document.getElementById("homeButton");l.classList.add("active"),l.addEventListener("click",X)}else if(o.includes("favorites.html")){const l=document.getElementById("favoritesButton");l.classList.add("active"),l.addEventListener("click",X)}});const X=o=>{o.currentTarget.classList.contains("active")?o.preventDefault():alert("Button clicked!")},ue=document.querySelector(".js-quote"),fe=new q;me();async function me(){try{const o=await fe.getQuote();pe(o)}catch(o){console.log(o)}}function pe({author:o,quote:l}){ue.innerHTML=`

${l}

${o}

- `}const pe=new R,Q=document.querySelector(".js-list");Y("Muscles");async function Y(o){try{const l=await pe.getFilter(o);ge(l)}catch(l){console.log(l)}}function ge(o){const l=o.map(({filter:u,name:f,imgURL:i})=>` + `}const ge=new q,Y=document.querySelector(".js-list");K("Muscles");async function K(o){try{const l=await ge.getFilter(o);ve(l)}catch(l){console.log(l)}}function ve(o){const l=o.map(({filter:u,name:f,imgURL:i})=>`
  • @@ -9,16 +9,16 @@ import{A as R,a as oe,i as A}from"./sprite-578f308f.js";document.addEventListene

    ${f}

  • - `).join("");Q.insertAdjacentHTML("beforeend",l)}document.querySelectorAll(".btnFilters").forEach(o=>{o.addEventListener("click",()=>{const l=o.innerText;Q.innerHTML="",Y(l)})});const ve=new R,q=document.querySelector(".modal-exercises"),k=document.querySelector(".overlay"),he=document.querySelector(".js-list");he.addEventListener("click",ye);async function ye(o){if(o.target.closest(".card__btn"))try{const l=o.target.closest(".card__btn").getAttribute("data-id"),u=await ve.getExercisesById(l),f=we(u);Le(f),be(),document.querySelector(".modal-exercises__btn-close").addEventListener("click",V)}catch(l){console.log(l)}}function be(){const o=window.innerWidth-document.body.offsetWidth+"px";q.classList.remove("hidden"),k.classList.remove("hidden"),document.body.style.paddingRight=o,document.body.style.overflow="hidden"}function Le(o){q.innerHTML=o}function Ee(o){const l="#EEA10C",u="#F4F4F4";let i="";for(let h=0;h<5;h++){const b=`starGradient${h}`,C=h+1<=o?100:h{o.addEventListener("click",()=>{const l=o.innerText;Y.innerHTML="",K(l)})});const P="/your-energy/assets/modal-exercise-image-3ecfcf3d.jpg",he="/your-energy/assets/modal-exercise-image@2x-88eeae48.jpg",ye=new q,A=document.querySelector(".modal-exercises"),z=document.querySelector(".overlay"),be=document.querySelector(".js-list");be.addEventListener("click",Le);async function Le(o){if(o.target.closest(".card__btn"))try{const l=o.target.closest(".card__btn").getAttribute("data-id"),u=await ye.getExercisesById(l),f=Ce(u);we(f),Ee(),document.querySelector(".modal-exercises__btn-close").addEventListener("click",V)}catch(l){console.log(l)}}function Ee(){const o=window.innerWidth-document.body.offsetWidth+"px";A.classList.remove("hidden"),z.classList.remove("hidden"),document.body.style.paddingRight=o,document.body.style.overflow="hidden"}function we(o){A.innerHTML=o}function xe(o){const l="#EEA10C",u="#F4F4F4";let i="";for(let h=0;h<5;h++){const b=`starGradient${h}`,C=h+1<=o?100:h ${S.map(L=>``).join("")} - `,x=`url(#${b})`;i+=`${w}`}return`${Number.isInteger(o)?`${o}.0`:o.toFixed(1)} ${i}`}function we({_id:o,bodyPart:l,equipment:u,gifUrl:f,name:i,target:g,description:v,rating:h,burnedCalories:b,time:C,popularity:S}){const w=x(f);function x(I){return I===null||!I?`srcset = './img/modal-exercise-image.jpg 1x,./img/modal-exercise-image@2x.jpg 2x' - src = './img/modal-exercise-image.jpg'`:`src="${I}"`}const L=Ee(h);return` + `,x=`url(#${b})`;i+=`${w}`}return`${Number.isInteger(o)?`${o}.0`:o.toFixed(1)} ${i}`}function Ce({_id:o,bodyPart:l,equipment:u,gifUrl:f,name:i,target:g,description:v,rating:h,burnedCalories:b,time:C,popularity:S}){const w=x(f);function x(I){return I===null||!I?`srcset = '${P} 1x,${he} 2x' + src = '${P}'`:`src="${I}"`}const L=xe(h);return` -`}function V(){q.classList.add("hidden"),k.classList.add("hidden"),document.body.style.paddingRight="0px",document.body.style.overflow="auto"}k.addEventListener("click",function(o){o.target===k&&V()});window.addEventListener("keydown",function(o){o.key==="Escape"&&!q.classList.contains("hidden")&&V()});document.addEventListener("DOMContentLoaded",function(){const o=document.querySelectorAll(".rating-label"),l=document.querySelector(".rating-value"),u=document.querySelector(".rating-form");let f=0;o.forEach(g=>{g.addEventListener("click",()=>{f=g.dataset.rating,i(f)})});function i(g){l.textContent=g;for(let v=0;vl?$.classList.add("scroll__go-top--show"):$.classList.remove("scroll__go-top--show")}function K(){window.pageYOffset>0&&(window.scrollBy(0,-75),setTimeout(K,0))}var B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ce(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Z={exports:{}};(function(o,l){(function(u,f){o.exports=f(u)})(typeof B<"u"?B:window||B.window||B.global,function(u){var f={},i="iziToast";document.querySelector("body");var g=!!/Mobi/.test(navigator.userAgent),v=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),h=typeof InstallTrigger<"u",b="ontouchstart"in document.documentElement,C=["bottomRight","bottomLeft","bottomCenter","topRight","topLeft","topCenter","center"],S={info:{color:"blue",icon:"ico-info"},success:{color:"green",icon:"ico-success"},warning:{color:"orange",icon:"ico-warning"},error:{color:"red",icon:"ico-error"},question:{color:"yellow",icon:"ico-question"}},w=568,x={};f.children={};var L={id:null,class:"",title:"",titleColor:"",titleSize:"",titleLineHeight:"",message:"",messageColor:"",messageSize:"",messageLineHeight:"",backgroundColor:"",theme:"light",color:"",icon:"",iconText:"",iconColor:"",iconUrl:null,image:"",imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,displayMode:0,position:"bottomRight",target:"",targetFirst:!0,timeout:5e3,rtl:!1,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:"",progressBarEasing:"linear",overlay:!1,overlayClose:!1,overlayColor:"rgba(0, 0, 0, 0.6)",transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeInUp",transitionOutMobile:"fadeOutDown",buttons:{},inputs:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if("remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof window.CustomEvent!="function"){var I=function(a,s){s=s||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(a,s.bubbles,s.cancelable,s.detail),e};I.prototype=window.Event.prototype,window.CustomEvent=I}var y=function(a,s,e){if(Object.prototype.toString.call(a)==="[object Object]")for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&s.call(e,a[t],t,a);else if(a)for(var r=0,d=a.length;r0?(r=(n-t)/n,r"u"&&(s.classList.remove(i+"-reseted"),n!==null&&(n.style.transition="width "+d.timeout+"ms "+d.progressBarEasing,n.style.width="0%"),d.time.START=new Date().getTime(),d.time.END=d.time.START+d.timeout,d.time.TIMER=setTimeout(function(){clearTimeout(d.time.TIMER),s.classList.contains(i+"-closing")||(t.hide(d,s,"timeout"),typeof e=="function"&&e.apply(t))},d.timeout),t.setSetting(r,"time",d.time))},pause:function(){if(typeof d.time.START<"u"&&!s.classList.contains(i+"-paused")&&!s.classList.contains(i+"-reseted")){if(s.classList.add(i+"-paused"),d.time.REMAINING=d.time.END-new Date().getTime(),clearTimeout(d.time.TIMER),t.setSetting(r,"time",d.time),n!==null){var c=window.getComputedStyle(n),m=c.getPropertyValue("width");n.style.transition="none",n.style.width=m}typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}},resume:function(){typeof d.time.REMAINING<"u"?(s.classList.remove(i+"-paused"),n!==null&&(n.style.transition="width "+d.time.REMAINING+"ms "+d.progressBarEasing,n.style.width="0%"),d.time.END=new Date().getTime()+d.time.REMAINING,d.time.TIMER=setTimeout(function(){clearTimeout(d.time.TIMER),s.classList.contains(i+"-closing")||(t.hide(d,s,"timeout"),typeof e=="function"&&e.apply(t))},d.time.REMAINING),t.setSetting(r,"time",d.time)):this.start()},reset:function(){clearTimeout(d.time.TIMER),delete d.time.REMAINING,t.setSetting(r,"time",d.time),s.classList.add(i+"-reseted"),s.classList.remove(i+"-paused"),n!==null&&(n.style.transition="none",n.style.width="100%"),typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}}},f.hide=function(a,s,e){typeof s!="object"&&(s=document.querySelector(s));var t=this,r=E(this.children[s.getAttribute("data-iziToast-ref")],a||{});r.closedBy=e||null,delete r.time.REMAINING,s.classList.add(i+"-closing"),function(){var c=document.querySelector("."+i+"-overlay");if(c!==null){var m=c.getAttribute("data-iziToast-ref");m=m.split(",");var p=m.indexOf(String(r.ref));p!==-1&&m.splice(p,1),c.setAttribute("data-iziToast-ref",m.join()),m.length===0&&(c.classList.remove("fadeIn"),c.classList.add("fadeOut"),setTimeout(function(){c.remove()},700))}}(),r.transitionIn&&s.classList.remove(r.transitionIn),r.transitionInMobile&&s.classList.remove(r.transitionInMobile),g||window.innerWidth<=w?r.transitionOutMobile&&s.classList.add(r.transitionOutMobile):r.transitionOut&&s.classList.add(r.transitionOut);var d=s.parentNode.offsetHeight;s.parentNode.style.height=d+"px",s.style.pointerEvents="none",(!g||window.innerWidth>w)&&(s.parentNode.style.transitionDelay="0.2s");try{var n=new CustomEvent(i+"-closing",{detail:r,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}catch(c){console.warn(c)}setTimeout(function(){s.parentNode.style.height="0px",s.parentNode.style.overflow="",setTimeout(function(){delete t.children[r.ref],s.parentNode.remove();try{var c=new CustomEvent(i+"-closed",{detail:r,bubbles:!0,cancelable:!0});document.dispatchEvent(c)}catch(m){console.warn(m)}typeof r.onClosed<"u"&&r.onClosed.apply(null,[r,s,e])},1e3)},200),typeof r.onClosing<"u"&&r.onClosing.apply(null,[r,s,e])},f.show=function(a){var s=this,e=E(x,a||{});if(e=E(L,e),e.time={},e.id===null&&(e.id=te(e.title+e.message+e.color)),e.displayMode===1||e.displayMode=="once")try{if(document.querySelectorAll("."+i+"#"+e.id).length>0)return!1}catch{console.warn("["+i+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}if(e.displayMode===2||e.displayMode=="replace")try{y(document.querySelectorAll("."+i+"#"+e.id),function(n,c){s.hide(e,n,"replaced")})}catch{console.warn("["+i+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}e.ref=new Date().getTime()+Math.floor(Math.random()*1e7+1),f.children[e.ref]=e;var t={body:document.querySelector("body"),overlay:document.createElement("div"),toast:document.createElement("div"),toastBody:document.createElement("div"),toastTexts:document.createElement("div"),toastCapsule:document.createElement("div"),cover:document.createElement("div"),buttons:document.createElement("div"),inputs:document.createElement("div"),icon:e.iconUrl?document.createElement("img"):document.createElement("i"),wrapper:null};t.toast.setAttribute("data-iziToast-ref",e.ref),t.toast.appendChild(t.toastBody),t.toastCapsule.appendChild(t.toast),function(){if(t.toast.classList.add(i),t.toast.classList.add(i+"-opening"),t.toastCapsule.classList.add(i+"-capsule"),t.toastBody.classList.add(i+"-body"),t.toastTexts.classList.add(i+"-texts"),g||window.innerWidth<=w?e.transitionInMobile&&t.toast.classList.add(e.transitionInMobile):e.transitionIn&&t.toast.classList.add(e.transitionIn),e.class){var n=e.class.split(" ");y(n,function(c,m){t.toast.classList.add(c)})}e.id&&(t.toast.id=e.id),e.rtl&&(t.toast.classList.add(i+"-rtl"),t.toast.setAttribute("dir","rtl")),e.layout>1&&t.toast.classList.add(i+"-layout"+e.layout),e.balloon&&t.toast.classList.add(i+"-balloon"),e.maxWidth&&(isNaN(e.maxWidth)?t.toast.style.maxWidth=e.maxWidth:t.toast.style.maxWidth=e.maxWidth+"px"),(e.theme!==""||e.theme!=="light")&&t.toast.classList.add(i+"-theme-"+e.theme),e.color&&(ie(e.color)?t.toast.style.background=e.color:t.toast.classList.add(i+"-color-"+e.color)),e.backgroundColor&&(t.toast.style.background=e.backgroundColor,e.balloon&&(t.toast.style.borderColor=e.backgroundColor))}(),function(){e.image&&(t.cover.classList.add(i+"-cover"),t.cover.style.width=e.imageWidth+"px",se(e.image.replace(/ /g,""))?t.cover.style.backgroundImage="url(data:image/png;base64,"+e.image.replace(/ /g,"")+")":t.cover.style.backgroundImage="url("+e.image+")",e.rtl?t.toastBody.style.marginRight=e.imageWidth+10+"px":t.toastBody.style.marginLeft=e.imageWidth+10+"px",t.toast.appendChild(t.cover))}(),function(){e.close?(t.buttonClose=document.createElement("button"),t.buttonClose.type="button",t.buttonClose.classList.add(i+"-close"),t.buttonClose.addEventListener("click",function(n){n.target,s.hide(e,t.toast,"button")}),t.toast.appendChild(t.buttonClose)):e.rtl?t.toast.style.paddingLeft="18px":t.toast.style.paddingRight="18px"}(),function(){e.progressBar&&(t.progressBar=document.createElement("div"),t.progressBarDiv=document.createElement("div"),t.progressBar.classList.add(i+"-progressbar"),t.progressBarDiv.style.background=e.progressBarColor,t.progressBar.appendChild(t.progressBarDiv),t.toast.appendChild(t.progressBar)),e.timeout&&(e.pauseOnHover&&!e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(n){s.progress(e,t.toast).pause()}),t.toast.addEventListener("mouseleave",function(n){s.progress(e,t.toast).resume()})),e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(n){s.progress(e,t.toast).reset()}),t.toast.addEventListener("mouseleave",function(n){s.progress(e,t.toast).start()})))}(),function(){e.iconUrl?(t.icon.setAttribute("class",i+"-icon"),t.icon.setAttribute("src",e.iconUrl)):e.icon&&(t.icon.setAttribute("class",i+"-icon "+e.icon),e.iconText&&t.icon.appendChild(document.createTextNode(e.iconText)),e.iconColor&&(t.icon.style.color=e.iconColor)),(e.icon||e.iconUrl)&&(e.rtl?t.toastBody.style.paddingRight="33px":t.toastBody.style.paddingLeft="33px",t.toastBody.appendChild(t.icon))}(),function(){e.title.length>0&&(t.strong=document.createElement("strong"),t.strong.classList.add(i+"-title"),t.strong.appendChild(M(e.title)),t.toastTexts.appendChild(t.strong),e.titleColor&&(t.strong.style.color=e.titleColor),e.titleSize&&(isNaN(e.titleSize)?t.strong.style.fontSize=e.titleSize:t.strong.style.fontSize=e.titleSize+"px"),e.titleLineHeight&&(isNaN(e.titleSize)?t.strong.style.lineHeight=e.titleLineHeight:t.strong.style.lineHeight=e.titleLineHeight+"px")),e.message.length>0&&(t.p=document.createElement("p"),t.p.classList.add(i+"-message"),t.p.appendChild(M(e.message)),t.toastTexts.appendChild(t.p),e.messageColor&&(t.p.style.color=e.messageColor),e.messageSize&&(isNaN(e.titleSize)?t.p.style.fontSize=e.messageSize:t.p.style.fontSize=e.messageSize+"px"),e.messageLineHeight&&(isNaN(e.titleSize)?t.p.style.lineHeight=e.messageLineHeight:t.p.style.lineHeight=e.messageLineHeight+"px")),e.title.length>0&&e.message.length>0&&(e.rtl?t.strong.style.marginLeft="10px":e.layout!==2&&!e.rtl&&(t.strong.style.marginRight="10px"))}(),t.toastBody.appendChild(t.toastTexts);var r;(function(){e.inputs.length>0&&(t.inputs.classList.add(i+"-inputs"),y(e.inputs,function(n,c){t.inputs.appendChild(M(n[0])),r=t.inputs.childNodes,r[c].classList.add(i+"-inputs-child"),n[3]&&setTimeout(function(){r[c].focus()},300),r[c].addEventListener(n[1],function(m){var p=n[2];return p(s,t.toast,this,m)})}),t.toastBody.appendChild(t.inputs))})(),function(){e.buttons.length>0&&(t.buttons.classList.add(i+"-buttons"),y(e.buttons,function(n,c){t.buttons.appendChild(M(n[0]));var m=t.buttons.childNodes;m[c].classList.add(i+"-buttons-child"),n[2]&&setTimeout(function(){m[c].focus()},300),m[c].addEventListener("click",function(p){p.preventDefault();var ne=n[1];return ne(s,t.toast,this,p,r)})})),t.toastBody.appendChild(t.buttons)}(),e.message.length>0&&(e.inputs.length>0||e.buttons.length>0)&&(t.p.style.marginBottom="0"),(e.inputs.length>0||e.buttons.length>0)&&(e.rtl?t.toastTexts.style.marginLeft="10px":t.toastTexts.style.marginRight="10px",e.inputs.length>0&&e.buttons.length>0&&(e.rtl?t.inputs.style.marginLeft="8px":t.inputs.style.marginRight="8px")),function(){t.toastCapsule.style.visibility="hidden",setTimeout(function(){var n=t.toast.offsetHeight,c=t.toast.currentStyle||window.getComputedStyle(t.toast),m=c.marginTop;m=m.split("px"),m=parseInt(m[0]);var p=c.marginBottom;p=p.split("px"),p=parseInt(p[0]),t.toastCapsule.style.visibility="",t.toastCapsule.style.height=n+p+m+"px",setTimeout(function(){t.toastCapsule.style.height="auto",e.target&&(t.toastCapsule.style.overflow="visible")},500),e.timeout&&s.progress(e,t.toast).start()},100)}(),function(){var n=e.position;if(e.target)t.wrapper=document.querySelector(e.target),t.wrapper.classList.add(i+"-target"),e.targetFirst?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule);else{if(C.indexOf(e.position)==-1){console.warn("["+i+`] Incorrect position. -It can be › `+C);return}g||window.innerWidth<=w?e.position=="bottomLeft"||e.position=="bottomRight"||e.position=="bottomCenter"?n=i+"-wrapper-bottomCenter":e.position=="topLeft"||e.position=="topRight"||e.position=="topCenter"?n=i+"-wrapper-topCenter":n=i+"-wrapper-center":n=i+"-wrapper-"+n,t.wrapper=document.querySelector("."+i+"-wrapper."+n),t.wrapper||(t.wrapper=document.createElement("div"),t.wrapper.classList.add(i+"-wrapper"),t.wrapper.classList.add(n),document.body.appendChild(t.wrapper)),e.position=="topLeft"||e.position=="topCenter"||e.position=="topRight"?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule)}isNaN(e.zindex)?console.warn("["+i+"] Invalid zIndex."):t.wrapper.style.zIndex=e.zindex}(),function(){e.overlay&&(document.querySelector("."+i+"-overlay.fadeIn")!==null?(t.overlay=document.querySelector("."+i+"-overlay"),t.overlay.setAttribute("data-iziToast-ref",t.overlay.getAttribute("data-iziToast-ref")+","+e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1)):(t.overlay.classList.add(i+"-overlay"),t.overlay.classList.add("fadeIn"),t.overlay.style.background=e.overlayColor,t.overlay.setAttribute("data-iziToast-ref",e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1),document.querySelector("body").appendChild(t.overlay)),e.overlayClose?(t.overlay.removeEventListener("click",{}),t.overlay.addEventListener("click",function(n){s.hide(e,t.toast,"overlay")})):t.overlay.removeEventListener("click",{}))}(),function(){if(e.animateInside){t.toast.classList.add(i+"-animateInside");var n=[200,100,300];(e.transitionIn=="bounceInLeft"||e.transitionIn=="bounceInRight")&&(n=[400,200,400]),e.title.length>0&&setTimeout(function(){t.strong.classList.add("slideIn")},n[0]),e.message.length>0&&setTimeout(function(){t.p.classList.add("slideIn")},n[1]),(e.icon||e.iconUrl)&&setTimeout(function(){t.icon.classList.add("revealIn")},n[2]);var c=150;e.buttons.length>0&&t.buttons&&setTimeout(function(){y(t.buttons.childNodes,function(m,p){setTimeout(function(){m.classList.add("revealIn")},c),c=c+150})},e.inputs.length>0?150:0),e.inputs.length>0&&t.inputs&&(c=150,y(t.inputs.childNodes,function(m,p){setTimeout(function(){m.classList.add("revealIn")},c),c=c+150}))}}(),e.onOpening.apply(null,[e,t.toast]);try{var d=new CustomEvent(i+"-opening",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(d)}catch(n){console.warn(n)}setTimeout(function(){t.toast.classList.remove(i+"-opening"),t.toast.classList.add(i+"-opened");try{var n=new CustomEvent(i+"-opened",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}catch(c){console.warn(c)}e.onOpened.apply(null,[e,t.toast])},1e3),e.drag&&(b?(t.toast.addEventListener("touchstart",function(n){T.startMoving(this,s,e,n)},!1),t.toast.addEventListener("touchend",function(n){T.stopMoving(this,n)},!1)):(t.toast.addEventListener("mousedown",function(n){n.preventDefault(),T.startMoving(this,s,e,n)},!1),t.toast.addEventListener("mouseup",function(n){n.preventDefault(),T.stopMoving(this,n)},!1))),e.closeOnEscape&&document.addEventListener("keyup",function(n){n=n||window.event,n.keyCode==27&&s.hide(e,t.toast,"esc")}),e.closeOnClick&&t.toast.addEventListener("click",function(n){s.hide(e,t.toast,"toast")}),s.toast=t.toast},f})})(Z);var _e=Z.exports;const H=Ce(_e);const D={timeout:3e3,close:!1,closeOnClick:!0,icon:null,position:"topRight",transitionIn:"fadeInDown",transitionOut:"fadeOutUp"};class O{static success(l){H.success({title:"OK",titleColor:"green",message:l,messageColor:"green",progressBarColor:"green",...D})}static error(l){H.error({title:"Error",titleColor:"red",message:l,messageColor:"red",progressBarColor:"red",...D})}static warning(l){H.warning({title:"Caution",message:l,titleColor:"red",messageColor:"red",progressBarColor:"red",...D})}}const z=document.getElementById("subscribeForm"),J=z.querySelector('input[name="email"]'),P=document.getElementById("subscribeBtn");J.addEventListener("input",Te);z.addEventListener("submit",Se);function Ie(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)}function Te(){J.value}async function Se(o){o.preventDefault();const l=new FormData(z),u=l.get("email");if(!Ie(u))return console.error("Invalid email address"),O.error("Invalid email address");try{P.disabled=!0;const i=await oe.post("https://your-energy.b.goit.study/api/subscription",l,{headers:{"Content-Type":"application/json"}});return i.status>=200&&i.status<300?(z.reset(),O.success(`${i.data.message}`)):(console.error("Server Error:",i.status,i.statusText),O.error(`Server Error: ${i.status} ${i.statusText}`))}catch(i){return console.error("Error:",i.message),O.error(`Error: ${i.message}`)}finally{P.disabled=!1}}const Me=new R,j=document.querySelector(".js-list");j.addEventListener("click",Be);async function Be(o){if(!o.target.closest(".filters__item"))return;const l=o.target.closest(".filters__item");let u=l.lastElementChild.children[0].innerText.toLowerCase().replace(/\s/g,"");const f=l.lastElementChild.children[1].innerText.toLowerCase().replace(/\s/g,"%20");u==="bodyparts"&&(u="bodypart");try{const i=await Me.getExercises(u,f);Oe(i)}catch(i){console.log(i)}}function Oe(o){j.innerHTML="";const l=o.map(({_id:u,rating:f,name:i,burnedCalories:g,bodyPart:v,target:h})=>` +`}function V(){A.classList.add("hidden"),z.classList.add("hidden"),document.body.style.paddingRight="0px",document.body.style.overflow="auto"}z.addEventListener("click",function(o){o.target===z&&V()});window.addEventListener("keydown",function(o){o.key==="Escape"&&!A.classList.contains("hidden")&&V()});document.addEventListener("DOMContentLoaded",function(){const o=document.querySelectorAll(".rating-label"),l=document.querySelector(".rating-value"),u=document.querySelector(".rating-form");let f=0;o.forEach(g=>{g.addEventListener("click",()=>{f=g.dataset.rating,i(f)})});function i(g){l.textContent=g;for(let v=0;vl?D.classList.add("scroll__go-top--show"):D.classList.remove("scroll__go-top--show")}function Z(){window.pageYOffset>0&&(window.scrollBy(0,-75),setTimeout(Z,0))}var O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ie(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var J={exports:{}};(function(o,l){(function(u,f){o.exports=f(u)})(typeof O<"u"?O:window||O.window||O.global,function(u){var f={},i="iziToast";document.querySelector("body");var g=!!/Mobi/.test(navigator.userAgent),v=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),h=typeof InstallTrigger<"u",b="ontouchstart"in document.documentElement,C=["bottomRight","bottomLeft","bottomCenter","topRight","topLeft","topCenter","center"],S={info:{color:"blue",icon:"ico-info"},success:{color:"green",icon:"ico-success"},warning:{color:"orange",icon:"ico-warning"},error:{color:"red",icon:"ico-error"},question:{color:"yellow",icon:"ico-question"}},w=568,x={};f.children={};var L={id:null,class:"",title:"",titleColor:"",titleSize:"",titleLineHeight:"",message:"",messageColor:"",messageSize:"",messageLineHeight:"",backgroundColor:"",theme:"light",color:"",icon:"",iconText:"",iconColor:"",iconUrl:null,image:"",imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,displayMode:0,position:"bottomRight",target:"",targetFirst:!0,timeout:5e3,rtl:!1,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:"",progressBarEasing:"linear",overlay:!1,overlayClose:!1,overlayColor:"rgba(0, 0, 0, 0.6)",transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeInUp",transitionOutMobile:"fadeOutDown",buttons:{},inputs:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if("remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof window.CustomEvent!="function"){var I=function(a,s){s=s||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(a,s.bubbles,s.cancelable,s.detail),e};I.prototype=window.Event.prototype,window.CustomEvent=I}var y=function(a,s,e){if(Object.prototype.toString.call(a)==="[object Object]")for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&s.call(e,a[t],t,a);else if(a)for(var r=0,d=a.length;r0?(r=(n-t)/n,r"u"&&(s.classList.remove(i+"-reseted"),n!==null&&(n.style.transition="width "+d.timeout+"ms "+d.progressBarEasing,n.style.width="0%"),d.time.START=new Date().getTime(),d.time.END=d.time.START+d.timeout,d.time.TIMER=setTimeout(function(){clearTimeout(d.time.TIMER),s.classList.contains(i+"-closing")||(t.hide(d,s,"timeout"),typeof e=="function"&&e.apply(t))},d.timeout),t.setSetting(r,"time",d.time))},pause:function(){if(typeof d.time.START<"u"&&!s.classList.contains(i+"-paused")&&!s.classList.contains(i+"-reseted")){if(s.classList.add(i+"-paused"),d.time.REMAINING=d.time.END-new Date().getTime(),clearTimeout(d.time.TIMER),t.setSetting(r,"time",d.time),n!==null){var c=window.getComputedStyle(n),m=c.getPropertyValue("width");n.style.transition="none",n.style.width=m}typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}},resume:function(){typeof d.time.REMAINING<"u"?(s.classList.remove(i+"-paused"),n!==null&&(n.style.transition="width "+d.time.REMAINING+"ms "+d.progressBarEasing,n.style.width="0%"),d.time.END=new Date().getTime()+d.time.REMAINING,d.time.TIMER=setTimeout(function(){clearTimeout(d.time.TIMER),s.classList.contains(i+"-closing")||(t.hide(d,s,"timeout"),typeof e=="function"&&e.apply(t))},d.time.REMAINING),t.setSetting(r,"time",d.time)):this.start()},reset:function(){clearTimeout(d.time.TIMER),delete d.time.REMAINING,t.setSetting(r,"time",d.time),s.classList.add(i+"-reseted"),s.classList.remove(i+"-paused"),n!==null&&(n.style.transition="none",n.style.width="100%"),typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}}},f.hide=function(a,s,e){typeof s!="object"&&(s=document.querySelector(s));var t=this,r=E(this.children[s.getAttribute("data-iziToast-ref")],a||{});r.closedBy=e||null,delete r.time.REMAINING,s.classList.add(i+"-closing"),function(){var c=document.querySelector("."+i+"-overlay");if(c!==null){var m=c.getAttribute("data-iziToast-ref");m=m.split(",");var p=m.indexOf(String(r.ref));p!==-1&&m.splice(p,1),c.setAttribute("data-iziToast-ref",m.join()),m.length===0&&(c.classList.remove("fadeIn"),c.classList.add("fadeOut"),setTimeout(function(){c.remove()},700))}}(),r.transitionIn&&s.classList.remove(r.transitionIn),r.transitionInMobile&&s.classList.remove(r.transitionInMobile),g||window.innerWidth<=w?r.transitionOutMobile&&s.classList.add(r.transitionOutMobile):r.transitionOut&&s.classList.add(r.transitionOut);var d=s.parentNode.offsetHeight;s.parentNode.style.height=d+"px",s.style.pointerEvents="none",(!g||window.innerWidth>w)&&(s.parentNode.style.transitionDelay="0.2s");try{var n=new CustomEvent(i+"-closing",{detail:r,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}catch(c){console.warn(c)}setTimeout(function(){s.parentNode.style.height="0px",s.parentNode.style.overflow="",setTimeout(function(){delete t.children[r.ref],s.parentNode.remove();try{var c=new CustomEvent(i+"-closed",{detail:r,bubbles:!0,cancelable:!0});document.dispatchEvent(c)}catch(m){console.warn(m)}typeof r.onClosed<"u"&&r.onClosed.apply(null,[r,s,e])},1e3)},200),typeof r.onClosing<"u"&&r.onClosing.apply(null,[r,s,e])},f.show=function(a){var s=this,e=E(x,a||{});if(e=E(L,e),e.time={},e.id===null&&(e.id=ie(e.title+e.message+e.color)),e.displayMode===1||e.displayMode=="once")try{if(document.querySelectorAll("."+i+"#"+e.id).length>0)return!1}catch{console.warn("["+i+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}if(e.displayMode===2||e.displayMode=="replace")try{y(document.querySelectorAll("."+i+"#"+e.id),function(n,c){s.hide(e,n,"replaced")})}catch{console.warn("["+i+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}e.ref=new Date().getTime()+Math.floor(Math.random()*1e7+1),f.children[e.ref]=e;var t={body:document.querySelector("body"),overlay:document.createElement("div"),toast:document.createElement("div"),toastBody:document.createElement("div"),toastTexts:document.createElement("div"),toastCapsule:document.createElement("div"),cover:document.createElement("div"),buttons:document.createElement("div"),inputs:document.createElement("div"),icon:e.iconUrl?document.createElement("img"):document.createElement("i"),wrapper:null};t.toast.setAttribute("data-iziToast-ref",e.ref),t.toast.appendChild(t.toastBody),t.toastCapsule.appendChild(t.toast),function(){if(t.toast.classList.add(i),t.toast.classList.add(i+"-opening"),t.toastCapsule.classList.add(i+"-capsule"),t.toastBody.classList.add(i+"-body"),t.toastTexts.classList.add(i+"-texts"),g||window.innerWidth<=w?e.transitionInMobile&&t.toast.classList.add(e.transitionInMobile):e.transitionIn&&t.toast.classList.add(e.transitionIn),e.class){var n=e.class.split(" ");y(n,function(c,m){t.toast.classList.add(c)})}e.id&&(t.toast.id=e.id),e.rtl&&(t.toast.classList.add(i+"-rtl"),t.toast.setAttribute("dir","rtl")),e.layout>1&&t.toast.classList.add(i+"-layout"+e.layout),e.balloon&&t.toast.classList.add(i+"-balloon"),e.maxWidth&&(isNaN(e.maxWidth)?t.toast.style.maxWidth=e.maxWidth:t.toast.style.maxWidth=e.maxWidth+"px"),(e.theme!==""||e.theme!=="light")&&t.toast.classList.add(i+"-theme-"+e.theme),e.color&&(se(e.color)?t.toast.style.background=e.color:t.toast.classList.add(i+"-color-"+e.color)),e.backgroundColor&&(t.toast.style.background=e.backgroundColor,e.balloon&&(t.toast.style.borderColor=e.backgroundColor))}(),function(){e.image&&(t.cover.classList.add(i+"-cover"),t.cover.style.width=e.imageWidth+"px",ne(e.image.replace(/ /g,""))?t.cover.style.backgroundImage="url(data:image/png;base64,"+e.image.replace(/ /g,"")+")":t.cover.style.backgroundImage="url("+e.image+")",e.rtl?t.toastBody.style.marginRight=e.imageWidth+10+"px":t.toastBody.style.marginLeft=e.imageWidth+10+"px",t.toast.appendChild(t.cover))}(),function(){e.close?(t.buttonClose=document.createElement("button"),t.buttonClose.type="button",t.buttonClose.classList.add(i+"-close"),t.buttonClose.addEventListener("click",function(n){n.target,s.hide(e,t.toast,"button")}),t.toast.appendChild(t.buttonClose)):e.rtl?t.toast.style.paddingLeft="18px":t.toast.style.paddingRight="18px"}(),function(){e.progressBar&&(t.progressBar=document.createElement("div"),t.progressBarDiv=document.createElement("div"),t.progressBar.classList.add(i+"-progressbar"),t.progressBarDiv.style.background=e.progressBarColor,t.progressBar.appendChild(t.progressBarDiv),t.toast.appendChild(t.progressBar)),e.timeout&&(e.pauseOnHover&&!e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(n){s.progress(e,t.toast).pause()}),t.toast.addEventListener("mouseleave",function(n){s.progress(e,t.toast).resume()})),e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(n){s.progress(e,t.toast).reset()}),t.toast.addEventListener("mouseleave",function(n){s.progress(e,t.toast).start()})))}(),function(){e.iconUrl?(t.icon.setAttribute("class",i+"-icon"),t.icon.setAttribute("src",e.iconUrl)):e.icon&&(t.icon.setAttribute("class",i+"-icon "+e.icon),e.iconText&&t.icon.appendChild(document.createTextNode(e.iconText)),e.iconColor&&(t.icon.style.color=e.iconColor)),(e.icon||e.iconUrl)&&(e.rtl?t.toastBody.style.paddingRight="33px":t.toastBody.style.paddingLeft="33px",t.toastBody.appendChild(t.icon))}(),function(){e.title.length>0&&(t.strong=document.createElement("strong"),t.strong.classList.add(i+"-title"),t.strong.appendChild(B(e.title)),t.toastTexts.appendChild(t.strong),e.titleColor&&(t.strong.style.color=e.titleColor),e.titleSize&&(isNaN(e.titleSize)?t.strong.style.fontSize=e.titleSize:t.strong.style.fontSize=e.titleSize+"px"),e.titleLineHeight&&(isNaN(e.titleSize)?t.strong.style.lineHeight=e.titleLineHeight:t.strong.style.lineHeight=e.titleLineHeight+"px")),e.message.length>0&&(t.p=document.createElement("p"),t.p.classList.add(i+"-message"),t.p.appendChild(B(e.message)),t.toastTexts.appendChild(t.p),e.messageColor&&(t.p.style.color=e.messageColor),e.messageSize&&(isNaN(e.titleSize)?t.p.style.fontSize=e.messageSize:t.p.style.fontSize=e.messageSize+"px"),e.messageLineHeight&&(isNaN(e.titleSize)?t.p.style.lineHeight=e.messageLineHeight:t.p.style.lineHeight=e.messageLineHeight+"px")),e.title.length>0&&e.message.length>0&&(e.rtl?t.strong.style.marginLeft="10px":e.layout!==2&&!e.rtl&&(t.strong.style.marginRight="10px"))}(),t.toastBody.appendChild(t.toastTexts);var r;(function(){e.inputs.length>0&&(t.inputs.classList.add(i+"-inputs"),y(e.inputs,function(n,c){t.inputs.appendChild(B(n[0])),r=t.inputs.childNodes,r[c].classList.add(i+"-inputs-child"),n[3]&&setTimeout(function(){r[c].focus()},300),r[c].addEventListener(n[1],function(m){var p=n[2];return p(s,t.toast,this,m)})}),t.toastBody.appendChild(t.inputs))})(),function(){e.buttons.length>0&&(t.buttons.classList.add(i+"-buttons"),y(e.buttons,function(n,c){t.buttons.appendChild(B(n[0]));var m=t.buttons.childNodes;m[c].classList.add(i+"-buttons-child"),n[2]&&setTimeout(function(){m[c].focus()},300),m[c].addEventListener("click",function(p){p.preventDefault();var oe=n[1];return oe(s,t.toast,this,p,r)})})),t.toastBody.appendChild(t.buttons)}(),e.message.length>0&&(e.inputs.length>0||e.buttons.length>0)&&(t.p.style.marginBottom="0"),(e.inputs.length>0||e.buttons.length>0)&&(e.rtl?t.toastTexts.style.marginLeft="10px":t.toastTexts.style.marginRight="10px",e.inputs.length>0&&e.buttons.length>0&&(e.rtl?t.inputs.style.marginLeft="8px":t.inputs.style.marginRight="8px")),function(){t.toastCapsule.style.visibility="hidden",setTimeout(function(){var n=t.toast.offsetHeight,c=t.toast.currentStyle||window.getComputedStyle(t.toast),m=c.marginTop;m=m.split("px"),m=parseInt(m[0]);var p=c.marginBottom;p=p.split("px"),p=parseInt(p[0]),t.toastCapsule.style.visibility="",t.toastCapsule.style.height=n+p+m+"px",setTimeout(function(){t.toastCapsule.style.height="auto",e.target&&(t.toastCapsule.style.overflow="visible")},500),e.timeout&&s.progress(e,t.toast).start()},100)}(),function(){var n=e.position;if(e.target)t.wrapper=document.querySelector(e.target),t.wrapper.classList.add(i+"-target"),e.targetFirst?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule);else{if(C.indexOf(e.position)==-1){console.warn("["+i+`] Incorrect position. +It can be › `+C);return}g||window.innerWidth<=w?e.position=="bottomLeft"||e.position=="bottomRight"||e.position=="bottomCenter"?n=i+"-wrapper-bottomCenter":e.position=="topLeft"||e.position=="topRight"||e.position=="topCenter"?n=i+"-wrapper-topCenter":n=i+"-wrapper-center":n=i+"-wrapper-"+n,t.wrapper=document.querySelector("."+i+"-wrapper."+n),t.wrapper||(t.wrapper=document.createElement("div"),t.wrapper.classList.add(i+"-wrapper"),t.wrapper.classList.add(n),document.body.appendChild(t.wrapper)),e.position=="topLeft"||e.position=="topCenter"||e.position=="topRight"?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule)}isNaN(e.zindex)?console.warn("["+i+"] Invalid zIndex."):t.wrapper.style.zIndex=e.zindex}(),function(){e.overlay&&(document.querySelector("."+i+"-overlay.fadeIn")!==null?(t.overlay=document.querySelector("."+i+"-overlay"),t.overlay.setAttribute("data-iziToast-ref",t.overlay.getAttribute("data-iziToast-ref")+","+e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1)):(t.overlay.classList.add(i+"-overlay"),t.overlay.classList.add("fadeIn"),t.overlay.style.background=e.overlayColor,t.overlay.setAttribute("data-iziToast-ref",e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1),document.querySelector("body").appendChild(t.overlay)),e.overlayClose?(t.overlay.removeEventListener("click",{}),t.overlay.addEventListener("click",function(n){s.hide(e,t.toast,"overlay")})):t.overlay.removeEventListener("click",{}))}(),function(){if(e.animateInside){t.toast.classList.add(i+"-animateInside");var n=[200,100,300];(e.transitionIn=="bounceInLeft"||e.transitionIn=="bounceInRight")&&(n=[400,200,400]),e.title.length>0&&setTimeout(function(){t.strong.classList.add("slideIn")},n[0]),e.message.length>0&&setTimeout(function(){t.p.classList.add("slideIn")},n[1]),(e.icon||e.iconUrl)&&setTimeout(function(){t.icon.classList.add("revealIn")},n[2]);var c=150;e.buttons.length>0&&t.buttons&&setTimeout(function(){y(t.buttons.childNodes,function(m,p){setTimeout(function(){m.classList.add("revealIn")},c),c=c+150})},e.inputs.length>0?150:0),e.inputs.length>0&&t.inputs&&(c=150,y(t.inputs.childNodes,function(m,p){setTimeout(function(){m.classList.add("revealIn")},c),c=c+150}))}}(),e.onOpening.apply(null,[e,t.toast]);try{var d=new CustomEvent(i+"-opening",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(d)}catch(n){console.warn(n)}setTimeout(function(){t.toast.classList.remove(i+"-opening"),t.toast.classList.add(i+"-opened");try{var n=new CustomEvent(i+"-opened",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}catch(c){console.warn(c)}e.onOpened.apply(null,[e,t.toast])},1e3),e.drag&&(b?(t.toast.addEventListener("touchstart",function(n){T.startMoving(this,s,e,n)},!1),t.toast.addEventListener("touchend",function(n){T.stopMoving(this,n)},!1)):(t.toast.addEventListener("mousedown",function(n){n.preventDefault(),T.startMoving(this,s,e,n)},!1),t.toast.addEventListener("mouseup",function(n){n.preventDefault(),T.stopMoving(this,n)},!1))),e.closeOnEscape&&document.addEventListener("keyup",function(n){n=n||window.event,n.keyCode==27&&s.hide(e,t.toast,"esc")}),e.closeOnClick&&t.toast.addEventListener("click",function(n){s.hide(e,t.toast,"toast")}),s.toast=t.toast},f})})(J);var Te=J.exports;const H=Ie(Te);const $={timeout:3e3,close:!1,closeOnClick:!0,icon:null,position:"topRight",transitionIn:"fadeInDown",transitionOut:"fadeOutUp"};class N{static success(l){H.success({title:"OK",titleColor:"green",message:l,messageColor:"green",progressBarColor:"green",...$})}static error(l){H.error({title:"Error",titleColor:"red",message:l,messageColor:"red",progressBarColor:"red",...$})}static warning(l){H.warning({title:"Caution",message:l,titleColor:"red",messageColor:"red",progressBarColor:"red",...$})}}const R=document.getElementById("subscribeForm"),ee=R.querySelector('input[name="email"]'),U=document.getElementById("subscribeBtn");ee.addEventListener("input",Me);R.addEventListener("submit",Be);function Se(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)}function Me(){ee.value}async function Be(o){o.preventDefault();const l=new FormData(R),u=l.get("email");if(!Se(u))return console.error("Invalid email address"),N.error("Invalid email address");try{U.disabled=!0;const i=await ae.post("https://your-energy.b.goit.study/api/subscription",l,{headers:{"Content-Type":"application/json"}});return i.status>=200&&i.status<300?(R.reset(),N.success(`${i.data.message}`)):(console.error("Server Error:",i.status,i.statusText),N.error(`Server Error: ${i.status} ${i.statusText}`))}catch(i){return console.error("Error:",i.message),N.error(`Error: ${i.message}`)}finally{U.disabled=!1}}const Oe=new q,j=document.querySelector(".js-list");j.addEventListener("click",Ne);async function Ne(o){if(!o.target.closest(".filters__item"))return;const l=o.target.closest(".filters__item");let u=l.lastElementChild.children[0].innerText.toLowerCase().replace(/\s/g,"");const f=l.lastElementChild.children[1].innerText.toLowerCase().replace(/\s/g,"%20");u==="bodyparts"&&(u="bodypart");try{const i=await Oe.getExercises(u,f);ke(i)}catch(i){console.log(i)}}function ke(o){j.innerHTML="";const l=o.map(({_id:u,rating:f,name:i,burnedCalories:g,bodyPart:v,target:h})=>`
  • @@ -83,18 +83,18 @@ It can be › `+C);return}g||window.innerWidth<=w?e.position=="bottomLeft"||e.po ${f} - +
    - +

    ${i}

    @@ -104,4 +104,4 @@ It can be › `+C);return}g||window.innerWidth<=w?e.position=="bottomLeft"||e.po

    Target:${h}

    -
  • `).join("");j.insertAdjacentHTML("beforeend",l)}var _=document.getElementById("mySVG");_.style.transform="scale(1)";_.style.transition="fill 0.3s ease, transform 0.3s ease";var ee=["var(--color-yellow)","var(--color-black)","var(--color-valid)"],W=0;_.addEventListener("mouseover",function(){_.style.fill=ee[W],_.style.transform="scale(1.6) rotate(145deg)"});_.addEventListener("mouseout",function(){_.style.transform="scale(1) rotate(0deg)",W=(W+1)%ee.length});const Ne=document.getElementById("btn"),ke=document.getElementById("bmi-result"),N=document.getElementById("weight-condition");function ze(){const o=document.getElementById("height").value/100,u=(document.getElementById("weight").value/(o*o)).toFixed(1);ke.value=u,u<18.5?N.innerText="Under weight":u>=18.5&&u<=24.9?N.innerText="Normal weight":u>=25&&u<=29.9?N.innerText="Overweight":u>=30&&(N.innerText="Obesity")}Ne.addEventListener("click",ze); + `).join("");j.insertAdjacentHTML("beforeend",l)}var _=document.getElementById("mySVG");_.style.transform="scale(1)";_.style.transition="fill 0.3s ease, transform 0.3s ease";var te=["var(--color-yellow)","var(--color-black)","var(--color-valid)"],W=0;_.addEventListener("mouseover",function(){_.style.fill=te[W],_.style.transform="scale(1.6) rotate(145deg)"});_.addEventListener("mouseout",function(){_.style.transform="scale(1) rotate(0deg)",W=(W+1)%te.length});const ze=document.getElementById("btn"),Re=document.getElementById("bmi-result"),k=document.getElementById("weight-condition");function qe(){const o=document.getElementById("height").value/100,u=(document.getElementById("weight").value/(o*o)).toFixed(1);Re.value=u,u<18.5?k.innerText="Under weight":u>=18.5&&u<=24.9?k.innerText="Normal weight":u>=25&&u<=29.9?k.innerText="Overweight":u>=30&&(k.innerText="Obesity")}ze.addEventListener("click",qe); diff --git a/assets/modal-exercise-image-3ecfcf3d.jpg b/assets/modal-exercise-image-3ecfcf3d.jpg new file mode 100644 index 0000000..a12db05 Binary files /dev/null and b/assets/modal-exercise-image-3ecfcf3d.jpg differ diff --git a/assets/modal-exercise-image@2x-88eeae48.jpg b/assets/modal-exercise-image@2x-88eeae48.jpg new file mode 100644 index 0000000..a69ff1c Binary files /dev/null and b/assets/modal-exercise-image@2x-88eeae48.jpg differ diff --git a/index.html b/index.html index 764c488..2f94484 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ /> Your Energy - +