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,MAELvD,gBAAgBgB,MAAQ,MAG1BtB,SAAS2E,iBAAiB,SAAS,SAAUC,GAG3C,GAFAA,EAAEC,iBAGAtE,mBAAmBe,QAAUmD,eAAelB,WAC3C/C,cAAcc,QAAUmD,eAAe7F,IACxC,CACA,MAAMoH,EAAQ/G,SAASgH,WACrBvE,GAAOA,EAAI6B,WAAakB,eAAelB,WAEzCwB,QAAQC,IAAIgB,GAIZ/G,SAASiH,OAAOF,EAAO,GAGvBrG,aAAa6B,MAAM+C,QAAU,EAG/BhE,mBAAmBe,MAAQd,cAAcc,MAAQ,MAGnD,IAAI6E,QAAS,EACblG,QAAQ0E,iBAAiB,SAAS,SAAUC,GAC1CA,EAAEC,iBACFpD,iBAAiBgD,gBAAiB0B,QAClCA,QAAUA","sources":["script.js"],"sourcesContent":["'use strict';\n\n/////////////////////////////////////////////////\n/////////////////////////////////////////////////\n// BANKIST APP\n\n/////////////////////////////////////////////////\n// Data\n\n// DIFFERENT DATA! Contains movement dates, currency and locale\n\nconst account1 = {\n owner: 'Jonas Schmedtmann',\n movements: [200, 455.23, -306.5, 25000, -642.21, -133.9, 79.97, 1300],\n interestRate: 1.2, // %\n pin: 1111,\n\n movementsDates: [\n '2019-11-18T21:31:17.178Z',\n '2019-12-23T07:42:02.383Z',\n '2020-01-28T09:15:04.904Z',\n '2020-04-01T10:17:24.185Z',\n '2020-05-08T14:11:59.604Z',\n '2022-04-27T14:43:26.374Z',\n '2022-04-29T18:49:59.371Z',\n '2022-05-03T12:01:20.894Z',\n ],\n currency: 'EUR',\n locale: 'pt-PT', // de-DE\n};\n\nconst account2 = {\n owner: 'Jessica Davis',\n movements: [5000, 3400, -150, -790, -3210, -1000, 8500, -30],\n interestRate: 1.5,\n pin: 2222,\n\n movementsDates: [\n '2019-11-01T13:15:33.035Z',\n '2019-11-30T09:48:16.867Z',\n '2019-12-25T06:04:23.907Z',\n '2020-01-25T14:18:46.235Z',\n '2020-02-05T16:33:06.386Z',\n '2020-04-27T14:43:26.374Z',\n '2020-04-29T18:49:59.371Z',\n '2020-05-03T12:01:20.894Z',\n ],\n currency: 'USD',\n locale: 'en-US',\n};\n\nconst accounts = [account1, account2];\n\n/////////////////////////////////////////////////\n// Elements\nconst labelWelcome = document.querySelector('.welcome');\nconst labelDate = document.querySelector('.date');\nconst labelBalance = document.querySelector('.balance__value');\nconst labelSumIn = document.querySelector('.summary__value--in');\nconst labelSumOut = document.querySelector('.summary__value--out');\nconst labelSumInterest = document.querySelector('.summary__value--interest');\nconst labelTimer = document.querySelector('.timer');\n\nconst containerApp = document.querySelector('.app');\nconst containerMovements = document.querySelector('.movements');\n\nconst btnLogin = document.querySelector('.login__btn');\nconst btnTransfer = document.querySelector('.form__btn--transfer');\nconst btnLoan = document.querySelector('.form__btn--loan');\nconst btnClose = document.querySelector('.form__btn--close');\nconst btnSort = document.querySelector('.btn--sort');\n\nconst inputLoginUsername = document.querySelector('.login__input--user');\nconst inputLoginPin = document.querySelector('.login__input--pin');\nconst inputTransferTo = document.querySelector('.form__input--to');\nconst inputTransferAmount = document.querySelector('.form__input--amount');\nconst inputLoanAmount = document.querySelector('.form__input--loan-amount');\nconst inputCloseUsername = document.querySelector('.form__input--user');\nconst inputClosePin = document.querySelector('.form__input--pin');\n\n/////////////////////////////////////////////////\n// Functions\n\nconst formatMovementDate = function (date, locale) {\n const calcDaysPassed = (date1, date2) =>\n Math.round(Math.abs(date2 - date1) / (1000 * 60 * 60 * 24));\n\n const daysPassed = calcDaysPassed(new Date(), date);\n //console.log(daysPassed);\n\n if (daysPassed === 0) return `Today`;\n if (daysPassed === 1) return `Yesterday`;\n if (daysPassed <= 7) return `${daysPassed} days ago`;\n\n // const day = `${date.getDate()}`.padStart(2, '0');\n // const month = `${date.getMonth() + 1}`.padStart(2, '0');\n // const year = date.getFullYear();\n // return `${day}/${month}/${year}`;\n return new Intl.DateTimeFormat(locale).format(date);\n};\n\nconst formatCur = function (value, locale, currency) {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currency,\n }).format(value);\n};\n\nconst displayMovements = function (acc, sort = false) {\n containerMovements.innerHTML = '';\n\n const movs = sort\n ? acc.movements.slice().sort((a, b) => a - b)\n : acc.movements;\n\n movs.forEach(function (mov, i) {\n const type = mov > 0 ? 'deposit' : 'withdrawal';\n\n const date = new Date(acc.movementsDates[i]);\n const displayDate = formatMovementDate(date, acc.locale);\n const formattedMov = formatCur(mov, acc.locale, acc.currency);\n\n const html = `\n
\n
${\n i + 1\n } ${type}
\n
${displayDate}
\n
${formattedMov}
\n
\n `;\n\n containerMovements.insertAdjacentHTML('afterbegin', html);\n });\n};\n\nconst calcDisplayBalance = function (acc) {\n acc.balance = acc.movements.reduce((acc, mov) => acc + mov, 0);\n labelBalance.textContent = formatCur(acc.balance, acc.locale, acc.currency);\n};\n\nconst calcDisplaySummary = function (acc) {\n const incomes = acc.movements\n .filter(mov => mov > 0)\n .reduce((acc, mov) => acc + mov, 0);\n labelSumIn.textContent = formatCur(incomes, acc.locale, acc.currency);\n\n const out = acc.movements\n .filter(mov => mov < 0)\n .reduce((acc, mov) => acc + mov, 0);\n labelSumOut.textContent = formatCur(Math.abs(out), acc.locale, acc.currency);\n\n const interest = acc.movements\n .filter(mov => mov > 0)\n .map(deposit => (deposit * acc.interestRate) / 100)\n .filter((int, i, arr) => {\n // console.log(arr);\n return int >= 1;\n })\n .reduce((acc, int) => acc + int, 0);\n labelSumInterest.textContent = formatCur(interest, acc.locale, acc.currency);\n};\n\nconst createUsernames = function (accs) {\n accs.forEach(function (acc) {\n acc.username = acc.owner\n .toLowerCase()\n .split(' ')\n .map(name => name[0])\n .join('');\n });\n};\ncreateUsernames(accounts);\n\nconst updateUI = function (acc) {\n // Display movements\n displayMovements(acc);\n\n // Display balance\n calcDisplayBalance(acc);\n\n // Display summary\n calcDisplaySummary(acc);\n};\n\nconst startLogOutTimer = function () {\n const tick = function () {\n const min = String(Math.trunc(time / 60)).padStart(2, 0);\n const sec = String(time % 60).padStart(2, 0);\n // In each call, print the remaining time to UI\n labelTimer.textContent = `${min}:${sec}`;\n\n // When 0 seconds, stop timer and log out user\n if (time === 0) {\n clearInterval(timer);\n labelWelcome.textContent = `Log in to get started`;\n containerApp.style.opacity = 0;\n }\n // Decrease 1s\n time--;\n };\n // Set time to 5 minutes\n let time = 120;\n // Call the timer every second\n tick();\n const timer = setInterval(tick, 1000);\n\n return timer;\n};\n\n///////////////////////////////////////\n// Event handlers\nlet currentAccount, timer;\n\n// FAKE ALWAYS LOGGED IN\n// currentAccount = account1;\n// updateUI(currentAccount);\n// containerApp.style.opacity = 100;\n\n// Experimenting with API\n\nbtnLogin.addEventListener('click', function (e) {\n // Prevent form from submitting\n e.preventDefault();\n\n currentAccount = accounts.find(\n acc => acc.username === inputLoginUsername.value\n );\n console.log(currentAccount);\n\n if (currentAccount?.pin === +inputLoginPin.value) {\n // Display UI and message\n labelWelcome.textContent = `Welcome back, ${\n currentAccount.owner.split(' ')[0]\n }`;\n containerApp.style.opacity = 100;\n\n // Create Current Date and Time\n const now = new Date();\n const options = {\n hour: 'numeric',\n minute: 'numeric',\n day: 'numeric',\n month: 'numeric',\n year: 'numeric',\n //weekday: 'long',\n };\n // const locale = navigator.language;\n // console.log(locale);\n labelDate.textContent = new Intl.DateTimeFormat(\n currentAccount.locale,\n options\n ).format(now);\n\n // const now = new Date();\n // const day = `${now.getDate()}`.padStart(2, '0');\n // const month = `${now.getMonth() + 1}`.padStart(2, '0');\n // const year = now.getFullYear();\n // const hour = `${now.getHours()}`.padStart(2, '0');\n // const min = `${now.getMinutes()}`.padStart(2, '0');\n // labelDate.textContent = `${day}/${month}/${year}, ${hour}:${min}`;\n\n // Clear input fields\n inputLoginUsername.value = inputLoginPin.value = '';\n inputLoginPin.blur();\n\n //Timer\n if (timer) clearInterval(timer);\n timer = startLogOutTimer();\n\n // Update UI\n updateUI(currentAccount);\n }\n});\n\nbtnTransfer.addEventListener('click', function (e) {\n e.preventDefault();\n const amount = +inputTransferAmount.value;\n const receiverAcc = accounts.find(\n acc => acc.username === inputTransferTo.value\n );\n inputTransferAmount.value = inputTransferTo.value = '';\n\n if (\n amount > 0 &&\n receiverAcc &&\n currentAccount.balance >= amount &&\n receiverAcc?.username !== currentAccount.username\n ) {\n // Doing the transfer\n currentAccount.movements.push(-amount);\n receiverAcc.movements.push(amount);\n\n // Add transfer date\n currentAccount.movementsDates.push(new Date().toISOString());\n receiverAcc.movementsDates.push(new Date().toISOString());\n\n // Update UI\n updateUI(currentAccount);\n\n // Reset timer\n clearInterval(timer);\n timer = startLogOutTimer();\n }\n});\n\nbtnLoan.addEventListener('click', function (e) {\n e.preventDefault();\n\n const amount = Math.floor(inputLoanAmount.value);\n\n if (amount > 0 && currentAccount.movements.some(mov => mov >= amount * 0.1)) {\n setTimeout(function () {\n // Add movement\n currentAccount.movements.push(amount);\n\n // Add Loan Date\n currentAccount.movementsDates.push(new Date().toISOString());\n\n // Update UI\n updateUI(currentAccount);\n\n // Reset timer\n clearInterval(timer);\n timer = startLogOutTimer();\n }, 2500);\n }\n inputLoanAmount.value = '';\n});\n\nbtnClose.addEventListener('click', function (e) {\n e.preventDefault();\n\n if (\n inputCloseUsername.value === currentAccount.username &&\n +inputClosePin.value === currentAccount.pin\n ) {\n const index = accounts.findIndex(\n acc => acc.username === currentAccount.username\n );\n console.log(index);\n // .indexOf(23)\n\n // Delete account\n accounts.splice(index, 1);\n\n // Hide UI\n containerApp.style.opacity = 0;\n }\n\n inputCloseUsername.value = inputClosePin.value = '';\n});\n\nlet sorted = false;\nbtnSort.addEventListener('click', function (e) {\n e.preventDefault();\n displayMovements(currentAccount, !sorted);\n sorted = !sorted;\n});\n\n/////////////////////////////////////////////////\n/////////////////////////////////////////////////\n// LECTURES\n\n/*\n/////////////////////////////////////////////////\n// Converting and Checking Numbers\nconsole.log(23 === 23.0);\n\n// Base 10 - 0 to 9\n// Binary base 2 - 0 1\nconsole.log(0.1 + 0.2);\nconsole.log(0.1 + 0.2 === 0.3);\n\n// Conversion\nconsole.log(Number('23'));\nconsole.log(+'23');\n\n// Parsing\nconsole.log(Number.parseInt('30px', 10));\nconsole.log(Number.parseInt('e23', 10));\n\nconsole.log(Number.parseFloat('2.5rem'));\nconsole.log(Number.parseInt('2.5rem'));\n\n//console.log(parseFloat('2.5rem'));\n\n// Check if value is NaN\nconsole.log(Number.isNaN(20));\nconsole.log(Number.isNaN('20'));\nconsole.log(Number.isNaN(+'20x'));\nconsole.log(Number.isNaN(23 / 0));\n\n// Check if value is number\nconsole.log(Number.isFinite(20));\nconsole.log(Number.isFinite('20'));\nconsole.log(Number.isFinite(+'20X'));\nconsole.log(Number.isNaN(23 / 0));\n\nconsole.log(Number.isInteger(23));\nconsole.log(Number.isInteger(23.0));\nconsole.log(Number.isInteger(23 / 0));\n\n/////////////////////////////////////////////////\n// Math and Rounding\n\nconsole.log(Math.sqrt(25));\nconsole.log(25 ** (1 / 2));\nconsole.log(8 ** (1 / 3));\n\nconsole.log(Math.max(5, 18, 23, 11, 2));\nconsole.log(Math.max(5, 18, '23', 11, 2));\nconsole.log(Math.max(5, 18, '23px', 11, 2));\n\nconsole.log(Math.min(5, 18, 23, 11, 2));\n\nconsole.log(Math.PI * Number.parseFloat('10px') ** 2);\n\nconsole.log(Math.trunc(Math.random() * 6) + 1);\n\nconst randomInt = (min, max) =>\n Math.floor(Math.random() * (max - min) + 1) + min;\n//console.log(randomInt(10, 20));\n\n// Rounding Integers\nconsole.log(Math.trunc(23.3));\nconsole.log(Math.round(23.9));\n\nconsole.log(Math.ceil(23.3));\nconsole.log(Math.ceil(23.9));\n\nconsole.log(Math.floor(23.3));\nconsole.log(Math.floor(23.9));\n\nconsole.log(Math.trunc(-23.3));\nconsole.log(Math.floor(-23.3));\n\n// Rounding Decimals\nconsole.log((2.7).toFixed(0));\nconsole.log((2.7).toFixed(3));\nconsole.log((2.345).toFixed(2));\nconsole.log(+(2.345).toFixed(2));\n\n/////////////////////////////////////////////////\n// Remainder Operator\n\nconsole.log(5 % 2);\nconsole.log(5 / 2); // 5 = 2 * 2 + 1\n\nconsole.log(8 % 3);\nconsole.log(8 / 3); // 8 = 2 * 3 + 2\n\nconsole.log(6 % 2);\nconsole.log(6 / 2);\n\nconsole.log(7 % 2);\nconsole.log(7 / 2);\n\nconst isEven = n => n % 2 === 0;\nconsole.log(isEven(8));\nconsole.log(isEven(23));\nconsole.log(isEven(514));\n\nlabelBalance.addEventListener('click', function () {\n [...document.querySelectorAll('.movements__row')].forEach(function (row, i) {\n if (i % 2 === 0) row.style.backgroundColor = 'orangered';\n if (i % 3 === 0) row.style.backgroundColor = 'blue';\n });\n});\n\n/////////////////////////////////////////////////\n// Numeric Seperators\n\n// 287,460,000,000\nconst diameter = 287_460_000_000;\nconsole.log(diameter);\n\nconst price = 345_99;\nconsole.log(price);\n\nconst transferFee1 = 15_00;\nconst transferFee2 = 1_500;\n\nconst PI = 3.1415;\nconsole.log(PI);\n\nconsole.log(Number('230_000'));\n\n\n/////////////////////////////////////////////////\n// BigInt\n\nconsole.log(2 ** 53 - 1);\nconsole.log(Number.MAX_SAFE_INTEGER);\nconsole.log(2 ** 53 + 1);\nconsole.log(2 ** 53 + 2);\nconsole.log(2 ** 53 + 3);\nconsole.log(2 ** 53 + 4);\n\nconsole.log(4349873098470938479083740987340987349087430987340987n);\nconsole.log(BigInt(43498730987));\n\n// Operations\nconsole.log(10000n + 10000n);\nconsole.log(323452345234500239485234554325n * 100000000n);\n\nconst huge = 2302934908723049872309847239487n;\nconst num = 23;\nconsole.log(huge * BigInt(num));\n\n// Exceptions\nconsole.log(20n > 15);\nconsole.log(20n === 20);\nconsole.log(typeof 20n);\nconsole.log(20n == 20);\n\nconsole.log(huge + ' is REALLY big!!!');\n\n// Divisions\nconsole.log(10n / 3n);\nconsole.log(10 / 3);\n\n/////////////////////////////////////////////////\n// Dates and Times\n\n// Create a Date(4 ways)\n// const now = new Date();\n// console.log(now);\n\n// console.log(new Date('Aug 02 2020 18:05:53'));\n// console.log(new Date('December 24, 2015'));\n// console.log(new Date(account1.movementsDates[0]));\n// console.log(new Date(2037, 10, 19, 15, 23, 5));\n// console.log(new Date(2037, 10, 31));\n\n// console.log(new Date(0));\n// console.log(new Date(3 * 24 * 60 * 60 * 1000));\n\n// Working with Dates\nconst future = new Date(2037, 10, 19, 15, 23);\nconsole.log(future);\nconsole.log(future.getFullYear());\nconsole.log(future.getMonth());\nconsole.log(future.getDate());\nconsole.log(future.getDay());\nconsole.log(future.getHours());\nconsole.log(future.getMinutes());\nconsole.log(future.getSeconds());\nconsole.log(future.toISOString());\nconsole.log(future.getTime());\n\nconsole.log(new Date(2142278580000));\n\nconsole.log(Date.now());\n\nfuture.setFullYear(2040);\nconsole.log(future);\n\n\n/////////////////////////////////////////////////\n// Operations with Dates\n\nconst future = new Date(2037, 10, 19, 15, 23);\nconsole.log(+future);\n\nconst calcDaysPassed = (date1, date2) =>\n Math.abs(date2 - date1) / (1000 * 60 * 60 * 24);\n\nconst days1 = calcDaysPassed(new Date(2037, 3, 4), new Date(2037, 3, 14));\nconsole.log(days1);\n\n/////////////////////////////////////////////////\n// Internationalizing Numbers\n\nconst num = 3884764.23;\n\nconst options = {\n style: 'currency',\n unit: 'celsius',\n currency: 'EUR',\n //useGrouping: false,\n};\n\nconsole.log('US', new Intl.NumberFormat('en-US', options).format(num));\nconsole.log('Germany', new Intl.NumberFormat('de-DE', options).format(num));\nconsole.log('Syria', new Intl.NumberFormat('ar-SY', options).format(num));\nconsole.log(\n 'Browser',\n new Intl.NumberFormat(navigator.language, options).format(num)\n);\n\n\n/////////////////////////////////////////////////\n// Timers\n\nconst ingredients = ['olives', 'spinach'];\nconst pizzaTimer = setTimeout(\n (ing1, ing2) => console.log(`Here is your pizza with ${ing1} and ${ing2} 🍕`),\n 3000,\n ...ingredients\n);\nconsole.log('Waiting...');\n\nif (ingredients.includes('spinach')) clearTimeout(pizzaTimer);\n\n// setInterval\nsetInterval(function () {\n const now = new Date();\n console.log(now);\n}, 3000);\n*/\n"],"names":["account1","owner","movements","interestRate","pin","movementsDates","currency","locale","account2","accounts","labelWelcome","document","querySelector","labelDate","labelBalance","labelSumIn","labelSumOut","labelSumInterest","labelTimer","containerApp","containerMovements","btnLogin","btnTransfer","btnLoan","btnClose","btnSort","inputLoginUsername","inputLoginPin","inputTransferTo","inputTransferAmount","inputLoanAmount","inputCloseUsername","inputClosePin","formatMovementDate","date","daysPassed","date1","Date","date2","Math","round","abs","Intl","DateTimeFormat","format","formatCur","value","NumberFormat","style","displayMovements","acc","sort","innerHTML","slice","a","b","forEach","mov","i","type","html","insertAdjacentHTML","calcDisplayBalance","acc1","balance","reduce","textContent","calcDisplaySummary","acc2","incomes","filter","out","interest","map","deposit","int","arr","createUsernames","accs","username","toLowerCase","split","name","join","updateUI","startLogOutTimer","tick","min","String","trunc","time","padStart","sec","clearInterval","timer1","opacity","setInterval","currentAccount","timer","addEventListener","e","preventDefault","find","console","log","now","options","hour","minute","day","month","year","blur","amount","receiverAcc","push","toISOString","floor","some","setTimeout","index","findIndex","splice","sorted"],"version":3,"file":"index.fda9851c.js.map"}