commit d9a9d45cb820ed4ca66f1bcaf3147d8893c8d654 Author: ocogeclub Date: Tue Jan 21 16:10:10 2020 +0900 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9466353 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.shared/ +bin/ +!bin/sources/ +node_modules/ +*yarn* \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..c6635b3 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ocoge +Ohiwa Code Generator \ No newline at end of file diff --git a/fonts/Pakchee-R.otf b/fonts/Pakchee-R.otf new file mode 100644 index 0000000..8c2bae3 Binary files /dev/null and b/fonts/Pakchee-R.otf differ diff --git a/fonts/SourceHanCodeJP-Light.otf b/fonts/SourceHanCodeJP-Light.otf new file mode 100644 index 0000000..c5e7099 Binary files /dev/null and b/fonts/SourceHanCodeJP-Light.otf differ diff --git a/fonts/SourceHanCodeJP-Normal.otf b/fonts/SourceHanCodeJP-Normal.otf new file mode 100644 index 0000000..c542085 Binary files /dev/null and b/fonts/SourceHanCodeJP-Normal.otf differ diff --git a/fonts/SourceHanCodeJP-Regular.otf b/fonts/SourceHanCodeJP-Regular.otf new file mode 100644 index 0000000..4edcf71 Binary files /dev/null and b/fonts/SourceHanCodeJP-Regular.otf differ diff --git a/fonts/SourceHanCodeJP.otf b/fonts/SourceHanCodeJP.otf new file mode 100644 index 0000000..c5e7099 Binary files /dev/null and b/fonts/SourceHanCodeJP.otf differ diff --git a/fonts/averia-sans-libre-v7-latin-regular.woff2 b/fonts/averia-sans-libre-v7-latin-regular.woff2 new file mode 100644 index 0000000..d6b7f06 Binary files /dev/null and b/fonts/averia-sans-libre-v7-latin-regular.woff2 differ diff --git a/fonts/fa-brands-400.woff2 b/fonts/fa-brands-400.woff2 new file mode 100644 index 0000000..e2bfe66 Binary files /dev/null and b/fonts/fa-brands-400.woff2 differ diff --git a/fonts/fa-solid-900.woff2 b/fonts/fa-solid-900.woff2 new file mode 100644 index 0000000..92c4d57 Binary files /dev/null and b/fonts/fa-solid-900.woff2 differ diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..505b876 Binary files /dev/null and b/icon.png differ diff --git a/img/saori.png b/img/saori.png new file mode 100644 index 0000000..2c1ce8e Binary files /dev/null and b/img/saori.png differ diff --git a/img/saori_hakodot.png b/img/saori_hakodot.png new file mode 100644 index 0000000..171310b Binary files /dev/null and b/img/saori_hakodot.png differ diff --git a/img/saori_hakodot_2x.png b/img/saori_hakodot_2x.png new file mode 100644 index 0000000..502fc77 Binary files /dev/null and b/img/saori_hakodot_2x.png differ diff --git a/img/scratch_cat.png b/img/scratch_cat.png new file mode 100644 index 0000000..421361f Binary files /dev/null and b/img/scratch_cat.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..25b0123 --- /dev/null +++ b/index.html @@ -0,0 +1,1768 @@ + + + + + + + + + + + +
Javascript Code:
+

+  
+  
+  CLI
+  
+ +
+
+ + + +
+
+ +
+ + +
+ + + + + + + +
+
+ + +
+
+ + +
+
+

