1(this["webpackJsonpspotify-random"]=this["webpackJsonpspotify-random"]||[]).push([[0],[,,,,,,,,,,function(e,t,c){},function(e,t,c){},function(e,t,c){},,function(e,t,c){"use strict";c.r(t);var n=c(0),a=c.n(n),o=c(4),r=c.n(o),s=(c(10),c(2)),i=(c(11),c(12),c(1));function l(e){var t=e.coverUrl,c=e.externalUrl;return Object(i.jsx)("div",{className:"cover-wrapper",children:Object(i.jsx)("div",{className:"cover cover-animate",style:{background:"url("+t+") no-repeat"},children:Object(i.jsx)("a",{className:"cover-link",href:c,target:"_blank",children:Object(i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",width:"120",height:"120",children:Object(i.jsx)("path",{d:"M256 0C114.833 0 0 114.844 0 256s114.833 256 256 256 256-114.844 256-256S397.167 0 256 0zm101.771 264.969l-149.333 96a10.62 10.62 0 01-5.771 1.698c-1.75 0-3.521-.438-5.104-1.302A10.653 10.653 0 01192 352V160c0-3.906 2.125-7.49 5.563-9.365 3.375-1.854 7.604-1.74 10.875.396l149.333 96c3.042 1.958 4.896 5.344 4.896 8.969s-1.854 7.01-4.896 8.969z",fill:"#fff","data-original":"#000000",xmlns:"http://www.w3.org/2000/svg"})})})})})}var u="https://api.spotify.com/v1",d={get:function(e){var t=new Headers;return t.append("Authorization","Bearer "+localStorage.getItem("access_token")),fetch("".concat(u).concat(e),{method:"GET",headers:t})},post:function(e,t){var c=new Headers;return c.append("Accept","application/json"),c.append("Authorization","Bearer "+localStorage.getItem("access_token")),c.append("Content-Type","application/json"),fetch("".concat(u).concat(e),{method:"POST",body:JSON.stringify(t),headers:c})}},h=c(5);var m=function(){var e=Object(n.useState)({name:"",url:"",cover:"",trackName:""}),t=Object(s.a)(e,2),c=t[0],a=t[1],o=Object(n.useState)(!0),r=Object(s.a)(o,2),u=r[0],m=r[1],j=Object(n.useState)(!1),p=Object(s.a)(j,2),f=p[0],v=p[1];function b(){m(!0),console.log("Searching on Spotify API..."),document.querySelector(".cover")&&document.querySelector(".cover").classList.remove("cover-animate"),d.get("/recommendations?seed_genres=brazil&market=BR&limit=1").then((function(e){if(401==e.status)throw e.status;return e.json()})).then((function(e){a({name:e.tracks[0].artists[0].name,url:e.tracks[0].external_urls.spotify,cover:e.tracks[0].album.images[0].url,trackName:e.tracks[0].name}),setTimeout((function(){m(!1),document.querySelector(".cover").classList.add("cover-animate")}),1500)})).catch((function(e){console.log(e),"401"==e&&(v(!1),m(!1))}))}return Object(n.useEffect)((function(){var e=window.location.hash;if(""!=e){var t=/access_token=([^&]*)/gi.exec(e)[1];t&&(console.log(t),localStorage.setItem("access_token",t),v(!0)),b()}}),[]),Object(i.jsx)(i.Fragment,{children:Object(i.jsxs)("div",{children:[f&&u&&Object(i.jsx)(h.a,{autoplay:!0,loop:!0,src:"https://assets6.lottiefiles.com/packages/lf20_h59xofz0.json",style:{height:"600px",width:"600px"}}),f&&!u&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsxs)("section",{className:"container",children:[c.cover&&Object(i.jsx)(l,{coverUrl:null===c||void 0===c?void 0:c.cover,externalUrl:null===c||void 0===c?void 0:c.url}),Object(i.jsxs)("aside",{className:"info",children:[Object(i.jsx)("h1",{children:null===c||void 0===c?void 0:c.name}),Object(i.jsx)("h2",{children:null===c||void 0===c?void 0:c.trackName})]})]}),Object(i.jsx)("button",{onClick:function(){return b()},className:"btn-lucky",children:"I'm lucky"})]}),!f&&Object(i.jsx)("a",{className:"btn-authorize",href:"https://accounts.spotify.com/authorize?response_type=token&client_id=85bf2a7d9ac849cbab60d66724ab096c&redirect_uri=https://spotifyrandom.netlify.app",children:"Sign account"})]})})},j=function(e){e&&e instanceof Function&&c.e(3).then(c.bind(null,15)).then((function(t){var c=t.getCLS,n=t.getFID,a=t.getFCP,o=t.getLCP,r=t.getTTFB;c(e),n(e),a(e),o(e),r(e)}))};r.a.render(Object(i.jsx)(a.a.StrictMode,{children:Object(i.jsx)(m,{})}),document.getElementById("root")),j()}],[[14,1,2]]]); 2//# sourceMappingURL=main.c0230311.chunk.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.