~jojo/jojos-hue

55988d34443b99b70f84962cd44595e8119f830f — JoJo 14 days ago 1cb77e9
web ui w color picker & esp32 works &
R client/jojos-hue.ino => client/client.ino +14 -14
@@ 10,7 10,7 @@
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS 48
#define MAX_MILLIAMPS 1000
#define MAX_MILLIAMPS 2000
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
#define CONN_ETH
// ---------------------------------------------------------


@@ 36,12 36,12 @@ EthernetClient client;
#define NET
// ---------------------------------------------------------
#elif                             defined(CONN_WIFI)
// #include <WiFi.h>
#include <WiFi.h>
// #include <WiFiClient.h>
// #include <WebServer.h>
// #include <ESPmDNS.h>
// #include "secrets.h"
// WebServer server(80);
#include "secrets.h"
WiFiClient client;
#define NET
// ---------------------------------------------------------
#                                 else


@@ 79,16 79,16 @@ void setup() {
    Serial.print("IP address: ");
    Serial.println(Ethernet.localIP());
#elif defined(CONN_WIFI)
    // WiFi.mode(WIFI_STA);
    // WiFi.begin(ssid, password);
    // while (WiFi.status() != WL_CONNECTED) {
    //     delay(300);
    //     Serial.print(".");
    // }
    // Serial.print("\nConnected to ");
    // Serial.println(ssid);
    // Serial.print("IP address: ");
    // Serial.println(WiFi.localIP());
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
        delay(300);
        Serial.print(".");
    }
    Serial.print("\nConnected to ");
    Serial.println(ssid);
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
    // if (MDNS.begin("esp32")) {
    //     Serial.println("MDNS responder started");
    // }

M server/Cargo.lock => server/Cargo.lock +1674 -3
@@ 3,14 3,1685 @@
version = 3

[[package]]
name = "aead"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331"
dependencies = [
 "generic-array",
]

[[package]]
name = "aes"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
dependencies = [
 "aes-soft",
 "aesni",
 "cipher",
]

[[package]]
name = "aes-gcm"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da"
dependencies = [
 "aead",
 "aes",
 "cipher",
 "ctr",
 "ghash",
 "subtle",
]

[[package]]
name = "aes-soft"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072"
dependencies = [
 "cipher",
 "opaque-debug",
]

[[package]]
name = "aesni"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
dependencies = [
 "cipher",
 "opaque-debug",
]

[[package]]
name = "anyhow"
version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf"