+
+
+
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..492f147 --- /dev/null +++ b/index.js @@ -0,0 +1,108 @@ +const { app, BrowserWindow, Menu, session } = require('electron'); + +/** Force disable security warning */ +process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the JavaScript object is garbage collected. +let win + +function createWindow() { + // Create the browser window. + win = new BrowserWindow({ + /** Icon */ + icon: "./icon.png", + width: 800, + height: 600, + webPreferences: { + nodeIntegration: true + } + }) + /** Maximize Window when launch */ + win.maximize(); + + // and load the index.html of the app. + win.loadFile('index.html') + + // Open the DevTools. + // win.webContents.openDevTools() + + // Emitted when the window is closed. + win.on('closed', () => { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + win = null + }) + + /** For SkyWay */ + session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { + details.requestHeaders['Origin'] = 'electron://localhost'; + callback({ + cancel: false, + requestHeaders: details.requestHeaders + }); + }); +} + +// This method will be called when Electron has finished +// initialization and is ready to create browser windows. +// Some APIs can only be used after this event occurs. +// app.on('ready', createWindow) +app.on('ready', () => { + createWindow(); + /** Custom Menu */ + let template = [ + { + label: 'Menu', + submenu: [ + { + label: 'Quit', + click: () => { + app.quit(); + }, + accelerator: "CommandOrControl+Q" + }, + { + label: 'Toggle Developer Tools', + click: () => { + win.webContents.toggleDevTools() + }, + accelerator: "F12" + }, + { + label: 'Reload', + click: () => { + win.reload(); + }, + accelerator: "F5" + } + ] + } + ] + const menu = Menu.buildFromTemplate(template); + Menu.setApplicationMenu(menu); + win.setMenuBarVisibility(false); +}) + + +// Quit when all windows are closed. +app.on('window-all-closed', () => { + // On macOS it is common for applications and their menu bar + // to stay active until the user quits explicitly with Cmd + Q + if (process.platform !== 'darwin') { + app.quit() + } +}) + +app.on('activate', () => { + // On macOS it's common to re-create a window in the app when the + // dock icon is clicked and there are no other windows open. + if (win === null) { + createWindow() + } +}) + +// In this file you can include the rest of your app's specific main process +// code. You can also put them in separate files and require them here. + diff --git a/local_modules/ocoge_pigpiod/binding.gyp b/local_modules/ocoge_pigpiod/binding.gyp new file mode 100644 index 0000000..fe79d75 --- /dev/null +++ b/local_modules/ocoge_pigpiod/binding.gyp @@ -0,0 +1,10 @@ +{ "targets": + [ { "target_name" : "ocoge_pigpiod" + , "sources" : [ "ocoge_pigpiod.cpp" ] + , "defines" : [ "NAPI_DISABLE_CPP_EXCEPTIONS" ] + , "include_dirs" : [ " +#include +#include +#include + +using namespace Napi; + +int pi = 0; + +Value Usleep(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 1) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + usleep(info[0].As().DoubleValue()); + + return env.Null(); +} + + +// pigpio 初期化 +Value Start(const CallbackInfo& info) +{ + Env env = info.Env(); + pi = pigpio_start(0, 0); + return env.Null(); +} +// リモート +Value StartRemote(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsString() || !info[1].IsString()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + std::string addrStr = info[0].As().Utf8Value(); + std::string portStr = info[1].As().Utf8Value(); + + pi = pigpio_start(&addrStr[0], &portStr[0]); + + return env.Null(); +} + +// pigpio 後始末 +Value Stop(const CallbackInfo& info) +{ + Env env = info.Env(); + pigpio_stop(pi); + return env.Null(); +} + +// GPIO 端子のモードを設定 +Value SetMode(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int gpio = info[0].As().DoubleValue(); + unsigned int mode = info[1].As().DoubleValue(); + + return Number::New(env, + set_mode(pi, gpio, mode) + ); +} + +// GPIO 端子のモードを取得 +Value GetMode(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 1) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int gpio = info[0].As().DoubleValue(); + + return Number::New(env, + get_mode(pi, gpio) + ); +} + +// GPIOの内部プルアップ/ダウン抵抗の設定/クリア +Value SetPullUpDown(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int gpio = info[0].As().DoubleValue(); + unsigned int pud = info[1].As().DoubleValue(); + + return Number::New(env, + set_pull_up_down(pi, gpio, pud) + ); +} + +// GPIOの電圧を読む +Value Read(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 1) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int gpio = info[0].As().DoubleValue(); + + return Number::New(env, + gpio_read(pi, gpio) + ); +} + +// GPIO の電圧をセットする +Value Write(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int gpio = info[0].As().DoubleValue(); + unsigned int value = info[1].As().DoubleValue(); + + return Number::New(env, + gpio_write(pi, gpio, value) + ); + +} + +// サーボパルス幅をセットする +Value SetServoPulsewidth(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int user_gpio = info[0].As().DoubleValue(); + unsigned int pulsewidth = info[1].As().DoubleValue(); + + return Number::New(env, + set_servo_pulsewidth(pi, user_gpio, pulsewidth) + ); +} + +// PWM周波数を設定する +Value SetPwmFrequency(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int user_gpio = info[0].As().DoubleValue(); + unsigned int frequency = info[1].As().DoubleValue(); + + return Number::New(env, + set_PWM_frequency(pi, user_gpio, frequency) + ); +} + +// PWMのレンジを設定する +Value SetPwmRange(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int user_gpio = info[0].As().DoubleValue(); + unsigned int range = info[1].As().DoubleValue(); + + return Number::New(env, + set_PWM_range(pi, user_gpio, range) + ); +} + +// PWMのデューティ比を指定して出力を開始する +Value SetPwmDutycycle(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int user_gpio = info[0].As().DoubleValue(); + unsigned int dutycycle = info[1].As().DoubleValue(); + + return Number::New(env, + set_PWM_dutycycle(pi, user_gpio, dutycycle) + ); +} + +// シリアルポートを開く +Value SerialOpen(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 3) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsString() || !info[1].IsNumber() || !info[2].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + std::string ser_tty = info[0].As().Utf8Value(); + // char *c = new char[ser_tty.size()+1]; + // std::strcpy(c, ser_tty.c_str()); + // &ser_tty[0] で参照できるらしいけど危険? + + unsigned int baud = info[1].As().DoubleValue(); + unsigned int ser_flags = info[2].As().DoubleValue(); + + return Number::New(env, + serial_open(pi, &ser_tty[0], baud, ser_flags) + ); +} + +// シリアルポートを閉じる +Value SerialClose(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 1) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + + return Number::New(env, + serial_close(pi, handle) + ); +} + +// シリアルデバイスからデータを読む +Value SerialRead(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + unsigned int count = info[1].As().DoubleValue(); + char buf[count+1]; + for (unsigned int i = 0; i <= count; i++) + { + buf[i] = 0; + } + serial_read(pi, handle, buf, count); + return String::New(env, + buf + ); +} + +// シリアルデバイスにバイト列を書き込む(data: string) +Value SerialWrite(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsString()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + std::string buf = info[1].As().Utf8Value(); + + unsigned int count = buf.length(); + + return Number::New(env, + serial_write(pi, handle, &buf[0], count) + ); +} + +// I2Cバスアドレスのデバイスのハンドルを返す +Value I2cOpen(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 3) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int i2c_bus = info[0].As().DoubleValue(); + unsigned int i2c_addr = info[1].As().DoubleValue(); + unsigned int i2c_flags = info[2].As().DoubleValue(); + + return Number::New(env, + i2c_open(pi, i2c_bus, i2c_addr, i2c_flags) + ); +} + +// オープン済みI2Cハンドルを閉じる +Value I2cClose(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 1) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + + return Number::New(env, + i2c_close(pi, handle) + ); +} + +// I2Cハンドルに関連付けられているデバイスの指定されたレジスタに1バイトを書き込む +Value I2cWriteByteData(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 3) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + unsigned int i2c_reg = info[1].As().DoubleValue(); + unsigned int bVal = info[2].As().DoubleValue(); + + return Number::New(env, + i2c_write_byte_data(pi, handle, i2c_reg, bVal) + ); +} + +// I2Cハンドルに関連付けられているデバイスの指定されたレジスタから1バイトを読み込む +Value I2cReadByteData(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + unsigned int i2c_reg = info[1].As().DoubleValue(); + + return Number::New(env, + i2c_read_byte_data(pi, handle, i2c_reg) + ); +} + +// I2Cハンドルに関連付けられているデバイスの指定されたレジスタから単一の16ビットワードを読み取る +Value I2cReadWordData(const CallbackInfo& info) +{ + Env env = info.Env(); + if (info.Length() < 2) + { + TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + return env.Null(); + } + if (!info[0].IsNumber() || !info[1].IsNumber()) + { + TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException(); + return env.Null(); + } + + unsigned int handle = info[0].As().DoubleValue(); + unsigned int i2c_reg = info[1].As().DoubleValue(); + + return Number::New(env, + i2c_read_word_data(pi, handle, i2c_reg) + ); +} + +Object +Init(Env env, Object exports) +{ + exports.Set(String::New(env, "usleep"), Function::New(env, Usleep)); + exports.Set(String::New(env, "start"), Function::New(env, Start)); + exports.Set(String::New(env, "start_remote"), Function::New(env, StartRemote)); + exports.Set(String::New(env, "stop"), Function::New(env, Stop)); + exports.Set(String::New(env, "set_mode"), Function::New(env, SetMode)); + exports.Set(String::New(env, "get_mode"), Function::New(env, GetMode)); + exports.Set(String::New(env, "set_pull_up_down"), Function::New(env, SetPullUpDown)); + exports.Set(String::New(env, "read"), Function::New(env, Read)); + exports.Set(String::New(env, "write"), Function::New(env, Write)); + exports.Set(String::New(env, "set_servo_pulsewidth"), Function::New(env, SetServoPulsewidth)); + exports.Set(String::New(env, "set_PWM_frequency"), Function::New(env, SetPwmFrequency)); + exports.Set(String::New(env, "set_PWM_range"), Function::New(env, SetPwmRange)); + exports.Set(String::New(env, "set_PWM_dutycycle"), Function::New(env, SetPwmDutycycle)); + exports.Set(String::New(env, "serial_open"), Function::New(env, SerialOpen)); + exports.Set(String::New(env, "serial_close"), Function::New(env, SerialClose)); + exports.Set(String::New(env, "serial_read"), Function::New(env, SerialRead)); + exports.Set(String::New(env, "serial_write"), Function::New(env, SerialWrite)); + exports.Set(String::New(env, "i2c_open"), Function::New(env, I2cOpen)); + exports.Set(String::New(env, "i2c_close"), Function::New(env, I2cClose)); + exports.Set(String::New(env, "i2c_write_byte_data"), Function::New(env, I2cWriteByteData)); + exports.Set(String::New(env, "i2c_read_byte_data"), Function::New(env, I2cReadByteData)); + exports.Set(String::New(env, "i2c_read_word_data"), Function::New(env, I2cReadWordData)); + return exports; +} + +NODE_API_MODULE( ocoge_pigpiod, Init ) \ No newline at end of file diff --git a/local_modules/ocoge_pigpiod/package.json b/local_modules/ocoge_pigpiod/package.json new file mode 100644 index 0000000..057c637 --- /dev/null +++ b/local_modules/ocoge_pigpiod/package.json @@ -0,0 +1,11 @@ +{ + "name": "ocoge_pigpiod", + "version": "0.0.1", + "main": "index.js", + "private": true, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^1.7.1" + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..40be0e4 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "ocoge", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "scripts": { + "start": "electron .", + "postinstall": "electron-rebuild" + }, + "devDependencies": { + "electron": "^7.1.8", + "electron-rebuild": "^1.8.8" + }, + "dependencies": { + "axios": "^0.19.1", + "node-dht-sensor": "^0.4.0", + "nodemailer": "^6.4.2", + "ocoge_pigpiod": "file:./local_modules/ocoge_pigpiod" + } +} diff --git a/pxt-blockly/LICENSE b/pxt-blockly/LICENSE new file mode 100644 index 0000000..afc627a --- /dev/null +++ b/pxt-blockly/LICENSE @@ -0,0 +1,25 @@ +PXT Blockly fork + +The MIT License (MIT) + +Copyright (c) Microsoft Corporation + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pxt-blockly/README.md b/pxt-blockly/README.md new file mode 100644 index 0000000..24ddaf0 --- /dev/null +++ b/pxt-blockly/README.md @@ -0,0 +1,70 @@ +# Blockly (Microsoft MakeCode fork) + +This is a fork of [Blockly](https://github.com/google/blockly/), an open source visual programming environment. +The fork is maintained by the Microsoft MakeCode team, and is used to power the blocks environment in [PXT](https://github.com/Microsoft/pxt). + + +Major additions and changes in this fork: +* [scratch-blocks](https://github.com/llk/scratch-blocks) rendering of the blocks [block_render_svg.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/block_render_svg.js) +* Using insertion markers instead of dragged connections [insertion_marker_manager.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/insertion_marker_manager.js) +* Inverted and coloured toolbox modes [toolbox.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/toolbox.js#L428) +* Supports disabled categories [toolbox.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/toolbox.js#L360) +* Supports icons in the toolbox +* Adds a number slider field [field_slider.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/field_slider.js) +* Zoom in / out with touch gestures [touch_gesture.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/touch_gesture.js) +* Workspace comments that appear like sticky notes [workspace_comment.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/workspace_comment.js) +* A number of Edge & IE fixes +* Support underlining and icons in flyout labels [flyout_button.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/flyout_button.js#L203) +* Support for multiple flyouts per toolbox for performance reasons [pxt_blockly_functions.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/pxt_blockly_functions.js#L650) + +## Prerequisites + +* node, npm +* python + +## Development + +``` +git clone https://github.com/google/closure-library +cd closure-library +git checkout v20180805 +cd ../ +git clone https://github.com/Microsoft/pxt-blockly +cd pxt-blockly +npm install . +``` + +## Building + +* `gulp build` to build blockly (install ``gulp`` if needed ``npm install -g gulp``) + +## Update Blockly.d.ts + +* `gulp typings` to regenerate blockly.d.ts + +## Testing local changes in PXT + +* `gulp publish` from the ``develop`` branch to generate the blockly-compressed and blocks-compressed files, and copy them into the pxt-blockly node module folder +* run `pxt clean && pxt serve` in the **target** directory (eg pxt-arcade, or pxt-minecraft) + +**Make sure you've checked out the correct closure-library (see above)** + +See [more tips about **pxt+pxt-blockly** testing](https://github.com/Microsoft/pxt/tree/master/scripts). + +## Updating pxt-blockly in PXT + +* `gulp bump` to bump blockly version, commit, and tag. + +* After the Travis has deployed the package to npm, update the pxt-blockly version in `package.json` in the pxt repo. + +## Playground + +There is a playground manual testing page at [tests/playground.html](./tests/playground.html), which requires no build step or server running. + +`open tests/playground.html` + +## License + +The original Google/Blockly is licensed under Apache License (Version 2.0). + +New code is licensed under MIT. diff --git a/pxt-blockly/THIRD-PARTY-NOTICES.txt b/pxt-blockly/THIRD-PARTY-NOTICES.txt new file mode 100644 index 0000000..3b8f777 --- /dev/null +++ b/pxt-blockly/THIRD-PARTY-NOTICES.txt @@ -0,0 +1,430 @@ +/*!----------------- PXT Blockly ThirdPartyNotices ------------------------------------------------------- + +The Microsoft Blockly fork uses third party material from the projects listed below. +The original copyright notice and the license under which Microsoft +received such third party material are set forth below. Microsoft +reserves all other rights not expressly granted, whether by +implication, estoppel or otherwise. + +In the event that we accidentally failed to list a required notice, please +bring it to our attention. Post an issue or email us: + + yelmteam@microsoft.com + +--------------------------------------------- +Third Party Code Components +--------------------------------------------- + +----------------- google/blockly ------------------- + +Copyright 2013 Google Inc + + Apache License + Version 2.0, January 2011 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +--------------------------------------------- + +%% gulp-git 2.9.0 NOTICES AND INFORMATION BEGIN HERE (https://registry.npmjs.org/gulp-git/-/gulp-git-2.9.0.tgz) +========================================= +The MIT License + +Copyright (c) 2015 Steve Lacy slacy.me + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +========================================= +END OF gulp-git NOTICES AND INFORMATION + +%% semver 6.6.0 NOTICES AND INFORMATION BEGIN HERE (https://registry.npmjs.org/semver/-/semver-6.0.0.tgz) +========================================= +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +========================================= +END OF semver NOTICES AND INFORMATION + + +%% Closure Library v20190729 NOTICES AND INFORMATION BEGIN HERE (https://github.com/google/closure-library/archive/v20190729.tar.gz) +========================================= + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +========================================= +END OF Closure Library NOTICES AND INFORMATION \ No newline at end of file diff --git a/pxt-blockly/blockly_compressed.js b/pxt-blockly/blockly_compressed.js new file mode 100644 index 0000000..05d1ee1 --- /dev/null +++ b/pxt-blockly/blockly_compressed.js @@ -0,0 +1,2402 @@ +// Do not edit this file; automatically generated by build.py. +'use strict'; + +var $jscomp=$jscomp||{};$jscomp.scope={};var COMPILED=!0,goog=goog||{};goog.global=this||self;goog.isDef=function(a){return void 0!==a};goog.isString=function(a){return"string"==typeof a};goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a}; +goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]&&c[d]!==Object.prototype[d]?c[d]:c[d]={}:c[d]=b}; +goog.define=function(a,b){var c=b;if(!COMPILED){var d=goog.global.CLOSURE_UNCOMPILED_DEFINES,e=goog.global.CLOSURE_DEFINES;d&&void 0===d.nodeType&&Object.prototype.hasOwnProperty.call(d,a)?c=d[a]:e&&void 0===e.nodeType&&Object.prototype.hasOwnProperty.call(e,a)&&(c=e[a])}return c};goog.FEATURESET_YEAR=2012;goog.DEBUG=!1;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1; +goog.provide=function(a){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');goog.constructNamespace_(a)};goog.constructNamespace_=function(a,b){if(!COMPILED){delete goog.implicitNamespaces_[a];for(var c=a;(c=c.substring(0,c.lastIndexOf(".")))&&!goog.getObjectByName(c);)goog.implicitNamespaces_[c]=!0}goog.exportPath_(a,b)}; +goog.getScriptNonce=function(a){if(a&&a!=goog.global)return goog.getScriptNonce_(a.document);null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document));return goog.cspNonce_};goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/;goog.cspNonce_=null;goog.getScriptNonce_=function(a){return(a=a.querySelector&&a.querySelector("script[nonce]"))&&(a=a.nonce||a.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(a)?a:""};goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/; +goog.module=function(a){if("string"!==typeof a||!a||-1==a.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+a+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide."); +if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)}; +goog.module.getInternal_=function(a){if(!COMPILED){if(a in goog.loadedModules_)return goog.loadedModules_[a].exports;if(!goog.implicitNamespaces_[a])return a=goog.getObjectByName(a),null!=a?a:null}return null};goog.ModuleType={ES6:"es6",GOOG:"goog"};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()};goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG}; +goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var a=goog.global.$jscomp;return a?"function"!=typeof a.getCurrentModulePath?!1:!!a.getCurrentModulePath():!1}; +goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0}; +goog.declareModuleId=function(a){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(a in goog.loadedModules_)throw Error('Module with namespace "'+a+'" already exists.');}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=a;else{var b=goog.global.$jscomp;if(!b||"function"!=typeof b.getCurrentModulePath)throw Error('Module with namespace "'+ +a+'" has been loaded incorrectly.');b=b.require(b.getCurrentModulePath());goog.loadedModules_[a]={exports:b,type:goog.ModuleType.ES6,moduleId:a}}};goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.forwardDeclare=function(a){};COMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&null!=goog.getObjectByName(a)},goog.implicitNamespaces_={"goog.module":!0}); +goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e=0;e>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid; +goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if("function"===typeof a.clone)return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)}; +goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')}); +a("es7",function(){return b("2 ** 2 == 4")});a("es8",function(){return b("async () => 1, true")});a("es9",function(){return b("({...rest} = {}), true")});a("es_next",function(){return!1});return{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(a,b){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var c=this.createRequiresTranspilation_();this.requiresTranspilation_=c.map;this.transpilationTarget_=this.transpilationTarget_|| +c.target}if(a in this.requiresTranspilation_)return this.requiresTranspilation_[a]?!0:!goog.inHtmlDocument_()||"es6"!=b||"noModule"in goog.global.document.createElement("script")?!1:!0;throw Error("Unknown language mode: "+a);},goog.Transpiler.prototype.transpile=function(a,b){return goog.transpile_(a,b,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(a){return a.replace(/<\/(SCRIPT)/ig,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={}; +this.idToPath_={};this.written_={};this.loadingDeps_=[];this.depsToLoad_=[];this.paused_=!1;this.factory_=new goog.DependencyFactory(goog.transpiler_);this.deferredCallbacks_={};this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(a,b){function c(){d&&(goog.global.setTimeout(d,0),d=null)}var d=b;if(a.length){for(var e=[],f=0;f\x3c/script>";b.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}else{var e=b.createElement("script");e.defer=goog.Dependency.defer_;e.async=!1;e.type="text/javascript";(d=goog.getScriptNonce())&&e.setAttribute("nonce",d);goog.DebugLoader_.IS_OLD_IE_? +(a.pause(),e.onreadystatechange=function(){if("loaded"==e.readyState||"complete"==e.readyState)a.loaded(),a.resume()}):e.onload=function(){e.onload=null;a.loaded()};e.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path;b.head.appendChild(e)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."), +a.loaded()):a.pause()},goog.Es6ModuleDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(a){function b(a,b){var c=b?'