text: (()=>{"use strict";function e(){const e=document.querySelector(".header"),t=document.querySelector(".user"),s=document.querySelector(".footer"),n=document.querySelector(".repositories"),i=document.querySelector("[data-loader]");i.classList.remove("hidden"),setTimeout((()=>{i.classList.add("hidden"),e.classList.add("active"),s.classList.add("active"),t.classList.add("active"),n.classList.add("active")}),2e3)}function t(e,t){const s=document.querySelector(".user"),n=`\n    <div class="user__avatar">\n    <img src= ${e.avatar_url||"../public/assets/no-found.png"} />\n  </div>\n  <div class="user__profile">\n    <h2>${e.name||""}</h2>\n    <p>@${e.login||""}</p>\n    <div class="user__location">\n      <div>\n      <span class="iconify" data-icon="fa-solid:map-marker-alt" data-inline="false"></span>\n      <p>${e.location||""}</p>\n      </div>\n      <div>\n      ${e.company?'<span class="iconify" data-icon="ic:baseline-business-center" data-inline="false"></span>':""}\n      <p>${e.company||""}</p>\n      </div>\n    </div>\n    <div class="user__data">\n      <span class="iconify" data-icon="fluent:people-team-28-filled" data-inline="false"></span>\n      <p>${e.followers||0}</p>\n      <span class="iconify" data-icon="fluent:people-team-28-regular" data-inline="false"></span>\n      <p>${e.following||0}</p>\n      <span class="iconify" data-icon="dashicons:star-filled" data-inline="false"></span>\n      <p>${t||0}</p>\n    </div>\n  </div>\n  <div class="user__branchs">\n    <h3>Total Repositories</h3>\n    <div class="user__total-branchs">\n      <span class="iconify" data-icon="bx:bx-git-branch" data-inline="false"></span>\n      <p>${e.public_repos||0}</p>\n    </div>\n  </div>\n  `;s.innerHTML=n}async function s(e){const s=t;try{const t=await fetch(e);this.jsonUser=await t.json();const n=await fetch(`${e}/starred`);this.jsonStar=await n.json(),this.totalStar=this.jsonStar.length,console.log("teste"),s(this.jsonUser,this.totalStar)}catch(e){console.log("Usuario não encontrado",e)}}async function n(e){try{const t=await fetch(`${e}/repos`);this.jsonRepositorie=await t.json(),setTimeout((()=>{!function(e){const t=document.querySelector(".repositories"),s=[...e.sort(((e,t)=>e.id<t.id?1:-1))].reduce(((e,t)=>{let s=e;return s+=`<div data-anime="scroll" class="repositories__repositorie">\n    <div  class="repositories__content">\n      <h2><a href="${t.svn_url}" target="_blank">${t.name}</a></h2>\n      <p>${t.description||""}</p>\n    </div>\n    <div class="repositories__info">\n      <span class="iconify" data-icon="dashicons:star-filled" data-inline="false"></span>\n      <p>${t.stargazers_count}</p>\n      <span class="iconify" data-icon="bx:bx-git-branch" data-inline="false"></span>\n      <p>${t.forks}</p>\n      <span class="iconify" data-icon="bi:file-earmark-code-fill" data-inline="false"></span>\n      <p>${t.language||""}</p>\n      <a href="${t.svn_url}" target="_blank">\n      <span class="iconify" data-icon="bx:bx-link-external" data-inline="false"></span>\n      </a>\n    </div>\n  </div>`,s}),"");t.innerHTML=s}(this.jsonRepositorie)}),1e3)}catch(e){console.log("Usuario não encontrado",e)}}class i{constructor(e){this.sections=document.querySelectorAll(e),this.windowMetade=.3*window.innerHeight,this.checkdistance=function(e,t){let s;return(...t)=>{s&&clearTimeout(s),s=setTimeout((()=>{e(...t),s=null}),50)}}(this.checkdistance.bind(this))}getDistance(){this.distance=[...this.sections].map((e=>{const t=e.offsetTop;return{element:e,offset:Math.floor(t-this.windowMetade)}}))}checkdistance(){this.distance.forEach((e=>{window.pageYOffset>e.offset?e.element.classList.add("ativo"):e.element.classList.contains("ativo")&&e.element.classList.remove("ativo")}))}init(){return this.sections.length&&(this.getDistance(),this.checkdistance(),window.addEventListener("scroll",this.checkdistance)),this}}new class{constructor(t,i){this.buttonSearch=document.querySelector(t),this.inputValue=i,this.searchPage=document.querySelector(".search"),this.getUserName=this.getUserName.bind(this),this.initLoader=e,this.userFetch=s,this.repositorieFetch=n}getUserName(e){e.preventDefault(),this.userName=document.querySelector(this.inputValue).value,this.url=`https://api.github.com/users/${this.userName}`,this.userName&&(this.initLoader(),this.userFetch(this.url),this.repositorieFetch(this.url),this.searchPage.classList.remove("active"),setTimeout((()=>{new i('[data-anime="scroll"]').init()}),2e3))}getUserEvent(){this.buttonSearch.addEventListener("submit",this.getUserName)}init(){this.getUserEvent(),document.querySelector('[data-back="button"]').addEventListener("click",(()=>{document.location.reload()}))}}(".search__input",'[data-search="name"]').init()})();