text: !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){},function(e,t,n){"use strict";n.r(t);n(0);let r="",o="";const c=(()=>{let e=!0;const t=(e,t,n)=>({name:e,symbol:t,score:n});return{players:(e,n)=>{r=t(e,"X",0),o=t(n,"O",0),s.play(r,o),s.score(r,o)},switchPlayers:(t,n)=>!0===e?(e=!1,t):(e=!0,n)}})(),u=(()=>{const e=[[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]];let t=[],n=[],c=0;return{checkWin:(t,n,u)=>{for(let l=0;l<e.length;l+=1){if(console.log(c),n.includes(e[l][0])&&n.includes(e[l][1])&&n.includes(e[l][2]))return t.score+=1,s.score(r,o),t.name+" wins!";if(9===c&&""===u.textContent)return s.score(r,o),"It's a draw!"}},populateArr:(e,c)=>{"X"===c?(t.push(Number(e)+1),i.writeResult(r,t)):(n.push(Number(e)+1),i.writeResult(o,n))},resetArr:()=>{t=[],n=[],c=0},increaseCounter:()=>{c+=1}}})(),l=document.querySelector(".gameboard"),s={play:(e,t)=>(l.querySelectorAll("button").forEach((n,r)=>{n.setAttribute("id",r),n.addEventListener("click",()=>{const o=document.getElementById("result");return u.increaseCounter(),"X"===n.textContent||"O"===n.textContent||""!==o.textContent||(n.textContent=c.switchPlayers(e.symbol,t.symbol),u.populateArr(r,n.textContent)),!1})}),!1),score:(e,t)=>{const n=document.getElementById("player1-score"),r=document.getElementById("player2-score");n.textContent=`${e.name}: ${e.score}`,r.textContent=`${t.name}: ${t.score}`}},i={writeResult:(e,t)=>{const n=document.getElementById("result");n.textContent=u.checkWin(e,t,n)},resetBoard:()=>{l.querySelectorAll("button").forEach(e=>{e.textContent=""}),document.getElementById("result").textContent="",u.resetArr()}},d={firstReset:()=>{document.getElementById("reset").addEventListener("click",()=>{i.resetBoard()})},firstStart:()=>{document.querySelector("#start").addEventListener("click",()=>{const e=document.getElementById("player-1").value,t=document.getElementById("player-2").value;c.players(e,t);const n=document.querySelector(".d-none"),r=document.querySelector("#hide-div");n.classList.remove("d-none"),r.classList.add("d-none")})}};d.firstReset(),d.firstStart()}]);