const stripe_width = 32;
const stripe_pos = 40;
const stripe2_pos = 110;
const h = g.getHeight();
const w = g.getWidth();
const decompress = require("heatshrink").decompress;


function benchStart() {
  return {
    now : +Date.now(),
    diff: function() {
      return (0+Date.now()) - this.now;
    }
  };
}
const startupTime = benchStart();
function image(x,y,b) {
    return {
      bpp:1, width:x,height:y,
      buffer: decompress(atob(b)),
    };
}

const katakana = {
A: image(56, 51, "v//AAfwAon//AGF/wGT/gGM/A3F/BDEn/wJQoGCj4RB//gAxUB//AAwcDAwsH/+AAwcP/4tCAwMf/wGEn/8Awl/JYYGBKQkf/I9DAwJgBGwQGDGwRlBAwJsE+42DAwPzGwYGB+J7EQIIvDQIIFEAw5DEAwRDDgCIEAxCPBKIcAR4IhER4hnCLAg9BLAgoBAwgoBcQiCBMwj0BHogGBHogGBfoooEQQREFEIgGBAokAhAGFA="),
I: image(54, 55, "AAkEAws+AokB/wGEg//Awk//gTE//gAwcPCYt/CYkDCYsfCYv//A0F4A0ECYg0BCYggBCYn/KwhBBGgl/EAgtBEAgMBEAZOBEAgMBEAYZB/+ABggTDBgQnDAoIaDJoIaDFgIABDQQFC74aBBgX8v4aBEwWBDQQgB/EHDQQ6BwEfGoX/+AJBDQMDWAKMBDQMPAQIaDiBFCPAgaDU4hrDDQiuDDX4acSAIaCA="),
U: image(52, 55, "AAMP/gGE//ABlH/AAnvAon+Bk5EDv/vIgcHBkHPBgZwBBgn/Bi8B/+PBgcf/AMFw/wBgYEDgED/6qEv4MEKYK3F8AFDj7EED4LREv/4CQn/wASEFginBDAgfEDAIfDn67BC4YABH4QXBCQcHZoQkEEoYMCHAYlBFYZEBLwk/MgpQEAAw"),
E: image(58, 45, "h//AAfwgYGE/0AAwn/wE/AwngDgv4DjhDCv/wJQkf/gGEg//AwkB//AA4gc/Dn4cjbAv/34GF94GF/YGF/wcjwA="),
  O: image(57, 54, "AAcf+AGEh/8AwkH/wGEgf/AwkB/+AA4n/4AGEv/gAwk/GIsf/A4P/4AE+F/Awn4n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AIADh5QCQAhQBCrM/Myk/M3JQGh5QFMyIRBAH6NB"),
YO: image(50, 49, "v//AAefAonnAon5Aon+DDA1DgP/wA8E8AFDj/4AocHDFZjfDCJjxDD5WE/+/AonvAon7PgoYX/g3DAAQ"),

};
const hiragana = {

// hiragana

A: image(52, 50, "gEB/wGEn/AAocD/gMcg//AAfgv4FD/wMYFIRNa54HDgYyCBgYsEBgX/+AGBHQYpBCQQaCh4JBJQPwgIdBBAP/wASB4H/j/8MIP8j5fBBIP/4P8gf+j/7/hVBj/jA4PH/C/Bn4RBv8Aj/3/Ef55FB/9/wI+D+/wj40BHwIWBL4QJB+BFBwAmB/4MBD4M/94MBD4JAB/4cBNYN/BgM//AsB/n/z4bBQgOHX4QVB/B3B/CQCAQTSC8BFCB4Q4CB4UAgIIBRQOAXojREn/gaIgAC"),
I:image(58, 50, "v/gAgUggEf/AGCnkAg/+AwU/gEB/+AAwQZBDgcP/gcECQIcFCQIJCCol/4AGBgYLBj/wCokHCAIABFAIQCCon/DgQECn4cDCoItCAAI+BDggVCLoZeB+BgCCocPPQZUBwZdDJAQcEGAIcEGAIcEGQPDDghIBDggyBDggyBx4cBjxIC8aaCCAIyBLAMDM4IyBSARnC//HUIk/+IyBCASdBLAJKCGQOf/kDJQV/GQRKCJ4XgEYRPC/CoCDgOHNwl/8P/84jCDgM//5HCDgMHAwIjBgP8DwIsBQgYVBSQgVBaYZnCTIgtBbQhDCUAYkCfwYOCGIgAHA"),
U: image(46, 50, "h//Aoc////8AFBAgIABgEDAofACwIAB/wWD//4CwgdBCIeAFQUfCwIADCwIAMj//+AEBv4tDAgQLBHAYFBAgf/8YFE54FECwRTB/wkCAoP7IAd/OgR2CKwcBQ4kH/hMEJYQcC4AWIh4WEn4tJg6EEj6EEVgIQDE4l/CAbABCAZqBBQgQDBQIQCXwIyCYYTIFeIhlCBQjxCLIQWBMgbdFvzYJ"),
E:image(55, 50, "gF//4GE/4AB+AFBgIGC/+AgEDAwYNBg4FC/wGBh4GC/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CCYJrCgf8CYkP+BlBCYQaBv6GDOwQaECYIaEKwIaD4JWDgP+CYIaCg/4NQYTB8Z+BFwef+4aCMgN/74aCn/z/zXCIAOH/IaCh5CB44aBJoU+a4QyBwFwDQLGBCAOBX4adBGIJMBRIQaBUYI4CDQJnDFYJ7EDQKzCDQYECgA="),
WO: image(52, 49, "AAMf+AFDgP+Bgk/8AFDgYMM/gkD/4AC+EBAof/BkA5FhEAg45Cg/AgF/AQMBBIMP/4DB//gE4Xwn5dBn4GB74IBgY0Fv4FD8AfBAoYfB/gbBIAIiBg///A7B/+A/4rBCQIxBBAISB/ghBCQeBEoIMBCQI0BBgQSCDIYSB54MBgIlB+AMCj0H/0PBgIABHQQMBOgP4BgZBBBwTDCMYIMDKIIMRWQQmDAwUMYYqyBAoaxBN4IMEV4QMCcggMBWwbZCAweA"), 
N: image(54, 49, "AAMHAwsf8AGE/+AAocD/wTF+AGEv/ACZUP/ATKgP/CYv8Awk/IQgTBIQkHCYxCFCYxWTIQxWGFAhCBAwkPAwJCE/5KDCYQiBhhCBAwJlBn+Aj/+/49BDoP/8IDBgf8IQIDBKgUf/EPLAJUBv/gn/AFgKZCAIMHCIP4DQSXBAIIaC/+BCIIaBYwKZCLwIuBCYLRCFwIKBEYX/CYUfEYP4TIRACCYQ+BwZUBDwIYBOgITCRAQVCEIP//0BYISjB+CtDUYRNBAwQ5Bg7gDBQIA="),

};
const keys = [
  "A","I","U","E","O",
  "HA","HI","HU","HE","HO",
  "KA","KI","KU","KE","KO",
  "MA","MI","MU","ME","MO",
  "NA","NI","NU","NE","NO",
  "RA","RI","RU","RE","RO",
  "SA","SI","SU","SE","SO",
  "TA","TI","TU","TE","TO",
  "WA","WO","YO","YU","N",
 ];
