import { DOMParser, Element } from "https://deno.land/x/deno_dom@v0.1.2-alpha3/deno-dom-wasm.ts"; class itemsXML { private repo: string = ""; private encoder: TextEncoder; private decoder: TextDecoder; private items_by_name: Map = new Map(); private items_by_id: Map = new Map(); constructor (repo: string = "client-data") { this.repo = repo; this.encoder = new TextEncoder(); this.decoder = new TextDecoder("utf-8"); } async init () { console.log("Fetching items xml files from client-data..."); await this.fetchFile("items.xml"); } private async fetchFile (path: string) { const raw = await Deno.readFile(`${this.repo}/${path}`); const xml = this.decoder.decode(raw); await this.parseXML(path, xml); } private async parseXML (path: string, xml: string) { Deno.write(Deno.stdout.rid, this.encoder.encode(` \r⌛ parsing ${path}...`)); const domparser = new DOMParser(); if (xml.startsWith("\n