import { register, Wordlist } from './wordlist'; import { defineReadOnly } from '../utils/properties'; import { toUtf8String } from '../utils/utf8'; const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), 128 + codes.indexOf(data[i * 3 + 1]), 128 + codes.indexOf(data[i * 3 + 2]), ]; words.cn.push(toUtf8String(bytes)); let common = s % 4; for (let i = common; i < 3; i++) { bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228: 128); } words.tw.push(toUtf8String(bytes)); } class LangZh extends Wordlist { private _country: string constructor(country) { super('zh_' + country); defineReadOnly(this, '_country', country); } getWord(index: number): string { return words[this._country][index]; } getWordIndex(word: string): number { return words[this._country].indexOf(word); } split(mnemonic: string): Array { mnemonic = mnemonic.replace(/(?:\u3000| )+/g, ''); return mnemonic.split(''); } } const langZhCn = new LangZh('cn'); register(langZhCn); const langZhTw = new LangZh('tw'); register(langZhTw); //var count = 0; //var fs = require('fs'); //fs.readFileSync('wordlists/lang-zh.txt').toString().split('\x0a').forEach(function(d, i) { // let word = langZhCn.getWord(i); // if (d !== word) { // console.log(d, word, i, toUtf8Bytes(d)); // count++; // } //}); //console.log(count); //var count = 0; //var fs = require('fs'); //fs.readFileSync('wordlists/lang-zh_tw.txt').toString().split('\x0a').forEach(function(d, i) { // let word = langZhTw.getWord(i); // if (d !== word) { // console.log(d, word, i, toUtf8Bytes(d)); // count++; // } //}); //console.log(count); export { langZhCn, langZhTw };