Worked through converting to due to site not working. Now I am getting Uncaught (in promise) ReferenceError: moralis is not defined; when attempting to log in via metamask error appears to start at the below bold code. Any idea on a fix? Had a developer build the repository, my skill level is beginner. Any advice would be greatly appreciated!
async function get_exchange_rates(){var e;window.exchange_rates||(e=await(e=await fetch("https://www.binance.com/api/v3/ticker/price?symbol=BNBUSDC")).json(),e=parseFloat(e.price),window.exchange_rates={},window.exchange_rates.USD=e)}async function format_currency(e){var t=localStorage.getItem("currency");return"BNB"==t?parseFloat(e.toFixed(4)).toString()+" BNB":(await get_exchange_rates(),window.exchange_rates[t]?(e*window.exchange_rates[t]).toFixed(2)+" "+t:parseFloat(e.toFixed(4)).toString()+" BNB")}function scale_parchment(){$(".parchment").height($("body").height()-230)}async function login(){window.user=moralis.User.current(),window.user||(window.user=await moralis.Web3.authenticate({chainId:window.CHAIN_ID})),console.log("logged in user:",user)}async function login_logout(){window.user?Swal.fire({title:"Would you like to log out?",showDenyButton:!0,confirmButtonText:"Log out",denyButtonText:"Cancel"}).then(async e=>{e.isConfirmed&&(window.user=null,await Moralis.User.logOut())}):await login()}function shorten_addr(e){return e=e.slice(0,6)+".."+e.slice(e.length-4,e.length)}async function switch_chain(){try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+window.CHAIN_ID.toString(16)}]})}catch(e){4902===e.code||-32002==e.code?Swal.fire({title:"Select Chain",text:"Please switch your wallet to the chain "+window.CHAIN.toUpperCase()}):Swal.fire({icon:"error",title:"Error",text:
Error ${e.code}: +e.message})}}async function update_user(){window.user&&!window.ethereum.selectedAddress&&(window.user=null,await Moralis.User.logOut(),window.location.reload());var e=window.user?shorten_addr(window.user.get("ethAddress")):"Log in";$("#user_addr").html(e),window.user?parseInt(window.ethereum.chainId)==window.CHAIN_ID||window.switch_attempted||(window.switch_attempted=!0,await switch_chain()):window.switch_attempted=!1}function derive_key(e){for(var t=0;t<100;t++)e=nacl.util.encodeBase64(nacl.hash(nacl.util.decodeUTF8(e)));return nacl.hash(nacl.util.decodeUTF8(e)).slice(0,nacl.secretbox.keyLength)}function enc_with_key(e,t){var n=nacl.randomBytes(nacl.secretbox.nonceLength),e=nacl.secretbox(nacl.util.decodeUTF8(e),n,t);return nacl.util.encodeBase64(n)+":"+nacl.util.encodeBase64(e)}function dec_with_key(e,t){var n=nacl.util.decodeBase64(e.split(":")[0]),e=(e=nacl.util.decodeBase64(e.split(":")[1]),nacl.secretbox.open(e,n,t));return nacl.util.encodeUTF8(e)}window.treasurehunt="v001",window.NFT_CONTRACT_ADDRESS="0x3e0abc4cd3269a0283349a1dc5a18bfe6f153224",window.web3_bsc=new Web3("https://bsc-dataseed.binance.org"),window.TREASURE_HUNT_URL="https://treasurehunttoken.com/",window.BSCSCAN="https://bscscan.com",window.CHAIN="bsc",window.CHAIN_ID=56,window.BLACKLIST=[],window.serverUrl="https://srkzwy6g3vsa.usemoralis.com:2053/server",window.appId="aQWF5eNt563HmiEiLEoh2AUrTdTow8b1XzhIPnJM",Moralis.start({serverUrl:window.serverUrl,appId:window.appId}),window.user=null,setTimeout(get_exchange_rates,10),localStorage.getItem("currency")||localStorage.setItem("currency","BNB"),$("#currencySelect").val(localStorage.getItem("currency")).change(function(){localStorage.setItem("currency",$("#currencySelect").val()),window.location.reload()}),setInterval(scale_parchment,500),window.user=Moralis.User.current(),setInterval(update_user,500);const SALT_KEY=nacl.util.decodeBase64("HYZAgC1Z/skSs8FZvL0TCp+ZGU59onmjdkEQZvSd1DU="),SALT_KEY2=nacl.util.decodeBase64("/7eJ3nUtSL9AW+WRl36QDs6BGcE2WPypc2lv42axg6E="),PAD="hlOLqp2hvWA40ni8XW6ERSOH3x",HASH_NONCE=nacl.util.decodeBase64("sAOAEli24spWsY8/4IaZ+W6EqJ436CY1");function hash_str(e){return nacl.util.encodeBase64(nacl.box(nacl.util.decodeUTF8(e+" __"+PAD),HASH_NONCE,SALT_KEY,SALT_KEY2))}function encrypt_soln(e,t){var n=derive_key(e);return[hash_str(e),enc_with_key(t,n)]}function sleep(t){return new Promise(e=>setTimeout(e,t))}function escape_text(e){return document.createElement("div").appendChild(document.createTextNode(e)).parentNode.innerHTML}async function get_values(e){for(var t={},n=[],a=0;a<e.length;a++)t[e[a]]=0,n.push(e[a].toLowerCase());const o=new Moralis.Query("BscTransactions");o.containedIn("to_address",n);for(var r=await o.findAll(),a=0;a<r.length;a++)t[r[a].get("to_address")]+=parseFloat(r[a].get("value"))/1e18;for(a=0;a<e.length;a++)t[e[a]]=parseFloat(t[e[a]].toFixed(4)).toString();return t}async function fix_cache(e){await Moralis.Web3API.token.reSyncMetadata({chain:window.CHAIN,address:window.NFT_CONTRACT_ADDRESS,token_id:""+e,flag:"uri",mode:"sync"})}