[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"

[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"

[[package]]
name = "async-attributes"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5"
dependencies = [
 "quote",
 "syn",
]

[[package]]
name = "async-channel"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
dependencies = [
 "concurrent-queue",
 "event-listener",
 "futures-core",
]

[[package]]
name = "async-dup"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7427a12b8dc09291528cfb1da2447059adb4a257388c2acd6497a79d55cf6f7c"
dependencies = [
 "futures-io",
 "simple-mutex",
]

[[package]]
name = "async-executor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965"
dependencies = [
 "async-task",
 "concurrent-queue",
 "fastrand",
 "futures-lite",
 "once_cell",
 "slab",
]

[[package]]
name = "async-global-executor"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6"
dependencies = [
 "async-channel",
 "async-executor",
 "async-io",
 "async-mutex",
 "blocking",
 "futures-lite",
 "num_cpus",
 "once_cell",
]

[[package]]
name = "async-h1"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc5142de15b549749cce62923a50714b0d7b77f5090ced141599e78899865451"
dependencies = [
 "async-channel",
 "async-dup",
 "async-std",
 "byte-pool",
 "futures-core",
 "http-types",
 "httparse",
 "lazy_static",
 "log",
 "pin-project",
]

[[package]]
name = "async-io"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b"
dependencies = [
 "concurrent-queue",
 "futures-lite",
 "libc",
 "log",
 "once_cell",
 "parking",
 "polling",
 "slab",
 "socket2",
 "waker-fn",
 "winapi",
]

[[package]]
name = "async-lock"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b"
dependencies = [
 "event-listener",
]

[[package]]
name = "async-mutex"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e"
dependencies = [
 "event-listener",
]

[[package]]
name = "async-process"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b21b63ab5a0db0369deb913540af2892750e42d949faacc7a61495ac418a1692"
dependencies = [
 "async-io",
 "blocking",
 "cfg-if 1.0.0",
 "event-listener",
 "futures-lite",
 "libc",
 "once_cell",
 "signal-hook",
 "winapi",
]

[[package]]
name = "async-session"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "345022a2eed092cd105cc1b26fd61c341e100bd5fcbbd792df4baf31c2cc631f"
dependencies = [
 "anyhow",
 "async-std",
 "async-trait",
 "base64 0.12.3",
 "bincode",
 "blake3",
 "chrono",
 "hmac 0.8.1",
 "kv-log-macro",
 "rand 0.7.3",
 "serde",
 "serde_json",
 "sha2",
]

[[package]]
name = "async-sse"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53bba003996b8fd22245cd0c59b869ba764188ed435392cf2796d03b805ade10"
dependencies = [
 "async-channel",
 "async-std",
 "http-types",
 "log",
 "memchr",
 "pin-project-lite 0.1.12",
]

[[package]]
name = "async-std"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952"
dependencies = [
 "async-attributes",
 "async-channel",
 "async-global-executor",
 "async-io",
 "async-lock",
 "async-process",
 "crossbeam-utils",
 "futures-channel",
 "futures-core",
 "futures-io",
 "futures-lite",
 "gloo-timers",
 "kv-log-macro",
 "log",
 "memchr",
 "num_cpus",
 "once_cell",
 "pin-project-lite 0.2.7",
 "pin-utils",
 "slab",
 "wasm-bindgen-futures",
]

[[package]]
name = "async-task"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"

[[package]]
name = "async-trait"
version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "atomic-waker"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"

[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"

[[package]]
name = "base-x"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b"

[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"

[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"

[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
 "serde",
]

[[package]]
name = "blake3"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3"
dependencies = [
 "arrayref",
 "arrayvec",
 "cc",
 "cfg-if 0.1.10",
 "constant_time_eq",
 "crypto-mac 0.8.0",
 "digest",
]

[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
 "generic-array",
]

[[package]]
name = "blocking"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"
dependencies = [
 "async-channel",
 "async-task",
 "atomic-waker",
 "fastrand",
 "futures-lite",
 "once_cell",
]

[[package]]
name = "bumpalo"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631"

[[package]]
name = "byte-pool"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8c7230ddbb427b1094d477d821a99f3f54d36333178eeb806e279bcdcecf0ca"
dependencies = [
 "crossbeam-queue",
 "stable_deref_trait",
]

[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"

[[package]]
name = "jojos-hue-server"
version = "0.1.0"
name = "cache-padded"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"

[[package]]
name = "cc"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"

[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"

[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chrono"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
 "byteorder",
 "libc",
 "num-integer",
 "num-traits",
 "serde",
 "time 0.1.44",
 "winapi",
]

[[package]]
name = "cipher"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
dependencies = [
 "generic-array",
]

[[package]]
name = "concurrent-queue"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
dependencies = [
 "cache-padded",
]

[[package]]
name = "const_fn"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7"

[[package]]
name = "constant_time_eq"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"

[[package]]
name = "cookie"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951"
dependencies = [
 "aes-gcm",
 "base64 0.13.0",
 "hkdf",
 "hmac 0.10.1",
 "percent-encoding",
 "rand 0.8.4",
 "sha2",
 "time 0.2.27",
 "version_check",
]

[[package]]
name = "cpufeatures"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
dependencies = [
 "libc",
]

[[package]]
name = "cpuid-bool"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba"

[[package]]
name = "crossbeam-queue"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9"
dependencies = [
 "cfg-if 1.0.0",
 "crossbeam-utils",
]

[[package]]
name = "crossbeam-utils"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
dependencies = [
 "cfg-if 1.0.0",
 "lazy_static",
]

[[package]]
name = "crypto-mac"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
dependencies = [
 "generic-array",
 "subtle",
]

[[package]]
name = "crypto-mac"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a"
dependencies = [
 "generic-array",
 "subtle",
]

[[package]]
name = "ctor"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
dependencies = [
 "quote",
 "syn",
]

[[package]]
name = "ctr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f"
dependencies = [
 "cipher",
]

[[package]]
name = "dashmap"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
dependencies = [
 "cfg-if 1.0.0",
 "num_cpus",
]

[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
 "generic-array",
]

[[package]]
name = "discard"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"

[[package]]
name = "event-listener"
version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59"

[[package]]
name = "fastrand"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e"
dependencies = [
 "instant",
]

[[package]]
name = "femme"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2af1a24f391a5a94d756db5092c6576aad494b88a71a5a36b20c67b63e0df034"
dependencies = [
 "cfg-if 0.1.10",
 "js-sys",
 "log",
 "serde",
 "serde_derive",
 "serde_json",
 "wasm-bindgen",
 "web-sys",
]

[[package]]
name = "form_urlencoded"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
 "matches",
 "percent-encoding",
]

[[package]]
name = "futures-channel"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"
dependencies = [
 "futures-core",
]

[[package]]
name = "futures-core"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"

[[package]]
name = "futures-io"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"

[[package]]
name = "futures-lite"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
dependencies = [
 "fastrand",
 "futures-core",
 "futures-io",
 "memchr",
 "parking",
 "pin-project-lite 0.2.7",
 "waker-fn",
]

[[package]]
name = "futures-macro"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
dependencies = [
 "autocfg",
 "proc-macro-hack",
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "futures-task"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"

[[package]]
name = "futures-util"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"
dependencies = [
 "autocfg",
 "futures-core",
 "futures-macro",
 "futures-task",
 "pin-project-lite 0.2.7",
 "pin-utils",
 "proc-macro-hack",
 "proc-macro-nested",
 "slab",
]

[[package]]
name = "generic-array"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
 "typenum",
 "version_check",
]

[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
 "cfg-if 1.0.0",
 "libc",
 "wasi 0.9.0+wasi-snapshot-preview1",
]

[[package]]
name = "getrandom"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
 "cfg-if 1.0.0",
 "libc",
 "wasi 0.10.0+wasi-snapshot-preview1",
]

[[package]]
name = "ghash"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375"
dependencies = [
 "opaque-debug",
 "polyval",
]

[[package]]
name = "gloo-timers"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f"
dependencies = [
 "futures-channel",
 "futures-core",
 "js-sys",
 "wasm-bindgen",
 "web-sys",
]

[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
 "libc",
]

[[package]]
name = "hkdf"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f"
dependencies = [
 "digest",
 "hmac 0.10.1",
]

[[package]]
name = "hmac"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840"
dependencies = [
 "crypto-mac 0.8.0",
 "digest",
]

[[package]]
name = "hmac"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
dependencies = [
 "crypto-mac 0.10.1",
 "digest",
]

[[package]]
name = "http-client"
version = "6.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea880b03c18a7e981d7fb3608b8904a98425d53c440758fcebf7d934aa56547c"
dependencies = [
 "async-trait",
 "cfg-if 1.0.0",
 "dashmap",
 "http-types",
 "log",
]

[[package]]
name = "http-types"
version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad"
dependencies = [
 "anyhow",
 "async-channel",
 "async-std",
 "base64 0.13.0",
 "cookie",
 "futures-lite",
 "infer",
 "pin-project-lite 0.2.7",
 "rand 0.7.3",
 "serde",
 "serde_json",
 "serde_qs",
 "serde_urlencoded",
 "url",
]

[[package]]
name = "httparse"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"

[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
 "matches",
 "unicode-bidi",
 "unicode-normalization",
]

[[package]]
name = "infer"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac"

[[package]]
name = "instant"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d"
dependencies = [
 "cfg-if 1.0.0",
]

[[package]]
name = "itoa"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"

[[package]]
name = "jojos-hue-server"
version = "0.1.0"
dependencies = [
 "async-std",
 "byteorder",
 "serde",
 "tide",
]

[[package]]
name = "js-sys"
version = "0.3.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1866b355d9c878e5e607473cbe3f63282c0b7aad2db1dbebf55076c686918254"
dependencies = [
 "wasm-bindgen",
]

[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
dependencies = [
 "log",
]

[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"

[[package]]
name = "libc"
version = "0.2.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"

[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
 "cfg-if 1.0.0",
 "value-bag",
]

[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"

[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"

[[package]]
name = "num-integer"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
 "autocfg",
 "num-traits",
]

[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
 "autocfg",
]

[[package]]
name = "num_cpus"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [
 "hermit-abi",
 "libc",
]

[[package]]
name = "once_cell"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"

[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"

[[package]]
name = "parking"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"

[[package]]
name = "percent-encoding"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"

[[package]]
name = "pin-project"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08"
dependencies = [
 "pin-project-internal",
]

[[package]]
name = "pin-project-internal"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "pin-project-lite"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"

[[package]]
name = "pin-project-lite"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"

[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"

[[package]]
name = "polling"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25"
dependencies = [
 "cfg-if 1.0.0",
 "libc",
 "log",
 "wepoll-ffi",
 "winapi",
]

[[package]]
name = "polyval"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd"
dependencies = [
 "cpuid-bool",
 "opaque-debug",
 "universal-hash",
]

[[package]]
name = "ppv-lite86"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"

[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"

[[package]]
name = "proc-macro-nested"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"

[[package]]
name = "proc-macro2"
version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d"
dependencies = [
 "unicode-xid",
]

[[package]]
name = "quote"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [
 "proc-macro2",
]

[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
 "getrandom 0.1.16",
 "libc",
 "rand_chacha 0.2.2",
 "rand_core 0.5.1",
 "rand_hc 0.2.0",
]

[[package]]
name = "rand"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
dependencies = [
 "libc",
 "rand_chacha 0.3.1",
 "rand_core 0.6.3",
 "rand_hc 0.3.1",
]

[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
 "ppv-lite86",
 "rand_core 0.5.1",
]

[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
 "ppv-lite86",
 "rand_core 0.6.3",
]

[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
 "getrandom 0.1.16",
]

[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
 "getrandom 0.2.3",
]

[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
 "rand_core 0.5.1",
]

[[package]]
name = "rand_hc"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
dependencies = [
 "rand_core 0.6.3",
]

[[package]]
name = "route-recognizer"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56770675ebc04927ded3e60633437841581c285dc6236109ea25fbf3beb7b59e"

[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
 "semver",
]

[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"

[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
 "semver-parser",
]

[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"

[[package]]
name = "serde"
version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
dependencies = [
 "serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "serde_json"
version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950"
dependencies = [
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "serde_qs"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a72808528a89fa9eca23bbb6a1eb92cb639b881357269b6510f11e50c0f8a9"
dependencies = [
 "percent-encoding",
 "serde",
 "thiserror",
]

[[package]]
name = "serde_urlencoded"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
dependencies = [
 "form_urlencoded",
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "sha1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"

[[package]]
name = "sha2"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa"
dependencies = [
 "block-buffer",
 "cfg-if 1.0.0",
 "cpufeatures",
 "digest",
 "opaque-debug",
]

[[package]]
name = "signal-hook"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1"
dependencies = [
 "libc",
 "signal-hook-registry",
]

[[package]]
name = "signal-hook-registry"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
dependencies = [
 "libc",
]

[[package]]
name = "simple-mutex"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38aabbeafa6f6dead8cebf246fe9fae1f9215c8d29b3a69f93bd62a9e4a3dcd6"
dependencies = [
 "event-listener",
]

[[package]]
name = "slab"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"

[[package]]
name = "socket2"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad"
dependencies = [
 "libc",
 "winapi",
]

[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"

[[package]]
name = "standback"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff"
dependencies = [
 "version_check",
]

[[package]]
name = "stdweb"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
dependencies = [
 "discard",
 "rustc_version",
 "stdweb-derive",
 "stdweb-internal-macros",
 "stdweb-internal-runtime",
 "wasm-bindgen",
]

[[package]]
name = "stdweb-derive"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
 "proc-macro2",
 "quote",
 "serde",
 "serde_derive",
 "syn",
]

[[package]]
name = "stdweb-internal-macros"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [
 "base-x",
 "proc-macro2",
 "quote",
 "serde",
 "serde_derive",
 "serde_json",
 "sha1",
 "syn",
]

[[package]]
name = "stdweb-internal-runtime"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"

[[package]]
name = "subtle"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"

[[package]]
name = "sval"
version = "1.0.0-alpha.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08"

[[package]]
name = "syn"
version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
dependencies = [
 "proc-macro2",
 "quote",
 "unicode-xid",
]

[[package]]
name = "thiserror"
version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88"
dependencies = [
 "thiserror-impl",
]

[[package]]
name = "thiserror-impl"
version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "tide"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c459573f0dd2cc734b539047f57489ea875af8ee950860ded20cf93a79a1dee0"
dependencies = [
 "async-h1",
 "async-session",
 "async-sse",
 "async-std",
 "async-trait",
 "femme",
 "futures-util",
 "http-client",
 "http-types",
 "kv-log-macro",
 "log",
 "pin-project-lite 0.2.7",
 "route-recognizer",
 "serde",
 "serde_json",
]

[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
 "libc",
 "wasi 0.10.0+wasi-snapshot-preview1",
 "winapi",
]

[[package]]
name = "time"
version = "0.2.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242"
dependencies = [
 "const_fn",
 "libc",
 "standback",
 "stdweb",
 "time-macros",
 "version_check",
 "winapi",
]

[[package]]
name = "time-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1"
dependencies = [
 "proc-macro-hack",
 "time-macros-impl",
]

[[package]]
name = "time-macros-impl"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f"
dependencies = [
 "proc-macro-hack",
 "proc-macro2",
 "quote",
 "standback",
 "syn",
]

[[package]]
name = "tinyvec"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338"
dependencies = [
 "tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"

[[package]]
name = "typenum"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"

[[package]]
name = "unicode-bidi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085"

[[package]]
name = "unicode-normalization"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
dependencies = [
 "tinyvec",
]

[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"

[[package]]
name = "universal-hash"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05"
dependencies = [
 "generic-array",
 "subtle",
]

[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
 "form_urlencoded",
 "idna",
 "matches",
 "percent-encoding",
 "serde",
]

[[package]]
name = "value-bag"
version = "1.0.0-alpha.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae"
dependencies = [
 "ctor",
 "sval",
 "version_check",
]

[[package]]
name = "version_check"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"

[[package]]
name = "waker-fn"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"

[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"

[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"

[[package]]
name = "wasm-bindgen"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e68338db6becec24d3c7977b5bf8a48be992c934b5d07177e3931f5dc9b076c"
dependencies = [
 "cfg-if 1.0.0",
 "serde",
 "serde_json",
 "wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f34c405b4f0658583dba0c1c7c9b694f3cac32655db463b56c254a1c75269523"
dependencies = [
 "bumpalo",
 "lazy_static",
 "log",
 "proc-macro2",
 "quote",
 "syn",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-futures"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a87d738d4abc4cf22f6eb142f5b9a81301331ee3c767f2fef2fda4e325492060"
dependencies = [
 "cfg-if 1.0.0",
 "js-sys",
 "wasm-bindgen",
 "web-sys",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d5a6580be83b19dc570a8f9c324251687ab2184e57086f71625feb57ec77c8"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3775a030dc6f5a0afd8a84981a21cc92a781eb429acef9ecce476d0c9113e92"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "wasm-bindgen-backend",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c279e376c7a8e8752a8f1eaa35b7b0bee6bb9fb0cdacfa97cc3f1f289c87e2b4"

[[package]]
name = "web-sys"
version = "0.3.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a84d70d1ec7d2da2d26a5bd78f4bca1b8c3254805363ce743b7a05bc30d195a"
dependencies = [
 "js-sys",
 "wasm-bindgen",
]

[[package]]
name = "wepoll-ffi"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
dependencies = [
 "cc",
]

[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
 "winapi-i686-pc-windows-gnu",
 "winapi-x86_64-pc-windows-gnu",
]

[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

M server/Cargo.toml => server/Cargo.toml +4 -1
@@ 6,4 6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
byteorder = "*"
\ No newline at end of file
byteorder = "*"
tide = "0.16"
async-std = { version = "1.10", features = ["attributes"] }
serde = { version = "1.0", features = ["derive"] }
\ No newline at end of file

M server/src/main.rs => server/src/main.rs +63 -24
@@ 2,46 2,84 @@ use byteorder::{ByteOrder, LittleEndian};
use std::{
    io::{Read, Write},
    iter::once,
    net,
    sync::mpsc,
    net::{SocketAddr, TcpListener, TcpStream},
    sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender},
    thread,
    time::{Duration, Instant},
};
use tide::{prelude::*, Request};

const FPS: f32 = 120.0;
const TIMEOUT: Duration = Duration::from_millis(200);

type Con = (TcpStream, SocketAddr);
type Client = (Sender<Vec<RGB>>, u16);

#[derive(Clone, Copy, Deserialize, Debug)]
struct RGB {
    r: f32,
    g: f32,
    b: f32,
}

fn main() {
    let (clients_tx, clients_rx) = mpsc::channel::<(net::TcpStream, net::SocketAddr)>();
#[derive(Clone, Copy, Debug)]
enum Cmd {
    All(RGB),
}

#[async_std::main]
async fn main() -> tide::Result<()> {
    let (clients_tx, clients_rx) = channel();
    let (cmd_tx, cmd_rx) = sync_channel(8);

    thread::spawn(move || {
        let listener = net::TcpListener::bind("0.0.0.0:7017").unwrap();
        let listener = TcpListener::bind("0.0.0.0:7017").unwrap();
        loop {
            if let Ok(c) = listener.accept() {
            if let Some(c) = listener.accept().ok().and_then(setup_client) {
                clients_tx.send(c).unwrap();
            }
        }
    });

    thread::spawn(move || controller(clients_rx, cmd_rx));

    let mut web = tide::new();
    web.at("/").serve_file("static/index.html")?;
    web.at("/static").serve_dir("static/")?;
    web.at("/all")
        .get(move |req| all_handler(req, cmd_tx.clone()));
    web.listen("192.168.0.41:8558").await?;
    Ok(())
}

async fn all_handler(req: Request<()>, tx: SyncSender<Cmd>) -> tide::Result {
    let rgb = req.query()?;
    tx.send(Cmd::All(rgb)).unwrap();
    Ok("cool, ty".into())
}

fn controller(clients_rx: Receiver<Client>, cmd_rx: Receiver<Cmd>) {
    let mut clients = Vec::new();
    let t0 = Instant::now();
    let mut tprev = Instant::now();
    let mut cmd = Cmd::All(RGB {
        r: 0.0,
        g: 0.0,
        b: 0.0,
    });
    loop {
        if let Ok(con) = clients_rx.try_recv() {
            if let Some(client) = setup_client(con) {
                clients.push(client);
            }
        if let Ok(client) = clients_rx.try_recv() {
            clients.push(client);
        }

        let t = t0.elapsed().as_secs_f64();
        if let Ok(new_cmd) = cmd_rx.try_recv() {
            println!("New command: {:?}", new_cmd);
            cmd = new_cmd;
        }
        clients = clients
            .into_iter()
            .filter_map(|(tx, nleds)| tx.send(lightf(t, nleds)).map(|()| (tx, nleds)).ok())
            .filter_map(|(tx, nleds)| tx.send(lightf(cmd, t, nleds)).map(|()| (tx, nleds)).ok())
            .collect();
        let dt = tprev.elapsed();
        tprev = Instant::now();


@@ 52,9 90,7 @@ fn main() {
    }
}

fn setup_client(
    (mut stream, addr): (net::TcpStream, net::SocketAddr),
) -> Option<(mpsc::Sender<Vec<RGB>>, u16)> {
fn setup_client((mut stream, addr): Con) -> Option<Client> {
    stream
        .set_write_timeout(Some(TIMEOUT))
        .map_err(|e| println!("Error setting write timeout. {:?}", e))


@@ 65,7 101,7 @@ fn setup_client(
        .map_err(|e| println!("Error reading client num leds. {:?}", e))
        .ok()?;
    let nleds = LittleEndian::read_u16(&buf);
    let (tx, rx) = mpsc::channel::<Vec<RGB>>();
    let (tx, rx) = channel::<Vec<RGB>>();
    thread::spawn(move || loop {
        let magic_cookie = b"satan";
        let color_data = rx


@@ 73,7 109,7 @@ fn setup_client(
            .unwrap()
            .into_iter()
            .flat_map(|RGB { r, g, b }| once(r).chain(once(g)).chain(once(b)))
            .map(|x| (x * 255.999) as u8);
            .map(|x| (x * 256.0).min(256.0).max(0.0) as u8);
        let data = magic_cookie
            .iter()
            .cloned()


@@ 88,12 124,15 @@ fn setup_client(
    Some((tx, nleds))
}

fn lightf(t: f64, nleds: u16) -> Vec<RGB> {
    (0..nleds)
        .map(|_i| RGB {
            r: (t * 2.0).sin() as f32 * 0.5 + 0.5,
            g: (t * 5.0).sin() as f32 * 0.5 + 0.5,
            b: (t * 7.0).sin() as f32 * 0.5 + 0.5,
        })
        .collect()
fn lightf(cmd: Cmd, _t: f64, nleds: u16) -> Vec<RGB> {
    match cmd {
        Cmd::All(c) => vec![c; nleds as usize],
    }
    // (0..nleds)
    //     .map(|_i| RGB {
    //         r: (t * 2.0).sin() as f32 * 0.5 + 0.5,
    //         g: (t * 5.0).sin() as f32 * 0.5 + 0.5,
    //         b: (t * 7.0).sin() as f32 * 0.5 + 0.5,
    //     })
    //     .collect()
}

A server/static/index.html => server/static/index.html +16 -0
@@ 0,0 1,16 @@
<html>
  <head>
    <link rel="stylesheet" href="/static/reinvented-color-wheel.css">
    <link rel="stylesheet" href="/static/main.css">
  </head>
  <body>
    <main>
      <h1>jojos hue</h1>

      <div id="color-picker-container"></div>
    </main>

    <script lang="javascript" src="/static/reinvented-color-wheel.js"></script>
    <script lang="javascript" src="/static/main.js"></script>
  </body>
</html>

A server/static/main.css => server/static/main.css +15 -0
@@ 0,0 1,15 @@
body {
    margin: 0;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

main > button {
    font-size: 3em;
    padding: 0.4em 0.8em;
    margin: 0.2em;
}

A server/static/main.js => server/static/main.js +49 -0
@@ 0,0 1,49 @@
// create a new color picker
var colorWheel = new ReinventedColorWheel({
    // appendTo is the only required property. specify the parent element of the color wheel.
    appendTo: document.getElementById("color-picker-container"),

    // followings are optional properties and their default values.

    // initial color (can be specified in hsv / hsl / rgb / hex)
    rgb: [255, 0, 0],
    // hsl: [0, 100, 50],
    // rgb: [255, 0, 0],
    // hex: "#ff0000",

    // appearance
    wheelDiameter: 900,
    wheelThickness: 80,
    handleDiameter: 40,
    wheelReflectsSaturation: true,

    // handler
    onChange: (color) => {
        // the only argument is the ReinventedColorWheel instance itself.
        console.log("rgb:", color.rgb[0], color.rgb[1], color.rgb[2]);
        let url = "/all?" + new URLSearchParams(
            [["r", color.rgb[0] / 255.0],
             ["g", color.rgb[1] / 255.0],
             ["b", color.rgb[2] / 255.0]]).toString();
        fetch(url);
        console.log(url);
    },
});


// set color in HSV / HSL / RGB / HEX
// colorWheel.hsv = [240, 100, 100];
// colorWheel.hsl = [120, 100, 50];
// colorWheel.rgb = [255, 128, 64];
// colorWheel.hex = '#888888';

// get color in HSV / HSL / RGB / HEX
// console.log("hsv:", colorWheel.hsv[0], colorWheel.hsv[1], colorWheel.hsv[2]);
// console.log("hsl:", colorWheel.hsl[0], colorWheel.hsl[1], colorWheel.hsl[2]);
// console.log("rgb:", colorWheel.rgb[0], colorWheel.rgb[1], colorWheel.rgb[2]);
// console.log("hex:", colorWheel.hex);

// please call redraw() after changing some appearance properties.
// colorWheel.wheelDiameter = 400;
// colorWheel.wheelThickness = 40;
// colorWheel.redraw();

A server/static/reinvented-color-wheel.css => server/static/reinvented-color-wheel.css +47 -0
@@ 0,0 1,47 @@
.reinvented-color-wheel,
.reinvented-color-wheel--hue-wheel,
.reinvented-color-wheel--hue-handle,
.reinvented-color-wheel--sv-space,
.reinvented-color-wheel--sv-handle {
  touch-action: manipulation;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.reinvented-color-wheel {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: 50%;
}

.reinvented-color-wheel--hue-wheel {
  border-radius: 50%;
}

.reinvented-color-wheel--sv-space {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: auto;
}

.reinvented-color-wheel--hue-handle,
.reinvented-color-wheel--sv-handle {
  position: absolute;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px black inset;
}

.reinvented-color-wheel--hue-handle {
  pointer-events: none;
}

A server/static/reinvented-color-wheel.js => server/static/reinvented-color-wheel.js +458 -0
@@ 0,0 1,458 @@
var ReinventedColorWheel = (function () {
  'use strict';

  function hsl2hsv(hsl) {
    var h = hsl[0],
        s = hsl[1] / 100,
        l = hsl[2] / 100,
        sv, v;

    if(l === 0) {
        // no need to do calc on black
        // also avoids divide by 0 error
        return [0, 0, 0];
    }

    l *= 2;
    s *= (l <= 1) ? l : 2 - l;
    v = (l + s) / 2;
    sv = (2 * s) / (l + s);
    return [h, sv * 100, v * 100];
  }

  var hsl2hsv_1 = hsl2hsv;

  function hsv2hsl(hsv) {
    var h = hsv[0],
        s = hsv[1] / 100,
        v = hsv[2] / 100,
        sl, l;

    l = (2 - s) * v;
    sl = s * v;
    sl /= (l <= 1) ? l : 2 - l;
    sl = sl || 0;
    l /= 2;
    return [h, sl * 100, l * 100];
  }

  var hsv2hsl_1 = hsv2hsl;

  // http://www.rapidtables.com/convert/color/rgb-to-hsv.htm
  function rgb2hsv(rgb) {
      var r = rgb[0];
      var g = rgb[1];
      var b = rgb[2];
      var max = Math.max(r, g, b);
      var min = Math.min(r, g, b);
      var delta = max - min;
      var h = delta && 60 * (max === r ? (g - b) / delta % 6 :
          max === g ? (b - r) / delta + 2 :
              (r - g) / delta + 4);
      return [
          h < 0 ? h + 360 : h,
          max && delta * 100 / max,
          max * 100 / 255,
      ];
  }

  // http://www.rapidtables.com/convert/color/hsv-to-rgb.htm
  function hsv2rgb(hsv) {
      var h = hsv[0] / 60;
      var s = hsv[1] / 100;
      var v = hsv[2] / 100;
      var c = v * s;
      var x = c * (1 - Math.abs(h % 2 - 1));
      var m = v - c;
      var _x = (x + m) * 255 + .5 | 0;
      var _c = (c + m) * 255 + .5 | 0;
      var _0 = m * 255 + .5 | 0;
      var _h = h | 0;
      return (_h === 1 ? [_x, _c, _0] :
          _h === 2 ? [_0, _c, _x] :
              _h === 3 ? [_0, _x, _c] :
                  _h === 4 ? [_x, _0, _c] :
                      _h === 5 ? [_c, _0, _x] :
                          [_c, _x, _0]);
  }

  function clamp$1(val, min, max) {
    return Math.min(Math.max(val, min), max);
  }

  var clamp_1 = clamp$1;

  var clamp = clamp_1;

  function componentToHex(c) {
    var value = Math.round(clamp(c, 0, 255));
    var hex   = value.toString(16);

    return hex.length == 1 ? "0" + hex : hex;
  }

  function rgb2hex(rgb) {
    var alpha = rgb.length === 4 ? componentToHex(rgb[3] * 255) : "";

    return "#" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]) + alpha;
  }

  var rgb2hex_1 = rgb2hex;

  function expand(hex) {
    var result = "#";

    for (var i = 1; i < hex.length; i++) {
      var val = hex.charAt(i);
      result += val + val;
    }

    return result;
  }

  function hex(hex) {
    // #RGB or #RGBA
    if(hex.length === 4 || hex.length === 5) {
      hex = expand(hex);
    }

    var rgb = [
      parseInt(hex.substring(1,3), 16),
      parseInt(hex.substring(3,5), 16),
      parseInt(hex.substring(5,7), 16)
    ];

    // #RRGGBBAA
    if (hex.length === 9) {
      var alpha = parseFloat((parseInt(hex.substring(7,9), 16) / 255).toFixed(2));
      rgb.push(alpha);
    }

    return rgb;
  }

  var hex_1 = hex;

  function normalizeHsvOrDefault(hsv, defaultHsvOrHsl) {
      if (hsv) {
          return [
              isFiniteNumber(hsv[0]) ? normalizeHue(hsv[0]) : defaultHsvOrHsl[0],
              isFiniteNumber(hsv[1]) ? normalizePercentage(hsv[1]) : defaultHsvOrHsl[1],
              isFiniteNumber(hsv[2]) ? normalizePercentage(hsv[2]) : defaultHsvOrHsl[2],
          ];
      }
      else {
          return defaultHsvOrHsl;
      }
  }
  function normalizeHsl(hsl) {
      return [
          normalizeHue(hsl[0]),
          normalizePercentage(hsl[1]),
          normalizePercentage(hsl[2]),
      ];
  }
  function normalizeHue(value) {
      var modulo = Math.round(value % 360 * 10) / 10;
      return modulo < 0 ? modulo + 360 : modulo;
  }
  function normalizePercentage(value) {
      return value < 0 ? 0 : value > 100 ? 100 : (value * 10 + .5 | 0) / 10;
  }
  function isFiniteNumber(n) {
      return typeof n === 'number' && isFinite(n);
  }

  var window = (typeof globalThis !== 'undefined' ? globalThis : self);

  var onDrag = 
  // for IE, Edge, Firefox, Chrome
  'PointerEvent' in window ?
      function (element, onDragStart, onDragMove) {
          element.addEventListener('pointerdown', function (event) {
              if (event.button === 0 && onDragStart(event) !== false) {
                  this.setPointerCapture(event.pointerId);
              }
          });
          element.addEventListener('pointermove', function (event) {
              if (this.hasPointerCapture(event.pointerId)) {
                  onDragMove(event);
              }
          });
      }
      // for Mobile Safari
      : 'ontouchend' in window ?
          function (element, onDragStart, onDragMove) {
              var dragging = false;
              element.addEventListener('touchstart', function (event) {
                  if (event.touches.length === 1 && onDragStart(event.touches[0]) !== false) {
                      dragging = true;
                      event.preventDefault();
                  }
              });
              element.addEventListener('touchmove', function (event) {
                  if (dragging && event.touches.length === 1) {
                      event.preventDefault();
                      onDragMove(event.touches[0]);
                  }
              });
          }
          // for Safari
          :
              function (element, onDragStart, onDragMove) {
                  var onMouseMove = function (event) {
                      onDragMove(event);
                  };
                  var onMouseUp = function () {
                      removeEventListener('mouseup', onMouseUp);
                      removeEventListener('mousemove', onMouseMove);
                  };
                  element.addEventListener('mousedown', function (event) {
                      if (event.button === 0 && onDragStart(event) !== false) {
                          addEventListener('mousemove', onMouseMove);
                          addEventListener('mouseup', onMouseUp);
                      }
                  });
              };

  var defaultOptions = {
      hsv: [0, 100, 100],
      hsl: [0, 100, 50],
      wheelDiameter: 200,
      wheelThickness: 20,
      handleDiameter: 16,
      wheelReflectsSaturation: true,
      onChange: function () { },
  };
  var Matrix = window.DOMMatrix || window.WebKitCSSMatrix || window.MSCSSMatrix;
  var inverseTransform = function (element) {
      var ancestors = [element];
      while (element = element.parentElement) {
          ancestors.push(element);
      }
      var matrix = new Matrix();
      for (var i = ancestors.length - 1; i >= 0; i--) {
          var style = getComputedStyle(ancestors[i]);
          var transform = style.transform;
          if (transform && transform !== 'none') {
              var transformOrigin = style.transformOrigin.split(' ').map(parseFloat);
              matrix = matrix
                  .translate(transformOrigin[0], transformOrigin[1])
                  .multiply(new Matrix(transform))
                  .translate(-transformOrigin[0], -transformOrigin[1]);
          }
      }
      return matrix.inverse();
  };
  var tripletsAreEqual = function (a, b) {
      return a === b || (a[0] === b[0] && a[1] === b[1] && a[2] === b[2]);
  };
  var ReinventedColorWheel = /** @class */ (function () {
      function ReinventedColorWheel(options) {
          var _this = this;
          this.options = options;
          this.wheelDiameter = this.options.wheelDiameter || defaultOptions.wheelDiameter;
          this.wheelThickness = this.options.wheelThickness || defaultOptions.wheelThickness;
          this.handleDiameter = this.options.handleDiameter || defaultOptions.handleDiameter;
          this.onChange = this.options.onChange || defaultOptions.onChange;
          this.wheelReflectsSaturation = this.options.wheelReflectsSaturation !== undefined ? this.options.wheelReflectsSaturation : defaultOptions.wheelReflectsSaturation;
          this.rootElement = this.options.appendTo.appendChild(createElementWithClass('div', 'reinvented-color-wheel'));
          this.hueWheelElement = this.rootElement.appendChild(createElementWithClass('canvas', 'reinvented-color-wheel--hue-wheel'));
          this.hueWheelContext = this.hueWheelElement.getContext('2d');
          this.hueHandleElement = this.rootElement.appendChild(createElementWithClass('div', 'reinvented-color-wheel--hue-handle'));
          this.svSpaceElement = this.rootElement.appendChild(createElementWithClass('canvas', 'reinvented-color-wheel--sv-space'));
          this.svSpaceContext = this.svSpaceElement.getContext('2d');
          this.svHandleElement = this.rootElement.appendChild(createElementWithClass('div', 'reinvented-color-wheel--sv-handle'));
          this._redrawHueWheel = function () {
              _this._redrawHueWheelRequested = false;
              var wheelDiameter = _this.wheelDiameter;
              var center = wheelDiameter / 2;
              var radius = center - _this.wheelThickness / 2;
              var TO_RAD = Math.PI / 180;
              var hslPostfix = _this.wheelReflectsSaturation ? "," + _this._hsl[1] + "%," + _this._hsl[2] + "%)" : ',100%,50%)';
              var ctx = _this.hueWheelContext;
              ctx.clearRect(0, 0, wheelDiameter, wheelDiameter);
              ctx.lineWidth = _this.wheelThickness;
              for (var i = 0; i < 360; i++) {
                  ctx.beginPath();
                  ctx.arc(center, center, radius, (i - 90.7) * TO_RAD, (i - 89.3) * TO_RAD);
                  ctx.strokeStyle = 'hsl(' + i + hslPostfix;
                  ctx.stroke();
              }
          };
          this.hueWheelContext.imageSmoothingEnabled = false;
          this.svSpaceContext.imageSmoothingEnabled = false;
          this._hsv = normalizeHsvOrDefault(options.hsv ? options.hsv :
              options.hsl ? ReinventedColorWheel.hsl2hsv(options.hsl) :
                  options.rgb ? ReinventedColorWheel.rgb2hsv(options.rgb) :
                      options.hex ? ReinventedColorWheel.rgb2hsv(ReinventedColorWheel.hex2rgb(options.hex)) :
                          undefined, defaultOptions.hsv);
          this._hsl = normalizeHsl(ReinventedColorWheel.hsv2hsl(this._hsv));
          this._rgb = ReinventedColorWheel.hsv2rgb(this._hsv);
          this._hex = ReinventedColorWheel.rgb2hex(this._rgb);
          var invertTransform = function (x, y) {
              var m = _this._inverseTransform.multiply(new Matrix("matrix(1,0,0,1," + x + "," + y + ")"));
              return { x: m.e, y: m.f };
          };
          var onDragStart = function (element) {
              _this._inverseTransform = inverseTransform(element);
              var rect = element.getBoundingClientRect();
              _this._center = invertTransform(rect.left + rect.width / 2, rect.top + rect.height / 2);
          };
          var onDragStartHue = function (event) {
              onDragStart(_this.hueWheelElement);
              var point = invertTransform(event.clientX, event.clientY);
              var x = point.x - _this._center.x;
              var y = point.y - _this._center.y;
              var wheelInnerRadius = _this.wheelDiameter / 2 - _this.wheelThickness;
              if (x * x + y * y < wheelInnerRadius * wheelInnerRadius) {
                  return false;
              }
              onDragMoveHue(event);
          };
          var onDragMoveHue = function (event) {
              var point = invertTransform(event.clientX, event.clientY);
              var x = point.x - _this._center.x;
              var y = point.y - _this._center.y;
              var angle = Math.atan2(y, x);
              _this.hsv = [angle * 180 / Math.PI + 90, _this.hsv[1], _this.hsv[2]];
          };
          var onDragMoveSv = function (event) {
              var point = invertTransform(event.clientX, event.clientY);
              var a = 100 / _this.svSpaceElement.width;
              var s = (point.x - _this._center.x) * a + 50;
              var v = (_this._center.y - point.y) * a + 50;
              _this.hsv = [_this._hsv[0], s, v];
          };
          var onDragStartSv = function (event) {
              onDragStart(_this.svSpaceElement);
              onDragMoveSv(event);
          };
          onDrag(this.hueWheelElement, onDragStartHue, onDragMoveHue);
          onDrag(this.svSpaceElement, onDragStartSv, onDragMoveSv);
          onDrag(this.svHandleElement, onDragStartSv, onDragMoveSv);
          this.redraw();
      }
      Object.defineProperty(ReinventedColorWheel.prototype, "hsv", {
          get: function () { return this._hsv; },
          set: function (value) {
              tripletsAreEqual(this._hsv, value) || this._setHSV(value);
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(ReinventedColorWheel.prototype, "hsl", {
          get: function () { return this._hsl; },
          set: function (value) {
              tripletsAreEqual(this._hsl, value) || this._setHSV(ReinventedColorWheel.hsl2hsv(value));
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(ReinventedColorWheel.prototype, "rgb", {
          get: function () { return this._rgb; },
          set: function (value) {
              tripletsAreEqual(this._rgb, value) || this._setHSV(ReinventedColorWheel.rgb2hsv(value));
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(ReinventedColorWheel.prototype, "hex", {
          get: function () { return this._hex; },
          set: function (value) {
              this._hex !== value && (this.rgb = ReinventedColorWheel.hex2rgb(value));
          },
          enumerable: false,
          configurable: true
      });
      /** @deprecated */ ReinventedColorWheel.prototype.setHSV = function () { this.hsv = arguments; };
      /** @deprecated */ ReinventedColorWheel.prototype.setHSL = function () { this.hsl = arguments; };
      ReinventedColorWheel.prototype.redraw = function () {
          this.hueWheelElement.width = this.hueWheelElement.height = this.wheelDiameter;
          this.svSpaceElement.width = this.svSpaceElement.height = (this.wheelDiameter - this.wheelThickness * 2) * Math.SQRT1_2;
          var hueHandleStyle = this.hueHandleElement.style;
          var svHandleStyle = this.svHandleElement.style;
          hueHandleStyle.width = hueHandleStyle.height = svHandleStyle.width = svHandleStyle.height = this.handleDiameter + "px";
          hueHandleStyle.marginLeft = hueHandleStyle.marginTop = svHandleStyle.marginLeft = svHandleStyle.marginTop = -this.handleDiameter / 2 + "px";
          this._redrawHueWheel();
          this._redrawHueHandle();
          this._redrawSvSpace();
          this._redrawSvHandle();
      };
      ReinventedColorWheel.prototype._setHSV = function (hsv) {
          var oldHsv = this._hsv;
          var newHsv = this._hsv = normalizeHsvOrDefault(hsv, oldHsv);
          var hueChanged = oldHsv[0] - newHsv[0];
          var svChanged = oldHsv[1] - newHsv[1] || oldHsv[2] - newHsv[2];
          if (hueChanged) {
              this._hsl = [newHsv[0], this._hsl[1], this._hsl[2]];
              this._redrawHueHandle();
              this._updateSvBackground();
          }
          if (svChanged) {
              this._hsl = normalizeHsl(ReinventedColorWheel.hsv2hsl(newHsv));
              this._redrawSvHandle();
              if (this.wheelReflectsSaturation && !this._redrawHueWheelRequested) {
                  requestAnimationFrame(this._redrawHueWheel);
                  this._redrawHueWheelRequested = true;
              }
          }
          if (hueChanged || svChanged) {
              this._rgb = ReinventedColorWheel.hsv2rgb(newHsv);
              this._hex = ReinventedColorWheel.rgb2hex(this._rgb);
              this.onChange(this);
          }
      };
      ReinventedColorWheel.prototype._redrawSvSpace = function () {
          this._updateSvBackground();
          var sideLength = this.svSpaceElement.width;
          var ctx = this.svSpaceContext;
          var saturationGradient = ctx.createLinearGradient(0, 0, sideLength, 0);
          var valueGradient = ctx.createLinearGradient(0, 0, 0, sideLength);
          saturationGradient.addColorStop(0, 'rgba(255,255,255,1)');
          saturationGradient.addColorStop(1, 'rgba(255,255,255,0)');
          valueGradient.addColorStop(0, 'rgba(0,0,0,0)');
          valueGradient.addColorStop(1, 'rgba(0,0,0,1)');
          ctx.fillStyle = saturationGradient;
          ctx.fillRect(0, 0, sideLength, sideLength);
          ctx.fillStyle = valueGradient;
          ctx.fillRect(0, 0, sideLength, sideLength);
      };
      ReinventedColorWheel.prototype._updateSvBackground = function () {
          this.svSpaceElement.style.backgroundColor = "hsl(" + this._hsv[0] + ",100%,50%)";
      };
      ReinventedColorWheel.prototype._redrawHueHandle = function () {
          var center = this.wheelDiameter / 2;
          var wheelRadius = center - this.wheelThickness / 2;
          var angle = (this._hsv[0] - 90) * Math.PI / 180;
          var hueHandleStyle = this.hueHandleElement.style;
          hueHandleStyle.left = wheelRadius * Math.cos(angle) + center + "px";
          hueHandleStyle.top = wheelRadius * Math.sin(angle) + center + "px";
      };
      ReinventedColorWheel.prototype._redrawSvHandle = function () {
          var svSpaceElementWidth = this.svSpaceElement.width;
          var svHandleStyle = this.svHandleElement.style;
          var offset = (this.wheelDiameter - svSpaceElementWidth) / 2;
          var hsv = this._hsv;
          svHandleStyle.left = offset + svSpaceElementWidth * hsv[1] / 100 + "px";
          svHandleStyle.top = offset + svSpaceElementWidth * (1 - hsv[2] / 100) + "px";
      };
      ReinventedColorWheel.default = ReinventedColorWheel;
      ReinventedColorWheel.defaultOptions = defaultOptions;
      ReinventedColorWheel.hsv2hsl = hsv2hsl_1;
      ReinventedColorWheel.hsl2hsv = hsl2hsv_1;
      ReinventedColorWheel.hsv2rgb = hsv2rgb;
      ReinventedColorWheel.rgb2hsv = rgb2hsv;
      ReinventedColorWheel.rgb2hex = rgb2hex_1;
      ReinventedColorWheel.hex2rgb = hex_1;
      return ReinventedColorWheel;
  }());
  function createElementWithClass(tagName, className) {
      var element = document.createElement(tagName);
      element.className = className;
      return element;
  }

  return ReinventedColorWheel;

}());