let kana = katakana.KA;
let scroll = 0;
// const keys = Object.keys(katakana).sort();
// console.log(keys);
let hiramode = false;
let curkana = 'KA';

console.log("StartupTime: "+startupTime.diff());

function next () {
  const off = keys.indexOf(curkana);
  if (off !== -1 && off + 1 < keys.length) {
    return keys[off + 1];
  }
  return keys[0];
}

function randKana() {
  try {
    let index = 0 | (Math.random() * keys.length);
    curkana = keys[index];
  } catch (e) {
    randKana();
  }
}
// const bench = benchStart();
// console.log("-->" + bench.diff());

function prev () {
  const off = keys.indexOf(curkana);
  if (off > 0) {
    return keys[off - 1];
  }
  return keys[keys.length - 1];
}
let color = 0;
const colors = [
  () => g.setColor(0,1,0),
  () => g.setColor(1,1,0),
  () => g.setColor(0,1,1),
  () => g.setColor(1,1,1),
  // too dark
  () => g.setColor(0,0,1),
  () => g.setColor(0,0,0),
  () => g.setColor(1,0,0),
];

function nextColor() {
  if (color + 1 >= colors.length) {
    color = 0;
  } else {
    color++;
  }
}
function prevColor() {
  if (color < 1) {
    color = colors.length - 1;
  } else {
    color--;
  }
}

function render(hhmm) {
  g.setFontAlign(-1, -1, 0);
  g.setBgColor(0, 0, 0);
  g.setColor(0, 0, 0);
    const whitecolor = color > 3;
    colors[color]();
    g.fillRect(0, 30, w, h);

    g.setFont('Vector', 50);
    if (whitecolor) {
      g.setColor(0, 0, 0);
    } else {
      g.setColor(0.5, 0.5, 0.5);
    }
    x = 26;
    y = h - 42;
    g.drawString(hhmm, x - 3, y - 3);
    if (whitecolor) {
      g.setColor(1, 1, 1);
    } else {
      g.setColor(0, 0, 0);
    }
    g.drawString(hhmm, x, y - 1);
  
  drawKana();
  drawMonthDay();
 // Bangle.drawWidgets(); // :? always draw?
}

