// Copyright (c) 2017, Shellyl_N and Authors
// license: ISC
// https://github.com/shellyln



export const charactersMap = new Map<string, {index: number, pattern: string}>([
    ["0", {index:  0, pattern: "1112212110"}],
    ["1", {index:  1, pattern: "2112111120"}],
    ["2", {index:  2, pattern: "1122111120"}],
    ["3", {index:  3, pattern: "2122111110"}],
    ["4", {index:  4, pattern: "1112211120"}],
    ["5", {index:  5, pattern: "2112211110"}],
    ["6", {index:  6, pattern: "1122211110"}],
    ["7", {index:  7, pattern: "1112112120"}],
    ["8", {index:  8, pattern: "2112112110"}],
    ["9", {index:  9, pattern: "1122112110"}],
    ["A", {index: 10, pattern: "2111121120"}],
    ["B", {index: 11, pattern: "1121121120"}],
    ["C", {index: 12, pattern: "2121121110"}],
    ["D", {index: 13, pattern: "1111221120"}],
    ["E", {index: 14, pattern: "2111221110"}],
    ["F", {index: 15, pattern: "1121221110"}],
    ["G", {index: 16, pattern: "1111122120"}],
    ["H", {index: 17, pattern: "2111122110"}],
    ["I", {index: 18, pattern: "1121122110"}],
    ["J", {index: 19, pattern: "1111222110"}],
    ["K", {index: 20, pattern: "2111111220"}],
    ["L", {index: 21, pattern: "1121111220"}],
    ["M", {index: 22, pattern: "2121111210"}],
    ["N", {index: 23, pattern: "1111211220"}],
    ["O", {index: 24, pattern: "2111211210"}],
    ["P", {index: 25, pattern: "1121211210"}],
    ["Q", {index: 26, pattern: "1111112220"}],
    ["R", {index: 27, pattern: "2111112210"}],
    ["S", {index: 28, pattern: "1121112210"}],
    ["T", {index: 29, pattern: "1111212210"}],
    ["U", {index: 30, pattern: "2211111120"}],
    ["V", {index: 31, pattern: "1221111120"}],
    ["W", {index: 32, pattern: "2221111110"}],
    ["X", {index: 33, pattern: "1211211120"}],
    ["Y", {index: 34, pattern: "2211211110"}],
    ["Z", {index: 35, pattern: "1221211110"}],
    ["-", {index: 36, pattern: "1211112120"}],
    [".", {index: 37, pattern: "2211112110"}],
    [" ", {index: 38, pattern: "1221112110"}],
    ["$", {index: 39, pattern: "1212121110"}],
    ["/", {index: 40, pattern: "1212111210"}],
    ["+", {index: 41, pattern: "1211121210"}],
    ["%", {index: 42, pattern: "1112121210"}],
    ["*", {index: 43, pattern: "1211212110"}]
]);


export const reverseMap = new Map<number, string>();
for (const e of charactersMap.entries()) reverseMap.set(e[1].index, e[0]);


export const fullAsciiMap = new Map<number, string>([
    [  0, "%U"], // NUL
    [  1, "$A"], // SOH
    [  2, "$B"], // STX
    [  3, "$C"], // ETX
    [  4, "$D"], // EOT
    [  5, "$E"], // ENQ
    [  6, "$F"], // ACK
    [  7, "$G"], // BEL
    [  8, "$H"], // BS
    [  9, "$I"], // HT
    [  0, "$J"], // LF
    [ 11, "$K"], // VT
    [ 12, "$L"], // FF
    [ 13, "$M"], // CR
    [ 14, "$N"], // SO
    [ 15, "$O"], // SI
    [ 16, "$P"], // DLE
    [ 17, "$Q"], // DC1
    [ 18, "$R"], // DC2
    [ 19, "$S"], // DC3
    [ 20, "$T"], // DC4
    [ 21, "$U"], // NAK
    [ 22, "$V"], // SYN
    [ 23, "$W"], // ETB
    [ 24, "$X"], // CAN
    [ 25, "$Y"], // EM
    [ 26, "$Z"], // SUB
    [ 27, "%A"], // ESC
    [ 28, "%B"], // FS
    [ 29, "%C"], // GS
    [ 30, "%D"], // RS
    [ 31, "%E"], // US
    [ 32, " " ], // SP
    [ 33, "/A"], // !
    [ 34, "/B"], // "
    [ 35, "/C"], // #
    [ 36, "/D"], // $
    [ 37, "/E"], // %
    [ 38, "/F"], // &
    [ 39, "/G"], // '
    [ 40, "/H"], // (
    [ 41, "/I"], // )
    [ 42, "/J"], // *
    [ 43, "/K"], // +
    [ 44, "/L"], // ,
    [ 45, "-" ], // -
    [ 46, "." ], // .
    [ 47, "/" ], // /
    [ 48, "0" ], // 0
    [ 49, "1" ], // 1
    [ 50, "2" ], // 2
    [ 51, "3" ], // 3
    [ 52, "4" ], // 4
    [ 53, "5" ], // 5
    [ 54, "6" ], // 6
    [ 55, "7" ], // 7
    [ 56, "8" ], // 8
    [ 57, "9" ], // 9
    [ 58, "/Z"], // :
    [ 59, "%F"], // ;
    [ 60, "%G"], // <
    [ 61, "%H"], // =
    [ 62, "%I"], // >
    [ 63, "%J"], // ?
    [ 64, "%V"], // @
    [ 65, "A" ], // A
    [ 66, "B" ], // B
    [ 67, "C" ], // C
    [ 68, "D" ], // D
    [ 69, "E" ], // E
    [ 70, "F" ], // F
    [ 71, "G" ], // G
    [ 72, "H" ], // H
    [ 73, "I" ], // I
    [ 74, "J" ], // J
    [ 75, "K" ], // K
    [ 76, "L" ], // L
    [ 77, "M" ], // M
    [ 78, "N" ], // N
    [ 79, "O" ], // O
    [ 80, "P" ], // P
    [ 81, "Q" ], // Q
    [ 82, "R" ], // R
    [ 83, "S" ], // S
    [ 84, "T" ], // T
    [ 85, "U" ], // U
    [ 86, "V" ], // V
    [ 87, "W" ], // W
    [ 88, "X" ], // X
    [ 89, "Y" ], // Y
    [ 90, "Z" ], // Z
    [ 91, "%K"], // [
    [ 92, "%L"], // backslash
    [ 93, "%M"], // ]
    [ 94, "%N"], // ^
    [ 95, "%O"], // _
    [ 96, "%W"], // `
    [ 97, "+A"], // a
    [ 98, "+B"], // b
    [ 99, "+C"], // c
    [100, "+D"], // d
    [101, "+E"], // e
    [102, "+F"], // f
    [103, "+G"], // g
    [104, "+H"], // h
    [105, "+I"], // i
    [106, "+J"], // j
    [107, "+K"], // k
    [108, "+L"], // l
    [109, "+M"], // m
    [110, "+N"], // n
    [111, "+O"], // o
    [112, "+P"], // p
    [113, "+Q"], // q
    [114, "+R"], // r
    [115, "+S"], // s
    [116, "+T"], // t
    [117, "+U"], // u
    [118, "+V"], // v
    [119, "+W"], // w
    [120, "+X"], // x
    [121, "+Y"], // y
    [122, "+Z"], // z
    [123, "%P"], // {
    [124, "%Q"], // |
    [125, "%R"], // }
    [126, "%S"], // ~
    [127, "%T"]  // DEL
]);