function drawMonthDay() {
  g.setFont('Vector', 20);
  g.setColor(1,1,1);
  g.setFontAlign(-1, -1, 0);
  g.drawString(month, 4, 112);
  g.setFontAlign(1, -1, 0);
  g.drawString(day, w, 112);
}

function getPhoneme(k) {
  switch (k) {
    case "TU": return "TSU";
    case "TI": return "CHI";
    case "SI": return "SHI";
    case "HU": return "FU";
  }
  return k;
}

var ohhmm = '';
var ypos = 0;
var xpos = 0;
var zpos = 1;
function drawKana (x, y) {
  if (!x) {
    x = 4 + (g.getWidth() / 6);
  }
  if (!y) {
    y = 40;
  }
  x += xpos;
  y += ypos;
  g.setColor(0, 0, 0);
  g.fillRect(0, 30, g.getWidth(), 6 * (h / 8) + 1);
  g.setColor(1, 1, 1);
  x -= ((zpos) - 1)*50;
  y -= (zpos - 1)*50;
  kana = hiramode ? hiragana[curkana] : katakana[curkana];
  if (guard) {
  g.setColor(0.8,0.8,0.8);
  }
  g.drawImage(kana, x + 20, y, { scale: 1.6 * zpos });
  g.setColor(1, 1, 1);
  g.setFont('Vector', 24);
  g.drawString(getPhoneme(curkana), 4, 32);
  if (hiramode) {
    g.setColor(0.2,0.2,0.2)
    g.drawString('K', w - 20, 32);
    g.setColor(1, 1, 1);
    g.drawString('H', w - 20, 32+24);
  } else {
     g.setColor(1, 1, 1);
    g.drawString('K', w - 20, 32);
    g.setColor(0.2,0.2,0.2)
    g.drawString('H', w - 20, 32+24);
  }
 // g.drawString(hiramode ? 'H' : 'K', w - 20, 32);
}

function tickWatch () {
  const now = Date();
  month = now.getMonth() + 1;
  day = now.getDate();
  function zpad (n) {
    return (n < 10) ? '0' + n : n;
  }
  const hhmm = zpad(now.getHours()) + ':' + zpad(now.getMinutes());
  if (hhmm !== ohhmm) {
    ohhmm = hhmm;
    randKana();
    render(hhmm);
  }
}
let guard = false;
function hiraPush(d,dx) {
  if (guard) {
    return;
  }
  xpos = 0;
  ypos = 0;
  zpos = 1;
  guard = true;
  var count = 2;
  function paint() {
    count--;
    if (count < 0) {
      guard = false;
      xpos = 0;
      ypos = 0;
      zpos = 1;
      render(ohhmm);
      return;
    }
    zpos -= 0.04;
    render(ohhmm);
    setTimeout(paint, 100);
  }
  setTimeout (paint, 5);
}

function hiraSwipe(d,dx, dostuff) {
  if (guard) {
    return;
  }
  if (dx) {
    ypos = 0;
  } else {
    ypos = (d * 4);
  }
  xpos = 0;
  guard = true;
  var count = 2;
  function paint() {
    count--;
    if (count < 0) {
      if (dx) {
        curkana = d>0?prev():next();
      } else {
        if (dostuff) {
          hiramode = !hiramode;
        }
      }
      guard = false;
      xpos = 0;
      ypos = 0;
      render(ohhmm);
      return;
    }
    if (dx) {
      xpos += (8*d);
    } else {
      ypos -= (4*d);
    }
    render(ohhmm);
    setTimeout(paint, 5);
  }
  setTimeout (paint, 5);
}

Bangle.on('touch', function (tap, top) {
  if (top.y < (h / 1.5)) {
    if (top.x > w /2) {
    //hiramode = !hiramode;
    if (hiramode) {
      hiraSwipe(1,0, hiramode);
    } else {
      hiraSwipe(-1,0, !hiramode);
    }
    } else {
      hiraSwipe(1,1,1);
    }
  } else if (top.x < w / 2) {
    nextColor();
    hiraPush();
   // curkana = prev();
  } else {
    prevColor();
    hiraPush();
   // curkana = next();
  }
  render(ohhmm);
});
Bangle.on('swipe', function (x,y) {
  if (x > 0) {
   // nextColor();
    hiraSwipe(1, 1);
  } else if (x < 0) {
   // prevColor();
    hiraSwipe(-1,1);
  } else if (y < 0) {
    hiraSwipe(1, 0, hiramode);
  } else if (y > 0) {
    hiraSwipe(-1, 0, !hiramode);
  }
  render(ohhmm);
});

g.clear(true);
// show launcher when button pressed
Bangle.setUI('clock');
Bangle.loadWidgets();
Bangle.drawWidgets();

// redraw widgets every 10 minutes
setInterval(function() {
    // maybe not always necessary
    Bangle.drawWidgets();
}, 1000 * 60 * 10);
tickWatch();
setInterval(tickWatch, 1000 * 60);


